:root {
  color-scheme: dark;
  --ink: #eee7d7;
  --muted: #a9a18e;
  --faint: rgba(238, 231, 215, .16);
  --line: rgba(238, 231, 215, .22);
  --paper: #b99160;
  --night: #11100d;
  --focus: #d6b982;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--night); color: var(--ink); }
body { overflow: hidden; font-family: "Songti TC", "Songti SC", "STSong", "Noto Serif CJK TC", "Noto Serif CJK SC", Georgia, serif; -webkit-font-smoothing: antialiased; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.entry {
  min-height: 100dvh; display: grid; place-items: center; padding: 32px 24px;
  background: #11100d;
}
.entry-inner { width: min(100%, 620px); text-align: center; }
.eyebrow { margin: 0 0 28px; color: var(--paper); font: 600 11px/1.3 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .2em; text-transform: uppercase; }
.entry h1 { margin: 0; color: var(--ink); font-size: clamp(42px, 10vw, 104px); font-weight: 400; letter-spacing: .08em; line-height: .98; }
.title-original { margin: 22px 0 30px; color: var(--muted); font-size: clamp(18px, 3vw, 28px); letter-spacing: .18em; }
.entry-lead { margin: 0; color: var(--ink); font-size: clamp(18px, 2.5vw, 24px); line-height: 1.5; }
.entry-subtitle { margin: 10px auto 34px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.headphones { margin: 0 0 18px; color: var(--paper); font: 600 11px/1.3 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .18em; }
.enter-button { border: 1px solid var(--line); border-radius: 1px; padding: 12px 22px; background: transparent; color: var(--ink); font-size: 14px; letter-spacing: .08em; transition: border-color 160ms ease, background-color 160ms ease; }
.enter-button:hover { border-color: var(--paper); background: rgba(185, 145, 96, .10); }
.entry-status { min-height: 1.4em; margin: 16px 0 0; color: var(--muted); font-size: 12px; }

.experience { position: relative; min-height: 100dvh; display: flex; flex-direction: column; background: var(--night); }
.topbar, .bottom-bar { position: relative; z-index: 5; flex: none; display: flex; align-items: center; gap: 16px; padding: 12px clamp(14px, 3vw, 36px); background: rgba(17, 16, 13, .94); }
.topbar { min-height: 54px; justify-content: space-between; border-bottom: 1px solid var(--faint); }
.back-link, .chrome-button { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-decoration: none; }
.back-link:hover, .chrome-button:hover { color: var(--ink); }
.back-link { white-space: nowrap; }
.topbar-center { display: flex; align-items: baseline; gap: 10px; min-width: 0; text-align: center; }
.scene-number { color: var(--paper); font: 11px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .12em; }
.scene-title { overflow: hidden; color: var(--ink); font-size: 12px; letter-spacing: .12em; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.chrome-button { border: 0; padding: 5px 0; background: transparent; }
.chrome-button[aria-pressed="false"] { color: var(--paper); }
.language-control select { min-width: 80px; border: 1px solid var(--faint); border-radius: 1px; padding: 5px 7px; background: #171510; color: var(--ink); font-size: 11px; }

.pan-viewport { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-color: rgba(238,231,215,.4) transparent; scrollbar-width: thin; touch-action: pan-x; outline: none; }
.pan-viewport:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.stage { position: relative; flex: none; height: clamp(220px, 62dvh, 520px); width: 1000px; margin: 0; background: #191712; }
.artwork { position: absolute; inset: 0; display: block; width: 100%; height: 100%; user-select: none; object-fit: fill; }
.living-layers { position: absolute; inset: 0; pointer-events: none; }
.living-overlay { position: absolute; overflow: visible; opacity: 0; transform-origin: 50% 58%; will-change: transform, opacity; }
.living-overlay img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }
.living-patch { position: absolute; z-index: 3; overflow: hidden; opacity: 0; will-change: opacity; }
.living-patch img { display: block; width: 100%; height: 100%; object-fit: fill; user-select: none; }
.legacy-living-overlay { display: none !important; }
.living-overlay::after { content: ""; position: absolute; left: 44%; top: 45%; width: 10%; height: 10%; border-radius: 50%; opacity: 0; background: rgba(238, 219, 169, .52); filter: blur(5px); transition: opacity 240ms ease; }
.living-overlay.is-near::after { opacity: .16; }

/* Development-only diagnostics are injected only for ?debug=living or
   ?debug=motion. Normal production pages never create this layer. */
.living-debug-layer { position: absolute; z-index: 30; inset: 0; pointer-events: none; }
.living-debug-box { position: absolute; border: 2px dashed #f4bd61; background: rgba(244, 189, 97, .08); box-shadow: 0 0 0 1px rgba(17, 16, 13, .9); }
.living-debug-box[data-playing="true"] { border-color: #8fe3c0; background: rgba(143, 227, 192, .08); }
.living-debug-anchor { position: absolute; width: 14px; height: 14px; border: 2px solid #fff0c4; border-radius: 50%; background: #d36f62; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px rgba(17, 16, 13, .9); }
.living-debug-label { position: absolute; top: 4px; left: 4px; z-index: 1; margin: 0; padding: 5px 7px; color: #fff6de; background: rgba(17, 16, 13, .92); font: 600 10px/1.35 ui-monospace, "SFMono-Regular", Menlo, monospace; white-space: pre; }
.living-debug-box[data-object="scene02_dancer"] .living-debug-label { top: 4px; left: auto; right: 4px; }
.living-debug-box[data-object="scene02_han_drum"] .living-debug-label { top: auto; bottom: 4px; left: 4px; }
.living-debug-layer[data-mode="motion"]::before { content: "DEBUG MOTION · all living layers forced on"; position: absolute; z-index: 2; top: 10px; left: 10px; padding: 6px 8px; color: #11100d; background: #8fe3c0; font: 700 10px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .08em; }

.bottom-bar { min-height: 52px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, 28vw); gap: 18px; border-top: 1px solid var(--faint); }
.interaction-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.progress-wrap { height: 1px; overflow: hidden; background: var(--faint); }
.progress { display: block; width: 0; height: 100%; background: var(--paper); transition: width 80ms linear; }

.about-panel { position: absolute; z-index: 10; top: 66px; right: clamp(14px, 3vw, 36px); width: min(390px, calc(100vw - 28px)); padding: 24px; border: 1px solid var(--line); background: #171510; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.about-panel .eyebrow { margin-bottom: 18px; }
.about-panel h2 { margin: 0 0 14px; color: var(--ink); font-size: 28px; font-weight: 400; letter-spacing: .08em; }
.about-panel p:not(.eyebrow) { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.about-panel .about-credit { color: #8b836f; font-size: 12px; }
.about-close { position: absolute; top: 9px; right: 12px; border: 0; padding: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.about-close:hover { color: var(--ink); }

.noscript { margin: 0; padding: 24px; color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

@media (max-width: 700px) {
  .topbar { min-height: 78px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "back actions" "scene scene"; align-items: center; gap: 6px 10px; padding-block: 8px; }
  .back-link { grid-area: back; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar-center { grid-area: scene; position: static; max-width: none; justify-content: center; transform: none; }
  .scene-title { max-width: 74vw; }
  .topbar-actions { gap: 8px; margin-left: auto; }
  .chrome-button { font-size: 11px; }
  .language-control select { min-width: 66px; padding-inline: 4px; font-size: 10px; }
  .stage { height: clamp(210px, 48dvh, 360px); }
  .bottom-bar { grid-template-columns: 1fr; gap: 8px; padding-block: 10px; }
  .progress-wrap { grid-row: 1; }
  .interaction-hint { font-size: 11px; }
  .about-panel { top: 84px; }
}

.living-overlay[data-object="scene02_dancer"]::after,
.living-overlay[data-object="scene02_han_drum"]::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  .enter-button, .living-overlay::after, .progress { transition: none; }
  .living-overlay { transform: none !important; }
}

@media (max-width: 700px) {
  .living-debug-label { max-width: 42vw; overflow: hidden; font-size: 8px; }
}
