:root {
  color-scheme: dark;
  --bg: #050505;
  --ink: #f4f1ea;
  --muted: #a49f96;
  --red: #e11226;
  --red-dark: #6d0712;
  --bone: #d8d0bf;
  --line: rgba(244, 241, 234, 0.16);
  --panel: rgba(5, 5, 5, 0.62);
  --cyan: #34d6c6;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 580px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 20%, rgba(225, 18, 38, 0.28), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(52, 214, 198, 0.12), transparent 24%),
    linear-gradient(145deg, #090909 0%, #050505 52%, #130306 100%);
}

.stage,
.stage__canvas,
.stage__shade,
.stage__grain {
  position: absolute;
  inset: 0;
}

.stage {
  z-index: 0;
}

.stage__canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage__shade {
  pointer-events: none;
  background:
    radial-gradient(circle at 52% 45%, transparent 0 28%, rgba(0, 0, 0, 0.24) 60%, rgba(0, 0, 0, 0.84) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.24) 38%, rgba(0, 0, 0, 0.38) 64%, rgba(0, 0, 0, 0.78));
}

.stage__grain {
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, transparent, black 18%, black 82%, transparent);
}

.topbar {
  position: fixed;
  z-index: 4;
  top: 22px;
  left: clamp(18px, 4vw, 56px);
  right: clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.brand,
.segments,
.hero,
.rail,
.fallback,
.profile-panel {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--ink);
  background: var(--red);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.34);
}

.brand strong,
.brand small,
.hero__eyebrow,
.hero h1,
.hero p,
.loader p {
  margin: 0;
}

.brand strong {
  display: block;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.segments {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.56);
  backdrop-filter: blur(16px);
}

.segments__item {
  min-width: 86px;
  border: 0;
  background: transparent;
  padding: 12px 15px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 260ms var(--ease), color 260ms var(--ease);
}

.segments__item:hover,
.segments__item.is-active {
  background: var(--ink);
  color: #090909;
}

.hero {
  position: fixed;
  z-index: 3;
  left: clamp(22px, 6vw, 86px);
  bottom: clamp(72px, 12vh, 136px);
  width: min(560px, calc(46vw - 22px));
  display: grid;
  gap: 16px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.88);
  transition: opacity 360ms ease, transform 520ms var(--ease);
}

.hero.is-switching {
  opacity: 0;
  transform: translateY(12px);
}

.hero__eyebrow {
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 12.5ch;
  font-size: clamp(3rem, 6.4vw, 5.8rem);
  font-weight: 950;
  line-height: 0.86;
  text-transform: uppercase;
}

.hero p {
  max-width: 520px;
  color: var(--bone);
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  font-weight: 650;
  line-height: 1.45;
}

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.topic-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.44);
  padding: 0 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 240ms var(--ease), color 240ms var(--ease), border-color 240ms var(--ease);
}

.topic-chip:hover,
.topic-chip.is-active {
  border-color: var(--red);
  background: rgba(225, 18, 38, 0.16);
  color: var(--ink);
}

.topic-note {
  max-width: 520px;
  margin: 0;
  color: var(--bone);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.4;
}

.route-note {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.hero__cta,
.hero__ghost,
.rail__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--ink);
  padding: 0 18px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero__cta {
  background: var(--ink);
  color: #080808;
}

.hero__ghost,
.rail__button {
  background: rgba(5, 5, 5, 0.48);
  color: var(--ink);
}

.hero__ghost.is-hidden {
  display: none;
}

.hero__cta:hover,
.hero__ghost:hover,
.rail__button:hover {
  border-color: var(--red);
  background: var(--red);
  color: var(--ink);
}

.rail {
  position: fixed;
  z-index: 3;
  right: clamp(18px, 4vw, 56px);
  bottom: clamp(24px, 5vh, 52px);
  display: flex;
  align-items: center;
  gap: 14px;
}

.rail__count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.rail__count b {
  color: var(--ink);
}

.fallback {
  position: fixed;
  z-index: 2;
  left: clamp(22px, 6vw, 86px);
  bottom: 24px;
  display: none;
  gap: 10px;
  align-items: center;
  max-width: calc(100vw - 44px);
  color: var(--muted);
  font-size: 0.86rem;
}

.fallback a {
  color: var(--ink);
  font-weight: 900;
}

.asset-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 30px;
  align-items: center;
  border-left: 3px solid var(--red);
  padding: 4px 0 4px 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.fallback--static {
  inset: 0;
  display: grid;
  place-content: center;
  padding: 28px;
  background: var(--bg);
}

.loader {
  position: fixed;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 12px;
  background: rgba(5, 5, 5, 0.82);
  transition: opacity 420ms ease, visibility 420ms ease;
}

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

.loader span {
  width: 72px;
  height: 6px;
  background: linear-gradient(90deg, var(--red), var(--ink), var(--cyan));
  animation: load 760ms linear infinite alternate;
}

.loader p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.profile-panel {
  position: fixed;
  z-index: 7;
  right: 18px;
  top: 106px;
  display: none;
  width: min(360px, calc(100vw - 36px));
  max-height: calc(100vh - 128px);
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.82);
  padding: 12px;
  color: var(--bone);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  backdrop-filter: blur(18px);
}

.profile-panel.is-visible {
  display: block;
}

@keyframes load {
  from {
    transform: scaleX(0.35);
  }
  to {
    transform: scaleX(1);
  }
}

@media (max-width: 760px) {
  .shell {
    min-height: 620px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand__text {
    display: none;
  }

  .segments {
    max-width: calc(100vw - 92px);
    overflow: hidden;
  }

  .segments__item {
    min-width: auto;
    padding: 11px 12px;
  }

  .hero {
    left: 20px;
    right: 20px;
    bottom: 86px;
    width: auto;
  }

  .hero h1 {
    max-width: 10ch;
    font-size: clamp(2.65rem, 15vw, 4.7rem);
  }

  .hero p {
    max-width: 94%;
    font-size: 0.98rem;
  }

  .topic-note {
    font-size: 0.88rem;
  }

  .route-note {
    font-size: 0.68rem;
  }

  .hero__actions {
    align-items: stretch;
  }

  .hero__cta,
  .hero__ghost {
    min-height: 46px;
    padding: 0 14px;
  }

  .rail {
    left: 20px;
    right: 20px;
    bottom: 20px;
    justify-content: space-between;
  }

  .asset-status {
    width: 100%;
  }
}

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