:root {
  --bg: #09090b;
  --red: #ff2800;
  --yellow: #ffd33d;
  --white: #f5f5f2;
  --muted: #a6a6a1;
  --line: rgba(255, 255, 255, 0.24);
  --load: 0%;
  color-scheme: dark;
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--white);
}

body {
  min-height: 100dvh;
  overscroll-behavior: none;
}

button,
a {
  font: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 5px;
}

#stage {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

#cinematicVideo,
#fallbackImage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#cinematicVideo {
  z-index: 0;
  background: var(--bg);
}

#fallbackImage {
  z-index: 0;
  opacity: 0;
  transition: opacity 320ms ease;
}

#fallbackImage.is-visible {
  opacity: 1;
}

.shade {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 9, 11, 0.64) 0%, rgba(9, 9, 11, 0.14) 34%, transparent 58%),
    linear-gradient(0deg, rgba(9, 9, 11, 0.74) 0%, transparent 40%),
    linear-gradient(180deg, rgba(9, 9, 11, 0.38) 0%, transparent 28%);
  pointer-events: none;
}

.grain {
  position: absolute;
  z-index: 3;
  inset: -50%;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  transform: rotate(8deg);
}

.hud {
  position: fixed;
  z-index: 7;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 28px 34px;
}

.brand {
  justify-self: start;
  color: var(--white);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.07em;
  text-decoration: none;
}

.brand span {
  color: var(--red);
}

.hud-meta {
  justify-self: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  letter-spacing: 0.22em;
}

#soundToggle,
#enterButton {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(9, 9, 11, 0.28);
  padding: 11px 15px;
  color: var(--white);
  font-size: 10px;
  letter-spacing: 0.16em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

#soundToggle {
  justify-self: end;
}

#soundToggle:hover,
#enterButton:hover:not(:disabled) {
  border-color: var(--red);
  background: rgba(255, 40, 0, 0.12);
}

#soundToggle[aria-pressed="true"] {
  border-color: var(--red);
  color: var(--red);
}

.caption {
  position: fixed;
  z-index: 6;
  top: clamp(112px, 17vh, 190px);
  left: clamp(24px, 5.2vw, 90px);
  width: min(820px, 70vw);
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
  pointer-events: none;
}

.caption.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--yellow);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.31em;
  text-transform: uppercase;
}

.caption h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(52px, 7.2vw, 124px);
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: -0.075em;
  text-transform: uppercase;
  text-wrap: balance;
}

.zh {
  margin: 21px 0 0;
  color: rgba(245, 245, 242, 0.84);
  font-size: clamp(12px, 1.05vw, 17px);
  font-weight: 400;
  letter-spacing: 0.15em;
}

.metrics {
  display: flex;
  gap: 28px;
  margin-top: 24px;
}

.metric {
  display: grid;
  gap: 5px;
  padding-left: 12px;
  border-left: 2px solid var(--red);
}

.metric strong {
  color: var(--white);
  font-size: clamp(14px, 1.25vw, 20px);
  letter-spacing: 0.035em;
}

.metric small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.22em;
}

#stage[data-station="control"] .caption h1,
#stage[data-station="driver"] .caption h1,
#stage[data-station="powertrain"] .caption h1 {
  font-size: clamp(46px, 6vw, 104px);
}

#stationNav {
  position: fixed;
  z-index: 8;
  top: 50%;
  right: 30px;
  display: grid;
  gap: 16px;
  transform: translateY(-50%);
}

.station-dot {
  position: relative;
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.36);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.station-dot::before {
  content: "";
  position: absolute;
  inset: -9px;
}

.station-dot:hover {
  transform: scale(1.45);
  background: var(--white);
}

.station-dot[aria-current="true"] {
  background: var(--red);
  box-shadow: 0 0 18px var(--red);
  transform: scale(1.35);
}

.chapter-index {
  position: fixed;
  z-index: 7;
  right: 28px;
  bottom: 25px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.chapter-index i {
  display: block;
  width: 34px;
  height: 1px;
  background: var(--line);
}

.hint {
  position: fixed;
  z-index: 7;
  bottom: 24px;
  left: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.21em;
}

.hint span {
  width: 20px;
  height: 1px;
  background: var(--red);
}

.loader {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 40, 0, 0.08), transparent 34%),
    var(--bg);
  text-align: center;
  transition: opacity 650ms ease, visibility 650ms ease;
}

.loader.is-gone {
  opacity: 0;
  visibility: hidden;
}

.loader-inner {
  width: min(84vw, 980px);
}

.loader-kicker {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.3em;
}

.loader-word {
  position: relative;
  display: inline-block;
  padding-right: 0.08em;
  color: transparent;
  font-size: clamp(116px, 25vw, 350px);
  font-weight: 900;
  line-height: 0.78;
  letter-spacing: -0.105em;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.23);
}

.loader-word::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--red);
  clip-path: inset(0 calc(100% - var(--load)) 0 0);
  transition: clip-path 120ms linear;
  -webkit-text-stroke: 0;
}

.loader-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 620px);
  margin: 34px auto 22px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.loader-status p,
.loader-status span {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.loader.has-error #loaderPercent {
  color: var(--red);
}

#enterButton {
  min-width: 188px;
  margin-top: 12px;
}

#enterButton:disabled {
  opacity: 0.34;
  cursor: wait;
}

.server-help {
  color: var(--yellow);
  font-size: 12px;
  letter-spacing: 0.06em;
}

noscript {
  position: fixed;
  z-index: 40;
  inset: auto 16px 16px;
  padding: 12px;
  background: var(--red);
  color: white;
}

@media (max-width: 700px) {
  .hud {
    grid-template-columns: 1fr 1fr;
    padding: max(18px, env(safe-area-inset-top)) 20px 18px;
  }

  .hud-meta {
    display: none;
  }

  .caption {
    top: auto;
    bottom: max(92px, calc(env(safe-area-inset-bottom) + 76px));
    left: 20px;
    width: min(78vw, 480px);
  }

  .caption h1,
  #stage[data-station="control"] .caption h1,
  #stage[data-station="driver"] .caption h1,
  #stage[data-station="powertrain"] .caption h1 {
    font-size: clamp(42px, 13.5vw, 68px);
  }

  .zh {
    margin-top: 14px;
    font-size: 12px;
  }

  .metrics {
    flex-direction: column;
    gap: 8px;
    margin-top: 17px;
  }

  .metric {
    gap: 2px;
  }

  #stationNav {
    right: 18px;
  }

  .hint {
    bottom: max(21px, env(safe-area-inset-bottom));
    left: 20px;
  }

  .chapter-index {
    right: 18px;
    bottom: max(21px, env(safe-area-inset-bottom));
  }

  .loader-inner {
    width: 88vw;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .caption {
    top: 90px;
  }

  .caption h1,
  #stage[data-station] .caption h1 {
    font-size: clamp(38px, 8vw, 68px);
  }

  .zh,
  .metrics {
    margin-top: 10px;
  }
}

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

  .caption {
    transform: none;
  }
}
