/* Sensory Overload: neon party look, phone-first, with a big-screen layout. */

:root {
  --bg: #07080f;
  --bg2: #0d1020;
  --panel: rgba(255, 255, 255, 0.055);
  --panel2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3f5ff;
  --muted: #9aa0b8;
  --dim: #5f6680;
  --pink: #ff3d8b;
  --orange: #ff9a3c;
  --yellow: #ffd23f;
  --lime: #b6f35a;
  --cyan: #34e0ff;
  --blue: #5b7cff;
  --violet: #a874ff;
  --red: #ff4d5e;
  --green: #2fe6a6;
  --display: "Anton", Impact, "Arial Narrow", sans-serif;
  --ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --c0: var(--pink);
  --c1: var(--orange);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(40% 35% at 12% 8%, rgba(255, 61, 139, 0.2), transparent 70%),
    radial-gradient(45% 40% at 92% 92%, rgba(52, 224, 255, 0.14), transparent 70%),
    radial-gradient(40% 30% at 85% 12%, rgba(168, 116, 255, 0.12), transparent 70%);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(3%, -2%, 0) rotate(2deg); } }

input, button { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
b { font-weight: 700; }

/* ── shared controls ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 17px; line-height: 1;
  padding: 16px 20px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  transition: transform 0.12s ease, filter 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.primary {
  border: 0; color: #19060f;
  background: linear-gradient(100deg, var(--pink), var(--orange));
  box-shadow: 0 14px 34px -12px rgba(255, 61, 139, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.big { width: 100%; font-size: 19px; padding: 19px 22px; border-radius: 18px; }
.btn.ghost { background: transparent; }
.btn.link { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 15px; padding: 10px; text-decoration: underline; text-underline-offset: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  -webkit-user-select: none; user-select: none;
}
.chip.ghost { background: transparent; }
.chip:active { transform: scale(0.96); }

input {
  width: 100%; font-size: 18px; font-weight: 600;
  padding: 15px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: var(--dim); }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(52, 224, 255, 0.18); }

.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }

.hub-link {
  position: fixed; z-index: 30; top: calc(12px + var(--sat)); left: 12px;
  display: inline-flex; gap: 6px; align-items: center;
  font: 600 13px var(--ui); color: var(--text); text-decoration: none;
  padding: 8px 13px; border-radius: 999px;
  background: rgba(7, 8, 15, 0.6); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
body.show-hub .hub-link { opacity: 1; pointer-events: auto; }

/* ── logo with RGB-split glitch ──────────────────── */
.logo { display: flex; flex-direction: column; align-items: center; font-family: var(--display); font-weight: 400; line-height: 0.86; letter-spacing: 0.01em; text-transform: uppercase; }
.glitch { position: relative; display: block; font-size: clamp(54px, 18.5vw, 96px); color: #fff; text-shadow: 0 0 24px rgba(255, 61, 139, 0.35); }
.glitch.two { color: transparent; background: linear-gradient(90deg, var(--pink), var(--orange) 45%, var(--yellow)); -webkit-background-clip: text; background-clip: text; text-shadow: none; }
.glitch::before, .glitch::after {
  content: attr(data-t); position: absolute; inset: 0; pointer-events: none;
  -webkit-background-clip: initial; background: none; mix-blend-mode: screen;
}
.glitch::before { color: var(--cyan); transform: translate(-3px, 0); opacity: 0.7; animation: g1 3.1s infinite steps(1); }
.glitch::after { color: var(--pink); transform: translate(3px, 0); opacity: 0.7; animation: g2 3.7s infinite steps(1); }
@keyframes g1 {
  0%, 88% { clip-path: inset(0 0 0 0); transform: translate(-2px, 0); }
  90% { clip-path: inset(12% 0 60% 0); transform: translate(-9px, -1px); }
  93% { clip-path: inset(58% 0 14% 0); transform: translate(7px, 1px); }
  96% { clip-path: inset(30% 0 40% 0); transform: translate(-4px, 0); }
}
@keyframes g2 {
  0%, 84% { clip-path: inset(0 0 0 0); transform: translate(2px, 0); }
  86% { clip-path: inset(66% 0 6% 0); transform: translate(8px, 0); }
  90% { clip-path: inset(4% 0 74% 0); transform: translate(-6px, 1px); }
  94% { clip-path: inset(40% 0 30% 0); transform: translate(5px, -1px); }
}

/* ── screens ─────────────────────────────────────── */
.app { position: fixed; inset: 0; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: scale(1.02);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.screen.on { opacity: 1; visibility: visible; transform: none; transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s; }

/* ── home ────────────────────────────────────────── */
.home { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.home-in {
  width: 100%; max-width: 440px; margin: auto; display: flex; flex-direction: column; align-items: center;
  padding: calc(52px + var(--sat)) 22px calc(26px + var(--sab)); gap: 18px; text-align: center;
}
.home-art { width: min(52vw, 210px); margin-bottom: -8px; filter: drop-shadow(0 20px 40px rgba(91, 124, 255, 0.25)); }
.home-art svg { width: 100%; height: auto; overflow: visible; }
.orbit { transform-origin: 130px 156px; }
.o1 { animation: spin1 9s linear infinite; }
.o2 { animation: spin2 12s linear infinite; }
.o3 { animation: spin3 15s linear infinite; }
@keyframes spin1 { from { transform: rotate(-22deg); } to { transform: rotate(338deg); } }
@keyframes spin2 { from { transform: rotate(32deg); } to { transform: rotate(-328deg); } }
@keyframes spin3 { from { transform: rotate(8deg); } to { transform: rotate(368deg); } }
.phone-bob { animation: bob 3.6s ease-in-out infinite; transform-origin: 130px 156px; }
@keyframes bob { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.slosh { animation: slosh 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes slosh { 0%, 100% { transform: skewY(6deg); } 50% { transform: skewY(-6deg); } }
.marble { animation: roll 3.6s ease-in-out infinite; }
@keyframes roll { 0%, 100% { transform: translateX(-10px); } 50% { transform: translateX(26px); } }
.waves path { animation: wave 1.6s ease-out infinite; }
.waves path:nth-child(2) { animation-delay: 0.2s; }
.waves path:nth-child(3) { animation-delay: 0.4s; }
@keyframes wave { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

.pitch { color: #c9cee0; font-size: 16px; line-height: 1.5; max-width: 34ch; }
.pitch b { color: var(--text); }
.home-form { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.code-in { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.3em; text-align: center; }
.home-form.has-code #btn-create { order: 3; }
.home-form.has-code #btn-solo { order: 4; }
.tv-tip { font-size: 13.5px; color: var(--muted); line-height: 1.5; max-width: 34ch; }
.tv-tip a { color: var(--cyan); }

/* ── lobby ───────────────────────────────────────── */
.lob-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  padding: calc(14px + var(--sat)) 14px 10px;
}
.lob-head #btn-leave { justify-self: start; }
.lob-acts { justify-self: end; display: flex; gap: 6px; }
.room-id { display: flex; flex-direction: column; align-items: center; }
.room-id .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.room-id .code { font-family: var(--mono); font-weight: 700; font-size: 30px; letter-spacing: 0.18em; color: var(--yellow); text-shadow: 0 0 22px rgba(255, 210, 63, 0.35); }
.lob-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.lob-body > *, .over-in > * { flex-shrink: 0; }
.qr-box { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop 0.3s ease; }
.qr-box p { font-size: 13px; color: var(--muted); }
.qr { background: #fff; border-radius: 18px; padding: 10px; line-height: 0; box-shadow: 0 20px 50px -20px rgba(255, 255, 255, 0.35); }
.qr svg { width: 100%; height: 100%; display: block; }
#lob-qr { width: min(62vw, 240px); aspect-ratio: 1; }

.sensor-card {
  position: relative; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(140deg, rgba(255, 61, 139, 0.16), rgba(91, 124, 255, 0.1) 60%, rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 61, 139, 0.3);
  overflow: hidden;
}
.sensor-card h2 { font-family: var(--display); font-weight: 400; font-size: 30px; letter-spacing: 0.01em; line-height: 1; }
.sensor-card p { color: #c9cee0; font-size: 14.5px; line-height: 1.5; margin-top: 6px; }
.sensor-card.ready { background: rgba(47, 230, 166, 0.07); border-color: rgba(47, 230, 166, 0.3); }
.sensor-card.ready .sc-text, .sensor-card.ready #btn-sensors { display: none; }
.caps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.caps li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 10px 6px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.caps li i { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.caps li.ok { color: var(--text); }
.caps li.ok i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.caps li.no i { background: var(--red); }
.sc-note { font-size: 13px !important; color: var(--muted) !important; margin: 0 !important; }

.list-h { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.list-h span { color: var(--text); }
.players { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.players li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); animation: pop 0.35s ease;
}
.players li.me { border-color: rgba(255, 210, 63, 0.45); }
.players li.off { opacity: 0.45; }
.av {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-size: 19px; color: #07080f; background: var(--pc, var(--pink));
  box-shadow: 0 0 18px -4px var(--pc, var(--pink));
}
.pname { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ptag { flex: none; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.ptag.ok { background: rgba(47, 230, 166, 0.14); color: var(--green); }
.crown { color: var(--yellow); font-size: 14px; margin-left: 4px; }
.lob-foot { padding: 12px 16px calc(16px + var(--sab)); display: flex; flex-direction: column; gap: 10px; background: linear-gradient(transparent, rgba(7, 8, 15, 0.92) 30%); }
.wait { text-align: center; font-size: 14.5px; color: var(--muted); }

/* ── in game ─────────────────────────────────────── */
.game { background: var(--bg); }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; }
.hud-top { display: flex; justify-content: space-between; align-items: center; padding: calc(12px + var(--sat)) 14px 0; }
.hud-round { font-family: var(--mono); font-weight: 700; font-size: 13px; padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); color: var(--text); }
.hud-verb { text-align: center; margin-top: -6px; transition: opacity 0.2s; }
.hud-verb b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(40px, 12vw, 60px); line-height: 1; letter-spacing: 0.02em; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4), 0 0 30px var(--c0); }
.hud-verb span { display: block; margin-top: 4px; font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.78); }
.timebar { position: absolute; left: 14px; right: 14px; bottom: calc(14px + var(--sab)); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c0), var(--c1)); transform-origin: left; }
.timebar.low i { background: var(--red); }

.hearts { display: inline-flex; gap: 4px; }
.hearts svg { width: 22px; height: 22px; }
.hearts.big svg { width: 38px; height: 38px; }
.hearts .full path { fill: var(--pink); filter: drop-shadow(0 0 6px rgba(255, 61, 139, 0.7)); }
.hearts .empty path { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 2; }
.hearts .breaking path { fill: rgba(255, 61, 139, 0); stroke: rgba(255, 255, 255, 0.28); stroke-width: 2; animation: breakheart 1s ease 0.5s backwards; transform-origin: center; transform-box: fill-box; }
@keyframes breakheart {
  0% { transform: scale(1); fill: #ff3d8b; stroke: transparent; }
  35% { transform: scale(1.45) rotate(-8deg); fill: #ffffff; stroke: transparent; }
  60% { transform: scale(0.85) rotate(6deg); fill: #ff3d8b; }
  100% { transform: scale(1); fill: rgba(255, 61, 139, 0); stroke: rgba(255, 255, 255, 0.28); }
}

.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: calc(30px + var(--sat)) 24px calc(30px + var(--sab)); gap: 10px;
  animation: fadein 0.25s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

.intro { background: radial-gradient(70% 60% at 50% 40%, #3a1028, #07080f 80%); }
.big-t { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 13vw, 72px); line-height: 1; }
.intro-sub { color: #c9cee0; font-size: 16px; max-width: 30ch; line-height: 1.5; }

.ann { background: radial-gradient(80% 60% at 50% 38%, color-mix(in srgb, var(--c0) 55%, #07080f), color-mix(in srgb, var(--c1) 18%, #07080f) 55%, #07080f); }
.game:has(#ov-ann:not([hidden])) .hud, .game:has(#ov-intro:not([hidden])) .hud { opacity: 0; }
.ann-round { font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 0.26em; text-transform: uppercase; color: rgba(255, 255, 255, 0.8); }
.ann-speed { font-family: var(--display); font-size: 30px; color: var(--yellow); letter-spacing: 0.04em; animation: blink 0.25s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.ann-verb {
  font-family: var(--display); font-weight: 400; font-size: clamp(76px, 25vw, 150px); line-height: 0.92; letter-spacing: 0.01em;
  color: #fff; text-shadow: 0 8px 50px rgba(0, 0, 0, 0.35), 0 0 60px color-mix(in srgb, var(--c0) 70%, transparent);
  animation: slam 0.42s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes slam { from { transform: scale(2.2); opacity: 0; } to { transform: none; opacity: 1; } }
.ann-hint { font-size: 21px; font-weight: 700; }
.ann-how { font-size: 15px; color: rgba(255, 255, 255, 0.75); max-width: 32ch; line-height: 1.45; }
.ann-count { height: 96px; margin-top: 12px; font-family: var(--display); font-size: 92px; line-height: 96px; color: #fff; }
.ann-count.tick { animation: tick 0.5s ease; }
@keyframes tick { from { transform: scale(1.8); opacity: 0.2; } to { transform: none; opacity: 1; } }

.verdict { background: radial-gradient(75% 60% at 50% 42%, color-mix(in srgb, var(--vc, var(--green)) 30%, #07080f), #07080f 75%); }
.hud { transition: opacity 0.2s; }
.v-tag { font-family: var(--display); font-size: clamp(70px, 22vw, 130px); line-height: 0.95; color: var(--vc, var(--green)); text-shadow: 0 0 50px color-mix(in srgb, var(--vc, var(--green)) 60%, transparent); animation: slam 0.42s cubic-bezier(0.2, 1.6, 0.4, 1); }
.v-stat { font-size: 19px; font-weight: 700; }
.v-stat small { display: block; font-size: 14px; color: var(--muted); font-weight: 500; margin-top: 4px; }
.v-next { margin-top: 10px; font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: 0.08em; }

.watch { background: rgba(7, 8, 15, 0.94); justify-content: flex-start; padding-top: calc(70px + var(--sat)); }
.w-tag { font-family: var(--display); font-size: 54px; line-height: 1; color: var(--red); }
.w-sub { color: var(--muted); font-size: 15px; }
.w-verb { font-family: var(--display); font-size: 40px; margin: 12px 0 4px; color: #fff; }
.mini { list-style: none; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.mini li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--panel); position: relative; overflow: hidden; }
.mini li .bar { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--pc) 22%, transparent); width: calc(var(--p, 0) * 100%); transition: width 0.18s linear; }
.mini li > * { position: relative; }
.mini .av { width: 28px; height: 28px; font-size: 14px; }
.mini .pname { font-size: 14.5px; }
.mini .st { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.mini .st.ok { color: var(--green); }
.mini .st.bad { color: var(--red); }

/* ── game over ───────────────────────────────────── */
.over { overflow: hidden; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.over-in { position: relative; flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: calc(64px + var(--sat)) 18px 12px; }
.ov-title { font-family: var(--display); font-weight: 400; font-size: clamp(56px, 17vw, 100px); line-height: 0.95; background: linear-gradient(90deg, var(--yellow), var(--orange), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.ov-sub { color: #c9cee0; font-size: 16px; }
.standings { list-style: none; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.standings li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); animation: pop 0.4s ease both; text-align: left; }
.standings li.me { border-color: rgba(255, 210, 63, 0.5); }
.standings .pos { width: 28px; font-family: var(--display); font-size: 22px; color: var(--muted); text-align: center; }
.standings li:first-child .pos { color: var(--yellow); }
.standings .st { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.over-foot { position: relative; padding: 12px 16px calc(16px + var(--sab)); display: flex; flex-direction: column; gap: 10px; }

/* ── toast ───────────────────────────────────────── */
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
  background: rgba(20, 22, 36, 0.95); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: pop 0.25s ease;
}

.cam-feed { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; z-index: -2; }

/* ═════════════════════ BIG SCREEN ═════════════════════ */
.tv { position: fixed; inset: 0; }
.tv-screen { position: absolute; inset: 0; padding: 4vh 4vw; }
.tv-lobby { display: grid; grid-template-columns: 1.1fr 1fr; gap: 4vw; align-items: center; padding-top: max(4vh, 60px); }
.tv-timebar i { transition: transform 0.05s linear; }
.tv-left { display: flex; flex-direction: column; gap: 3vh; align-items: flex-start; }
.tvlogo { align-items: flex-start; }
.tvlogo .glitch { font-size: clamp(60px, 8.4vw, 170px); }
.tv-pitch { font-size: clamp(16px, 1.45vw, 26px); color: #c9cee0; line-height: 1.5; max-width: 36ch; }
.tv-pitch b { color: var(--text); }
.join-card { display: flex; align-items: center; gap: 2.4vw; padding: 2vw; border-radius: 28px; background: var(--panel); border: 1px solid var(--line); }
#tv-qr { width: clamp(160px, 16vw, 320px); aspect-ratio: 1; }
.join-text .lbl { font-size: clamp(13px, 1.05vw, 19px); color: var(--muted); }
.join-text .url { font-family: var(--mono); font-weight: 700; font-size: clamp(18px, 1.7vw, 32px); color: var(--cyan); margin: 0.3vh 0 1.4vh; }
.join-text .code { font-family: var(--mono); font-weight: 700; font-size: clamp(48px, 6vw, 120px); letter-spacing: 0.16em; color: var(--yellow); line-height: 1; text-shadow: 0 0 40px rgba(255, 210, 63, 0.4); }
.tv-right { display: flex; flex-direction: column; gap: 2.4vh; height: 100%; justify-content: center; }
.tv-h { font-family: var(--mono); font-weight: 500; font-size: clamp(13px, 1.1vw, 20px); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.tv-h span { color: var(--text); }
.tv-players { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 12vw, 240px), 1fr)); gap: 1.2vw; max-height: 52vh; overflow: hidden; }
.tv-players li { display: flex; align-items: center; gap: 0.9vw; padding: 1vw; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
.tv-players li.off { opacity: 0.4; }
.tv-players .av { width: clamp(34px, 3vw, 60px); height: clamp(34px, 3vw, 60px); font-size: clamp(17px, 1.5vw, 30px); }
.tv-players .pname { font-size: clamp(15px, 1.25vw, 24px); }
.tv-players .pname small { font-size: clamp(11px, 0.85vw, 16px); }
.tv-empty { color: var(--muted); font-size: clamp(15px, 1.3vw, 24px); }
.tv-actions { display: flex; gap: 1vw; align-items: center; }
.tv-actions .btn.big { width: auto; min-width: 16vw; font-size: clamp(18px, 1.5vw, 28px); }
.tv-join { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8vw; color: var(--muted); font-size: clamp(13px, 0.95vw, 17px); }
.tv-join input { width: 9em; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.25em; padding: 9px 12px; font-size: 15px; }

.tv-stage { display: flex; flex-direction: column; gap: 2.4vh; }
.tv-top { display: flex; align-items: center; gap: 1.2vw; font-family: var(--mono); font-size: clamp(13px, 1.1vw, 20px); color: var(--muted); }
.tv-round { color: var(--text); font-weight: 700; padding: 0.6vh 1vw; border-radius: 12px; background: var(--panel2); }
.tv-codechip { margin-left: auto; }
.tv-codechip b { color: var(--yellow); letter-spacing: 0.16em; }
.tv-ann { text-align: center; display: flex; flex-direction: column; align-items: center; transition: all 0.4s ease; }
.tv-speed { font-family: var(--display); font-size: clamp(30px, 3.4vw, 64px); color: var(--yellow); animation: blink 0.25s steps(2) infinite; }
.tv-verb { font-family: var(--display); font-weight: 400; font-size: clamp(90px, 15vw, 300px); line-height: 0.9; color: #fff; text-shadow: 0 0 80px color-mix(in srgb, var(--c0) 70%, transparent); }
.tv-verb.slam { animation: slam 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
.tv-hint { font-size: clamp(18px, 2vw, 38px); font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.tv-count { font-family: var(--display); font-size: clamp(60px, 7vw, 140px); height: 1.1em; line-height: 1.1; }
.tv-count.tick { animation: tick 0.5s ease; }
.tv-stage.playing .tv-ann { flex-direction: row; justify-content: center; gap: 2vw; align-items: baseline; }
.tv-stage.playing .tv-verb { font-size: clamp(60px, 7vw, 140px); }
.tv-stage.playing .tv-count { display: none; }
.tv-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 50% at 50% 30%, color-mix(in srgb, var(--c0) 30%, transparent), transparent 70%); transition: background 0.6s; }
.tv-timebar { height: 1.2vh; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.tv-timebar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--c0), var(--c1)); transform-origin: left; }
.tv-race { list-style: none; flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 11vw, 220px), 1fr)); gap: 1.4vw; align-content: center; }
.racer { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1vh; padding: 1.4vw 0.8vw; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); transition: transform 0.25s, border-color 0.25s, background 0.25s; }
.racer .ring { position: relative; width: clamp(70px, 6.4vw, 130px); aspect-ratio: 1; }
.racer .ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.racer .ring circle { fill: none; stroke-width: 7; }
.racer .ring .track { stroke: rgba(255, 255, 255, 0.1); }
.racer .ring .fill { stroke: var(--pc); stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: calc(289 * (1 - var(--p, 0))); transition: stroke-dashoffset 0.18s linear; filter: drop-shadow(0 0 6px var(--pc)); }
.racer .av { position: absolute; inset: 16%; width: auto; height: auto; font-size: clamp(22px, 2.4vw, 46px); }
.racer .pname { font-size: clamp(14px, 1.15vw, 22px); text-align: center; max-width: 100%; }
.racer .st { font-family: var(--mono); font-size: clamp(13px, 1vw, 19px); color: var(--muted); min-height: 1.3em; }
.racer.ok { border-color: rgba(47, 230, 166, 0.55); background: rgba(47, 230, 166, 0.08); transform: translateY(-4px); }
.racer.ok .st { color: var(--green); }
.racer.bad { border-color: rgba(255, 77, 94, 0.5); background: rgba(255, 77, 94, 0.08); }
.racer.bad .st { color: var(--red); }
.racer .hearts svg { width: clamp(14px, 1.1vw, 22px); height: clamp(14px, 1.1vw, 22px); }

.tv-results { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; }
.tv-rows { list-style: none; width: min(1100px, 92vw); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 1vh 1.6vw; }
.tv-rows li { display: flex; align-items: center; gap: 1vw; padding: 1.1vh 1.2vw; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); opacity: 0; animation: rowin 0.4s ease forwards; }
@keyframes rowin { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.tv-rows .pos { font-family: var(--display); font-size: clamp(20px, 1.8vw, 34px); width: 2.2ch; text-align: center; color: var(--muted); }
.tv-rows .av { width: clamp(30px, 2.4vw, 48px); height: clamp(30px, 2.4vw, 48px); font-size: clamp(15px, 1.2vw, 24px); }
.tv-rows .pname { flex: 1; font-size: clamp(15px, 1.3vw, 25px); }
.tv-rows .pname small.hearts { display: flex; margin-top: 4px; }
.tv-rows .hearts svg { width: clamp(14px, 1.05vw, 20px); height: clamp(14px, 1.05vw, 20px); }
.tv-rows .st { font-family: var(--mono); font-size: clamp(13px, 1.05vw, 20px); color: var(--muted); }
.tv-rows .tag { font-family: var(--display); font-size: clamp(16px, 1.4vw, 28px); letter-spacing: 0.04em; min-width: 4.5em; text-align: right; }
.tv-rows li.lost { border-color: rgba(255, 77, 94, 0.55); background: rgba(255, 77, 94, 0.1); animation: rowin 0.4s ease forwards, shake 0.45s ease 0.9s; }
.tv-rows li.lost .tag { color: var(--red); }
.tv-rows li.out { background: rgba(255, 77, 94, 0.22); }
.tv-rows li.saved .tag { color: var(--yellow); }
.tv-rows li.first .tag { color: var(--green); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.tv-next { font-family: var(--mono); color: var(--muted); font-size: clamp(13px, 1vw, 19px); }
.tv-intro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; text-align: center; background: rgba(7, 8, 15, 0.9); }
.tv-intro h2 { font-family: var(--display); font-weight: 400; font-size: clamp(60px, 8vw, 160px); line-height: 1; }
.tv-intro p { font-size: clamp(17px, 1.6vw, 30px); color: #c9cee0; }
.tv-intro .kicker { font-size: clamp(13px, 1.1vw, 20px); }

.tv-over { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.4vh; text-align: center; }
.tv-winner { font-family: var(--display); font-weight: 400; font-size: clamp(80px, 12vw, 240px); line-height: 0.95; background: linear-gradient(90deg, var(--yellow), var(--orange), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.tv-over .kicker { font-size: clamp(14px, 1.2vw, 22px); }
.tv-standings { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 1vw; max-width: 80vw; }
.tv-standings li { display: flex; align-items: center; gap: 0.8vw; padding: 1vh 1.2vw; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: clamp(14px, 1.2vw, 22px); animation: pop 0.4s ease both; }
.tv-standings .pos { font-family: var(--display); color: var(--muted); }
.tv-standings .av { width: clamp(28px, 2.2vw, 42px); height: clamp(28px, 2.2vw, 42px); font-size: clamp(14px, 1.1vw, 20px); }

@media (max-width: 820px) {
  .tv-lobby { grid-template-columns: 1fr; overflow-y: auto; }
  .tv-right { height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
