:root {
  --bg: #030b07;
  --bg-raised: #08170f;
  --bg-panel: #0b1f15;
  --fg: #4dff9f;
  --fg-dim: #2a9966;
  --fg-mute: #1f6b48;
  --fg-bright: #d4ffe7;
  --text: #a9dcbf;
  --live: #ff3b5c;
  --amber: #ffcf4d;
  --border: #17432d;
  --display: "VT323", "Courier New", monospace;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 16px;
  --max: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(77, 255, 159, 0.08), transparent 60%),
    radial-gradient(800px 500px at -10% 40%, rgba(255, 59, 92, 0.04), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.22) 0, rgba(0,0,0,0.22) 1px, transparent 2px, transparent 3px);
  mix-blend-mode: multiply;
}

a { color: var(--fg-bright); }
h1, h2, h3, p { margin: 0; }
em { color: var(--amber); font-style: normal; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter) 10px;
  background: rgba(3, 11, 7, 0.86);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem; letter-spacing: 0.08em;
}
.bar-mark { font-family: var(--display); font-size: 1.45rem; letter-spacing: 0.12em; color: var(--fg); text-decoration: none; text-shadow: 0 0 10px rgba(77,255,159,0.5); line-height: 1; }
.bar-live { display: flex; align-items: center; gap: 6px; color: var(--live); font-weight: 600; }
.bar-season { color: var(--fg-dim); font-weight: 400; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 10px var(--live); animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.ticker { margin-left: auto; display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.ticker-label { color: var(--fg-dim); }
.ticker-value { color: var(--amber); font-weight: 600; }
.ticker-delta { min-width: 4.5em; text-align: right; }
.ticker-delta.up { color: var(--fg); }
.ticker-delta.down { color: var(--live); }

@media (max-width: 520px) {
  .bar-season { display: none; }
  .bar-mark { font-size: 1.2rem; }
  .ticker-delta { display: none; }
}

/* ---------- Layout ---------- */
main > section { max-width: var(--max); margin: 0 auto; padding: 72px var(--gutter); }
@media (min-width: 900px) { main > section { padding: 110px 32px; } }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 32px; }
.section-h {
  font-family: var(--display); font-weight: 400; color: var(--fg-bright);
  font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1; letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(77,255,159,0.35);
  margin-bottom: 32px;
}
.section-head .section-h { margin-bottom: 0; }
.section-h span { color: var(--fg-mute); margin-right: 0.35em; }
.section-note { color: var(--fg-dim); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Hero ---------- */
.hero { display: grid; gap: 48px; align-items: center; padding-top: 56px !important; }
@media (min-width: 960px) {
  .hero { grid-template-columns: 1.05fr 1fr; min-height: min(calc(100vh - 60px), 820px); padding-top: 40px !important; }
  .hero-copy { min-width: 0; }
  .hero .wordmark { font-size: min(8.2vw, 7.1rem); }
}

.kicker { color: var(--fg); font-size: 0.82rem; letter-spacing: 0.18em; margin-bottom: 18px; }
.cursor { animation: blink 1s steps(2, start) infinite; }

.wordmark {
  position: relative;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(3.3rem, 18vw, 8.6rem);
  line-height: 0.85; white-space: nowrap; letter-spacing: 0.02em;
  color: var(--fg);
  text-shadow: 0 0 6px rgba(77,255,159,0.9), 0 0 28px rgba(77,255,159,0.45), 0 0 70px rgba(77,255,159,0.2);
  margin-bottom: 26px;
  word-break: break-word;
}
.wordmark::before, .wordmark::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
  text-shadow: none; opacity: 0.8;
}
.wordmark::before { color: var(--live); transform: translate(-2px, 0); clip-path: inset(0 0 0 0); animation: glitch-a 4.5s infinite steps(1); mix-blend-mode: screen; }
.wordmark::after { color: #4de1ff; transform: translate(2px, 0); clip-path: inset(0 0 0 0); animation: glitch-b 4.5s infinite steps(1); mix-blend-mode: screen; }
@keyframes glitch-a {
  0%, 91%, 100% { clip-path: inset(0 0 100% 0); }
  92% { clip-path: inset(12% 0 64% 0); transform: translate(-5px, 0); }
  94% { clip-path: inset(58% 0 20% 0); transform: translate(4px, 0); }
  96% { clip-path: inset(30% 0 48% 0); transform: translate(-3px, 0); }
}
@keyframes glitch-b {
  0%, 91%, 100% { clip-path: inset(0 0 100% 0); }
  93% { clip-path: inset(70% 0 6% 0); transform: translate(5px, 0); }
  95% { clip-path: inset(8% 0 76% 0); transform: translate(-4px, 0); }
}

.lede { font-size: clamp(1.25rem, 3.4vw, 1.6rem); line-height: 1.35; color: var(--fg-bright); font-weight: 600; max-width: 30ch; margin-bottom: 18px; }
.sub { max-width: 52ch; margin-bottom: 30px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.status { color: var(--fg-dim); font-size: 0.74rem; letter-spacing: 0.12em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 24px; border-radius: 4px;
  font-family: var(--mono); font-size: 0.92rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border: 1px solid var(--fg);
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--fg); color: #021108; box-shadow: 0 0 24px rgba(77,255,159,0.35); }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--fg-bright); box-shadow: 0 0 36px rgba(77,255,159,0.55); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover, .btn-ghost:focus-visible { background: rgba(77,255,159,0.1); }
.btn:focus-visible, .shot:focus-visible, .race-rail:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.hero-visual { position: relative; padding-bottom: 12%; }
.screen, .phone { margin: 0; overflow: hidden; border: 1px solid var(--border); background: #000; }
.screen img, .phone img { display: block; width: 100%; height: auto; }
.screen-wide { border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(77,255,159,0.06); }
.phone {
  position: absolute; right: -2%; bottom: 0; width: 42%;
  border-radius: 22px; border: 6px solid #0e2419;
  box-shadow: 0 24px 60px rgba(0,0,0,0.75), 0 0 40px rgba(77,255,159,0.12);
}
.screen::after { content: "● REC"; position: absolute; }
.screen { position: relative; }
.screen::after { top: 10px; right: 12px; font-size: 0.7rem; letter-spacing: 0.15em; color: var(--live); text-shadow: 0 0 8px var(--live); }

/* ---------- Rules ---------- */
.rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); counter-reset: r; }
@media (min-width: 820px) { .rule-list { grid-template-columns: repeat(3, 1fr); } }
.rule-list li { background: var(--bg); padding: 28px 24px 32px; counter-increment: r; }
.rule-list li::before { content: "RULE " counter(r, decimal-leading-zero); display: block; color: var(--fg-mute); font-size: 0.74rem; letter-spacing: 0.18em; margin-bottom: 14px; }
.rule-list h3 { font-family: var(--display); font-weight: 400; font-size: 2.1rem; line-height: 1; color: var(--fg); margin-bottom: 12px; }

/* ---------- Bodies ---------- */
.bodies { padding-right: 0 !important; padding-left: 0 !important; }
.bodies .section-head { padding: 0 var(--gutter); }
@media (min-width: 900px) { .bodies .section-head { padding: 0 32px; } }
.race-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(78vw, 290px); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 4px var(--gutter) 18px; scroll-padding: 0 var(--gutter);
  scrollbar-width: thin; scrollbar-color: var(--fg-mute) transparent;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
@media (min-width: 900px) { .race-rail { padding-left: 32px; padding-right: 32px; scroll-padding: 0 32px; } }
.race {
  scroll-snap-align: start;
  border: 1px solid var(--border); background: var(--bg-raised); border-radius: 4px;
  padding: 20px; display: flex; flex-direction: column; gap: 6px; min-height: 230px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.race:hover { border-color: var(--fg-dim); background: var(--bg-panel); }
.race-cat { color: var(--fg-mute); font-size: 0.7rem; letter-spacing: 0.16em; }
.race h3 { font-family: var(--display); font-weight: 400; font-size: 2rem; line-height: 1; color: var(--fg-bright); text-transform: none; letter-spacing: 0.02em; }
.race-mods { color: var(--fg-dim); font-size: 0.85rem; }
.race-ab { color: var(--fg); font-size: 0.85rem; }
.race-flav { margin-top: auto; color: var(--fg-dim); font-style: italic; font-size: 0.82rem; line-height: 1.5; text-transform: none; letter-spacing: 0; }
.race-more { background: transparent; border-style: dashed; }
.race-more h3 { font-size: 1.6rem; color: var(--fg); }

/* ---------- Systems ---------- */
.sys-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .sys-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .sys-grid { grid-template-columns: repeat(4, 1fr); } }
.sys { border-top: 2px solid var(--fg-dim); background: linear-gradient(var(--bg-raised), transparent); padding: 20px 18px 24px; }
.sys h3 { color: var(--fg-bright); font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.sys p { font-size: 0.9rem; }
.sys-dim { border-top-style: dashed; border-top-color: var(--fg-mute); }
.sys-dim h3 { color: var(--fg-dim); }

/* ---------- Footage ---------- */
.shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .shots { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.shot {
  position: relative; display: block; padding: 0; margin: 0; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #000;
  aspect-ratio: 9 / 14;
}
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.4s ease, filter 0.4s; filter: saturate(0.9); }
.shot:hover img { transform: scale(1.03); filter: saturate(1.1); }
.shot-wide { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.shot-wide img { object-position: center; }
.shot-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 12px 10px; text-align: left;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; color: var(--fg);
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

dialog#lightbox {
  border: 1px solid var(--fg-dim); background: var(--bg); color: var(--text);
  padding: 12px; max-width: min(96vw, 1400px); max-height: 94vh; border-radius: 6px;
}
dialog#lightbox::backdrop { background: rgba(0, 6, 3, 0.88); }
#lb-img { display: block; max-width: 100%; max-height: calc(94vh - 90px); margin: 0 auto; }
#lb-cap { padding: 10px 4px 2px; font-size: 0.85rem; color: var(--fg-dim); }
.lb-close { position: absolute; top: 6px; right: 8px; width: 44px; height: 44px; border: 0; background: rgba(0,0,0,0.6); color: var(--fg); font-size: 1.6rem; cursor: pointer; border-radius: 4px; }

/* ---------- Join ---------- */
.join-box {
  position: relative; max-width: 720px; margin: 0 auto; text-align: center;
  border: 1px solid var(--fg-dim); background: var(--bg-raised); border-radius: 6px;
  padding: 44px 20px; box-shadow: 0 0 60px rgba(77,255,159,0.08) inset;
}
@media (min-width: 640px) { .join-box { padding: 56px 48px; } }
.join-box h2 { font-family: var(--display); font-weight: 400; font-size: clamp(2.4rem, 7vw, 3.6rem); line-height: 1; color: var(--fg-bright); margin-bottom: 14px; text-shadow: 0 0 14px rgba(77,255,159,0.35); }
.join-box > p:not(.kicker):not(.join-msg) { max-width: 46ch; margin: 0 auto 28px; }
#join-form { display: grid; gap: 10px; max-width: 520px; margin: 0 auto; }
#join-form input, #join-form select {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 4px;
  background: #020805; border: 1px solid var(--border); color: var(--fg-bright);
  font-family: var(--mono); font-size: 16px;
}
#join-form select { color: var(--fg-dim); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%), linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
#join-form select.chosen { color: var(--fg-bright); }
#join-form input:focus, #join-form select:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(77,255,159,0.18); }
#join-form .btn { width: 100%; }
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.join-msg { min-height: 1.6em; margin-top: 16px; font-size: 0.9rem; }
.join-msg.ok { color: var(--fg); }
.join-msg.err { color: var(--live); }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--border); padding: 32px var(--gutter) calc(40px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 0.8rem; color: var(--fg-dim); display: grid; gap: 6px; }
.foot-fine { color: var(--fg-mute); font-style: italic; }
