/* ==========================================================================
   RaceLeague — core stylesheet
   Ground is monochrome (the RL marks are white-on-black). Colour only ever
   enters the page as a team livery, injected as --livery / --livery-ink.
   ========================================================================== */

:root {
  --ink:        #0a0b0d;
  --panel:      #101216;
  --raised:     #171a1f;
  --hair:       #23262c;
  --hair-lit:   #33373f;
  --bone:       #eceae6;
  --dim:        #9a9ca1;
  --dimmer:     #6b6e74;

  /* brand accents — sampled directly from the official rebrand sheet
     (RL Documents & Branding/rlrebrand.png), not approximated. Pink is the
     primary accent; violet is a fill/background colour only (too dark for
     text-on-ink at 2.08:1) — see --violet-light for a text/border-safe tint. */
  --pink:        #D54982;
  --pink-hot:    #DD6A98;
  --pink-rgb:    213,73,130;
  --violet:      #573874;
  --violet-light:#7C6493;
  --violet-rgb:  87,56,116;
  --orchid:      #DB85C5;

  --livery:     var(--pink);
  --livery-ink: var(--pink-hot);

  /* elevation — depth comes from layered surfaces and glow, not borders */
  --e1: 0 1px 2px rgba(0,0,0,.4);
  --e2: 0 4px 16px -4px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.4);
  --e3: 0 18px 48px -12px rgba(0,0,0,.7), 0 4px 12px -4px rgba(0,0,0,.5);
  --glow: 0 0 0 1px rgba(var(--pink-rgb),.22), 0 12px 40px -12px rgba(var(--pink-rgb),.35);

  --gp:      #eceae6;
  --sprint:  #9a9ca1;

  --f-display: 'Archivo', system-ui, sans-serif;
  --f-body:    'Inter', system-ui, sans-serif;
  --f-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --shell: 1240px;
  --gut: 32px;
  --nav-h: 62px;

  --r-sm:   8px;
  --r-md:   16px;
  --r-lg:   20px;
  --r-pill: 999px;
  --champion-gold: #e5c276;
}

[data-theme="light"] { --champion-gold: #79520d; }
.badge--champion { color: var(--champion-gold); border-color: currentColor; }
.archive-champion .row__name, .archive-champion .row__pos b,
.archive-champion .row__pts, .archive-champion .archive-driver,
.archive-champion > td:first-child, .archive-champion > td:last-child { color: var(--champion-gold); }
.archive-champion .row__bar { background: linear-gradient(90deg, var(--champion-gold), transparent 92%); }
.archive-champion .row__id a, .archive-driver a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.archive-driver a:hover { text-decoration-color: currentColor; }
.history-season-link { text-decoration: underline; text-decoration-color: var(--hair-lit); text-underline-offset: 3px; }
.history-season-link:hover { color: var(--bone); text-decoration-color: currentColor; }

*, *::before, *::after { box-sizing: border-box; }

/* Page wash on its own composited layer, so scrolling never repaints it. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, #15111b 0%, transparent 60%),
    linear-gradient(180deg, #0c0d10 0%, #0a0b0d 40%);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Keep headings readable when they wrap, and respect side cutouts in landscape. */
h1, h2, h3 { text-wrap: balance; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--livery); color: #fff; }

:focus-visible {
  outline: 2px solid var(--livery-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- type ---------------------------------------------------------------- */

.display {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 125, 'wght' 800;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  line-height: 0.92;
  margin: 0;
}

.eyebrow {
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--dimmer);
  margin: 0;
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.num {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'zero' 1;
}

/* --- shell --------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-left: max(var(--gut), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gut), env(safe-area-inset-right, 0px));
}

.section { padding-block: 84px; }
.section--tight { padding-block: 52px; }

/* --- dashboard ------------------------------------------------------------ */

/* The homepage's main content as one dashboard view — a wide primary column
   next to a narrower side column — instead of stacked full-width sections. */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.dash__side {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* The side column runs narrower, so its tower needs a denser cut */
.dash__side .tower .tower__head,
.dash__side .tower .row {
  grid-template-columns: 40px 1fr 56px 72px;
  gap: 8px;
  padding-inline: 14px;
}
.dash__side .tower .row__av { width: 28px; height: 28px; }
.dash__side .tower .row__name { font-size: 0.84375rem; }

.rule {
  height: 1px;
  background: var(--hair);
  border: 0;
  margin: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 30px;
  position: relative;
}

/* A gradient hairline that fades out, rather than a hard 1px rule edge to edge */
.section-head::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--hair-lit) 0%, var(--hair) 45%, transparent 100%);
}

.section-head h2 {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 112, 'wght' 700;
  text-transform: uppercase;
  font-size: clamp(1.375rem, 2.7vw, 2rem);
  letter-spacing: -0.018em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

/* Small pink marker replaces the old label-above-heading */
.section-head h2::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 12px rgba(var(--pink-rgb),.9);
  flex-shrink: 0;
}

.section-head a { color: var(--dim); font-size: 0.8125rem; font-family: var(--f-body); font-weight: 500; }
.section-head a:hover { color: var(--bone); }

/* --- nav ----------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(10, 11, 13, .62);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: background .35s ease, border-color .35s ease, box-shadow .35s ease;
}

/* Chrome only asserts itself once content is actually passing underneath */
.nav.scrolled {
  background: rgba(10, 11, 13, .84);
  border-bottom-color: rgba(255,255,255,.08);
  box-shadow: 0 10px 30px -18px rgba(0,0,0,.9);
}

.nav__in {
  display: flex;
  align-items: center;
  gap: 34px;
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-left: max(var(--gut), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gut), env(safe-area-inset-right, 0px));
}

.data-notice {
  position: fixed; z-index: 100; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  padding: 12px 16px; border: 1px solid var(--hair-lit); border-radius: var(--r-md);
  background: var(--raised); box-shadow: var(--e2); font-size: 0.875rem;
}
.data-notice button { color: var(--pink-hot); background: none; border: 0; font: inherit; cursor: pointer; min-height: 44px; }

.nav__mark { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.nav__mark img { width: 25px; height: 25px; display: block; }
.nav__mark span {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 120, 'wght' 800;
  text-transform: uppercase;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
}

.nav__links { display: flex; gap: 28px; align-items: center; }

.nav__links a {
  font-family: var(--f-body);
  font-size: 0.84375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--dim);
  padding-block: 6px;
  position: relative;
  transition: color .18s ease;
}

.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--pink);
  box-shadow: 0 0 10px rgba(var(--pink-rgb),.8);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s cubic-bezier(.2,.7,.3,1);
}

.nav__links a:hover { color: var(--bone); }
.nav__links a:hover::after { transform: scaleX(1); }
.nav__links a[aria-current='page'] { color: var(--bone); }
.nav__links a[aria-current='page']::after { transform: scaleX(1); }

.nav__burger {
  display: none;
  background: none;
  border: 1px solid var(--hair-lit);
  color: var(--bone);
  border-radius: 3px;
  padding: 6px 9px;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 0.78125rem;
  letter-spacing: .01em;
  cursor: pointer;
  min-height: 44px;
}

/* --- hero ---------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(72px, 12vw, 150px) clamp(56px, 8vw, 96px);
  overflow: hidden;
  isolation: isolate;
}

/* The dot field sits below every hero element */
.hero__dots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  mask-image: radial-gradient(115% 78% at 50% 42%, #000 32%, transparent 78%);
  -webkit-mask-image: radial-gradient(115% 78% at 50% 42%, #000 32%, transparent 78%);
}

.hero__wash {
  position: absolute;
  inset: -30% -20% auto -20%;
  height: 760px;
  z-index: -1;
  background:
    radial-gradient(38% 46% at 22% 12%, var(--violet) 0%, transparent 72%),
    radial-gradient(42% 50% at 78% 6%,  var(--orchid) 0%, transparent 70%),
    radial-gradient(46% 56% at 50% 34%, var(--pink)   0%, transparent 74%);
  opacity: .24;
  filter: blur(6px);
  pointer-events: none;
}

.hero__in {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* The wordmark is the headline — no small label sitting above it */
.hero__mark {
  width: min(680px, 88vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 40px rgba(var(--pink-rgb),.28));
}

.hero__season {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 600;
  text-transform: uppercase;
  font-size: clamp(0.8125rem, 1.5vw, 1.0625rem);
  letter-spacing: .3em;
  color: var(--dim);
  margin: 26px 0 0;
  padding-left: .3em;
}

/* Vital season info, directly beneath the mark */
/* An asymmetric bento grid, not a uniform strip — the leader tile gets real
   space to show who's ahead, not just a number the same size as the rest. */
.hero__vitals {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  grid-template-areas: "leader latest" "leader rounds";
  gap: 12px;
  margin-top: 34px;
  width: min(680px, 100%);
  text-align: left;
}
.hero__vitals--noleader {
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "latest rounds";
}
.hero__vitals[hidden] { display: none; }

.vital {
  position: relative;
  padding: 18px clamp(18px, 3vw, 26px);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.028);
  border: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--e3);
  overflow: hidden;
}

.vital--leader {
  grid-area: leader;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
}
.vital--latest { grid-area: latest; }
.vital--rounds { grid-area: rounds; }

.vital__av {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.14);
  flex-shrink: 0;
}

.vital__name {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 112, 'wght' 700;
  text-transform: uppercase;
  font-size: clamp(1.125rem, 2.4vw, 1.5rem);
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.vital__big {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 800;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  line-height: .95;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.vital__big span {
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  color: var(--dimmer);
  margin-left: 6px;
  text-transform: uppercase;
}
.vital__big .counter-value {
  font: inherit;
  color: inherit;
  margin-left: 0;
}

.vital__v {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 115, 'wght' 700;
  font-size: clamp(1.1875rem, 2.3vw, 1.625rem);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.vital__k {
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--dimmer);
  margin-top: 8px;
}

.hero__sub {
  max-width: 52ch;
  color: var(--dim);
  font-size: clamp(0.90625rem, 1.4vw, 1.03125rem);
  line-height: 1.7;
  margin: 26px auto 0;
}

/* Page headers on inner pages — heading first, meta underneath */
.page-head { padding-block: clamp(48px, 7vw, 76px) 26px; }

.page-head h1 {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 122, 'wght' 800;
  text-transform: uppercase;
  font-size: clamp(2.375rem, 7vw, 4.875rem);
  line-height: .9;
  letter-spacing: -0.03em;
  margin: 0;
}

.page-head p {
  color: var(--dim);
  max-width: 56ch;
  margin: 18px 0 0;
  font-size: clamp(0.90625rem, 1.4vw, 1.03125rem);
  line-height: 1.7;
}

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-body);
  font-size: 0.84375rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 13px 22px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-pill);
  color: var(--bone);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  /* fast press feedback; hover lift is handled by a spring in motion.js */
  transition: background .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.btn:hover {
  background: rgba(255,255,255,.085);
  border-color: rgba(255,255,255,.25);
  box-shadow: var(--e2);
}

.btn--solid {
  background: linear-gradient(180deg, var(--pink-hot), var(--pink));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 26px -8px rgba(var(--pink-rgb),.75);
}
.btn--solid:hover {
  background: linear-gradient(180deg, #E283AA, var(--pink-hot));
  box-shadow: 0 12px 34px -8px rgba(var(--pink-rgb),.9);
  border-color: transparent;
}

.btn--secondary {
  background: linear-gradient(180deg, var(--violet-light), var(--violet));
  color: var(--bone);
  border-color: transparent;
  box-shadow: 0 8px 26px -8px rgba(var(--violet-rgb),.55);
}
.btn--secondary:hover {
  background: linear-gradient(180deg, #9784A9, var(--violet-light));
  box-shadow: 0 12px 34px -8px rgba(var(--violet-rgb),.7);
  border-color: transparent;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* --- stat strip ---------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
}

.stat {
  position: relative;
  padding: 22px 20px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.07);
  background: linear-gradient(168deg, rgba(255,255,255,.05), rgba(255,255,255,.012));
  box-shadow: var(--e1);
  overflow: hidden;
  transition: border-color .3s ease, box-shadow .3s ease;
}

.stat::after {
  content: '';
  position: absolute;
  left: 16%; right: 16%; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--pink-rgb),.6), transparent);
  opacity: 0;
  transition: opacity .35s ease;
}

.stat:hover { border-color: rgba(255,255,255,.13); box-shadow: var(--e2); }
.stat:hover::after { opacity: 1; }

.stat__v {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 700;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.stat__k {
  font-family: var(--f-mono);
  font-size: 0.65625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dimmer);
  margin-top: 9px;
}

/* --- timing tower (signature) -------------------------------------------- */

.tower {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.012));
  box-shadow: var(--e2);
}

.tower__head {
  display: grid;
  grid-template-columns: 52px 1fr 120px 92px;
  gap: 14px;
  padding: 12px 16px 12px 20px;
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--dimmer);
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.022);
}

.tower__head span:nth-child(3),
.tower__head span:nth-child(4) { text-align: right; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr 120px 92px;
  gap: 14px;
  align-items: center;
  padding: 0 16px 0 20px;
  min-height: 64px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  isolation: isolate;
  transition: background .2s ease;
}

.row:last-child { border-bottom: 0; }

.row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--livery);
  box-shadow: 0 0 14px -1px var(--livery);
}

.row__bar {
  position: absolute;
  left: 3px; top: 0; bottom: 0; right: 0;
  background: linear-gradient(90deg, var(--livery) 0%, transparent 92%);
  opacity: .17;
  z-index: -1;
  transform-origin: left;
  transform: scaleX(var(--fill, 0));
  transition: transform 1.15s cubic-bezier(.16,.84,.28,1);
}

.row:hover { background: rgba(255,255,255,.045); }

.row__pos {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.9375rem;
  color: var(--dim);
}

.row__pos b { color: var(--bone); font-weight: 500; }
.row__pos b.medal { font-weight: 600; }
.row__pos b.medal--1 { color: #e8c15a; text-shadow: 0 0 12px rgba(232,193,90,.5); }
.row__pos b.medal--2 { color: #c3c7cf; }
.row__pos b.medal--3 { color: #b3773f; }

.row__id { display: flex; align-items: center; gap: 13px; min-width: 0; }

.row__av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--raised);
  border: 1px solid var(--hair-lit);
  object-fit: cover;
  flex-shrink: 0;
}

.row__name {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 108, 'wght' 600;
  text-transform: uppercase;
  font-size: 0.96875rem;
  letter-spacing: .005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__team {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  color: var(--dim);
  letter-spacing: .05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__gap { text-align: right; font-family: var(--f-mono); font-size: 0.78125rem; color: var(--dimmer); }

.row__pts {
  text-align: right;
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 112, 'wght' 700;
  font-size: 1.3125rem;
  font-variant-numeric: tabular-nums;
}

.row__logo { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; opacity: .95; }

/* --- cards --------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 14px;
  background: transparent;
  border: 0;
}

.grid--4 { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }

.grid--3 { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }

.card {
  position: relative;
  background: linear-gradient(168deg, rgba(255,255,255,.055) 0%, rgba(255,255,255,.018) 42%, rgba(255,255,255,.008) 100%);
  border: 1px solid rgba(255,255,255,.075);
  border-left: 3px solid var(--livery);
  border-radius: var(--r-xl);
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  box-shadow: var(--e2), 0 0 14px -4px color-mix(in srgb, var(--livery) 45%, transparent);
  transition: border-color .3s cubic-bezier(.2,.7,.3,1), box-shadow .3s cubic-bezier(.2,.7,.3,1);
}

/* Corner wash in the item's own livery colour — always faintly on, so every
   card carries its identity at rest, not just on hover. */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 100% at 0% 0%, color-mix(in srgb, var(--livery) 22%, transparent), transparent 65%);
  opacity: .5;
  transition: opacity .3s cubic-bezier(.2,.7,.3,1);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(255,255,255,.14);
  box-shadow: var(--e3), 0 0 22px -4px color-mix(in srgb, var(--livery) 60%, transparent);
}
.card:hover::before { opacity: 1; }

.card > * { position: relative; }

/* A <button class="card"> (media lightbox trigger) needs the UA chrome
   stripped, but keeps every other .card rule — same look, same motion. */
button.card { font: inherit; text-align: left; cursor: pointer; width: 100%; }

.card__av {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--raised);
  border: 1px solid rgba(255,255,255,.12);
  object-fit: cover;
  box-shadow: var(--e1);
}

.card__name {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 110, 'wght' 700;
  text-transform: uppercase;
  font-size: 1.125rem;
  line-height: 1.05;
  margin: 0;
}

.card__user { font-family: var(--f-mono); font-size: 0.71875rem; color: var(--dimmer); word-break: break-all; }

.card__team {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: .06em;
  color: var(--livery-ink);
  text-transform: uppercase;
}

.card__team img { width: 17px; height: 17px; object-fit: contain; }

.card__foot {
  display: flex;
  gap: 18px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
}

.card__stat { display: flex; flex-direction: column; gap: 3px; }
.card__stat b {
  font-family: var(--f-mono);
  font-size: 1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.card__stat span {
  font-family: var(--f-mono);
  font-size: 0.59375rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--dimmer);
}

/* --- hall of fame ---------------------------------------------------------- */

.hof-card { position: relative; gap: 12px; }

.hof-rank {
  position: absolute;
  top: 18px; right: 18px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--f-mono);
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--dim);
  box-shadow: var(--e1);
}
.hof-rank--1 { background: linear-gradient(160deg, #f4d789, #c9992f); box-shadow: 0 6px 18px -6px rgba(201,153,47,.7); }
.hof-rank--2 { background: linear-gradient(160deg, #e6e8ec, #a7abb3); box-shadow: 0 6px 18px -6px rgba(150,155,165,.6); }
.hof-rank--3 { background: linear-gradient(160deg, #d3966a, #9c5f36); box-shadow: 0 6px 18px -6px rgba(156,95,54,.6); }

.hof-blurb { color: var(--dim); font-size: 0.8125rem; line-height: 1.65; margin: 0; padding-right: 30px; }

.hof-achievements { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }

.hof-achievements li {
  position: relative;
  padding-left: 15px;
  font-family: var(--f-mono);
  font-size: 0.71875rem;
  color: var(--dim);
  letter-spacing: .01em;
}

.hof-achievements li::before {
  content: '';
  position: absolute;
  left: 0; top: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dimmer);
}

.hof-achievements li.hof-place--1::before { background: #e8c15a; box-shadow: 0 0 8px rgba(232,193,90,.7); }
.hof-achievements li.hof-place--1 { color: var(--bone); }
.hof-achievements li.hof-place--2::before { background: #c3c7cf; }
.hof-achievements li.hof-place--3::before { background: #b3773f; }

.hof-empty { font-family: var(--f-mono); font-size: 0.71875rem; color: var(--dimmer); margin: 0; }

/* --- form strip ---------------------------------------------------------- */

.form-strip { display: flex; flex-wrap: wrap; gap: 3px; }

.chip {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 0.71875rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-sm);
  color: var(--dim);
  background: rgba(255,255,255,.04);
  padding-inline: 5px;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.7,.3,1), border-color .18s ease, box-shadow .18s ease;
}

.chip:hover { transform: translateY(-3px); border-color: var(--livery-ink); box-shadow: var(--e2); }
/* Feedback lives on the press, not the release */
.chip:active { transform: translateY(-1px) scale(.96); transition-duration: .08s; }
.chip--p1 { background: var(--bone); color: var(--ink); border-color: var(--bone); font-weight: 600; }
.chip--pod { background: #2b2f36; color: var(--bone); border-color: var(--hair-lit); }
.chip--pts { background: var(--raised); color: var(--bone); }
.chip--out { color: var(--dimmer); }
.chip--dnf { color: #d97070; border-color: #4a2a2a; }
.chip--sprint { border-style: dashed; }

/* --- profile ------------------------------------------------------------- */

.profile {
  position: relative;
  padding-block: clamp(64px, 10vw, 128px) 56px;
  overflow: hidden;
  isolation: isolate;
}

.profile::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--livery), rgba(255,255,255,.06) 55%, transparent);
  opacity: .6;
}

/* Full-bleed personalised banner — two soft radials built from this
   person/team's own livery colour, so every profile reads as a real
   cover rather than a plain header row. */
.profile__wash {
  position: absolute;
  inset: -40% -10% auto -30%;
  height: 680px;
  z-index: -1;
  background:
    radial-gradient(52% 62% at 15% 12%, var(--livery) 0%, transparent 70%),
    radial-gradient(42% 55% at 88% -4%, color-mix(in srgb, var(--livery) 55%, var(--violet)) 0%, transparent 74%);
  opacity: .32;
  filter: blur(4px);
  pointer-events: none;
}

.profile__in {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 30px;
  flex-wrap: wrap;
}

.profile__av {
  width: clamp(140px, 14vw, 180px);
  height: clamp(140px, 14vw, 180px);
  border-radius: 50%;
  background: var(--raised);
  border: 1px solid rgba(255,255,255,.14);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--e3),
    0 0 0 4px color-mix(in srgb, var(--livery) 55%, transparent),
    0 0 70px -14px color-mix(in srgb, var(--livery) 75%, transparent);
}

.profile__name {
  font-size: clamp(2.625rem, 8vw, 5.75rem);
  letter-spacing: -0.032em;
  margin: 0 0 16px;
}

.profile__meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 7px 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-pill);
  color: var(--dim);
  background: rgba(255,255,255,.035);
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}

a.badge:hover { border-color: var(--pink); color: var(--bone); background: rgba(var(--pink-rgb),.1); }

.badge img { width: 16px; height: 16px; object-fit: contain; }
.badge--livery { border-color: var(--livery-ink); color: var(--livery-ink); }

.profile__pos {
  margin-left: auto;
  text-align: right;
  padding: 20px 28px;
  border-radius: var(--r-xl);
  background: linear-gradient(160deg, color-mix(in srgb, var(--livery) 16%, transparent), transparent);
  border: 1px solid color-mix(in srgb, var(--livery) 35%, transparent);
}
.profile__pos .stat__v { font-size: clamp(3.25rem, 8vw, 5.5rem); }
.points-chart { width: min(220px, 100%); margin: 14px 0 0 auto; text-align: left; }
.points-chart figcaption, .points-chart output { display: block; color: var(--dim); font-size: .75rem; }
.points-chart output { min-height: 3em; line-height: 1.4; }
.points-chart input[type="range"] {
  --progress: 100%;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(var(--pink-hot), var(--pink-hot)) left center / var(--progress) 4px no-repeat,
    linear-gradient(var(--hair-lit), var(--hair-lit)) center / 100% 4px no-repeat;
  cursor: ew-resize;
  transition: background-size 180ms ease;
}
.points-chart input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.points-chart input[type="range"]::-moz-range-track { height: 4px; background: transparent; }
.points-chart input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin-top: -6px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--pink-hot);
  box-shadow: 0 0 0 1px var(--pink-hot);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.points-chart input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--pink-hot);
  box-shadow: 0 0 0 1px var(--pink-hot);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.points-chart input[type="range"]:hover::-webkit-slider-thumb,
.points-chart input[type="range"]:focus-visible::-webkit-slider-thumb { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(var(--pink-rgb), .22); }
.points-chart input[type="range"]:hover::-moz-range-thumb,
.points-chart input[type="range"]:focus-visible::-moz-range-thumb { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(var(--pink-rgb), .22); }
.points-chart input[type="range"]:active { transition: none; }
.spark { display: block; width: 100%; height: 64px; cursor: crosshair; }

/* --- tables -------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.table th {
  text-align: left;
  background: rgba(255,255,255,.02);
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dimmer);
  font-weight: 400;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255,255,255,.045);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr { transition: background .16s ease; }
.table tbody tr:hover { background: rgba(255,255,255,.04); }
.table .r { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.table .neg { color: #d97070; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.01));
  box-shadow: var(--e2);
}

/* --- controls ------------------------------------------------------------ */

.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }

.input, .select {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.11);
  color: var(--bone);
  font-family: var(--f-mono);
  font-size: 0.75rem;
  padding: 11px 15px;
  border-radius: var(--r-pill);
  min-width: 180px;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.input::placeholder { color: var(--dimmer); }
.input:focus, .select:focus {
  border-color: var(--pink);
  background: rgba(255,255,255,.06);
  box-shadow: 0 0 0 3px rgba(var(--pink-rgb),.16);
  outline: none;
}

select.select, select.select:focus, select.select option, select.select optgroup {
  background-color: var(--panel);
  color: var(--bone);
}
select.select {
  min-height: 44px;
  max-width: 100%;
  border-radius: 12px;
  border-color: var(--hair-lit);
  font-family: var(--f-body);
  font-size: .875rem;
  cursor: pointer;
}
select.select:hover:not(:disabled) { border-color: var(--pink); }
select.select:disabled { opacity: .58; cursor: default; }

@supports (appearance: base-select) and selector(::picker(select)) {
  select.select, select.select::picker(select) { appearance: base-select; }
  select.select::picker(select) {
    max-height: min(330px, 55dvh);
    max-width: calc(100vw - 24px);
    margin: 5px 0;
    padding: 5px;
    border: 1px solid var(--hair-lit);
    border-radius: 14px;
    background: var(--panel);
    color: var(--bone);
    box-shadow: var(--e3);
  }
  select.select::picker-icon { color: var(--pink-hot); transition: rotate .18s ease; }
  select.select:open::picker-icon { rotate: 180deg; }
  select.select option {
    min-height: 42px;
    gap: .6em;
    padding: 8px 10px;
    border-radius: 8px;
    overflow-wrap: anywhere;
  }
  select.select option:checked { background: color-mix(in srgb, var(--pink) 14%, var(--panel)); }
  select.select option:hover, select.select option:focus-visible { background: var(--raised); }
  select.select option::checkmark { order: 1; margin-inline-start: auto; color: var(--pink-hot); }
}
@media (prefers-reduced-motion: reduce) {
  select.select::picker-icon { transition: none; }
}
:root { color-scheme: dark; }

.toggle {
  display: inline-flex;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: var(--r-pill);
  overflow: hidden;
  background: rgba(255,255,255,.035);
}

.toggle button {
  background: transparent;
  border: 0;
  color: var(--dim);
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: .01em;
  padding: 11px 20px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.toggle button + button { border-left: 1px solid rgba(255,255,255,.09); }
.toggle button:hover { color: var(--bone); }
.toggle button[aria-pressed='true'] {
  background: linear-gradient(180deg, var(--pink-hot), var(--pink));
  color: #fff;
  box-shadow: 0 6px 18px -8px rgba(var(--pink-rgb),.9);
}

/* --- states -------------------------------------------------------------- */

.state {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.02);
  padding: 40px 28px;
  text-align: center;
  color: var(--dim);
  font-family: var(--f-body);
  font-size: 0.875rem;
}

.state--error { border-color: #4a2a2a; color: #d99; }
.state a { color: var(--bone); text-decoration: underline; text-underline-offset: 3px; }

.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--raised) 0%, color-mix(in srgb, var(--raised) 91%, var(--bone)) 50%, var(--raised) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
  border-radius: 2px;
}

@keyframes shimmer { to { background-position: -200% 0; } }

.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;
}

/* --- footer -------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--hair);
  padding-block: 40px 56px;
  color: var(--dimmer);
  font-family: var(--f-body);
  font-size: 0.8125rem;
}

.foot__in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.foot a:hover { color: var(--bone); }

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
  :root { --gut: 20px; }
  .nav__links {
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--ink);
    border-bottom: 1px solid var(--hair);
    padding: 8px var(--gut) 18px;
    display: none;
  }
  .nav__links.open { display: flex; }
  .nav__links a { padding-block: 12px; width: 100%; font-size: 0.8125rem; }
  .nav__burger { display: block; }
  .tower__head, .row { grid-template-columns: 38px 1fr 78px; }
  .tower__head span:nth-child(3), .row__gap { display: none; }
  .profile__pos { margin-left: 0; text-align: left; }
  .section { padding-block: 56px; }
  .hero__vitals { grid-template-columns: 1fr; grid-template-areas: "leader" "latest" "rounds"; }
  .hero__vitals--noleader { grid-template-areas: "latest" "rounds"; }
  .dash { grid-template-columns: 1fr; }
  /* Once the side column runs full-width again, it doesn't need the denser
     cut anymore — fall back to the same tower layout every other page uses. */
  .dash__side .tower .tower__head,
  .dash__side .tower .row { grid-template-columns: 38px 1fr 78px; padding-inline: 16px 20px; }
  .dash__side .tower .tower__head span:nth-child(3), .dash__side .tower .row__gap { display: none; }
  .dash__side .tower .row__av { width: 34px; height: 34px; }
  .dash__side .tower .row__name { font-size: 0.96875rem; }
}

/* Reduced motion keeps the feedback, drops the movement — cross-fades and
   colour changes stay, translation, springs and the dot wave do not. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .16s !important;
  }
  .chip:hover, .card:hover { transform: none !important; }
  .row__bar { transition: none; transform: scaleX(var(--fill, 0)); }
}

/* Translucency and contrast preferences — solidify rather than blur */
@media (prefers-reduced-transparency: reduce) {
  .nav, .btn, .vital, .input, .select {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #14161b;
  }
}

@media (prefers-contrast: more) {
  .card, .stat, .tower, .table-wrap { border-color: rgba(255,255,255,.3); }
  .row__team, .card__user, .stat__k, .vital__k { color: #c7c9cd; }
}

/* --- race sheet ----------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 5, 7, .62);
}

.sheet {
  position: fixed;
  z-index: 91;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, #16181d 0%, #101216 100%);
  box-shadow: var(--e3), 0 0 0 1px rgba(0,0,0,.5);
  overflow: hidden;
  will-change: transform, opacity;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .022);
}

.sheet__title {
  font-family: var(--f-display);
  font-variation-settings: 'wdth' 118, 'wght' 700;
  text-transform: uppercase;
  font-size: clamp(1.25rem, 3vw, 1.6875rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}

.sheet__meta {
  font-family: var(--f-mono);
  font-size: 0.71875rem;
  color: var(--dim);
  margin: 9px 0 0;
  letter-spacing: .04em;
}

.sheet__close {
  margin-left: auto;
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .04);
  color: var(--dim);
  font-family: var(--f-mono);
  font-size: 0.9375rem;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.sheet__close:hover { background: rgba(255,255,255,.1); color: var(--bone); border-color: rgba(255,255,255,.26); }

.sheet__body { overflow-y: auto; overscroll-behavior: contain; }

.race-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(5px, 1.6vw, 12px);
  padding: 14px clamp(10px, 3vw, 22px) 18px;
  border-bottom: 1px solid var(--hair);
}
.race-podium__place {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 10px 5px 12px;
  border: 1px solid var(--podium-colour);
  border-radius: 16px 16px 8px 8px;
  color: #fff;
  text-align: center;
  background: #25252c;
  background: linear-gradient(160deg, color-mix(in srgb, var(--podium-colour) 43%, #13141a), #171820 95%);
}
.race-podium__place--1 { grid-column: 2; padding-bottom: 26px; }
.race-podium__place--2 { grid-column: 1; padding-bottom: 18px; }
.race-podium__place--3 { grid-column: 3; }
.race-podium__place:hover { color: #fff; box-shadow: inset 0 0 0 1px var(--podium-colour); }
.race-podium__place:focus-visible { outline: 2px solid var(--pink-hot); outline-offset: 2px; }
.race-podium__rank {
  padding: 2px 8px;
  border-radius: 100px;
  background: #14151b;
  color: #e3e7ee;
  font: 700 .75rem var(--f-mono);
}
.race-podium__place--1 .race-podium__rank { color: #ffe28b; }
.race-podium__avatar {
  width: clamp(32px, 10vw, 64px);
  height: clamp(32px, 10vw, 64px);
  object-fit: contain;
  background: #16171c;
  border-radius: 50%;
  color: #fff !important; /* Avatar initials carry a site-wide inline colour. */
}
.race-podium__name, .race-podium__team { max-width: 100%; overflow-wrap: anywhere; }
.race-podium__name { font-size: clamp(.75rem, 2.5vw, 1rem); line-height: 1.15; }
.race-podium__team { color: #e3e7ee; font-size: .72rem; line-height: 1.15; }
[data-theme="light"] .sheet { background: var(--panel); }

.sheet__tabs {
  display: flex;
  gap: 6px;
  padding: 14px 22px 0;
}

.sheet__tabs button {
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 0.78125rem;
  letter-spacing: .01em;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(255,255,255,.035);
  color: var(--dim);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.sheet__tabs button:hover { color: var(--bone); }

.sheet__tabs button[aria-pressed='true'] {
  background: linear-gradient(180deg, var(--pink-hot), var(--pink));
  color: #fff;
  border-color: transparent;
}

/* the driver whose page opened the sheet */
.row--you { background: rgba(var(--pink-rgb), .075); }
.row--you .row__name { color: #fff; }

.round-link {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.22);
  text-underline-offset: 3px;
  transition: text-decoration-color .18s ease, color .18s ease;
}

.round-link:hover { color: var(--livery-ink); text-decoration-color: var(--livery-ink); }

/* --- lightbox -------------------------------------------------------------- */

.lightbox {
  position: fixed;
  z-index: 91;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, #16181d 0%, #101216 100%);
  box-shadow: var(--e3), 0 0 0 1px rgba(0,0,0,.5);
  overflow: hidden;
  will-change: transform, opacity;
}

.lightbox img {
  display: block;
  width: 100%;
  max-height: 64vh;
  object-fit: contain;
  background: var(--panel);
}

.lightbox__cap {
  padding: 16px 22px 18px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .022);
}

.lightbox__close { position: absolute; top: 14px; right: 14px; z-index: 1; }

@media (max-width: 620px) {
  .sheet { width: 100vw; max-height: 86vh; left: 0; top: auto; bottom: 0; transform: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* A quieter, more editorial interface: keep the dark identity, let the
   standings and people carry the colour, and reduce decorative effects. */
:root {
  --ink: #101113; --panel: #17181a; --raised: #202124;
  --hair: #2c2e31; --hair-lit: #414347;
  --bone: #f1f0ed; --dim: #b0b1b1; --dimmer: #929395;
  --e1: none; --e2: none; --e3: 0 16px 40px rgba(0,0,0,.28);
  --r-sm: 6px; --r-md: 12px; --r-lg: 16px; --r-xl: 12px;
}
body::before { background: linear-gradient(180deg, #141416, var(--ink) 500px); }
.nav { background: rgba(16,17,19,.88); border-bottom: 1px solid var(--hair); }
.nav.scrolled { background: rgba(16,17,19,.94); border-bottom-color: var(--hair); box-shadow: none; }
.nav__links a::after { height: 1px; box-shadow: none; }
.hero { padding-block: clamp(60px, 8vw, 110px) clamp(52px, 7vw, 90px); }
.hero__dots { opacity: .3; }
.hero__wash { opacity: .08; }
.hero__mark { width: min(520px, 82vw); height: clamp(56px, 10vw, 96px); object-fit: cover; filter: none; }
.hero__season { letter-spacing: .17em; padding-left: .17em; }
.section-head h2, .page-head h1, .card__name, .row__name, .vital__name {
  text-transform: none; letter-spacing: -.02em;
}
.section-head h2 { font-size: clamp(1.3125rem, 2.2vw, 1.75rem); }
.section-head h2::before { display: none; }
.page-head h1 { font-size: clamp(2.375rem, 6vw, 4.25rem); line-height: 1; }
.vital, .stat, .tower, .card, .table-wrap, .state {
  background: var(--panel); border: 1px solid var(--hair); box-shadow: none;
}
.card { border-left: 2px solid var(--livery); }
.card::before { opacity: .12; }
.card:hover { border-color: var(--hair-lit); border-left-color: var(--livery); box-shadow: none; }
.card:hover::before { opacity: .22; }
.stat:hover { border-color: var(--hair-lit); box-shadow: none; }
.tower__head, .table th { background: rgba(255,255,255,.025); border-color: var(--hair); }
.row, .table td { border-color: var(--hair); }
.row::before { width: 2px; box-shadow: none; }
.row__bar { opacity: .08; }
.row__pos b.medal--1 { color: #e8c15a; text-shadow: none; }
.btn { border-color: var(--hair-lit); }
.btn--solid { background: var(--pink); color: #fff; box-shadow: none; border-color: transparent; }
.btn--solid:hover { background: var(--pink-hot); box-shadow: none; }
.btn--secondary { background: transparent; color: var(--bone); border-color: var(--hair-lit); box-shadow: none; }
.btn--secondary:hover { background: var(--raised); box-shadow: none; border-color: var(--dim); }
.input, .select, .toggle, .badge { border-color: var(--hair-lit); }
.sheet, .lightbox { background: var(--panel); border-color: var(--hair-lit); }
.sheet__head, .lightbox__cap { border-color: var(--hair); }
.profile__av { box-shadow: none; }
@media (max-width: 620px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 232px), 1fr)); }
  .dash, .dash__main, .dash__side, .dash__block, .profile__in { min-width: 0; }
  .controls > *, .input, .select { max-width: 100%; min-width: 0; }
  .tower__head, .row, .dash__side .tower .tower__head, .dash__side .tower .row {
    grid-template-columns: 32px minmax(0, 1fr) 58px;
    gap: 8px; padding-inline: 12px;
  }
  .row__id { gap: 8px; }
}
/* Static dark surfaces avoid repainting a blurred backdrop while scrolling. */
.nav, .vital { backdrop-filter: none; -webkit-backdrop-filter: none; }
.hero__wash, .profile__wash { filter: none; }

/* Calm, content-shaped loading states and an editorial way into the league. */
.sk-value { width: 42%; height: 32px; }
.sk-label { width: 58%; height: 10px; margin-top: 14px; }
.sk-avatar { width: 62px; height: 62px; border-radius: 50%; }
.sk-title { width: 68%; height: 18px; }
.sk-card-foot { width: 90%; height: 28px; margin-top: 14px; }
.sk-card::before { display: none; }
.sk-row::before { display: none; }
.sk-row > .skeleton { height: 14px; }
.sk-row > .skeleton:first-child { width: min(24px, 100%); }
.sk-row > .skeleton:nth-child(2) { width: min(64%, 200px); }
.sk-row > .skeleton:last-child { height: 20px; width: min(38px, 100%); justify-self: end; }
.sk-profile { width: min(320px, 100%); padding-block: 10px; }
.sk-profile-name { width: 100%; height: clamp(38px, 6vw, 68px); }
.sk-profile-meta { width: 65%; height: 26px; margin-top: 16px; border-radius: var(--r-pill); }
.sk-team-logo { width: 112px; height: 112px; }
.sk-profile-chart { height: 64px; width: 100%; margin-top: 12px; }
.sk-profile-position { width: min(240px, 100%); }
.sk-search { padding-block: 12px; }
.sk-search .skeleton { height: 15px; margin-block: 12px; width: 60%; }
.nav__tools:disabled, .nav__burger:disabled, .btn:not([href]).sk-pending {
  position: relative;
  color: transparent;
  cursor: default;
}
.nav__tools:disabled::after, .nav__burger:disabled::after, .btn:not([href]).sk-pending::after {
  content: '';
  position: absolute;
  inset: 38% 20%;
  background: var(--hair-lit);
  border-radius: 3px;
}
.hero__headline { max-width: 14ch; margin: 24px 0 0; font: 500 clamp(2rem, 5vw, 3.875rem)/1.04 var(--f-display); letter-spacing: -.04em; text-wrap: balance; }
.guide { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 7vw, 100px); border-top: 1px solid var(--hair); }
.guide__intro h2 { font: 500 clamp(1.875rem, 4vw, 3.125rem)/1.08 var(--f-display); letter-spacing: -.035em; margin: 14px 0; }
.guide__intro p:last-child { max-width: 44ch; color: var(--dim); }
.guide__links { border-top: 1px solid var(--hair); }
.guide__links a { display: flex; justify-content: space-between; gap: 16px; padding: 20px 2px; border-bottom: 1px solid var(--hair); transition: color .2s ease, padding .2s ease; }
.guide__links a:hover { color: var(--pink-hot); padding-inline: 8px; }
.guide__links b { color: var(--dimmer); font: 0.75rem var(--f-mono); margin-right: 18px; }

.nav__tools { min-height: 44px; padding: 8px 14px; }
.tools-panel {
  color: var(--bone);
  background: var(--panel);
  border: 1px solid var(--hair-lit);
  border-radius: var(--r-lg);
  width: min(42rem, calc(100% - 24px));
  max-height: min(46rem, calc(100dvh - 32px));
  padding: clamp(14px, 3vw, 24px);
}
.tools-panel::backdrop { background: rgba(0, 0, 0, .64); }
@media (prefers-reduced-motion: no-preference) {
  .tools-panel[open]::backdrop { animation: tools-backdrop 180ms ease-out both; }
  .tools-panel[data-closing]::backdrop { animation: tools-backdrop 135ms ease-in reverse both; }
}
@keyframes tools-backdrop { from { opacity: 0; } to { opacity: 1; } }
.tools-head, .tools-tabs, .tools-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools-head { justify-content: space-between; }
.tools-head h2 { margin: 0; }
.tools-tabs { margin-block: 16px; }
.tools-panel .btn { min-height: 44px; padding: 8px 12px; }
.tools-panel [aria-pressed="true"] { background: var(--raised); border-color: var(--pink); }
.tools-actions { border-top: 1px solid var(--hair); padding-top: 12px; }
.page-actions { margin-block: 14px; }
.page-actions .tools-actions { border-top: 0; padding-top: 0; }
.page-actions .tools-actions .btn { min-height: 40px; padding: 8px 13px; }
.page-actions .tools-actions { gap: 6px; }
.page-actions .tools-actions .btn { font-size: .75rem; background: transparent; box-shadow: none; }
.page-actions .tools-actions .btn:hover { background: var(--raised); }
.page-note { margin-top: 10px; max-width: 32rem; color: var(--dim); }
.page-note summary { cursor: pointer; width: fit-content; font-size: .8125rem; }
.page-note .tools-note { margin-top: 10px; }
.tools-status { margin: 0; color: var(--dim); }
.tools-status:not(:empty) { margin-block: 12px; }
.tools-input, .tools-note textarea { width: 100%; }
.tools-note textarea { display: block; margin-block: 8px; resize: vertical; }
.tools-setting, .tools-results li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tools-setting { margin-block: 8px; flex-wrap: wrap; }
.tools-results { padding: 0; list-style: none; }
.tools-results li { border-bottom: 1px solid var(--hair); }
.tools-results a { display: block; flex: 1; padding: 10px 4px; overflow-wrap: anywhere; }
.tools-results a:hover, .reading-tools a:hover { color: var(--pink-hot); }
.tools-faq { margin-block: 12px; }
.tools-faq details { border-bottom: 1px solid var(--hair); padding-block: 10px; }
.tools-faq summary, .reading-tools summary { cursor: pointer; }
.reading-tools { margin-top: 12px; color: var(--dim); }
.reading-tools details { margin-top: 8px; }
.reading-tools a { text-decoration: underline; }
main h2[id] { scroll-margin-top: calc(var(--nav-h) + 20px); }
.reading-progress { position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; border: 0; appearance: none; }
.reading-progress::-webkit-progress-bar { background: transparent; }
.reading-progress::-webkit-progress-value { background: var(--pink); }
.reading-progress::-moz-progress-bar { background: var(--pink); }
.back-top { position: fixed; z-index: 50; bottom: max(16px, env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); background: var(--panel); min-height: 44px; }
.back-top[hidden] { display: none; }

[data-theme="light"] {
  color-scheme: light;
  --ink: #f8f6f2; --panel: #fff; --raised: #efede8;
  --hair: #dedbd5; --hair-lit: #a9a69f; --bone: #211f21;
  --dim: #4f4a51; --dimmer: #615b62; --pink: #a52d60; --pink-hot: #8c204e;
  --livery-ink: #8c204e;
}
[data-theme="light"] body::before { background: var(--ink); }
[data-theme="light"] .nav { background: var(--ink); }
[data-theme="light"] .nav__mark img, [data-theme="light"] .hero__mark { filter: brightness(0); }
[data-theme="light"] .row--you .row__name { color: var(--bone); }
[data-theme="light"] .chip--pod { background: var(--raised); }
[data-theme="light"] .state--error { color: #8b2440; }
[data-theme="light"] .table .neg { color: #992c45; }
@media (max-width: 1060px) { .nav__in { gap: 12px; } .nav__links { gap: 12px; } }
@media (max-width: 370px) { .nav__mark { gap: 4px; } .nav__tools { padding-inline: 8px; } }
@media (max-width: 700px) { .guide { grid-template-columns: 1fr; gap: 20px; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .guide__links a { transition: none; } }

.badge--champion { color: var(--champion-gold); border-color: currentColor; }
a.badge--champion:hover { color: var(--champion-gold); border-color: currentColor; }
@media (prefers-reduced-transparency: reduce) {
  .nav, .vital { background: var(--panel); }
}
@media (prefers-contrast: more) {
  .card, .stat, .tower, .table-wrap { border-color: var(--dimmer); }
}

/* Media stories */
.news-section{padding-bottom:96px}.news-section label{display:block;margin-bottom:8px;color:var(--dim);font-size:14px}.news-section select{max-width:100%;margin-bottom:24px}.news-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin:12px 0 24px}.news-card{min-width:0;padding:24px;border:1px solid var(--hair);border-radius:18px;background:var(--panel)}.news-card__head{display:flex;align-items:center;gap:12px;margin-bottom:18px}.news-logo{position:relative;display:grid;place-items:center;flex:none;width:44px;height:44px;border-radius:50%;background:var(--raised);font-size:12px;font-weight:700;overflow:hidden}.news-logo img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:var(--panel)}.news-meta{color:var(--dim);font-size:13px;margin-top:3px}.news-content{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65}.news-embed-title{font-size:20px}.news-attachment{display:block;margin:14px 0;overflow-wrap:anywhere}.news-attachment img{display:block;max-width:100%;max-height:480px;border-radius:10px;object-fit:contain}.news-link{display:inline-block;margin:12px 14px 0 0;color:var(--pink-hot)}@media(max-width:700px){.news-list{grid-template-columns:1fr}.news-card{padding:18px}}
.news-content p{margin:0 0 1em}.news-content p:last-child{margin-bottom:0}.news-content a{color:var(--pink-hot);text-decoration:underline;text-underline-offset:3px}.news-content code{padding:.1em .3em;border-radius:4px;background:var(--raised);font-size:.9em}.news-content .news-embed-title{margin:1em 0 .4em;line-height:1.2}
.news-content h2,.news-content h3,.news-content h4{margin:1em 0 .45em;line-height:1.22}.news-content blockquote{margin:1em 0;padding:.1em 0 .1em 1em;border-left:3px solid var(--hair-lit);color:var(--dim);white-space:pre-wrap}.news-content .news-small{font-size:.85em;color:var(--dim)}.news-content pre{overflow:auto;padding:12px;background:var(--raised);border-radius:8px}.news-spoiler{display:inline-block}.news-spoiler summary{cursor:pointer;color:var(--pink-hot)}

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  gap: clamp(28px, 6vw, 90px);
  align-items: start;
  padding-block: clamp(36px, 8vw, 110px);
}
.account-intro {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 240px;
  padding: clamp(20px, 5vw, 58px);
  border-radius: var(--r-lg);
  border: 1px solid var(--hair);
  background: linear-gradient(150deg, color-mix(in srgb, var(--pink) 13%, var(--panel)), var(--panel) 75%);
}
.account-intro img { object-fit: contain; margin-bottom: 24px; }
[data-theme="light"] .account-intro img { filter: brightness(0); }
.account-intro h1 {
  margin: 0;
  font: 800 clamp(2rem, 5vw, 4.25rem)/1 var(--f-display);
  letter-spacing: -.05em;
  text-wrap: balance;
}
.account-intro p, .account-panel > p { color: var(--dim); }
.account-panel {
  min-width: 0;
  padding: clamp(18px, 4vw, 36px);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  background: var(--panel);
  overflow-wrap: anywhere;
}
.account-panel h2 { margin: 0 0 12px; font: 750 1.6rem var(--f-display); }
.account-form, .account-providers { display: grid; gap: 12px; }
.account-providers { margin-bottom: 22px; }
.account-form label { display: grid; gap: 5px; font-weight: 600; }
.account-form :is(input, select) { width: 100%; min-width: 0; min-height: 44px; }
.account-form small { color: var(--dim); }
.account-captcha { min-width: 0; }
.account-panel .btn, .news-comments .btn { min-height: 44px; }
.account-panel .account-primary { background: var(--pink); color: #fff; }
.account-status:empty, .news-comments [role="status"]:empty { display: none; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.account-favourites { display: grid; gap: 8px; }
.account-favourites > * { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--raised); border-radius: 10px; }
.account-favourites img { object-fit: contain; }
.news-comments { margin-top: 16px; border-top: 1px solid var(--hair); }
.news-comments summary { padding: 12px 0; cursor: pointer; color: var(--bone); }
.news-comments a { color: var(--pink-hot); }
.news-comments article { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.news-comments article p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.news-comments time { margin-inline-start: 8px; font-size: .75rem; color: var(--dim); }
.news-comments form { margin-top: 12px; }
.news-comments textarea { display: block; resize: vertical; width: 100%; min-width: 0; min-height: 82px; border-radius: 12px; margin: 6px 0 8px; }
@media (max-width: 720px) { .account-layout { grid-template-columns: minmax(0, 1fr); } }
