@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Sora:wght@500;700;800&display=swap');

:root {
  --bg-0: #071122;
  --bg-1: #0c1f3f;
  --bg-2: #102f61;
  --panel: rgba(13, 28, 58, 0.78);
  --panel-strong: rgba(10, 23, 48, 0.9);
  --line: rgba(128, 171, 255, 0.27);
  --line-strong: rgba(142, 198, 255, 0.48);
  --text: #edf4ff;
  --muted: #a8bcde;
  --accent: #ffce4f;
  --accent-2: #49d2ff;
  --good: #45df9e;
  --bad: #ff6d73;
  --board-cat: linear-gradient(165deg, #13489a, #0e2f66 68%);
  --board-clue: linear-gradient(165deg, #1f69da, #15469e 72%);
  --board-clue-hover: linear-gradient(165deg, #2a7bff, #1b56bf 72%);
  --radius: 16px;
  --shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 14px 32px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Avenir Next', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 720px at 8% -10%, rgba(73, 210, 255, 0.16), transparent 65%),
    radial-gradient(1000px 640px at 94% -16%, rgba(255, 206, 79, 0.13), transparent 62%),
    linear-gradient(155deg, var(--bg-2) 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: auto;
  width: 42vmax;
  height: 42vmax;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.24;
  pointer-events: none;
  z-index: -1;
}

body::before {
  left: -14vmax;
  bottom: -12vmax;
  background: radial-gradient(circle, rgba(73, 210, 255, 0.95), rgba(73, 210, 255, 0));
}

body::after {
  right: -14vmax;
  top: -13vmax;
  background: radial-gradient(circle, rgba(255, 206, 79, 0.95), rgba(255, 206, 79, 0));
}

.app {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 20px 36px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

header {
  margin-bottom: 18px;
  animation: rise-in 500ms ease-out both;
}

header h1 {
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-size: clamp(2.2rem, 4vw, 3.45rem);
  letter-spacing: 0.02em;
  text-shadow: 0 8px 24px rgba(9, 18, 38, 0.45);
}

header p {
  margin-top: 8px;
  max-width: 740px;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.2vw, 1.08rem);
}

.panel {
  background: linear-gradient(155deg, rgba(14, 32, 64, 0.88), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(5px);
}

#setup {
  animation: rise-in 560ms 70ms ease-out both;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c4d6f4;
  font-weight: 700;
}

.category-search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.category-search-row input {
  flex: 1 1 280px;
}

.category-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

input,
select,
button {
  border-radius: 12px;
  border: 1px solid rgba(118, 163, 240, 0.35);
  background: rgba(7, 19, 41, 0.84);
  color: var(--text);
  padding: 11px 12px;
  font-size: 0.97rem;
  transition: transform 140ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
button:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(73, 210, 255, 0.2);
}

button {
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(165deg, #2c7bff, #184fab 72%);
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(16, 43, 94, 0.45);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.suggestion-btn {
  text-align: left;
  background: linear-gradient(165deg, #224d93, #17376b 72%);
  font-size: 0.9rem;
}

.hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.hidden {
  display: none !important;
}

.toolbar {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  animation: rise-in 360ms ease both;
}

.round-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.round-controls button {
  padding-inline: 14px;
  background: linear-gradient(165deg, #2e64c7, #224994 70%);
}

.game-layout {
  margin-top: 12px;
  display: block;
}

.board-wrap {
  background: linear-gradient(165deg, rgba(16, 36, 76, 0.94), rgba(11, 27, 58, 0.92));
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 9px;
}

.category {
  background: var(--board-cat);
  border: 1px solid rgba(107, 165, 255, 0.54);
  border-radius: 12px;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  font-size: 0.8rem;
  box-shadow: 0 10px 20px rgba(7, 16, 35, 0.35);
  animation: tile-in 360ms ease both;
}

.clue-btn {
  min-height: 72px;
  background: var(--board-clue);
  border: 1px solid rgba(121, 173, 255, 0.54);
  color: var(--accent);
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-size: clamp(1.05rem, 2.2vw, 1.38rem);
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(8, 18, 36, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 20px rgba(8, 18, 38, 0.35);
  animation: tile-in 420ms ease both;
}

.clue-btn:hover:not(:disabled) {
  background: var(--board-clue-hover);
}

.clue-btn.used {
  opacity: 0.34;
  color: #8ca2c9;
  filter: saturate(0.75);
}

.buzzer-panel {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
}

.buzzer-panel code {
  background: rgba(9, 22, 47, 0.75);
  border: 1px solid rgba(118, 163, 240, 0.25);
  border-radius: 8px;
  padding: 3px 7px;
}

#buzzerCode {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

#buzzerPlayers {
  text-align: right;
}

@media (max-width: 700px) {
  .buzzer-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }

  #buzzerPlayers {
    text-align: center;
  }
}

.buzz-btn-phone {
  font-size: clamp(2rem, 9vw, 3.2rem);
  padding: 20px;
  min-height: 180px;
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  letter-spacing: 0.08em;
  background: linear-gradient(165deg, #ff5f66, #cd303f 72%);
}

.score-strip-wrap {
  position: sticky;
  bottom: 10px;
  margin-top: 14px;
  z-index: 50;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(121, 173, 255, 0.45);
  background: linear-gradient(180deg, rgba(12, 28, 59, 0.88), rgba(8, 18, 39, 0.94));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
}

.score-card {
  min-height: 86px;
  border-radius: 12px;
  border: 1px solid rgba(127, 172, 246, 0.46);
  background: linear-gradient(165deg, #1b4e9d, #11336a 74%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 16px rgba(8, 18, 38, 0.36);
  animation: tile-in 320ms ease both;
}

.score-name {
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  color: #c5daf8;
  margin-bottom: 4px;
}

.score-value {
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: clamp(1.2rem, 1.8vw, 1.8rem);
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(8, 18, 36, 0.7);
}

.modal {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 50% 0%, rgba(73, 210, 255, 0.1), transparent 65%),
    rgba(5, 12, 25, 0.9);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  width: min(1040px, 100%);
  min-height: min(82vh, 780px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  border-color: rgba(131, 182, 255, 0.42);
  background: linear-gradient(160deg, rgba(15, 35, 73, 0.95), rgba(10, 23, 49, 0.96));
  box-shadow: var(--shadow-lg);
  animation: modal-in 260ms ease-out both;
}

.modal-card.is-buzzed {
  border-color: rgba(255, 230, 120, 0.85);
  background: linear-gradient(160deg, rgba(60, 47, 14, 0.96), rgba(46, 35, 10, 0.97));
  box-shadow:
    0 0 0 3px rgba(255, 216, 87, 0.3),
    0 0 36px rgba(255, 212, 74, 0.3),
    var(--shadow-lg);
}

.clue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.clue-head h3 {
  margin: 0;
  font-size: clamp(1rem, 1vw + 0.78rem, 1.35rem);
  color: #c7d7f4;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clue-value {
  color: var(--accent);
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: clamp(1.2rem, 1vw + 1rem, 1.66rem);
  letter-spacing: 0.03em;
}

.clue-buzzer-first {
  text-align: center;
  color: #e9f2ff;
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  letter-spacing: 0.06em;
  font-size: clamp(1.2rem, 1.7vw, 2rem);
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(8, 18, 36, 0.6);
  text-transform: uppercase;
}

.clue-text {
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 2vw + 0.85rem, 2.8rem);
  line-height: 1.24;
  white-space: pre-line;
  margin: 0;
  text-align: center;
  text-wrap: balance;
}

.answer {
  color: var(--good);
  padding-top: 10px;
  border-top: 1px solid rgba(110, 170, 236, 0.34);
}

.controls {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.controls > button {
  background: linear-gradient(165deg, #2b75f4, #1c56bc 72%);
}

.scoring-title {
  width: 100%;
  font-weight: 700;
  color: #bfd1f1;
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  letter-spacing: 0.03em;
}

.daily-double-alert {
  width: 100%;
  text-align: center;
  font-family: 'Sora', 'Space Grotesk', sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(255, 206, 79, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(165deg, rgba(62, 45, 12, 0.68), rgba(40, 27, 6, 0.62));
}

.clue-score-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.clue-score-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.clue-score-row input {
  max-width: 160px;
}

.clue-score-name {
  font-weight: 700;
}

.clue-score-row button:nth-of-type(1) {
  background: linear-gradient(165deg, #2fbe87, #228c64 72%);
}

.clue-score-row button:nth-of-type(2) {
  background: linear-gradient(165deg, #ea5a67, #be3f4d 72%);
}

.clue-team-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
  justify-content: center;
  gap: 12px;
}

.clue-team-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 148px;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(127, 172, 246, 0.42);
  background: linear-gradient(165deg, rgba(25, 67, 132, 0.86), rgba(15, 41, 86, 0.92));
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.clue-team-card.is-active {
  border-color: rgba(255, 236, 140, 0.98);
  box-shadow:
    0 0 0 3px rgba(255, 216, 87, 0.5),
    0 0 28px rgba(255, 212, 74, 0.55),
    0 14px 26px rgba(0, 0, 0, 0.38);
  transform: translateY(-3px) scale(1.02);
}

.clue-team-card.is-dimmed {
  opacity: 0.38;
  filter: saturate(0.55);
}

.clue-team-name {
  font-weight: 800;
  font-size: clamp(1.25rem, 1.35vw + 0.95rem, 1.9rem);
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0.02em;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 10px 6px;
}

.clue-team-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.clue-team-action {
  width: 34px;
  height: 34px;
  min-height: 34px;
  font-size: 1rem;
  font-weight: 900;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
}

.clue-team-action.plus {
  background: linear-gradient(165deg, #2fbe87, #228c64 72%);
}

.clue-team-action.minus {
  background: linear-gradient(165deg, #ea5a67, #be3f4d 72%);
}

#status {
  min-height: 1.2rem;
  margin-top: 12px;
  color: #b9cae7;
  font-weight: 500;
}

.board .category,
.board .clue-btn {
  animation-delay: calc(var(--index, 0) * 24ms);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .board {
    grid-template-columns: repeat(6, minmax(46px, 1fr));
    gap: 7px;
  }

  .category {
    min-height: 62px;
    font-size: 0.72rem;
  }

  .clue-btn {
    min-height: 56px;
  }

  .modal-card {
    min-height: auto;
  }

  .clue-score-row {
    grid-template-columns: 1fr;
  }

  .score-strip-wrap {
    position: static;
    bottom: auto;
  }

  .score-card {
    min-height: 74px;
  }
}
