:root {
  --bg: #0b0b16; --panel: #161628; --panel2: #1f1f38; --ink: #f6f6ff; --muted: #a9a9c9;
  --pink: #ff3355; --blue: #2fa8ff; --gold: #ffc233; --green: #2ee87a; --red: #ff4b4b;
  --a0: #e21b3c; --a1: #1368ce; --a2: #d89e00; --a3: #26890c;
  --font-display: 'Bangers', Impact, 'Arial Narrow Bold', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-body); overscroll-behavior: none; }
body { background: url(/art/phone-bg.jpg) center/cover fixed, radial-gradient(120% 80% at 50% 0%, #2a1a3f 0%, var(--bg) 55%) fixed; }
.hero { width: 100%; border-radius: 14px; box-shadow: 0 10px 30px #000a; display: block; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#app { min-height: 100%; display: flex; flex-direction: column; padding: max(14px, env(safe-area-inset-top)) 16px calc(16px + var(--safe-b)); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
#status { position: fixed; top: 0; left: 0; right: 0; padding: 6px 12px calc(6px); text-align: center; font-size: 13px; font-weight: 700; background: var(--red); color: #fff; transform: translateY(-100%); transition: transform .25s; z-index: 60; }
#status.show { transform: none; }
#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; background: #000c; color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 700; transition: all .25s; z-index: 70; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

h1, h2, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: .02em; margin: 0; }
h1 { font-size: clamp(34px, 11vw, 56px); line-height: .95; text-shadow: 0 4px 0 #0008, 0 0 24px #ff33aa55; }
h2 { font-size: clamp(26px, 8vw, 40px); line-height: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 13px; background: #fff2; letter-spacing: .04em; }
.card { background: var(--panel); border-radius: 18px; padding: 16px; box-shadow: 0 10px 30px #0006; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.top .me { font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.top .me .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
.score { font-family: var(--font-display); font-size: 26px; line-height: 1; }
.rankchip { font-size: 12px; font-weight: 800; color: var(--muted); }

/* join */
input.text { width: 100%; font: inherit; font-weight: 800; font-size: 20px; padding: 14px 16px; border-radius: 14px; border: 2px solid #ffffff22; background: #00000055; color: #fff; outline: none; }
input.text:focus { border-color: var(--gold); }
.teams { display: grid; gap: 10px; }
.teambtn { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--panel2); border: 3px solid transparent; text-align: left; transition: transform .1s; }
.teambtn:active { transform: scale(.98); }
.teambtn.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, var(--panel2)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent); }
.teambtn .crest { width: 54px; height: 54px; border-radius: 50%; flex: none; background: #0006 center/cover; }
.teambtn .tname { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.teambtn .tcount { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.big { width: 100%; padding: 18px; border-radius: 16px; font-family: var(--font-display); font-size: 30px; letter-spacing: .04em; background: linear-gradient(180deg, #ffd45e, #ffb300); color: #2a1a00; box-shadow: 0 8px 0 #9a6500, 0 14px 30px #0008; transition: transform .08s, box-shadow .08s; }
.big:active { transform: translateY(5px); box-shadow: 0 3px 0 #9a6500, 0 8px 20px #0008; }
.big:disabled { filter: grayscale(.6) brightness(.7); }
.link { color: var(--muted); font-weight: 700; text-decoration: underline; font-size: 14px; }

/* lobby */
.crestbig { width: 160px; height: 160px; margin: 8px auto; border-radius: 50%; background: #0006 center/cover; box-shadow: 0 0 40px var(--c); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .6 } 50% { opacity: 1 } }

/* question */
.qnum { font-weight: 900; font-size: 13px; letter-spacing: .12em; color: var(--muted); }
.qtext { font-weight: 800; font-size: clamp(17px, 4.6vw, 22px); line-height: 1.25; }
.media { border-radius: 14px; overflow: hidden; background: #0008; max-height: 26vh; display: flex; justify-content: center; }
.media.empty { display: none; }
.media img, .media video { max-width: 100%; max-height: 26vh; object-fit: contain; display: block; }
.timer { height: 10px; border-radius: 999px; background: #ffffff22; overflow: hidden; }
.timer > i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold), var(--pink)); transform-origin: left; }
.worth { display: flex; justify-content: space-between; font-weight: 900; font-size: 14px; }
.worth b { font-family: var(--font-display); font-size: 24px; color: var(--gold); letter-spacing: .03em; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: 46vh; }
.ans { border-radius: 16px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 12px; text-align: left; color: #fff; font-weight: 800; font-size: clamp(14px, 4vw, 18px); line-height: 1.15; box-shadow: inset 0 -6px 0 #0004, 0 8px 24px #0006; transition: transform .08s, filter .2s, opacity .3s; }
.ans:active { transform: scale(.96); }
.ans .shape { font-size: 34px; line-height: 1; text-shadow: 0 3px 0 #0005; }
.ans[data-i="0"] { background: var(--a0); } .ans[data-i="1"] { background: var(--a1); } .ans[data-i="2"] { background: var(--a2); } .ans[data-i="3"] { background: var(--a3); }
.ans.dim { opacity: .28; filter: grayscale(.5); }
.ans.mine { outline: 4px solid #fff; outline-offset: -4px; }
.ans.correct { box-shadow: 0 0 0 4px #fff, 0 0 40px var(--green); }
.locked { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.locked .chip { display: inline-flex; align-items: center; gap: 10px; padding: 14px 20px; border-radius: 16px; font-weight: 900; font-size: 20px; color: #fff; }

/* reveal */
.verdict { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; animation: slam .45s cubic-bezier(.2, 1.4, .4, 1); }
.verdict.ok { color: var(--green); } .verdict.bad { color: var(--red); } .verdict.meh { color: var(--muted); }
.verdict h1 { font-size: clamp(48px, 18vw, 84px); color: inherit; text-shadow: 0 0 40px currentColor, 0 6px 0 #0008; }
.delta { font-family: var(--font-display); font-size: clamp(44px, 16vw, 72px); color: #fff; }
.fact { background: #ffffff12; border-left: 4px solid var(--gold); padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.35; color: #e6e6ff; }
@keyframes slam { from { transform: scale(2.2); opacity: 0 } to { transform: none; opacity: 1 } }

/* leaderboard */
.myrank { text-align: center; padding: 18px 10px; }
.myrank .r { font-family: var(--font-display); font-size: clamp(64px, 26vw, 120px); line-height: .9; }
.myrank .mv { font-weight: 900; font-size: 16px; }
.mv.up { color: var(--green); } .mv.down { color: var(--red); } .mv.same { color: var(--muted); }
.teamrows { display: flex; flex-direction: column; gap: 8px; }
.trow { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #ffffff0d; border-left: 6px solid var(--c); }
.trow.mine { background: color-mix(in srgb, var(--c) 20%, #ffffff0d); }
.trow .tn { font-family: var(--font-display); font-size: 20px; line-height: 1; }
.trow .ts { font-weight: 900; font-variant-numeric: tabular-nums; }
.trow .tr { font-family: var(--font-display); font-size: 22px; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 6px; }
.prow { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: #ffffff0a; font-weight: 700; font-size: 15px; }
.prow.mine { background: #ffc23322; outline: 2px solid var(--gold); }
.prow .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .d { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* mini games */
.mini { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.rolecard { text-align: center; padding: 18px; border-radius: 20px; background: var(--panel); }
.rolecard h2 { color: var(--gold); }
.mashwrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.mash { width: min(78vw, 340px); height: min(78vw, 340px); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 44px; letter-spacing: .05em; color: #fff; box-shadow: 0 14px 0 #0008, 0 20px 60px #000a; transition: transform .05s; }
.mash:active { transform: scale(.94) translateY(8px); box-shadow: 0 4px 0 #0008, 0 10px 30px #000a; }
.mash.attack { background: radial-gradient(circle at 35% 30%, #ff7a8a, var(--pink) 60%, #a1001f); }
.mash.block { background: radial-gradient(circle at 35% 30%, #8fd0ff, var(--blue) 60%, #0a3f7a); }
.mash.belt { background: radial-gradient(circle at 35% 30%, #fff0a8, var(--gold) 55%, #9a6500); color: #2a1a00; }
.mash .emo { font-size: 90px; line-height: 1; filter: drop-shadow(0 6px 0 #0005); }
.counter { font-family: var(--font-display); font-size: 56px; line-height: 1; }
.wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; border-radius: 20px; background: linear-gradient(180deg, #5a0010, #2a0008); animation: pulse 1s infinite; }
.wait h1 { font-size: clamp(40px, 14vw, 64px); }
.countdown { flex: 1; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 40vw; line-height: 1; color: var(--gold); text-shadow: 0 0 60px var(--gold); }
.stake { text-align: center; font-weight: 900; }
.stake b { font-family: var(--font-display); font-size: 36px; color: var(--gold); letter-spacing: .03em; }

/* bonus */
.bonus body, #app.bonus { background: linear-gradient(135deg, #ff004c, #ff7a00, #ffe600, #00d26a, #00a2ff, #8a2be2) fixed; }
#app.bonus .card, #app.bonus .ans { box-shadow: 0 0 0 3px #fff8, 0 10px 30px #0006; }
.pete { position: fixed; right: -40vw; bottom: calc(0px + var(--safe-b)); width: 46vw; max-width: 240px; z-index: 40; filter: drop-shadow(0 0 20px #fff); transition: right .5s cubic-bezier(.2, 1.3, .4, 1); pointer-events: none; }
.pete.in { right: -6vw; }
.pete img { width: 100%; display: block; }
.rainbow { color: #fff; text-shadow: 0 2px 8px #0009; }
#app.bonus .top, #app.bonus .qnum { color: #fff; text-shadow: 0 2px 8px #0009; }
#app.bonus .rankchip { color: #fff; }

/* final */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 180px; }
.pod { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.pod .bar { width: 100%; border-radius: 10px 10px 0 0; background: var(--c, #fff3); display: flex; align-items: flex-start; justify-content: center; font-family: var(--font-display); font-size: 28px; padding-top: 6px; }
.pod .pn { font-weight: 900; font-size: 13px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod.p1 .bar { height: 120px; } .pod.p2 .bar { height: 86px; } .pod.p3 .bar { height: 60px; }
