:root {
  --primary: #f4511e;
  --primary-dark: #b23c14;
  --secondary: #00acc1;
  --tertiary: #d81b60;
  --bg: #16120f;
  --surface: #201a18;
  --surface-variant: #2c2422;
  --outline: #a89890;
  --on-surface: #f5ede9;
  --error: #ff5449;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, #1c1613 100%);
  color: var(--on-surface);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px;
}

.wrap.wide {
  max-width: 720px;
}

h1, h2, h3 {
  font-weight: 900;
  letter-spacing: 0.5px;
}

.brand {
  text-align: center;
  color: var(--primary);
  font-weight: 900;
  letter-spacing: 2px;
  margin: 32px 0 4px;
}

.brand img {
  display: block;
  margin: 0 auto;
  width: 200px;
  max-width: 100%;
  height: auto;
}

.topbar .brand img {
  margin: 0;
  width: 120px;
}

.qrcode {
  width: 180px;
  max-width: 100%;
  margin: 12px auto 20px;
  background: white;
  border-radius: 12px;
  padding: 8px;
}
.qrcode svg { display: block; width: 100%; height: auto; }

.launch-logo {
  display: block;
  margin: 24px auto 0;
  width: 160px;
  max-width: 100%;
  height: auto;
}

.subtitle {
  text-align: center;
  color: var(--outline);
  margin-bottom: 32px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--outline);
  margin-bottom: 6px;
}

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--surface-variant);
  color: var(--on-surface);
  font-size: 16px;
  font-weight: 600;
}

input:focus, select:focus {
  outline: 2px solid var(--primary);
}

.password-field {
  position: relative;
  margin-bottom: 18px;
}

.password-field input[type=password], .password-field input[type=text] {
  margin-bottom: 0;
  padding-right: 60px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 0;
  bottom: 0;
  width: auto;
  padding: 0 14px;
  background: none;
  border: none;
  color: var(--outline);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
}

.password-toggle:hover { color: var(--on-surface); }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: var(--secondary); }
button.tertiary { background: var(--tertiary); }
button.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: var(--on-surface); }
button.danger { background: var(--error); }
button.small { width: auto; padding: 8px 16px; font-size: 12px; }

.error-text {
  color: var(--error);
  font-weight: 700;
  font-size: 14px;
  margin: -8px 0 16px;
}

.muted { color: var(--outline); }

.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

a { color: var(--secondary); }

.center { text-align: center; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar .brand { margin: 0; text-align: left; }

.pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.pill.live { background: rgba(216,27,96,0.2); color: var(--tertiary); }
.pill.past { background: rgba(255,255,255,0.08); color: var(--outline); }

.quiz-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}
.quiz-item:hover { border-color: var(--primary); }
.quiz-item .icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--tertiary));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.quiz-item .meta { flex: 1; min-width: 0; }
.quiz-item .meta .title { font-weight: 900; text-transform: uppercase; }
.quiz-item .meta .sub { color: var(--outline); font-size: 13px; margin-top: 2px; }

.join-code {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--primary);
  text-align: center;
  margin: 8px 0;
}

.chip {
  display: inline-flex;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--surface-variant);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--on-surface);
}
.chip.selected { background: var(--secondary); color: white; border-color: var(--secondary); }

.participant-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-variant);
  margin-bottom: 8px;
}
.participant-row .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
}
.participant-row.ready .avatar { background: var(--secondary); }
.participant-row .name { font-weight: 800; flex: 1; }
.participant-row .kick { background: none; border: none; color: var(--error); cursor: pointer; width: auto; padding: 4px 8px; font-size: 18px; }

.timer {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 8px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 900; color: var(--primary);
  margin: 0 auto 24px;
}
.timer.low { border-color: var(--error); color: var(--error); }

.answer-bar { margin-bottom: 10px; }
.answer-bar .label-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.answer-bar .track { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.1); overflow: hidden; }
.answer-bar .fill { height: 100%; background: var(--secondary); }

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--surface-variant);
  margin-bottom: 10px;
  border: 2px solid transparent;
}
.leaderboard-row .rank {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--outline);
  color: black;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}
.leaderboard-row.rank-1 { border-color: var(--gold); } .leaderboard-row.rank-1 .rank { background: var(--gold); }
.leaderboard-row.rank-2 { border-color: var(--silver); } .leaderboard-row.rank-2 .rank { background: var(--silver); }
.leaderboard-row.rank-3 { border-color: var(--bronze); } .leaderboard-row.rank-3 .rank { background: var(--bronze); }
.leaderboard-row .name { flex: 1; font-weight: 900; text-transform: uppercase; }
.leaderboard-row .score { font-weight: 900; color: var(--primary); font-size: 18px; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tabs button { background: var(--surface-variant); color: var(--on-surface); }
.tabs button.active { background: var(--secondary); }

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--outline);
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.question-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 16px;
}

.grid-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.grid-status .dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900;
}
.grid-status .dot.answered { background: var(--primary); color: white; }

.answer-grid { display: flex; flex-direction: column; gap: 12px; }
.answer-choice {
  background: var(--surface-variant);
  color: var(--on-surface);
  text-transform: none;
  font-size: 17px;
  min-height: 64px;
  text-align: center;
}
.answer-choice.selected { background: var(--primary); }
.answer-choice.correct { background: #00c853; }
.answer-choice.incorrect { background: var(--error); }
.answer-choice:disabled { opacity: 1; }
.answer-choice:disabled:not(.selected):not(.correct) { opacity: 0.5; }

.duel-score-strip { margin-bottom: 8px; }
.duel-score-strip .row { padding: 6px 0; font-weight: 800; font-size: 14px; }
.duel-score-strip .row.me { color: var(--primary); }
.duel-score-strip .row:not(.me) { color: var(--outline); }

/* ---- Bingo: card, called board, current ball ---------------------------- */

/* Player's 5x5 daubable card (header row of B/I/N/G/O + 25 cells). */
.bingo-card {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.bingo-card-head {
  text-align: center;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--primary);
  padding: 4px 0;
}
.bingo-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0;
  margin: 0;
  border-radius: 12px;
  background: var(--surface-variant);
  color: var(--on-surface);
  border: 2px solid rgba(255,255,255,0.08);
  font-size: clamp(16px, 5vw, 24px);
  font-weight: 900;
  text-transform: none;
  cursor: pointer;
  transition: transform 0.05s ease;
}
.bingo-cell.called {
  border-color: var(--secondary);
  color: var(--secondary);
}
.bingo-cell.daubed {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,0.25);
}
.bingo-cell.free {
  background: var(--tertiary);
  border-color: var(--tertiary);
  color: #fff;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: default;
}
.bingo-cell:active { transform: scale(0.94); }
.bingo-cell:disabled { opacity: 1; }

.bingo-btn { transition: box-shadow 0.2s ease, transform 0.1s ease; }
.bingo-btn.ready {
  box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(255,215,0,0.5);
  animation: bingo-pulse 1s ease-in-out infinite;
}
@keyframes bingo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.current-ball {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold);
  text-align: center;
  margin: 8px 0 16px;
}

.claim-banner {
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
}
.claim-banner.ok { background: rgba(0,200,83,0.15); color: #00c853; border: 1px solid rgba(0,200,83,0.4); }
.claim-banner.bad { background: rgba(255,84,73,0.15); color: var(--error); border: 1px solid rgba(255,84,73,0.4); }

.called-list {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--outline);
  line-height: 1.9;
  word-spacing: 2px;
}

/* Host big-screen: PLAYING = ball/winners column + full 1-75 board column. */
.host-play { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.host-play-left { flex: 1; min-width: 280px; }
.host-play-right { flex: 1; min-width: 280px; }

.called-board { display: flex; gap: 8px; }
.called-col { flex: 1; }
.called-col-head {
  text-align: center;
  font-weight: 900;
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 6px;
}
.called-num {
  text-align: center;
  padding: 6px 0;
  margin-bottom: 4px;
  border-radius: 8px;
  background: var(--surface-variant);
  color: var(--outline);
  font-weight: 800;
  font-size: 14px;
}
.called-num.lit {
  background: var(--secondary);
  color: #fff;
}
.called-num.current {
  background: var(--gold);
  color: #000;
  box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(255,215,0,0.6);
}

.winner-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-variant);
  margin-bottom: 8px;
}
.winner-row .badge {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: var(--outline);
  flex-shrink: 0;
}
.winner-row .name { flex: 1; font-weight: 800; }
.winner-row.win { border-left: 3px solid var(--gold); }
.winner-row.false { border-left: 3px solid var(--error); opacity: 0.75; }
