/* ===== Apex Loop — zero-dependency static racing site styles ===== */

:root {
  --bg: #08090d;
  --bg-soft: #0e1119;
  --panel: #141823;
  --panel-2: #1b2130;
  --line: #2b3243;
  --text: #f2f4f8;
  --muted: #98a2b5;
  --lime: #ccff00;
  --red: #ff2a3c;
  --cyan: #5ce1ff;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1000px 560px at 10% -10%, rgba(204, 255, 0, 0.07), transparent 60%),
    radial-gradient(900px 520px at 92% 6%, rgba(255, 42, 60, 0.07), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap { width: min(1080px, calc(100% - 40px)); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--lime);
  color: #0a0b0e;
  font-weight: 800;
  border-radius: 8px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 9, 13, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--lime), var(--red));
  font-size: 1.1rem;
}
.brand__name small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.site-nav { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.site-nav a:hover { color: var(--lime); text-decoration: none; }
.header-badge {
  margin: 0;
  padding: 5px 11px;
  border: 1px solid rgba(204, 255, 0, 0.4);
  border-radius: 999px;
  color: var(--lime);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.header-badge span { font-size: 0.6rem; vertical-align: 1px; }

/* ===== Hero ===== */
.hero { padding: 76px 0 54px; text-align: center; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 12px; color: var(--lime); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.18em; }
.hero h1 { margin: 0 0 18px; font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.12; letter-spacing: -0.02em; }
.hero h1 span {
  display: block;
  background: linear-gradient(100deg, var(--lime), var(--cyan) 55%, var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 0.62em;
  letter-spacing: 0.08em;
}
.lede { max-width: 760px; margin: 0 auto 30px; color: #cbd2df; font-size: clamp(1rem, 2vw, 1.12rem); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 720px; margin: 0 auto 30px; }
.fact {
  padding: 16px 8px;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.fact strong { display: block; font-size: 1.7rem; color: var(--lime); line-height: 1.2; }
.fact span { font-size: 0.8rem; color: var(--muted); }
.cta-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; border-color: var(--lime); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--lime); border-color: transparent; color: #0a0b0e; }
.btn--ghost { background: transparent; }
.btn--small { padding: 7px 13px; font-size: 0.86rem; }

/* ===== Sections ===== */
.section { padding: 56px 0; border-bottom: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 28px; }
.section-index { margin: 0 0 6px; color: var(--red); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.section-head h2 { margin: 0 0 10px; font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.25; }
.section-desc { margin: 0; color: var(--muted); }

/* ===== Race shell ===== */
.race-shell {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.hud__item { padding: 12px 14px; background: var(--bg-soft); }
.hud__item span { display: block; color: var(--muted); font-size: 0.74rem; letter-spacing: 0.05em; }
.hud__item strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--lime); }

.canvas-wrap { position: relative; background: #0a0c12; }
#race-canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(8, 9, 13, 0.82);
  backdrop-filter: blur(4px);
}
.overlay[hidden] { display: none; }
.overlay__kicker { margin: 0; color: var(--red); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.22em; }
.overlay h3 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.1; }
.overlay p { max-width: 520px; margin: 0; color: #cbd2df; }

.touch-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.touch-mid { display: flex; flex-direction: column; gap: 8px; }
.touch-btn {
  width: 62px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--lime);
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}
.touch-btn:active, .touch-btn.is-down { background: var(--lime); color: #0a0b0e; }

.race-actions { display: flex; align-items: center; gap: 12px; padding: 14px 18px 0; flex-wrap: wrap; }
.key-hint { color: var(--muted); font-size: 0.8rem; }
.game-status {
  min-height: 1.7em;
  margin: 14px 18px 18px;
  padding: 9px 13px;
  border-left: 3px solid var(--lime);
  background: rgba(204, 255, 0, 0.07);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
}

/* ===== Steps / table / FAQ ===== */
.steps { margin: 0; padding-left: 22px; color: var(--muted); }
.steps li { margin-bottom: 10px; }
.steps strong { color: var(--text); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.spec-table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 0.93rem; }
.spec-table caption { padding: 12px 16px; text-align: left; color: var(--muted); font-size: 0.85rem; }
.spec-table th, .spec-table td { padding: 11px 16px; border-top: 1px solid var(--line); text-align: left; }
.spec-table thead th { background: var(--panel-2); color: var(--lime); font-size: 0.82rem; letter-spacing: 0.06em; }
.spec-table tbody th { color: var(--text); font-weight: 700; white-space: nowrap; }
.spec-table tbody td { color: var(--muted); }

.faq-list { display: grid; gap: 10px; }
.faq-list details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 18px; }
.faq-list summary { padding: 14px 0; cursor: pointer; font-weight: 700; }
.faq-list p { margin: 0 0 16px; color: var(--muted); }
.source-list { padding-left: 20px; color: var(--muted); }
.source-list li { margin-bottom: 10px; }
.source-list strong { color: var(--text); }

/* ===== Footer ===== */
.site-footer { padding: 30px 0 46px; color: var(--muted); font-size: 0.88rem; }
.footer-inner p { margin: 4px 0; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; padding-block: 10px; }
  .site-nav { order: 3; width: 100%; margin-left: 0; gap: 14px; }
  .header-badge { margin-left: auto; }
  .hero { padding: 54px 0 40px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 42px 0; }
  .hud { grid-template-columns: repeat(3, 1fr); }
  .touch-controls { display: flex; }
  .race-actions { padding: 14px 12px 0; }
  .game-status { margin: 12px; }
}

@media (max-width: 520px) {
  .header-badge { display: none; }
  .hud__item { padding: 9px 10px; }
  .hud__item strong { font-size: 1rem; }
  .touch-btn { width: 56px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
