:root {
  --bg: #05080f;
  --panel: #0b1222;
  --card: #0f1b30;
  --card-soft: #0a1324;
  --accent: #ff9151;
  --accent-2: #ff6f61;
  --text: #e8edf7;
  --muted: #c2cee3;
  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.04);
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --correct: #5be0a2;
  --wrong: #ef5d5d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 720px at 12% -10%, rgba(142, 243, 197, 0.12), transparent),
    radial-gradient(1000px 640px at 88% 10%, rgba(246, 196, 82, 0.14), transparent),
    linear-gradient(160deg, #05080f 0%, #07101d 45%, #05080f 100%);
  color: var(--text);
  font-family: "Space Grotesk", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 10% 8%;
  background: radial-gradient(500px 240px at 70% 30%, rgba(255, 255, 255, 0.04), transparent);
  filter: blur(50px);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }

.site-header {
  width: 100%;
  max-width: 1100px;
  margin: 20px auto 6px;
  padding: 16px 20px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)) , var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(130%);
  position: relative;
  z-index: 2;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1f0f08;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 12px 34px rgba(255, 145, 81, 0.32);
}

.brand-copy h1 { font-size: 28px; }
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}
.tagline { color: var(--muted); font-size: 14px; margin-top: 6px; }

.header-actions { display: flex; gap: 8px; }

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 36px;
  padding: 18px 20px 52px;
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  backdrop-filter: blur(10px) saturate(130%);
}

.card::before {
  content: "";
  position: absolute;
  inset: -10% auto auto -30%;
  width: 320px;
  height: 320px;
  background: radial-gradient(240px at center, rgba(142, 243, 197, 0.14), transparent);
  z-index: 0;
}

.card > * { position: relative; z-index: 1; }
.card:hover { transform: translateY(-3px); box-shadow: 0 22px 64px rgba(0, 0, 0, 0.55); border-color: rgba(255, 255, 255, 0.14); }

.intro {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.card-top {
  display: flex;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--accent);
  border: 1px solid var(--border);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.pill.ambient {
  background: linear-gradient(120deg, rgba(255, 145, 81, 0.16), rgba(255, 111, 97, 0.14));
  color: #24120a;
  font-weight: 700;
}

.intro-head { margin: 6px 0 10px; }
.intro h2 { margin: 6px 0 4px; font-size: 30px; font-weight: 800; }
.intro-text { margin: 6px 0 12px; color: var(--muted); }
.intro-actions { margin-top: 16px; }

.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 10px 0 18px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}

.meta-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 145, 81, 0.14);
  display: grid;
  place-items: center;
  font-size: 15px;
}

.meta-copy { display: grid; gap: 2px; }
.meta-label { color: var(--accent); font-weight: 700; font-size: 13px; }
.meta-text { color: #e2e8f5; font-size: 13px; opacity: 0.82; }

.label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.input-prefix {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.3px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-group:focus-within {
  border-color: rgba(142, 243, 197, 0.6);
  box-shadow: 0 0 0 4px rgba(142, 243, 197, 0.12);
}

.input:focus {
  outline: none;
}

.error { color: var(--wrong); margin-top: 6px; font-size: 14px; }
.small { font-size: 13px; }

.game, .result {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.progress-text {
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.badge {
  border: 1px solid var(--border);
  background: var(--card-soft);
  border-radius: 12px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.timer {
  color: var(--text);
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  background: linear-gradient(120deg, rgba(255, 145, 81, 0.12), rgba(255, 111, 97, 0.1));
  border-color: rgba(255, 145, 81, 0.3);
  min-width: 200px;
}

.timer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timer-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.timer-bar-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 1px rgba(255, 145, 81, 0.2);
  transition: width 120ms linear, background 200ms ease;
}

.timer-low { color: var(--wrong); }
.timer-low .timer-bar-fill {
  background: linear-gradient(90deg, var(--wrong), #ff8a7a);
}
.timer-label { font-weight: 600; color: var(--muted); }
.player, .score { color: var(--text); }

.card .question { font-size: clamp(20px, 2vw, 24px); line-height: 1.4; margin-bottom: 18px; }
.choices { display: grid; gap: 12px; }

.btn, .choices button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.3;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease, box-shadow 160ms ease, color 120ms ease;
}

.choices button { text-align: left; background: var(--card-soft); }
.choices button:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.16); }
.choices button:active { transform: translateY(1px); }
.choices button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(142, 243, 197, 0.14);
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  color: #041020;
  box-shadow: 0 12px 34px rgba(255, 145, 81, 0.28);
  font-weight: 800;
}

.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 18px 44px rgba(255, 145, 81, 0.34); }
.btn.primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  box-shadow: 0 6px 24px rgba(255, 255, 255, 0.04);
}
.btn.ghost:hover { border-color: rgba(255, 255, 255, 0.34); box-shadow: 0 10px 26px rgba(255, 145, 81, 0.18); }
.full { width: 100%; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

.controls { display: flex; justify-content: flex-end; margin-top: 16px; }

.correct { background: rgba(91, 224, 162, 0.2) !important; border-color: rgba(91, 224, 162, 0.7) !important; color: #0b1b13; }
.wrong { background: rgba(239, 93, 93, 0.2) !important; border-color: rgba(239, 93, 93, 0.7) !important; color: #1e0c0c; }

.disabled { opacity: 0.78; cursor: default; }

.result {
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.final-score { font-size: 36px; margin: 12px 0 18px; }

.leaderboard {
  text-align: left;
  margin: 16px auto 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-soft);
  max-width: 460px;
}

.leaderboard h3 { margin: 0 0 10px; }
.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.muted { color: var(--muted); }

.leaderboard-card {
  width: 100%;
  max-width: 480px;
  margin-bottom: 10px;
}

.leaderboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill.season {
  background: linear-gradient(120deg, rgba(255, 145, 81, 0.16), rgba(255, 215, 128, 0.16));
  color: #24120a;
  font-weight: 700;
}

.pill.season-closed {
  background: var(--glass);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.12);
}

.leaderboard ol,
.leaderboard-card ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.leaderboard li,
.leaderboard-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 12px;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard .name,
.leaderboard-card .name {
  color: var(--text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.leaderboard .position,
.leaderboard-card .position {
  color: var(--muted);
  font-weight: 700;
  min-width: 26px;
  text-align: right;
}

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

.leaderboard a,
.leaderboard-card a {
  color: inherit;
  text-decoration: none;
}

.leaderboard a:hover,
.leaderboard-card a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.leaderboard .podium-icon,
.leaderboard-card .podium-icon {
  font-size: 18px;
}

.leaderboard li.podium,
.leaderboard-card li.podium {
  border-color: rgba(255, 145, 81, 0.4);
  box-shadow: 0 12px 36px rgba(255, 145, 81, 0.1);
}

.leaderboard li.rank-1,
.leaderboard-card li.rank-1 {
  background: linear-gradient(120deg, rgba(255, 215, 128, 0.2), rgba(255, 145, 81, 0.12));
}

.leaderboard li.rank-2,
.leaderboard-card li.rank-2 {
  background: linear-gradient(120deg, rgba(193, 212, 255, 0.2), rgba(142, 186, 255, 0.12));
}

.leaderboard li.rank-3,
.leaderboard-card li.rank-3 {
  background: linear-gradient(120deg, rgba(255, 190, 140, 0.2), rgba(255, 140, 106, 0.12));
}

.hidden { display: none; }

.site-footer {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 8px 20px 0;
  display: flex;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-copy h1 { font-size: 24px; }
  .container { padding: 10px 16px 32px; }
  .card { padding: 20px; }
}
