@font-face{font-family:Barlow;src:url(./assets/barlow-condensed.ttf)}
@font-face{font-family:Plex;src:url(./assets/plex-mono.ttf)}

:root {
  color-scheme: dark;
  --bg: #101112;
  --surface: #16181a;
  --surface-2: #1d2023;
  --fg: #f3f1ec;
  --muted: #9ea2a0;
  --line: #2d3033;
  --line-strong: #3e4246;
  --accent: #d9381e;
  --accent-hover: #ef4d33;
  --accent-soft: rgba(217, 56, 30, 0.14);
  --paper: #f6f2ea;
  --ink: #151413;
  --ink-muted: #58544f;
  --mono: Plex, ui-monospace, monospace;
  --display: Barlow, "Arial Narrow", sans-serif;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); min-width: 300px; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; background: none; border: 0; }
button, a, select, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
button:disabled { opacity: 0.42; cursor: default; }

.wrap { width: min(1420px, calc(100% - clamp(24px, 6vw, 96px))); margin: 0 auto; }

/* Unified Top Navigation */
.mast { border-bottom: 1px solid var(--line); background: rgba(16, 17, 18, 0.92); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30; }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-home { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 14px; letter-spacing: 0.02em; color: var(--fg); }
.brand-home img { width: 28px; height: 28px; border-radius: 6px; display: block; }
.brand-home:hover { color: #fff; }
.brand-sep { color: #565a5e; font-size: 14px; }
.brand-work { font: 700 20px/1 var(--display); letter-spacing: 0.06em; color: var(--fg); }
.brand-work:hover { color: var(--accent-hover); }

.mode-nav { display: flex; align-items: center; gap: 6px; }
.mode-nav a, .mode-nav .nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 13px; border-radius: 6px;
  font-size: 13px; color: var(--muted); border: 1px solid transparent;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.mode-nav a:hover, .mode-nav .nav-btn:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
.mode-nav a.is-active { color: #fff; background: var(--surface-2); border-color: var(--line-strong); font-weight: 600; }

/* Compact Single-Row Hero */
.hero-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 18px 0 14px; flex-wrap: wrap; }
.hero-left { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1 var(--mono); letter-spacing: 0.14em; color: var(--muted); }
.hero-kicker i { width: 18px; height: 2px; background: var(--accent); display: inline-block; }
.hero-bar h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.08; letter-spacing: -0.02em; font-weight: 700; }
.hero-sub { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: 0.04em; }

/* Main Stage Shell */
.stage-shell { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45); }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #141618; }
.view-tabs { display: flex; align-items: center; gap: 4px; }
.view-tabs button {
  min-height: 36px; padding: 0 13px; border-radius: 6px; font-size: 13px; color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.view-tabs button:hover:not(:disabled) { color: var(--fg); background: rgba(255, 255, 255, 0.05); }
.view-tabs button[aria-pressed="true"] { background: var(--surface-2); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-strong); }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font: 500 11px/1 var(--mono); letter-spacing: 0.06em; color: #d5d7d4;
  padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* 3D Picture Viewport */
.picture { position: relative; aspect-ratio: 12 / 5; min-height: 360px; max-height: 68vh; width: 100%; background: #0c0d0e; overflow: hidden; }
.picture #poster, .picture #orbit-screen { position: absolute; inset: 0; width: 100%; height: 100%; }
.picture #poster { object-fit: cover; z-index: 1; filter: brightness(0.68); }
.picture #orbit-screen { z-index: 2; cursor: grab; }
.picture #orbit-screen:active { cursor: grabbing; }
.picture.mode-director #orbit-screen { touch-action: pan-y; }
.picture.mode-interactive #orbit-screen { touch-action: none; }
.picture #orbit-screen canvas { display: block; width: 100%; height: 100%; }

/* Narrative Loading Overlay */
.load-overlay {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(16, 17, 18, 0.56), rgba(10, 11, 12, 0.86));
  backdrop-filter: blur(4px);
}
.load-card { max-width: 460px; width: 100%; text-align: center; }
.load-quote { margin: 0 0 18px; font-size: clamp(16px, 2vw, 20px); line-height: 1.6; font-weight: 500; color: #f6f2ea; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7); }
.load-bar { height: 3px; width: 100%; background: rgba(255, 255, 255, 0.16); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.load-bar span { display: block; height: 100%; width: 8%; background: var(--accent); transition: width 0.18s ease-out; }
.load-state { font: 12px/1.4 var(--mono); color: #c7cac8; letter-spacing: 0.04em; }

/* Floating Drag Hint ("这不是视频，拖一下试试") */
.drag-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(16, 17, 18, 0.84); border: 1px solid rgba(217, 56, 30, 0.65);
  color: #fff; font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  backdrop-filter: blur(8px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  animation: hint-fade 0.35s ease-out;
}
.drag-hint:hover { background: var(--accent); border-color: var(--accent); }
.drag-hint em { font-style: normal; color: var(--accent-hover); font-size: 15px; }
.drag-hint:hover em { color: #fff; }
@keyframes hint-fade { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Return to Director Pill */
.return-director {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  min-height: 36px; padding: 0 13px; border-radius: 999px;
  background: rgba(16, 17, 18, 0.8); border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f3f1ec; font-size: 12px; backdrop-filter: blur(8px);
}
.return-director:hover { border-color: var(--accent); color: #fff; background: rgba(217, 56, 30, 0.88); }

.stage-shot-badge {
  position: absolute; left: 14px; top: 14px; z-index: 4; pointer-events: none;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(16, 17, 18, 0.68); border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e4e1; font-size: 12px; backdrop-filter: blur(6px);
  display: none;
}

/* End-of-Play 3-Choice Card */
.end-overlay {
  position: absolute; inset: auto 16px 18px 16px; z-index: 6;
  display: flex; justify-content: center; pointer-events: none;
}
.end-card {
  pointer-events: auto; width: min(560px, 100%);
  padding: 18px 20px; border-radius: 12px;
  background: rgba(18, 20, 22, 0.9); border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px); text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  animation: card-rise 0.3s ease-out;
}
@keyframes card-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.end-eyebrow { margin: 0 0 4px; font: 500 10px/1 var(--mono); letter-spacing: 0.16em; color: var(--accent-hover); }
.end-card h2 { margin: 0 0 14px; font-size: 18px; font-weight: 650; color: #fff; }
.end-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.end-btn {
  min-height: 40px; padding: 0 16px; border-radius: 7px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.06); color: var(--fg);
}
.end-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.end-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.end-btn.primary:hover { background: var(--accent-hover); }
.end-btn.accent { border-color: rgba(217, 56, 30, 0.65); color: #ffcabf; background: var(--accent-soft); }
.end-btn.accent:hover { background: var(--accent); color: #fff; }

/* Scrubber & Transport */
.rail { padding: 8px 16px 2px; background: var(--surface); }
.rail input { width: 100%; height: 24px; cursor: pointer; accent-color: var(--accent); margin: 0; display: block; }

.transport { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 16px 14px; }
.playgroup, .options { display: flex; align-items: center; gap: 10px; }
.playgroup .action {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border-radius: 7px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 650;
}
.playgroup .action:hover:not(:disabled) { background: var(--accent-hover); }
.symbol { font-size: 12px; }
.time-readout { font: 13px/1 var(--mono); color: var(--fg); display: flex; align-items: baseline; gap: 4px; }
.total { color: var(--muted); font-size: 12px; }
.shot-pill {
  font-size: 13px; color: #d5d7d4; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
}

.options button {
  min-height: 38px; padding: 0 13px; border-radius: 7px;
  border: 1px solid var(--line-strong); font-size: 13px; color: #d9dbd8;
}
.options button:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.options button[aria-expanded="true"] { border-color: var(--accent); color: #fff; background: var(--accent-soft); }

/* Collapsible More Panel */
.more-panel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding: 12px 16px; border-top: 1px solid var(--line); background: #131517;
}
.more-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.more-label { font: 11px/1 var(--mono); color: var(--muted); letter-spacing: 0.06em; margin-right: 4px; }
.more-panel button, .rate-pick {
  min-height: 36px; padding: 0 11px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: #d6d8d5; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.more-panel button:hover { border-color: var(--line-strong); color: #fff; }
.more-panel button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: #fff; }
.rate-pick select { background: transparent; border: 0; padding: 4px 2px; font: 12px var(--mono); }
.rate-pick option { background: #1c1f22; color: #fff; }

/* Fullscreen support */
.stage-shell:fullscreen, .stage-shell.expanded {
  display: flex; flex-direction: column; justify-content: center; background: #08090a; border-radius: 0; border: 0;
}
.stage-shell.expanded { position: fixed; inset: 0; z-index: 50; }
.stage-shell:fullscreen .picture, .stage-shell.expanded .picture { max-height: 76vh; flex: 1; }

/* Sections Below Stage */
.internals-section, .shots { margin: 34px 0 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.section-kicker { margin: 0 0 4px; font: 500 11px/1 var(--mono); letter-spacing: 0.14em; color: var(--accent-hover); }
.section-head h2 { margin: 0; font-size: clamp(19px, 2.2vw, 24px); font-weight: 650; letter-spacing: -0.01em; }
.shot-legend { font-size: 12px; color: var(--muted); }

/* Detail Tools (visible when inspecting an internal mechanism) */
.detail-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-tools select {
  min-height: 36px; padding: 0 10px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 12px;
}
.shell-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #d4d6d3; cursor: pointer; min-height: 36px; }
.shell-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.exit-detail {
  min-height: 36px; padding: 0 12px; border-radius: 6px;
  border: 1px solid var(--accent); color: #ffcabf; background: var(--accent-soft); font-size: 12px; font-weight: 600;
}
.exit-detail:hover { background: var(--accent); color: #fff; }

/* 9 Humanized Internal Mechanism Cards */
.internals-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.part-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px 16px; border-radius: 9px; min-height: 68px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.part-card:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-2); transform: translateY(-1px); }
.part-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.part-card strong { font-size: 15px; font-weight: 600; color: var(--fg); line-height: 1.3; }
.part-card span { font-size: 12px; color: var(--muted); }
.part-card[aria-pressed="true"] strong { color: #fff; }
.part-card[aria-pressed="true"] span { color: #f7c5b9; }

/* 9 Timeline Shot Cards */
.shots #chapters { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
.chapter {
  padding: 0; text-align: left; border: 1px solid var(--line); border-radius: 7px;
  overflow: hidden; background: var(--surface); transition: border-color 0.15s, background-color 0.15s;
}
.chapter:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chapter[aria-current="true"] { border-color: var(--accent); }
.chapter img { display: block; width: 100%; aspect-ratio: 12 / 5; object-fit: cover; }
.chapter-meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 7px 9px 2px; }
.chapter-time { font: 11px/1 var(--mono); color: var(--muted); }
.chapter-dot {
  font-size: 10px; color: #ffcabf; background: var(--accent-soft);
  padding: 2px 5px; border-radius: 4px; white-space: nowrap;
}
.chapter strong { display: block; padding: 2px 9px 9px; font-size: 13px; font-weight: 560; color: var(--fg); }

/* Editorial Tribute Band (Echoes finiyang.com Warm Paper / Ink / Vermilion) */
.tribute-band {
  margin: 42px 0 0; border-radius: 14px; background: var(--paper); color: var(--ink);
  padding: clamp(22px, 3.2vw, 34px) clamp(20px, 3.4vw, 38px);
}
.tribute-inner { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr); gap: 24px 36px; align-items: end; }
.tribute-kicker { margin: 0 0 8px; font: 600 11px/1.2 var(--mono); letter-spacing: 0.12em; color: var(--accent); }
.tribute-copy h2 { margin: 0 0 10px; font-size: clamp(20px, 2.3vw, 27px); line-height: 1.25; font-weight: 700; color: var(--ink); }
.tribute-copy p:last-child { margin: 0; font-size: 14px; line-height: 1.75; color: var(--ink-muted); max-width: 60ch; }
.tribute-meta { display: flex; flex-direction: column; gap: 14px; align-items: flex-end; text-align: right; }
.tribute-sign { margin: 0; font: 500 12px/1.4 var(--mono); color: var(--ink); padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(21, 20, 19, 0.16); background: rgba(255, 255, 255, 0.55); }
.tribute-links { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: flex-end; font-size: 13px; font-weight: 600; }
.tribute-links a { color: var(--ink); border-bottom: 1px solid rgba(21, 20, 19, 0.25); padding-bottom: 2px; }
.tribute-links a:first-child { color: var(--accent); border-color: rgba(217, 56, 30, 0.4); }
.tribute-links a:hover { opacity: 0.72; }

.site-footer {
  margin: 24px 0 36px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 12px;
}
.site-footer p { margin: 0; }

/* Help Dialog */
dialog {
  width: min(480px, 92vw); padding: 24px; border-radius: 12px;
  background: #1a1c1e; color: var(--fg); border: 1px solid var(--line-strong);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.dialog-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-kicker { font: 500 11px/1 var(--mono); letter-spacing: 0.12em; color: var(--accent-hover); }
.dialog-top button { width: 34px; height: 34px; border-radius: 6px; color: var(--muted); font-size: 16px; }
.dialog-top button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
dialog h2 { margin: 0 0 16px; font-size: 22px; }
dialog dl { display: grid; grid-template-columns: max-content 1fr; gap: 12px 16px; margin: 0; }
dialog dt { font-size: 13px; font-weight: 600; color: #ffcabf; }
dialog dd { margin: 0; font-size: 13px; line-height: 1.65; color: #c4c7c5; }

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .shots #chapters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .internals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tribute-inner { grid-template-columns: 1fr; }
  .tribute-meta { align-items: flex-start; text-align: left; }
  .tribute-links { justify-content: flex-start; }
}

@media (max-width: 680px) {
  .wrap { width: calc(100% - 24px); }
  .nav { min-height: 54px; gap: 8px; }
  .brand-home span { display: none; }
  .brand-sep { display: none; }
  .brand-work { font-size: 18px; }
  .mode-nav a, .mode-nav .nav-btn { min-height: 44px; padding: 0 10px; font-size: 13px; }

  .hero-bar { margin: 12px 0 10px; gap: 6px; }
  .hero-left { gap: 10px; }
  .hero-bar h1 { font-size: 24px; }
  .hero-sub { font-size: 13px; }

  .stage-head { padding: 6px 8px; }
  .view-tabs button { min-height: 44px; padding: 0 11px; font-size: 13px; }
  .live-pill { padding: 5px 8px; font-size: 10px; }

  /* Mobile Portrait Stage: Unlock 12/5 so Optimus fills ~56svh instead of a 150px slit */
  .picture { aspect-ratio: auto; height: clamp(320px, 56svh, 520px); max-height: none; min-height: 320px; }
  .stage-shot-badge { display: inline-flex; }
  .shot-pill { display: none; }

  .transport { padding: 6px 10px 12px; gap: 8px; flex-wrap: wrap; }
  .playgroup .action { min-height: 44px; padding: 0 16px; }
  .options button { min-height: 44px; padding: 0 12px; }
  .more-panel button, .rate-pick { min-height: 44px; padding: 0 12px; font-size: 13px; }
  .end-btn { min-height: 44px; flex: 1 1 130px; }

  .internals-grid { grid-template-columns: 1fr; gap: 8px; }
  .part-card { min-height: 58px; padding: 12px 14px; }

  .shots #chapters { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 6px; scroll-snap-type: x proximity; }
  .chapter { flex: 0 0 144px; scroll-snap-align: start; }

  .detail-tools select, .exit-detail { min-height: 44px; }
  .return-director { min-height: 40px; top: 10px; right: 10px; }
  .drag-hint { bottom: 14px; font-size: 13px; padding: 10px 16px; white-space: nowrap; }
}
