/* 《山海汴京圖》v4 — Museum-Grade Song Scroll Mounting & Full-Responsive Ink-Jade UI */
:root {
  --ink-deep: #131c22;
  --ink-glass: rgba(14, 22, 27, 0.76);
  --ink-border: rgba(235, 222, 194, 0.24);
  --xuan: #f3ead4;
  --xuan-dim: rgba(243, 234, 212, 0.80);
  --cinnabar: #b93226;
  --cinnabar-bright: #d44234;
  --gold: #d9b168;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", "Source Han Serif TC", "STSong", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #141c20;
  color: var(--xuan);
  font-family: var(--serif);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#glCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#glCanvas:active { cursor: grabbing; }

/* Subtle Silk Scroll Mounting Border (fades cleanly on entry) */
.scroll-mount {
  position: fixed;
  top: calc(14px + var(--safe-t));
  right: calc(14px + var(--safe-r));
  bottom: calc(14px + var(--safe-b));
  left: calc(14px + var(--safe-l));
  border: 1px solid rgba(244, 232, 200, 0.34);
  box-shadow: inset 0 0 0 1px rgba(24, 34, 38, 0.22);
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.9s ease, inset 0.9s ease;
}
body.is-entered .scroll-mount {
  opacity: 0;
  inset: 0;
}

/* Whisper-quiet museum opening attribution (top-left, zero collision with enter-stage or colophon!) */
.opening-credit {
  position: fixed;
  top: calc(24px + var(--safe-t));
  left: calc(24px + var(--safe-l));
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 140px);
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(16, 24, 28, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(243, 234, 212, 0.24);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: rgba(246, 238, 218, 0.90);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.credit-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cinnabar-bright);
  box-shadow: 0 0 8px rgba(212, 66, 52, 0.8);
}
body.is-entered .opening-credit { opacity: 0; }

/* Unified Entered Top HUD Bar (guaranteed zero plaque/links overlap at every width!) */
.top-hud {
  position: fixed;
  top: calc(14px + var(--safe-t));
  left: calc(14px + var(--safe-l));
  right: calc(14px + var(--safe-r));
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}
body.is-entered .top-hud {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.top-plaque {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 13px;
  background: var(--ink-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.plaque-seal {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  background: var(--cinnabar-bright);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(212, 66, 52, 0.65);
}
.plaque-brand {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--xuan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plaque-divider {
  width: 1px;
  height: 12px;
  flex-shrink: 0;
  background: rgba(243, 234, 212, 0.24);
}
.plaque-meta, .plaque-stats {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--xuan-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.plaque-stats { color: var(--gold); }

.top-links {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  pointer-events: auto;
}
.mini-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 11px;
  background: var(--ink-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  color: var(--xuan);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.3s;
}
.mini-link:hover {
  background: rgba(185, 50, 38, 0.85);
  border-color: rgba(243, 234, 212, 0.45);
}

/* Pure Painting Mode (Hide UI / 藏鏡) */
body.hud-hidden .top-plaque,
body.hud-hidden .top-links .mini-link:not(.hud-toggle-btn),
body.hud-hidden .dock,
body.hud-hidden .region-toast {
  opacity: 0 !important;
  pointer-events: none !important;
}
body.hud-hidden .top-plaque {
  transform: translateY(-8px);
}
body.hud-hidden .hud-toggle-btn {
  opacity: 0.58;
}
body.hud-hidden .hud-toggle-btn:hover {
  opacity: 1;
}

/* Classical Vertical Song Colophon & Twin Cinnabar Seals */
.colophon {
  position: fixed;
  top: calc(34px + var(--safe-t));
  right: calc(34px + var(--safe-r));
  z-index: 8;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 13px;
  padding: 16px 18px 20px 22px;
  pointer-events: none;
  background: radial-gradient(ellipse at 65% 45%, rgba(244, 236, 214, 0.62) 0%, rgba(244, 236, 214, 0.22) 55%, rgba(244, 236, 214, 0) 82%);
  border-radius: 16px;
  transition: opacity 0.85s ease, transform 0.85s ease;
}
body.is-entered .colophon {
  opacity: 0;
  transform: translateX(18px);
}
.colophon-title {
  writing-mode: vertical-rl;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #161d22;
  text-shadow: 0 1px 16px rgba(248, 240, 220, 0.88);
  line-height: 1.05;
}
.colophon-sub {
  writing-mode: vertical-rl;
  font-size: 13px;
  letter-spacing: 0.24em;
  color: #25343b;
  padding-top: 6px;
  text-shadow: 0 1px 10px rgba(248, 240, 220, 0.92);
}
.seals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}
.seal-stamp {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 9.5px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--cinnabar);
  border: 1.5px solid var(--cinnabar);
  background: rgba(246, 238, 218, 0.72);
  border-radius: 3px;
}
.seal-stamp.solid {
  background: var(--cinnabar);
  color: #f8f0dc;
}

/* Opening Enter Button Stage */
.enter-stage {
  position: fixed;
  left: 50%;
  bottom: calc(34px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 10;
  width: min(92vw, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  transition: opacity 0.65s ease, transform 0.65s ease;
}
body.is-entered .enter-stage {
  opacity: 0;
  transform: translate(-50%, 16px);
  visibility: hidden;
}
.enter-btn {
  pointer-events: auto;
  min-height: 46px;
  padding: 12px 36px;
  background: rgba(185, 50, 38, 0.93);
  color: #fbf4e4;
  border: 1px solid rgba(250, 226, 178, 0.65);
  border-radius: 999px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 12px 36px rgba(18, 12, 10, 0.42), inset 0 1px 0 rgba(255, 240, 210, 0.35);
  transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}
.enter-btn:hover {
  transform: translateY(-2px);
  background: #c93b2d;
  box-shadow: 0 16px 42px rgba(185, 50, 38, 0.48);
}
.enter-hint {
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(14, 22, 26, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(243, 234, 212, 0.22);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.06em;
  color: rgba(248, 240, 220, 0.94);
  text-align: center;
  max-width: 100%;
}
.hint-touch { display: none; }

/* Poetic Realm Discovery Whisper Banner */
.region-toast {
  position: fixed;
  top: calc(60px + var(--safe-t));
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 11;
  max-width: calc(100vw - 28px);
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(14, 22, 27, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(235, 222, 194, 0.28);
  color: #f6ecd6;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.region-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 3D Split Curtain Labels */
.curtain-handle {
  position: fixed;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.curtain-handle.visible { opacity: 1; }
.curtain-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.curtain-pill.left {
  background: rgba(244, 235, 212, 0.88);
  color: #1a2429;
  border: 1px solid rgba(26, 36, 41, 0.25);
}
.curtain-pill.right {
  background: rgba(12, 22, 28, 0.88);
  color: #6ef0e6;
  border: 1px solid rgba(110, 240, 230, 0.42);
}

/* Bottom Translucent Ink-Jade Control Dock — Desktop Single Sleek Row (>= 1160px) */
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translate(-50%, 16px);
  z-index: 12;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100vw - 24px - var(--safe-l) - var(--safe-r));
  padding: 7px 11px;
  background: var(--ink-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ink-border);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
}
body.is-entered .dock {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.dock-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.dock-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.dock-sep {
  width: 1px;
  height: 16px;
  flex-shrink: 0;
  background: rgba(243, 234, 212, 0.22);
  margin: 0 1px;
}
.dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--xuan-dim);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.dock-btn:hover {
  background: rgba(243, 234, 212, 0.12);
  color: var(--xuan);
}
.dock-btn.active {
  background: rgba(185, 50, 38, 0.90);
  border-color: rgba(250, 224, 176, 0.45);
  color: #fff8ea;
}
.dock-btn.subtle {
  color: var(--gold);
  border-color: rgba(217, 177, 104, 0.30);
}

.curtain-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 3px;
  flex-shrink: 0;
}
.curtain-label {
  font-size: 11.5px;
  color: var(--gold);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
#curtainSlider {
  width: 72px;
  accent-color: var(--cinnabar-bright);
  cursor: pointer;
  touch-action: pan-x;
}

.noscript-fallback {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 32px;
  background: #141c20;
  color: var(--xuan);
}

/* ==========================================================================
   Breakpoint 1: Medium Desktop / Tablets / Landscape (<= 1220px)
   Clean symmetrical 2-row dock, hide verbose plaque metadata
   ========================================================================== */
@media (max-width: 1220px) {
  .top-plaque .plaque-meta,
  .top-plaque .div-meta { display: none; }

  .dock {
    flex-direction: column;
    gap: 6px;
    padding: 7px 11px;
  }
  .dock-sep-main { display: none; }
  .dock-row {
    max-width: 100%;
    justify-content: center;
  }
  .dock-scroll {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }
  .dock-scroll::-webkit-scrollbar { display: none; }
}

/* ==========================================================================
   Breakpoint 2: Coarse Touch Devices — Tailored Gesture Hint
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline-block; }
}

/* ==========================================================================
   Breakpoint 3: Mobile Portrait & Compact Screens (<= 640px)
   Anchored edge-to-edge dock, zero horizontal overflow, clean top HUD
   ========================================================================== */
@media (max-width: 640px) {
  .scroll-mount {
    top: calc(10px + var(--safe-t));
    right: calc(10px + var(--safe-r));
    bottom: calc(10px + var(--safe-b));
    left: calc(10px + var(--safe-l));
  }

  .opening-credit {
    top: calc(18px + var(--safe-t));
    left: calc(16px + var(--safe-l));
    font-size: 9.5px;
    padding: 4px 9px;
  }
  .opening-credit .credit-extra { display: none; }

  .colophon {
    top: calc(18px + var(--safe-t));
    right: calc(14px + var(--safe-r));
    padding: 10px 11px 12px 13px;
    gap: 8px;
  }
  .colophon-title { font-size: 28px; letter-spacing: 0.18em; }
  .colophon-sub { font-size: 11px; letter-spacing: 0.18em; padding-top: 4px; }
  .seal-stamp { width: 23px; height: 23px; font-size: 8px; }

  .enter-stage {
    bottom: calc(22px + var(--safe-b));
    width: calc(100vw - 28px);
    gap: 8px;
  }
  .enter-btn {
    padding: 11px 28px;
    font-size: 15px;
    letter-spacing: 0.2em;
    text-indent: 0.2em;
  }
  .enter-hint {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 14px;
  }
  .hint-desktop { display: none; }
  .hint-touch { display: inline-block; }

  .top-hud {
    top: calc(10px + var(--safe-t));
    left: calc(10px + var(--safe-l));
    right: calc(10px + var(--safe-r));
    gap: 6px;
  }
  .top-plaque {
    padding: 6px 9px;
    gap: 6px;
  }
  .top-plaque .plaque-stats,
  .top-plaque .div-stats { display: none; }
  .plaque-brand {
    font-size: 12px;
    letter-spacing: 0.06em;
  }
  .top-links { gap: 4px; }
  .mini-link {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .region-toast {
    top: calc(50px + var(--safe-t));
    font-size: 11.5px;
    letter-spacing: 0.10em;
    text-indent: 0.10em;
    padding: 5px 13px;
  }

  .curtain-handle { gap: 10px; }
  .curtain-pill { font-size: 9.5px; padding: 3px 8px; }

  /* Edge-anchored mobile dock — impossible to overflow horizontally */
  .dock {
    left: calc(10px + var(--safe-l));
    right: calc(10px + var(--safe-r));
    bottom: calc(10px + var(--safe-b));
    max-width: none;
    width: auto;
    transform: translateY(16px);
    padding: 7px 8px 8px;
    gap: 6px;
    border-radius: 13px;
  }
  body.is-entered .dock {
    transform: translateY(0);
  }
  .dock-row {
    width: 100%;
    justify-content: flex-start;
  }
  .dock-row-realms {
    overflow: hidden;
  }
  .dock-scroll {
    width: 100%;
    gap: 4px;
    padding-right: 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent 100%);
  }
  .dock-row-tools {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(243, 234, 212, 0.13);
  }
  .dock-sep-sub { display: none; }
  .dock-styles {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .dock-styles .dock-btn {
    padding: 5px 4px;
    font-size: 11.5px;
    min-height: 32px;
  }
  .dock-utils {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .curtain-wrap {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 2px;
  }
  #curtainSlider {
    flex: 1 1 auto;
    width: auto;
    min-width: 70px;
  }
  .dock-btn {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 11.5px;
  }
}

/* Ultra-compact phones (<= 355px, e.g. 320px iPhone SE) */
@media (max-width: 355px) {
  .mini-link.link-learn { display: none; }
  .mini-link { padding: 5px 7px; font-size: 10.5px; }
  .plaque-brand { font-size: 11.5px; }
}

/* ==========================================================================
   Breakpoint 4: Mobile Landscape & Short Viewports (max-height <= 500px)
   Ultra-compact vertical footprint so the painting & creatures breathe!
   ========================================================================== */
@media (max-height: 500px) and (min-width: 480px) {
  .scroll-mount {
    top: calc(8px + var(--safe-t));
    right: calc(8px + var(--safe-r));
    bottom: calc(8px + var(--safe-b));
    left: calc(8px + var(--safe-l));
  }
  .opening-credit {
    top: calc(14px + var(--safe-t));
    left: calc(16px + var(--safe-l));
    font-size: 9.5px;
    padding: 4px 9px;
  }
  .colophon {
    top: calc(12px + var(--safe-t));
    right: calc(14px + var(--safe-r));
    padding: 8px 10px 10px 12px;
    gap: 8px;
  }
  .colophon-title { font-size: 22px; letter-spacing: 0.16em; }
  .colophon-sub { font-size: 10.5px; letter-spacing: 0.16em; padding-top: 2px; }
  .seal-stamp { width: 21px; height: 21px; font-size: 7.5px; }

  .enter-stage {
    bottom: calc(12px + var(--safe-b));
    gap: 5px;
  }
  .enter-btn {
    min-height: 38px;
    padding: 8px 26px;
    font-size: 13.5px;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
  }
  .enter-hint {
    font-size: 10.5px;
    padding: 3px 11px;
  }

  .top-hud {
    top: calc(8px + var(--safe-t));
    left: calc(10px + var(--safe-l));
    right: calc(10px + var(--safe-r));
  }
  .top-plaque { padding: 5px 10px; gap: 7px; }
  .plaque-brand { font-size: 12px; }
  .plaque-stats { font-size: 10px; }
  .mini-link { min-height: 28px; padding: 4px 9px; font-size: 11px; }

  /* Place region toast cleanly in the top center gap so it NEVER blocks the Dragon or Arch! */
  .region-toast {
    top: calc(9px + var(--safe-t));
    max-width: 34vw;
    font-size: 11px;
    letter-spacing: 0.10em;
    text-indent: 0.10em;
    padding: 4px 12px;
  }

  .dock {
    bottom: calc(8px + var(--safe-b));
    padding: 5px 9px;
    gap: 4px;
    border-radius: 11px;
  }
  .dock-btn {
    min-height: 26px;
    padding: 3px 8px;
    font-size: 11px;
  }
  .curtain-label { font-size: 11px; }
  #curtainSlider { width: 64px; }
}

/* Video Devlog Modal (Zero-LCP-Cost Native Dialog matching Ink-Jade Scroll Aesthetic) */
.link-video {
  border-color: rgba(235, 196, 114, 0.52);
  color: #f7deb0;
}
.video-modal {
  margin: auto;
  width: min(92vw, 860px);
  padding: 0;
  border: 1.5px solid rgba(235, 222, 194, 0.36);
  border-radius: 16px;
  background: rgba(12, 20, 25, 0.96);
  color: #f6ecd6;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}
.video-modal::backdrop {
  background: rgba(6, 11, 14, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.video-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(235, 222, 194, 0.18);
}
.video-modal-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #f6e7c6;
}
.video-modal-close {
  min-width: 32px;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(235, 222, 194, 0.28);
  background: rgba(243, 234, 212, 0.08);
  color: #f6ecd6;
  font-size: 14px;
  cursor: pointer;
}
.video-modal-close:hover {
  background: rgba(185, 50, 38, 0.75);
  border-color: rgba(250, 226, 178, 0.55);
}
.video-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #060a0d;
}
.video-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-modal-foot {
  padding: 10px 16px;
  text-align: right;
  border-top: 1px solid rgba(235, 222, 194, 0.14);
}
.video-ext-link {
  color: #e6c47a;
  font-size: 12.5px;
  text-decoration: none;
  letter-spacing: 0.04em;
}
.video-ext-link:hover { text-decoration: underline; }

/* Accessibility: Skip Link, Focus-Visible & Collapsible Scroll Archive */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 9999;
  padding: 10px 16px;
  background: #162228;
  color: #f6ecd6;
  border: 2px solid #d9b168;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 14px;
  outline: 2px solid #f6ecd6;
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid #e6c47a;
  outline-offset: 2px;
}

.scroll-archive {
  position: fixed;
  left: calc(20px + var(--safe-l));
  bottom: calc(20px + var(--safe-b));
  z-index: 25;
  max-width: min(460px, calc(100vw - 40px));
  transition: opacity 0.35s ease, transform 0.35s ease;
}
body.is-entered .scroll-archive,
body.hud-hidden .scroll-archive {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}
.scroll-dossier {
  background: rgba(14, 22, 27, 0.84);
  color: #f3ead4;
  border: 1px solid rgba(235, 222, 194, 0.30);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}
.scroll-dossier-summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #f3ead4;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.scroll-dossier-summary::-webkit-details-marker { display: none; }
.scroll-dossier-summary::before {
  content: "▸";
  color: #d9b168;
}
.scroll-dossier[open] .scroll-dossier-summary::before {
  content: "▾";
}
.scroll-dossier-body {
  padding: 0 16px 14px;
  max-height: 55vh;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(243, 234, 212, 0.92);
  border-top: 1px solid rgba(235, 222, 194, 0.16);
}
.scroll-dossier-body h2 {
  margin: 12px 0 6px;
  font-size: 13px;
  color: #f0d28d;
  letter-spacing: 0.06em;
}
.scroll-dossier-body p { margin: 10px 0; }
.scroll-dossier-body ul { margin: 6px 0 10px; padding-left: 18px; }
.scroll-dossier-body li { margin-bottom: 5px; }
.scroll-dossier-body code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(243, 234, 212, 0.12);
  color: #f7e4b5;
}
.scroll-dossier-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 222, 194, 0.16);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 11.5px;
  color: rgba(243, 234, 212, 0.8);
}
.scroll-dossier-footer a {
  color: #e6c47a;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .scroll-archive {
    left: calc(14px + var(--safe-l));
    bottom: calc(114px + var(--safe-b));
  }
}

/* Accessibility: Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .scroll-mount,
  .opening-credit,
  .top-hud,
  .top-plaque,
  .colophon,
  .enter-stage,
  .enter-btn,
  .region-toast,
  .curtain-handle,
  .dock,
  .dock-btn,
  .mini-link {
    transition-duration: 0.01ms !important;
  }
}
