:root {
  color-scheme: dark;
  --navy-950: #010617;
  --navy-900: #03102b;
  --navy-800: #071a3c;
  --navy-700: #0b2b59;
  --cyan: #55d3ff;
  --cyan-soft: #a9ebff;
  --gold: #ffd24e;
  --gold-deep: #d98a08;
  --pink: #ff4f88;
  --green: #51e4ae;
  --muted: #91a8c7;
  --text: #f6fbff;
  --border: rgba(99, 186, 235, .28);
  font-family: Bahnschrift, "Arial Narrow", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-width: 300px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(30, 113, 214, .36), transparent 42%),
    linear-gradient(155deg, #06173c 0%, var(--navy-950) 58%, #020817 100%);
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.screen { min-height: 100dvh; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.brand-logo {
  position: relative;
  width: min(315px, 78vw);
  padding: 24px 32px 28px;
  border: 4px solid #f7bd28;
  border-radius: 50%;
  text-align: center;
  transform: skew(-3deg) rotate(-1deg);
  background: linear-gradient(145deg, #113995, #061953 62%, #030b2b);
  box-shadow: 0 0 0 6px #0b5dc3, 0 0 0 9px #e1a51f, 0 0 42px rgba(38, 148, 255, .5), inset 0 0 24px rgba(84, 190, 255, .32);
}
.brand-logo::before {
  content: "";
  position: absolute;
  inset: -15px;
  z-index: -1;
  border-radius: 50%;
  background-image: radial-gradient(circle, #fff4a8 0 2px, #ffc331 2.5px 4px, transparent 4.5px);
  background-size: 17px 17px;
  filter: drop-shadow(0 0 7px #ffd44f);
}
.brand-logo span, .brand-logo strong { display: block; line-height: .76; text-shadow: 0 4px 0 #8b1800, 0 7px 9px rgba(0,0,0,.55), 0 0 18px rgba(255,223,86,.8); }
.brand-logo span { color: #fff; font-size: clamp(34px, 11vw, 53px); font-weight: 900; letter-spacing: .04em; -webkit-text-stroke: 1px #ffc73a; }
.brand-logo strong { color: var(--gold); font-size: clamp(48px, 15vw, 75px); font-weight: 900; letter-spacing: .02em; -webkit-text-stroke: 1px #fff3af; }
.brand-logo em { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%) skew(3deg); white-space: nowrap; padding: 5px 11px; border: 2px solid #ffd65b; border-radius: 999px; color: #fff; background: #e63d2f; font-size: 9px; font-style: normal; font-weight: 900; letter-spacing: .15em; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.brand-logo.small { width: 176px; padding: 13px 18px 15px; border-width: 2px; box-shadow: 0 0 0 3px #0b5dc3, 0 0 0 5px #dca020, 0 0 24px rgba(38,148,255,.42); }
.brand-logo.small::before { inset: -8px; background-size: 11px 11px; }
.brand-logo.small span { font-size: 23px; }
.brand-logo.small strong { font-size: 33px; }
.brand-logo.small em { bottom: -7px; padding: 3px 7px; border-width: 1px; font-size: 5px; }

.start-screen, .login-screen, .finish-screen {
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}
.start-card, .login-card, .finish-card {
  width: min(470px, 100%);
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 44px 30px 34px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(8, 30, 69, .97), rgba(2, 11, 32, .98));
  box-shadow: 0 30px 90px rgba(0,0,0,.48);
  text-align: center;
}
.demo-label { margin: 7px 0 0; color: var(--cyan); font-size: .82rem; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; }
.start-card h1, .finish-card h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1; }
.start-card p, .finish-card p { max-width: 34ch; margin: -8px 0 0; color: #bdd0e8; font: 1rem/1.55 Arial, sans-serif; }
.primary-button {
  min-height: 58px;
  padding: 0 28px;
  border: 1px solid #83e4ff;
  border-radius: 12px;
  color: #031225;
  background: linear-gradient(#79e0ff, #27aee9);
  box-shadow: 0 10px 30px rgba(25, 176, 232, .26), inset 0 1px 0 #d8f8ff;
  font-weight: 900;
  letter-spacing: .04em;
}
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button.wide { width: 100%; }
.start-button { width: min(270px, 100%); min-height: 72px; font-size: 1.35rem; text-transform: uppercase; }

.login-card { justify-items: stretch; gap: 16px; text-align: left; }
.login-card .brand-logo { justify-self: center; margin-bottom: 9px; }
.login-card header { text-align: center; }
.login-card h1 { margin: 4px 0 8px; font-size: 2.25rem; }
.login-card header p { margin: 0; color: var(--muted); font: .95rem/1.45 Arial, sans-serif; }
.field { display: grid; gap: 7px; color: #cfe3f7; font-size: .88rem; font-weight: 800; }
.field input, .answer-text {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #315b87;
  border-radius: 10px;
  outline: none;
  color: #fff;
  background: #041229;
  font-size: 1rem;
}
.field input:focus, .answer-text:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(85,211,255,.15); }
.consent { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; color: #aebfd5; font: .78rem/1.45 Arial, sans-serif; }
.consent input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: #31bce9; }
.privacy-note { margin: 0; padding: 10px 12px; border-radius: 9px; color: #8eddbf; background: rgba(43, 177, 128, .1); font: .75rem/1.4 Arial, sans-serif; }

.game-screen { min-height: 100dvh; display: grid; grid-template-rows: auto auto auto 1fr; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 12px calc(84px + env(safe-area-inset-bottom)); }
.player-brand { display: grid; justify-items: center; padding: 10px 0 18px; }
.game-top { display: grid; grid-template-columns: minmax(0,1fr) 82px minmax(0,1fr); align-items: stretch; gap: 7px; }
.team-card, .timer-card { min-width: 0; display: grid; align-content: center; gap: 3px; min-height: 77px; padding: 9px; border: 1px solid var(--border); border-radius: 12px; background: rgba(5, 21, 49, .94); }
.team-card.team-one { border-top: 3px solid var(--cyan); }
.team-card.team-two { border-top: 3px solid var(--pink); text-align: right; }
.team-card span, .timer-card span { color: #77a2ca; font-size: .61rem; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.team-card strong { overflow: hidden; font-size: .88rem; white-space: nowrap; text-overflow: ellipsis; }
.team-card b { color: #fff; font-size: 1.5rem; line-height: 1; }
.team-card.buzzed { filter: brightness(1.35); box-shadow: 0 0 24px rgba(85,211,255,.32); }
.timer-card { justify-items: center; padding: 7px 4px; border-color: rgba(255,210,78,.4); text-align: center; }
.timer-card strong { font-size: 1.72rem; font-variant-numeric: tabular-nums; }
.timer-card.danger strong { color: #ff819b; animation: pulse .55s ease-in-out infinite alternate; }

.question-card { padding: 16px 15px; border: 1px solid rgba(79,177,231,.38); border-radius: 14px; background: linear-gradient(150deg, #0a2a5b, #061733); box-shadow: inset 0 0 26px rgba(45,154,225,.09); text-align: center; }
.question-card .round { color: var(--cyan); font-size: .68rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.question-card h1 { margin: 7px 0 0; font-size: clamp(1.35rem, 6vw, 2rem); line-height: 1.12; }

.play-area { position: relative; min-height: 0; display: grid; align-content: start; gap: 12px; }
.answer-board { position: relative; display: grid; gap: 7px; padding: 11px; border: 3px solid var(--gold); border-radius: 15px; background: linear-gradient(#061537, #02091d); box-shadow: 0 0 0 2px #684309, 0 0 30px rgba(255,194,50,.14), inset 0 0 24px rgba(27,112,201,.2); perspective: 900px; }
.answer-tile { min-height: 48px; display: grid; grid-template-columns: 35px 1fr 46px; align-items: center; overflow: hidden; border: 1px solid #5dcfff; border-radius: 7px; color: #fff; background: linear-gradient(#1474c5, #07509b); box-shadow: inset 0 0 18px rgba(120,220,255,.2); transform-style: preserve-3d; transition: transform .5s, filter .25s; }
.answer-tile span { display: grid; place-items: center; height: 100%; border-right: 1px solid rgba(255,255,255,.32); color: var(--cyan-soft); font-weight: 900; }
.answer-tile strong { padding: 0 10px; overflow: hidden; font-size: 1rem; text-transform: uppercase; white-space: nowrap; text-overflow: ellipsis; }
.answer-tile b { display: grid; place-items: center; height: 100%; border-left: 1px solid rgba(255,255,255,.32); color: var(--gold); font-size: 1.25rem; }
.answer-tile.hidden strong, .answer-tile.hidden b { visibility: hidden; }
.answer-tile.hidden::after { content: "?"; grid-column: 2; grid-row: 1; justify-self: center; color: rgba(199,236,255,.55); font-size: 1.2rem; font-weight: 900; }
.answer-tile.revealed { animation: tile-flip .55s ease both; border-color: #fff5aa; filter: brightness(1.15); }
.turn-button { width: 100%; min-height: 64px; display: grid; place-items: center; gap: 2px; border: 1px solid #76f5cf; border-radius: 12px; color: #02231d; background: linear-gradient(135deg, #69f2c2, #2fcf9b); box-shadow: 0 0 28px rgba(67,225,170,.25); font-size: 1.18rem; font-weight: 900; animation: button-glow .7s ease-in-out infinite alternate; }
.turn-button small { font: .73rem Arial, sans-serif; }

.answer-panel-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 10px; background: rgba(0,4,16,.84); backdrop-filter: blur(7px); }
.answer-panel { width: min(470px, 100%); max-height: calc(100dvh - 20px); display: grid; gap: 10px; overflow-y: auto; padding: 17px; border: 1px solid #3d95c6; border-radius: 17px; background: #071832; box-shadow: 0 28px 80px rgba(0,0,0,.65); }
.answer-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.answer-panel header > div { min-width: 0; flex: 1; }
.answer-panel h2 { margin: 7px 0 0; font-size: clamp(1.8rem, 6.5vw, 2.35rem); line-height: 1.1; text-wrap: balance; }
.answer-panel .countdown { flex-shrink: 0; }
.start-notice { margin: 0; padding: 12px; border: 1px solid var(--gold); border-radius: 10px; color: #fff0ac; background: #19304b; font-size: 1rem; line-height: 1.35; font-weight: 800; animation: quick-message-in .25s ease both; }
.countdown { display: grid; place-items: center; min-width: 52px; height: 52px; border: 2px solid var(--gold); border-radius: 50%; color: #fff; background: #11336a; font-size: 1.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.answer-prompt { margin: 0; color: #c0d0e5; font: .85rem/1.4 Arial, sans-serif; }
.answer-field { display: grid; gap: 6px; }
.answer-field > span { color: var(--cyan); font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.answer-list { width: 100%; min-height: 138px; padding: 5px; border: 1px solid #315a82; border-radius: 10px; outline: none; color: #e9f6ff; background: #061229; font-size: 1rem; font-weight: 800; }
.answer-list:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(75,197,245,.18); }
.answer-list option { padding: 7px 9px; }
.answer-text { min-height: 69px; resize: vertical; }
.answer-actions { display: grid; grid-template-columns: .85fr 1.3fr; gap: 8px; }
.secondary-button { min-height: 52px; border: 1px solid #2d5279; border-radius: 10px; color: #c8d8e9; background: #0b203f; font-weight: 800; }
.speech-button.listening { color: #052118; border-color: var(--green); background: var(--green); }
.speech-note { min-height: 18px; margin: -4px 0 0; color: #83d9f7; font: .72rem/1.35 Arial, sans-serif; text-align: center; }

.strike-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 22px; background: rgba(0,3,13,.9); backdrop-filter: blur(5px); }
.strike-stage { width: min(470px,100%); display: grid; justify-items: center; gap: 14px; text-align: center; }
.strike-stage > p { margin: 0; color: #ff9caf; font-size: .82rem; font-weight: 900; letter-spacing: .18em; }
.strike-stage h2 { margin: 0; color: #fff; font-size: clamp(2rem,9vw,3.4rem); text-shadow: 0 4px 18px #000; }
.strike-row { width: 100%; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.strike-x { display: grid; place-items: center; aspect-ratio: 1; border: 5px solid #6c2638; border-radius: 17px; color: #7a2a3d; background: #1a0a18; font-size: clamp(4.5rem,24vw,8rem); font-weight: 900; line-height: .7; text-shadow: 0 4px 0 #630016; box-shadow: inset 0 0 25px rgba(255,33,79,.08); }
.strike-x.earned { color: #ff234e; border-color: #ff3459; background: #3b0714; box-shadow: 0 0 30px rgba(255,35,78,.3), inset 0 0 30px rgba(255,73,106,.2); }
.strike-x.current { animation: strike-flash .22s steps(2,end) 6, strike-hit .55s ease both; }
.strike-x.waiting { filter: brightness(.42) saturate(.5); }
.quick-message { position: fixed; z-index: 42; left: max(12px,env(safe-area-inset-left)); right: max(12px,env(safe-area-inset-right)); bottom: calc(82px + env(safe-area-inset-bottom)); width: min(520px,calc(100% - 24px)); min-height: 76px; margin: auto; display: grid; grid-template-columns: 50px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid; border-radius: 14px; background: rgba(4,18,43,.97); box-shadow: 0 18px 55px rgba(0,0,0,.62); animation: quick-message-in .34s ease both; }
.quick-message.correct { border-color: var(--green); }
.quick-message.wrong { border-color: #ff4b70; }
.quick-message-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 3px solid currentColor; border-radius: 50%; font-size: 2.25rem; font-weight: 900; line-height: 1; }
.quick-message.correct .quick-message-icon { color: var(--green); }
.quick-message.wrong .quick-message-icon { color: #ff4b70; }
.quick-message span, .quick-message strong { display: block; }
.quick-message span { margin-bottom: 3px; color: var(--cyan); font-size: .66rem; font-weight: 900; letter-spacing: .12em; }
.quick-message strong { overflow: hidden; color: #fff; font-size: .88rem; line-height: 1.25; }
.quick-message .primary-button { min-height: 48px; padding: 0 14px; }
.round-event-message { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--border); text-align: center; }
.round-event-message p { margin: 0 0 10px; color: #e3efff; font-size: 1rem; line-height: 1.4; }
.round-event-message a { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 16px; border: 1px solid #ffe68a; border-radius: 10px; color: #07142a; background: var(--gold); font-size: 1.1rem; font-weight: 900; text-decoration: none; }
.round-event-message a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.phone-nav { position: fixed; z-index: 20; left: max(10px,env(safe-area-inset-left)); right: max(10px,env(safe-area-inset-right)); bottom: max(8px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: .8fr 1fr 1.4fr; gap: 5px; padding: 6px; border: 1px solid rgba(86,188,240,.42); border-radius: 14px; background: rgba(3,13,35,.97); box-shadow: 0 15px 45px rgba(0,0,0,.55); backdrop-filter: blur(14px); }
.phone-nav button { min-width: 0; min-height: 49px; border: 1px solid transparent; border-radius: 9px; color: #91a8c7; background: transparent; font-size: .67rem; font-weight: 900; }
.phone-nav button.active { color: #fff; border-color: #3baee7; background: #0c3763; }
.phone-nav button:last-child { overflow: hidden; text-align: left; }
.phone-nav button span, .phone-nav button strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.phone-nav button span { color: #7590b2; font-size: .55rem; text-transform: uppercase; }
.players-drawer { position: fixed; inset: 0; z-index: 25; display: grid; align-content: end; background: rgba(0,4,16,.68); }
.players-card { display: grid; gap: 12px; max-height: 78dvh; overflow: auto; padding: 24px 18px calc(92px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #061633; box-shadow: 0 -20px 60px rgba(0,0,0,.55); }
.players-card header { display: flex; align-items: center; justify-content: space-between; }
.players-card h2 { margin: 0; font-size: 1.8rem; }
.player-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: rgba(10,42,84,.48); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #041225; background: var(--cyan); font-weight: 900; }
.player-row strong, .player-row small { display: block; }
.player-row small { margin-top: 3px; color: #829abd; font: .68rem Arial,sans-serif; }
.player-row b { color: var(--gold); }

@keyframes tile-flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes screen-flip { from { opacity: 0; transform: rotateY(82deg) scale(.82); } to { opacity: 1; transform: rotateY(0) scale(1); } }
@keyframes strike-flash { 0%,49% { opacity: 1; filter: brightness(2); } 50%,100% { opacity: .32; filter: brightness(.7); } }
@keyframes strike-hit { 0% { transform: scale(.2) rotate(-12deg); } 65% { transform: scale(1.16) rotate(4deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes quick-message-in { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulse { to { transform: scale(1.08); filter: brightness(1.25); } }
@keyframes button-glow { to { filter: brightness(1.12); box-shadow: 0 0 40px rgba(67,225,170,.45); } }

@media (min-width: 760px) {
  .game-screen { width: min(560px,100%); margin: 0 auto; padding-top: 24px; }
  body::before, body::after { content: ""; position: fixed; top: 0; bottom: 0; width: 1px; background: linear-gradient(transparent,rgba(85,211,255,.35),transparent); }
  body::before { left: calc(50% - 300px); }
  body::after { right: calc(50% - 300px); }
}

@media (max-height: 720px) {
  .answer-panel { gap: 7px; padding: 12px; }
  .answer-panel h2 { font-size: clamp(1.7rem, 6vw, 2.15rem); }
  .countdown { min-width: 42px; height: 42px; font-size: 1.15rem; }
  .answer-list { min-height: 105px; }
  .answer-text { min-height: 55px; }
}

@media (max-width: 380px) {
  .quick-message { grid-template-columns: 42px minmax(0,1fr) auto; gap: 7px; }
  .quick-message-icon { width: 40px; height: 40px; font-size: 1.85rem; }
  .quick-message .primary-button { padding: 0 10px; font-size: .8rem; }
}

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