/* ===================================================================
   Convention Jeopardy! — styles
   Classic Jeopardy palette: deep board blue + gold. No external fonts
   required (falls back gracefully offline for convention use).
   =================================================================== */

:root {
  --board-blue: #060ce9;
  --board-blue-dark: #030a8c;
  --panel: #0a1580;
  --gold: #d69f4c;
  --gold-bright: #ffcc00;
  --clue-text: #ffffff;
  --dd-red: #b5121b;
  --ok: #2e8b57;
  --bad: #c0392b;
  --ink: #0b1020;
  --paper: #f4f5fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at 50% 0%, #1b2a6b, #060a2a 70%);
  color: var(--ink);
  min-height: 100vh;
}

/* ---------- screens ---------- */
.screen { display: none; }
.screen.active { display: block; }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: 2px solid var(--board-blue-dark);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  transition: transform .05s ease, filter .1s ease;
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--board-blue); color: #fff; border-color: var(--gold); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn.big { padding: 0.8rem 1.6rem; font-size: 1.15rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- setup screen ---------- */
.setup-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1.2rem 4rem; }
.logo {
  text-align: center;
  color: var(--gold-bright);
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0.4rem 0 0;
  text-shadow: 3px 3px 0 var(--board-blue-dark);
  transform: skewX(-6deg);
}
.tagline { text-align: center; color: #cdd3ff; margin: 0 0 1.6rem; }

.card {
  background: var(--paper);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.card h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.hint { color: #55607a; font-size: 0.9rem; margin: 0.3rem 0; }
.hint a { color: var(--board-blue); }
code { background: #e5e8f5; padding: 0.1rem 0.35rem; border-radius: 4px; }

.file-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.6rem; }
.file-btn { display: inline-block; }
.file-status { font-size: 0.9rem; color: #55607a; }
.load-summary {
  margin-top: 0.8rem; padding: 0.7rem 0.9rem; border-radius: 8px;
  background: #e8f6ec; border: 1px solid #b6e0c2; font-size: 0.9rem;
}

.team-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.6rem 0; }
.team-row { display: flex; gap: 0.5rem; align-items: center; }
.team-row input[type=text] {
  flex: 1; padding: 0.5rem 0.7rem; border: 1px solid #c3c9de; border-radius: 8px; font: inherit;
}
.team-row .swatch { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.team-row .remove { border: none; background: none; color: var(--bad); cursor: pointer; font-size: 1.2rem; }

.switch-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.4rem 0; }
.start-row { text-align: center; margin-top: 1.4rem; }
.start-row .hint { color: #cdd3ff; }

/* ---------- game header ---------- */
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem; gap: 1rem; flex-wrap: wrap;
}
.round-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.round-tab {
  padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer; font-weight: 700;
  background: rgba(255,255,255,.1); color: #cdd3ff; border: 1px solid transparent;
}
.round-tab.active { background: var(--gold); color: var(--ink); }
.header-actions { display: flex; gap: 0.5rem; }

/* ---------- board ---------- */
.board {
  display: grid;
  gap: 6px;
  padding: 0 0.6rem 0.6rem;
  max-width: 1400px;
  margin: 0 auto;
}
.cat-cell {
  background: var(--board-blue);
  color: #fff;
  text-transform: uppercase;
  font-weight: 800;
  text-align: center;
  display: flex; align-items: center; justify-content: center;
  padding: 0.6rem 0.3rem;
  min-height: 74px;
  border: 2px solid var(--board-blue-dark);
  font-size: clamp(0.7rem, 1.1vw, 1rem);
  line-height: 1.15;
}
.clue-cell {
  background: var(--board-blue);
  color: var(--gold-bright);
  border: 2px solid var(--board-blue-dark);
  font-weight: 800;
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  display: flex; align-items: center; justify-content: center;
  min-height: 64px;
  cursor: pointer;
  text-shadow: 2px 2px 0 var(--board-blue-dark);
  transition: background .12s ease;
}
.clue-cell:hover { background: #1a24c9; }
.clue-cell.done { color: transparent; cursor: pointer; background: var(--board-blue-dark); text-shadow: none; }
.clue-cell.done:hover { background: #1a2170; }
/* faint value re-appears on hover so the host can find a played square */
.clue-cell.done:hover { color: rgba(214,159,76,.45); text-shadow: none; }

/* ---------- scoreboard ---------- */
.scoreboard {
  display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center;
  padding: 0.9rem; margin-top: 0.4rem;
}
.score-tile {
  background: var(--paper); border-radius: 10px; padding: 0.6rem 0.9rem;
  min-width: 150px; text-align: center; box-shadow: 0 3px 10px rgba(0,0,0,.3);
  border-top: 5px solid var(--team-color, var(--gold));
}
.score-tile input.name {
  border: none; background: transparent; font-weight: 700; text-align: center;
  width: 100%; font-size: 0.95rem; font: inherit; font-weight: 700;
}
.score-tile .score {
  font-size: 1.6rem; font-weight: 800; cursor: pointer; margin-top: 0.2rem;
}
.score-tile .score.neg { color: var(--bad); }
.score-tile .active-pill {
  font-size: 0.65rem; text-transform: uppercase; color: var(--ok); font-weight: 700;
  visibility: hidden;
}
.score-tile.active { outline: 3px solid var(--ok); }
.score-tile.active .active-pill { visibility: visible; }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3,5,20,.85);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50;
}
.hidden { display: none !important; }

.clue-card, .repair-card {
  background: var(--board-blue);
  color: #fff;
  border: 4px solid var(--gold);
  border-radius: 12px;
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.repair-card { background: var(--paper); color: var(--ink); }

.dd-banner {
  background: var(--dd-red); color: var(--gold-bright); text-align: center;
  font-weight: 900; letter-spacing: 3px; font-size: 1.6rem; padding: 0.5rem;
  border-radius: 8px; margin-bottom: 0.8rem; text-shadow: 2px 2px 0 #000;
}
.clue-meta { text-transform: uppercase; font-weight: 700; color: var(--gold-bright); letter-spacing: 1px; margin-bottom: 0.8rem; }
.clue-text { font-size: clamp(1.3rem, 3vw, 2rem); text-align: center; line-height: 1.35; min-height: 3em; display: flex; align-items: center; justify-content: center; }
.answer-block { text-align: center; margin: 0.6rem 0; }
.answer-label { text-transform: uppercase; font-size: 0.75rem; color: var(--gold-bright); letter-spacing: 1px; }
.clue-answer { font-size: 1.4rem; font-weight: 700; margin: 0.2rem 0; }

.dd-wager { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1rem; }
.dd-wager label { display: flex; align-items: center; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.dd-wager select, .dd-wager input, .final-wagers input, .final-wagers select {
  font: inherit; padding: 0.4rem 0.6rem; border-radius: 6px; border: 1px solid #c3c9de;
}

.score-controls { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.review-note { text-align: center; color: var(--gold-bright); font-style: italic; margin: 0.6rem 0; }
.team-score-row { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; background: rgba(255,255,255,.08); padding: 0.4rem 0.6rem; border-radius: 8px; }
.team-score-row .tname { font-weight: 700; }
.team-score-row .actions { display: flex; gap: 0.4rem; }
.btn.correct { background: var(--ok); color: #fff; border-color: #1c5c39; }
.btn.wrong { background: var(--bad); color: #fff; border-color: #7d2019; }

.modal-footer { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.reveal-answer, #reveal-answer { display: block; margin: 0.4rem auto; }

/* ---------- repair form ---------- */
.repair-form { display: flex; flex-direction: column; gap: 0.8rem; max-height: 60vh; overflow-y: auto; padding-right: 0.4rem; }
.repair-field { display: flex; flex-direction: column; gap: 0.25rem; }
.repair-field label { font-weight: 600; font-size: 0.9rem; }
.repair-field .path { font-size: 0.75rem; color: #7a839e; font-weight: 400; }
.repair-field input, .repair-field textarea {
  font: inherit; padding: 0.45rem 0.6rem; border: 1px solid #c3c9de; border-radius: 6px; width: 100%;
}
.repair-field.invalid input, .repair-field.invalid textarea { border-color: var(--bad); background: #fdecec; }
.final-wagers { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.8rem 0; }
.final-wagers .team-score-row { color: #fff; }
