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

:root {
  --purple:      #7c6ff7;
  --purple-dark: #6c5ce7;
  --purple-deep: #4834d4;
  --green:       #00b894;
  --green-dark:  #00a381;
  --red:         #ff6b6b;
  --red-dark:    #ee5a5a;
  --amber:       #fdcb6e;
  --bg-from:     #667eea;
  --bg-to:       #764ba2;
  --card-bg:     #ffffff;
  --surface:     #f7f8fc;
  --text:        #1a1a2e;
  --text-2:      #4a4a6a;
  --muted:       #8888aa;
  --border:      #e8e8f0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ── Screens ──────────────────────────────────────────────────────── */
.screen { display: none; width: 100%; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── Shared card ──────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.center-card { align-items: center; text-align: center; }

/* ── Typography ───────────────────────────────────────────────────── */
h1 {
  font-size: 2.4em;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
h2 { font-size: 1.5em; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
h3 { font-size: 1em; font-weight: 600; color: var(--text-2); }
.subtitle { color: var(--muted); font-size: 1em; line-height: 1.5; }
.hint { color: var(--muted); font-size: 0.875em; }
.logo-icon { font-size: 3.5em; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); }

/* ── Buttons ──────────────────────────────────────────────────────── */
button {
  padding: 13px 26px;
  font-size: 0.95em;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
  letter-spacing: 0.01em;
}
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
button:active:not(:disabled) { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108,92,231,0.35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108,92,231,0.45); }
.btn-secondary {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,184,148,0.3);
}
.btn-secondary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,184,148,0.4); }
.btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--purple);
  border: 2px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--purple); }
.btn-large { padding: 16px 40px; font-size: 1.05em; border-radius: 16px; }

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.form-group label { font-size: 0.75em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }

input, select {
  padding: 11px 14px;
  font-size: 0.95em;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(124,111,247,0.12);
  background: #fff;
}
.code-input { text-transform: uppercase; letter-spacing: 0.3em; font-size: 1.6em; font-weight: 700; text-align: center; }
.error { color: var(--red); font-size: 0.875em; text-align: center; font-weight: 500; }

/* ── Category badge ───────────────────────────────────────────────── */
.category-badge {
  background: rgba(255,255,255,0.22);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: #fff;
}

/* ── Answer groups (shared) ───────────────────────────────────────── */
.answer-groups { display: flex; flex-direction: column; gap: 10px; }
.answer-group {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border: 1.5px solid var(--border);
}
.answer-group-header {
  font-weight: 700; font-size: 0.8em; text-transform: uppercase;
  letter-spacing: 0.07em; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.answer-group.amen   .answer-group-header { color: #1a7a50; }
.answer-group.rebuke .answer-group-header { color: #c0392b; }
.answer-group.convert .answer-group-header { color: #8a6200; }
.answer-group-count { background: currentColor; color: #fff !important; padding: 1px 8px; border-radius: 20px; font-size: 0.85em; }
.answer-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 5px 13px; border-radius: 20px; font-size: 0.82em; font-weight: 600; background: #f0eeff; color: var(--purple-dark); }
.chip.converted::after { content: ' ↩'; font-size: 0.8em; color: var(--muted); }

/* ── Leaderboard (shared) ─────────────────────────────────────────── */
.leaderboard { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.leaderboard li {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: var(--surface);
  border-radius: 14px; font-size: 0.9em; font-weight: 500;
  color: var(--text); border: 1.5px solid transparent;
}
.leaderboard li:first-child { background: linear-gradient(135deg,#fffbec,#fff8d6); border-color: rgba(253,203,110,0.5); font-weight: 700; }
.leaderboard li .rank { font-weight: 700; color: var(--muted); min-width: 22px; }
.leaderboard li .lb-score { margin-left: auto; font-weight: 800; color: var(--purple-dark); font-size: 1.05em; }

/* ── Round points (shared) ────────────────────────────────────────── */
.round-points { display: flex; flex-direction: column; gap: 6px; }
.round-point-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; background: var(--surface); border-radius: 10px;
  font-size: 0.875em; font-weight: 500;
}
.round-point-row .pts { font-weight: 700; color: var(--green-dark); }

/* ── Progress bar (shared) ────────────────────────────────────────── */
.progress-bar { background: rgba(255,255,255,0.2); border-radius: 20px; height: 10px; overflow: hidden; }
#q-progress-fill { height: 100%; background: var(--green); border-radius: 20px; transition: width 0.4s ease; }

/* ── Timer (shared) ───────────────────────────────────────────────── */
.timer-ring { position: relative; width: 58px; height: 58px; flex-shrink: 0; }
.timer-ring svg { transform: rotate(-90deg); width: 58px; height: 58px; }
.timer-track { fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 5; }
.timer-fill { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 163; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke 0.5s; }
.timer-fill.urgent { stroke: var(--red); }
#deb-timer-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.9em; font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════
   HOST (BIG SCREEN) STYLES
   ════════════════════════════════════════════════════════════════════ */
.host-body { display: flex; align-items: flex-start; justify-content: center; padding: 24px; }

/* Setup + Home screens */
#screen-setup, #screen-home, #screen-reconnect { min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }

/* Lobby */
.host-lobby {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  min-height: 100vh;
  width: 100%;
}
.host-lobby-left {
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(20px);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.host-brand { color: rgba(255,255,255,0.9); font-size: 1em; font-weight: 700; letter-spacing: 0.02em; }
.host-room-code-block { text-align: center; }
.host-room-label { color: rgba(255,255,255,0.6); font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.host-room-code { color: #fff; font-size: 4em; font-weight: 800; letter-spacing: 0.2em; line-height: 1; }
#lobby-qr canvas, #lobby-qr img { border-radius: 12px; }
.qr-label { color: rgba(255,255,255,0.6); font-size: 0.8em; font-weight: 500; text-align: center; }
.host-join-url { color: rgba(255,255,255,0.45); font-size: 0.72em; text-align: center; word-break: break-all; }

.host-lobby-right {
  padding: 48px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.host-lobby-right h2 { color: #fff; font-size: 1.8em; }
.muted-count { color: rgba(255,255,255,0.5); font-size: 0.7em; font-weight: 500; margin-left: 6px; }

.host-player-list { list-style: none; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.host-player-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.12);
  border-radius: 14px;
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.host-player-list li .crown { font-size: 1.1em; }

.host-lobby-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

/* Game screens */
.host-game-wrap {
  min-height: 100vh;
  width: 100%;
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.host-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 14px 22px;
  color: #fff;
}
.host-round-badge {
  background: rgba(255,255,255,0.2);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.host-room-code-badge {
  background: rgba(255,255,255,0.12);
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.5);
}
.host-progress-label { color: rgba(255,255,255,0.7); font-size: 0.85em; font-weight: 600; }

.host-question-card {
  background: #fff;
  border-radius: 24px;
  padding: 56px 64px;
  text-align: center;
  font-size: 2em;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.host-question-card.small { font-size: 1.3em; padding: 28px 40px; flex: none; }

.host-progress-status { color: rgba(255,255,255,0.8); font-size: 0.9em; font-weight: 600; margin-bottom: 8px; text-align: center; }

.host-player-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.host-player-chip {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.2);
  transition: background 0.3s, color 0.3s;
}
.host-player-chip.answered { background: var(--green); color: #fff; border-color: var(--green); }

/* Big screen answer groups */
.answer-groups-host { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.answer-groups-host .answer-group { background: rgba(255,255,255,0.95); }
.answer-groups-host .chip { font-size: 0.9em; padding: 6px 14px; }

.host-action-bar { display: flex; justify-content: center; margin-top: auto; padding-top: 8px; }

/* Scoring grid */
.host-scoring-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.host-score-col { background: rgba(255,255,255,0.1); border-radius: 20px; padding: 24px; }
.host-score-col .leaderboard li { background: rgba(255,255,255,0.15); color: #fff; border-color: transparent; }
.host-score-col .leaderboard li:first-child { background: rgba(253,203,110,0.25); }
.host-score-col .leaderboard li .rank { color: rgba(255,255,255,0.5); }
.host-score-col .leaderboard li .lb-score { color: var(--amber); }
.host-score-col .round-point-row { background: rgba(255,255,255,0.1); color: #fff; }
.host-leaderboard li { background: rgba(255,255,255,0.15); color: #fff; }
.host-leaderboard li:first-child { background: rgba(253,203,110,0.25); }
.host-leaderboard li .rank { color: rgba(255,255,255,0.5); }
.host-leaderboard li .lb-score { color: var(--amber); }

/* ════════════════════════════════════════════════════════════════════
   PLAYER (PHONE) STYLES
   ════════════════════════════════════════════════════════════════════ */
.player-body { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 0 16px 16px; }

.player-persistent-header {
  width: 100%; max-width: 420px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; margin-bottom: 8px;
  color: rgba(255,255,255,0.7); font-size: 0.8em; font-weight: 700;
  letter-spacing: 0.05em;
}

.player-card { max-width: 420px; width: 100%; margin: auto; }

.player-room-badge {
  background: linear-gradient(135deg, #f0eeff, #f5eeff);
  border: 2px solid rgba(124,111,247,0.2);
  border-radius: 14px;
  padding: 10px 20px;
  text-align: center;
  font-size: 1.8em;
  font-weight: 800;
  color: var(--purple-dark);
  letter-spacing: 0.2em;
}

.player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; background: var(--surface);
  border-radius: 12px; font-size: 0.9em; font-weight: 500; color: var(--text);
}
.player-list li .score-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 0.78em; font-weight: 700;
}

/* Player voting */
.player-voting-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}
.player-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px; padding: 12px 16px; color: #fff;
  font-size: 0.875em; font-weight: 600;
}
.player-question-card {
  background: #fff; border-radius: 20px;
  padding: 32px 24px; text-align: center;
  font-size: 1.25em; font-weight: 500; line-height: 1.6; color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.player-vote-btns { display: flex; flex-direction: column; gap: 12px; }
.resp-btn {
  padding: 18px 20px; font-size: 1em; font-weight: 700;
  border-radius: 16px; border: 2.5px solid transparent;
  width: 100%; text-align: center;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.resp-btn.amen    { background: #e8faf3; color: #1a7a50; border-color: var(--green); }
.resp-btn.rebuke  { background: #fff0f0; color: #c0392b; border-color: var(--red); }
.resp-btn.convert { background: #fffbec; color: #8a6200; border-color: var(--amber); }
.resp-btn:hover   { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,0.1); }
.resp-btn.selected { transform: scale(1.03); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.resp-btn:not(.selected).answered { opacity: 0.3; pointer-events: none; }

.player-waiting { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; }
.waiting-icon { font-size: 2.5em; }

.player-answer-badge {
  padding: 12px 20px; border-radius: 14px; text-align: center;
  font-size: 1em; font-weight: 700;
}
.player-answer-badge.amen    { background: #e8faf3; color: #1a7a50; border: 2px solid var(--green); }
.player-answer-badge.rebuke  { background: #fff0f0; color: #c0392b; border: 2px solid var(--red); }
.player-answer-badge.convert { background: #fffbec; color: #8a6200; border: 2px solid var(--amber); }

.player-current-answer {
  background: var(--surface); border-radius: 12px;
  padding: 12px 16px; font-size: 0.9em; color: var(--text-2); font-weight: 500;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .host-lobby { grid-template-columns: 1fr; }
  .host-lobby-left { padding: 32px 24px; }
  .host-lobby-right { padding: 32px 24px; }
  .host-question-card { font-size: 1.4em; padding: 32px 24px; }
  .answer-groups-host { grid-template-columns: 1fr; }
  .host-scoring-grid { grid-template-columns: 1fr; }
}
