:root {
  color-scheme: dark;
  --bg: #111c20;
  --ink: #f0eadb;
  --muted: #b1bdbb;
  --warm: #efd5a1;
  --line: #e1ecdc28;
  --glass: #131f22ed;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 74% 0, #283d42 0, transparent 50rem), var(--bg);
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; }
button {
  font: inherit;
  color: inherit;
}
:focus-visible { outline: 2px solid var(--warm); outline-offset: 3px; }
.site {
  max-width: 1720px;
  width: 95%;
  margin: 0 auto;
  padding: 0 0 24px;
}
.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: clamp(76px,8.8vw,116px);
  gap: 15px;
}
.heading {
  display: flex;
  gap: clamp(15px,2.2vw,33px);
  align-items: baseline;
  min-width: 0;
}
h1 {
  margin: 0;
  white-space: nowrap;
  font: 500 clamp(36px,5vw,60px)/1.12 "Songti SC","Noto Serif SC","STSong","SimSun",serif;
  letter-spacing: .09em;
}
.view-type {
  color: var(--muted);
  font-size: clamp(11px,1.4vw,14px);
  white-space: nowrap;
}
.pictures {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  white-space: nowrap;
  text-decoration: none;
  font-size: 14px;
}
.pictures:hover { background: #f4ead111; }
svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.stage {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  height: clamp(470px,74vh,980px);
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #32474d;
  box-shadow: 0 14px 48px #07111658;
}
.stage:fullscreen, .stage.theater {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  min-height: 0;
  border: none;
  border-radius: 0;
}
.stage.theater { position: fixed; inset: 0; z-index: 10; }
body.theater-open { overflow: hidden; }
.poster, .viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.poster { object-fit: cover; object-position: 56% 52%; }
.viewport { opacity: 0; transition: opacity .28s ease; }
.stage[data-viewer="ready"] .viewport { opacity: 1; }
.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.viewport canvas:active { cursor: grabbing; }
.viewport canvas:focus-visible { outline-offset: -4px; }
.viewer-status {
  position: absolute;
  z-index: 1;
  bottom: 19px;
  left: 19px;
  width: min(300px,calc(100% - 38px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--glass);
  box-shadow: 0 5px 32px #10202775;
}
.viewer-status p { margin: 0 0 9px; font-size: 14px; line-height: 1.55; }
.viewer-status progress { width: 100%; height: 5px; accent-color: #d8b775; }
.fallback-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.fallback-actions a, .no-script { color: var(--warm); font-size: 14px; }
.no-script { position: absolute; bottom: 135px; left: 24px; padding: 12px; background: var(--glass); }
.view-controls {
  position: absolute;
  inset: auto 16px 16px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  pointer-events: none;
}
.view-controls div {
  display: flex;
  gap: 2px;
  padding: 4px;
  pointer-events: auto;
  border: 1px solid #edeedb26;
  border-radius: 7px;
  background: var(--glass);
  box-shadow: 0 4px 20px #08131966;
}
.view-controls button {
  display: inline-flex;
  gap: 7px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}
.view-controls button:hover { background: #f5e6c416; }
.view-controls button[aria-pressed="true"] {
  border-color: #d5ae6a38;
  color: var(--warm);
  background: #dcb87d1c;
}
.scene-notes {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 14px 1px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.scene-notes p { margin: 0; }
.scene-notes a { text-decoration-color: #b8c9be5c; text-underline-offset: 3px; }
.touch-help { display: none; }

@media (max-width: 670px) {
  .site { width: calc(100% - 20px); }
  .site-head { min-height: 84px; gap: 9px; }
  .heading { gap: 5px; flex-direction: column; align-items: flex-start; }
  h1 { font-size: 37px; }
  .view-type { font-size: 11px; }
  .pictures { font-size: 12px; min-height: 42px; padding: 0 9px; }
  .stage { height: min(69svh,660px); min-height: 360px; border-radius: 7px; }
  .view-controls { inset: auto 7px 7px; gap: 5px; }
  .view-controls div { padding: 3px; gap: 1px; }
  .view-controls button { min-width: 39px; min-height: 42px; padding: 0 7px; font-size: 12px; }
  .view-tools button { gap: 0; min-width: 40px; }
  .view-tools button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .view-tools svg { width: 18px; height: 18px; }
}
@media (pointer: coarse) {
  .mouse-help { display: none; }
  .touch-help { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .viewport { transition: none; }
}
