/* 9ja Hama Sports — design tokens + shared components, from Figma
   (https://www.figma.com/design/lHqHPkxaCFkwUNM8WlOJ3g/9JA-HAMA--Copy-) */

:root {
  --bg: #040712;
  --surface: #060a12;
  --card: #080b14;
  --card-tint: rgba(255, 255, 255, 0.03);
  --border: rgba(187, 187, 187, 0.2);
  --border-soft: rgba(187, 187, 187, 0.13);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.64);
  --text-faint: rgba(255, 255, 255, 0.47);
  --primary: #a1c71a;
  --primary-tint: rgba(161, 199, 26, 0.09);
  --danger: #ef4444;
  --danger-tint: rgba(239, 68, 68, 0.09);
  --avatar-bg: #108225;
  --card-elevated: #111827;
  --radius: 10px;
  --radius-lg: 13px;
  --radius-pill: 26px;
  --font-display: "Anton", sans-serif;
  --font-body: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0;
}

p { margin: 0; }

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

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navigation ─────────────────────────────────────────── */

.nav {
  position: relative;
  background: var(--surface);
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.22);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__logo img { height: 44px; display: block; }

/* Hamburger menu — hidden on desktop entirely; on mobile it's a native
   <details>/<summary> disclosure, so no JS either way. Chrome collapses a
   closed <details>'s content box to zero width regardless of `display`
   overrides on its children, so rather than fight that, the nav links are
   rendered twice (see _nav_links.html): a desktop copy outside <details>,
   and a mobile copy inside it that uses the browser's own unmodified
   open/close behavior. */
.nav__menu { display: none; }

.nav__toggle {
  display: none;
  list-style: none;
  cursor: pointer;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}
.nav__toggle::-webkit-details-marker { display: none; }
.nav__toggle::marker { content: ""; }

.nav__links {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  font-size: 15px;
}

.nav__links a { color: var(--text); }
.nav__links a.is-active {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.nav__right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.nav__bell { font-size: 20px; color: var(--text); }

/* ── Footer ─────────────────────────────────────────────── */

.footer {
  background: var(--surface);
  padding: 50px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.footer img { height: 44px; }

.footer__tagline {
  color: var(--text-muted);
  max-width: 500px;
}

.footer__social { display: flex; gap: 20px; font-size: 20px; }

.footer__links {
  display: flex;
  gap: 40px;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
}

.footer__rule {
  width: 100%;
  max-width: 1280px;
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 0;
}

.footer__copy { color: var(--text); font-size: 14px; }

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 16px;
  border: none;
  cursor: pointer;
  text-align: center;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid rgba(255, 255, 255, 0.2); }
.btn-muted { background: #5f605b; color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Page header ────────────────────────────────────────── */

.page-header { padding: 48px 0 8px; }
.page-header h1 { font-size: 32px; color: var(--text); margin-bottom: 6px; }
.page-header p { color: var(--text-muted); }

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  margin-bottom: 16px;
}

/* ── Hero (home) ────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 90px 24px 60px;
  text-align: center;
  background: #141414 url("../img/hero-bg.png") center top / cover no-repeat;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20, 20, 20, 0) 0%, rgba(20, 20, 20, 0.69) 57%, #141414 100%);
}

.hero__team-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.hero__inner { position: relative; max-width: 900px; margin: 0 auto; }
.hero h1 { font-size: 42px; color: #fff; line-height: 1.15; }
.hero p.lead { color: #fff; max-width: 640px; margin: 20px auto; font-size: 18px; font-weight: 500; }

.hero__cta { display: flex; gap: 14px; justify-content: center; margin: 30px 0; flex-wrap: wrap; }
.hero__cta .btn { width: 220px; }

.hero__stats {
  display: flex;
  gap: 48px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.hero__stat { text-align: center; }
.hero__stat strong { display: block; font-family: var(--font-display); font-size: 24px; color: #fff; }
.hero__stat span { color: rgba(255, 255, 255, 0.5); font-size: 15px; }

/* ── How it works ───────────────────────────────────────── */

.how-it-works { padding: 60px 24px; }
.how-it-works h2 { font-size: 32px; margin-bottom: 6px; }
.how-it-works > .wrap > p { color: var(--text-muted); margin-bottom: 32px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; max-width: 640px; }

.step {
  display: flex;
  align-items: center;
  gap: 20px;
  border: 0.4px solid var(--border-soft);
  border-radius: 5px;
  padding: 20px 24px;
}

.step__icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: rgba(139, 145, 140, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--primary);
}

.step h3 { font-size: 20px; margin-bottom: 4px; }
.step p { color: var(--text-muted); font-size: 15px; }

/* ── Category cards ─────────────────────────────────────── */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0 32px;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 20px;
  border: 0.4px solid var(--border-soft);
  border-radius: 5px;
  padding: 20px 24px;
  background: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.category-card:hover { border-color: var(--primary); }

.category-card__icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: rgba(139, 145, 140, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--primary);
}

.category-card h3 { font-size: 20px; font-family: var(--font-body); font-weight: 400; margin-bottom: 4px; }
.category-card p { color: var(--text-muted); font-size: 15px; }

/* ── Question / play card ───────────────────────────────── */

.qcard {
  background: var(--card);
  border: 0.4px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 24px 0;
}

.qcard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 20px;
}

.qcard__top h2 { font-size: 20px; }

.live-badge { color: var(--danger); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.live-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }

.qcard__question { font-size: 22px; margin-bottom: 20px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }

.choice {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-tint);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 20px;
  cursor: pointer;
}

.choice input { display: none; }

.choice__letter {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.choice:has(input:checked) { border-color: var(--primary); }
.choice:has(input:checked) .choice__letter { border-color: var(--primary); }

.choice--correct { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.choice--correct .choice__letter { border-color: var(--primary); color: var(--primary); }
.choice--incorrect { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.choice--incorrect .choice__letter { border-color: var(--danger); color: var(--danger); }

.qcard__bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; gap: 16px; }

.progress { display: flex; align-items: center; gap: 8px; }
.progress__track { width: 110px; height: 5px; border-radius: 10px; background: #fff; overflow: hidden; }
.progress__fill { height: 100%; background: var(--primary); }
.progress__time { font-family: var(--font-display); color: var(--primary); font-size: 18px; }

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

.results-head { text-align: center; padding: 40px 0 20px; }
.results-head .trophy { font-size: 44px; }
.results-head h1 { font-size: 32px; margin: 12px 0 6px; }
.results-head .meta { color: var(--text-muted); margin-bottom: 14px; }
.results-head .points strong { font-family: var(--font-display); color: var(--primary); font-size: 28px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  max-width: 620px;
  margin: 24px auto;
}

.stat-tile {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

.stat-tile .icon { color: var(--primary); font-size: 22px; margin-bottom: 8px; display: block; }
.stat-tile strong { display: block; font-family: var(--font-display); font-size: 20px; }
.stat-tile span { color: var(--text-muted); font-size: 15px; }

.panel {
  background: var(--card);
  border: 0.4px solid var(--border-soft);
  border-radius: var(--radius-lg);
  max-width: 700px;
  margin: 20px auto;
  padding: 20px 24px;
}

.panel h2 { font-size: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); margin-bottom: 16px; }

.rank-row { display: flex; justify-content: space-around; text-align: center; gap: 16px; flex-wrap: wrap; }
.rank-row div span { display: block; color: var(--text-muted); font-size: 15px; margin-bottom: 4px; }
.rank-row div strong { font-family: var(--font-display); font-size: 22px; }

.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.review-row {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 0.5px solid;
}

.review-row--correct { background: rgba(243, 255, 199, 0.03); border-color: rgba(242, 251, 209, 0.38); color: #e9ff99; }
.review-row--incorrect { background: rgba(255, 190, 190, 0.09); border-color: #ffbbbb; color: #ffa3a3; }

.review-row__num {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid currentColor;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.results-actions { max-width: 700px; margin: 24px auto; display: grid; gap: 14px; }
.results-actions .btn-row { display: flex; gap: 16px; flex-wrap: wrap; }
.results-actions .btn-row .btn { flex: 1; min-width: 200px; }

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

.lb-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin: 20px 0 28px;
}

.lb-toggle a {
  padding: 12px 32px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}

.lb-toggle a.is-active { background: var(--primary); color: #fff; }

.lb-table { background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }

.lb-head, .lb-row {
  display: grid;
  grid-template-columns: 70px 1fr 100px;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
}

.lb-head { font-weight: 600; padding-bottom: 12px; }

.lb-row { margin: 8px; border: 1px solid var(--border-soft); border-radius: 4px; background: var(--card-tint); }
.lb-row--you { color: var(--text); }
.lb-row__rank { color: var(--text-faint); font-size: 16px; }
.lb-row__rank.medal { font-size: 20px; }

.lb-row__name { display: flex; align-items: center; gap: 14px; }
.lb-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--avatar-bg); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; text-transform: uppercase; }

.lb-row__score { text-align: right; }
.lb-row__score strong { display: block; }
.lb-row__score span { color: var(--text-muted); font-size: 13px; }

.empty-note { color: var(--text-muted); padding: 24px; text-align: center; }

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

@media (max-width: 720px) {
  .choices { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .hero__stats { gap: 24px; }
  .lb-head, .lb-row { grid-template-columns: 40px 1fr 80px; padding: 12px; }
  .nav { padding: 14px 16px; }
  .nav__links--desktop { display: none; }
  .nav__menu { display: block; }
  .nav__toggle { display: block; }
  /* Native open/close, unmodified — closed by default, no override needed. */
  .nav__menu[open] .nav__links--mobile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 16px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    padding: 12px 20px 20px;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.22);
    z-index: 30;
  }
  .nav__links--mobile a { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
  .nav__links--mobile a:last-child { border-bottom: none; }
}

/* ── Auth (phone login) ─────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  position: relative;
  background: var(--card-elevated);
  border: 1px solid rgba(0, 0, 0, 0.17);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 486px;
  padding: 40px 32px;
  text-align: center;
}

.auth-card__logo { height: 60px; margin-bottom: 24px; }

.auth-card h1 { font-size: 18px; margin-bottom: 10px; }
.auth-card__lead { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 24px; }
.auth-card__error { color: var(--danger); font-size: 14px; margin-bottom: 16px; }

.auth-field {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(250, 250, 250, 0.13);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  margin-bottom: 16px;
}

.auth-field::placeholder { color: var(--text-muted); }

.auth-card .btn { width: 100%; }
.auth-card__link { display: inline-block; margin-top: 16px; color: var(--text-muted); font-size: 14px; }

/* Cosmetic-only loading overlay — a no-JS client never sees it (see the
   inline script in phone_login.html), the real state renders immediately. */
.auth-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--card-elevated);
  border-radius: var(--radius-lg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  text-align: center;
}

.is-detecting .auth-overlay { display: flex; }

.spinner {
  width: 64px;
  height: 64px;
  margin: 24px 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

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