:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(20, 25, 40, 0.6);
  --panel-border: rgba(255, 255, 255, 0.1);
  --primary: #00f0ff;
  --secondary: #7000ff;
  --correct: #00ff88;
  --incorrect: #ff0055;
  --text-light: #ffffff;
  --text-muted: #b9bfd0;
  --font-family: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(112, 0, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(0, 240, 255, 0.1) 0%, transparent 50%);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  animation: fadeInDown 0.8s ease-out;
}

.logo h1 {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#score-container {
  text-align: right;
  background: var(--panel-bg);
  padding: 1rem 2rem;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--correct);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

#board-container {
  flex: 1;
  display: flex;
  justify-content: center;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

#board {
  display: grid;
  --board-cols: 6;
  grid-template-columns: repeat(var(--board-cols), 1fr);
  gap: 10px;
  padding: 15px;
  width: 100%;
}

/* Wide boards (7+ categories, e.g. Chess Fundamentals) — tighten spacing/text
   to fit; the exact column count comes from --board-cols, set in JS. */
#board.cols-wide { gap: 6px; }
#board.cols-wide .category-header { font-size: 1rem; padding: 0.6rem 0.3rem; }
#board.cols-wide .tile { font-size: 1.6rem; }

.category-header {
  text-align: center;
  padding: 1rem 0.5rem;
  font-weight: 700;
  font-size: 1.35rem;
  text-transform: uppercase;
  color: var(--primary);
  border-bottom: 2px solid rgba(0, 240, 255, 0.2);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.tile {
  background: rgba(30, 36, 56, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffd700; /* Gold */
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tile:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 215, 0, 0.3);
  border-color: rgba(255, 215, 0, 0.5);
}

.tile:hover::before {
  opacity: 1;
}

.tile.answered {
  background: rgba(10, 12, 20, 0.5);
  color: transparent;
  text-shadow: none;
  cursor: default;
  pointer-events: none;
  border-color: transparent;
  box-shadow: none;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 780px;
  padding: 3rem;
  transform: scale(1);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
}

.modal.hidden .modal-content {
  transform: scale(0.9);
}

.modal-content.glow {
  box-shadow: 0 0 50px rgba(112, 0, 255, 0.2), inset 0 0 20px rgba(0, 240, 255, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.neon-text {
  font-size: 2rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.modal-body p {
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 2.5rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.option-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.3rem 1.4rem;
  border-radius: 12px;
  color: var(--text-light);
  font-size: 1.4rem;
  line-height: 1.35;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  align-items: center;
}

.option-btn:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.option-btn.correct-reveal {
  background: rgba(0, 255, 136, 0.2);
  border-color: var(--correct);
  color: var(--correct);
}

.option-btn.wrong-reveal {
  background: rgba(255, 0, 85, 0.2);
  border-color: var(--incorrect);
  color: var(--incorrect);
  opacity: 0.7;
}

.feedback-box {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 12px;
  animation: fadeIn 0.5s;
}

.feedback-box.correct {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.feedback-box.incorrect {
  background: rgba(255, 0, 85, 0.1);
  border: 1px solid rgba(255, 0, 85, 0.3);
}

#feedback-title {
  font-size: 2.1rem;
  margin-bottom: 0.5rem;
}

.correct #feedback-title { color: var(--correct); }
.incorrect #feedback-title { color: var(--incorrect); }

#feedback-remark {
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.btn {
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.primary-btn {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(112, 0, 255, 0.4);
}

.primary-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(112, 0, 255, 0.6);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 900px) {
  #board { grid-template-columns: repeat(3, 1fr); }
  #board.cols-wide { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .logo h1 { font-size: 2.5rem; }
  #board { grid-template-columns: repeat(2, 1fr); }
  #board.cols-wide { grid-template-columns: repeat(2, 1fr); }
  .options-grid { grid-template-columns: 1fr; }
  .modal-content { padding: 2rem 1.5rem; }
}

/* ── Camp teams mode ─────────────────────────────────────────────────────── */
.teams-bar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; flex: 1; }
.team-card { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 8px 16px; text-align: center; cursor: pointer; min-width: 120px; transition: border-color 0.15s, transform 0.15s; position: relative; }
.team-card:hover { transform: translateY(-2px); }
.team-card.active { border-color: var(--primary); box-shadow: 0 0 14px rgba(0,240,255,0.35); }
.team-name { font-size: 1rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.team-card.active .team-name { color: var(--primary); }
.team-score { font-size: 1.7rem; font-weight: 900; color: var(--correct); text-shadow: 0 0 10px rgba(0,255,136,0.4); }
.team-score.neg { color: var(--incorrect); text-shadow: 0 0 10px rgba(255,0,85,0.4); }
.team-turn { font-size: 0.85rem; font-weight: 700; color: var(--primary); letter-spacing: 1px; text-transform: uppercase; }
.header-btns { display: flex; gap: 8px; }
.hdr-btn { background: var(--panel-bg); border: 1px solid var(--panel-border); color: var(--text-light); border-radius: 10px; padding: 10px 16px; font-family: var(--font-family); font-weight: 700; cursor: pointer; font-size: 1.05rem; }
.hdr-btn:hover { border-color: var(--primary); }
.modal-team { text-align: center; color: var(--primary); font-weight: 700; font-size: 1.3rem; margin-top: 4px; letter-spacing: 0.5px; }
.skip-btn { display: block; margin: 14px auto 0; background: transparent; border: 1px solid var(--panel-border); color: var(--text-muted); border-radius: 10px; padding: 10px 20px; font-family: var(--font-family); cursor: pointer; font-size: 1.05rem; }
.skip-btn:hover { border-color: var(--incorrect); color: var(--text-light); }
.skip-btn.hidden { display: none; }

/* Setup + results */
.setup-content { max-width: 460px; text-align: center; }
.setup-sub { color: var(--text-muted); font-size: 1.15rem; margin: 12px 0 8px; }
.setup-counts { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.setup-count-btn, .setup-mode-btn { background: var(--panel-bg); border: 1px solid var(--panel-border); color: var(--text-light); border-radius: 10px; padding: 10px 18px; font-family: var(--font-family); font-weight: 700; font-size: 1rem; cursor: pointer; }
.setup-count-btn.active, .setup-mode-btn.active { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 12px rgba(0,240,255,0.3); }
.setup-modes { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.setup-mode-btn { flex: 1; font-size: 1.05rem; padding: 12px; }
.setup-names { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.setup-name { background: rgba(0,0,0,0.35); border: 1px solid var(--panel-border); color: var(--text-light); border-radius: 10px; padding: 12px 14px; font-family: var(--font-family); font-size: 1.15rem; text-align: center; }
.setup-name:focus { outline: none; border-color: var(--primary); }
.results-list { margin: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.result-row { display: flex; align-items: center; gap: 12px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px 18px; font-size: 1.3rem; }
.result-row.winner { border-color: var(--correct); box-shadow: 0 0 16px rgba(0,255,136,0.35); font-size: 1.5rem; }
.result-medal { width: 2rem; }
.result-name { flex: 1; text-align: left; font-weight: 700; }
.result-score { font-weight: 900; color: var(--correct); }

/* ── Secret fact-check flags ─────────────────────────────────────────────── */
#modal-value { user-select: none; cursor: default; }
#modal-value.flagged { text-decoration: underline dotted rgba(255, 165, 0, 0.6); text-underline-offset: 6px; }
#modal-value.flag-pulse { animation: flagPulse 0.6s ease; }
@keyframes flagPulse {
  0% { color: inherit; }
  30% { color: #ffa500; text-shadow: 0 0 12px rgba(255, 165, 0, 0.8); }
  100% { color: inherit; }
}

.flags-list {
  max-height: 50vh;
  overflow-y: auto;
  text-align: left;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.flags-empty { color: var(--text-muted); text-align: center; padding: 20px 0; }
.flag-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.flag-info { flex: 1; min-width: 0; }
.flag-meta { color: var(--primary); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.flag-text { margin: 4px 0; }
.flag-answer { color: var(--correct); font-size: 0.85rem; }
.flag-unflag {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
}
.flag-unflag:hover { border-color: var(--incorrect); color: var(--incorrect); }
.flags-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── 6-team support + name picker ────────────────────────────────────────── */
.setup-keys { color: var(--text-muted); font-size: 0.85rem; margin-top: 14px; }
/* Two columns of name inputs so all 6 fit on screen without scrolling */
.setup-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.setup-names input:only-child { grid-column: 1 / -1; }
/* Slimmer team cards so 6 fit across the header on the camp TV */
.team-card { min-width: 100px; padding: 8px 12px; }

.picker-name {
  font-size: 3rem;
  font-weight: 900;
  margin: 30px 0;
  min-height: 1.3em;
  color: var(--text-light);
}
.picker-name.picker-final {
  color: var(--correct);
  text-shadow: 0 0 24px rgba(0, 255, 136, 0.6);
  animation: pickerPop 0.4s ease;
}
@keyframes pickerPop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
