:root {
  color-scheme: dark;
  --page-back: url("assets/shared/backgrounds/dark-16x9.webp");
  --bg: #080706;
  --bg-soft: #17100c;
  --panel: rgba(18, 12, 9, 0.8);
  --panel-strong: rgba(36, 22, 15, 0.86);
  --text: #fff2df;
  --muted: #c9aa8c;
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.2);
  --line: rgba(255, 184, 95, 0.28);
  --font-display: "Cinzel", "Cormorant Garamond", Georgia, serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
  --rail-width: 4.75rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page-back: url("assets/shared/backgrounds/light-16x9.webp");
  --bg: #efe2c7;
  --bg-soft: #b9a16f;
  --panel: rgba(46, 58, 48, 0.8);
  --panel-strong: rgba(220, 202, 160, 0.9);
  --text: #1b2418;
  --muted: #32422e;
  --accent: #6f2f14;
  --accent-soft: rgba(111, 47, 20, 0.2);
  --line: rgba(50, 66, 46, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--muted);
  background:
    var(--page-back),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
  background-attachment: fixed, scroll;
  background-position: center, center;
  background-repeat: no-repeat;
  background-size: cover, cover;
  font-family: var(--font-body), ui-serif, Georgia, serif;
  font-size: 18px;
  transition:
    background 1000ms ease,
    color 1000ms ease;
}

:root[data-theme="light"] body {
  background:
    linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)),
    var(--page-back),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
  background-attachment: fixed, fixed, scroll;
  background-position: center, center, center;
  background-repeat: no-repeat;
  background-size: 100% 100%, cover, cover;
}

@media (min-aspect-ratio: 2/1) {
  :root {
    --page-back: url("assets/shared/backgrounds/dark-21x9.webp");
  }

  :root[data-theme="light"] {
    --page-back: url("assets/shared/backgrounds/light-21x9.webp");
  }

}

@media (max-aspect-ratio: 4/5) {
  :root {
    --page-back: url("assets/shared/backgrounds/dark-mobile.webp");
  }

  :root[data-theme="light"] {
    --page-back: url("assets/shared/backgrounds/light-mobile.webp");
  }

}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 1300ms;
  animation-timing-function: cubic-bezier(0.45, 0, 0.2, 1);
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  animation-name: none;
}

::view-transition-new(root) {
  animation-name: theme-reveal;
}

@keyframes theme-reveal {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.75rem;
  width: var(--rail-width);
  height: 100vh;
  padding: 0.75rem;
  border-right: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: none;
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.18);
  transition:
    background 1000ms ease,
    border-color 1000ms ease,
    box-shadow 1000ms ease;
}

:root[data-theme="light"] .rail {
  box-shadow: 10px 0 42px rgba(126, 64, 20, 0.14);
}

.rail-button,
.theme-orbit {
  position: relative;
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 1000ms ease,
    color 1000ms ease;
}

.rail-button:hover,
.theme-orbit:hover,
.rail-button:focus-visible,
.theme-orbit:focus-visible {
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.home-button {
  text-decoration: none;
}

.home-button img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-button span {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0;
}

.menu-icon {
  display: grid;
  gap: 0.28rem;
}

.menu-icon span {
  display: block;
  width: 1.45rem;
  height: 0.14rem;
  border-radius: 999px;
  background: currentColor;
}

.search-icon {
  width: 1.45rem;
  height: 1.45rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
}

.theme-orbit {
  align-self: end;
}

.sky-track {
  position: relative;
  width: 2.35rem;
  height: 1.7rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px 999px 0.5rem 0.5rem;
  background: linear-gradient(180deg, #111827 0%, #34160b 100%);
  transition:
    background 1000ms ease,
    border-color 1000ms ease;
}

.sky-track::before {
  position: absolute;
  inset: auto 0.25rem 0.2rem;
  height: 0.18rem;
  border-radius: 999px;
  background: rgba(255, 180, 95, 0.38);
  content: "";
}

.sky-body {
  position: absolute;
  display: grid;
  place-items: center;
  left: 50%;
  top: 0.24rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, 0);
  transition:
    background 1000ms ease,
    box-shadow 1000ms ease;
}

.moon-crescent {
  position: relative;
  width: 0.62rem;
  height: 0.72rem;
  overflow: hidden;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 36%, rgba(255, 255, 255, 0.92), transparent 0.08rem),
    radial-gradient(circle at 42% 66%, rgba(255, 255, 255, 0.5), transparent 0.07rem),
    linear-gradient(105deg, #f7f0df 0%, #bdb4a5 36%, rgba(189, 180, 165, 0.28) 58%, transparent 70%);
  filter: drop-shadow(0 0 0.42rem rgba(245, 243, 255, 0.58));
  transition:
    opacity 1000ms ease,
    transform 1000ms ease;
}

.moon-crescent::after {
  position: absolute;
  inset: -0.02rem -0.1rem -0.02rem 0.2rem;
  border-radius: 50%;
  background: #111827;
  content: "";
}

.moon-crescent::before {
  position: absolute;
  z-index: 1;
  inset: 0.08rem auto auto 0.14rem;
  width: 0.24rem;
  height: 0.55rem;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.48), transparent 70%);
  content: "";
  transform: rotate(8deg);
}

.theme-animating .sky-body {
  animation: celestial-swap 1300ms cubic-bezier(0.45, 0, 0.2, 1);
}

:root[data-theme="light"] .sky-track {
  background: linear-gradient(180deg, #9bdcff 0%, #ffd38a 100%);
}

:root[data-theme="light"] .sky-body {
  background: #ffd166;
  box-shadow:
    inset 0 0 0 #ffd166,
    0 0 1rem rgba(255, 190, 79, 0.9);
}

:root[data-theme="light"] .moon-crescent {
  opacity: 0;
  transform: scale(0.35);
}

@keyframes celestial-swap {
  0% {
    transform: translate(-50%, 0);
    opacity: 1;
  }

  50% {
    transform: translate(1.8rem, 0.28rem);
    opacity: 0;
  }

  50.01% {
    transform: translate(-2.35rem, 0.28rem);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.section-drawer {
  position: fixed;
  top: 0.75rem;
  bottom: auto;
  left: var(--rail-width);
  z-index: 4;
  display: grid;
  align-content: start;
  gap: 0.16rem;
  width: max-content;
  min-width: 11.5rem;
  max-width: calc(100vw - var(--rail-width) - 1rem);
  max-height: calc(100vh - 1.5rem);
  padding: 0.9rem;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--panel);
  backdrop-filter: none;
  box-shadow: 18px 0 70px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  transform: translateX(calc(-100% - var(--rail-width) - 1rem));
  transition:
    transform 180ms ease,
    background 1000ms ease,
    border-color 1000ms ease,
    box-shadow 1000ms ease;
}

:root[data-theme="light"] .section-drawer {
  background: rgba(46, 58, 48, 0.86);
  box-shadow: 18px 0 70px rgba(29, 39, 25, 0.18);
}

:root[data-theme="light"] .section-drawer button {
  color: #f5e7bf;
  text-shadow: 0 1px 0 rgba(22, 27, 19, 0.42);
}

:root[data-theme="light"] .section-drawer button:hover,
:root[data-theme="light"] .section-drawer button:focus-visible,
:root[data-theme="light"] .section-drawer button.active {
  background: rgba(224, 202, 151, 0.95);
  color: #1b2418;
}

body.menu-open .section-drawer {
  transform: translateX(0);
}

.nav-level {
  display: none;
  gap: 0.16rem;
}

.nav-level.active {
  display: grid;
}

.nav-subtitle {
  display: block;
  width: 100%;
  min-height: 2.35rem;
  padding: 0.46rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel-strong);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-chip-grid {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 0.18rem;
  padding: 0.08rem 0 0.35rem;
}

.nav-chip-grid:last-child {
  grid-template-columns: repeat(3, max-content);
}

.section-drawer button {
  min-height: 2.35rem;
  padding: 0.46rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: left;
  text-decoration: none;
}

.nav-chip-grid button {
  width: auto;
  min-width: 6.5rem;
  min-height: 3.2rem;
  padding: 0.5rem 0.65rem;
  font-size: 1.35rem;
  white-space: nowrap;
}

.section-drawer button:hover,
.section-drawer button:focus-visible,
.section-drawer button.active {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--text);
  outline: none;
}

.nav-parent::before {
  content: "‹ ";
}

.page {
  display: grid;
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 2rem);
  place-items: center;
}

.is-hidden {
  display: none !important;
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(13.7rem, 1fr));
  gap: 0.35rem;
  width: min(100%, 86rem);
}

.sections-grid a {
  display: flex;
  position: relative;
  isolation: isolate;
  align-items: end;
  overflow: hidden;
  min-height: 10.1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background-color: #24160f;
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition:
    background 1000ms ease,
    color 1000ms ease,
    box-shadow 1000ms ease;
}

.sections-grid a::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 48%),
    rgba(0, 0, 0, 0.42);
  content: "";
}

.sections-grid a img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  transition: transform 220ms ease;
}

.sections-grid a {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.sections-grid a span {
  position: relative;
  z-index: 2;
}

:root[data-theme="light"] .sections-grid a {
  background-color: #dccaa0;
  box-shadow: 0 18px 50px rgba(29, 39, 25, 0.16);
  color: #f5e7bf;
}

:root[data-theme="light"] .sections-grid a::before {
  background:
    linear-gradient(135deg, rgba(46, 58, 48, 0.16), rgba(185, 161, 111, 0.3) 48%, transparent 70%),
    rgba(29, 39, 25, 0.38);
}

:root:not([data-theme="light"]) .sections-grid a {
  background-color: #24160f;
  color: var(--muted);
}

:root:not([data-theme="light"]) .sections-grid a::before {
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(143, 29, 16, 0.22) 48%, transparent 70%),
    rgba(0, 0, 0, 0.42);
}

.sections-grid a:hover,
.sections-grid a:focus-visible {
  outline: none;
}

.sections-grid a:hover img,
.sections-grid a:focus-visible img {
  transform: scale(1.15);
}

.race-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  width: min(100%, 92rem);
  min-height: 0;
  position: relative;
}

.race-view.has-selection {
  grid-template-columns: minmax(0, 1fr);
}

.race-detail,
.race-index {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
}

.race-detail {
  position: relative;
  z-index: 2;
  display: block;
  overflow: visible;
  min-height: 0;
  background: var(--panel);
}

.race-view:not(.has-selection) .race-detail {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.race-empty {
  grid-column: 1 / -1;
  display: grid;
  align-content: center;
  max-width: none;
  min-height: 0;
  padding: clamp(2rem, 5vw, 5rem);
}

.race-picker {
  justify-self: center;
  width: min(100%, 92rem);
}

.race-picker-grid {
  display: grid;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0;
}

.race-picker-section {
  display: grid;
  gap: 0.2rem;
}

.race-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  margin: 0;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel-strong);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.race-picker-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(16.45rem, 1fr));
  gap: 0.35rem;
  justify-content: center;
}

.race-picker-section:last-child .race-picker-list {
  grid-template-columns: repeat(3, minmax(26.9rem, 1fr));
}

.screen-picker {
  width: min(100%, 92rem);
}

.screen-picker-grid {
  width: 100%;
}

.screen-picker-section {
  gap: 0;
}

.screen-picker-heading {
  width: 100%;
  cursor: pointer;
}

.screen-picker-mark {
  position: relative;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.screen-picker-mark::before,
.screen-picker-mark::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.9rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
  transition: transform 260ms ease, opacity 260ms ease;
}

.screen-picker-mark::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.screen-picker-section.is-open .screen-picker-mark::after {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg) scaleX(0.2);
}

.screen-picker-panel {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  opacity: 0;
  transition: grid-template-rows 320ms ease, opacity 240ms ease;
}

.screen-picker-section.is-open .screen-picker-panel {
  grid-template-rows: 1fr;
  opacity: 1;
}

.screen-picker-panel > .screen-picker-list {
  min-height: 0;
  padding-top: 0.2rem;
}

.screen-picker-list {
  grid-template-columns: repeat(4, minmax(16.45rem, 1fr));
}

.screen-picker-section:last-child .screen-picker-list {
  grid-template-columns: repeat(3, minmax(26.9rem, 1fr));
}

.screen-page {
  display: grid;
  gap: clamp(1.25rem, 2vw, 2rem);
  min-height: min(48rem, calc(100vh - 9rem));
  padding: clamp(2rem, 4vw, 4rem);
}

.screen-back-button {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--panel-strong);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.screen-back-button span:first-child {
  font-size: 1.8rem;
  line-height: 0.8;
}

.screen-back-button:hover,
.screen-back-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.screen-page-header {
  display: grid;
  gap: 0.35rem;
}

.screen-page-header h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 7vw, 6rem);
  line-height: 0.95;
}

.screen-page-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  align-self: start;
}

.screen-info-card {
  display: grid;
  align-content: end;
  min-height: 14rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(143, 29, 16, 0.22) 48%, transparent 74%),
    rgba(36, 22, 15, 0.92);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.14);
}

.screen-info-card h2 {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.1;
}

:root[data-theme="light"] .screen-back-button {
  background: rgba(46, 58, 48, 0.9);
  color: #f5e7bf;
}

:root[data-theme="light"] .screen-info-card {
  background:
    linear-gradient(135deg, rgba(111, 47, 20, 0.14), rgba(185, 161, 111, 0.24) 50%, transparent 74%),
    rgba(220, 202, 160, 0.95);
}

:root[data-theme="light"] .screen-info-card h2 {
  color: #1b2418;
}

.race-picker-list .race-index-link {
  display: flex;
  position: relative;
  isolation: isolate;
  align-items: end;
  overflow: hidden;
  min-height: 10.1rem;
  margin-top: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background-color: #24160f;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.race-picker-list .race-index-link::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(143, 29, 16, 0.22) 48%, transparent 70%),
    rgba(0, 0, 0, 0.42);
  content: "";
  transition: transform 220ms ease;
}

.race-picker-list .race-index-link:hover,
.race-picker-list .race-index-link:focus-visible {
  border-color: var(--line);
  background: #24160f;
  color: var(--muted);
  outline: none;
}

.race-picker-list .race-index-link:hover::before,
.race-picker-list .race-index-link:focus-visible::before {
  transform: scale(1.15);
}

:root[data-theme="light"] .race-picker-list .race-index-link {
  background-color: #dccaa0;
  color: #1b2418;
}

:root[data-theme="light"] .race-picker-list .race-index-link::before {
  background:
    linear-gradient(135deg, rgba(111, 47, 20, 0.12), rgba(185, 161, 111, 0.22) 48%, transparent 70%),
    rgba(255, 244, 218, 0.2);
}

:root[data-theme="light"] .race-picker-heading,
:root[data-theme="light"] .race-group-toggle {
  background: rgba(46, 58, 48, 0.88);
  color: #f5e7bf;
}

:root[data-theme="light"] .race-index-link {
  color: #f5e7bf;
}

:root[data-theme="light"] .race-index-link.active {
  color: #f0b35a;
}

.race-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.race-empty h1,
.race-content h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  line-height: 0.95;
}

.race-empty p:not(.race-kicker),
.race-content p:not(.race-kicker) {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1.45;
}

.race-tabs {
  display: grid;
  position: absolute;
  top: 1.1rem;
  left: 0;
  z-index: 3;
  align-content: start;
  gap: 0.24rem;
  width: 3.2rem;
  padding: 0;
  border-right: 0;
  background: transparent;
}

.race-tab-hit {
  position: relative;
  display: block;
  width: 3rem;
}

.race-tab-hit::before {
  position: absolute;
  inset: 0 auto 0 -1.5rem;
  width: 4.5rem;
  content: "";
}

.race-tabs button {
  transform: translateX(-0.45rem);
  clip-path: inset(0 2.55rem 0 0);
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition:
    transform 160ms ease,
    clip-path 160ms ease;
}

.race-tab-hit:hover button,
.race-tab-hit:focus-within button,
.race-tabs button:hover,
.race-tabs button:focus-visible,
.race-tabs button.active {
  transform: translateX(-3rem);
  clip-path: inset(0 0 0 0);
}

.race-tabs button.active,
.race-tabs button:hover,
.race-tabs button:focus-visible {
  background: var(--panel-strong);
  color: var(--text);
  outline: none;
}

.race-content {
  position: relative;
  z-index: 2;
  align-self: stretch;
  min-height: 100%;
  padding: clamp(2rem, 5vw, 5rem);
  border-radius: 0.5rem;
  background: transparent;
  pointer-events: auto;
}

.race-index-hit {
  position: absolute;
  top: 0;
  left: 100%;
  z-index: 0;
  width: 5rem;
  max-height: calc(100vh - clamp(1rem, 3vw, 2rem) * 2);
  overflow: hidden;
  transform: none;
  transition: width 180ms ease;
}

.race-index {
  width: 15rem;
  height: auto;
  max-height: calc(100vh - clamp(1rem, 3vw, 2rem) * 2);
  align-self: start;
  overflow: hidden auto;
  padding: 0.75rem;
  transform: translateX(calc(1rem - 15rem));
  clip-path: none;
  transition:
    transform 180ms ease;
}

.race-view:not(.has-selection) .race-index-hit {
  display: none;
}

.race-index-hit:hover .race-index,
.race-index-hit:focus-within .race-index {
  transform: translateX(0);
}

.race-index-hit:hover,
.race-index-hit:focus-within {
  width: 15rem;
}

.race-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2.9rem;
  margin-top: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.race-group-toggle span:first-child {
  border-bottom: 0;
}

.race-view.has-selection .race-group-toggle {
  pointer-events: none;
}

.race-group-toggle:first-child {
  margin-top: 0;
}

.toggle-mark {
  display: none;
}

.race-group-list {
  display: grid;
  margin-bottom: 0.5rem;
}

.race-group-list::before {
  content: "";
}

.race-index-link {
  display: block;
  min-height: 2.3rem;
  margin-top: 0.18rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}

.race-index-link:hover,
.race-index-link:focus-visible {
  border-color: var(--line);
  background: var(--panel-strong);
  color: var(--text);
  outline: none;
}

.race-index-link.active {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  font-size: 1.28rem;
}

.race-index-link.active span {
  color: inherit;
  text-shadow: 0 0 0.35rem var(--accent-soft);
}

.search-panel {
  position: fixed;
  top: 5.75rem;
  left: calc(var(--rail-width) + 0.25rem);
  z-index: 6;
  width: min(21rem, calc(100vw - 1.5rem));
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel-strong);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-1rem) scaleX(0.08);
  transform-origin: left center;
  transition:
    opacity 240ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

body.search-open .search-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scaleX(1);
}

.search-panel label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.search-panel input {
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  outline: none;
  padding: 0 0.85rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
}

.search-panel input:focus {
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 720px) {
  :root {
    --rail-width: 4.25rem;
  }

  .rail {
    padding: 0.5rem;
  }

  .rail-button,
  .theme-orbit {
    width: 3rem;
    height: 3rem;
  }

  .section-drawer {
    width: min(13.75rem, calc(100vw - var(--rail-width)));
    min-width: 0;
  }

  .sections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .race-view {
    grid-template-columns: 1fr;
  }

  .race-detail {
    grid-template-columns: 1fr;
  }

  .race-tabs {
    position: static;
    grid-auto-flow: column;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    width: auto;
    padding: 0.45rem;
    transform: none;
  }

  .race-tabs button {
    transform: none;
    min-width: 5.6rem;
    min-height: 2.4rem;
    writing-mode: horizontal-tb;
  }

  .race-index {
    width: auto;
    max-height: none;
    clip-path: none;
  }

  .race-index-hit {
    position: static;
    width: auto;
    max-height: none;
    transform: none;
  }

  .race-picker-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .sections-grid {
    grid-template-columns: 1fr;
  }
}
