:root {
  --ground: #0A0A0C;
  --panel: #121116;
  --bone: #EDE8DF;
  --muted: #8E8A94;
  --line: #3A3840;
  --accent: #FF2D3F;
  --orange: #FF7A1A;
  --purple: #9B5CFF;
  --display: 'Big Shoulders Display', 'Impact', sans-serif;
  --body: 'Chakra Petch', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--ground);
  background-image:
    linear-gradient(rgba(237, 232, 223, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 232, 223, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--bone);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.45;
  overflow-x: clip;
}

a { color: var(--accent); }
a:hover { color: var(--bone); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.muted { color: var(--muted); }

/* ---------- side tag ---------- */
.side-tag {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  white-space: nowrap;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 5px;
  color: var(--bone);
  opacity: 0.55;
  pointer-events: none;
  z-index: 5;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 32px;
  padding: 16px clamp(20px, 5vw, 72px);
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--bone);
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 15px;
}
.brand { color: var(--bone); text-decoration: none; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.topbar nav a { color: var(--muted); text-decoration: none; text-transform: uppercase; padding: 6px 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: var(--accent); }
.topbar nav a[aria-current="page"] { color: var(--bone); border-bottom-color: var(--accent); }

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 72px);
}

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(40px, 8vw, 96px) 0 clamp(60px, 9vw, 120px); }
.hero.small { padding: clamp(36px, 6vw, 72px) 0 clamp(40px, 6vw, 72px); }
.kicker {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: 2px;
  color: var(--accent);
}
.hero h1 {
  position: relative;
  z-index: 2;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(110px, 24vw, 300px);
  line-height: 0.8;
  letter-spacing: -0.01em;
}
.hero.small h1 { font-size: clamp(72px, 13vw, 170px); }
.hero .solid { color: var(--bone); text-shadow: 8px 8px 0 var(--ground); }
.hero .outline {
  margin-top: 0.06em;
  color: transparent;
  -webkit-text-stroke: clamp(2px, 0.4vw, 5px) var(--accent);
  text-shadow: 8px 8px 0 var(--ground);
}
.hero .subtitle {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin: 28px 0 0;
  padding: 6px 16px 4px 0;
  background: var(--ground);
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.9;
  color: var(--accent);
}
.stripes {
  position: absolute;
  z-index: 1;
  left: -30vw;
  right: -30vw;
  top: 58%;
  height: clamp(60px, 9vw, 120px);
  transform: rotate(-7deg);
  background: repeating-linear-gradient(135deg, var(--accent) 0 34px, var(--ground) 34px 68px);
  opacity: 0.9;
}
.hero.small .stripes { top: 50%; height: clamp(40px, 6vw, 80px); }
.stripes::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -22px;
  height: 5px;
  background: var(--bone);
  opacity: 0.85;
}

/* ---------- sections ---------- */
.block { padding: 56px 0; border-top: 2px solid var(--bone); }
.section-title {
  margin: 0 0 28px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 0.9;
  text-transform: uppercase;
}
.section-title span {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}
.section-title .more {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 3px;
  text-decoration: none;
}

/* ---------- panels / facts ---------- */
.panel { border: 2px solid var(--bone); background: var(--panel); }
.panel + .panel { margin-top: 28px; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 32px;
  padding: 28px;
}
.event-tag { font-family: var(--mono); font-size: 14px; letter-spacing: 3px; color: var(--accent); margin: 0 0 8px; }
.race-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.85;
  color: var(--accent);
}
.race-name a { color: inherit; text-decoration: none; }
.race-name a:hover { color: var(--bone); }
.countdown { font-family: var(--mono); font-weight: 700; font-size: clamp(22px, 3.2vw, 36px); letter-spacing: 2px; }
.countdown small { display: block; font-size: 13px; letter-spacing: 3px; color: var(--muted); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border-top: 2px solid var(--bone); }
.fact { padding: 18px 28px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.fact-label { font-family: var(--mono); font-size: 13px; letter-spacing: 3px; color: var(--muted); }
.fact-value { font-size: 22px; font-weight: 700; }
.fact-value.hot { color: var(--accent); }
.description { margin: 0; padding: 24px 28px; font-size: 22px; font-weight: 700; border-top: 1px solid var(--line); }
.rules { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rules li { display: flex; gap: 18px; padding: 16px 28px; border-bottom: 1px solid var(--line); font-size: 20px; }
.rules li:last-child { border-bottom: 0; }
.rules .n { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.signup {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  padding: 20px 28px;
  background: var(--accent);
  color: var(--ground);
}
.signup strong { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 1; text-transform: uppercase; }
.signup span { font-family: var(--mono); font-weight: 700; font-size: 18px; }

.winner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 20px;
  padding: 18px 28px;
  background: var(--accent);
  color: var(--ground);
}
.winner .label { font-family: var(--mono); font-weight: 700; letter-spacing: 3px; font-size: 14px; }
.winner .name { font-family: var(--display); font-weight: 900; font-size: 44px; line-height: 1; text-transform: uppercase; }
.winner .name a { color: inherit; text-decoration: none; }
.winner .name a:hover { text-decoration: underline; text-decoration-thickness: 3px; }

/* ---------- race list ---------- */
.race-list { display: flex; flex-direction: column; gap: 20px; }
.race-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 28px;
  padding: 20px 24px;
  border: 2px solid var(--bone);
  background: var(--panel);
  color: var(--bone);
  text-decoration: none;
}
.race-row:hover { border-color: var(--accent); color: var(--bone); }
.race-row .num { font-family: var(--display); font-weight: 900; font-size: clamp(36px, 5vw, 56px); line-height: 0.9; color: var(--accent); }
.race-row .title { font-family: var(--display); font-weight: 900; font-size: clamp(32px, 4.5vw, 52px); line-height: 0.9; text-transform: uppercase; }
.race-row .meta { font-family: var(--mono); font-size: 14px; letter-spacing: 2px; color: var(--muted); text-align: right; }
.race-row .meta strong { display: block; color: var(--bone); font-size: 16px; }
.race-row .meta .live { color: var(--accent); }
.corrupt { color: var(--accent); font-weight: 700; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 2px solid var(--bone); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 24px; text-align: left; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-family: var(--mono); font-size: 13px; letter-spacing: 3px; font-weight: 700; color: var(--muted); white-space: nowrap; }
td.pos { font-family: var(--mono); font-weight: 700; color: var(--accent); width: 1%; white-space: nowrap; }
td.driver { font-weight: 700; white-space: nowrap; }
td.driver a { color: var(--bone); text-decoration: none; }
td.driver a:hover { color: var(--accent); }
td.wins { font-family: var(--mono); font-weight: 700; font-size: 20px; width: 1%; }
td.won { color: var(--muted); }
td.won a { color: var(--muted); }
td.won a:hover { color: var(--accent); }

.empty {
  margin: 0;
  padding: 28px;
  border: 2px dashed var(--line);
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 1px;
}

/* ---------- driver ---------- */
.stat-row { display: flex; flex-wrap: wrap; gap: 28px; margin-bottom: 28px; }
.stat { border: 2px solid var(--bone); background: var(--panel); padding: 18px 28px; min-width: 200px; }
.stat .fact-value { font-family: var(--display); font-weight: 900; font-size: 72px; line-height: 0.9; color: var(--accent); }

/* ---------- forms / admin ---------- */
.form { display: grid; gap: 18px; padding: 28px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field .label { font-family: var(--mono); font-size: 13px; letter-spacing: 3px; color: var(--muted); }
.field .hint { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 1px; }
input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"], textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--ground);
  color: var(--bone);
  border: 2px solid var(--line);
  border-radius: 0;
  font: inherit;
  font-size: 18px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input:disabled { color: var(--muted); }
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 14px; letter-spacing: 1px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.buttons { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--ground);
  font-family: var(--display);
  font-weight: 900;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--bone); border-color: var(--bone); color: var(--ground); }
.btn.ghost { background: transparent; color: var(--bone); border-color: var(--bone); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn.danger { background: transparent; color: var(--accent); }
.btn.danger:hover { background: var(--accent); color: var(--ground); }
.btn.small { min-height: 40px; font-size: 20px; padding: 6px 14px; }
.msg { font-family: var(--mono); font-size: 15px; letter-spacing: 1px; min-height: 1.4em; }
.msg.err { color: var(--accent); }
.msg.ok { color: #7CFFB0; }
.discord { display: grid; gap: 10px; padding: 18px 28px; border-top: 1px solid var(--line); }
.discord code { font-family: var(--mono); font-size: 16px; background: var(--ground); padding: 8px 12px; border: 1px solid var(--line); user-select: all; }
.admin-actions { white-space: nowrap; text-align: right; }

/* ---------- footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding: 28px clamp(20px, 5vw, 72px);
  border-top: 2px solid var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 1px;
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- motion: same effects as the street ads ---------- */
.stripes { animation: stripeMove 2.4s linear infinite; }
@keyframes stripeMove { from { background-position: 0 0; } to { background-position: 96.17px 0; } }

.glitch { position: relative; animation: gShake 4.2s infinite; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  text-shadow: none;
  opacity: 0;
}
.glitch::before { color: var(--purple); animation: gA 4.2s infinite steps(1); }
.glitch::after  { color: var(--accent); animation: gB 4.2s infinite steps(1); }
.glitch-outline::before { color: transparent; -webkit-text-stroke-color: var(--purple); }
.glitch-outline::after  { color: transparent; -webkit-text-stroke-color: var(--orange); }
.glitch-outline, .glitch-outline::before, .glitch-outline::after { animation-delay: 1.3s; }

@keyframes gShake {
  0%, 85%, 100% { transform: none; }
  86% { transform: translate(4px, 0) skewX(-3deg); }
  88% { transform: translate(-5px, 1px); }
  90% { transform: translate(2px, -1px) skewX(2deg); }
  92% { transform: none; }
}
@keyframes gA {
  0%, 85%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  86% { opacity: .9; transform: translate(-10px, 2px); clip-path: inset(8% 0 62% 0); }
  88% { opacity: .9; transform: translate(8px, -2px); clip-path: inset(52% 0 24% 0); }
  90% { opacity: .9; transform: translate(-6px, 0); clip-path: inset(30% 0 48% 0); }
  92% { opacity: .9; transform: translate(12px, 1px); clip-path: inset(74% 0 6% 0); }
  93% { opacity: 0; }
}
@keyframes gB {
  0%, 86%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  87% { opacity: .9; transform: translate(10px, -1px); clip-path: inset(60% 0 12% 0); }
  89% { opacity: .9; transform: translate(-8px, 2px); clip-path: inset(14% 0 66% 0); }
  91% { opacity: .9; transform: translate(6px, 0); clip-path: inset(40% 0 36% 0); }
  93% { opacity: 0; }
}

.race-name, .winner .name { animation: flick 5.5s infinite; }
@keyframes flick {
  0%, 94%, 100% { opacity: 1; }
  95% { opacity: .25; }
  96% { opacity: 1; }
  97% { opacity: .4; }
  98% { opacity: 1; }
}

.scan {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 4px);
}
.scan::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 18%;
  top: -20%;
  background: linear-gradient(180deg, transparent, rgba(237, 232, 223, .05), transparent);
  animation: scanMove 6s linear infinite;
}
@keyframes scanMove { from { top: -20%; } to { top: 105%; } }

@media (max-width: 640px) {
  .side-tag { display: none; }
  th, td { padding: 10px 14px; }
  .race-row { grid-template-columns: auto 1fr; }
  .race-row .meta { grid-column: 1 / -1; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stripes, .glitch, .glitch::before, .glitch::after,
  .race-name, .winner .name, .scan::after { animation: none; }
}

.panel { scroll-margin-top: 96px; }

/* ---------- drivers / accounts ---------- */
.topbar nav a.account { color: var(--accent); }
.topbar nav a.account[aria-current="page"] { color: var(--bone); }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.driver-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px 24px; border: 2px solid var(--bone); background: var(--panel);
  color: var(--bone); text-decoration: none;
}
.driver-card:hover { border-color: var(--accent); color: var(--bone); }
.driver-card .dname { font-family: var(--display); font-weight: 900; font-size: 40px; line-height: 0.9; text-transform: uppercase; }
.driver-card .tagline { color: var(--muted); font-size: 16px; }
.driver-card .meta { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 13px; letter-spacing: 2px; color: var(--muted); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.driver-card .meta strong { color: var(--accent); }
.profile-tagline { margin: 0; padding: 22px 28px; font-size: 24px; font-weight: 700; border-bottom: 1px solid var(--line); }
.profile-bio { margin: 0; padding: 22px 28px; white-space: pre-line; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 0; margin-bottom: -2px; }
.tabs button {
  min-height: 52px; padding: 10px 26px; background: transparent; color: var(--muted);
  border: 2px solid var(--line); border-bottom-color: var(--bone);
  font-family: var(--display); font-weight: 900; font-size: 28px; text-transform: uppercase; cursor: pointer;
}
.tabs button + button { border-left: 0; }
.tabs button[aria-selected="true"] { color: var(--bone); border-color: var(--bone); border-bottom-color: var(--panel); background: var(--panel); }
.notice { padding: 18px 28px; background: var(--accent); color: var(--ground); font-family: var(--mono); font-weight: 700; letter-spacing: 1px; }
.temp-pw { display: grid; gap: 8px; padding: 18px 28px; border: 2px solid #7CFFB0; background: var(--panel); margin-bottom: 20px; }
.temp-pw code { font-family: var(--mono); font-size: 20px; color: #7CFFB0; user-select: all; }
.badge { display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 2px; padding: 3px 8px; border: 1px solid var(--accent); color: var(--accent); }
.badge.ok { border-color: var(--muted); color: var(--muted); }
