:root {
  color-scheme: dark;
  --bg: #071018;
  --bg-2: #0d1622;
  --panel: rgba(10, 18, 30, 0.78);
  --panel-strong: rgba(15, 24, 39, 0.94);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f7fb;
  --muted: #a8b7c7;
  --accent: #f7b731;
  --accent-2: #7bdff2;
  --accent-3: #9ae6b4;
  --danger: #ff6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --maxw: 1180px;
}

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

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(123, 223, 242, 0.16), transparent 26%),
    radial-gradient(circle at 85% 15%, rgba(247, 183, 49, 0.18), transparent 22%),
    radial-gradient(circle at bottom right, rgba(154, 230, 180, 0.10), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 90%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.65;
  pointer-events: none;
  z-index: -1;
}

.ambient-one {
  width: 22rem;
  height: 22rem;
  left: -7rem;
  top: 6rem;
  background: rgba(123, 223, 242, 0.16);
}

.ambient-two {
  width: 26rem;
  height: 26rem;
  right: -8rem;
  bottom: 1rem;
  background: rgba(247, 183, 49, 0.12);
}

.shell {
  width: min(var(--maxw), calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.narrow {
  width: min(860px, calc(100% - 28px));
}

.card {
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.9), rgba(10, 16, 27, 0.86));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.simple-card {
  display: grid;
  gap: 16px;
  padding: clamp(22px, 4vw, 34px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 22px;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #ffd166);
  color: #111;
  box-shadow: 0 10px 26px rgba(247, 183, 49, 0.24);
}

.site-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.nav-link {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.nav-link.accent {
  color: #0d1622;
  background: var(--accent);
  border-color: transparent;
}

.select,
input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.select:focus,
input:focus {
  border-color: rgba(123, 223, 242, 0.75);
  box-shadow: 0 0 0 4px rgba(123, 223, 242, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.select option {
  color: #0d1622;
}

.select-inline {
  max-width: 170px;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  user-select: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.lang-switch:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.lang-switch:focus-within {
  border-color: rgba(123, 223, 242, 0.75);
  box-shadow: 0 0 0 4px rgba(123, 223, 242, 0.12);
}

.lang-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.lang-switch-track {
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(247, 183, 49, 0.22), rgba(123, 223, 242, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.lang-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #dbe6f3);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

.lang-switch.is-fr .lang-switch-thumb {
  transform: translateX(26px);
}

.lang-switch-text {
  min-width: 1.6rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--muted);
  transition: color 0.16s ease;
}

.lang-switch.is-en .lang-switch-text-en,
.lang-switch.is-fr .lang-switch-text-fr {
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn,
.tab,
.preview-choice,
.text-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.btn:hover,
.tab:hover,
.preview-choice:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #ffd166);
  color: #10151d;
  box-shadow: 0 14px 30px rgba(247, 183, 49, 0.18);
}

.secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.text-button {
  background: transparent;
  color: var(--accent-2);
  padding-inline: 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.8rem;
  color: var(--accent);
}

h1 {
  margin: 0;
  line-height: 1.03;
  letter-spacing: -0.04em;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
}

.lead {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
  max-width: 60ch;
}

.muted,
.message,
.field-hint,
.preview-caption,
.side-copy p,
.switch-note {
  color: var(--muted);
}

.hero-grid,
.auth-grid,
.game-grid,
.profile-grid,
.leaderboard-grid {
  display: grid;
  gap: 20px;
}

.hero-grid {
  grid-template-columns: 1.35fr 0.9fr;
  align-items: stretch;
}

.hero,
.preview,
.auth-panel,
.side-panel,
.leaderboard-hero,
.table-card,
.profile-panel,
.form-card,
.game-main,
.hero-card,
.auth-card,
.profile-card,
.leaderboard-card,
.game-card {
  padding: 28px;
}

.hero {
  display: grid;
  gap: 18px;
  min-height: 78vh;
  align-content: center;
}

.hero-copy {
  max-width: 58ch;
}

.game-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.scoreline {
  display: inline-flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.scoreline strong {
  color: var(--text);
  margin-left: 6px;
  font-size: 1.05rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.mini-stat {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-stat-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  margin-bottom: 12px;
  background: rgba(123, 223, 242, 0.14);
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 800;
}

.mini-stat strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.mini-stat p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(154, 230, 180, 0.12);
  border: 1px solid rgba(154, 230, 180, 0.2);
  color: #dfffea;
  font-size: 0.95rem;
  font-weight: 700;
}

.preview {
  display: grid;
  gap: 18px;
  align-content: center;
}

.preview-top {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(247, 183, 49, 0.12);
  color: #ffd166;
  font-size: 0.88rem;
  font-weight: 700;
}

.pill.subtle {
  background: rgba(123, 223, 242, 0.1);
  color: var(--accent-2);
}

.preview-quote {
  margin: 0;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 1.05rem;
}

.preview-quote p {
  margin: 0;
}

.preview-options {
  display: grid;
  gap: 10px;
}

.preview-choice {
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-caption {
  margin: 0;
  font-size: 0.96rem;
}

.auth-grid {
  grid-template-columns: 1fr 1.05fr;
  align-items: start;
}

.auth-panel {
  min-height: 100%;
  display: grid;
  gap: 18px;
}

.auth-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.benefit {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(123, 223, 242, 0.1);
  border: 1px solid rgba(123, 223, 242, 0.12);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.92rem;
}

.form-card {
  display: grid;
  gap: 18px;
}

.tabs {
  display: inline-flex;
  gap: 10px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tab {
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: rgba(123, 223, 242, 0.15);
  color: var(--text);
  border: 1px solid rgba(123, 223, 242, 0.22);
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

input::placeholder {
  color: rgba(168, 183, 199, 0.7);
}

.field-hint {
  margin: -4px 0 0;
  font-size: 0.92rem;
}

.switch-note {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.question-card {
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.game-grid {
  grid-template-columns: 1.1fr 0.48fr;
  align-items: start;
}

.game-main {
  display: grid;
  gap: 18px;
}

.game-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
  line-height: 1;
}

.review {
  margin: 18px 0 0;
  padding: 22px;
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  font-size: 1.1rem;
  white-space: pre-wrap;
}

.game-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin-top: 6px;
}

.choices {
  display: grid;
  gap: 12px;
}

.choices .btn {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  min-height: 4.3rem;
}

.choice-option {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}

.choice-index {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-2);
  font-size: 0.9rem;
}

.choice-text {
  flex: 1;
}

.choice-year {
  color: var(--muted);
  font-size: 0.95rem;
}

.choice-correct {
  background: rgba(154, 230, 180, 0.92) !important;
  color: #0a0f14 !important;
}

.choice-wrong {
  background: rgba(255, 107, 107, 0.92) !important;
  color: #0a0f14 !important;
}

.result-banner {
  min-height: 1.5em;
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.result-banner[data-state="success"] {
  border-color: rgba(154, 230, 180, 0.32);
  background: rgba(154, 230, 180, 0.08);
  color: #d8ffe4;
}

.result-banner[data-state="error"] {
  border-color: rgba(255, 107, 107, 0.32);
  background: rgba(255, 107, 107, 0.08);
  color: #ffd2d2;
}

.side-panel {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 118px;
}

.side-copy p {
  margin: 0 0 12px;
}

.side-stack {
  display: grid;
  gap: 12px;
}

.trial-banner {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(123, 223, 242, 0.08);
  border: 1px solid rgba(123, 223, 242, 0.16);
  color: var(--accent-2);
  font-weight: 600;
  min-height: 3.2rem;
}

.trial-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.side-item span {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(247, 183, 49, 0.12);
  color: #ffd166;
  font-weight: 800;
}

.profile-grid {
  grid-template-columns: 0.95fr 1.05fr;
  align-items: start;
}

.profile-panel {
  display: grid;
  gap: 16px;
}

.profile-box {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.form-divider {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-actions {
  justify-content: flex-start;
}

.leaderboard-grid {
  grid-template-columns: 0.95fr 1.05fr;
  align-items: start;
}

.leaderboard-hero {
  display: grid;
  gap: 12px;
}

.leaderboard-gate {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.table thead th {
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.table tbody tr:first-child td {
  color: #fff6d8;
}

.message {
  margin: 0;
  min-height: 1.4em;
}

.hidden {
  display: none !important;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.game-actions {
  justify-content: flex-start;
}

.game-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1080px) {
  .hero-grid,
  .auth-grid,
  .game-grid,
  .profile-grid,
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(var(--maxw), calc(100% - 18px));
    padding-top: 14px;
  }

  .site-header {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .select-inline {
    max-width: none;
  }

  .hero,
  .preview,
  .auth-panel,
  .side-panel,
  .leaderboard-hero,
  .table-card,
  .profile-panel,
  .form-card,
  .game-main {
    padding: 20px;
  }

  .hero-stats,
  .game-summary {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .text-button {
    width: 100%;
  }

  .switch-note {
    flex-direction: column;
    align-items: flex-start;
  }
}
