/* ============================================================
   本次列车终点站为 嘉禾望岗 · 日落列车
   Apple 流体界面原则的 Web 落地：
   · 材质 —— backdrop-filter 半透明层承载结构，内容在其下滑动
   · 动效 —— 弹簧驱动（临界阻尼），拖拽 1:1，动量投影，橡皮筋边界
   · 排版 —— 字号相关的字距/行高，系统字体优先
   ============================================================ */

/* ---------- 令牌 ---------- */
:root {
  color-scheme: dark;

  --ink: #0a0710;
  --ink-2: #140d1e;
  --gold: #f5c518;          /* 3号线 · 柠檬黄 */
  --gold-soft: #ffdea0;
  --amber: #ffb057;
  --pink: #ff5f9e;
  --violet: #8b5cf6;

  --text: #f7f2ec;
  --text-2: rgba(247, 242, 236, 0.64);
  --text-3: rgba(247, 242, 236, 0.4);

  --glass-bg: rgba(22, 15, 30, 0.46);
  --glass-brd: rgba(255, 255, 255, 0.1);
  --glass-hi: rgba(255, 255, 255, 0.16);
  --glass-blur: blur(22px) saturate(170%);

  --radius-window: 28px;
  --radius-deck: 26px;
  --gasket: 11px;

  --ambient-glow: rgba(255, 138, 61, 0.28);

  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
        "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC",
        "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas,
          "Liberation Mono", monospace;

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in: cubic-bezier(0.64, 0.39, 0, 0.78);   /* 出站路径的镜像缓动 */
}

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

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--text);
  font: 100% / 1.55 var(--ui);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 3px;
  border-radius: 999px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

svg { display: block; }

/* ============================================================
   环境光 —— 视频被画进画布，再模糊成整页的光
   ============================================================ */
.ambient {
  position: fixed;
  inset: -10%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#ambient {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: blur(70px) saturate(160%) brightness(0.95);
  transform: scale(1.4);
  opacity: 0.62;
  transition: opacity 1.2s var(--ease-out);
}

.ambient-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(115% 85% at 50% 44%, rgba(10, 7, 16, 0) 0%, rgba(10, 7, 16, 0.5) 58%, rgba(10, 7, 16, 0.93) 100%),
    linear-gradient(180deg, rgba(10, 7, 16, 0.62) 0%, rgba(10, 7, 16, 0.18) 26%, rgba(10, 7, 16, 0.34) 62%, rgba(10, 7, 16, 0.88) 100%);
}

/* 水洼倒影：呼应视频里那处把天空装进去的积水 */
.puddle {
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -34%;
  height: 46%;
  background: inherit;
  background: linear-gradient(180deg, rgba(255, 140, 70, 0.1), rgba(255, 95, 158, 0.05) 45%, transparent 78%);
  filter: blur(26px);
  opacity: 0.5;
  transform: scaleY(-1);
  pointer-events: none;
}

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: calc(10px + env(safe-area-inset-top)) clamp(14px, 2.4vw, 26px) 10px;
  background: linear-gradient(180deg, rgba(14, 9, 20, 0.66), rgba(14, 9, 20, 0.34));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-brd);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

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

.line-badge {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: linear-gradient(165deg, #ffe07a, var(--gold));
  color: #2a1c00;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 18px -8px rgba(245, 197, 24, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.route { display: flex; flex-direction: column; line-height: 1.24; min-width: 0; }
.route-name { font-size: 0.86rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.route-sub {
  font-size: 0.7rem; font-weight: 500; color: var(--text-2);
  letter-spacing: 0.05em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* LED 点阵走字屏 */
.pis {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 6px;
  mask-image: linear-gradient(90deg, transparent, #000 11%, #000 89%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 11%, #000 89%, transparent);
}
.pis-track {
  display: flex;
  width: max-content;
  animation: marquee 34s linear infinite;
}
.pis-track span {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #ffc46b;
  text-shadow: 0 0 12px rgba(255, 170, 60, 0.55), 0 0 2px rgba(255, 210, 130, 0.8);
  white-space: nowrap;
  padding-right: 2px;
}
@keyframes marquee { to { transform: translateX(-50%); } }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; flex: 0 0 auto; }

.pill-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-brd);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: background 0.18s var(--ease-out), transform 0.14s var(--ease-out);
}
.pill-btn:hover { background: rgba(255, 255, 255, 0.13); }
.pill-btn:active { transform: scale(0.96); }
.pill-btn[aria-pressed="true"] {
  background: linear-gradient(165deg, rgba(255, 224, 122, 0.95), rgba(245, 197, 24, 0.92));
  color: #2a1c00;
  border-color: transparent;
}

/* ============================================================
   舞台与车窗
   ============================================================ */
.stage {
  position: relative;
  z-index: 10;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(78px, 11vh, 104px) clamp(14px, 3vw, 40px) clamp(140px, 20vh, 186px);
}

.window-wrap {
  position: relative;
  perspective: 1400px;
  width: min(1180px, 100%, calc((100dvh - 300px) * 16 / 9 + 2 * var(--gasket)));
}

.window {
  position: relative;
  padding: var(--gasket);
  border-radius: var(--radius-window);
  background: linear-gradient(180deg, #251b2f 0%, #150f1e 46%, #0b0710 100%);
  box-shadow:
    0 70px 130px -50px rgba(0, 0, 0, 0.95),
    0 24px 60px -30px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 0 120px -16px var(--ambient-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transform-origin: 50% 50%;
  will-change: transform;
}

/* 车窗胶条 */
.window::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: calc(var(--radius-window) - 4px);
  border: 1px solid rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.window-inner {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius-window) - var(--gasket));
  overflow: hidden;
  background: #0a0710;
  cursor: grab;
  touch-action: none;   /* 指针拖拽接管手势 */
  transform-origin: 50% 50%;
}
.window-inner:active { cursor: grabbing; }

#video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0710;
  pointer-events: none;
  will-change: filter;
  transition: filter 0.3s var(--ease-out);
}

/* 时间倒流：画面轻微失焦、稍许褪色，像记忆在回卷 */
body.is-rewinding #video { filter: blur(1.6px) saturate(0.9) brightness(0.94); }

.sheen {
  position: absolute;
  inset: -25% -45%;
  background: linear-gradient(100deg,
    transparent 33%,
    rgba(255, 255, 255, 0.085) 43%,
    rgba(255, 236, 214, 0.055) 49%,
    rgba(255, 255, 255, 0.02) 55%,
    transparent 64%);
  mix-blend-mode: screen;
  transform: translateX(var(--sheen-x, 0px));
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 130px 26px rgba(10, 6, 16, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  background: radial-gradient(130% 100% at 50% 8%, rgba(255, 226, 190, 0.06), transparent 42%);
}

/* ---------- 车窗内 HUD ---------- */
.window-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.next-capsule {
  position: absolute;
  left: clamp(14px, 2.2vw, 26px);
  bottom: clamp(14px, 2.2vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 11px 17px 12px;
  border-radius: 18px;
  background: rgba(16, 11, 22, 0.42);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 16px 40px -22px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  /* transform 由脚本在沉浸模式下接管，这里只过渡材质属性 */
  transition: opacity 0.45s var(--ease-out), background 0.4s var(--ease-out);
}
/* 玻璃上的文字要「活」：更重、更亮、字距略开 */
.nc-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.nc-name {
  font-size: clamp(1.05rem, 2.1vw, 1.42rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.62);
}
.nc-en {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  color: rgba(255, 255, 255, 0.74);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.next-capsule.is-end {
  background: rgba(70, 40, 6, 0.42);
  border-color: rgba(255, 218, 130, 0.34);
}

/* 到站闪示：用左右 0 + 自动外边距做居中（而不是 translate），
   这样沉浸模式下脚本可以在 transform 上做反向缩放而不破坏居中 */
.station-flash {
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(14px, 2.4vw, 26px);
  width: fit-content;
  max-width: 76%;
  margin: 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #2a1c00;
  background: linear-gradient(165deg, #ffe391, rgba(245, 197, 24, 0.95));
  box-shadow: 0 14px 34px -16px rgba(245, 197, 24, 0.85);
  opacity: 0;
  filter: blur(7px);
  transition: opacity 0.3s var(--ease-out), filter 0.3s var(--ease-out);
}
.station-flash.is-on { opacity: 1; filter: blur(0); }

.tap-glyph {
  position: absolute;
  left: 50%; top: 50%;
  width: 74px; height: 74px;
  margin: -37px 0 0 -37px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(14, 10, 20, 0.4);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.28s var(--ease-out), transform 0.34s var(--ease-out);
}
.tap-glyph svg { width: 30px; height: 30px; fill: #fff; }
.tap-glyph.is-on { opacity: 1; transform: scale(1); }
.tap-glyph .g-play, .tap-glyph .g-pause { display: none; }
body.is-playing .tap-glyph .g-pause { display: block; }
body:not(.is-playing) .tap-glyph .g-play { display: block; }

/* ============================================================
   底部控制台（悬浮功能层）
   ============================================================ */
.deck {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%);
  width: min(1000px, calc(100vw - 24px));
  padding: 15px clamp(16px, 2.2vw, 24px) 13px;
  border-radius: var(--radius-deck);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.022)),
    var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
  box-shadow: 0 30px 70px -34px rgba(0, 0, 0, 0.95), inset 0 1px 0 var(--glass-hi);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.scrub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.scrub-seq {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-2);
}
.scrub-clock { display: flex; align-items: baseline; gap: 8px; }
.scrub-clock b {
  font-size: 1.24rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: #fff;
}
.scrub-clock i {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

/* 线路 = 进度条 = 站图 */
.line {
  position: relative;
  height: 40px;
  cursor: pointer;
  touch-action: none;
  border-radius: 12px;
}
.line::after {  /* 更大的命中区（~10px 迟滞） */
  content: "";
  position: absolute;
  inset: -7px 0;
}

.line-rail {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.line-fill {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  border-radius: 2px;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, rgba(255, 176, 87, 0.9), var(--gold) 62%, #fff3c9);
  box-shadow: 0 0 14px rgba(245, 197, 24, 0.55);
}

.line-ticks { position: absolute; inset: 0; }
.line-ticks i {
  position: absolute;
  top: 50%;
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(10, 7, 16, 0.55);
  transition: background 0.3s var(--ease-out), transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.line-ticks i.is-passed { background: var(--gold-soft); }
.line-ticks i.is-cur {
  background: #fff;
  transform: scale(1.5);
  box-shadow: 0 0 0 3px rgba(10, 7, 16, 0.6), 0 0 16px 3px rgba(245, 197, 24, 0.7);
}

/* 列车：跟着进度跑的金色胶囊 */
.train {
  position: absolute;
  top: 50%;
  left: 0;
  width: 34px; height: 13px;
  margin: -6.5px 0 0 -17px;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}
.train-body {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff2cd, var(--gold) 58%, #d9a800);
  box-shadow: 0 7px 18px -6px rgba(245, 197, 24, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  clip-path: polygon(9% 0, 100% 0, 100% 100%, 9% 100%, 0 50%);
}
.train-body::after {   /* 车窗 */
  content: "";
  position: absolute;
  left: 8px; right: 6px; top: 3.4px;
  height: 4px;
  border-radius: 2px;
  background: rgba(30, 20, 4, 0.55);
}
.train-glow {
  position: absolute;
  left: -16px; top: 50%;
  width: 26px; height: 26px;
  margin-top: -13px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 214, 122, 0.85), rgba(255, 190, 80, 0));
  filter: blur(1px);
}

.scrub-tip {
  position: absolute;
  bottom: 34px;
  left: 0;
  padding: 6px 11px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: #fff;
  background: rgba(18, 12, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.22s var(--ease-out), transform 0.3s var(--ease-out);
  pointer-events: none;
}
.scrub-tip.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 控制行 ---------- */
.deck-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.ctrl {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-brd);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: background 0.18s var(--ease-out), transform 0.14s var(--ease-out), color 0.2s var(--ease-out);
}
.ctrl:hover { background: rgba(255, 255, 255, 0.15); }
.ctrl:active { transform: scale(0.93); }
.ctrl svg { width: 19px; height: 19px; fill: currentColor; }

.ctrl-primary {
  width: 46px; height: 46px;
  background: linear-gradient(165deg, #fff4d4, var(--gold) 62%, #e5b400);
  color: #241800;
  border-color: transparent;
  box-shadow: 0 14px 30px -14px rgba(245, 197, 24, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.ctrl-primary:hover { background: linear-gradient(165deg, #fff8e3, #ffd52f 62%, #edbd00); }
.ctrl-primary svg { width: 21px; height: 21px; }

.ctrl .g-play, .ctrl .g-pause { display: none; }
body.is-playing .ctrl-primary .g-pause { display: block; }
body:not(.is-playing) .ctrl-primary .g-play { display: block; }

.ctrl .g-vol, .ctrl .g-mute { display: none; }
body:not(.is-muted) .ctrl .g-vol { display: block; }
body.is-muted .ctrl .g-mute { display: block; }

.ctrl-sm { width: 30px; height: 30px; }
.ctrl-sm svg { width: 15px; height: 15px; }

.vol { display: flex; align-items: center; gap: 9px; }

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 92px;
  height: 26px;
  background: transparent;
  cursor: pointer;
}
.vol-slider::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.14s var(--ease-out);
}
.vol-slider:active::-webkit-slider-thumb { transform: scale(1.18); }
.vol-slider::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); }
.vol-slider::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }

.deck-hint {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-3);
  transition: opacity 0.5s var(--ease-out);
}
body.is-riding .deck-hint { opacity: 0; }

/* ============================================================
   覆盖层
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 5, 13, 0.5);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  transition: opacity 0.5s var(--ease-out);
}
.overlay[hidden] { display: none; }

/* 材质化：模糊半径与缩放一起变化，像一层材料到场，而不是单纯的透明度 */
.start-card, .arrival-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: clamp(26px, 4vw, 38px);
  text-align: center;
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(24, 16, 33, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 60px 120px -50px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  transform: scale(0.96);
  filter: blur(9px);
  opacity: 0;
  transition: opacity 0.55s var(--ease-out), transform 0.62s var(--ease-out), filter 0.55s var(--ease-out);
}

/* 启程卡用 CSS 动画入场：不依赖 rAF，任何情况下都会「到场」 */
.start-card { animation: card-in 0.72s var(--ease-out) 0.18s both; }
@keyframes card-in {
  from { opacity: 0; transform: scale(0.96); filter: blur(9px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}
body.is-leaving .start-card {
  animation: card-out 0.5s var(--ease-in) both;
}
@keyframes card-out {
  from { opacity: 1; transform: scale(1); filter: blur(0); }
  to { opacity: 0; transform: scale(1.045); filter: blur(12px); }
}

.overlay.is-open .arrival-card { transform: scale(1); filter: blur(0); opacity: 1; }

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--text-2);
  text-transform: uppercase;
}
.eyebrow-gold { color: var(--gold-soft); }

.dest {
  margin: 14px 0 2px;
  font-size: clamp(2.4rem, 8vw, 4.1rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
  background: linear-gradient(100deg, #fff2d2 4%, var(--gold-soft) 30%, var(--amber) 58%, var(--pink) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 22px 60px rgba(255, 150, 90, 0.22);
}
.dest-arrival { font-size: clamp(2.6rem, 9vw, 4.6rem); }

.dest-en {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.42em;
  color: var(--text-3);
  text-indent: 0.42em;
}

/* 起讫小图：轨道与圆点在上，站名在下方，互不压字 */
.mini-route {
  position: relative;
  width: min(300px, 86%);
  height: 44px;
  margin: 22px auto 4px;
}
.mr-line {
  position: absolute;
  left: 4px; right: 4px; top: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--amber), var(--gold));
  opacity: 0.8;
}
.mr-dot {
  position: absolute;
  left: 0; top: 12px;
  width: 9px; height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.55);
}
.mr-dot-end {
  left: auto; right: 0;
  width: 11px; height: 11px;
  margin-top: -5.5px;
  background: var(--gold);
  box-shadow: 0 0 16px 2px rgba(245, 197, 24, 0.75);
}
.mr-label {
  position: absolute;
  top: 24px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text-3);
}
.mr-label-a { left: 0; }
.mr-label-b { right: 0; color: var(--gold-soft); }

.lede {
  margin: 18px 0 0;
  font-size: 0.92rem;
  line-height: 1.78;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 0;
}
.facts > div {
  padding: 8px 13px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.facts dt {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-3);
}
.facts dd {
  margin: 2px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.primary {
  position: relative;
  display: block;
  width: 100%;
  margin: 24px 0 0;
  padding: 15px 22px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #271a00;
  background: linear-gradient(165deg, #fff3cf, var(--gold) 60%, #e9b900);
  box-shadow: 0 22px 44px -20px rgba(245, 197, 24, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 0.14s var(--ease-out), box-shadow 0.24s var(--ease-out), filter 0.24s var(--ease-out);
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: scale(0.975); }

.ghost {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-brd);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: background 0.18s var(--ease-out), transform 0.14s var(--ease-out);
}
.ghost:hover { background: rgba(255, 255, 255, 0.14); }
.ghost:active { transform: scale(0.975); }

.text-btn {
  margin: 14px auto 0;
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, 0.25);
}
.text-btn:hover { color: var(--text-2); }

.start-hint {
  margin: 14px 0 0;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* 终到：scrim 变浓，舞台后退 */
.overlay.arrival { background: rgba(6, 4, 10, 0.62); }

/* 退场：与入场同一路径（放大 + 失焦），而不是硬切 */
.overlay.is-leaving { opacity: 0; pointer-events: none; }

/* ============================================================
   侧边说明（同一路径进出）
   ============================================================ */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 4, 10, 0.45);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.sheet-scrim[hidden] { display: none; }
.sheet-scrim.is-open { opacity: 1; }

.sheet {
  position: fixed;
  z-index: 55;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02)),
    rgba(20, 13, 29, 0.72);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-left: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: -40px 0 90px -40px rgba(0, 0, 0, 0.9);
  transform: translateX(102%);
  opacity: 0;
  transition: transform 0.52s var(--ease-out), opacity 0.4s var(--ease-out);
}
.sheet[hidden] { display: none; }
.sheet.is-open { transform: translateX(0); opacity: 1; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sheet-head h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.sheet-body {
  padding: 20px 22px calc(30px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sheet-body section + section { margin-top: 26px; }
.sheet-body h4 {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold-soft);
}
.sheet-body p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.85;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.sheet-body p + p, .sheet-body p + ul, .sheet-body ol + p { margin-top: 10px; }
.sheet-body .dim { color: var(--text-3); font-size: 0.78rem; }
.sheet-body .mono { font-family: var(--mono); font-size: 0.82em; color: var(--text-2); }

.line-map {
  list-style: none;
  margin: 14px 0 12px;
  padding: 0 0 0 18px;
  position: relative;
}
.line-map::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--amber), var(--gold));
  opacity: 0.65;
}
.line-map li {
  position: relative;
  padding: 3px 0;
  font-size: 0.84rem;
  color: var(--text-2);
}
.line-map li::before {
  content: "";
  position: absolute;
  left: -18px; top: 11px;
  width: 6px; height: 6px;
  margin-left: 1px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(20, 13, 29, 0.8);
}
.line-map li.is-end {
  color: var(--gold-soft);
  font-weight: 650;
}
.line-map li.is-end::before {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(20, 13, 29, 0.8), 0 0 14px 2px rgba(245, 197, 24, 0.7);
}

.keys {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.keys li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-2);
}
.keys kbd {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 4px 9px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  text-align: center;
}

/* ============================================================
   Toast / 沉浸退出
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  /* 让提示浮在控制台之上：--deck-h 由脚本按实际高度写入 */
  bottom: calc(var(--deck-h, 150px) + 34px);
  z-index: 70;
  transform: translate(-50%, 12px);
  max-width: min(88vw, 440px);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  color: var(--text);
  background: rgba(20, 13, 29, 0.86);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 22px 50px -24px rgba(0, 0, 0, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.4s var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.exit-immersive {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 45;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(20, 13, 29, 0.6);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out), transform 0.14s var(--ease-out);
}
.exit-immersive[hidden] { display: none; }
.exit-immersive.is-open { opacity: 1; }
.exit-immersive:active { transform: scale(0.95); }

/* ============================================================
   沉浸模式：整面车窗铺满视野，其余界面退场
   ============================================================ */
body.is-immersive .topbar,
body.is-immersive .deck {
  opacity: 0;
  pointer-events: none;
}
body.is-immersive .sheen { opacity: 0; }          /* 玻璃铺满视野后，反光提示不再成立 */
body.is-immersive .grain { opacity: 0.03; }
/* 控制台退场后，提示浮到视野底部（站牌之上） */
body.is-immersive .toast { bottom: calc(128px + env(safe-area-inset-bottom)); }
body.is-immersive .topbar { transform: translateY(-14px); }
body.is-immersive .deck { transform: translate(-50%, 18px); }
body.is-immersive .window { cursor: grab; }
body.is-immersive .ambient-veil { opacity: 0.72; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 860px) {
  .pis { display: none; }
  .route-sub { display: none; }
  .vol-slider { display: none; }
  .deck-hint { display: none; }
  .stage { padding-bottom: clamp(126px, 22vh, 160px); }
  .window-wrap { width: min(100%, calc((100dvh - 300px) * 16 / 9 + 2 * var(--gasket))); }
  .scrub-clock b { font-size: 1.08rem; }
}

@media (max-width: 520px) {
  .topbar { gap: 10px; }
  .route-name { font-size: 0.8rem; }
  .pill-btn { padding: 6px 11px; font-size: 0.74rem; }
  /* 竖屏：让车窗略微出血到屏幕两侧，像从车厢里看出去 */
  .stage { padding-inline: 0; }
  .window-wrap { width: 114%; }
  .deck { padding: 13px 14px 11px; border-radius: 22px; }
  .deck-controls { gap: 9px; }
  .ctrl { width: 38px; height: 38px; }
  .ctrl-primary { width: 44px; height: 44px; }
  .next-capsule { padding: 9px 13px 10px; border-radius: 15px; }
  .nc-en { max-width: 26ch; }
  .dest-en { letter-spacing: 0.3em; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .stage { padding-top: 66px; padding-bottom: 118px; }
  .window-wrap { width: min(100%, 900px, calc((100dvh - 196px) * 16 / 9 + 2 * var(--gasket))); }
  .deck { padding: 11px 16px 10px; }
  .scrub-head { margin-bottom: 7px; }
}

/* ============================================================
   无障碍与偏好
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  /* 保留反馈，只是把位移换成短交叉淡入 */
  .pis-track { animation-duration: 90s; }
  .sheen { display: none; }
  .window { box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.07); }
  .start-card, .arrival-card { transform: none; }
  .sheet { transition: opacity 0.24s var(--ease-out); transform: none; }
  .sheet.is-open { transform: none; }
  .next-capsule, .station-flash, .tap-glyph { transition-duration: 0.2s; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .deck, .sheet, .start-card, .arrival-card, .toast, .next-capsule,
  .pill-btn, .ctrl, .ghost, .exit-immersive {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .topbar { background: #150e1f; }
  .deck { background: #191121; }
  .sheet { background: #170f22; }
  .start-card, .arrival-card { background: #1b1226; }
  .next-capsule { background: rgba(20, 13, 29, 0.94); }
  .overlay { background: rgba(8, 5, 13, 0.86); }
}

@media (prefers-contrast: more) {
  :root {
    --text-2: rgba(255, 255, 255, 0.88);
    --text-3: rgba(255, 255, 255, 0.7);
    --glass-brd: rgba(255, 255, 255, 0.4);
  }
  .topbar, .deck, .sheet, .start-card, .arrival-card, .next-capsule, .toast {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #0d0916;
    border-color: rgba(255, 255, 255, 0.4);
  }
  .overlay { background: rgba(0, 0, 0, 0.9); }
}
