/* FORCE MAJEURE — visual system (see docs/VISUAL.md) */

:root {
  --beige: #E8E0D0;
  --slate: #5B6670;
  --ink: #2A2E33;
  --teal: #3E7C74;
  --red: #C4453C;
  --orange: #E8842C;
  --pink: #D9A0A7;
  --night: #2E3A4A;
  --paper: #F5F1E8;
  --paper-dim: #ECE6D8;
  --story-scale: 1;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui: 'Archivo', -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --shadow-card: 0 10px 30px rgba(42, 46, 51, 0.18), 0 2px 6px rgba(42, 46, 51, 0.12);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--ink);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }

button { font-family: inherit; cursor: pointer; }

/* ------------------------------------------------------------- grain ------ */
.grain {
  position: absolute; inset: 0; pointer-events: none; z-index: 40; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ title ------- */
.title-screen {
  position: relative; height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(120% 90% at 50% 0%, #3E4854 0%, var(--ink) 60%),
    var(--ink);
  overflow: hidden;
}
.title-frame {
  position: relative; z-index: 5;
  width: min(780px, 94vw);
  max-height: 96dvh;
  overflow-y: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 260px 260px 14px 14px;
  padding: 56px 44px 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.title-frame::before {
  content: ''; position: absolute; inset: 10px;
  border: 2px solid rgba(62, 124, 116, 0.55);
  border-radius: 250px 250px 8px 8px;
  pointer-events: none;
}
.title-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.18em;
  background: var(--red); color: var(--paper); padding: 7px 16px; border-radius: 999px;
  transform: rotate(-1.2deg);
}
.title-word {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(44px, 8vw, 72px); line-height: 1.02;
  margin: 22px 0 10px; letter-spacing: 0.01em;
  color: var(--ink);
}
.title-rule { width: 120px; height: 3px; background: var(--teal); margin: 0 auto 22px; }

/* ------------------------------------------------ bookshelf title ------ */
.shelf-sign { font-size: clamp(24px, 3.4vw, 34px) !important; letter-spacing: 0.08em; }
.bookshelf {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  width: min(660px, 100%); margin: 28px auto 24px;
}
.book { position: relative; padding: 0; background: none; border: none; }
.book img {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block;
  border: 2px solid var(--ink);
  box-shadow: 5px 6px 0 rgba(42, 46, 51, 0.45);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  background: var(--paper-dim);
}
.book:hover img { transform: rotate(0deg) translateY(-5px); box-shadow: 7px 10px 0 rgba(42, 46, 51, 0.4); }
.book.fm { z-index: 3; }
.book.fm img { transform: scale(1.06) rotate(0deg); }
.book.fm:hover img { transform: scale(1.06) translateY(-5px); }
.book-open {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  background: var(--red); color: var(--paper);
  font-family: var(--font-ui); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 5px 11px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  opacity: 0; transition: opacity 0.15s ease; pointer-events: none; white-space: nowrap;
}
.book.fm:hover .book-open, .book.fm:focus-visible .book-open { opacity: 1; }
.book.coming .coming-card {
  width: 100%; aspect-ratio: 2 / 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 2px dashed var(--slate); background: rgba(91, 102, 112, 0.08);
  transform: rotate(var(--tilt, 0deg));
}
.coming-card span:first-child {
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.18em;
  color: var(--slate);
}
.coming-sub { font-size: 11.5px; font-style: italic; color: var(--slate); }
.title-tag { font-size: 17px; line-height: 1.65; color: #3d434b; max-width: 56ch; margin: 0 auto; }
.title-stakes {
  margin-top: 14px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--slate);
}
.title-stakes strong { color: var(--red); }
.title-buttons { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; align-items: center; }
.title-foot {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  margin-top: 26px; flex-wrap: wrap;
}
.title-keys { font-size: 11px; color: var(--slate); letter-spacing: 0.04em; }
.title-credit {
  width: 100%; margin-bottom: 6px;
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate);
}

/* ------------------------------------------------------------- buttons ---- */
.btn {
  font-size: 15px; font-weight: 600; letter-spacing: 0.02em;
  padding: 12px 26px; border-radius: 8px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--red); color: var(--paper); }
.btn.danger { background: var(--paper); color: var(--red); border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }

.chip {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(245, 241, 232, 0.9); color: var(--ink);
  border: 1.5px solid var(--ink);
}
.chip:hover { background: var(--beige); }

/* ---------------------------------------------------------- game screen --- */
.game-screen {
  position: relative; height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(130% 100% at 50% -10%, #7b7161 0%, #5c5447 52%, #443e35 100%);
}
.game-screen.page-in { animation: pageIn 0.5s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
.game-screen.page-out { animation: pageOut 0.33s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(26px) rotate(0.4deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes pageOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-26px) rotate(-0.4deg); }
}

.scene-band {
  position: relative; height: 46dvh; min-height: 260px; overflow: hidden;
  background: var(--beige);
  border-bottom: 3px solid var(--ink);
  flex-shrink: 0;
}
.scene-svg, .scene-png {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transition: transform 0.25s ease-out;
}
.scene-svg svg { width: 100%; height: 100%; display: block; }
.scene-png { object-fit: cover; z-index: 2; }
.scene-vignette {
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(to bottom, rgba(42,46,51,0.16), rgba(42,46,51,0) 30%, rgba(42,46,51,0) 70%, rgba(42,46,51,0.35));
  pointer-events: none;
}

.story-wrap {
  position: relative; z-index: 10;
  width: min(980px, 94vw);
  margin: -54px auto 0;
  flex: 1;
  min-height: 0;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  padding: 26px 38px 30px;
  overflow-y: auto;
}

/* ---------------------------------------- the open book (skeuomorphic) --- */
/* The spread sits on a desk: warm taupe surface, cream pages with a spine
   crease, and a visible fore-edge page block at both outer edges. */
.duo {
  position: relative; isolation: isolate;
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  /* leave the right desk gutter free for the policy sheet */
  width: min(1180px, calc(100vw - 470px));
  min-width: 700px;
  margin: clamp(14px, 2.4vh, 30px) auto;
  border-radius: 5px 9px 9px 5px;
  box-shadow: 0 20px 40px rgba(26, 20, 14, 0.42), 0 3px 0 rgba(26, 20, 14, 0.3);
}
/* the stack of pages under the two visible pages */
.duo::before, .duo::after {
  content: ''; position: absolute; top: 8px; bottom: 8px; width: 8px;
  background: repeating-linear-gradient(to bottom,
    #efe9dc 0 2px, #d8d0c0 2px 3.5px, #cfc6b4 3.5px 5px);
  border-radius: 3px; z-index: -1;
}
.duo::before { left: -6px; }
.duo::after { right: -6px; }
.page-left {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 0; overflow-y: auto;
  background: linear-gradient(to right, #f8f4eb 0%, var(--paper) 55%, #e7e0cf 100%);
  padding: 40px 44px 26px 48px;
  border-radius: 5px 0 0 5px;
  box-shadow: inset -22px 0 26px -20px rgba(42, 46, 51, 0.5);
}
/* spine crease */
.page-left::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: -1px; width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(42, 46, 51, 0.4) 10%,
    rgba(42, 46, 51, 0.4) 90%, transparent);
}
.page-left .node-title { margin-bottom: 18px; }
.page-num {
  margin-top: auto; padding-top: 20px;
  text-align: center;
  font-family: var(--font-display); font-size: 15px; letter-spacing: 0.14em;
  color: var(--slate);
}
.page-num::before { content: '—  '; }
.page-num::after { content: '  —'; }
.side-col {
  display: flex; flex-direction: column;
  min-height: 0; overflow-y: auto;
  background: linear-gradient(to left, #f5f0e5 0%, var(--paper-dim) 55%, #e3dccb 100%);
  padding: 18px 32px 20px;
  border-radius: 0 9px 9px 0;
  box-shadow: inset 22px 0 26px -20px rgba(42, 46, 51, 0.45);
}
/* chips as paper tabs punched into the top of the right-hand page */
.page-chips { display: flex; justify-content: flex-end; gap: 7px; margin-bottom: 14px; flex: 0 0 auto; }
.side-col .chip {
  background: var(--paper); border: 1.5px solid var(--slate); border-bottom: none;
  border-radius: 4px 4px 0 0; padding: 4px 13px 5px;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase;
}
/* the illustration: a plate pasted into the page, narrower than the page */
.scene-square {
  position: relative; align-self: center;
  width: min(84%, 470px); margin: 0 auto;
  flex: 0 0 33%; height: 33%; min-height: 186px; max-height: 44%;
  aspect-ratio: 16 / 9;   /* used when the parent has no fixed height (endings) */
  padding: 9px 9px 26px;
  background: #fbf8f1;
  border: 1px solid rgba(42, 46, 51, 0.32);
  border-radius: 2px;
  box-shadow: 0 2px 0 rgba(42, 46, 51, 0.12), 4px 7px 14px rgba(42, 46, 51, 0.2);
}
.scene-plate { position: absolute; inset: 9px 9px 26px; overflow: hidden; background: var(--beige); }
.scene-plate-cap {
  position: absolute; left: 0; right: 6px; bottom: 6px;
  text-align: center;
  font-family: var(--font-display); font-style: italic;
  font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--slate);
}
.scene-square .scene-svg, .scene-square .scene-png {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.scene-square .scene-png { object-fit: cover; z-index: 2; }
/* the plate is blank paper until the painting arrives, then it develops */
.scene-square .scene-png { opacity: 0; filter: blur(12px) saturate(0.85); transition: opacity 0.2s ease, filter 0.75s ease, transform 0.7s ease-out; }
.scene-square .scene-png.loaded { opacity: 1; filter: blur(0) saturate(1); }
.scene-plate-cap { z-index: 4; }
.art-stamp {
  position: absolute; right: 12px; bottom: 28px; z-index: 5;
  font-family: var(--font-display); font-size: 10px; letter-spacing: 0.12em;
  color: rgba(245, 241, 232, 0.82); text-shadow: 0 1px 2px rgba(26, 20, 14, 0.8);
  pointer-events: none;
}
.side-col .choices {
  flex: 1 1 auto; min-height: 0; justify-content: center; gap: 12px;
  padding: 16px 0 6px;
}
.choice-page {
  display: block; margin-top: 6px;
  font-family: var(--font-display); font-style: italic;
  font-size: calc(13.5px * var(--story-scale, 1));
  color: var(--teal);
}

.story-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px;
}
.kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 6px;
}
.node-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(28px, 4.2vw, 40px); line-height: 1.08; color: var(--ink);
}
.story-tools { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }

.story-text { margin-bottom: 24px; outline: none; }
.story-text p {
  font-size: calc(18.5px * var(--story-scale, 1)); line-height: 1.72; color: #33383f;
  margin-bottom: 15px; max-width: 74ch;
}
.story-text p:last-child { margin-bottom: 0; }
/* the drop cap of a book you have just opened */
.story-text p.drop::first-letter {
  float: left;
  font-family: var(--font-display); font-weight: 600;
  font-size: calc(3.1em * var(--story-scale, 1)); line-height: 0.8;
  padding: 0.06em 0.09em 0 0; color: var(--teal);
}

/* ------------------------------------------------------------- choices ---- */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: stretch; gap: 0;
  text-align: left; width: 100%;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: 3px 3px 0 rgba(42, 46, 51, 0.85);
}
.choice:hover, .choice:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
  background: #fffdf7;
}
.choice:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.choice:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.choice-num {
  display: grid; place-items: center;
  width: 44px; flex-shrink: 0;
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
  color: var(--paper); background: var(--ink);
  border-radius: 6px 0 0 6px;
  border-right: 2px solid var(--ink);
}
.choice:hover .choice-num, .choice:focus-visible .choice-num { background: var(--red); }
.choice-body { padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.choice-label { font-size: calc(17px * var(--story-scale, 1)); font-weight: 600; line-height: 1.4; color: var(--ink); }
.choice-sub { font-size: calc(14.5px * var(--story-scale, 1)); color: var(--slate); font-style: italic; line-height: 1.4; }

/* --------------------------------------------------------- policy sheet --- */
.policy-sheet {
  position: absolute; top: 14px; right: 14px; z-index: 30;
  width: 198px;
  background: rgba(245, 241, 232, 0.96);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(42, 46, 51, 0.5);
  padding: 12px 14px;
  backdrop-filter: blur(2px);
}
.ps-head {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.16em;
  color: var(--teal); border-bottom: 1.5px solid var(--ink);
  padding-bottom: 6px; margin-bottom: 8px;
}
.ps-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 3.5px 0; }
.ps-label { font-size: 11px; font-weight: 600; color: #4a5058; letter-spacing: 0.02em; }
.ps-val { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--ink); }
.ps-bar {
  grid-column: 1 / -1; height: 4px; background: rgba(42, 46, 51, 0.15);
  border-radius: 2px; overflow: hidden;
}
.ps-bar span { display: block; height: 100%; background: var(--teal); border-radius: 2px; transition: width 0.6s cubic-bezier(0.22, 0.9, 0.3, 1); }
.ps-foot {
  display: flex; justify-content: space-between;
  border-top: 1.5px solid rgba(42, 46, 51, 0.3);
  margin-top: 8px; padding-top: 7px;
  font-size: 10.5px; color: var(--slate); letter-spacing: 0.04em;
}

/* ------------------------------------------------------------- deltas ----- */
.delta-layer { position: absolute; top: 96px; right: 14px; z-index: 35; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.delta-chip {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  animation: deltaFloat 2.6s ease forwards;
}
.delta-chip.pos { color: var(--teal); border-color: var(--teal); }
.delta-chip.neg { color: var(--red); border-color: var(--red); }
@keyframes deltaFloat {
  0% { opacity: 0; transform: translateY(8px); }
  12% { opacity: 1; transform: none; }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* ------------------------------------------------------------- ending ----- */
.ending-screen .story-wrap { margin-top: 0; }
.ending-screen .scene-square { margin: 22px auto 2px; max-height: none; }
.ending-title { font-size: clamp(30px, 5vw, 42px); }
.stamp-stamp {
  display: inline-block;
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; letter-spacing: 0.14em;
  color: var(--red);
  border: 4px solid var(--red);
  border-radius: 10px;
  padding: 8px 22px;
  transform: rotate(-7deg) scale(2.4);
  opacity: 0;
  margin: 10px 0 18px;
}
.stamp-stamp.slam { animation: stampSlam 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes stampSlam {
  0% { opacity: 0; transform: rotate(-13deg) scale(2.4); }
  60% { opacity: 1; transform: rotate(-6deg) scale(0.96); }
  100% { opacity: 0.92; transform: rotate(-7deg) scale(1); }
}
.epigraph {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 18px; line-height: 1.5; color: #4a5058;
  border-left: 3px solid var(--teal);
  padding: 4px 0 4px 18px; margin-bottom: 22px; max-width: 60ch;
}
.ending-meta {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
  border-top: 1.5px solid rgba(42,46,51,0.3);
  margin-top: 26px; padding-top: 18px;
}
.ps-mini {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em; color: var(--ink);
}
.ps-mini span { background: var(--beige); border: 1.5px solid rgba(42,46,51,0.4); padding: 4px 10px; border-radius: 6px; }
.ending-path { display: flex; gap: 10px; font-size: 11.5px; color: var(--slate); letter-spacing: 0.05em; text-transform: uppercase; flex-wrap: wrap; }
.ending-wrap .title-buttons { margin-top: 30px; flex-direction: row; flex-wrap: wrap; justify-content: center; }
.ending-cta { margin-top: 8px; }
.ending-cta-note {
  margin-top: 24px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal);
}
.other-book {
  display: block; width: 100%; max-width: 460px; margin: 14px auto 0;
  text-align: center; padding: 13px 18px 14px;
  background: var(--beige);
}
.other-book-sub {
  display: block; margin-top: 4px;
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 12.5px; letter-spacing: 0.02em; text-transform: none; color: var(--slate);
}

/* -------------------------------------------------------------- overlays --- */
.overlay {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(42, 46, 51, 0.72);
  display: grid; place-items: center;
  animation: pageIn 0.25s ease both;
}
.ledger-frame, .menu-frame {
  position: relative; z-index: 5;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  width: min(980px, 94vw);
  max-height: 90dvh;
  overflow-y: auto;
  padding: 30px 34px;
}
.ledger-frame h2, .menu-frame h2 {
  font-family: var(--font-display); font-size: 30px; font-weight: 600; margin-bottom: 4px;
}
.ledger-count { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal); font-weight: 700; margin-bottom: 20px; }
.ledger-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.claim {
  border: 2px solid var(--ink); border-radius: 8px;
  padding: 14px; background: var(--paper);
  min-height: 132px; display: flex; flex-direction: column; gap: 8px;
}
.claim.open { background: #fffdf7; }
.claim.locked { background: var(--paper-dim); opacity: 0.85; }
.claim-stamp {
  font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.14em;
  color: var(--red); border-bottom: 2px solid var(--red); align-self: flex-start;
  padding-bottom: 2px; transform: rotate(-2deg);
}
.claim.locked .claim-stamp { color: var(--slate); border-color: var(--slate); }
.claim-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.claim-epi { font-size: 12px; line-height: 1.5; color: #555b63; font-style: italic; }
.menu-frame .menu-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; max-width: 300px; }

/* ---------------------------------------------------------- responsive ---- */
@media (max-width: 900px) {
  .duo {
    display: flex; flex-direction: column; overflow-y: auto;
    width: min(680px, 100%); min-width: 0;
    margin: 10px auto; border-radius: 5px;
  }
  .page-left {
    border-radius: 5px 5px 0 0; padding: 26px 26px 16px;
    box-shadow: inset 0 -14px 18px -16px rgba(42, 46, 51, 0.4);
  }
  .page-left::after { display: none; }
  .side-col { box-shadow: none; border-radius: 0 0 5px 5px; padding: 18px 24px 22px; }
  .scene-square { height: auto; max-height: none; width: min(86%, 420px); }
  /* the policy sheet cannot share a narrow gutter — let it sit under the book */
  .policy-sheet { position: static; width: auto; max-width: 420px; margin: 12px auto 18px; }
  .page-num { padding-top: 14px; }
}

@media (max-width: 860px) {
  .policy-sheet { width: 168px; padding: 10px 11px; }
  .ps-label { font-size: 10px; }
  .ps-val { font-size: 12.5px; }
  .story-wrap:not(.spread) { padding: 20px 22px 24px; }
  .story-text p { font-size: calc(16.5px * var(--story-scale, 1)); }
  .scene-band { height: 40dvh; }
}
@media (max-width: 620px) {
  .policy-sheet {
    position: static; width: 100%; order: -1;
    display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px;
    border-radius: 6px; margin-bottom: 12px;
  }
  .ps-head { grid-column: 1 / -1; }
  .ps-foot { grid-column: 1 / -1; }
  .scene-band { height: 34dvh; min-height: 200px; }
  .story-wrap { margin-top: -40px; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------- music hint (blocked) --- */
.music-hint {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 300;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 4px;
  padding: 10px 18px; box-shadow: 3px 4px 0 rgba(42, 46, 51, 0.35);
  cursor: pointer;
  animation: hintBob 1.6s ease-in-out infinite;
}
.music-hint:hover { background: var(--beige); }
@keyframes hintBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
