/* ── Host body ──────────────────────────────────────────────────────────── */
.host-body { min-height: 100vh; }

/* ─── LOBBY ─────────────────────────────────────────────────────────────── */
#phase-lobby {
  min-height: 100vh;
  align-items: stretch;
}
.lobby-wrap {
  display: flex;
  flex: 1;
  gap: 0;
  min-height: 100vh;
}

.lobby-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border-right: 1px solid rgba(255,255,255,0.07);
  gap: 20px;
}

.game-logo {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.qr-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: fadeIn 0.5s ease;
}
.qr-card img {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto 12px;
}
.join-url-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.join-url { font-size: 1rem; font-weight: 700; color: var(--text-primary); word-break: break-all; }

/* Pending players */
.pending-section {
  width: 100%;
  max-width: 400px;
  background: rgba(233, 69, 96, 0.08);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pending-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}
.pending-count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 20px;
}
.pending-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pending-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  animation: popIn 0.3s ease;
}
.pending-name {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
}
.btn-approve {
  background: #2ecc71;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-approve:hover { background: #27ae60; }
.btn-approve:active { transform: scale(0.95); }
.btn-deny {
  background: rgba(233, 69, 96, 0.2);
  color: var(--accent);
  border: 1px solid rgba(233, 69, 96, 0.4);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-deny:hover { background: rgba(233, 69, 96, 0.35); }

.player-list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  width: 100%;
  max-width: 400px;
}
.player-count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
}

.lobby-player-list {
  list-style: none;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lobby-player-list li {
  background: var(--bg-panel);
  border-radius: 30px;
  padding: 8px 18px;
  font-size: 1rem;
  font-weight: 700;
  animation: popIn 0.3s ease;
}

.lobby-right {
  width: 380px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  gap: 24px;
  background: var(--bg-panel);
}

.config-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.config-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-group label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.config-row {
  display: flex;
  gap: 10px;
}
.config-group select,
.config-group input[type="number"],
.config-row input[type="number"],
.config-row select {
  background: var(--bg-highlight);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}
.config-group select:focus,
.config-group input:focus {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1.2rem;
  font-weight: 800;
  padding: 16px 32px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, opacity 0.2s;
  width: 100%;
  letter-spacing: 0.3px;
}
.btn-primary:hover:not(:disabled) { background: #c73652; transform: scale(1.02); }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.start-hint { font-size: 0.85rem; color: var(--text-muted); text-align: center; }

/* ─── CATEGORY SELECT ───────────────────────────────────────────────────── */
#phase-category {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.category-phase-wrap {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.category-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.selector-label {
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  animation: fadeIn 0.4s ease;
  text-shadow: 0 0 30px rgba(255,215,0,0.4);
}
.mini-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}
.mini-lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.mini-lb-row:first-child { color: var(--text-primary); font-weight: 800; }
.mini-lb-row .lb-name { font-weight: 700; }
.mini-lb-row .lb-score { color: var(--gold); font-weight: 800; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.cat-btn {
  background: var(--bg-panel);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 20px 16px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
  animation: fadeIn 0.3s ease both;
}
.cat-btn:hover { background: var(--bg-highlight); border-color: var(--accent); transform: scale(1.04); }
.cat-btn:active { transform: scale(0.97); }

/* Category grid locked (non-host player is selecting) */
.category-grid.locked .cat-btn {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
}

/* ─── QUESTION PHASE ────────────────────────────────────────────────────── */
#phase-question {
  min-height: 100vh;
  flex-direction: row;
  align-items: stretch;
}
.question-layout {
  display: flex;
  flex: 1;
  min-height: 100vh;
}
.question-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  gap: 16px;
}

.question-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.q-counter {
  background: var(--bg-panel);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
}
.q-category-label {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.answered-count {
  background: var(--bg-panel);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.timer-bar-wrap {
  width: 100%;
  height: 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--timer-green);
  border-radius: 8px;
  transition: width 0.95s linear, background-color 0.5s ease;
}
.timer-bar.urgent {
  animation: timerPulse 0.6s ease-in-out infinite;
}

.timer-seconds-display {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-muted);
  line-height: 1;
  margin-top: -8px;
}
.timer-seconds-display.urgent { color: var(--timer-red); }

.question-text {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
  text-align: center;
  padding: 8px 0;
  animation: fadeIn 0.4s ease;
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  flex: 1;
}
.answer-tile {
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 80px;
  transition: opacity 0.4s, transform 0.3s, box-shadow 0.3s;
  animation: popIn 0.35s ease both;
}
.answer-tile:nth-child(1) { animation-delay: 0.05s; }
.answer-tile:nth-child(2) { animation-delay: 0.1s; }
.answer-tile:nth-child(3) { animation-delay: 0.15s; }
.answer-tile:nth-child(4) { animation-delay: 0.2s; }

.tile-a { background: var(--color-a); }
.tile-b { background: var(--color-b); }
.tile-c { background: var(--color-c); }
.tile-d { background: var(--color-d); }

.answer-letter {
  font-size: 1.4rem;
  font-weight: 900;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.answer-body {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Reveal states */
.tile-correct {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.7), 0 0 40px rgba(255,255,255,0.3);
  animation: glow 1.2s ease-in-out infinite;
}
.tile-wrong {
  opacity: 0.25;
  filter: grayscale(0.8);
  transform: scale(0.97);
}

.host-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
}
.btn-host-ctrl {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-host-ctrl:hover { background: rgba(255,255,255,0.14); color: var(--text-primary); }
.btn-skip:hover { background: rgba(231,76,60,0.3); color: #fff; }
.btn-extend:hover { background: rgba(46,204,113,0.2); color: #fff; }

/* ─── LEADERBOARD SIDEBAR ───────────────────────────────────────────────── */
.leaderboard-sidebar {
  width: 260px;
  min-width: 220px;
  background: var(--bg-panel);
  border-left: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 14px;
}
.sidebar-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}
.live-leaderboard {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.lb-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background 0.3s;
  animation: fadeIn 0.3s ease;
}
.lb-entry.rank-1 { background: rgba(255,215,0,0.12); border-left: 3px solid var(--gold); }
.lb-entry.rank-2 { border-left: 3px solid var(--silver); }
.lb-entry.rank-3 { border-left: 3px solid var(--bronze); }
.lb-rank {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.lb-name {
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--gold);
}
.lb-streak {
  font-size: 0.8rem;
  color: var(--timer-orange, #f39c12);
}
.lb-kick-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.lb-kick-btn:hover { color: var(--accent); background: rgba(233,69,96,0.15); }

/* ─── REVEAL PHASE ──────────────────────────────────────────────────────── */
#phase-reveal {
  min-height: 100vh;
  flex-direction: row;
  align-items: stretch;
}
.reveal-layout {
  display: flex;
  flex: 1;
  min-height: 100vh;
}
.reveal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 32px;
  gap: 16px;
}
.reveal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reveal-question-text {
  font-size: 1.5rem;
}
.reveal-answer-grid .answer-tile { cursor: default; }
.reveal-results-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0;
}
.reveal-result-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  animation: popIn 0.35s ease both;
}
.reveal-result-chip.correct { border: 2px solid var(--timer-green); }
.reveal-result-chip.wrong { border: 2px solid rgba(255,255,255,0.1); opacity: 0.55; }
.chip-name { color: var(--text-primary); }
.chip-pts { color: var(--gold); }
.chip-streak { color: #f39c12; font-size: 0.8rem; }

.btn-next {
  align-self: center;
  width: auto;
  padding: 14px 40px;
  margin-top: auto;
}

/* ─── FINAL PHASE ───────────────────────────────────────────────────────── */
#phase-final {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.final-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 900px;
}
.final-title {
  font-size: 3rem;
  font-weight: 900;
  animation: celebrate 0.8s ease;
  text-shadow: 0 0 40px rgba(255,215,0,0.5);
}

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 600px;
}
.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  animation: slideUp 0.6s ease both;
}
.slot-1 { animation-delay: 0.1s; }
.slot-2 { animation-delay: 0.3s; }
.slot-3 { animation-delay: 0.5s; }

.podium-crown { font-size: 2rem; margin-bottom: 4px; animation: pulse 1.5s ease infinite; }
.podium-avatar { font-size: 2.2rem; margin-bottom: 6px; }
.podium-name { font-size: 1rem; font-weight: 800; text-align: center; max-width: 120px; word-break: break-word; }
.podium-score { font-size: 0.9rem; color: var(--gold); font-weight: 800; margin-top: 4px; }
.podium-block {
  margin-top: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
}
.block-1 { background: var(--gold); height: 140px; color: #1a1a0a; }
.block-2 { background: var(--silver); height: 100px; color: #1a1a1a; }
.block-3 { background: var(--bronze); height: 70px; }

.final-full-leaderboard {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.final-lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  animation: fadeIn 0.3s ease both;
}
.final-lb-row .lb-rank { width: 28px; }

#btn-play-again { width: auto; padding: 16px 48px; font-size: 1.2rem; }

/* ─── BONUS ROUND ───────────────────────────────────────────────────────── */
#phase-bonus {
  min-height: 100vh;
  flex-direction: row;
  align-items: stretch;
}
.bonus-layout {
  display: flex;
  flex: 1;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #1a1030 100%);
}
.bonus-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 24px;
}

.bonus-badge {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 24px;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(243,156,18,0.5);
  animation: pulse 2s ease-in-out infinite;
}
.bonus-badge-sm {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 20px;
}

.bonus-announce {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: popIn 0.5s ease;
}
.bonus-player-announce {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255,215,0,0.5);
  text-align: center;
}
.bonus-wager-hint {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.bonus-question-wrap {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.4s ease;
}
.bonus-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}
.bonus-who-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  flex: 1;
}
.bonus-wager-display {
  background: rgba(243,156,18,0.15);
  border: 1px solid rgba(243,156,18,0.4);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #f39c12;
}

.bonus-reveal-wrap {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.4s ease;
}
.bonus-result-player {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
}
.bonus-result-verdict {
  font-size: 2rem;
  font-weight: 900;
}
.bonus-result-verdict.correct { color: var(--timer-green); }
.bonus-result-verdict.wrong   { color: var(--accent); }
.bonus-result-points {
  font-size: 3rem;
  font-weight: 900;
}
.bonus-result-points.gain { color: var(--gold); }
.bonus-result-points.loss { color: var(--accent); }
.bonus-result-score {
  font-size: 1.1rem;
  color: var(--text-muted);
}
.bonus-reveal-grid { max-width: 700px; }
