:root {
  --bg: #0c0a09;
  --panel: #1a1613;
  --panel2: #231e1a;
  --line: #342d27;
  --text: #f3ece0;
  --dim: #a89d8e;
  --accent: #ff5b1f;
  --on-accent: #1a0a03;
  --ok: #3fbf6a;
  --b0: #3fbf6a; --b1: #a6d44a; --b2: #f2c230; --b3: #ff8a1f; --b4: #e5413a; --none: #17130f;
  --bandc: #f2c230;
  --miss: #3d3631;
  --display: "Avenir Next Condensed", "Impact", "Haettenschweiler", "Arial Narrow", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pad: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; -webkit-text-size-adjust: 100%; }
#app { position: fixed; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background:
  radial-gradient(120% 60% at 50% -10%, #2a1a12 0%, transparent 60%), var(--bg); }
button { font: inherit; color: inherit; }
a { color: inherit; }

.screen { height: 100%; display: flex; flex-direction: column; padding: max(var(--pad), env(safe-area-inset-top)) var(--pad) max(var(--pad), env(safe-area-inset-bottom)); position: relative; overflow: hidden; }
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; display: block; }
.screen.center { justify-content: flex-start; }
.grow { flex: 1 1 auto; min-height: 12px; }

.kicker { margin: 8px 0 0; font: 700 14px/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.title { margin: 10px 0 0; font: 900 clamp(76px, 25vw, 124px)/.84 var(--display); letter-spacing: -.01em; text-transform: uppercase; display: flex; flex-direction: column; }
.title.small { font-size: 56px; flex-direction: row; gap: .3em; }
.title.round { font-size: clamp(60px, 19vw, 96px); color: var(--text); }
.accent { color: var(--accent); }
.how { margin: 20px 0 0; font-size: 19px; line-height: 1.4; color: var(--text); max-width: 26em; }

.btn { appearance: none; border: 0; cursor: pointer; min-height: 56px; border-radius: 14px; padding: 0 20px; font: 800 18px/1 var(--body); letter-spacing: .04em; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:active { filter: brightness(.9); }
.btn.big { width: 100%; min-height: 64px; font-size: 20px; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 2px solid var(--line); font-size: 15px; letter-spacing: .06em; }
.btn:disabled { cursor: default; }
.btn.load { position: relative; overflow: hidden; background: var(--panel2); color: var(--text); border: 2px solid var(--line); }
.btn.load .fill { position: absolute; inset: 0; background: var(--accent); opacity: .85; transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.btn.load .inner { position: relative; mix-blend-mode: normal; }
.btn .inner { display: inline-flex; gap: 14px; align-items: baseline; justify-content: center; }
.btn .cnt { font-weight: 600; font-size: 15px; opacity: .8; letter-spacing: .02em; text-transform: none; }
.btn.load .inner { text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.btn.load:not(:disabled) .fill { display: none; }

/* start */
.start .disc { position: absolute; left: 50%; bottom: -88vw; width: 132vw; height: 132vw; max-width: 760px; max-height: 760px; transform: translateX(-50%); border-radius: 50%;
  background:
    radial-gradient(circle, var(--bg) 0 3%, var(--accent) 3.2% 20%, #14100d 20.2% 21%, transparent 21.2%),
    conic-gradient(from 20deg, rgba(255,255,255,0) 0 10%, rgba(255,255,255,.10) 14%, rgba(255,255,255,0) 20% 60%, rgba(255,255,255,.10) 64%, rgba(255,255,255,0) 70%),
    repeating-radial-gradient(circle, #14110f 0 2px, #1f1a16 2px 4px);
  box-shadow: 0 0 0 2px #0b0908, 0 -20px 80px rgba(255,91,31,.18); animation: spin 18s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }
.start > *:not(.disc) { position: relative; z-index: 1; }
.start .btn { margin-top: 18px; }

/* header + clock */
.hd { display: flex; justify-content: space-between; align-items: baseline; min-height: 40px; padding-top: 4px; }
.rl { font: 800 15px/1.2 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.sn { font: 700 16px/1.2 var(--body); color: var(--dim); font-variant-numeric: tabular-nums; }
/* play */
.replay { position: relative; width: 72px; flex: 0 0 auto; aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background:
  radial-gradient(circle, var(--accent) 0 26%, #14100d 26.5% 28%, transparent 28.5%),
  repeating-radial-gradient(circle, #14110f 0 2px, #211b17 2px 4px); box-shadow: 0 10px 40px rgba(0,0,0,.6); display: grid; place-items: center; }
.replay:active { transform: scale(.97); }
.replay .ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .track { stroke: var(--line); }
.ring .sweep { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 289.03; stroke-dashoffset: 289.03; }
.ring.go .sweep { animation: sweep var(--d, 2s) linear forwards; }
@keyframes sweep { from { stroke-dashoffset: 289.03; } to { stroke-dashoffset: 0; } }
.replay .icon { width: 26%; height: 26%; fill: var(--on-accent); position: relative; margin-left: 4%; }
.how.tight { margin-top: 10px; color: var(--dim); font-size: 17px; }
.hd { gap: 10px; }
.hd .rl { white-space: nowrap; }
.pips { display: inline-flex; gap: 5px; align-items: center; }
.pip { width: 9px; height: 9px; border-radius: 50%; background: var(--panel2); border: 1.5px solid var(--line); }
.pip.past { background: var(--line); }
.pip.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(255,91,31,.7); }
.giveup { appearance: none; border: 0; background: none; color: var(--dim); font: 600 14px/1 var(--body); text-decoration: underline; text-underline-offset: 3px; min-height: 40px; padding: 0 2px 0 8px; cursor: pointer; }
.hero { display: flex; align-items: center; gap: 12px; padding: 8px 0 10px; flex: 0 0 auto; }
.worth { flex: 1; min-width: 0; }
.numrow { display: flex; align-items: baseline; gap: 6px; }
.pnum { font: 900 58px/.9 var(--display); font-variant-numeric: tabular-nums; color: var(--text); min-width: 2.1ch; }
.pnum.warn { color: #ff4d3a; }
.x2 { font: 800 18px/1 var(--display); color: var(--accent); }
.barbox { height: 5px; margin-top: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.pbar2 { display: block; height: 100%; width: 100%; background: var(--ok); transform-origin: left; }
.pbar2.warn { background: #ff4d3a; }
.chip { display: block; margin-top: 5px; min-height: 16px; font: 800 12px/16px var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.btn.more { flex: 0 0 auto; min-height: 56px; padding: 0 14px; font-size: 15px; letter-spacing: .02em; background: var(--panel2); color: var(--text); border: 2px solid var(--accent); text-transform: none; white-space: nowrap; }
.btn.more:disabled { border-color: var(--line); color: var(--dim); }
.btn.more:active:not(:disabled) { filter: brightness(1.3); }
.ansbox { position: relative; flex: 0 0 auto; }
.ansbox .field { width: 100%; height: 54px; }
.fb { position: absolute; right: 14px; top: 0; bottom: 0; display: flex; align-items: center; font: 800 15px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); opacity: 0; pointer-events: none; }
.fb.accent { color: var(--accent); }
.fb.show { animation: fbshow 1.3s ease forwards; }
@keyframes fbshow { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.field.shake { animation: shake .4s ease; border-color: var(--accent); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.ans { display: flex; gap: 10px; flex: 0 0 auto; }
.field { flex: 1; min-width: 0; height: 58px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); color: var(--text); padding: 0 16px; font: 500 18px var(--body); outline: none; -webkit-appearance: none; appearance: none; }
.field::placeholder { color: #7c7165; }
.field:focus { border-color: var(--accent); }
.results { list-style: none; margin: 8px 0 0; padding: 0; flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.results li { border-bottom: 1px solid var(--line); }
.row { display: block; width: 100%; min-height: 48px; padding: 0 4px; border: 0; background: none; text-align: left; font-size: 18px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.row:active { background: var(--panel2); }
.row .t { font-weight: 700; color: var(--text); }
.row .b { color: var(--dim); }
.results .hint { border: 0; padding: 14px 4px; color: var(--dim); font-size: 16px; line-height: 1.4; }

/* keyboard up: compact hero so pips, points, replay, box and 4 rows fit in ~330px */
.kb .hero { padding: 4px 0 6px; gap: 10px; }
.kb .replay { width: 52px; }
.kb .replay .ring { inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); }
.kb .pnum { font-size: 46px; }
.kb .hd { min-height: 32px; padding-top: 0; }
.kb .giveup { min-height: 32px; }
.kb .btn.more { min-height: 48px; }
.kb .ansbox .field { height: 48px; }
.kb .barbox { margin-top: 4px; }
.kb .chip { margin-top: 2px; min-height: 14px; line-height: 14px; }
.kb .row { min-height: 40px; font-size: 17px; }
.kb .results { margin-top: 4px; }
.kb .screen { padding-top: 6px; padding-bottom: 6px; }

/* payoff */
.payoff { --cv: min(70vw, 30vh, 300px); overflow-y: auto; }
.payoff .flip { width: var(--cv); height: var(--cv); margin: 8px auto 0; perspective: 1100px; }
.flip-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: flip .9s .15s cubic-bezier(.3,.7,.2,1) forwards; }
@keyframes flip { to { transform: rotateY(180deg); } }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 4px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.65); background: var(--panel); }
.face.front { transform: rotateY(180deg); }
.face img { width: 100%; height: 100%; display: block; object-fit: cover; }
.vinyl { width: 100%; height: 100%; display: grid; place-items: center; background: repeating-radial-gradient(circle, #14110f 0 2px, #211b17 2px 4px); }
.vinyl i { width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #14100d; }
.cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; padding: 8%; text-align: center; background: repeating-radial-gradient(circle at 50% 50%, #1b1613 0 3px, #241d18 3px 6px); font: 800 clamp(14px, 5vw, 28px)/1.05 var(--display); text-transform: uppercase; color: var(--accent); }
.pbarbox { height: 3px; margin: 14px auto 0; width: var(--cv); background: var(--panel2); border-radius: 2px; overflow: hidden; }
.pbar { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); animation: grow linear forwards; }
@keyframes grow { to { transform: scaleX(1); } }
.pts { display: flex; align-items: baseline; gap: 12px; margin-top: 14px; }
.pts b { font: 900 44px/1 var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.payoff.win .pts b { color: var(--ok); }
.pts span { flex: 1; min-width: 0; font: 700 15px/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.info { margin-top: 10px; min-height: 0; }
.song { margin: 0; font: 900 clamp(32px, 9.5vw, 48px)/.98 var(--display); text-transform: uppercase; letter-spacing: .005em; overflow-wrap: anywhere; }
.band { margin: 6px 0 0; font: 700 20px/1.2 var(--body); color: var(--accent); }
.album { margin: 4px 0 0; font-size: 16px; line-height: 1.3; color: var(--dim); }
.said { margin: 8px 0 0; font-size: 15px; color: var(--dim); }
.payoff .btn { margin-top: 8px; flex: 0 0 auto; }
.payoff .am { padding-top: 6px; min-height: 44px; }
.am { display: block; margin: 0 auto; padding: 12px 8px 4px; min-height: 48px; text-align: center; font: 600 14px/1.6 var(--body); color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }

/* round card */
.roundcard .btn { margin-top: 18px; }
.roundcard .title { margin-top: 24px; }

/* recap */
.recap { padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.score { display: flex; align-items: baseline; gap: 12px; margin-top: 10px; }
.score b { font: 900 clamp(96px, 30vw, 140px)/.85 var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.score span { font: 800 26px/1 var(--display); color: var(--dim); }
.squares { display: flex; gap: 6px; margin: 18px 0 0; }
.sq { display: inline-block; width: 26px; height: 26px; border-radius: 5px; background: var(--none); box-shadow: inset 0 0 0 1.5px #5a4f45; }
.sq.b0 { background: var(--b0); box-shadow: none; }
.sq.b1 { background: var(--b1); box-shadow: none; }
.sq.b2 { background: var(--b2); box-shadow: none; }
.sq.b3 { background: var(--b3); box-shadow: none; }
.sq.b4 { background: var(--b4); box-shadow: none; }
.squares .sq.gap { margin-left: 12px; }
.squares .sq { flex: 0 0 auto; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 4px; margin: 12px 0 18px; font-size: 14px; color: var(--dim); }
.legend .sq { width: 14px; height: 14px; border-radius: 3px; margin-left: 8px; }
.legend .sq:first-child { margin-left: 0; }
.note { margin: 14px 0 22px; font-size: 16px; line-height: 1.4; color: var(--dim); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--panel); border-radius: 14px; border-left: 5px solid #5a4f45; overflow: hidden; }
.card.b0 { border-left-color: var(--b0); }
.card.b1 { border-left-color: var(--b1); }
.card.b2 { border-left-color: var(--b2); }
.card.b3 { border-left-color: var(--b3); }
.card.b4 { border-left-color: var(--b4); }
.chead { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 10px 12px 10px 10px; border: 0; background: none; text-align: left; cursor: pointer; }
.thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 4px; overflow: hidden; background: var(--panel2); }
.thumb img, .thumb .cover-fallback { width: 100%; height: 100%; object-fit: cover; font-size: 10px; padding: 2px; }
.meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meta b { font-size: 17px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta span { font-size: 15px; color: var(--accent); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta em { font-style: normal; font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpts { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 40px; }
.cpts b { font: 900 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.cpts .sq { width: 14px; height: 14px; border-radius: 3px; }
.cbody { display: none; padding: 0 14px 12px; }
.card.open .cbody { display: block; }
.wavebox { position: relative; height: 84px; margin-top: 2px; cursor: pointer; }
.wave { display: block; width: 100%; height: 100%; }
.playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.cfoot { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--dim); min-height: 18px; }
.cbody .am { padding-top: 6px; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

@media (min-width: 700px) {
  #app { max-width: 560px; left: 50%; margin-left: -280px; width: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  .start .disc { animation: none; }
  .flip-in { animation-duration: .01s; animation-delay: 0s; }
}
