/* FactClash: game-show night. Mobile first, one screen, keyboard aware. */
:root {
  --bg: #140A2E; --panel: #231456; --panel2: #2E1B6C; --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.16);
  --ink: #F8F4FF; --muted: #B8ABE3; --dim: #7E70B4;
  --gold: #FFC83D; --gold2: #FFB000; --gold3: #B97A00; --goldInk: #2B1800;
  --pink: #FF4FA3; --cyan: #3DE0FF; --green: #35E39A; --red: #FF5C7A; --orange: #FF9A3D;
  --hud: 56px; --pad: 14px; --app-h: 100dvh;
  --c0:#FFC83D; --c1:#4F8CFF; --c2:#35E39A; --c3:#FF5C7A; --c4:#B77CFF; --c5:#FF9A3D; --c6:#3DE0FF; --c7:#FF6FC4; --c8:#A6E35A; --c9:#FFE066; --c10:#7B8CFF; --c11:#FF7F9F;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); }
body { color: var(--ink); font: 16px/1.4 Figtree, system-ui, sans-serif; -webkit-font-smoothing: antialiased; touch-action: manipulation; font-variant-numeric: tabular-nums; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }
a { color: var(--cyan); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13.5px; } .tiny { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.rowf { display: flex; align-items: center; gap: 10px; }
.center { text-align: center; }

/* ---------- stage lights ---------- */
.lights { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(60% 42% at 50% -6%, rgba(255,200,61,.30), transparent 70%),
    radial-gradient(38% 55% at -5% -5%, rgba(255,79,163,.20), transparent 62%),
    radial-gradient(38% 55% at 105% -5%, rgba(61,224,255,.16), transparent 62%),
    radial-gradient(70% 30% at 50% 108%, rgba(139,107,255,.25), transparent 70%),
    linear-gradient(180deg, #1F1150 0%, #150A33 55%, #10072A 100%); }
.lights::before, .lights::after { content: ""; position: absolute; top: -20%; width: 46%; height: 95%; filter: blur(18px); opacity: .5;
  background: linear-gradient(180deg, rgba(255,230,160,.22), rgba(255,230,160,0) 80%); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); }
.lights::before { left: 4%; transform: rotate(18deg); }
.lights::after { right: 4%; transform: rotate(-18deg); }
.lights.party::before { animation: sweepL 2.2s ease-in-out infinite alternate; opacity: .85; }
.lights.party::after { animation: sweepR 2.2s ease-in-out infinite alternate; opacity: .85; }
@keyframes sweepL { from { transform: rotate(30deg); } to { transform: rotate(-6deg); } }
@keyframes sweepR { from { transform: rotate(-30deg); } to { transform: rotate(6deg); } }

/* ---------- shell ---------- */
.app { position: fixed; left: 0; right: 0; top: 0; height: var(--app-h); z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 4px minmax(0,1fr) auto; padding-top: env(safe-area-inset-top); overflow: hidden; }
.hud, .dock, .stage { min-width: 0; }
.hud { height: var(--hud); display: flex; align-items: center; gap: 8px; padding: 0 12px; min-width: 0; }
.hud .mid { flex: 1; min-width: 0; text-align: center; font-weight: 700; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud .clock { font: 900 30px/1 Archivo; font-stretch: 112%; color: var(--gold); min-width: 42px; text-align: right; text-shadow: 0 0 18px rgba(255,200,61,.5); }
.hud .clock.hot { color: var(--red); animation: throb .5s ease-in-out infinite alternate; }
@keyframes throb { to { transform: scale(1.14); } }
.hud .pill { flex: none; height: 30px; padding: 0 11px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255,255,255,.08); font: 800 14px Archivo; }
.fuse { position: relative; background: rgba(255,255,255,.06); }
.fuse i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--gold2), #FFE08A); box-shadow: 0 0 14px rgba(255,200,61,.9); border-radius: 0 3px 3px 0; transition: width .25s linear; }
.fuse.hot i { background: linear-gradient(90deg, var(--pink), var(--red)); box-shadow: 0 0 16px rgba(255,79,163,.9); }
.stage { position: relative; min-height: 0; display: flex; gap: 12px; padding: 8px var(--pad) 10px; overflow: hidden; }
.stage > .main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.stage > .side { display: none; width: 320px; min-height: 0; flex-direction: column; gap: 12px; }
.stage > .main.narrow { max-width: 540px; margin: 0 auto; width: 100%; }
@media (min-width: 920px) { .stage > .side { display: flex; } .stage { padding: 14px 22px; gap: 22px; } .stage > .main { max-width: 760px; } }
.dock { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px var(--pad) calc(12px + env(safe-area-inset-bottom)); }
@media (min-width: 920px) { .dock { justify-content: center; } .dock > * { max-width: 420px; } }
.dock .note { flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; line-height: 1.25; }
.enter > * { animation: enter .22s cubic-bezier(.2,.8,.2,1) both; }
.enter > *:nth-child(2) { animation-delay: .04s; } .enter > *:nth-child(3) { animation-delay: .08s; } .enter > *:nth-child(4) { animation-delay: .12s; } .enter > *:nth-child(5) { animation-delay: .16s; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; }
.logo svg { width: 30px; height: 30px; color: var(--gold); filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); }
.logo b { font: 900 19px/1 Archivo; font-stretch: 112%; letter-spacing: .02em; background: linear-gradient(180deg, #FFF1C2, #FFC83D 55%, #FFA800); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(90,50,0,.55)); white-space: nowrap; }
.logo.xl { flex-direction: column; gap: 2px; }
.logo.xl svg { width: 84px; height: 84px; }
.logo.xl b { font-size: clamp(34px, 10.4vw, 64px); font-stretch: 112%; filter: drop-shadow(0 4px 0 rgba(90,50,0,.6)); }
.capdrop { animation: capdrop .75s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes capdrop { from { transform: translateY(-90px) rotate(-25deg); opacity: 0; } 60% { transform: translateY(6px) rotate(6deg); opacity: 1; } to { transform: none; } }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 54px; padding: 0 22px; border: 0; border-radius: 16px; white-space: nowrap;
  font: 800 17px/1 Archivo; font-stretch: 110%; letter-spacing: .01em; color: var(--goldInk);
  background: linear-gradient(180deg, #FFE59A 0%, #FFC83D 45%, #FFAE00 100%);
  box-shadow: 0 5px 0 var(--gold3), 0 12px 26px rgba(255,176,0,.28), inset 0 1px 0 rgba(255,255,255,.7);
  transition: transform .06s ease, box-shadow .06s ease, filter .15s; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold3), 0 4px 10px rgba(255,176,0,.2), inset 0 1px 0 rgba(255,255,255,.6); }
.btn:disabled { filter: grayscale(.7) brightness(.7); cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.violet { color: #fff; background: linear-gradient(180deg, #A58CFF, #7B55F5 55%, #6436E8); box-shadow: 0 5px 0 #3B1E9E, 0 12px 26px rgba(123,85,245,.3), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.violet:active:not(:disabled) { box-shadow: 0 1px 0 #3B1E9E, inset 0 1px 0 rgba(255,255,255,.3); }
.btn.wa { color: #fff; background: linear-gradient(180deg, #4BE38A, #25D366 55%, #1DB954); box-shadow: 0 5px 0 #11843F, 0 12px 26px rgba(37,211,102,.25), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.wa:active:not(:disabled) { box-shadow: 0 1px 0 #11843F; }
.btn.ghost { color: var(--ink); background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1.5px var(--line2); }
.btn.ghost:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 0 0 1.5px var(--line2); }
.btn.sm { height: 44px; padding: 0 14px; font-size: 15px; border-radius: 13px; }
.btn.xs { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn.flex1 { flex: 1; min-width: 0; }
.btn.boost { color: #fff; background: linear-gradient(180deg, #FF8CC6, #FF4FA3 55%, #E8228A); box-shadow: 0 5px 0 #97125A, 0 12px 26px rgba(255,79,163,.28), inset 0 1px 0 rgba(255,255,255,.4); padding: 0 14px; font-stretch: 100%; }
.btn.boost.off { color: var(--muted); background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1.5px var(--line2); }
.btn.boost.used { opacity: .35; }
.btn.boost.on { animation: glowpink .8s ease-in-out infinite alternate; }
@keyframes glowpink { to { box-shadow: 0 5px 0 #97125A, 0 0 28px rgba(255,79,163,.9), inset 0 1px 0 rgba(255,255,255,.4); } }
.ib { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255,255,255,.08); color: var(--muted); padding: 0; position: relative; }
.ib:hover { color: var(--ink); background: rgba(255,255,255,.13); }
.ib svg { width: 20px; height: 20px; }
.ib .dot { position: absolute; right: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--pink); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2.5px solid var(--cyan); outline-offset: 2px; }

/* ---------- surfaces & forms ---------- */
.card { position: relative; border-radius: 22px; padding: 16px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02)), var(--panel); border: 1px solid var(--line2); box-shadow: 0 18px 40px rgba(6,2,22,.45), inset 0 1px 0 rgba(255,255,255,.08); min-height: 0; }
.card.fill { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.card.tight { padding: 12px 14px; }
.bulbs { position: absolute; left: 18px; right: 18px; top: -5px; height: 10px; pointer-events: none;
  background: radial-gradient(circle at 5px 5px, #FFF0BF 0 2.4px, rgba(255,200,61,0) 3.4px) 0 0 / 18px 10px repeat-x; filter: drop-shadow(0 0 5px rgba(255,200,61,.9)); }
.bulbs.chase { animation: chase .42s steps(2) infinite; }
@keyframes chase { to { background-position: 18px 0; } }
.label { display: block; font: 700 13.5px Figtree; color: var(--muted); margin: 12px 0 6px; }
.label:first-child { margin-top: 0; }
.h1 { font: 900 clamp(28px, 8vw, 40px)/1.05 Archivo; font-stretch: 112%; margin: 0; }
.h2 { font: 800 22px/1.15 Archivo; font-stretch: 105%; margin: 0; }
.h3 { font: 800 17px/1.2 Archivo; margin: 0; }
.field { width: 100%; height: 52px; padding: 0 16px; border-radius: 16px; border: 1.5px solid var(--line2); background: rgba(8,3,26,.55); font-size: 17px; font-weight: 600; }
.field::placeholder, textarea::placeholder { color: var(--dim); font-weight: 500; }
.field:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 4px rgba(61,224,255,.15); }
.codebox { text-transform: uppercase; letter-spacing: .45em; text-align: center; font: 900 30px Archivo; font-stretch: 125%; height: 66px; padding-left: .45em; }
.err { color: var(--red); font-size: 14px; font-weight: 700; min-height: 19px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { border: 0; height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--ink); font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px var(--line2); }
.chipbtn:active { transform: scale(.95); }
.chipbtn.on { background: var(--gold); color: var(--goldInk); box-shadow: none; }
.seg { display: flex; gap: 5px; background: rgba(8,3,26,.5); border-radius: 16px; padding: 5px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); min-height: 50px; border-radius: 12px; font: 800 15px Archivo; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.05; }
.seg button small { font: 600 11px Figtree; color: var(--dim); }
.seg button.on { background: var(--panel2); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(255,200,61,.55); }
.seg button.on small { color: var(--muted); }
.stepper { display: flex; align-items: center; height: 50px; border-radius: 14px; background: rgba(8,3,26,.5); }
.stepper button { width: 48px; height: 100%; border: 0; background: transparent; color: var(--gold); font: 800 24px Archivo; }
.stepper output { flex: 1; text-align: center; font: 900 20px Archivo; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- discs ---------- */
.disc { --c: var(--c0); position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--c); display: grid; place-items: center; color: #1A0B38; font: 900 14px Archivo; letter-spacing: .02em; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2), 0 4px 10px rgba(0,0,0,.3); }
.disc.sm { width: 32px; height: 32px; font-size: 12px; }
.disc.lg { width: 56px; height: 56px; font-size: 19px; }
.disc.xl { width: 92px; height: 92px; font-size: 32px; }
.disc.away { opacity: .35; filter: grayscale(.6); }
.disc .lv { position: absolute; right: -7px; bottom: -5px; min-width: 20px; height: 17px; padding: 0 4px; border-radius: 9px; background: #1A0B38; color: var(--gold); border: 1.5px solid var(--gold); font: 800 10px/14px Archivo; text-align: center; }
.disc.sm .lv { display: none; }
.disc .ring { position: absolute; inset: -5px; border-radius: 50%; border: 2.5px solid transparent; }
.disc .ring.typing { border-color: var(--cyan); animation: pulse .9s ease-in-out infinite; }
.disc .ring.done { border-color: var(--green); }
.disc .ring.ready { border-color: var(--gold); }
@keyframes pulse { 0%,100% { opacity: .35; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.05); } }
.pgrid { display: flex; flex-wrap: wrap; gap: 14px 10px; align-content: flex-start; }
.pcell { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pcell .nm { max-width: 64px; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pcell .nm.me { color: var(--ink); }
.pcell .st { height: 14px; font-size: 11px; font-weight: 800; color: var(--dim); white-space: nowrap; }
.pcell .st.typing { color: var(--cyan); } .pcell .st.done { color: var(--green); } .pcell .st.host { color: var(--gold); }
.pcell.empty .disc { background: transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.14); color: var(--dim); font-size: 22px; }
.pcell.pop { animation: popin .4s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes popin { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.strip { display: flex; gap: 8px; overflow: hidden; min-height: 66px; flex: none; }
.strip .pcell { width: 56px; }

/* ---------- question ---------- */
.qcard { position: relative; flex: none; padding: 18px 16px 16px; border-radius: 24px; background: radial-gradient(120% 100% at 50% 0%, #3E2596 0%, #25145E 62%); border: 1.5px solid rgba(255,200,61,.42); box-shadow: 0 18px 44px rgba(8,2,30,.55), inset 0 1px 0 rgba(255,255,255,.14); }
.qcard.slam { animation: slam .32s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes slam { from { transform: scale(1.1) translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.qmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.diff { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; font: 800 13px Archivo; color: #140A2E; background: var(--cyan); }
.diff.easy { background: var(--green); } .diff.medium { background: var(--gold); } .diff.hard { background: var(--orange); } .diff.expert { background: var(--pink); color: #fff; }
.diff.boss { background: linear-gradient(90deg, #FF5C7A, #FF4FA3); color: #fff; box-shadow: 0 0 18px rgba(255,79,163,.7); animation: bossglow .9s ease-in-out infinite alternate; }
@keyframes bossglow { to { box-shadow: 0 0 30px rgba(255,79,163,1); } }
.mult { margin-left: auto; font: 800 14px Archivo; color: var(--gold); white-space: nowrap; }
.qtext { font: 800 clamp(21px, 6vw, 31px)/1.2 Archivo; letter-spacing: -.005em; overflow-wrap: anywhere; }
.ansbox { position: relative; flex: 1; min-height: 110px; display: flex; flex-direction: column; border-radius: 20px; background: rgba(8,3,26,.6); border: 1.5px solid var(--line2); transition: border-color .15s, box-shadow .15s; }
.ansbox:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(61,224,255,.14); }
.ansbox.boosted { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255,79,163,.18); }
.ansbox textarea { flex: 1; width: 100%; min-height: 0; border: 0; outline: none; resize: none; background: transparent; padding: 14px 16px 4px; font: 500 17px/1.45 Figtree; }
.ansbox .cnt { align-self: flex-end; padding: 0 14px 8px; font-size: 12px; font-weight: 700; color: var(--dim); }
.ansbox .cnt.near { color: var(--orange); }
.live { flex: none; min-height: 18px; font-size: 13.5px; font-weight: 700; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.locked { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 20px; border: 1.5px solid rgba(53,227,154,.5); background: linear-gradient(180deg, rgba(53,227,154,.14), rgba(53,227,154,.04)); animation: enter .2s ease both; }
.locked .t { font: 800 20px Archivo; color: var(--green); display: flex; align-items: center; gap: 8px; }
.locked .t svg { width: 22px; height: 22px; }
.locked .txt { color: var(--muted); font-size: 15px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow-wrap: anywhere; }

/* ---------- ladder meter ---------- */
.meter { width: 14px; flex: none; display: flex; flex-direction: column-reverse; gap: 5px; padding: 4px 0; }
.meter i { flex: 1; max-height: 44px; border-radius: 4px; background: rgba(255,255,255,.08); }
.meter i.done { background: rgba(255,200,61,.45); }
.meter i.cur { background: var(--gold); box-shadow: 0 0 14px rgba(255,200,61,.9); animation: pulse 1.2s ease-in-out infinite; }
.meter i.boss { box-shadow: inset 0 0 0 1.5px rgba(255,79,163,.8); }
.meter i.boss.cur { background: var(--pink); box-shadow: 0 0 16px rgba(255,79,163,.9); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.list::-webkit-scrollbar { display: none; }
.row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 12px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid var(--line); flex: none; }
.row.tap { cursor: pointer; } .row.tap:active { transform: scale(.985); }
.row.me { box-shadow: inset 4px 0 0 var(--cyan); }
.row.win { background: linear-gradient(90deg, rgba(255,200,61,.26), rgba(255,200,61,.05)); border-color: rgba(255,200,61,.6); }
.row.rin { animation: rowin .34s cubic-bezier(.2,1.25,.4,1) both; }
@keyframes rowin { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.row .rk { width: 24px; text-align: center; font: 900 16px Archivo; color: var(--dim); flex: none; display: grid; place-items: center; }
.row .rk svg { width: 22px; height: 22px; color: var(--gold); }
.row .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .nm small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.row .pts { font: 900 22px Archivo; color: var(--gold); min-width: 52px; text-align: right; flex: none; }
.row .pts.zero { color: var(--dim); }
.bar { width: 52px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; flex: none; }
.bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--green); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.bar i.part { background: var(--gold); } .bar i.miss { background: var(--red); }
.tagrow { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 999px; font: 800 11px Archivo; background: rgba(255,255,255,.1); color: var(--muted); white-space: nowrap; }
.tag.gold { background: rgba(255,200,61,.2); color: var(--gold); } .tag.pink { background: rgba(255,79,163,.22); color: #FF9CCF; } .tag.green { background: rgba(53,227,154,.18); color: var(--green); } .tag.red { background: rgba(255,92,122,.18); color: #FF9AAE; } .tag.cyan { background: rgba(61,224,255,.16); color: var(--cyan); }
.delta { font: 800 12px Archivo; flex: none; } .delta.up { color: var(--green); } .delta.down { color: var(--red); }
.flame { display: inline-flex; align-items: center; gap: 1px; font: 900 13px Archivo; color: var(--orange); flex: none; }
.flame svg { width: 15px; height: 15px; animation: flicker .45s ease-in-out infinite alternate; transform-origin: 50% 90%; }
@keyframes flicker { from { transform: scale(.9) rotate(-5deg); } to { transform: scale(1.1) rotate(5deg); } }

/* ---------- banner / overlays / fx ---------- */
.banner { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; background: linear-gradient(90deg, rgba(255,200,61,.26), rgba(255,79,163,.14)); border: 1.5px solid rgba(255,200,61,.5); animation: slam .35s cubic-bezier(.2,1.4,.4,1) both; }
.banner.cold { background: rgba(255,255,255,.06); border-color: var(--line2); }
.banner .t { font: 900 19px/1.15 Archivo; font-stretch: 105%; }
.banner svg { width: 34px; height: 34px; color: var(--gold); flex: none; }
.overlay { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; background: radial-gradient(circle at 50% 45%, rgba(40,20,100,.55), rgba(10,4,30,.92)); }
.overlay.on { display: grid; }
.overlay .big { font: 900 min(44vw, 210px)/1 Archivo; font-stretch: 125%; color: var(--gold); text-shadow: 0 8px 0 #8A5A00, 0 0 60px rgba(255,200,61,.6); animation: countpop .95s cubic-bezier(.2,1.5,.4,1) both; text-align: center; }
.overlay .big.go { color: var(--green); text-shadow: 0 8px 0 #0E7A4C, 0 0 60px rgba(53,227,154,.6); }
.overlay .sub { text-align: center; font: 800 20px Archivo; color: var(--muted); margin-top: 10px; }
@keyframes countpop { 0% { transform: scale(1.8); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { transform: scale(.86); opacity: 0; } }
.fx { position: fixed; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; }
.pop { position: absolute; font: 900 48px Archivo; font-stretch: 112%; color: var(--gold); text-shadow: 0 5px 0 #8A5A00, 0 0 30px rgba(255,200,61,.6); animation: popup 1.2s cubic-bezier(.2,.9,.3,1) forwards; white-space: nowrap; }
.pop.zero { color: var(--muted); text-shadow: 0 4px 0 rgba(0,0,0,.4); font-size: 36px; }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.12); } 70% { opacity: 1; transform: translate(-50%, -30px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -70px) scale(.95); } }
.bubble { position: absolute; bottom: 120px; display: flex; align-items: center; gap: 7px; padding: 5px 13px 5px 5px; border-radius: 999px; background: rgba(46,27,108,.97); border: 1.5px solid rgba(255,200,61,.45); font: 800 15px Archivo; animation: floatup 2.6s ease-out forwards; box-shadow: 0 10px 24px rgba(0,0,0,.45); white-space: nowrap; }
@keyframes floatup { 0% { opacity: 0; transform: translateY(24px) scale(.7); } 12% { opacity: 1; transform: translateY(0) scale(1.06); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-280px) scale(.95); } }
.confetti i { position: absolute; top: -16px; width: 8px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(112vh) rotate(760deg); opacity: .6; } }
.toasts { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 6px); transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 9px 14px; border-radius: 999px; text-align: center; font-size: 14px !important; background: rgba(46,27,108,.97); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-weight: 700; font-size: 14.5px; animation: toastin .2s ease both; }
.toast.bad { border-color: rgba(255,92,122,.6); }
.toast.good { border-color: rgba(53,227,154,.6); }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- sheets & trays ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 35; background: rgba(6,2,20,.62); opacity: 0; pointer-events: none; transition: opacity .18s; }
.sheet-bg.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 36; max-height: 88%; display: flex; flex-direction: column; background: linear-gradient(180deg, #2A1868, #1C0F4A); border-top: 1px solid var(--line2); border-radius: 24px 24px 0 0; transform: translateY(105%); transition: transform .22s cubic-bezier(.2,.9,.3,1); padding-bottom: env(safe-area-inset-bottom); visibility: hidden; }
.sheet.on { transform: none; visibility: visible; }
@media (min-width: 720px) { .sheet { left: 50%; right: auto; width: 600px; transform: translate(-50%, 105%); } .sheet.on { transform: translate(-50%, 0); } }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.22); margin: 9px auto 0; flex: none; }
.sheet .sh { display: flex; align-items: center; gap: 10px; padding: 8px 16px 10px; flex: none; }
.sheet .sh .h2 { flex: 1; font-size: 20px; min-width: 0; }
.sheet .sb { padding: 0 16px 14px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.sheet .sf { display: flex; gap: 10px; padding: 10px 16px 14px; border-top: 1px solid var(--line); flex: none; }
.tick { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.tick:first-child { border-top: 0; }
.tick b { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 900 13px Archivo; }
.tick.pass b { background: rgba(53,227,154,.2); color: var(--green); } .tick.part b { background: rgba(255,200,61,.2); color: var(--gold); } .tick.miss b { background: rgba(255,92,122,.2); color: var(--red); }
.quote { padding: 12px 14px; border-radius: 16px; background: rgba(8,3,26,.55); line-height: 1.5; margin-bottom: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.keylist { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.tray { position: absolute; left: var(--pad); right: var(--pad); bottom: calc(100% + 4px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; border-radius: 20px; background: rgba(35,20,86,.98); border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: enter .16s ease both; z-index: 3; }
.tray button { height: 46px; border: 0; border-radius: 13px; background: rgba(255,255,255,.08); font: 800 15px Archivo; color: var(--ink); }
.tray button:active { transform: scale(.94); background: var(--gold); color: var(--goldInk); }

/* ---------- intro / hub / lobby / end ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 4px 0 0; flex: none; }
.tagline { font: 800 clamp(19px, 5.4vw, 24px) Archivo; }
.steps { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.stepc { display: flex; gap: 14px; align-items: center; padding: 13px 14px; border-radius: 20px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.stepc .n { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font: 900 20px Archivo; color: var(--goldInk); background: linear-gradient(180deg, #FFE59A, #FFB000); box-shadow: 0 3px 0 var(--gold3); }
.stepc .h3 { margin-bottom: 2px; }
.invite { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 20px; background: linear-gradient(90deg, rgba(255,200,61,.2), rgba(255,79,163,.12)); border: 1.5px solid rgba(255,200,61,.5); }
.daily { position: relative; overflow: hidden; border-radius: 22px; padding: 16px; background: radial-gradient(90% 120% at 100% 0%, rgba(255,79,163,.35), transparent 60%), linear-gradient(135deg, #3B1F95, #24135E); border: 1.5px solid rgba(255,200,61,.38); box-shadow: 0 16px 36px rgba(6,2,22,.45); flex: none; }
.daily .num { font: 800 13px Archivo; color: var(--gold); }
.daily .topic { font: 900 clamp(26px, 7.5vw, 34px)/1.05 Archivo; font-stretch: 108%; margin: 4px 0 6px; }
.daily .go { margin-top: 12px; }
.chipl { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 4px; border-radius: 999px; background: rgba(255,255,255,.08); border: 0; color: var(--ink); font-weight: 800; font-size: 14px; flex: none; }
.chipl .disc { width: 32px; height: 32px; font-size: 12px; }
.xpbar { height: 9px; border-radius: 5px; background: rgba(255,255,255,.1); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold2), #FFE59A); transition: width 1.2s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 10px rgba(255,200,61,.6); }
.sharegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sharegrid .btn { height: 64px; flex-direction: column; gap: 4px; font-size: 12.5px; padding: 0 4px; font-stretch: 100%; }
.sharegrid .btn svg { width: 22px; height: 22px; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 18px; width: min(68vw, 250px); margin: 6px auto; }
.qr svg, .qr img { width: 100%; height: auto; display: block; }
.bigcode { font: 900 clamp(56px, 18vw, 90px)/1 Archivo; font-stretch: 125%; letter-spacing: .12em; padding-left: .12em; color: var(--gold); text-shadow: 0 5px 0 #8A5A00, 0 0 40px rgba(255,200,61,.35); text-align: center; border: 0; background: none; width: 100%; }
.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; gap: 8px; align-items: end; flex: none; padding-top: 22px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 12px; border-radius: 18px 18px 8px 8px; background: rgba(255,255,255,.05); border: 1px solid var(--line); animation: rowin .45s cubic-bezier(.2,1.2,.4,1) both; min-width: 0; }
.pod .nm { font-weight: 800; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .sc { font: 900 22px Archivo; color: var(--gold); }
.pod .pl { font: 800 12px Archivo; color: var(--dim); }
.pod.p1 { padding-top: 14px; border-color: rgba(255,200,61,.6); background: linear-gradient(180deg, rgba(255,200,61,.24), rgba(255,200,61,.04)); animation-delay: .3s; min-height: 150px; }
.pod.p2 { animation-delay: .12s; min-height: 120px; } .pod.p3 { animation-delay: .04s; min-height: 104px; }
.pod.empty { opacity: .25; }
.capw { position: relative; }
.capw .cap { position: absolute; left: 50%; top: -26px; width: 40px; height: 40px; margin-left: -20px; color: var(--gold); z-index: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.award { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid var(--line); flex: none; }
.award .ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,200,61,.16); color: var(--gold); }
.award .ic svg { width: 22px; height: 22px; }
.award.mine { border-color: rgba(255,200,61,.6); background: rgba(255,200,61,.1); }
.gridsq { display: flex; gap: 5px; flex-wrap: wrap; }
.gridsq i { width: 24px; height: 24px; border-radius: 7px; background: rgba(255,255,255,.14); }
.gridsq i.g2 { background: var(--green); } .gridsq i.g1 { background: var(--gold); } .gridsq i.gx { background: transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.14); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.25); border-top-color: currentColor; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.genstage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.gensteps { display: flex; gap: 6px; width: min(80vw, 360px); }
.gensteps i { flex: 1; height: 10px; border-radius: 5px; background: rgba(255,255,255,.1); animation: bulb 1.1s ease-in-out infinite; }
@keyframes bulb { 0%,100% { background: rgba(255,255,255,.1); } 50% { background: var(--gold); box-shadow: 0 0 14px rgba(255,200,61,.8); } }
.lanes { display: flex; flex-direction: column; gap: 7px; flex: none; }
.lane { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.lane .track { flex: 1; height: 9px; border-radius: 5px; background: rgba(255,255,255,.1); overflow: hidden; }
.lane .track i { display: block; height: 100%; background: var(--violet, #8B6BFF); transition: width .5s cubic-bezier(.2,.8,.2,1); border-radius: 5px; }
.lane .track i.me { background: var(--gold); }
.result { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.bigscore { font: 900 clamp(56px, 18vw, 84px)/1 Archivo; font-stretch: 112%; color: var(--gold); text-shadow: 0 5px 0 #8A5A00, 0 0 40px rgba(255,200,61,.35); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 10px; border-radius: 14px; background: rgba(255,255,255,.05); text-align: center; }
.stat b { display: block; font: 900 22px Archivo; color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- keyboard-open compact mode ---------- */
body.kb { --hud: 44px; }
body.kb .stage { padding-top: 4px; padding-bottom: 6px; gap: 8px; }
body.kb .stage > .main { gap: 8px; }
body.kb .meter, body.kb .strip, body.kb .bulbs, body.kb .hide-kb, body.kb .lanes, body.kb .hero .tagline { display: none !important; }
body.kb .qcard { padding: 10px 12px; border-radius: 18px; }
body.kb .qmeta { margin-bottom: 4px; }
body.kb .qtext { font-size: 17px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
body.kb .ansbox { min-height: 64px; }
body.kb .dock { padding-top: 6px; padding-bottom: 8px; }
body.kb .btn { height: 46px; }
body.kb .logo.xl svg { width: 44px; height: 44px; } body.kb .logo.xl b { font-size: 30px; }
@media (max-height: 660px) { .qtext { font-size: 20px; } .strip { min-height: 58px; } .btn { height: 50px; } .logo.xl svg { width: 56px; height: 56px; } .stepc { padding: 10px 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; } }

/* ---------- rounds track (replaces the side meter) ---------- */
.rounds { display: flex; gap: 4px; flex: none; }
.rounds i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); }
.rounds i.done { background: rgba(255,200,61,.5); }
.rounds i.cur { background: var(--gold); box-shadow: 0 0 10px rgba(255,200,61,.9); }
.rounds i.boss { background: rgba(255,79,163,.28); }
.rounds i.boss.cur { background: var(--pink); box-shadow: 0 0 12px rgba(255,79,163,.9); }
.rounds i.boss.done { background: rgba(255,79,163,.6); }
body.kb .rounds { display: none; }

/* ---------- host form ---------- */
.form { display: flex; flex-direction: column; gap: 22px; }
.sec-t { font: 800 16px/1.2 Archivo; margin: 0 0 10px; color: var(--ink); }
.hint { font-size: 13px; color: var(--dim); margin-top: 8px; }
.topicrow { display: flex; gap: 8px; }
.topicrow .field { flex: 1; min-width: 0; }
.dice { width: 52px; height: 52px; border-radius: 16px; background: rgba(255,200,61,.14); color: var(--gold); flex: none; }
.dice svg { width: 26px; height: 26px; }
.dice.roll svg { animation: roll .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes roll { from { transform: rotate(-200deg) scale(.6); } to { transform: none; } }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode { border: 0; border-radius: 16px; padding: 12px 6px 11px; background: rgba(8,3,26,.5); box-shadow: inset 0 0 0 1.5px var(--line2); display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted); min-width: 0; }
.mode svg { width: 26px; height: 26px; }
.mode b { font: 800 15px Archivo; color: var(--ink); }
.mode small { font-size: 11.5px; font-weight: 600; color: var(--dim); }
.mode.on { background: linear-gradient(180deg, rgba(255,200,61,.2), rgba(255,200,61,.04)); box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.mode.on small { color: var(--muted); }
.asname { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px 8px 8px; border: 0; border-radius: 16px; background: rgba(255,255,255,.05); color: var(--muted); font-size: 14.5px; text-align: left; }
.asname b { color: var(--ink); }
.asname span { margin-left: auto; color: var(--cyan); font-weight: 700; font-size: 13.5px; }
.mini { display: flex; flex-direction: column; gap: 10px; }
.mini .li { display: flex; gap: 12px; align-items: center; font-size: 14.5px; color: var(--muted); }
.mini .li b { color: var(--ink); }
.mini .li .ic { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,200,61,.14); color: var(--gold); }
.mini .li .ic svg { width: 18px; height: 18px; }
.mine-card { flex: none; }
.mine-card .tick { padding: 6px 0; font-size: 14px; }
.podium.two { grid-template-columns: 1fr 1.18fr; }
.podium.one { grid-template-columns: minmax(0, 220px); justify-content: center; }
.dock .btn.icon { width: 54px; padding: 0; flex: none; }
@media (max-width: 380px) { .dock .btn { font-size: 15.5px; padding: 0 14px; } .modes .mode small { display: none; } }

/* ---------- where the answer was right or wrong ---------- */
.mk { border-radius: 4px; padding: 1px 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.mk.good { background: rgba(53,227,154,.16); box-shadow: inset 0 -2px 0 var(--green); }
.mk.bad { background: rgba(255,92,122,.18); box-shadow: inset 0 -2px 0 var(--red); }
.legend { display: flex; gap: 14px; font-size: 12px; font-weight: 700; color: var(--muted); margin: -4px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .g { background: var(--green); } .legend .b { background: var(--red); }
.keys { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.keys i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,200,61,.35); box-shadow: 0 0 0 1.5px var(--gold); }
body.kb .keys { margin-top: 4px; }
