/* Player view (/web/): movement -> level -> play. Shares app.css for dialogs, toast and the board. */
body.pv {
  --pv-bg: #0b0d14;
  --pv-card: rgba(255, 255, 255, 0.045);
  --pv-card-hi: rgba(255, 255, 255, 0.09);
  --pv-line: rgba(255, 255, 255, 0.09);
  --pv-text: #eef0f6;
  --pv-muted: #8f97ab;
  --pv-accent: #ffd23f;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(255, 90, 90, 0.12), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(90, 140, 255, 0.12), transparent 60%),
    var(--pv-bg);
  background-attachment: fixed;
  color: var(--pv-text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.pv[data-mv="smb"] { --pv-accent: #ff5a4f; }
body.pv[data-mv="celeste"] { --pv-accent: #ff6def; }
body.pv[data-mv="meatboy"] { --pv-accent: #e3262f; }

.pv-main { min-height: 100vh; display: grid; }
.pv-step { display: none; padding: 48px 32px; max-width: 1180px; margin: 0 auto; width: 100%; position: relative; }
body.pv[data-step="movement"] #stepMovement,
body.pv[data-step="play"] #stepPlay { display: block; animation: pv-in 0.25s ease-out; }
@keyframes pv-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.pv h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 32px; }
.pv-muted { color: var(--pv-muted); font-size: 13px; margin: 8px 0 0; }

/* the logo (or the name in type where the logo isn't served) */
.pv-logo { display: block; width: 50%; min-width: min(700px, 100%); height: auto; margin: 0 auto 36px; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55)); }
.pv-logo.pv-logo-small { width: auto; min-width: 0; height: 48px; margin: 0 8px 0 0; filter: none; }
.dropcard .pv-logo { min-width: 0; width: min(420px, 100%); margin: 0 auto 18px; }
.pv-logo-text { display: grid; justify-items: center; width: auto; min-width: 0; font-weight: 900; font-size: clamp(30px, 5vw, 54px); line-height: 0.95; letter-spacing: -0.02em; text-transform: uppercase; }
.pv-logo-text span:first-child { color: #ffd9a8; }
.pv-logo-text span:last-child { background: linear-gradient(90deg, #e3262f, #7fd3f2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pv-logo-small.pv-logo-text { font-size: 15px; height: auto; }

/* movement cards */
.pv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.pv-card {
  all: unset; box-sizing: border-box; cursor: pointer; position: relative; overflow: hidden;
  display: grid; grid-template-rows: 200px auto; border-radius: 22px;
  background: var(--pv-card); border: 1px solid var(--pv-line);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
/* the card under the pointer (or keyboard focus) lights up in its movement system's colour; while the
   pointer is over a card, no other card stays highlighted */
/* body.pv: beats app.css's button:hover:not(:disabled) */ body.pv .pv-card:hover, body.pv .pv-card:focus-visible {
  transform: translateY(-4px); border-color: var(--c); background: var(--pv-card-hi); outline: none;
  box-shadow: 0 0 0 1px var(--c), 0 14px 40px color-mix(in srgb, var(--c) 28%, transparent);
}
/* the card chosen with the arrows or a gamepad looks like the hovered one */
body.pv .pv-card.sel { transform: translateY(-4px); border-color: var(--c); background: var(--pv-card-hi); box-shadow: 0 0 0 1px var(--c), 0 14px 40px color-mix(in srgb, var(--c) 28%, transparent); }
body.pv .pv-cards:hover .pv-card:not(:hover) { transform: none; border-color: var(--pv-line); background: var(--pv-card); box-shadow: none; }
/* the main keys, once, under the cards */
.pv-menu-keys { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 88px; }
.pv-menu-keys .sep { width: 2px; height: 56px; margin: 0 10px; border-radius: 2px; background: var(--pv-line); }
.pv-menu-keys kbd {
  font: 800 34px ui-monospace, monospace; min-width: 84px; height: 84px; box-sizing: border-box; padding: 0 12px;
  display: grid; place-items: center; border-radius: 18px; color: var(--pv-text);
  background: linear-gradient(#2a2f3d, #1c2029); border: 1px solid #3a4152; border-bottom-width: 7px;
}
.pv-menu-keys kbd.pad { min-width: 112px; color: var(--pv-muted); transition: color 0.2s ease, border-color 0.2s ease; }
.pv-menu-keys kbd.pad svg { width: 64px; height: 40px; }
.pv-menu-keys kbd.pad.connected { color: var(--pv-text); border-color: #6a7488; } /* a gamepad is plugged in */
.pv-menu-keys kbd.arrow { font: 900 46px system-ui, sans-serif; line-height: 1; padding-bottom: 6px; } /* the monospace arrows are tiny */
.pv-card .art {
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--c) 35%, transparent), transparent 65%);
}
.pv-card canvas { image-rendering: pixelated; height: 128px; width: auto; max-width: 70%; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5)); }
.pv-card .art .fallback { font-size: 72px; }
.pv-card .txt { padding: 16px 22px 22px; text-align: center; }
.pv-card .name { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }

/* level cards */
.pv-levels { display: grid; gap: 28px; }
.pv-group h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pv-muted); }
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.pv-grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pv-level {
  all: unset; box-sizing: border-box; cursor: pointer; border-radius: 16px; padding: 14px 16px;
  background: var(--pv-card); border: 1px solid var(--pv-line); position: relative; overflow: hidden;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.pv-level::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--t); }
body.pv .pv-level:hover, body.pv .pv-level:focus-visible { transform: translateY(-2px); border-color: var(--pv-accent); background: var(--pv-card-hi); }
.pv-level .n { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pv-level .k { font-size: 12px; color: var(--pv-muted); }
.pv-level.course .n { font-size: 17px; }

/* play */
.pv-step.pv-play { max-width: none; padding: 20px 24px; }
body.pv[data-step="play"] #stepPlay { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.pv-stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pv-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pv-spacer { flex: 1; }

/* the movement and level dropdowns */
.pv-dd { position: relative; }
.pv-dd-btn {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 14px 0 10px; border-radius: 14px; max-width: 360px;
  background: var(--pv-card); border: 1px solid var(--pv-line);
  transition: background 0.12s ease, border-color 0.12s ease;
}
body.pv .pv-dd-btn:hover, body.pv .pv-dd-btn[aria-expanded="true"] { background: var(--pv-card-hi); border-color: color-mix(in srgb, var(--pv-accent) 60%, transparent); }
.pv-dd-btn:focus-visible { outline: 2px solid var(--pv-accent); outline-offset: 2px; }
#lvBtn { padding-left: 16px; }
.pv-dd-art {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--pv-accent) 40%, transparent), transparent 70%);
}
.pv-dd-art canvas, .pv-opt-art canvas { image-rendering: pixelated; max-width: 32px; max-height: 30px; }
.pv-dd-text { display: grid; line-height: 1.15; min-width: 0; }
.pv-dd-text small { color: var(--pv-accent); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; }
.pv-dd-text b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-caret {
  width: 0; height: 0; flex: none; margin-left: 4px;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--pv-muted);
  transition: transform 0.18s ease, border-top-color 0.12s ease;
}
body.pv .pv-dd-btn:hover .pv-caret { border-top-color: var(--pv-text); }
.pv-dd-btn[aria-expanded="true"] .pv-caret { transform: rotate(180deg); border-top-color: var(--pv-accent); }

.pv-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; min-width: 100%;
  display: grid; gap: 4px; padding: 8px; border-radius: 18px;
  background: rgba(20, 23, 33, 0.97); border: 1px solid var(--pv-line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); backdrop-filter: blur(12px);
  animation: pv-pop 0.14s ease-out;
}
.pv-pop[hidden] { display: none; }
@keyframes pv-pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pv-opt {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 8px 12px 8px 8px; border-radius: 12px; min-width: 280px;
}
body.pv .pv-opt:hover, body.pv .pv-opt:focus-visible { background: var(--pv-card-hi); }
.pv-opt[aria-checked="true"] { background: color-mix(in srgb, var(--c) 18%, transparent); }
.pv-opt-art {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%);
}
.pv-opt-name { font-weight: 700; font-size: 15px; }
.pv-opt-tag {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent);
}
.pv-pop-levels { width: min(760px, calc(100vw - 48px)); max-height: min(70vh, 640px); overflow: auto; gap: 20px; padding: 18px; }
.pv-level[aria-current="true"] { border-color: var(--pv-accent); background: var(--pv-card-hi); }
.pv-icon {
  all: unset; cursor: pointer; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--pv-card); border: 1px solid var(--pv-line); font-size: 16px; color: var(--pv-text);
}
body.pv .pv-icon:hover { background: var(--pv-card-hi); }
.pv-icon[aria-pressed="true"] { color: var(--pv-muted); text-decoration: line-through; }
.pv-icon:disabled { opacity: 0.4; cursor: default; }
.pv .screen-box { display: flex; justify-content: center; }
.pv #screen { border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--pv-line); outline: none; }
.pv #screen:focus-visible { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--pv-accent); }

.pv-side { display: grid; gap: 16px; }
.pv-panel { background: var(--pv-card); border: 1px solid var(--pv-line); border-radius: 20px; padding: 18px 20px; }
.pv-panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.pv-panel h2 { margin: 0; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pv-accent); }
.pv-panel-head span { color: var(--pv-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.pv-board li { display: grid; grid-template-columns: 2.2em 3.4em 1fr auto auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 10px; }
.pv-board li:nth-child(1) b { color: var(--pv-accent); }
.pv-board li.mine { background: rgba(255, 210, 63, 0.12); }
.pv-board li .d { color: var(--pv-muted); font-size: 12px; }
.pv-board li button { all: unset; cursor: pointer; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--pv-card-hi); font-size: 11px; }
body.pv .pv-board li button:hover { background: var(--pv-accent); color: #111; }
.pv-wide {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%; margin-top: 12px; padding: 11px; border-radius: 12px; text-align: center;
  background: var(--pv-card-hi); font-weight: 650;
}
body.pv .pv-wide:hover:not(:disabled) { background: var(--pv-accent); color: #111; }
.pv-wide:disabled { opacity: 0.35; cursor: default; }

/* controls with big keycaps */
.pv-keys { display: grid; gap: 12px; }
.pv-keys { grid-template-columns: max-content 1fr; column-gap: 16px; }
.pv-key { display: contents; }
.pv-key .caps { display: flex; gap: 6px; }
.pv-keys .pad { grid-column: 1 / -1; }
.pv-key kbd {
  font: 700 18px ui-monospace, monospace; min-width: 42px; height: 42px; padding: 0 8px; box-sizing: border-box;
  display: grid; place-items: center; border-radius: 10px; color: var(--pv-text);
  background: linear-gradient(#2a2f3d, #1c2029); border: 1px solid #3a4152; border-bottom-width: 4px; margin: 0;
}
.pv-key .what { font-size: 15px; align-self: center; }
.pv-keys .pad { color: var(--pv-muted); font-size: 12px; }

@media (max-width: 980px) {
  body.pv[data-step="play"] #stepPlay { grid-template-columns: 1fr; }
  .pv-step { padding: 32px 16px; }
}
