:root {
  --navy: #101b4d;
  --navy-2: #182664;
  --blue: #2166d1;
  --cyan: #3ed5e8;
  --yellow: #ffd84a;
  --coral: #ff6d68;
  --cream: #fffaf0;
  --ink: #162044;
  --muted: #657096;
  --green: #149b68;
  --red: #d83b4c;
  --white: #fff;
  --shadow: 0 18px 50px rgba(7, 14, 48, .2);
  font-family: Inter, ui-rounded, "Avenir Next", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--navy);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #27459a 0, transparent 34%), linear-gradient(145deg, #101b4d 0%, #12183d 100%); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .14; background-image: linear-gradient(30deg, transparent 40%, var(--cyan) 41%, transparent 42%), linear-gradient(150deg, transparent 40%, var(--yellow) 41%, transparent 42%); background-size: 90px 90px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }

#app { position: relative; min-height: 100vh; }
.screen { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; padding: 32px 20px 48px; background: var(--cream); box-shadow: 0 0 60px rgba(0,0,0,.24); }
.hidden { display: none !important; }

.brand-lockup { text-align: center; margin: 10px auto 20px; }
.brand-kicker { display: block; color: var(--navy); font-size: .8rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.brand-lockup h1 { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: 5px; margin: 8px auto; max-width: 440px; color: white; font-size: clamp(1.75rem, 8vw, 3.1rem); letter-spacing: -.065em; line-height: .92; }
.brand-lockup h1 span { padding: 12px 8px; background: var(--blue); box-shadow: 4px 5px 0 var(--navy); transform: rotate(-1deg); }
.brand-lockup h1 span:nth-child(2) { background: var(--cyan); color: var(--navy); transform: rotate(1deg); }
.brand-lockup > strong { display: inline-block; margin-top: 5px; padding: 7px 22px; border-radius: 999px; background: var(--yellow); color: var(--navy); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; transform: rotate(-1deg); }
.tagline { max-width: 440px; margin: 0 auto 22px; text-align: center; color: var(--muted); font-weight: 650; }

.panel, .settings-block, .room-card, .question-card, .round-card, .correct-answer { border: 2px solid rgba(16,27,77,.1); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.panel { padding: 22px; }
.home-panel { max-width: 500px; margin: auto; }
.home-panel + .home-panel { margin-top: 18px; }
label { display: block; margin-bottom: 8px; color: var(--navy); font-size: .84rem; font-weight: 850; }
input, select { width: 100%; min-height: 49px; padding: 11px 14px; border: 2px solid #ccd2e4; border-radius: 12px; background: white; color: var(--ink); }
input:focus, select:focus { border-color: var(--blue); }
.check-row { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; padding: 14px; border-radius: 14px; background: #edf8fa; cursor: pointer; }
.check-row input { flex: 0 0 auto; width: 22px; min-height: 22px; accent-color: var(--blue); }
.check-row span { display: grid; gap: 3px; }
.check-row small { color: var(--muted); font-weight: 600; line-height: 1.3; }
.btn { min-height: 48px; padding: 11px 18px; border: 2px solid var(--navy); border-radius: 12px; background: white; color: var(--navy); font-weight: 900; box-shadow: 3px 4px 0 var(--navy); transition: transform .12s, box-shadow .12s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 4px 6px 0 var(--navy); }
.btn:active:not(:disabled) { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--navy); }
.btn-primary { width: 100%; background: var(--yellow); }
.btn-small { min-height: 40px; padding: 8px 12px; font-size: .82rem; }
.btn-large { margin-top: 16px; font-size: 1.05rem; }
.divider { display: flex; align-items: center; gap: 10px; margin: 20px 0; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #d8dceb; }
.join-row { display: flex; flex-direction: column; gap: 10px; }
.join-row input { flex: 1; }
#code-input { letter-spacing: .22em; font-weight: 900; text-transform: uppercase; }
.rules { max-width: 500px; margin: 18px auto; padding: 14px 18px; border-radius: 14px; background: rgba(255,255,255,.65); }
.rules summary { cursor: pointer; font-weight: 850; color: var(--navy); }
.rules li { margin: 8px 0; color: var(--muted); line-height: 1.4; }
.legal { max-width: 560px; margin: 20px auto 0; color: #7b849f; font-size: .7rem; text-align: center; }
.error { min-height: 1em; margin: 12px 0 0; color: var(--red); font-weight: 700; }

.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: .78rem; font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }
h2 { margin: 0 0 22px; color: var(--navy); font-size: clamp(1.75rem, 7vw, 2.7rem); line-height: 1.08; }
.room-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 18px; padding: 17px 20px; margin-bottom: 18px; background: var(--navy); color: white; }
.room-code-copy { display: grid; gap: 5px; }
.room-card span { color: #b8c7ff; font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.room-card strong { font-size: 2rem; letter-spacing: .16em; color: var(--yellow); }
.room-card .btn { width: max-content; border-color: white; box-shadow: none; color: var(--navy); }
.room-invite { display: flex; align-items: center; gap: 10px; }
.room-qr { display: grid; place-items: center; width: 96px; height: 96px; padding: 4px; border-radius: 8px; background: white; }
.room-qr svg { display: block; width: 88px; height: 88px; }
.room-invite-copy { display: grid; gap: 4px; max-width: 110px; }
.room-invite-copy small { color: #c6d1f3; font-size: .65rem; line-height: 1.25; overflow-wrap: anywhere; }
.settings-block { margin-top: 18px; padding: 18px; box-shadow: none; }
.settings-block h3 { margin: 0 0 16px; color: var(--navy); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-grid label { margin: 0; }
.settings-grid select { margin-top: 7px; }
.text-btn { margin-top: 14px; padding: 5px 0; border: 0; background: none; color: var(--blue); font-weight: 800; text-decoration: underline; }
.status { min-height: 1.4em; color: var(--muted); font-weight: 700; text-align: center; }

.leaderboard { display: grid; gap: 8px; }
.leader-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; min-height: 52px; padding: 8px 13px; border: 2px solid #dfe3ef; border-radius: 13px; background: white; }
.leader-row.is-me { border-color: var(--blue); background: #eef5ff; }
.leader-rank { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--navy); color: white; font-size: .75rem; font-weight: 900; }
.leader-name { overflow: hidden; text-overflow: ellipsis; font-weight: 850; }
.leader-score { color: var(--blue); font-weight: 950; }
.offline { color: var(--muted); font-size: .7rem; }

.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: var(--navy); }
.game-header div { display: grid; gap: 2px; font-weight: 900; }
.game-header small { color: var(--muted); font-weight: 750; }
.score-pill { padding: 8px 12px; border-radius: 999px; background: var(--yellow); }
.round-card { display: flex; gap: 13px; align-items: center; padding: 14px 16px; margin-bottom: 14px; border: 0; background: var(--navy); color: white; box-shadow: none; }
.round-card > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--yellow); font-size: 1.35rem; }
.round-card p { margin: 0 0 2px; font-weight: 950; }
.round-card small { color: #c6d1f3; }
.question-card { min-height: 180px; display: grid; place-items: center; align-content: center; padding: 25px; margin: 15px 0; text-align: center; }
.question-card h2 { margin: 5px 0 0; font-size: clamp(1.35rem, 6vw, 2rem); }
.question-value { margin: 0; color: var(--coral); font-size: .73rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.choice { min-height: 76px; padding: 13px; border: 2px solid var(--navy); border-radius: 15px; background: white; color: var(--navy); font-weight: 850; box-shadow: 3px 4px 0 var(--navy); }
.choice.locked { border-color: var(--blue); background: var(--blue); color: white; box-shadow: 3px 4px 0 var(--cyan); }
.choice.locked::after { content: "  ✓ LOCKED"; font-size: .65rem; }
.choice:disabled:not(.locked) { opacity: .52; }
.banner { margin: 12px 0; padding: 13px; border-radius: 12px; background: #e9f7f9; color: var(--navy); font-weight: 750; text-align: center; }
.mini-roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 18px; }
.player-chip { padding: 7px 10px; border-radius: 999px; background: #e4e6ef; color: var(--muted); font-size: .75rem; font-weight: 850; }
.player-chip.answered { background: #d8f4e8; color: #08764c; }
.player-chip.offline-chip { opacity: .62; }

.timer { position: relative; height: 30px; overflow: hidden; border-radius: 999px; background: #dfe3ed; }
.timer > div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--cyan), var(--blue)); transform-origin: left; }
.timer > span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--navy); font-size: .72rem; font-weight: 950; }
.timer.danger > div { background: var(--coral); }

.correct-answer { padding: 19px; margin: 16px 0; text-align: center; background: var(--navy); color: white; }
.correct-answer span { display: block; color: var(--cyan); font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.correct-answer strong { display: block; margin-top: 5px; color: var(--yellow); font-size: 1.45rem; }
.explanation { color: var(--muted); line-height: 1.5; text-align: center; }
.results { display: grid; gap: 8px; margin: 18px 0; }
.result-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-radius: 13px; background: white; border: 2px solid #dfe3ef; }
.result-row.correct { border-color: #8ad7b9; background: #effbf6; }
.result-row.wrong { border-color: #efb4ba; background: #fff4f5; }
.result-name { font-weight: 900; }
.result-points { font-weight: 950; color: var(--green); }
.result-answer { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; }
.leaderboard-title { margin: 22px 0 10px; color: var(--navy); }
.compact .leader-row { min-height: 44px; }
.trophy { margin: 30px 0 12px; font-size: 4.5rem; text-align: center; filter: drop-shadow(0 8px 5px rgba(0,0,0,.15)); }
#screen-over { text-align: center; }
.winner-names { margin: -10px 0 24px; color: var(--blue); font-size: clamp(1.5rem, 7vw, 2.5rem); font-weight: 950; }
.final { text-align: left; }
#home-btn { margin-top: 16px; box-shadow: none; }

.toast { position: fixed; z-index: 10; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(calc(100% - 32px), 500px); padding: 13px 17px; border-radius: 12px; background: var(--navy); color: white; box-shadow: var(--shadow); text-align: center; font-weight: 800; }

@media (max-width: 520px) {
  .screen { padding: 24px 16px 38px; }
  .settings-grid, .choices { grid-template-columns: 1fr; }
  .choice { min-height: 62px; }
  .room-card { grid-template-columns: 1fr; text-align: center; }
  .room-code-copy { justify-items: center; }
  .room-card .btn { width: 100%; }
  .room-invite { justify-content: center; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
