/* ═════════════════════════ Player (phone) ═════════════════════════ */
html, body { overscroll-behavior: none; }
#app { min-height: 100dvh; }
.screen {
  min-height: 100dvh; width: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-grad); display: grid; place-items: center; box-shadow: 0 6px 18px -6px rgba(139, 92, 246, .8); }
.brand-mark svg { width: 16px; height: 16px; color: #fff; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; max-width: 55%; }
.me-chip .avatar { width: 28px; height: 28px; font-size: 11px; }
.me-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 18px 0; }
.hero-title { font-size: clamp(30px, 9vw, 42px); line-height: 1.05; font-weight: 700; }
.lede { color: var(--muted); font-size: 16px; }
.phone-note { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-color: rgba(34, 211, 238, .3); background: rgba(34, 211, 238, .06); }
.phone-note .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(34, 211, 238, .14); color: var(--brand-2); }
.phone-note .ic svg { width: 22px; height: 22px; }
.phone-note b { display: block; font-size: 15px; margin-bottom: 3px; }
.phone-note span { font-size: 14px; color: var(--muted); line-height: 1.4; }
.temp-note { font-size: 12px; color: var(--dim); text-align: center; margin-top: 4px; }

/* Code entry */
.code-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; position: relative; }
.code-boxes input.hidden-input { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; height: 100%; caret-color: transparent; z-index: 2; }
.code-box {
  aspect-ratio: 1 / 1.15; border-radius: 18px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: clamp(34px, 11vw, 48px);
  background: rgba(255, 255, 255, .05); border: 1.5px solid var(--line-2);
  transition: border .15s, background .15s, transform .2s var(--spring);
}
.code-box.filled { background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .6); animation: pop .25s var(--spring); }
.code-box.cursor { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(34, 211, 238, .15); }
.code-boxes.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.error-text { color: #FDA4AF; font-weight: 600; font-size: 14px; min-height: 20px; text-align: center; }

/* Lobby */
.lobby-orb { position: relative; width: 180px; height: 180px; margin: 0 auto; display: grid; place-items: center; }
.lobby-orb .core { width: 96px; height: 96px; border-radius: 50%; background: var(--brand-grad); display: grid; place-items: center; box-shadow: 0 0 60px rgba(139, 92, 246, .55); z-index: 1; }
.lobby-orb .core svg { width: 44px; height: 44px; color: #fff; }
.lobby-orb i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(139, 92, 246, .5); animation: ripple 2.4s var(--ease) infinite; }
.lobby-orb i:nth-child(2) { animation-delay: .8s; }
.lobby-orb i:nth-child(3) { animation-delay: 1.6s; }
@keyframes ripple { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
.lecture-card { padding: 18px; display: grid; gap: 6px; }
.lecture-card .k { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-2); }
.lecture-card .t { font-family: var(--display); font-size: 19px; font-weight: 650; line-height: 1.2; }
.stat-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.big-count { font-family: var(--display); font-size: 56px; font-weight: 700; line-height: 1; text-align: center; }

/* Countdown */
.countdown-num { font-family: var(--display); font-size: min(42vw, 220px); font-weight: 700; line-height: 1; text-align: center; animation: cd 1s var(--ease) both; }
@keyframes cd { 0% { transform: scale(1.8); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(.85); opacity: .9; } }

/* Question */
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q-progress { font-weight: 700; font-size: 14px; color: var(--muted); }
.q-progress b { color: var(--text); font-family: var(--display); font-size: 18px; }
.q-ring { width: 58px; height: 58px; }
.q-ring .num { font-size: 20px; }
.time-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; margin: 12px 0 4px; }
.time-bar i { display: block; height: 100%; width: 100%; background: var(--brand-grad); transform-origin: left; border-radius: inherit; }
.time-bar.danger i { background: var(--bad); }
.q-text { font-family: var(--display); font-weight: 650; font-size: clamp(20px, 5.6vw, 25px); line-height: 1.22; margin: 14px 2px 18px; text-wrap: pretty; }
.opts { display: grid; gap: 11px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opts.two .opt { flex-direction: column; justify-content: center; text-align: center; min-height: 150px; font-size: 22px; }
.opts .opt.selected { transform: scale(1.02); box-shadow: 0 0 0 4px #fff, 0 10px 30px -6px var(--c); }
.opts .opt.selected .mark { opacity: 1; transform: none; }
.opts.has-sel .opt:not(.selected) { opacity: .5; filter: saturate(.7); }
.opts.locked .opt { pointer-events: none; }
.submit-dock { position: sticky; bottom: 0; margin-top: auto; padding-top: 16px; background: linear-gradient(to top, var(--bg) 55%, transparent); }
.submit-dock .hint { text-align: center; font-size: 13px; color: var(--dim); margin-top: 8px; }
.locked-card { margin-top: 16px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.locked-card .ic { width: 44px; height: 44px; border-radius: 12px; background: rgba(34, 211, 238, .12); color: var(--brand-2); display: grid; place-items: center; flex: none; }
.locked-card .ic svg { width: 22px; height: 22px; }
.locked-card b { display: block; font-size: 16px; }
.answer-meter { height: 4px; background: rgba(255, 255, 255, .08); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.answer-meter i { display: block; height: 100%; background: var(--brand-2); transition: width .4s var(--ease); }
.timeup { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(7, 10, 20, .7); backdrop-filter: blur(6px); z-index: 20; animation: rise .3s both; }
.timeup div { font-family: var(--display); font-size: 40px; font-weight: 700; }

/* Reveal */
.reveal { --tone: var(--good); text-align: center; }
.reveal.wrong { --tone: var(--bad); }
.reveal.none { --tone: #64748B; }
.reveal-bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--tone) 45%, transparent), transparent 70%); animation: rise .5s both; }
.verdict-ic { width: 104px; height: 104px; margin: 0 auto; border-radius: 50%; background: var(--tone); display: grid; place-items: center; box-shadow: 0 0 0 10px color-mix(in srgb, var(--tone) 25%, transparent), 0 20px 60px -10px var(--tone); animation: pop .55s var(--spring) both; }
.verdict-ic svg { width: 56px; height: 56px; color: #fff; }
.verdict { font-size: 40px; font-weight: 700; }
.points { display: inline-flex; align-items: baseline; gap: 6px; padding: 10px 22px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-family: var(--display); font-size: 30px; font-weight: 700; margin: 0 auto; }
.points small { font-size: 15px; color: var(--muted); }
.streak { display: inline-flex; align-items: center; gap: 6px; color: #FDBA74; font-weight: 700; justify-content: center; }
.streak svg { width: 20px; height: 20px; animation: beat 1.2s infinite; }
.correct-ans { padding: 14px 16px; display: flex; align-items: center; gap: 12px; text-align: left; }
.correct-ans .opt-dot { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.correct-ans .opt-dot svg { width: 16px; height: 16px; fill: #fff; }
.correct-ans small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.correct-ans b { font-weight: 650; }
.rank-line { font-size: 15px; color: var(--muted); }
.rank-line b { color: var(--text); }
.move { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 14px; }
.move svg { width: 12px; height: 12px; }
.move.up { color: var(--good); }
.move.down { color: var(--bad); }

/* Leaderboard / final */
.my-rank { text-align: center; display: grid; gap: 6px; }
.my-rank .r { font-family: var(--display); font-size: 88px; font-weight: 700; line-height: .95; }
.my-rank .r sup { font-size: .38em; vertical-align: top; position: relative; top: .35em; margin-left: 2px; }
.lb { display: grid; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.lb-row.me { background: rgba(139, 92, 246, .16); border-color: rgba(139, 92, 246, .5); }
.lb-row .pos { width: 26px; font-family: var(--display); font-weight: 700; color: var(--muted); text-align: center; }
.lb-row .nm { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-row.p1 .pos { color: var(--gold); }
.lb-row.p2 .pos { color: var(--silver); }
.lb-row.p3 .pos { color: var(--bronze); }
.gap-note { text-align: center; font-size: 14px; color: var(--muted); }
.final-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.final-stats .card { padding: 14px 10px; text-align: center; }
.final-stats b { display: block; font-family: var(--display); font-size: 24px; }
.final-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }
.medal { width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff8, transparent 40%), var(--medal, var(--brand)); box-shadow: 0 20px 60px -15px var(--medal, var(--brand)); animation: pop .7s var(--spring) both; }
.medal svg { width: 56px; height: 56px; color: #fff; }
