* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: #060ce3;
  color: #fff;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.2rem;
  background: #04091f;
  flex: 0 0 auto;
}

#topbar h1 {
  font-size: clamp(1rem, 1.8vw, 1.6rem);
  margin: 0;
  color: #ffcc33;
  font-weight: 700;
}

#topbar button {
  background: none;
  border: 1px solid #3f6df5;
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 1rem;
  cursor: pointer;
}

#topbar button:hover {
  background: #143fbf;
}

/* ── Board ───────────────────────────────────────────────────────────────── */

#board {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 0.4rem;
  padding: 0.6rem;
  min-height: 0;
}

.category-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #060ce3;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(0.8rem, 1.6vw, 1.3rem);
  padding: 0.4rem;
  border-radius: 4px;
}

.clue-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #060ce3;
  color: #ffcc33;
  font-weight: 700;
  font-size: clamp(1.4rem, 3.2vw, 3rem);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.clue-cell:hover {
  background: #143fbf;
}

.clue-cell.used {
  background: #050a24;
  color: transparent;
  cursor: default;
}

/* ── Scoreboard ──────────────────────────────────────────────────────────── */

#scoreboard {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: #04091f;
}

.team-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #10186b;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
}

.team-chip .team-name {
  font-weight: 700;
  cursor: text;
  min-width: 2ch;
  outline: none;
}

.team-chip .team-score {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffcc33;
  min-width: 3ch;
  text-align: right;
}

.team-chip button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.3rem;
  border-radius: 4px;
}

.team-chip button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.team-chip .remove-team {
  color: #ff8080;
  opacity: 0.6;
}

.team-chip .remove-team:hover {
  opacity: 1;
}

#add-team-btn {
  align-self: center;
  background: none;
  border: 1px dashed #6b7fd6;
  color: #cdd6ff;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}

#add-team-btn:hover {
  background: #10186b;
}

/* ── Overlays (clue + settings) ─────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 20, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

#clue-box {
  width: min(90vw, 1100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

#clue-meta {
  color: #8fa0e8;
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#clue-text {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.3;
}

#answer-text {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  color: #ffcc33;
  font-style: italic;
}

#answer-text.hidden {
  display: none;
}

#clue-text code,
#answer-text code {
  font-family: "Cascadia Code", Consolas, monospace;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
}

.overlay-actions button {
  font-size: 1.1rem;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid #3f6df5;
  background: #10186b;
  color: #fff;
  cursor: pointer;
}

.overlay-actions button:hover {
  background: #143fbf;
}

#award-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.award-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.5rem 1rem;
}

.award-row .team-name {
  min-width: 8ch;
  font-weight: 700;
}

.award-row button.award {
  background: #1a7340;
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-size: 1rem;
}

.award-row button.award:hover {
  background: #23924f;
}

.award-row button.penalize {
  background: #7a2020;
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-size: 1rem;
}

.award-row button.penalize:hover {
  background: #99282a;
}

/* ── Settings modal ──────────────────────────────────────────────────────── */

#settings-box {
  width: min(90vw, 480px);
  background: #0a1240;
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#settings-box h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #ffcc33;
}

#settings-box button.danger {
  background: #7a2020;
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

#settings-box button.danger:hover {
  background: #99282a;
}

#settings-box button.secondary {
  background: #10186b;
  border: 1px solid #3f6df5;
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

#settings-box button.secondary:hover {
  background: #143fbf;
}

#settings-box .close-row {
  display: flex;
  justify-content: flex-end;
}
