:root {
  --obsidian: #05060a;
  --ink: #0b1020;
  --panel: #101528;
  --frost: #eef1ff;
  --muted: #98a1bb;
  --cobalt: #334bff;
  --magenta: #fd2cff;
  --cyan: #47e7ff;
  --line: rgba(199, 210, 255, 0.22);
  --progress: 0;
  --display: "Bahnschrift SemiCondensed", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --body: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; }

html { background: var(--obsidian); }

body {
  margin: 0;
  color: var(--frost);
  background: var(--obsidian);
  font-family: var(--body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, a { color: inherit; }
button { font: inherit; }
img, video { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: 12px;
  padding: 10px 14px;
  color: var(--obsidian);
  background: var(--cyan);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.utility,
.eyebrow,
.scene__data,
.scene__annotation,
.mode-stage__visual figcaption,
.concept-note,
.topbar__meta,
.chapter-nav,
.hinge__readout {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(115deg, rgba(51, 75, 255, 0.14), transparent 34%),
    var(--obsidian);
  transition: opacity 500ms ease, visibility 500ms ease;
}

.loader::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 72px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cobalt) 40%, var(--magenta) 60%, transparent);
  box-shadow: 0 0 22px rgba(71, 231, 255, 0.42);
}

.loader__inner { width: min(620px, 100%); position: relative; z-index: 1; }
.loader .utility { color: var(--cyan); font-size: 11px; }
.loader h1 {
  margin: 14px 0 44px;
  font-family: var(--display);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: 0.025em;
}

.loader__track { height: 2px; background: rgba(255,255,255,0.14); overflow: hidden; }
.loader__track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cobalt), var(--cyan));
  box-shadow: 0 0 16px var(--cyan);
  transition: width 300ms ease;
}

.loader__status { margin: 10px 0 28px; color: var(--muted); font: 11px var(--mono); }
.enter-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 15px 0;
  border: 0;
  border-top: 1px solid var(--frost);
  border-bottom: 1px solid var(--frost);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}
.enter-button:disabled { opacity: 0.35; cursor: wait; }
.enter-button:not(:disabled):hover { color: var(--cyan); border-color: var(--cyan); }

body:not(.is-loading) .loader { opacity: 0; visibility: hidden; pointer-events: none; }

.topbar {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(5,6,10,0.78), rgba(5,6,10,0));
}

.brand {
  width: fit-content;
  color: var(--frost);
  text-decoration: none;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.025em;
}
.brand__prefix { letter-spacing: 0.08em; }
.brand__slash { padding: 0 8px; color: var(--magenta); }

.topbar__meta { display: flex; gap: 18px; color: rgba(238,241,255,0.55); font-size: 9px; }

.sound {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 10px var(--mono);
  cursor: pointer;
}
.sound__dot { width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; }
.sound[aria-pressed="true"] { color: var(--cyan); }
.sound[aria-pressed="true"] .sound__dot { background: currentColor; box-shadow: 0 0 10px currentColor; }

.chapter-nav {
  position: fixed;
  z-index: 110;
  right: clamp(20px, 3vw, 48px);
  top: 50%;
  display: grid;
  gap: 9px;
  transform: translateY(-50%);
}

.chapter-nav__item {
  display: grid;
  grid-template-columns: 24px 30px 38px;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: rgba(238,241,255,0.42);
  font-size: 9px;
  cursor: pointer;
  text-align: left;
}
.chapter-nav__item i { height: 1px; background: currentColor; transform-origin: right; transform: scaleX(0.35); transition: transform 220ms ease; }
.chapter-nav__item b { font: inherit; opacity: 0; transform: translateX(8px); transition: 220ms ease; }
.chapter-nav__item:hover,
.chapter-nav__item.is-current { color: var(--frost); }
.chapter-nav__item:hover i,
.chapter-nav__item.is-current i { transform: scaleX(1); }
.chapter-nav__item:hover b,
.chapter-nav__item.is-current b { opacity: 1; transform: none; }

.hinge {
  position: fixed;
  z-index: 105;
  left: 0;
  right: 0;
  top: 71px;
  height: 2px;
  pointer-events: none;
}
.hinge__base {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 24.8%, rgba(238,241,255,0.34) 25%, transparent 25.2%, transparent 49.8%, rgba(238,241,255,0.34) 50%, transparent 50.2%, transparent 74.8%, rgba(238,241,255,0.34) 75%, transparent 75.2%),
    var(--line);
}
.hinge__energy {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--progress) * 100%);
  height: 2px;
  background: linear-gradient(90deg, var(--cobalt), var(--cyan) 72%, var(--magenta));
  box-shadow: 0 0 14px rgba(71,231,255,0.7);
  transition: width 600ms cubic-bezier(.22,.76,.2,1);
}
.hinge__node {
  position: absolute;
  top: -3px;
  left: calc(var(--progress) * 100%);
  width: 8px;
  height: 8px;
  border: 1px solid var(--cyan);
  background: var(--obsidian);
  box-shadow: 0 0 12px rgba(71,231,255,0.75);
  transform: translateX(-50%) rotate(45deg);
  transition: left 600ms cubic-bezier(.22,.76,.2,1);
}
.hinge__readout {
  position: absolute;
  right: clamp(20px, 4vw, 64px);
  top: 10px;
  color: var(--cyan);
  font-size: 9px;
}

.experience {
  width: 100%;
  height: 100svh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.experience::-webkit-scrollbar { display: none; }

.scene {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--obsidian);
}

.scene__media,
.scene__grade,
.scene__grain { position: absolute; inset: 0; }

.scene__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.94) contrast(1.04);
}

.scene__grade {
  background:
    radial-gradient(circle at 55% 48%, transparent 30%, rgba(5,6,10,0.26) 72%),
    linear-gradient(90deg, rgba(5,6,10,0.72) 0%, rgba(5,6,10,0.06) 46%, rgba(5,6,10,0.22) 100%);
}
.scene__grade--left { background: linear-gradient(90deg, rgba(5,6,10,0.25), transparent 45%, rgba(5,6,10,0.8) 100%); }
.scene__grade--reality { background: linear-gradient(90deg, rgba(5,6,10,0.78) 0%, rgba(5,6,10,0.15) 56%, rgba(5,6,10,0.45) 100%); }
.scene__grain {
  opacity: 0.075;
  mix-blend-mode: soft-light;
  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='.8'/%3E%3C/svg%3E");
}

.scene__copy {
  position: absolute;
  z-index: 3;
  left: clamp(24px, 7vw, 112px);
  width: min(620px, 55vw);
}
.scene__copy--upper { top: clamp(112px, 14vh, 160px); }
.scene__copy--lower { top: auto; bottom: clamp(62px, 8vh, 88px); }
.scene__copy--right { left: auto; right: clamp(92px, 8vw, 140px); width: min(720px, 52vw); }
.scene__copy--left-narrow { width: min(520px, 44vw); }

.eyebrow { margin: 0 0 18px; color: var(--cyan); font-size: 10px; }
.eyebrow span { color: var(--frost); margin-right: 12px; }

.scene h1,
.scene h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: 0.022em;
  text-wrap: balance;
  color: var(--frost);
  background: linear-gradient(180deg, #ffffff 0%, #dce2ff 58%, #aab5df 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 32px rgba(88, 110, 255, 0.16);
}
.scene h1::after,
.scene h2::after {
  content: "";
  display: block;
  width: 68px;
  height: 2px;
  margin-top: 16px;
  background: linear-gradient(90deg, var(--cyan), var(--cobalt) 58%, transparent);
  box-shadow: 0 0 12px rgba(71,231,255,0.5);
}
.scene h1 { font-size: clamp(38px, 4.1vw, 62px); }
.scene h2 { font-size: clamp(36px, 3.8vw, 58px); }
.scene--shift h2 { font-size: clamp(34px, 3.6vw, 54px); }
.scene--modes h2 { font-size: clamp(34px, 3.2vw, 44px); }
.lede { max-width: 540px; margin: 18px 0 0; color: rgba(238,241,255,0.72); font-size: clamp(13px, 1vw, 16px); line-height: 1.78; }

.scene__data {
  position: absolute;
  z-index: 3;
  left: clamp(24px, 7vw, 112px);
  display: flex;
  gap: 28px;
  color: rgba(238,241,255,0.5);
  font-size: 9px;
}
.scene__data--lower { top: auto; bottom: 86px; }
.scene__annotation { position: absolute; z-index: 3; left: clamp(24px, 7vw, 112px); top: 96px; color: var(--muted); font-size: 9px; }

.scroll-cue {
  position: absolute;
  z-index: 4;
  left: clamp(24px, 7vw, 112px);
  bottom: 34px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--frost);
  font: 10px var(--mono);
  cursor: pointer;
}
.scroll-cue i { position: relative; width: 44px; height: 1px; background: var(--cyan); }
.scroll-cue i::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-right: 1px solid var(--cyan); border-bottom: 1px solid var(--cyan); transform: rotate(45deg); }

.scene--modes {
  display: grid;
  place-items: center;
  padding: 90px clamp(32px, 7vw, 112px) 64px;
  background:
    linear-gradient(120deg, rgba(51,75,255,0.09), transparent 38%),
    repeating-linear-gradient(90deg, transparent 0 12.4%, rgba(255,255,255,0.025) 12.5%),
    var(--obsidian);
}

.mode-stage {
  width: min(1500px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.7fr);
  gap: clamp(36px, 6vw, 92px);
  align-items: center;
}

.mode-stage__visual {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(199,210,255,0.18);
  background: #07090f;
  box-shadow: 0 28px 90px rgba(0,0,0,0.4);
}
.mode-stage__visual::before,
.mode-stage__visual::after { content: ""; position: absolute; z-index: 3; width: 48px; height: 48px; pointer-events: none; }
.mode-stage__visual::before { left: 12px; top: 12px; border-left: 1px solid var(--cyan); border-top: 1px solid var(--cyan); }
.mode-stage__visual::after { right: 12px; bottom: 12px; border-right: 1px solid var(--magenta); border-bottom: 1px solid var(--magenta); }
.mode-stage__visual img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: opacity 180ms ease, transform 700ms cubic-bezier(.2,.74,.2,1); }
.mode-stage__visual.is-switching img { opacity: 0; transform: scale(1.018); }
.mode-stage__visual figcaption { position: absolute; z-index: 4; left: 22px; right: 22px; bottom: 18px; display: flex; justify-content: space-between; color: rgba(238,241,255,0.68); font-size: 9px; }
.mode-stage__scan { position: absolute; z-index: 2; inset: 0; transform: translateX(-110%); background: linear-gradient(90deg, transparent 44%, rgba(71,231,255,0.2) 50%, transparent 56%); }
.mode-stage__visual.is-scanning .mode-stage__scan { animation: scan 720ms ease-out; }
@keyframes scan { to { transform: translateX(110%); } }

.mode-description { min-height: 5.6em; margin: 24px 0 0; color: rgba(238,241,255,0.74); font-size: 15px; line-height: 1.8; }
.concept-note { margin: 18px 0 28px; color: var(--muted); font-size: 9px; line-height: 1.6; }

.mode-tabs { display: grid; border-top: 1px solid rgba(255,255,255,0.16); scrollbar-width: none; }
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tabs button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.11);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: color 180ms ease, padding-left 180ms ease;
}
.mode-tabs button span { font: 9px var(--mono); }
.mode-tabs button:hover,
.mode-tabs button[aria-selected="true"] { color: var(--frost); padding-left: 10px; }
.mode-tabs button[aria-selected="true"] span { color: var(--cyan); }

.reality-note {
  position: absolute;
  z-index: 4;
  left: clamp(24px, 7vw, 112px);
  bottom: 36px;
  max-width: 510px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: baseline;
  color: var(--muted);
  font-size: 11px;
}
.reality-note span { color: var(--cyan); font: 9px var(--mono); white-space: nowrap; }
.reality-note p { margin: 0; }

.replay {
  position: absolute;
  z-index: 4;
  right: clamp(24px, 7vw, 112px);
  bottom: 32px;
  display: flex;
  min-width: 170px;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--frost);
  border-bottom: 1px solid var(--frost);
  color: var(--frost);
  text-decoration: none;
  font-size: 12px;
}
.replay:hover { color: var(--cyan); border-color: var(--cyan); }

.transition-curtain {
  position: fixed;
  z-index: 78;
  inset: 0;
  background: var(--obsidian);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.transition-curtain.is-active { opacity: 0.78; }

noscript { position: fixed; z-index: 1000; inset: auto 0 0; padding: 14px; background: #fff; color: #000; text-align: center; }

@media (max-width: 900px) {
  .topbar { height: 62px; grid-template-columns: 1fr auto; padding: 0 20px; }
  .topbar__meta { display: none; }
  .brand { font-size: 17px; }
  .chapter-nav {
    top: auto;
    right: 18px;
    left: 18px;
    bottom: 16px;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    transform: none;
  }
  .chapter-nav__item { grid-template-columns: auto 1fr; gap: 6px; padding: 10px 6px; }
  .chapter-nav__item b { display: none; }
  .chapter-nav__item i { transform-origin: left; }
  .loader::after { top: 62px; }
  .hinge { top: 61px; }
  .hinge__readout { right: 20px; top: 9px; }
  .scene__video { object-fit: contain; background: #05060a; }
  .scene__grade { background: linear-gradient(180deg, rgba(5,6,10,0.1) 30%, rgba(5,6,10,0.88) 78%, var(--obsidian)); }
  .scene__copy { left: 20px; right: 20px; width: auto; }
  .scene__copy--upper { top: 86px; }
  .scene__copy--lower,
  .scene__copy--right { top: auto; bottom: 108px; left: 20px; right: 20px; width: auto; }
  .scene__copy--left-narrow { width: auto; }
  .scene h1 { font-size: clamp(36px, 7.6vw, 54px); }
  .scene h2 { font-size: clamp(34px, 7.2vw, 50px); }
  .lede { max-width: 620px; font-size: 13px; line-height: 1.7; }
  .scene__data { left: 20px; gap: 12px; flex-wrap: wrap; }
  .scene__data--lower { top: auto; bottom: 98px; }
  .scene__annotation { left: 20px; top: 82px; }
  .scroll-cue { display: none; }
  .mode-stage { grid-template-columns: 1fr; gap: 24px; }
  .scene--modes { display: block; padding: 86px 20px 104px; overflow-y: auto; }
  .mode-stage__copy { display: grid; grid-template-columns: 1fr; }
  .mode-stage__copy h2 { font-size: clamp(34px, 7.2vw, 48px); }
  .mode-description { min-height: auto; font-size: 13px; }
  .mode-tabs { grid-template-columns: repeat(5, max-content); overflow-x: auto; border-bottom: 1px solid rgba(255,255,255,0.14); }
  .mode-tabs button { grid-template-columns: 1fr; min-width: 68px; padding: 11px 6px; text-align: center; border-bottom: 0; font-size: 12px; }
  .mode-tabs button:hover,
  .mode-tabs button[aria-selected="true"] { padding-left: 8px; }
  .reality-note { left: 20px; right: 20px; bottom: 80px; display: block; font-size: 10px; }
  .reality-note p { margin-top: 5px; }
  .replay { right: 20px; bottom: 82px; min-width: 130px; }
}

@media (max-width: 620px) {
  .sound { font-size: 9px; }
  .hinge__readout { display: none; }
  .scene h1, .scene h2 { letter-spacing: 0.006em; }
  .scene__copy--upper { top: 82px; }
  .scene--boot .scene__copy--upper { top: 92px; }
  .scene--boot .lede { max-width: 88%; }
  .scene--boot .scene__data--lower { top: calc(50% + 124px); bottom: auto; }
  .scene--reality .scene__copy--upper { top: auto; bottom: 132px; }
  .reality-note { display: none; }
  .replay { bottom: 74px; }
  .mode-stage__visual figcaption { left: 14px; right: 14px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  .scene__video { visibility: hidden; }
  .scene--boot .scene__media { background: center / cover no-repeat url('assets/image/poster-boot.png'); }
  .scene--shift .scene__media { background: center / cover no-repeat url('assets/image/poster-shift.png'); }
  .scene--reality .scene__media { background: center / cover no-repeat url('assets/image/poster-reality.png'); }
}
