/* ─── Quiplash Web — Styles ───────────────────────────────── */
/* Jackbox-inspired dark theme with bright accents */

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --accent-yellow: #f5c518;
  --accent-red: #e74c3c;
  --accent-green: #2ecc71;
  --accent-blue: #3498db;
  --accent-purple: #9b59b6;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --timer-height: 6px;
}

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

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ─── Timer Bar ──────────────────────────────────────────────── */

.timer-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--timer-height);
  background: rgba(255,255,255,0.1);
  z-index: 100;
}

.timer-bar .fill {
  height: 100%;
  background: var(--accent-yellow);
  transition: width 0.5s linear, background 0.3s;
  width: 100%;
}

.timer-bar.warning .fill {
  background: var(--accent-red);
}

/* ─── Landing Page ───────────────────────────────────────────── */

.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.game-logo {
  font-size: 4rem;
  font-weight: 900;
  color: var(--accent-yellow);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  margin-bottom: 0.5rem;
  letter-spacing: -2px;
}

.game-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.game-code-container {
  margin-bottom: 2rem;
}

.game-code-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.game-code {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent-green);
  letter-spacing: 8px;
  background: var(--bg-secondary);
  padding: 0.5rem 2rem;
  border-radius: 8px;
  border: 2px solid var(--accent-green);
}

.join-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

input[type="text"],
input[type="number"] {
  background: var(--bg-secondary);
  border: 2px solid var(--bg-card);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--accent-yellow);
}

button {
  background: var(--accent-yellow);
  color: var(--bg-primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

button:hover {
  opacity: 0.9;
}

button:active {
  transform: scale(0.97);
}

button.primary {
  background: var(--accent-green);
  color: white;
}

button.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ─── Host View ──────────────────────────────────────────────── */

.host-container {
  display: flex;
  height: 100vh;
  padding-top: var(--timer-height);
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.sidebar {
  width: 250px;
  background: var(--bg-secondary);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.phase-indicator {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.round-info {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.prompt-text {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  max-width: 800px;
  line-height: 1.3;
  color: var(--accent-yellow);
}

.writer-badge {
  display: inline-block;
  background: var(--accent-blue);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 1rem;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 900px;
  margin-top: 1rem;
}

.answer-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.answer-card .answer-text {
  font-size: 1.1rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.answer-card .answer-id {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.answer-card.winner {
  border-color: var(--accent-green);
  background: rgba(46, 204, 113, 0.1);
}

/* ─── Leaderboard ────────────────────────────────────────────── */

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
}

.leaderboard-rank {
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 24px;
}

.leaderboard-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.leaderboard-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-weight: 700;
  color: var(--accent-yellow);
}

/* ─── Player View (Mobile) ───────────────────────────────────── */

.player-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 1rem;
  padding-top: calc(var(--timer-height) + 0.5rem);
  overflow: auto;
}

.player-header {
  text-align: center;
  margin-bottom: 1rem;
}

.player-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.player-instruction {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.write-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 100%;
}

.write-area textarea {
  height: 70px;
  min-height: 70px;
  background: var(--bg-secondary);
  border: 2px solid var(--bg-card);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 8px;
  font-size: 1.2rem;
  resize: none;
  outline: none;
  font-family: inherit;
}

.write-area .primary {
  flex-shrink: 0;
}

.write-area textarea:focus {
  border-color: var(--accent-yellow);
}

.vote-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.vote-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.1s;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.3;
}

.vote-card:active {
  transform: scale(0.98);
}

.vote-card.selected {
  border-color: var(--accent-yellow);
  background: rgba(245, 197, 24, 0.1);
}

.vote-card .card-number {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

/* ─── Results ─────────────────────────────────────────────────── */

.result-winner {
  text-align: center;
}

.result-winner .winner-name {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 0.5rem 0;
}

.result-winner .winner-answer {
  font-size: 1.5rem;
  color: var(--accent-yellow);
  margin-bottom: 1rem;
}

.result-winner .winner-points {
  font-size: 1.2rem;
  color: var(--accent-green);
  font-weight: 700;
}

.keyword-reaction {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(155, 89, 182, 0.15);
  border-radius: 8px;
  border: 1px solid var(--accent-purple);
  text-align: center;
}

.keyword-reaction .reaction-text {
  font-style: italic;
  color: var(--accent-purple);
  font-size: 1rem;
}

.sfx-cue {
  display: inline-block;
  background: var(--accent-red);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin: 0.2rem;
}

/* ─── Game Over ───────────────────────────────────────────────── */

.game-over-title {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent-yellow);
  margin-bottom: 1rem;
}

.final-standings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 500px;
  width: 100%;
}

.final-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.final-rank {
  font-size: 1.5rem;
  font-weight: 900;
  min-width: 40px;
  text-align: center;
}

.final-name {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 700;
}

.final-score {
  font-size: 1.2rem;
  color: var(--accent-yellow);
  font-weight: 700;
}

/* ─── Lobby ───────────────────────────────────────────────────── */

.lobby-section {
  text-align: center;
}

.lobby-section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.lobby-players {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border-radius: 20px;
}

.host-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

/* ─── Intro ───────────────────────────────────────────────────── */

.intro-section {
  text-align: center;
  max-width: 700px;
}

.intro-section h1 {
  font-size: 3rem;
  color: var(--accent-yellow);
  margin-bottom: 1rem;
}

.intro-section p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* ─── Waiting ─────────────────────────────────────────────────── */

.waiting-message {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.2rem;
}

.waiting-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-card);
  border-top-color: var(--accent-yellow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive ──────────────────────────────────────────────── */

@media (max-width: 600px) {
  .game-logo { font-size: 2.5rem; }
  .game-code { font-size: 2rem; letter-spacing: 4px; }
  .prompt-text { font-size: 1.5rem; }
  .host-container { flex-direction: column; }
  .sidebar { width: 100%; max-height: 150px; }
  .answer-grid { grid-template-columns: 1fr; }
  .input-group { flex-direction: column; }
}
