:root {
  --bg-dark: #0a1030;
  --bg-navy: #101c4d;
  --board: #15308f;
  --board-dark: #0b1d63;
  --gold: #f5c242;
  --gold-dark: #d99e0b;
  --red: #e53935;
  --green: #2fae5e;
  --white: #ffffff;
  --text: #eef1fb;
  --muted: #9fb0d8;
  --card: #16215c;
  --border: #2b3b82;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, var(--bg-navy), var(--bg-dark) 70%);
  color: var(--text);
  min-height: 100vh;
  padding: 1.5rem 1rem 4rem;
}
.container { max-width: 1100px; margin: 0 auto; }
h1, h2, h3 { font-weight: 800; }
h1 { font-size: 2rem; letter-spacing: 0.02em; }
h1 .boom { color: var(--gold); }
a { color: inherit; }

header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.back-link { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.back-link:hover { color: var(--text); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 8px 26px -10px rgba(0,0,0,0.5);
}
.card + .card { margin-top: 1.25rem; }
.card h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

label { font-size: 0.85rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: 0.35rem; }
input[type=text], input[type=number], select, textarea {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
  background: var(--bg-navy);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245,194,66,0.25);
}

button {
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--gold); color: #1a1025; }
button.primary:hover:not(:disabled) { background: var(--gold-dark); }
button.secondary { background: var(--bg-navy); color: var(--text); border: 1px solid var(--border); }
button.secondary:hover:not(:disabled) { border-color: var(--gold); }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
button.danger:hover:not(:disabled) { background: var(--red); color: #fff; }
button.ghost { background: transparent; color: var(--muted); font-weight: 600; }
button.ghost:hover:not(:disabled) { color: var(--text); }
button.big { padding: 1rem 2rem; font-size: 1.15rem; }

/* avatar */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-navy);
  border: 3px solid var(--border);
  flex-shrink: 0;
}
.avatar.sm { width: 32px; height: 32px; }
.avatar.md { width: 48px; height: 48px; }
.avatar.lg { width: 84px; height: 84px; }

/* player chips / rows */
.player-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.player-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-navy);
  cursor: pointer;
  user-select: none;
}
.player-chip.selected { border-color: var(--gold); background: rgba(245,194,66,0.12); }
.player-chip input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }
.player-name { font-weight: 600; }

.player-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-navy);
}
.player-row + .player-row { margin-top: 0.5rem; }
.player-row .grow { flex: 1; min-width: 0; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

.status-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.5rem;
  background: var(--gold);
  color: #1a1025;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 10px 25px -8px rgba(0,0,0,0.5);
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 200;
}
.status-toast.show { transform: translateY(0); }

/* team columns (setup) */
.team-cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 1rem; }
.team-col { border: 2px solid var(--border); border-radius: 14px; padding: 0.9rem; background: var(--bg-navy); }
.team-col h4 { margin-bottom: 0.6rem; }
.team-col input[type=text] { font-weight: 800; font-size: 1.05rem; margin-bottom: 0.75rem; }
.team-col .player-row button { flex-shrink: 0; }

/* ---------------- Game Play ---------------- */
.progress-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.progress-bar { height: 6px; background: var(--bg-navy); border-radius: 3px; overflow: hidden; margin-bottom: 1.5rem; }
.progress-bar .fill { height: 100%; background: var(--gold); transition: width 0.3s; }

.scores-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.team-score-panel {
  border-radius: 16px;
  padding: 1rem 1.25rem;
  background: linear-gradient(160deg, var(--board), var(--board-dark));
  border: 2px solid var(--border);
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.team-score-panel.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,194,66,0.25); }
.team-score-panel .t-name { font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.team-score-panel .t-score { font-size: 2.4rem; font-weight: 900; color: var(--gold); }
.team-score-panel .t-players { margin-top: 0.5rem; display: flex; justify-content: center; gap: 0.35rem; flex-wrap: wrap; }

.feud-board {
  background: linear-gradient(160deg, var(--board), var(--board-dark));
  border: 4px solid var(--gold);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.6), inset 0 0 40px rgba(0,0,0,0.25);
}
.question-banner {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.4;
  padding: 0.5rem 0.5rem 1.25rem;
}
.answer-list { display: flex; flex-direction: column; gap: 0.6rem; }
.answer-tile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bg-navy);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  min-height: 3.2rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.answer-tile:hover:not(.revealed):not(.locked) { border-color: var(--gold); }
.answer-tile.locked { cursor: not-allowed; }
.answer-tile .rank {
  width: 2rem; height: 2rem; border-radius: 6px;
  background: var(--board-dark); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; flex-shrink: 0;
}
.answer-tile .a-text { flex: 1; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; }
.answer-tile .a-points {
  background: var(--gold); color: #1a1025;
  font-weight: 900; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.95rem;
  min-width: 2.6rem; text-align: center;
}
.answer-tile.revealed { background: linear-gradient(90deg, #1b3fb0, #16308f); border-color: var(--gold); animation: flip-in 0.35s ease-out; }
.answer-tile.hidden .a-text { color: var(--muted); text-align: center; }
@keyframes flip-in {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0deg); opacity: 1; }
}

.pot-row { display: flex; justify-content: center; align-items: baseline; gap: 0.5rem; margin-top: 1.25rem; color: var(--muted); font-weight: 700; }
.pot-row .pot-amt { font-size: 1.6rem; color: var(--gold); font-weight: 900; }

.strikes-row { display: flex; justify-content: center; gap: 0.6rem; margin-top: 1rem; }
.strike-x {
  width: 3rem; height: 3rem; border-radius: 10px;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 900; color: var(--border);
  background: var(--bg-navy);
}
.strike-x.used { color: #fff; background: var(--red); border-color: var(--red); animation: strike-pop 0.3s; }
@keyframes strike-pop { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }

.phase-banner { text-align: center; font-weight: 800; font-size: 1.15rem; margin: 1.25rem 0 0.75rem; color: var(--gold); }
.controls-row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }
.faceoff-row { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.faceoff-btn { padding: 1rem 2rem; font-size: 1.1rem; border-radius: 14px; }

.round-summary { text-align: center; margin-top: 1.25rem; padding: 1rem; border-radius: 12px; background: rgba(245,194,66,0.1); border: 1px dashed var(--gold); font-weight: 700; }

/* ---------------- Results ---------------- */
.winner-banner {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--board), var(--board-dark));
  border: 4px solid var(--gold);
  margin-bottom: 1.25rem;
}
.winner-banner .trophy { font-size: 3rem; }
.winner-banner h2 { font-size: 1.8rem; color: var(--gold); margin: 0.5rem 0 0.25rem; border: none; padding: 0; }
.final-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.final-score-bar-wrap { background: var(--bg-navy); border-radius: 12px; padding: 1rem; border: 1px solid var(--border); }
.final-score-bar-wrap .fs-name { font-weight: 700; margin-bottom: 0.4rem; }
.final-score-bar-wrap .fs-track { height: 14px; background: var(--board-dark); border-radius: 7px; overflow: hidden; margin-bottom: 0.4rem; }
.final-score-bar-wrap .fs-fill { height: 100%; background: var(--gold); }
.final-score-bar-wrap .fs-amt { font-weight: 900; font-size: 1.3rem; }

/* admin: answer rows */
.answer-row-form { display: flex; gap: 0.5rem; align-items: center; }
.answer-row-form input[type=text] { flex: 1; }
.answer-row-form input[type=number] { width: 90px; }
.answer-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.qa-list-item { border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1rem; background: var(--bg-navy); }
.qa-list-item + .qa-list-item { margin-top: 0.6rem; }
.qa-list-item .qa-q { font-weight: 800; margin-bottom: 0.5rem; }
.qa-list-item .qa-a-row { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--muted); padding: 0.15rem 0; }
.qa-list-item .qa-a-row .pts { color: var(--gold); font-weight: 700; }
.qa-list-item .qa-actions { margin-top: 0.6rem; display: flex; gap: 0.5rem; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.tab-btn { background: var(--bg-navy); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 0.5rem 1.1rem; }
.tab-btn.active { background: var(--gold); color: #1a1025; border-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

@media (max-width: 700px) {
  .scores-row { grid-template-columns: 1fr; }
  .final-scores { grid-template-columns: 1fr; }
}
