:root {
  --blue: #4285f4;
  --ink: #0d0d0d;
  --white: #fff;
  --line: rgba(255, 255, 255, .35);
  --red: #ff4b3e;
  --green: #2fd27a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--blue); color: var(--white); font-family: 'Figtree', system-ui, sans-serif; }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; text-transform: lowercase; }
button, input { font: inherit; color: inherit; text-transform: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }

/* ---------- phone ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; padding: 18px 20px 24px; gap: 18px; user-select: none; -webkit-user-select: none; }
.top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.top span:last-child { opacity: .75; }
.big { font-size: clamp(44px, 14vw, 72px); font-weight: 800; line-height: .92; letter-spacing: -.04em; }
.mid { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.small { font-size: 16px; line-height: 1.4; opacity: .85; }
.grow { flex: 1; }
.label { font-size: 13px; font-weight: 700; letter-spacing: .08em; opacity: .75; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input { background: none; border: 0; border-bottom: 2px solid var(--white); padding: 6px 0 8px; font-size: 28px; font-weight: 700; border-radius: 0; text-transform: none; }
.field input::placeholder { color: rgba(255, 255, 255, .5); text-transform: lowercase; }
.code-input { font-size: 64px !important; letter-spacing: .2em; text-align: center; }
.btn { background: var(--white); color: var(--ink); font-weight: 800; font-size: 22px; padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; width: 100%; }
.btn:active { background: var(--ink); color: var(--white); }
.btn[disabled] { opacity: .4; }
.error { background: var(--ink); padding: 12px 14px; font-weight: 700; font-size: 16px; }
.error:empty { display: none; }
.teams { display: flex; flex-direction: column; border-top: 2px solid var(--white); }
.team-opt { text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.team-opt b { font-size: 24px; letter-spacing: -.02em; }
.team-opt small { font-size: 14px; opacity: .8; text-transform: none; }
.team-opt.on { background: var(--white); color: var(--blue); padding-left: 12px; }
.team-opt input { background: none; border: 0; font-size: 24px; font-weight: 700; outline: none; text-transform: none; }
.team-opt input::placeholder { color: inherit; opacity: .6; text-transform: lowercase; }
.members { font-size: 22px; font-weight: 700; line-height: 1.35; text-transform: none; }
.members span { opacity: .6; }
.countdown { position: fixed; inset: 0; display: grid; place-items: center; font-size: 46vw; font-weight: 900; letter-spacing: -.06em; background: var(--blue); z-index: 10; }
.result { font-size: clamp(52px, 17vw, 96px); font-weight: 900; letter-spacing: -.05em; line-height: .9; }
.overlay { position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); padding: 10px 20px; font-weight: 700; font-size: 14px; z-index: 50; }

/* ---------- games ---------- */
.game { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 18px; gap: 14px; user-select: none; -webkit-user-select: none; }
.timebar { height: 8px; background: rgba(255, 255, 255, .25); }
.timebar i { display: block; height: 100%; background: var(--white); transform-origin: left; }
.react { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; touch-action: none; }
.react b { font-size: 18vw; font-weight: 900; letter-spacing: -.05em; }
.react small { font-size: 18px; font-weight: 700; opacity: .85; }
.react.wait { background: #e5322d; }
.react.go { background: #19b35a; }
.react.bad { background: var(--ink); }
.react.msg { background: var(--blue); }
.card { flex: 1; display: flex; flex-direction: column; padding: 18px; gap: 14px; }
.card.dark { background: var(--ink); }
.card.ok { animation: ok .25s; }
.card.no { animation: no .3s; }
@keyframes ok { from { box-shadow: inset 0 0 0 8px var(--green); } }
@keyframes no { from { box-shadow: inset 0 0 0 8px var(--red); transform: translateX(-6px); } 50% { transform: translateX(6px); } }
.counter { align-self: flex-end; font-size: 34px; font-weight: 900; letter-spacing: -.03em; }
.stroop-word, .math-q { flex: 1; display: grid; place-items: center; font-size: clamp(56px, 18vw, 96px); font-weight: 900; letter-spacing: -.04em; }
.math-q { text-transform: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { background: #262626; height: 96px; font-size: 28px; font-weight: 800; }
.opt:active { background: var(--white); color: var(--ink); }
.simon-label { font-size: 26px; font-weight: 800; letter-spacing: -.02em; text-align: center; padding: 8px 0; }
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(100%, 62dvh); margin: auto; aspect-ratio: 1; }
.simon.no { animation: no .3s; }
.pad { opacity: .22; transition: opacity .08s, transform .08s; touch-action: none; }
.pad.lit { opacity: 1; transform: scale(.96); }
.tap { flex: 1; border: 3px solid var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; }
.tap b { font-size: 30vw; font-weight: 900; letter-spacing: -.05em; line-height: 1; }
.tap small { font-size: 18px; font-weight: 700; opacity: .8; }
.tap.pulse { background: rgba(255, 255, 255, .08); }
.chimp { display: grid; gap: 6px; width: min(100%, 64dvh); margin: auto; }
.chimp.no { animation: no .3s; }
.cell { aspect-ratio: 1; }
.num { background: var(--white); color: var(--blue); font-weight: 900; font-size: 26px; display: grid; place-items: center; }
.chimp.hidden .num:not(.gone) { color: transparent; }
.chimp.reveal .num { color: var(--ink) !important; }
.num.gone { visibility: hidden; }

/* ---------- host / projector ---------- */
.host { min-height: 100vh; padding: 3.2vw 4vw 7vw; display: flex; flex-direction: column; gap: 2.4vw; }
.host .kicker { font-size: 1.5vw; font-weight: 700; letter-spacing: .06em; opacity: .8; }
.host .huge { font-size: 11vw; font-weight: 800; line-height: .85; letter-spacing: -.055em; }
.host .large { font-size: 5vw; font-weight: 800; line-height: .95; letter-spacing: -.04em; }
.host .body { font-size: 2.3vw; font-weight: 500; line-height: 1.3; max-width: 60vw; }
.lobby { display: grid; grid-template-columns: auto 1fr; gap: 5vw; align-items: start; flex: 1; }
.join { display: flex; flex-direction: column; gap: 1.6vw; }
.join img { width: 17vw; height: 17vw; display: block; }
.join .url { font-size: 2vw; font-weight: 700; }
.join .label { font-size: 1.3vw; }
.join .code { font-size: 7vw; font-weight: 900; letter-spacing: .08em; line-height: 1; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16vw, 1fr)); gap: 2vw 2.4vw; align-content: start; }
.tcol { border-top: .25vw solid var(--white); padding-top: .8vw; display: flex; flex-direction: column; gap: .3vw; }
.tcol h3 { font-size: 2.2vw; font-weight: 800; letter-spacing: -.02em; margin-bottom: .4vw; }
.chip { font-size: 1.6vw; font-weight: 600; text-transform: none; text-align: left; display: flex; align-items: center; gap: .7vw; }
.chip i { width: 1.1vw; height: 1.1vw; border: .18vw solid var(--white); border-radius: 50%; flex: none; transition: background .3s; }
.chip.done i { background: var(--white); }
.ctl { position: fixed; right: 2vw; bottom: 2vw; display: flex; gap: .8vw; z-index: 20; }
.ctl button { background: var(--white); color: var(--ink); font-weight: 800; font-size: 1.3vw; padding: .9vw 1.4vw; }
.ctl button.ghost { background: none; color: var(--white); border: 2px solid var(--line); }
.menu { position: fixed; inset: 0; background: rgba(13, 13, 13, .55); display: grid; place-items: center; z-index: 30; }
.menu > div { background: var(--white); color: var(--ink); padding: 2vw; display: flex; flex-direction: column; gap: .6vw; min-width: 26vw; }
.menu h3 { font-size: 2vw; text-transform: none; margin-bottom: .6vw; }
.menu button { text-align: left; font-size: 1.4vw; font-weight: 700; padding: .5vw 0; border-bottom: 1px solid #ddd; }
.menu button.kick { color: #d22; }
.progress { font-size: 14vw; font-weight: 900; letter-spacing: -.06em; line-height: .8; }
.host .countdown { font-size: 30vw; }
.rank { display: flex; flex-direction: column; gap: 1vw; }
.rank .row { display: grid; grid-template-columns: 7vw 1fr auto; align-items: baseline; border-top: .2vw solid var(--white); padding-top: .8vw; }
.rank .row.new { animation: rise .9s cubic-bezier(.2, .9, .2, 1) both; animation-delay: var(--d, 0s); }
.rank .row.first { background: var(--white); color: var(--blue); padding: 1vw 1.2vw; border: 0; }
.rank .pos { font-size: 4vw; font-weight: 900; letter-spacing: -.04em; }
.rank .nm { font-size: 4vw; font-weight: 800; letter-spacing: -.035em; }
.rank .pts { font-size: 3vw; font-weight: 700; }
@keyframes rise { from { opacity: 0; transform: translateY(3vw); } }
.bests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.4vw; }
.bests > div { border-top: .25vw solid var(--white); padding-top: 1vw; animation: rise .7s both; }
.bests .g { font-size: 1.6vw; font-weight: 700; opacity: .8; }
.bests .w { font-size: 3.4vw; font-weight: 800; letter-spacing: -.035em; text-transform: none; line-height: 1; margin: .5vw 0; }
.bests .r { font-size: 1.8vw; font-weight: 600; }
.final { display: grid; grid-template-columns: repeat(auto-fit, minmax(17vw, 1fr)); gap: 2vw; }
.final .tcol h3 { display: flex; justify-content: space-between; }
.prow { display: grid; grid-template-columns: 1fr auto; font-size: 1.35vw; font-weight: 600; text-transform: none; margin-top: .5vw; }
.bar { grid-column: 1 / -1; display: flex; height: 1.3vw; margin-top: .25vw; background: rgba(255, 255, 255, .12); }
.bar i { display: block; height: 100%; }
.legend { display: flex; gap: 1.8vw; font-size: 1.3vw; font-weight: 700; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: .5vw; }
.legend i { width: 1.1vw; height: 1.1vw; display: block; }
