:root {
  --night: #071018;
  --night-soft: #0d1822;
  --ink: #e8e2d6;
  --muted: #a8b1b7;
  --line: rgba(232, 226, 214, 0.18);
  --amber: #d8a25d;
  --amber-bright: #f1c782;
  --blue: #8ca9b8;
  --danger: #a65f55;
  --panel: rgba(9, 17, 24, 0.78);
  --paper: #d9d1c4;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--night); color: var(--ink); }
body { font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif; }
button, textarea, input { font: inherit; }
button { color: inherit; }

.skip-link { position: fixed; left: 16px; top: -48px; z-index: 100; background: var(--paper); color: var(--night); padding: 10px 14px; }
.skip-link:focus { top: 12px; }

.topbar { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 42px; background: linear-gradient(180deg, rgba(4,9,14,.96), rgba(4,9,14,.3), transparent); }
.brand { display: flex; align-items: center; gap: 12px; font-family: "Songti SC", "Noto Serif CJK SC", serif; letter-spacing: .06em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--amber); color: var(--amber-bright); font-family: Georgia, serif; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.mode-chip, .icon-button { border: 1px solid var(--line); background: rgba(7,16,24,.66); color: var(--muted); padding: 8px 12px; font-size: 12px; letter-spacing: .04em; }
.icon-button { cursor: pointer; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--amber); color: var(--ink); }
.language-toggle { min-width: 46px; color: var(--amber-bright); font-weight: 650; }
.production-system[hidden] { display: none; }
.production-system { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 74px 28px 28px; background: rgba(3,7,10,.92); }
.production-system-shell { --cluster-color: #d8a25d; position: relative; width: min(1420px, 100%); max-height: 100%; overflow: auto; padding: 30px; border: 1px solid rgba(255,75,84,.38); background-color: #111517; background-image: radial-gradient(rgba(226,232,235,.13) .75px, transparent .75px); background-size: 18px 18px; box-shadow: 0 28px 80px rgba(0,0,0,.58); }
.production-system-close { position: absolute; z-index: 2; top: 18px; right: 18px; border: 1px solid rgba(255,255,255,.24); background: #191d20; padding: 8px 12px; cursor: pointer; }
.production-system-close:hover, .production-system-close:focus-visible { border-color: #ff4b54; color: #fff; outline: none; }
.production-system-head { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; padding: 22px; border: 1px solid rgba(255,75,84,.48); background: rgba(53,31,33,.72); }
.production-system-brand { display: inline-block; margin: 0 0 10px; padding: 5px 9px; background: #ff4b54; color: #fff; font-weight: 750; }
.production-system-head h2 { font: 700 28px/1.1 system-ui, sans-serif; }
.production-system-lead { margin: 10px 0 0; color: #d9dde0; font-size: 12px; line-height: 1.6; }
.production-system-edition { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 18px; border: 1px solid rgba(157,119,239,.74); background: rgba(29,26,37,.9); }
.production-system-edition b { color: #f2f0f5; font-size: 15px; }
.production-system-edition span, .production-system-edition small { color: #c9c5d2; font-size: 11px; }
.production-clusters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.production-clusters section { --cluster-color: #d99a3a; min-width: 0; padding: 14px; border: 1px solid color-mix(in srgb, var(--cluster-color) 72%, transparent); background: color-mix(in srgb, var(--cluster-color) 7%, rgba(16,19,21,.94)); }
.production-clusters section[data-cluster="content"] { --cluster-color: #d8d855; }
.production-clusters section[data-cluster="product"] { --cluster-color: #4dd3da; }
.production-clusters section > header { display: flex; align-items: flex-start; gap: 12px; padding: 3px 2px 12px; }
.production-clusters section > header small { flex: 0 0 auto; padding: 4px 7px; background: var(--cluster-color); color: #111; font: 750 13px/1 system-ui, sans-serif; }
.production-clusters h3 { margin: 0; color: #f2f1ed; font: 700 17px/1.2 system-ui, sans-serif; }
.production-clusters header p { margin: 5px 0 0; color: #bfc3c5; font-size: 10px; line-height: 1.4; }
.production-clusters ol { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.production-clusters li { position: relative; min-height: 86px; padding: 14px 15px; border: 1px solid color-mix(in srgb, var(--cluster-color) 62%, #34383a); background: rgba(28,31,31,.96); }
.production-clusters li:not(:last-child)::after { content: "↓"; position: absolute; left: 50%; bottom: -18px; z-index: 1; color: #909496; font: 15px/1 system-ui, sans-serif; transform: translateX(-50%); }
.production-clusters li.qa { border-color: rgba(255,75,84,.8); background: rgba(48,29,30,.96); }
.production-clusters li b { display: block; color: #f2f1ed; font-size: 14px; }
.production-clusters li em { display: block; margin-top: 9px; color: #c5c8c9; font-size: 10px; font-style: normal; line-height: 1.55; }
.production-clusters section > strong { display: block; margin-top: 12px; padding: 8px 10px; background: color-mix(in srgb, var(--cluster-color) 18%, #171a1b); color: #f1f0ec; font-size: 10px; font-weight: 650; }
.production-orchestration { display: grid; grid-template-columns: 150px 1fr; gap: 18px; margin-top: 18px; padding: 13px 16px; border: 1px solid rgba(157,119,239,.68); background: rgba(42,34,58,.78); font-size: 11px; line-height: 1.65; }
.production-orchestration b { color: #d8c8ff; }
.production-orchestration span { color: #dedbe5; }
.production-flow { display: flex; align-items: stretch; gap: 8px; margin-top: 12px; padding: 14px; border: 1px solid rgba(157,119,239,.52); background: rgba(26,24,33,.84); }
.production-flow > div { flex: 1 1 0; min-width: 0; padding: 11px 12px; border: 1px solid rgba(255,255,255,.18); background: #1b1e20; }
.production-flow b, .production-flow small { display: block; }
.production-flow b { color: #f0efeb; font-size: 11px; }
.production-flow small { margin-top: 7px; color: #afb3b5; font-size: 9px; line-height: 1.4; }
.production-flow i { align-self: center; color: #9b9fa1; font-style: normal; }
.production-system footer { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(255,75,84,.48); background: rgba(52,29,31,.78); color: #cfd1d2; font-size: 9px; line-height: 1.65; }
.audio-start { position: fixed; z-index: 70; left: 50%; top: 82px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; border: 1px solid rgba(216,162,93,.72); background: rgba(7,16,24,.94); color: var(--paper); padding: 11px 15px; cursor: pointer; box-shadow: 0 12px 36px rgba(0,0,0,.36); backdrop-filter: blur(12px); }
.audio-start[hidden] { display: none; }
.audio-start strong { color: var(--amber-bright); font-size: 12px; }
.audio-start span { color: var(--muted); font-size: 11px; }

.experience { position: relative; min-height: 100dvh; overflow: hidden; isolation: isolate; }
.cinema-bg { position: absolute; inset: 0; z-index: -3; background-image: url('./media/images/BookScene_EP01_SC001_Elsinore_KF_BitterWatch_IMG001_probe_v01_generated.png'); background-size: cover; background-position: center; transform: scale(1); transition-property: transform, transform-origin; transition-timing-function: ease-out; will-change: transform, transform-origin; }
.cinema-video { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; transition: opacity .45s ease; background: var(--night); }
.cinema-video.active { opacity: 1; }
.shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(4,9,14,.56) 0%, rgba(4,9,14,.06) 24%, rgba(4,9,14,.04) 64%, rgba(4,9,14,.86) 100%), linear-gradient(90deg, rgba(4,9,14,.34) 0%, transparent 38%, rgba(4,9,14,.12) 100%); }
.experience::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background-image: radial-gradient(rgba(255,255,255,.08) .7px, transparent .7px); background-size: 4px 4px; opacity: .12; }
.image-status { position: fixed; z-index: 12; top: 88px; right: 42px; padding: 9px 12px; border: 1px solid rgba(166,95,85,.72); background: rgba(20,9,10,.88); color: #f0c6bd; font-size: 12px; letter-spacing: .04em; }

.chapter-rail { position: absolute; z-index: 12; left: 42px; top: 128px; bottom: 104px; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.chapter-rail .eyebrow { writing-mode: vertical-rl; }
.rail-line { flex: 1; width: 30px; position: relative; }
.rail-line::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line); transform: translateX(-50%); }
.rail-line i { position: absolute; z-index: 1; top: 0; left: 50%; width: 1px; height: 10%; background: var(--amber); transform: translateX(-50%); transition: height .45s ease; }
.rail-scene-nav { position: absolute; z-index: 2; inset: 0; }
.rail-scene-button { position: absolute; left: 50%; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: 8px/1 Georgia, serif; letter-spacing: 0; cursor: pointer; transform: translate(-50%, -50%); transition: color .18s, transform .18s; }
.rail-scene-button::before { content: ""; position: absolute; z-index: -1; width: 16px; height: 16px; border: 1px solid rgba(232,226,214,.22); border-radius: 50%; background: rgba(7,16,24,.82); transition: border-color .18s, background .18s, transform .18s; }
.rail-scene-button:hover, .rail-scene-button:focus-visible { color: var(--ink); outline: 2px solid var(--amber-bright); outline-offset: 2px; }
.rail-scene-button:hover::before, .rail-scene-button:focus-visible::before { border-color: var(--amber); transform: scale(1.14); }
.rail-scene-button.visited { color: var(--amber-bright); }
.rail-scene-button.visited::before { border-color: rgba(216,162,93,.55); }
.rail-scene-button.active { color: var(--night); font-weight: 700; }
.rail-scene-button.active::before { border-color: var(--amber-bright); background: var(--amber-bright); transform: scale(1.14); }

.stage { min-height: 100dvh; display: flex; align-items: center; padding: 104px max(8vw, 112px) 112px max(11vw, 152px); }
.content { width: min(700px, 100%); animation: reveal .55s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.kicker { color: var(--amber-bright); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; margin: 0 0 16px; }
h1, h2 { font-family: "Songti SC", "Noto Serif CJK SC", Georgia, serif; font-weight: 500; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(44px, 6.2vw, 88px); line-height: .98; max-width: 820px; }
h2 { font-size: clamp(30px, 4vw, 54px); line-height: 1.12; }
.lead { max-width: 620px; color: #c6ccd0; font-size: clamp(16px, 1.45vw, 20px); line-height: 1.8; margin: 24px 0 0; }
.source-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 12px; }

.question-grid, .choice-grid, .evidence-grid { display: grid; gap: 12px; margin-top: 28px; }
.choice-grid { grid-template-columns: repeat(3, 1fr); }
.option-card, .evidence-card { appearance: none; text-align: left; border: 1px solid var(--line); background: var(--panel); padding: 18px; cursor: pointer; transition: border-color .2s, transform .2s, background .2s; backdrop-filter: blur(12px); }
.option-card:hover, .option-card:focus-visible, .evidence-card:hover, .evidence-card:focus-visible { border-color: var(--amber); transform: translateY(-2px); }
.option-card.selected, .evidence-card.selected { border-color: var(--amber-bright); background: rgba(81,60,36,.58); }
.option-card strong { display: block; font-family: "Songti SC", serif; font-size: 19px; margin-bottom: 8px; }
.option-card span, .evidence-card p { color: var(--muted); font-size: 13px; line-height: 1.55; }

.field { margin-top: 24px; }
.field label { display: block; color: var(--paper); margin-bottom: 10px; }
textarea { width: 100%; min-height: 116px; resize: vertical; color: var(--ink); border: 1px solid var(--line); background: rgba(5,12,18,.76); padding: 16px; outline: none; line-height: 1.7; }
textarea:focus { border-color: var(--amber); }
.confidence-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; margin-top: 18px; color: var(--muted); }
input[type="range"] { accent-color: var(--amber); }

.evidence-card { position: relative; padding-left: 52px; }
.evidence-card::before { content: attr(data-index); position: absolute; left: 18px; top: 18px; color: var(--amber); font: 18px Georgia, serif; }
.evidence-card strong { display: block; margin-bottom: 7px; }
.evidence-card small { display: block; color: var(--blue); margin-top: 10px; }
.sort-board { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 22px; }
.sort-column { border: 1px dashed var(--line); min-height: 92px; padding: 14px; background: rgba(5,12,18,.5); }
.sort-column h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--amber-bright); }
.sort-column p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

.agent-panel { margin-top: 24px; padding: 20px; border-left: 2px solid var(--amber); background: rgba(5,12,18,.8); }
.agent-panel .agent-label { color: var(--amber-bright); font-size: 11px; letter-spacing: .14em; }
.agent-panel p { line-height: 1.75; color: #d6d9da; }
.evidence-citation { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--blue); font-size: 12px; line-height: 1.6; }

.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.result-card { padding: 18px; border-top: 1px solid var(--amber); background: rgba(5,12,18,.72); }
.result-card small { color: var(--muted); }
.result-card strong { display: block; font: 26px "Songti SC", serif; margin-top: 8px; }

.bottom-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 82px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 42px; background: linear-gradient(0deg, rgba(4,9,14,.98), rgba(4,9,14,.76), transparent); }
.text-button, .primary-button { border: 0; background: transparent; cursor: pointer; }
.text-button { justify-self: start; color: var(--muted); }
.text-button:disabled { opacity: .25; cursor: default; }
.primary-button { justify-self: end; min-width: 142px; padding: 13px 20px; background: var(--paper); color: var(--night); font-weight: 600; }
.primary-button:hover, .primary-button:focus-visible { background: var(--amber-bright); }
.source-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.playback-toggle { border: 1px solid rgba(216,162,93,.55); border-radius: 999px; padding: 5px 10px; background: rgba(7,16,24,.72); color: var(--amber-bright); font: inherit; cursor: pointer; white-space: nowrap; }
.playback-toggle:hover, .playback-toggle:focus-visible { border-color: var(--amber-bright); color: #fff8ec; outline: none; }
.playback-toggle[aria-pressed="true"] { background: var(--amber-bright); color: var(--night); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #7ea489; box-shadow: 0 0 12px #7ea489; }
.shot-counter { min-width: 48px; color: var(--amber-bright); font: 12px Georgia, serif; letter-spacing: .08em; }

@media (max-width: 820px) {
  .topbar { height: 60px; padding: 0 18px; }
  .brand { font-size: 13px; }
  .mode-chip { display: none; }
  .production-system { padding: 68px 14px 14px; }
  .production-system-shell { padding: 18px; }
  .production-system-head { grid-template-columns: 1fr; padding: 18px; }
  .production-system-edition { margin-right: 42px; }
  .production-clusters { grid-template-columns: 1fr; }
  .production-flow { flex-direction: column; }
  .production-flow i { transform: rotate(90deg); }
  .production-orchestration { grid-template-columns: 1fr; gap: 5px; }
  .topbar-actions { gap: 6px; }
  .icon-button { padding: 7px 8px; font-size: 11px; }
  .language-toggle { min-width: 38px; }
  .audio-start { top: 68px; width: calc(100vw - 36px); justify-content: center; }
  .audio-start span { display: none; }
  .chapter-rail { left: 17px; top: 88px; bottom: 88px; }
  .chapter-rail .eyebrow { display: none; }
  .stage { padding: 86px 20px 112px 48px; align-items: flex-end; }
  .cinema-bg { background-position: 60% center; }
  .shade { background: linear-gradient(0deg, rgba(4,9,14,.9) 0%, rgba(4,9,14,.28) 34%, rgba(4,9,14,.04) 68%, rgba(4,9,14,.42) 100%); }
  .choice-grid, .result-grid { grid-template-columns: 1fr; }
  .sort-board { grid-template-columns: 1fr; }
  h1 { font-size: clamp(42px, 13vw, 66px); }
  h2 { font-size: 34px; }
  .lead { font-size: 15px; line-height: 1.65; }
  .bottom-nav { height: 72px; padding: 0 18px; grid-template-columns: auto 1fr auto; }
  .source-status { justify-self: center; }
  .source-status span:last-child { display: none; }
  .image-status { top: 68px; right: 18px; }
  .primary-button { min-width: 112px; padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Visual-first cinematic episode */
.stage.visual-first { padding: 0; display: block; }
.visual-scene { position: relative; width: 100%; height: 100dvh; }

.orientation-guide { display: none; }

@media (max-width: 820px) and (orientation: portrait) {
  .orientation-guide { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(3,7,10,.82); backdrop-filter: blur(12px); }
  .orientation-guide[hidden] { display: none; }
  .orientation-card { width: min(330px, 100%); padding: 30px 26px 24px; text-align: center; border: 1px solid rgba(216,162,93,.42); background: linear-gradient(160deg, rgba(18,29,38,.98), rgba(6,13,19,.98)); box-shadow: 0 24px 70px rgba(0,0,0,.5); }
  .rotate-phone { position: relative; width: 88px; height: 64px; margin: 0 auto 20px; }
  .rotate-phone span { position: absolute; left: 29px; top: 4px; width: 31px; height: 54px; border: 2px solid var(--amber-bright); border-radius: 6px; animation: phoneRotate 1.8s cubic-bezier(.2,.75,.25,1) infinite; }
  .rotate-phone::before { content: ""; position: absolute; inset: 4px; border: 1px dashed rgba(216,162,93,.32); border-radius: 50%; }
  .orientation-kicker { margin: 0 0 9px; color: var(--amber-bright); font-size: 10px; letter-spacing: .22em; }
  .orientation-card h2 { font-size: 30px; }
  .orientation-card > p:not(.orientation-kicker) { margin: 14px auto 22px; max-width: 16em; color: var(--muted); font-size: 14px; line-height: 1.7; }
  .orientation-card button { border: 0; border-bottom: 1px solid rgba(232,226,214,.42); padding: 8px 2px; background: transparent; color: var(--paper); font-size: 12px; cursor: pointer; }
  @keyframes phoneRotate { 0%, 20% { transform: rotate(0deg); } 55%, 85% { transform: rotate(90deg); } 100% { transform: rotate(0deg); } }
}

.ai-video-disclosure { position: absolute; z-index: 6; right: 42px; top: 88px; padding: 8px 11px; border: 1px solid rgba(232,226,214,.28); background: rgba(7,16,24,.72); color: var(--muted); font-size: 11px; letter-spacing: .06em; backdrop-filter: blur(10px); }
.scene-heading { position: absolute; left: max(8vw, 108px); top: 13vh; z-index: 3; max-width: min(34vw, 460px); text-shadow: 0 2px 24px rgba(0,0,0,.9); }
.scene-heading p { margin: 0 0 7px; color: var(--amber-bright); font-size: 9px; letter-spacing: .18em; }
.scene-heading h1 { font-size: clamp(30px, 3.5vw, 50px); line-height: 1.08; }
.hotspot-layer { position: absolute; inset: 0; z-index: 4; }
.visual-hotspot { position: absolute; width: 48px; height: 48px; transform: translate(-50%,-50%); border: 0; background: transparent; cursor: pointer; }
.visual-hotspot i { position: absolute; inset: 15px; border: 1px solid var(--amber-bright); border-radius: 50%; box-shadow: 0 0 0 6px rgba(216,162,93,.12), 0 0 22px rgba(216,162,93,.4); }
.visual-hotspot i::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--amber-bright); }
.visual-hotspot span { position: absolute; left: 34px; top: 8px; color: var(--paper); font: 11px Georgia,serif; opacity: 0; transition: opacity .2s; }
.visual-hotspot:hover span, .visual-hotspot:focus-visible span, .visual-hotspot.active span { opacity: 1; }
.visual-hotspot.active i { box-shadow: 0 0 0 10px rgba(216,162,93,.18), 0 0 32px rgba(216,162,93,.7); }
.interaction-dock { position: absolute; z-index: 7; left: 50%; bottom: 154px; width: min(780px, calc(100vw - 224px)); transform: translateX(-50%); }
.hotspot-card { position: relative; width: min(520px, 100%); margin: 0 auto; padding: 18px 20px; border-top: 1px solid var(--amber); background: rgba(5,12,18,.86); backdrop-filter: blur(14px); text-align: center; animation: hotspot-reveal .3s ease both; }
@keyframes hotspot-reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.hotspot-card small { color: var(--amber-bright); letter-spacing: .14em; text-transform: uppercase; }
.hotspot-card h3 { margin: 8px 0; font: 24px "Songti SC",serif; }
.hotspot-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.cinematic-subtitle { position: absolute; z-index: 5; left: 50%; bottom: 94px; transform: translateX(-50%); width: min(760px, 68vw); text-align: center; text-shadow: 0 2px 18px #000; }
.cinematic-subtitle.with-interaction { display: none; }
.cinematic-subtitle span { display: block; font: clamp(18px,2vw,28px) "Songti SC",serif; line-height: 1.45; }
.cinematic-subtitle small { display: block; margin-top: 9px; color: var(--muted); letter-spacing: .12em; }
.cinematic-choice { width: 100%; padding: 16px; background: rgba(4,9,14,.78); backdrop-filter: blur(16px); }
.cinematic-choice > p { margin: 0 0 11px; color: var(--amber-bright); text-align: center; font-size: 12px; letter-spacing: .14em; }
.cinematic-choice > div { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.cinematic-choice button { padding: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); cursor: pointer; }
.cinematic-choice button:hover, .cinematic-choice button.selected { border-color: var(--amber); background: rgba(216,162,93,.16); }
.cinematic-choice strong, .cinematic-choice small { display: block; }
.cinematic-choice small { margin-top: 5px; color: var(--muted); }
.analysis-drawer { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(480px, 92vw); padding: 90px 30px 30px; overflow: auto; background: rgba(7,16,24,.97); border-left: 1px solid var(--line); transform: translateX(104%); transition: transform .32s ease; }
.analysis-drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; z-index: 2; top: 82px; right: 26px; border: 1px solid var(--line); background: rgba(7,16,24,.92); padding: 8px 12px; cursor: pointer; }
.analysis-drawer h2 { font-size: 31px; }
.analysis-visual-summary { margin: 24px 0; padding: 16px; border-left: 2px solid var(--amber); background: rgba(255,255,255,.03); }
.analysis-visual-summary span { color: var(--amber-bright); font-size: 11px; }
.analysis-visual-summary p { margin: 7px 0 0; line-height: 1.55; }
.analysis-visual-summary .shot-drawer-note { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 10px; }
.analysis-evidence { display: grid; gap: 10px; }
.analysis-evidence article { padding: 14px; border: 1px solid var(--line); }
.analysis-evidence small { color: var(--blue); }
.analysis-evidence p { margin: 8px 0; line-height: 1.55; }
.analysis-evidence cite { color: var(--muted); font-size: 11px; font-style: normal; }
.scene-question { margin-top: 24px; }
.scene-question label { display: block; margin-bottom: 9px; color: var(--paper); }
.scene-question > div { display: flex; }
.scene-question input { min-width: 0; flex: 1; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--ink); padding: 12px; }
.scene-question button { border: 0; background: var(--paper); color: var(--night); padding: 0 14px; cursor: pointer; }
.agent-brief { margin-top: 15px; padding: 16px; background: rgba(216,162,93,.1); border-top: 1px solid var(--amber); }
.agent-brief small { color: var(--amber-bright); }
.agent-brief p { line-height: 1.6; }
.agent-route { margin-top: 13px; padding-top: 12px; border-top: 1px solid rgba(216,162,93,.28); }
.agent-route span, .agent-route strong { display: block; }
.agent-route span { color: var(--amber-bright); font-size: 10px; letter-spacing: .12em; }
.agent-route strong { margin-top: 6px; color: var(--paper); font-size: 13px; line-height: 1.55; font-weight: 500; }
.agent-trace { margin-top: 12px; color: var(--muted); font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .cinema-video.active { object-fit: contain; object-position: center center !important; background: #03070a; }
  .ai-video-disclosure { right: 18px; top: 68px; max-width: 180px; text-align: right; }
  .scene-heading { left: 48px; top: 12vh; max-width: 38vw; }
  .scene-heading h1 { font-size: 30px; }
  .interaction-dock { bottom: 150px; width: calc(100vw - 76px); }
  .hotspot-card { width: 100%; }
  .cinematic-subtitle { bottom: 86px; width: calc(100vw - 72px); }
  .cinematic-subtitle span { font-size: 19px; }
  .cinematic-subtitle small { font-size: 10px; }
  .cinematic-choice { width: 100%; }
  .cinematic-choice > div { grid-template-columns: 1fr; }
  .cinematic-choice small { display: none; }
  #analysisToggle { display: inline-flex; padding: 7px 9px; }
}

/* Phone landscape: keep the cinematic layer clear of compact browser chrome. */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { height: 48px; padding: 0 18px; }
  .brand { font-size: 12px; }
  .brand-mark { width: 26px; height: 26px; }
  .mode-chip { display: none; }
  .icon-button { padding: 6px 9px; }
  .chapter-rail { left: 18px; top: 66px; bottom: 66px; gap: 8px; }
  .chapter-rail .eyebrow { display: none; }
  .rail-line { width: 24px; }
  .rail-scene-button { width: 24px; height: 24px; font-size: 7px; }
  .rail-scene-button::before { width: 14px; height: 14px; }
  .ai-video-disclosure { top: 56px; right: 18px; padding: 6px 8px; }
  .scene-heading { left: 62px; top: 15%; max-width: 34vw; }
  .visual-scene.has-interaction .scene-heading { display: none; }
  .scene-heading h1 { font-size: clamp(25px, 4.2vw, 36px); }
  .interaction-dock { bottom: 112px; width: min(720px, calc(100vw - 170px)); }
  .hotspot-card { width: min(460px, 100%); padding: 13px 15px; }
  .hotspot-card h3 { font-size: 20px; }
  .hotspot-card p { font-size: 12px; line-height: 1.5; }
  .cinematic-subtitle { bottom: 61px; width: min(680px, 70vw); }
  .cinematic-subtitle span { font-size: 17px; }
  .cinematic-subtitle small { margin-top: 4px; font-size: 9px; }
  .cinematic-choice { width: 100%; padding: 10px; }
  .cinematic-choice > p { margin-bottom: 7px; }
  .cinematic-choice button { padding: 8px 10px; }
  .cinematic-subtitle.with-interaction { display: none; }
  .bottom-nav { height: 54px; padding: 0 18px; }
  .primary-button { min-width: 96px; padding: 9px 13px; }
  .analysis-drawer { width: min(440px, 72vw); padding: 60px 24px 20px; }
  .drawer-close { top: 72px; right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .rotate-phone span { animation: none; transform: rotate(90deg); }
}

/* Story atlas: characters, relationships, plot bridges, and complete ending. */
.scene-context-button { margin-top: 18px; border: 1px solid rgba(232,226,214,.3); background: rgba(7,16,24,.66); color: var(--paper); padding: 8px 12px; font-size: 11px; letter-spacing: .12em; cursor: pointer; backdrop-filter: blur(10px); }
.scene-context-button:hover, .scene-context-button:focus-visible { border-color: var(--amber); color: var(--amber-bright); }
.atlas-open { overflow: hidden; }
.story-atlas { position: fixed; inset: 0; z-index: 90; overflow: auto; background: #071018; color: var(--ink); }
.story-atlas[hidden] { display: none; }
.story-atlas::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 16% 14%, rgba(140,169,184,.12), transparent 28%), radial-gradient(circle at 82% 12%, rgba(216,162,93,.1), transparent 26%), linear-gradient(180deg, rgba(255,255,255,.02), transparent 30%); }
.story-atlas > header { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; min-height: 92px; padding: 20px 42px; border-bottom: 1px solid var(--line); background: rgba(7,16,24,.94); backdrop-filter: blur(16px); }
.story-atlas > header span { color: var(--amber-bright); font: 10px Georgia, serif; letter-spacing: .2em; }
.story-atlas > header h2 { margin-top: 5px; font-size: 30px; }
.atlas-close { width: 42px; height: 42px; border: 1px solid var(--line); background: transparent; color: var(--paper); font-size: 24px; cursor: pointer; }
.atlas-close:hover { border-color: var(--amber); }
.atlas-tabs { position: sticky; top: 92px; z-index: 3; display: grid; grid-template-columns: repeat(4,1fr); padding: 0 42px; border-bottom: 1px solid var(--line); background: rgba(7,16,24,.94); backdrop-filter: blur(16px); }
.atlas-tabs button { border: 0; border-bottom: 2px solid transparent; padding: 17px 12px 14px; background: transparent; color: var(--muted); cursor: pointer; }
.atlas-tabs button.selected { border-color: var(--amber); color: var(--amber-bright); }
.atlas-content { position: relative; z-index: 1; width: min(1240px, calc(100% - 84px)); margin: 0 auto; padding: 48px 0 88px; }
.atlas-intro { display: grid; grid-template-columns: minmax(220px,.7fr) minmax(420px,1.3fr); gap: 48px; align-items: end; margin-bottom: 32px; }
.atlas-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.atlas-intro strong { font: clamp(34px,5vw,64px) "Songti SC",serif; font-weight: 500; line-height: 1.05; }
.atlas-loading { color: var(--muted); padding: 80px 0; text-align: center; }
.character-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.atlas-character-card { min-width: 0; border: 1px solid var(--line); background: rgba(13,24,34,.78); overflow: hidden; cursor: pointer; transition: transform .2s,border-color .2s; }
.atlas-character-card:hover { transform: translateY(-3px); border-color: rgba(216,162,93,.66); }
.character-portrait { height: 210px; background-size: cover; background-position: center 34%; filter: saturate(.74) contrast(1.04); }
.character-grid .atlas-character-card > .character-portrait { height: auto; aspect-ratio: 941 / 1672; background-position: center top; }
.character-copy { padding: 20px; }
.atlas-role { min-height: 34px; margin: 0; color: var(--amber-bright); font-size: 11px; line-height: 1.5; letter-spacing: .06em; }
.atlas-character-card h3 { margin: 7px 0 17px; font: 29px "Songti SC",serif; }
.atlas-character-card dl, .atlas-character-card dd { margin: 0; }
.atlas-character-card dl { display: grid; gap: 13px; }
.atlas-character-card dl > div { border-top: 1px solid var(--line); padding-top: 10px; }
.atlas-character-card dt { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.atlas-character-card dd { margin-top: 6px; color: #d5d8da; font-size: 13px; line-height: 1.65; }
.atlas-character-card cite { display: block; margin-top: 18px; color: var(--blue); font-size: 10px; font-style: normal; line-height: 1.5; }
.relationship-intro { margin-bottom: 18px; }
.relationship-layout { display: grid; grid-template-columns: minmax(500px,1.35fr) minmax(350px,.65fr); gap: 18px; align-items: start; }
.relationship-map { position: relative; min-height: 540px; border: 1px solid var(--line); background: radial-gradient(circle at center, rgba(216,162,93,.09), transparent 32%), rgba(5,12,18,.6); }
.relationship-map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.relationship-map line { stroke: rgba(216,162,93,.48); stroke-width: .34; vector-effect: non-scaling-stroke; }
.relation-node { position: absolute; transform: translate(-50%,-50%); display: flex; width: 76px; height: 88px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid rgba(232,226,214,.28); border-radius: 11px; padding: 6px; background: rgba(13,24,34,.96); color: var(--paper); cursor: pointer; box-shadow: 0 0 0 5px rgba(7,16,24,.88); }
.relation-node:hover { border-color: rgba(216,162,93,.7); transform: translate(-50%,-53%); }
.relation-node.selected { border-color: var(--amber-bright); background: #31281e; color: var(--amber-bright); box-shadow: 0 0 0 5px rgba(7,16,24,.9), 0 0 0 6px rgba(216,162,93,.25); }
.relation-avatar { display: block; width: 42px; height: 52px; flex: 0 0 52px; border: 1px solid rgba(232,226,214,.28); border-radius: 4px; background-size: cover; background-position: center top; filter: saturate(.76) contrast(1.04); }
.relation-name { display: block; max-width: 100%; overflow: hidden; font: 11px/1.2 "Songti SC",serif; text-overflow: ellipsis; white-space: nowrap; }
.relationship-detail { min-width: 0; }
.relationship-detail .atlas-character-card { display: grid; grid-template-columns: 128px minmax(0,1fr); cursor: default; }
.relationship-detail .character-portrait { width: 128px; height: auto; aspect-ratio: 941 / 1672; align-self: start; background-position: center top; }
.relationship-detail .character-copy { padding: 14px 16px; }
.relationship-detail .atlas-role { min-height: 0; font-size: 10px; }
.relationship-detail .atlas-character-card h3 { margin: 5px 0 10px; font-size: 24px; }
.relationship-detail .atlas-character-card dl { gap: 8px; }
.relationship-detail .atlas-character-card dl > div { padding-top: 7px; }
.relationship-detail .atlas-character-card dd { margin-top: 4px; font-size: 11px; line-height: 1.5; }
.relationship-detail .atlas-character-card cite { margin-top: 10px; }
.relation-list { display: grid; gap: 8px; margin-top: 12px; }
.relation-list article { padding: 13px 15px; border-left: 2px solid var(--amber); background: rgba(255,255,255,.035); }
.relation-list strong { font-family: "Songti SC",serif; }
.relation-list p { margin: 5px 0; color: var(--paper); font-size: 12px; }
.relation-list small { color: var(--muted); line-height: 1.45; }
.scene-bridge { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; margin-bottom: 26px; padding: 22px 24px; border: 1px solid rgba(216,162,93,.4); background: rgba(216,162,93,.06); }
.scene-bridge i { width: 1px; background: rgba(216,162,93,.35); }
.scene-bridge small { color: var(--amber-bright); letter-spacing: .12em; }
.scene-bridge p { margin: 8px 0 0; color: #d4d7d9; font-size: 13px; line-height: 1.65; }
.plot-timeline { display: grid; gap: 12px; }
.plot-beat { display: grid; grid-template-columns: 66px 1fr; gap: 22px; padding: 24px; border: 1px solid var(--line); background: rgba(13,24,34,.58); }
.plot-beat.active { border-color: var(--amber); background: rgba(216,162,93,.09); }
.plot-index { color: var(--amber); font: 30px Georgia,serif; }
.plot-beat small { color: var(--blue); letter-spacing: .08em; }
.plot-beat h3 { margin: 7px 0 9px; font: 25px "Songti SC",serif; }
.plot-beat p { margin: 0; color: #c8cdd0; line-height: 1.72; }
.plot-beat strong { display: block; margin-top: 12px; color: var(--amber-bright); font-size: 13px; }
.plot-beat cite { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; font-style: normal; }
.ending-intro strong { font-size: clamp(30px,4.2vw,56px); }
.ending-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.ending-grid article { min-height: 240px; padding: 22px; border-top: 1px solid var(--amber); background: rgba(13,24,34,.72); }
.ending-grid article > span { float: right; color: rgba(216,162,93,.5); font: 26px Georgia,serif; }
.ending-grid small { color: var(--blue); letter-spacing: .1em; }
.ending-grid h3 { margin: 18px 0 10px; font: 27px "Songti SC",serif; }
.ending-grid p { color: #cbd0d2; font-size: 13px; line-height: 1.7; }
.ending-grid cite { display: block; color: var(--muted); font-size: 10px; font-style: normal; }
.ending-interpretation { margin-top: 16px; padding: 25px; border: 1px solid rgba(140,169,184,.34); background: rgba(140,169,184,.07); }
.ending-interpretation small { color: var(--blue); letter-spacing: .14em; }
.ending-interpretation p { margin: 9px 0 0; font: 19px/1.75 "Songti SC",serif; }
.atlas-restart { display: block; margin: 28px auto 0; border: 0; padding: 14px 24px; background: var(--paper); color: var(--night); font-weight: 650; cursor: pointer; }
.analysis-bridge { display: grid; gap: 9px; margin: 0 0 14px; padding: 15px; border: 1px solid rgba(216,162,93,.28); background: rgba(216,162,93,.05); }
.analysis-bridge small { color: var(--amber-bright); letter-spacing: .1em; }
.analysis-bridge p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.analysis-bridge button { justify-self: start; border: 0; border-bottom: 1px solid var(--amber); padding: 6px 0; background: transparent; color: var(--paper); cursor: pointer; }
.agent-brief h3 { margin: 10px 0; font: 20px "Songti SC",serif; }
.agent-evidence { margin: 12px 0; padding: 12px; border-left: 2px solid var(--blue); background: rgba(140,169,184,.08); }
.agent-evidence span { color: var(--blue); font-size: 9px; letter-spacing: .12em; }
.agent-evidence p { margin: 7px 0 0; font-size: 12px; }
.agent-uncertainty { color: var(--muted); font-size: 12px; }
.agent-sources { display: grid; gap: 7px; margin-top: 12px; }
.agent-sources article { padding: 10px; border: 1px solid var(--line); }
.agent-sources article p { margin: 5px 0; font-size: 11px; }
.agent-sources cite { color: var(--muted); font-size: 9px; font-style: normal; }

@media (max-width: 820px) {
  .atlas-toggle { max-width: 78px; line-height: 1.15; }
  .story-atlas > header { min-height: 72px; padding: 14px 18px; }
  .story-atlas > header h2 { font-size: 24px; }
  .atlas-tabs { top: 72px; padding: 0 10px; }
  .atlas-tabs button { padding: 13px 4px 11px; font-size: 11px; }
  .atlas-content { width: calc(100% - 28px); padding: 28px 0 70px; }
  .atlas-intro { grid-template-columns: 1fr; gap: 12px; }
  .atlas-intro strong { grid-row: 1; font-size: 38px; }
  .character-grid, .ending-grid { grid-template-columns: 1fr; }
  .character-portrait { height: 240px; }
  .relationship-layout { grid-template-columns: 1fr; }
  .relationship-map { min-height: 500px; }
  .relation-node { width: 64px; height: 76px; gap: 4px; padding: 5px; }
  .relation-avatar { width: 34px; height: 42px; flex-basis: 42px; }
  .relation-name { font-size: 10px; }
  .scene-bridge { grid-template-columns: 1fr; gap: 12px; }
  .scene-bridge i { width: 100%; height: 1px; }
  .plot-beat { grid-template-columns: 44px 1fr; gap: 12px; padding: 18px 15px; }
  .plot-index { font-size: 22px; }
  .scene-context-button { margin-top: 10px; padding: 6px 9px; }
}

@media (max-width: 520px) {
  .relationship-detail .atlas-character-card { grid-template-columns: 104px minmax(0,1fr); }
  .relationship-detail .character-portrait { width: 104px; }
  .relationship-detail .character-copy { padding: 12px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .story-atlas > header { min-height: 58px; padding: 9px 20px; }
  .story-atlas > header h2 { font-size: 21px; }
  .atlas-tabs { top: 58px; }
  .atlas-tabs button { padding: 10px 8px 8px; }
  .atlas-content { padding-top: 24px; }
  .character-grid { grid-template-columns: repeat(3,1fr); }
  .character-portrait { height: 150px; }
  .relationship-map { min-height: 430px; }
}

/* v06 atmosphere: luminous court surfaces instead of a black UI shell. */
.cinema-bg { filter: brightness(1.12) saturate(.86) contrast(.96); }
.cinema-video { filter: brightness(1.08) saturate(.9) contrast(.97); }
.shade { background: linear-gradient(180deg, rgba(23,24,24,.3) 0%, rgba(23,24,24,.02) 27%, rgba(23,24,24,.02) 63%, rgba(23,24,24,.62) 100%), linear-gradient(90deg, rgba(23,24,24,.18) 0%, transparent 42%, rgba(23,24,24,.06) 100%); }
.topbar { color: #292722; background: linear-gradient(180deg, rgba(242,238,229,.94), rgba(242,238,229,.62), transparent); }
.topbar .mode-chip, .topbar .icon-button { border-color: rgba(71,61,47,.22); background: rgba(247,243,235,.72); color: #514c43; }
.topbar .icon-button:hover, .topbar .icon-button:focus-visible { border-color: #a77c42; color: #24211d; }
.brand-mark { border-color: #aa7a39; color: #8d622d; background: rgba(255,255,255,.38); }
.bottom-nav { color: #292722; background: linear-gradient(0deg, rgba(242,238,229,.97), rgba(242,238,229,.78), transparent); }
.bottom-nav .text-button, .bottom-nav .source-status { color: #514c43; }
.bottom-nav .shot-counter { color: #8d622d; }
.bottom-nav .primary-button { background: #f8f5ee; color: #292722; box-shadow: 0 7px 22px rgba(38,31,22,.14); }

.story-atlas { --atlas-bg: #ece7dc; --atlas-ink: #24231f; --atlas-muted: #6e685d; --atlas-line: rgba(60,52,42,.17); --atlas-gold: #9b713b; background: var(--atlas-bg); color: var(--atlas-ink); }
.story-atlas::before { background: radial-gradient(circle at 12% 8%, rgba(255,255,255,.9), transparent 30%), radial-gradient(circle at 88% 5%, rgba(177,139,85,.12), transparent 30%), repeating-linear-gradient(90deg, transparent 0 79px, rgba(96,79,57,.025) 80px); }
.story-atlas > header, .atlas-tabs { border-color: var(--atlas-line); background: rgba(244,240,231,.94); color: var(--atlas-ink); }
.story-atlas > header span, .atlas-role, .atlas-tabs button.selected, .scene-bridge small, .plot-beat strong { color: var(--atlas-gold); }
.atlas-close { border-color: var(--atlas-line); color: var(--atlas-ink); background: rgba(255,255,255,.36); }
.atlas-tabs button, .atlas-intro p, .atlas-character-card dt, .atlas-character-card cite, .relation-list small, .plot-beat cite, .ending-grid cite { color: var(--atlas-muted); }
.atlas-character-card, .plot-beat, .ending-grid article { border-color: var(--atlas-line); background: rgba(248,245,237,.9); box-shadow: 0 14px 38px rgba(50,42,32,.07); }
.atlas-character-card:hover { border-color: rgba(155,113,59,.55); box-shadow: 0 18px 42px rgba(50,42,32,.11); }
.character-portrait { filter: saturate(.82) brightness(1.12) contrast(.96); background-color: #ddd4c4; }
.atlas-character-card dl > div { border-color: var(--atlas-line); }
.atlas-character-card dd, .plot-beat p, .ending-grid p, .scene-bridge p { color: #4b473f; }
.relationship-map { border-color: var(--atlas-line); background: radial-gradient(circle at center, rgba(177,139,85,.13), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.72), rgba(225,217,202,.72)); }
.relationship-map line { stroke: rgba(126,91,47,.48); }
.relation-node { border-color: rgba(77,65,49,.2); background: rgba(249,246,239,.98); color: var(--atlas-ink); box-shadow: 0 0 0 5px rgba(236,231,220,.9), 0 8px 20px rgba(48,40,31,.1); }
.relation-node.selected { border-color: #a2753a; background: #fffaf0; color: #7f5727; box-shadow: 0 0 0 5px rgba(236,231,220,.94), 0 0 0 6px rgba(155,113,59,.22); }
.relation-avatar { border-color: rgba(77,65,49,.18); filter: saturate(.82) brightness(1.12) contrast(.96); background-color: #ddd4c4; }
.relation-list article { border-color: var(--atlas-gold); background: rgba(255,255,255,.48); }
.relation-list p { color: var(--atlas-ink); }
.scene-bridge { border-color: rgba(155,113,59,.3); background: rgba(255,250,240,.58); }
.scene-bridge i { background: rgba(155,113,59,.28); }
.plot-beat.active { border-color: var(--atlas-gold); background: #fff9ed; }
.plot-index { color: var(--atlas-gold); }
.plot-beat small, .ending-grid small, .ending-interpretation small { color: #647984; }
.ending-interpretation { border-color: rgba(100,121,132,.26); background: rgba(255,255,255,.46); }
.atlas-restart { background: #2e2b26; color: #f5f0e6; }
@media (max-width: 820px) { .shade { background: linear-gradient(0deg, rgba(23,24,24,.68) 0%, rgba(23,24,24,.14) 38%, rgba(23,24,24,.02) 68%, rgba(23,24,24,.25) 100%); } }

/* v07 relationship map: larger portraits, explicit bidirectional edges and labels. */
.relationship-layout { grid-template-columns: minmax(640px,1.58fr) minmax(310px,.42fr); gap: 14px; }
.relationship-map { min-height: 570px; overflow: hidden; }
.relationship-map svg { z-index: 0; }
.relationship-map marker path { fill: rgba(126,91,47,.72); }
.relationship-map line { stroke: rgba(126,91,47,.46); stroke-width: 1.15; transition: stroke .2s, stroke-width .2s, opacity .2s; }
.relationship-map line.related { stroke: #9b713b; stroke-width: 2.2; opacity: 1; }
.relation-node { z-index: 3; width: 100px; height: 124px; gap: 7px; border-radius: 13px; padding: 8px; }
.relation-avatar { width: 66px; height: 82px; flex-basis: 82px; border-radius: 6px; }
.relation-name { font-size: 12px; }
.relation-edge-label { position: absolute; z-index: 2; transform: translate(-50%,-50%); max-width: 132px; padding: 4px 7px; overflow: hidden; border: 1px solid rgba(98,80,58,.14); border-radius: 999px; background: rgba(245,240,231,.92); color: #6b6256; box-shadow: 0 3px 12px rgba(42,34,25,.08); font-size: 9px; line-height: 1.15; text-align: center; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.relation-edge-label b { margin-right: 4px; color: #9b713b; font-size: 10px; }
.relation-edge-label.related { z-index: 4; border-color: rgba(155,113,59,.48); background: #fff8eb; color: #493c2c; box-shadow: 0 4px 16px rgba(106,77,40,.16); font-weight: 650; }
.relationship-detail .atlas-character-card { grid-template-columns: 142px minmax(0,1fr); }
.relationship-detail .character-portrait { width: 142px; }

@media (max-width: 1040px) {
  .relationship-layout { grid-template-columns: 1fr; }
  .relationship-map { min-height: 600px; }
}
@media (max-width: 820px) {
  .relationship-map { min-height: 560px; }
  .relation-node { width: 76px; height: 98px; padding: 6px; }
  .relation-avatar { width: 50px; height: 62px; flex-basis: 62px; }
  .relation-edge-label { max-width: 96px; padding: 3px 5px; font-size: 8px; }
}

/* v08 completion: independent floating controls; no full-width pale navigation boards. */
.topbar,
.bottom-nav {
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
.topbar > *,
.bottom-nav > * {
  pointer-events: auto;
}
.brand,
.topbar .mode-chip,
.topbar .icon-button,
.bottom-nav .text-button,
.bottom-nav .source-status,
.bottom-nav .primary-button {
  border: 1px solid rgba(205, 164, 98, .52);
  background: rgba(25, 27, 27, .72);
  color: #f5ead7;
  box-shadow: 0 8px 26px rgba(8, 10, 10, .2);
  backdrop-filter: blur(12px) saturate(.9);
  -webkit-backdrop-filter: blur(12px) saturate(.9);
}
.brand { padding: 7px 11px 7px 7px; border-radius: 999px; }
.brand-mark { background: rgba(210, 170, 103, .15); color: #f2cf91; }
.topbar .mode-chip,
.topbar .icon-button,
.bottom-nav .text-button,
.bottom-nav .source-status { border-radius: 999px; }
.bottom-nav .text-button { padding: 10px 16px; }
.bottom-nav .source-status { padding: 9px 14px; }
.bottom-nav .primary-button { background: rgba(246, 232, 205, .93); color: #29241d; }
.bottom-nav .shot-counter { color: #f1c984; }
.bottom-nav .source-status span:last-child,
.bottom-nav .text-button { color: #f5ead7; }
.topbar .icon-button:hover,
.topbar .icon-button:focus-visible,
.bottom-nav button:hover,
.bottom-nav button:focus-visible { border-color: #f0c77f; color: #fff8ec; }
.perspective-compare,
.choice-carry {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(177, 139, 85, .28);
  border-radius: 14px;
  background: rgba(255, 250, 240, .52);
}
.perspective-compare > p,
.choice-carry p { margin: 0 0 10px; }
.perspective-compare > div { display: flex; flex-wrap: wrap; gap: 8px; }
.perspective-compare button {
  padding: 7px 10px;
  border: 1px solid rgba(91, 72, 49, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .58);
  color: #51483c;
}
.perspective-compare button.selected { border-color: #9b713b; background: #fff5df; color: #75501f; }
.perspective-compare small { display: block; margin-top: 10px; color: #625a4f; }
.perspective-compare small strong { margin-right: 8px; color: #9b713b; }
.interaction-dock .perspective-compare {
  width: 100%;
  background: rgba(248, 242, 230, .9);
  box-shadow: 0 12px 32px rgba(8, 10, 10, .22);
  backdrop-filter: blur(14px);
}
.interaction-dock .perspective-compare button { min-height: 44px; padding: 10px 14px; cursor: pointer; }
#narrationToggle[data-status="missing"] { border-style: dashed; border-color: #e1ad57; color: #f4d69f; }

@media (max-width: 820px) {
  .topbar { padding: 9px 10px; gap: 7px; }
  .brand { padding: 5px 8px 5px 5px; font-size: 12px; }
  .topbar-actions { gap: 5px; }
  .topbar .mode-chip,
  .topbar .icon-button { min-height: 44px; padding: 8px 9px; font-size: 11px; }
  .bottom-nav { grid-template-columns: auto minmax(0,1fr) auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 7px; }
  .bottom-nav .text-button { padding: 8px 11px; }
  .bottom-nav .source-status { min-width: 0; max-width: min(52vw, 260px); padding: 7px 10px; overflow: hidden; }
  .bottom-nav .primary-button { min-height: 44px; padding: 8px 13px; }
  .interaction-dock .perspective-compare > p,
  .interaction-dock .perspective-compare small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 560px) {
  .brand > span:last-child,
  #videoSoundToggle { display: none; }
  .brand { padding-right: 5px; }
  .topbar-actions { margin-left: auto; }
  .bottom-nav .status-dot,
  .bottom-nav .source-status > span:last-child { display: none; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding-top: 6px; padding-bottom: 6px; }
  .brand { padding-top: 4px; padding-bottom: 4px; }
  .topbar .mode-chip,
  .topbar .icon-button { min-height: 40px; padding: 7px 8px; }
  .bottom-nav { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  .bottom-nav .text-button,
  .bottom-nav .source-status,
  .bottom-nav .primary-button { min-height: 40px; padding-top: 5px; padding-bottom: 5px; }
}
