:root {
  --navy-950: #041039;
  --navy-900: #06174d;
  --navy-800: #0a2472;
  --blue-700: #123fa8;
  --blue-500: #2788ec;
  --gold-400: #ffd45c;
  --gold-300: #ffe592;
  --cream: #fff9e9;
  --white: #ffffff;
  --ink: #10204a;
  --danger: #a82929;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
  --radius-lg: 24px;
  --radius-md: 15px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--navy-950); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at 10% 10%, rgba(56, 142, 255, .28), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(255, 212, 92, .16), transparent 28%),
    linear-gradient(rgba(4, 16, 57, .55), rgba(4, 16, 57, .78)),
    url("/assets/hero.webp");
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-position: center, center, center, center top;
  background-size: cover, cover, cover, cover;
  background-attachment: fixed, fixed, fixed, fixed;
}

@media (max-width: 820px) {
  body { background-attachment: scroll, scroll, scroll, scroll; }
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--gold-400); outline-offset: 3px; }

.page-shell { width: min(1500px, 100%); margin-inline: auto; padding: 24px; }

.hero { text-align: center; padding: 18px 12px 28px; }
.hero__eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 7px 15px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .8rem;
}
.hero h1 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.3rem, 6vw, 5.4rem);
  line-height: .96;
  color: var(--gold-400);
  text-shadow: 0 5px 0 rgba(0,0,0,.22);
}
.hero > p { margin: 6px 0; }
#game-subtitle { font-size: clamp(1.15rem, 2.5vw, 1.7rem); font-weight: 800; }
.hero__instruction { color: var(--gold-300); }

.game-switcher {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-bottom: 22px;
}
.switcher-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.switcher-row:empty { display: none; }
.switcher-button {
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: 8px 18px;
  background: rgba(255,255,255,.08);
  color: white;
  font-weight: 800;
  font-size: .9rem;
}
.switcher-button:hover { background: rgba(255,255,255,.18); }
.switcher-button.is-active { background: var(--gold-400); color: var(--ink); border-color: var(--gold-400); }

.score-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 24px;
}

.team-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 15px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.09);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
  backdrop-filter: blur(12px);
}
.team-card label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.team-name {
  width: 100%;
  grid-column: 1;
  color: white;
  border: 0;
  border-bottom: 2px solid rgba(255,255,255,.28);
  background: transparent;
  font-weight: 800;
  font-size: 1.12rem;
}
.score {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 115px;
  text-align: right;
  color: var(--gold-400);
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1;
}
.score-buttons { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.score-buttons button {
  border: 0;
  border-radius: 10px;
  padding: 8px;
  background: rgba(255,255,255,.13);
  color: white;
  font-weight: 800;
}
.score-buttons button:hover { background: rgba(255,255,255,.23); }

.score-panel__center { display: grid; align-content: center; gap: 8px; min-width: 180px; }
.primary-action, .secondary-action, .text-action, .danger-action, .award-button {
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 900;
  border: 0;
}
.primary-action { background: var(--gold-400); color: var(--ink); box-shadow: 0 7px 0 #b9891f; }
.primary-action:active { transform: translateY(4px); box-shadow: 0 3px 0 #b9891f; }
.secondary-action { background: white; color: var(--ink); }
.text-action { background: transparent; color: white; border: 1px solid rgba(255,255,255,.3); }
.danger-action { background: var(--danger); color: white; }
.award-button { background: var(--blue-500); color: white; }

.board-wrap {
  overflow-x: auto;
  padding: 7px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.12);
  box-shadow: var(--shadow);
}
.game-board {
  min-width: 850px;
  display: grid;
  gap: 7px;
}
.category-cell, .clue-cell {
  min-height: 92px;
  border: 0;
  border-radius: 10px;
  text-align: center;
}
.category-cell {
  display: grid;
  place-items: center;
  padding: 12px;
  color: white;
  background: linear-gradient(155deg, #184fc1, #0b2b7c);
  font-family: "Baloo 2", cursive;
  font-weight: 800;
  font-size: clamp(.95rem, 1.6vw, 1.25rem);
  line-height: 1.08;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.clue-cell {
  position: relative;
  color: var(--gold-400);
  background: linear-gradient(145deg, #0d318d, #071f69);
  font-family: "Baloo 2", cursive;
  font-size: clamp(1.75rem, 3.2vw, 3rem);
  font-weight: 800;
  text-shadow: 2px 3px 0 rgba(0,0,0,.4);
  transition: transform .16s ease, filter .16s ease;
}
.clue-cell:hover:not(:disabled) { transform: translateY(-3px) scale(1.015); filter: brightness(1.18); }
.clue-cell:disabled { color: transparent; background: rgba(7, 31, 105, .45); cursor: default; text-shadow: none; }
.clue-cell:disabled::after { content: "✓"; color: rgba(255,255,255,.22); font-size: 2.4rem; }

footer { text-align: center; color: rgba(255,255,255,.62); padding: 24px 0 8px; font-size: .9rem; }

.game-dialog, .confirm-dialog {
  width: min(820px, calc(100% - 28px));
  border: 0;
  border-radius: 28px;
  padding: 0;
  color: white;
  background: transparent;
}
.game-dialog::backdrop, .confirm-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(5px); }
.dialog-card {
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: clamp(26px, 6vw, 60px);
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 28px;
  text-align: center;
  background:
    radial-gradient(circle at top right, rgba(255,212,92,.2), transparent 27%),
    linear-gradient(150deg, #123fa8, #06174d 75%);
  box-shadow: var(--shadow);
}
.dialog-topline { display: flex; justify-content: space-between; gap: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.dialog-value { color: var(--gold-400); }
.daily-double {
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 800;
  line-height: 1;
  color: var(--gold-400);
  animation: pulse .9s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(.96); } to { transform: scale(1.04); } }
.dialog-clue { margin: 0; font-family: "Baloo 2", cursive; font-size: clamp(1.7rem, 4vw, 2.8rem); font-weight: 700; line-height: 1.2; }
.timer {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-inline: auto;
  border: 3px solid var(--gold-400);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.timer span {
  font-family: "Baloo 2", cursive;
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold-400);
}
.timer.is-urgent { border-color: var(--danger); animation: pulse .5s ease-in-out infinite alternate; }
.timer.is-urgent span { color: var(--danger); }
.answer-panel { padding: 18px; border-radius: 16px; background: rgba(255,255,255,.1); }
.answer-panel span { display: block; opacity: .75; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.answer-panel strong { display: block; margin-top: 6px; color: var(--gold-400); font-size: clamp(1.6rem, 4vw, 2.5rem); }
.wager-panel { display: grid; justify-content: center; gap: 7px; }
.wager-panel input { width: 190px; padding: 10px 12px; border: 0; border-radius: 10px; text-align: center; font-weight: 900; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dialog-actions button { min-width: 145px; }

.confirm-card { padding: 30px; border-radius: 22px; text-align: center; background: var(--cream); color: var(--ink); }
.confirm-card h2 { margin-top: 0; font-family: "Baloo 2", cursive; font-size: 2rem; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }

@media (max-width: 820px) {
  .page-shell { padding: 14px; }
  .score-panel { grid-template-columns: 1fr 1fr; }
  .score-panel__center { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(3, 1fr); order: 3; }
  .category-cell, .clue-cell { min-height: 78px; }
}

@media (max-width: 560px) {
  .score-panel { grid-template-columns: 1fr; }
  .score-panel__center { grid-column: auto; grid-row: auto; grid-template-columns: 1fr; }
  .team-card { min-height: 130px; }
  .dialog-card { min-height: 520px; }
  .dialog-topline { flex-direction: column; }
}

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