/* ═══════════════════════════════════════════
   Game Closet — Core Styles
   ═══════════════════════════════════════════ */
:root {
  --bg:        #0f0e17;
  --surface:   #1a1a2e;
  --surface2:  #232340;
  --primary:   #ff6e6e;
  --secondary: #67e8f9;
  --accent:    #c084fc;
  --text:      #e8e8f0;
  --text-dim:  #8888a8;
  --success:   #4ade80;
  --warning:   #fbbf24;
  --danger:    #f87171;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

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

html, body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Typography ── */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.3rem, 3.5vw, 2rem); }
h3 { font-size: clamp(1rem, 2.5vw, 1.4rem); }

.glow { text-shadow: 0 0 20px rgba(255,110,110,0.5); }

/* ── Layout ── */
.container {
  width: 100%;
  max-width: 900px;
  padding: 1.5rem;
}

.container.wide { max-width: 1200px; }

.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100dvh;
  gap: 1.5rem;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.06);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--bg);
}

.btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary); }
.btn-secondary { background: var(--secondary); }
.btn-accent    { background: var(--accent); }
.btn-ghost     { background: transparent; border: 2px solid var(--text-dim); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-lg { padding: 1rem 2.5rem; font-size: 1.2rem; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Inputs ── */
input[type="text"], input[type="number"], textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--surface2);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 100px; }

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ── Logo / Header ── */
.logo {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-icon { font-size: 3rem; margin-bottom: 0.5rem; display: block; }

.subtitle {
  color: var(--text-dim);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  max-width: 500px;
  line-height: 1.5;
}

/* ── Timer ── */
.timer-bar {
  width: 100%;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0;
}

.timer-bar-fill {
  height: 100%;
  background: var(--secondary);
  border-radius: 3px;
  transition: width 1s linear, background 0.3s;
}

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

.timer-text {
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--secondary);
}

.timer-text.warning { color: var(--warning); }
.timer-text.danger  { color: var(--danger); }

/* ── Player list / chips ── */
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--surface2);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}

.player-chip .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 1rem 0;
}

/* ── Answer cards ── */
.answer-card {
  background: var(--surface2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.answer-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.answer-card.selected { border-color: var(--primary); background: rgba(255,110,110,0.1); }
.answer-card.correct  { border-color: var(--success); background: rgba(74,222,128,0.1); }
.answer-card.wrong    { border-color: var(--danger); opacity: 0.7; }

.answer-card .vote-count {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ── Leaderboard ── */
.leaderboard { width: 100%; }
.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--surface2);
  gap: 1rem;
}

.leaderboard-row .rank {
  font-size: 1.4rem;
  font-weight: 900;
  min-width: 2rem;
  text-align: center;
}

.leaderboard-row .rank:nth-child(1) { color: var(--warning); }
.leaderboard-row .name { flex: 1; font-weight: 600; }
.leaderboard-row .score { font-size: 1.3rem; font-weight: 900; color: var(--primary); }
.leaderboard-row .delta { font-size: 0.85rem; color: var(--success); margin-left: 0.5rem; }

/* ── QR code area ── */
.qr-area {
  background: white;
  padding: 1.2rem;
  border-radius: var(--radius);
  display: inline-block;
}

.room-code {
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Word display ── */
.word-display {
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: 900;
  font-style: italic;
  color: var(--accent);
  text-align: center;
  padding: 1rem 0;
}

.definition-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text);
  font-style: italic;
}

/* ── Phases / sections ── */
.phase-section {
  display: none;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.phase-section.active { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.pulse { animation: pulse 2s infinite; }

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success { background: rgba(74,222,128,0.2); color: var(--success); }
.badge-warning { background: rgba(251,191,36,0.2); color: var(--warning); }
.badge-danger  { background: rgba(248,113,113,0.2); color: var(--danger); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .container { padding: 1rem; }
  .card { padding: 1rem; }
  .btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ── Utilities ── */
.gap-sm  { gap: 0.5rem; }
.gap-md  { gap: 1rem; }
.gap-lg  { gap: 1.5rem; }
.mt-1    { margin-top: 0.5rem; }
.mt-2    { margin-top: 1rem; }
.mt-3    { margin-top: 1.5rem; }
.mb-1    { margin-bottom: 0.5rem; }
.mb-2    { margin-bottom: 1rem; }
.text-dim { color: var(--text-dim); }
.text-sm  { font-size: 0.85rem; }
.w-full   { width: 100%; }
.flex-row { display: flex; align-items: center; gap: 0.5rem; }
.hidden   { display: none !important; }
