/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; width: 100%;
  overflow: hidden; touch-action: none; user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #0a0b1a; color: #e8e8f0;
}
body { position: relative; }

/* ── Screens ────────────────────────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
}
.screen.active { display: flex; }

/* ── Splash ─────────────────────────────────────────────────── */
#splash {
  background: linear-gradient(135deg, #0a0b1a 0%, #1a1040 40%, #0d1a2d 100%);
  text-align: center;
}
.splash-content { max-width: 400px; padding: 24px; }
.logo { font-size: 80px; line-height: 1; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
.logo-small { font-size: 48px; margin-bottom: 12px; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.splash-content h1 {
  font-size: 48px; font-weight: 800;
  background: linear-gradient(135deg, #6c63ff, #e040fb, #00bcd4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.subtitle { font-size: 14px; color: rgba(255,255,255,0.5); font-style: italic; margin-bottom: 24px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  padding: 14px 44px;
  font-size: 18px; font-weight: 700;
  border: none; border-radius: 50px;
  cursor: pointer;
  background: linear-gradient(135deg, #6c63ff, #7c4dff);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108,99,255,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 6px 28px rgba(108,99,255,0.5); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-discord {
  display: inline-block;
  padding: 12px 32px;
  margin-bottom: 12px;
  font-size: 16px; font-weight: 700;
  border: none; border-radius: 50px;
  cursor: pointer;
  background: #5865f2;
  color: #fff;
  box-shadow: 0 4px 20px rgba(88,101,242,0.3);
  transition: transform 0.15s;
}
.btn-discord:hover { transform: scale(1.05); }
.btn-discord:active { transform: scale(0.97); }
.btn-discord:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Name Input ─────────────────────────────────────────────── */
.name-input-wrap { margin-bottom: 16px; }
.name-input {
  width: 100%; max-width: 240px;
  padding: 10px 16px;
  font-size: 16px; font-weight: 600;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.name-input::placeholder { color: rgba(255,255,255,0.3); font-weight: 400; }
.name-input:focus { border-color: #6c63ff; }
.status-text { margin-top: 12px; font-size: 13px; color: rgba(255,255,255,0.4); }
.points-gained { color: #69f0ae !important; font-weight: 600; }

/* ── Lobby ──────────────────────────────────────────────────── */
#lobby {
  background: linear-gradient(180deg, #0a0b1a, #111028);
}
.lobby-content { text-align: center; max-width: 400px; padding: 24px; width: 100%; }
.lobby-content h2 { font-size: 24px; margin-bottom: 20px; color: rgba(255,255,255,0.7); }
#lobbyPlayers {
  margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
}
.lobby-player {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  min-width: 200px; justify-content: center;
}
.lobby-player.is-you {
  background: rgba(108,99,255,0.12);
  border: 1px solid rgba(108,99,255,0.2);
}
.lp-name { font-weight: 600; }
.you-tag {
  display: inline-block;
  background: linear-gradient(135deg, #6c63ff, #7c4dff);
  color: #fff;
  font-size: 9px; font-weight: 800;
  padding: 1px 6px; border-radius: 8px;
  letter-spacing: 0.5px;
}

/* ── Game HUD ───────────────────────────────────────────────── */
#gameScreen {
  background: #0a0b1a;
}
#gameHud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
  font-size: 14px; font-weight: 600;
  color: rgba(255,255,255,0.7);
}
#scoreDisplay { color: #6c63ff; }

/* ── Scenario Card ──────────────────────────────────────────── */
#scenarioCard {
  margin: 60px 16px 20px;
  padding: 24px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  max-width: 500px;
  width: calc(100% - 32px);
  text-align: center;
}
#scenarioTitle {
  font-size: 20px; font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #e040fb, #6c63ff, #00bcd4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
#scenarioText {
  font-size: 15px; line-height: 1.6;
  color: rgba(255,255,255,0.8);
}

/* ── Choices ────────────────────────────────────────────────── */
#choices {
  display: flex; gap: 12px;
  padding: 0 16px;
  max-width: 500px;
  width: calc(100% - 32px);
  margin-bottom: 16px;
}
.choice-btn {
  flex: 1;
  padding: 16px 8px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.choice-btn:disabled { opacity: 0.5; cursor: default; }
.choice-btn:not(:disabled):hover {
  border-color: #6c63ff;
  background: rgba(108,99,255,0.08);
}
.choice-btn.selected {
  border-color: #6c63ff !important;
  background: rgba(108,99,255,0.15) !important;
  box-shadow: 0 0 20px rgba(108,99,255,0.2);
}
.choice-label {
  font-size: 16px; font-weight: 800;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
}
.choice-a.selected .choice-label { color: #6c63ff; }
.choice-b.selected .choice-label { color: #e040fb; }
.choice-text { font-size: 13px; font-weight: 600; line-height: 1.3; }

/* ── Timer ──────────────────────────────────────────────────── */
#timerBar {
  position: relative;
  height: 6px;
  width: calc(100% - 32px);
  max-width: 500px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
#timerFill {
  height: 100%;
  background: #3fb950;
  border-radius: 3px;
  transition: width 0.9s linear, background 0.3s;
  width: 100%;
}
#timerText {
  position: absolute;
  right: 0;
  top: -24px;
  font-size: 14px; font-weight: 700;
  color: rgba(255,255,255,0.5);
}
#waitingMsg { margin-top: 36px; }

/* ── Results Screen ─────────────────────────────────────────── */
#resultsScreen {
  background: linear-gradient(180deg, #0a0b1a, #111028);
}
.results-content {
  text-align: center; max-width: 480px; padding: 24px; width: 100%;
}
.results-content h2 { font-size: 22px; margin-bottom: 20px; }

#votesDisplay {
  display: flex; gap: 16px;
  margin-bottom: 20px;
}
.vote-col {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
}
.vote-label {
  font-size: 20px; font-weight: 800;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.3);
}
.voter {
  padding: 4px 0;
  font-size: 14px;
  font-weight: 600;
}
.voter.is-you {
  color: #6c63ff;
}
.voter.muted {
  color: rgba(255,255,255,0.25);
  font-style: italic;
  font-weight: 400;
}

#clueReveal {
  margin: 16px 0;
  padding: 16px;
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 12px;
}
.clue-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #e040fb; margin-bottom: 8px;
}
#clueText {
  font-size: 15px; line-height: 1.5; color: rgba(255,255,255,0.9);
  margin-bottom: 8px;
}
.lesson {
  font-size: 13px; font-style: italic;
  color: rgba(255,255,255,0.6);
}

#roundPoints { margin: 12px 0; }
#nextBtn { margin-top: 16px; }

/* ── Final Screen ───────────────────────────────────────────── */
#finalScreen {
  background: linear-gradient(180deg, #0a0b1a, #111028);
}
#finalLeaderboard {
  margin: 16px auto;
  max-width: 320px;
  text-align: left;
}
.final-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.final-row.is-you {
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.15);
}
.final-rank { width: 28px; text-align: center; font-weight: 700; }
.final-name { flex: 1; font-weight: 600; }
.final-score { font-weight: 700; color: #6c63ff; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 500px) {
  .splash-content h1 { font-size: 36px; }
  .logo { font-size: 60px; }
  .btn-primary { padding: 12px 32px; font-size: 16px; }
  #scenarioCard { padding: 16px; margin-top: 52px; }
  #scenarioTitle { font-size: 18px; }
  #scenarioText { font-size: 14px; }
  .choice-btn { padding: 12px 6px; }
  .choice-text { font-size: 12px; }
  #choices { gap: 8px; }
  #votesDisplay { flex-direction: column; gap: 8px; }
}
