/* ORBIT 电影感 UI 壳 — 令牌与组件（DESIGN.md §2–§4） */

:root {
  --space-void: #050813;
  --space-panel: rgba(10, 15, 29, 0.78);
  --space-panel-2: rgba(8, 12, 24, 0.92);
  --ink-primary: #f4f7ff;
  --ink-secondary: #aebbd0;
  --ink-muted: #8091aa;
  --ink-ghost: #5a6a84;
  --accent-cyan: #5dffee;
  --accent-cyan-dim: rgba(93, 255, 238, 0.35);
  --accent-cyan-glow: rgba(93, 255, 238, 0.16);
  --accent-amber: #ffb35c;
  --accent-amber-dim: rgba(255, 179, 92, 0.4);
  --event-weather: #6eb6ff;
  --event-lightning: #ffe566;
  --event-typhoon: #c084fc;
  --line-subtle: rgba(173, 194, 237, 0.18);
  --line-strong: rgba(150, 188, 228, 0.4);
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --shell-ease: cubic-bezier(0.45, 0.05, 0.2, 1);
  --font-cjk: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-latin: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Cascadia Code", Consolas, monospace;
}

/* 壳未启用时整块不可见，不抢科学控制台 */
.cinematic-shell[hidden],
.cinematic-shell[data-ready="false"] {
  display: none !important;
}

.cinematic-shell {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  font-family: var(--font-cjk);
  color: var(--ink-primary);
}

.cinematic-shell > * {
  pointer-events: auto;
}

/* —— 顶栏 —— */
.shell-top {
  position: absolute;
  top: 14px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: start;
  gap: var(--s-3);
  pointer-events: none;
}

.shell-top > * {
  pointer-events: auto;
}

.shell-brand {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-left: 28px;
}

.shell-brand__mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-brand__logo {
  width: 28px;
  height: 28px;
  flex: none;
  color: var(--accent-cyan);
}

.shell-brand__name {
  font-family: var(--font-latin);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--ink-primary);
}

.shell-brand__tag {
  font-size: 11px;
  color: var(--ink-secondary);
  letter-spacing: 0.04em;
}

.shell-brand__en {
  font-family: var(--font-latin);
  font-size: 10px;
  color: var(--ink-ghost);
  letter-spacing: 0.12em;
}

.shell-modes {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line-subtle);
  border-radius: 999px;
  background: var(--space-panel-2);
  backdrop-filter: blur(14px);
}

.shell-mode {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: color 120ms linear, background 120ms linear;
}

.shell-mode:hover {
  color: var(--ink-primary);
  background: rgba(93, 255, 238, 0.06);
}

.shell-mode:focus-visible {
  outline: 1px solid var(--accent-cyan);
  outline-offset: 2px;
}

.shell-mode.is-active {
  background: rgba(93, 255, 238, 0.12);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px var(--accent-cyan-dim);
}

.shell-mode[data-pending="true"]::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent-amber);
  vertical-align: middle;
  opacity: 0.85;
}

.shell-tools {
  justify-self: end;
  display: flex;
  gap: var(--s-2);
}

.shell-tool {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-subtle);
  border-radius: 50%;
  background: var(--space-panel-2);
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 13px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(12px);
  transition: color 120ms linear, border-color 120ms linear;
}

.shell-tool:hover,
.shell-tool.is-active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan-dim);
}

.shell-tool:focus-visible {
  outline: 1px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* —— 子导航 —— */
.shell-sub {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-subtle);
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: blur(12px);
}

.shell-sub[hidden] {
  display: none !important;
}

.shell-submode {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 12px;
  position: relative;
}

.shell-submode.is-active {
  color: var(--ink-primary);
  background: rgba(255, 255, 255, 0.04);
}

.shell-submode.is-active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  height: 1px;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan-dim);
}

/* —— 左栏信息卡 —— */
.shell-left {
  position: absolute;
  top: 118px;
  left: 24px;
  width: min(320px, calc(100vw - 48px));
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding: 12px 14px 12px 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(5, 8, 19, 0.72) 0%, rgba(5, 8, 19, 0.35) 70%, transparent 100%);
  scrollbar-width: thin;
  pointer-events: none;
}

.shell-left > * {
  pointer-events: auto;
}

.shell-left__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.shell-left__eyebrow::before {
  content: "+";
  color: var(--accent-cyan);
  font-size: 12px;
}

.shell-left__latin {
  margin-top: 18px;
  font-family: var(--font-latin);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.shell-left__title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 6px;
}

.shell-left__title {
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0.04em;
  color: var(--ink-primary);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}

.shell-left__index {
  margin-top: 12px;
  font-family: var(--font-latin);
  font-size: 13px;
  color: var(--ink-ghost);
  letter-spacing: 0.08em;
}

.shell-left__intro {
  margin: 18px 0 0;
  max-width: 34em;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-secondary);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

.shell-left__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line-subtle);
}

.shell-left__stat dt {
  margin: 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.shell-left__stat dd {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
}

.shell-left__stat dd small {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-muted);
}

.shell-left__foot {
  margin: 16px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--accent-cyan-dim);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.shell-left__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: 22px;
}

.shell-chip {
  min-height: 32px;
  border: 1px solid var(--line-subtle);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(8, 12, 24, 0.65);
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 12px;
  backdrop-filter: blur(8px);
  transition: border-color 120ms linear, color 120ms linear;
}

.shell-chip:hover,
.shell-chip.is-active {
  border-color: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.shell-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* —— 右栏探索尺度 —— */
.shell-right {
  position: absolute;
  top: 50%;
  right: 22px;
  transform: translateY(-50%);
  display: grid;
  gap: var(--s-3);
  justify-items: end;
}

.shell-right__label {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
}

.shell-scale-list {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.shell-scale-list::before {
  content: "";
  position: absolute;
  right: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line-strong), transparent);
}

.shell-scale {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  position: relative;
}

.shell-scale:hover {
  color: var(--ink-secondary);
}

.shell-scale.is-active {
  color: var(--accent-cyan);
}

.shell-scale__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--ink-ghost);
  background: transparent;
  flex: none;
  z-index: 1;
}

.shell-scale.is-active .shell-scale__dot {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-dim);
}

.shell-zoom {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.shell-zoom button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-subtle);
  border-radius: 50%;
  background: var(--space-panel-2);
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.shell-zoom button:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan-dim);
}

/* —— 操作提示 / 时间 —— */
.shell-hints {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(5, 8, 19, 0.45);
  color: var(--ink-muted);
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
}

.shell-time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  color: var(--ink-secondary);
  pointer-events: auto;
}

.shell-time button {
  min-height: 24px;
  border: 1px solid var(--line-subtle);
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 11px;
}

.shell-time button.is-active {
  color: var(--accent-amber);
  border-color: var(--accent-amber-dim);
}

.shell-time strong {
  font-variant-numeric: tabular-nums;
  color: var(--accent-amber);
  font-weight: 550;
}

.shell-status-dot {
  position: absolute;
  left: 50%;
  bottom: 158px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-muted);
  pointer-events: none;
  white-space: nowrap;
}

.shell-status-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* —— 底栏目的地 —— */
.shell-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-subtle);
  border-radius: 14px;
  background: var(--space-panel-2);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.shell-dock__label {
  min-width: 88px;
}

.shell-dock__label strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-primary);
}

.shell-dock__label span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-latin);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-ghost);
}

.shell-dock__search {
  min-width: 0;
  height: 32px;
  margin-left: 8px;
  border: 1px solid var(--line-subtle);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink-primary);
  font-size: 12px;
  outline: none;
}

.shell-dock__search::placeholder {
  color: var(--ink-ghost);
}

.shell-dock__search:focus {
  border-color: var(--accent-cyan-dim);
}

.shell-dock__strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
}

.dest-card {
  flex: 0 0 auto;
  width: 72px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 4px 8px;
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  text-align: center;
  transition: border-color 120ms linear, transform 120ms linear, background 120ms linear;
}

.dest-card:hover {
  border-color: var(--line-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.dest-card.is-active {
  border-color: var(--accent-cyan-dim);
  background: rgba(93, 255, 238, 0.08);
  color: var(--ink-primary);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--accent-cyan-glow);
}

.dest-card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.dest-card__orb {
  width: 40px;
  height: 40px;
  margin: 0 auto 6px;
  border-radius: 50%;
  box-shadow: inset -6px -4px 12px rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 255, 255, 0.06);
}

.dest-card__name {
  display: block;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-dock__aside {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 52px;
}

.shell-dock__overview {
  min-height: 36px;
  border: 1px solid var(--line-subtle);
  border-radius: 10px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 12px;
}

.shell-dock__overview:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan-dim);
}

.shell-footnote {
  position: absolute;
  left: 20px;
  bottom: 118px;
  font-size: 10px;
  color: var(--ink-ghost);
  pointer-events: none;
}

.shell-left__events {
  margin-top: 18px;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  scrollbar-width: thin;
}

.sense-event__heading {
  color: var(--ink-muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.sense-event {
  display: grid;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--line-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(8, 12, 24, 0.55);
  color: var(--ink-secondary);
  cursor: pointer;
  font: inherit;
}

.sense-event:hover,
.sense-event.is-active {
  border-color: var(--accent-cyan-dim);
  color: var(--ink-primary);
}

.sense-event__kind {
  font-size: 10px;
  color: var(--ink-ghost);
}

.sense-event strong {
  font-size: 12px;
  font-weight: 550;
}

.sense-event__meta {
  font-size: 10px;
  color: var(--ink-muted);
}

.sense-event[data-kind="typhoon"] { border-left: 2px solid var(--event-typhoon); }
.sense-event[data-kind="lightning"] { border-left: 2px solid var(--event-lightning); }
.sense-event[data-kind="weather"] { border-left: 2px solid var(--event-weather); }

/* 标签引导点（电影壳启用时） */
body.has-cinematic-shell .body-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(167, 211, 245, 0.28);
  background: rgba(5, 10, 23, 0.55);
  padding: 2px 8px 2px 6px;
}

body.has-cinematic-shell .body-label__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan-dim);
  flex: none;
}

body.has-cinematic-shell .body-label--earth {
  border-color: var(--accent-cyan-dim);
  color: var(--ink-primary);
}

body.has-cinematic-shell .body-label--earth .body-label__dot {
  width: 5px;
  height: 5px;
}
.shell-trail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.shell-trail path {
  fill: none;
  stroke: var(--accent-amber);
  stroke-width: 1.25;
  stroke-linecap: round;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(255, 179, 92, 0.55));
}

.shell-trail path.is-drawing {
  opacity: 0.9;
  animation: shell-trail-draw 1.8s var(--shell-ease) forwards;
}

@keyframes shell-trail-draw {
  0% {
    opacity: 0;
    stroke-dashoffset: 320;
  }
  35% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: 0;
  }
}

/* —— 微动效 —— */
@media (prefers-reduced-motion: no-preference) {
  .cinematic-shell[data-ready="true"] {
    animation: shell-fade-in 420ms var(--shell-ease) both;
  }

  @keyframes shell-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .shell-mode {
    transition: color 140ms linear, background 140ms linear, box-shadow 140ms linear;
  }

  .shell-mode.is-active {
    box-shadow: inset 0 0 0 1px var(--accent-cyan-dim), 0 0 18px var(--accent-cyan-glow);
  }

  .dest-card {
    transition: border-color 140ms linear, transform 140ms var(--shell-ease), background 140ms linear, box-shadow 140ms linear;
  }

  .dest-card.is-active {
    box-shadow: 0 0 0 1px var(--accent-cyan-glow), 0 6px 18px rgba(0, 0, 0, 0.35);
  }

  .sense-event {
    transition: border-color 120ms linear, background 120ms linear;
  }

  .shell-scale__dot {
    transition: background 160ms linear, box-shadow 160ms linear;
  }
}

/* 壳启用时：旧信息卡让位给左栏 */
body.has-cinematic-shell #info-card {
  display: none !important;
}

body.has-cinematic-shell .hud {
  z-index: 6;
}

/* 科学控制台展开时，左栏让位避免双栏打架 */
#hud:not(.is-collapsed) ~ #cinematic-shell .shell-left {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

#hud.is-collapsed ~ #cinematic-shell .shell-left {
  opacity: 1;
  transition: opacity 180ms ease;
}

/* 感知地球：右栏点色映射事件语义 */
body.shell-submode-sense .shell-scale.is-active {
  color: var(--event-weather);
}

body.shell-submode-sense .shell-scale.is-active .shell-scale__dot {
  background: var(--event-weather);
  border-color: var(--event-weather);
  box-shadow: 0 0 10px rgba(110, 182, 255, 0.45);
}

@media (max-width: 1279px) {
  .shell-top {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .shell-modes,
  .shell-tools {
    justify-self: center;
  }

  .shell-brand {
    justify-self: center;
    text-align: center;
  }

  .shell-brand__mark {
    justify-content: center;
  }

  .shell-left {
    top: 150px;
    width: min(280px, calc(100vw - 36px));
  }

  .shell-right {
    right: 10px;
  }

  .shell-dock {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .shell-dock__label {
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shell-trail path.is-drawing {
    animation: none;
    opacity: 0;
  }

  .dest-card,
  .shell-mode,
  .shell-chip {
    transition: none;
  }
}
