:root {
  color-scheme: dark;
  --night: #0d142d;
  --night-soft: #1c284b;
  --navy: #273455;
  --navy-deep: #1a2140;
  --paper: #fff8e8;
  --paper-deep: #f3e7cf;
  --ink: #272139;
  --muted: #5e5565;
  --gold: #d6a83f;
  --gold-bright: #f2c75f;
  --gold-ink: #7d5810;
  --terracotta: #a84f3e;
  --sage: #dbe8df;
  --peach: #f4d7c9;
  --line: rgba(39, 33, 57, .14);
  --display: Georgia, "Times New Roman", serif;
  --body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 32px 100px rgba(0, 0, 0, .42);
  --ring: var(--gold-bright);
  --book-h: clamp(560px, calc(100vh - 124px), 810px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); overflow-x: hidden; }
body { margin: 0; min-height: 100vh; color: #fff9eb; font-family: var(--body); background: radial-gradient(circle at 68% 0%, #293761 0, var(--night) 47%); }
button, select, a, input { font: inherit; }
button { cursor: pointer; color: inherit; }
h1, h2, h3 { font-family: var(--display); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
[data-heading]:focus-visible { outline-width: 2px; outline-offset: 4px; border-radius: 4px; }
/* A heading is focused after every page turn. Its ring shows only when the keyboard is in use. */
[data-heading]:focus:not(:focus-visible), html:not(.keyboard) [data-heading]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 22px; height: 22px; flex: 0 0 auto; fill: currentColor; }
.icon-stop { display: none; }
.is-playing > .icon-play { display: none; }
.is-playing > .icon-stop { display: block; }

/* ---- top bar ---- */
.topbar { width: min(1240px, calc(100% - 28px)); min-height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--navy-deep); font-weight: 900; }
.brand-text { min-width: 0; }
.brand strong, .brand small { display: block; white-space: nowrap; }
.brand small { color: #b8b8c8; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.nav-button { min-height: 48px; padding: 9px 17px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); color: #fff9eb; background: rgba(255,255,255,.06); font-weight: 800; white-space: nowrap; }
.nav-button:hover { background: rgba(255,255,255,.14); }
.nav-button:disabled { opacity: .5; cursor: wait; }
.switch { display: inline-flex; align-items: center; gap: 8px; }
.switch-track { position: relative; width: 30px; height: 18px; flex: 0 0 auto; border-radius: 999px; background: rgba(255,255,255,.28); transition: background .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff9eb; transition: transform .15s ease; }
.switch[aria-pressed="true"] .switch-track { background: var(--gold); }
.switch[aria-pressed="true"] .switch-track::after { transform: translateX(12px); background: var(--navy-deep); }

/* ---- book ---- */
main { width: min(1240px, calc(100% - 28px)); margin: 0 auto; padding-bottom: 12px; }
.book-stage { perspective: 1800px; }
.book { position: relative; min-height: var(--book-h); border-radius: 12px 30px 30px 12px; box-shadow: var(--shadow); transform-style: preserve-3d; }
.book-edge { position: absolute; inset: 12px -8px 12px 10px; z-index: -1; border-radius: 10px 34px 34px 10px; background: repeating-linear-gradient(0deg, #e6d7bb 0 2px, #fff7e7 2px 5px); box-shadow: 10px 15px 40px rgba(0,0,0,.3); }
.book-cover, .book-spread { min-height: var(--book-h); border-radius: inherit; overflow: hidden; }
.deep-link .book-cover { display: none; }

.book-cover { position: relative; background: #172240; isolation: isolate; }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.cover-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(9,15,34,.92) 0%, rgba(9,15,34,.68) 37%, rgba(9,15,34,.12) 70%, rgba(9,15,34,.05) 100%); }
.cover-copy { position: relative; z-index: 1; min-height: var(--book-h); width: min(47%, 520px); padding: clamp(48px, 8vw, 105px); display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; }
.series-name { margin: 0 0 12px; color: var(--gold-bright); font-size: .76rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.book-cover h1 { margin: 0; font-size: clamp(4.6rem, 10vw, 8.7rem); line-height: .86; letter-spacing: -.06em; }
.cover-subtitle { max-width: 29rem; margin: 24px 0 28px; color: #efeaf0; font-size: clamp(1rem, 1.8vw, 1.25rem); line-height: 1.55; }
.primary { min-height: 50px; border: 0; border-radius: 999px; padding: 13px 21px; color: var(--navy-deep); background: var(--gold); font-weight: 900; }
.primary:hover { background: #e4b950; }
.primary:disabled { cursor: wait; opacity: .62; }
.cover-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.primary.secondary { color: var(--gold-bright); background: rgba(13,20,45,.55); box-shadow: inset 0 0 0 2px var(--gold); text-align: left; }
.primary.secondary:hover { background: rgba(13,20,45,.8); }
.draft-note { margin: 15px 0 0; color: #cbc7d2; font-size: .76rem; }

.book-spread { display: grid; grid-template-columns: 1fr 1fr; color: var(--ink); background: var(--paper); }
.paper-page { --ring: var(--navy); position: relative; min-width: 0; min-height: var(--book-h); padding: clamp(30px, 3.5vw, 52px); background-color: var(--paper); background-image: linear-gradient(rgba(112,82,45,.025) 1px, transparent 1px); background-size: 100% 6px; }
.page-left { border-radius: 12px 0 0 12px; box-shadow: inset -24px 0 35px -34px rgba(44,28,17,.7); }
.page-right { border-radius: 0 30px 30px 0; box-shadow: inset 24px 0 35px -34px rgba(44,28,17,.7); }
.page-left::after { content: ""; position: absolute; top: 0; right: -1px; bottom: 0; width: 2px; background: rgba(87,61,37,.12); }
.page-kicker, .eyebrow { margin: 0 0 12px; color: var(--gold-ink); font-size: .76rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }

/* ---- contents ---- */
.page-heading { margin: 0; font-size: clamp(2.3rem, 3.9vw, 3.9rem); line-height: .98; letter-spacing: -.045em; }
.page-intro { max-width: 31rem; margin: 18px 0; color: var(--muted); font-size: 1.03rem; line-height: 1.6; }
.contents-illustration { height: clamp(150px, 26vh, 250px); margin: 18px 0 0; overflow: hidden; border-radius: 20px; background: #172240; }
.contents-illustration img { width: 100%; height: 100%; object-fit: cover; object-position: var(--cover-x, 70%) center; display: block; }
.contents-art { margin: 16px 0 0; padding: 16px 22px; border-radius: 20px; background: var(--navy); color: var(--paper); }
.contents-art strong { display: block; font-family: var(--display); font-size: 1.5rem; }
.contents-art p { margin: 6px 0 0; color: #d7d5df; line-height: 1.5; }
.status-line { margin: 14px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.next-books { margin-top: 14px; }
.next-books h3 { margin: 0 0 10px; font-size: 1.02rem; }
.book-chip { display: inline-block; margin: 0 6px 7px 0; padding: 7px 10px; border-radius: 999px; background: var(--paper-deep); color: var(--muted); font-size: .78rem; }

.chapter-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.chapter-card { min-width: 0; padding: 13px 8px 6px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,253,246,.6); }
.chapter-card .eyebrow { margin: 0 8px 3px; font-size: .66rem; letter-spacing: .1em; }
.chapter-card h2 { margin: 0 8px 6px; font-size: 1.08rem; line-height: 1.2; }
.scene-links { list-style: none; margin: 0; padding: 0; }
.scene-link { width: 100%; min-height: 48px; padding: 7px 4px 7px 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; color: var(--ink); background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; font-size: .93rem; font-weight: 650; line-height: 1.25; }
.scene-links li:last-child .scene-link { border-radius: 0 0 12px 12px; }
.scene-link:hover { background: #fffdf6; color: var(--gold-ink); }
.scene-link .icon { width: 18px; height: 18px; color: var(--gold-ink); }
.scene-pages { display: block; margin-top: 2px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.how-to-link { min-height: 48px; margin: 0 0 16px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(39,33,57,.3); color: var(--ink); background: #fffdf7; font-size: .9rem; font-weight: 800; }
.how-to-link:hover { background: #fff; }

/* ---- scene pages, two-page spread ---- */
.is-picture { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.is-picture::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.page-left.is-picture::before { box-shadow: inset -26px 0 34px -30px rgba(30,18,10,.75); }
.page-right.is-picture::before { box-shadow: inset 26px 0 34px -30px rgba(30,18,10,.75); }
.scene-figure { margin: 0; background: #d3c2a4; overflow: hidden; }
.scene-figure img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.is-picture .scene-figure { position: relative; flex: 1 1 auto; min-height: 0; }
.is-picture .scene-figure img { position: absolute; inset: 0; }
.caption-band { flex: 0 0 auto; padding: 18px clamp(24px, 3vw, 40px) 22px; background: var(--paper); border-top: 1px solid rgba(87,61,37,.18); }
.caption-title { margin: 0; font-family: var(--display); font-size: clamp(1.5rem, 2.3vw, 2rem); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.caption-moment { margin: 6px 0 0; color: var(--muted); font-size: .98rem; line-height: 1.45; }
.is-picture .response-ladder { flex: 0 0 auto; margin: 0; padding: 0 clamp(20px, 2.6vw, 36px) 20px; background: var(--paper); }
.is-picture .caption-band + .response-ladder { margin-top: -6px; }
.is-picture .caption-band { padding-bottom: 16px; }

.title-plate { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: clamp(30px, 5vw, 70px); border-right: 0; }
.plate-title { margin: 0; font-family: var(--display); font-size: clamp(2.2rem, 4vw, 3.6rem); font-weight: 700; line-height: 1.05; letter-spacing: -.03em; }
.plate-moment { max-width: 26rem; margin: 16px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.5; }
.is-words { display: flex; flex-direction: column; padding: clamp(26px, 3vw, 42px) clamp(26px, 3.4vw, 50px) 24px; }
.running-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--body); font-size: .72rem; font-weight: 800; letter-spacing: .07em; line-height: 1.4; text-transform: uppercase; }
.rh-chapter { margin-right: auto; color: var(--gold-ink); }
.rh-position { white-space: nowrap; }

.dialogue { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.line { position: relative; display: grid; grid-template-columns: minmax(58px, auto) minmax(0, 1fr) 48px; gap: 12px; align-items: center; padding: 13px 12px 13px 16px; border: 1px solid rgba(39,33,57,.09); border-radius: 16px; background: var(--sage); overflow: hidden; scroll-margin: 12px 0 96px; }
.line.no-audio { grid-template-columns: minmax(58px, auto) minmax(0, 1fr); padding-top: 14px; padding-bottom: 14px; }
.line[data-speaker="Child"] { margin-left: 24px; background: var(--peach); }
.line:not(.no-audio) { cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* Press and hold opens the line's options, so the browser's own text selection and callout stay off. */
.line { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.line-role { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.line-saved { display: none; color: var(--terracotta); }
.line-saved .icon { width: 14px; height: 14px; }
.line.is-saved .line-saved { display: inline-flex; }
.line-more { width: 40px; height: 32px; margin: -6px -4px -6px auto; padding: 0; display: grid; place-items: center; border: 0; border-radius: 999px; color: var(--ink); background: transparent; opacity: .72; }
.line-more:hover { opacity: 1; background: rgba(255,255,255,.6); }
.line-more .icon { width: 20px; height: 20px; }
.speaker { display: block; font-size: .66rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.turn-flag { display: inline-block; margin-top: 5px; padding: 3px 9px; border-radius: 999px; color: #fff; background: var(--terracotta); font-size: .78rem; font-weight: 800; line-height: 1.3; }
.filipino { margin: 0; font-size: 1.22rem; line-height: 1.3; font-weight: 800; }
.english { margin: 4px 0 0; color: var(--muted); font-size: .98rem; line-height: 1.35; }
.hide-english .english { display: none; }
.line-audio { width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 0; color: var(--ink); background: rgba(255,255,255,.88); }
.line-audio:hover { background: #fff; }
.line-audio.is-playing { color: var(--paper); background: var(--navy); }
.line.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.line.is-your-turn { border-color: var(--terracotta); box-shadow: inset 0 0 0 3px var(--terracotta); }

.response-ladder { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.response-ladder > * { padding: 11px 14px; border-radius: 16px; background: #fffdf7; border: 1px solid var(--line); }
.response-ladder > :last-child { border-left: 4px solid var(--gold); }
.response-ladder > div > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.response-ladder > * > strong { display: block; font-family: var(--display); font-size: 1.08rem; line-height: 1.3; }
/* Start small / Say more as mini exchanges (books whose manuscript names the pair of lines). */
.response-ladder.has-pairs .ladder-box { padding: 10px 10px 10px 12px; }
.ladder-label { margin: 0 0 6px; color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.mini-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.line.mini { grid-template-columns: minmax(0, 1fr) 48px; grid-template-areas: "role play" "text play"; gap: 0 8px; padding: 6px 6px 7px 10px; border-radius: 12px; }
.line.mini.no-audio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "role" "text"; }
.line.mini[data-speaker="Child"] { margin-left: 12px; }
.line.mini .line-role { grid-area: role; }
.line.mini .line-text { grid-area: text; }
.line.mini .line-audio { grid-area: play; }
.line.mini .speaker { font-size: .62rem; }
.line.mini .filipino { font-size: 1rem; }
.line.mini .english { margin-top: 1px; font-size: .86rem; }

.song-card { --ring: var(--gold-bright); --verse-size: 1.08rem; margin-top: 14px; padding: 22px 26px 24px; border-radius: 20px; color: var(--paper); background: var(--navy); }
.song-kicker { margin: 0 0 4px; color: var(--gold-bright); font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.song-card h2 { margin: 0 0 16px; font-size: 1.6rem; line-height: 1.15; }
.song-verses { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.verse { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.verse strong { display: block; color: var(--gold-bright); font-size: .68rem; line-height: 1.3; text-transform: uppercase; letter-spacing: .07em; }
.verse p { margin: 6px 0 0; font-family: var(--display); font-size: var(--verse-size); line-height: 1.5; }
.song-play { min-height: 48px; margin-top: 14px; padding: 6px 18px 6px 12px; display: inline-flex; align-items: center; gap: 8px; text-align: left; border-radius: 999px; border: 0; color: var(--navy-deep); background: var(--gold); font-size: .92rem; font-weight: 900; line-height: 1.2; }
.song-play:hover { background: #e4b950; }
.song-play.is-playing { color: #fff; background: var(--terracotta); }
.is-words.is-song { padding-left: clamp(22px, 2.4vw, 34px); padding-right: clamp(22px, 2.4vw, 34px); }
.is-words.is-song .song-card { margin: auto 0; padding: 24px 20px 26px 22px; }
.is-words.is-song .song-verses { gap: 16px; }
.is-words.is-song .page-foot { margin-top: 0; }

/* The whole picture, opened from the cropped phone picture. */
.figure-button { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: zoom-in; overflow: hidden; }
.figure-button:focus-visible { outline-offset: -4px; outline-color: var(--gold-bright); }
.figure-hint { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff9eb; background: rgba(13, 20, 45, .72); }
.figure-hint .icon { width: 18px; height: 18px; }
.viewer { --ring: var(--gold-bright); max-width: min(94vw, 720px); max-height: 94vh; margin: auto; padding: 8px; border: 0; border-radius: 20px; background: var(--navy); cursor: zoom-out; }
.viewer[open] { display: grid; gap: 8px; justify-items: center; animation: viewer-in .18s ease-out; }
.viewer::backdrop { background: rgba(6, 10, 26, .8); }
.viewer img { display: block; max-width: 100%; max-height: calc(94vh - 76px); width: auto; height: auto; border-radius: 14px; }
.viewer-close { min-width: 140px; min-height: 48px; padding: 0 18px; border: 1px solid rgba(255,248,232,.4); border-radius: 999px; color: var(--paper); background: transparent; font-weight: 900; }
@keyframes viewer-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.page-foot { margin-top: auto; padding-top: 18px; }
.listen-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 14px; }
.segmented { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented legend { padding: 0; margin-bottom: 5px; color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.segmented-row { display: inline-flex; border: 1px solid rgba(39,33,57,.3); border-radius: 999px; background: #fffdf7; }
.segmented label { position: relative; display: block; cursor: pointer; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented span { min-height: 48px; padding: 0 14px; display: grid; place-items: center; border-radius: 999px; color: var(--ink); font-size: .84rem; font-weight: 750; white-space: nowrap; }
.segmented input:checked + span { color: var(--paper); background: var(--navy); }
.segmented input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
.chip-toggle { min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(39,33,57,.3); color: var(--ink); background: #fffdf7; font-size: .84rem; font-weight: 750; }
.chip-toggle[aria-pressed="true"] { color: var(--paper); background: var(--navy); border-color: var(--navy); }

.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.bar-button { min-width: 48px; min-height: 48px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 999px; color: var(--gold-ink); background: transparent; font-weight: 900; }
.bar-button:hover .bar-label { text-decoration: underline; }
.play-all { min-height: 48px; padding: 0 24px 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; color: var(--paper); background: var(--navy); font-weight: 900; white-space: nowrap; }
.play-all:hover { background: #34446d; }
.play-all.is-playing { background: var(--terracotta); }
.play-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.play-role { font-size: .72rem; font-weight: 750; opacity: .85; }
.icon-turn { display: none; }
.play-all.is-next { color: #fff; background: var(--terracotta); }
.play-all.is-next > .icon-play, .play-all.is-next > .icon-stop { display: none; }
.play-all.is-next > .icon-turn { display: block; order: 2; }
.bar-stop { width: 48px; height: 48px; flex: 0 0 48px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(39,33,57,.3); color: var(--ink); background: #fffdf7; }
.bar-stop .icon-stop { display: block; }

/* ---- scenes sheet ---- */
.sheet { --ring: var(--navy); position: fixed; inset: 70px max(14px, calc((100vw - 1240px) / 2)) auto auto; width: min(780px, calc(100vw - 28px)); max-width: none; max-height: calc(100vh - 90px); margin: 0; padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(0,0,0,.5); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(6, 10, 26, .55); }
html:has(.sheet[open]), html:has(.viewer[open]) { overflow: hidden; }
.sheet-inner { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0 auto 0 0; font-size: 1.35rem; }
.sheet-button { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(39,33,57,.3); color: var(--ink); background: #fffdf7; font-size: .86rem; font-weight: 800; }
.sheet-button:hover { background: #fff; }
.sheet-button:disabled { opacity: .55; cursor: progress; }
.sheet-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 14px; padding: 16px 14px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-chapter h3 { margin: 0 8px 4px; color: var(--gold-ink); font-family: var(--body); font-size: .7rem; font-weight: 900; letter-spacing: .08em; line-height: 1.35; text-transform: uppercase; }
.sheet-chapter ul { list-style: none; margin: 0; padding: 0; }
.sheet-scene { width: 100%; min-height: 48px; padding: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 0; border-radius: 10px; color: var(--ink); background: transparent; font-size: .95rem; font-weight: 650; line-height: 1.25; }
.sheet-scene:hover { background: var(--paper-deep); }
.sheet-scene[aria-current="true"] { background: #f4dfab; font-weight: 850; }
.here { flex: 0 0 auto; color: #6b4b10; font-size: .64rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) 20px; border-top: 1px solid var(--line); }
.offline { flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.offline p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.offline .offline-why { flex: 1 0 100%; }
.offline p:empty { display: none; }

/* ---- how to use ---- */
.how-to { --ring: var(--navy); width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 26px 26px 24px; border: 0; border-radius: 22px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(0,0,0,.5); overflow-y: auto; }
.how-to::backdrop { background: rgba(6, 10, 26, .7); }
.how-to h2 { margin: 0 0 14px; font-size: 1.7rem; line-height: 1.15; }
.how-to-steps { margin: 0 0 22px; padding-left: 1.4em; display: grid; gap: 12px; font-size: 1.06rem; line-height: 1.5; }
.how-to-steps li::marker { color: var(--gold-ink); font-weight: 900; }
.how-to .primary { width: 100%; min-height: 52px; font-size: 1.05rem; }
html:has(.how-to[open]) { overflow: hidden; }

/* Line options (save, something sounds off, redo this take). A bottom sheet on phones. */
.line-sheet { --ring: var(--navy); width: min(460px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 40px); margin: auto; padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(0,0,0,.5); overflow-y: auto; }
.line-sheet::backdrop { background: rgba(6, 10, 26, .55); }
.line-sheet-inner { display: grid; gap: 14px; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
.line-sheet-speaker { margin: 0; color: var(--gold-ink); font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.line-sheet-title { margin: 3px 0 0; font-family: var(--body); font-size: 1.3rem; font-weight: 800; line-height: 1.3; }
.line-sheet-english { margin: 3px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.35; }
.line-sheet-options { display: grid; gap: 8px; }
.line-sheet-options[hidden], .line-note[hidden] { display: none; }
.sheet-option { width: 100%; min-height: 54px; padding: 0 16px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(39,33,57,.18); border-radius: 14px; color: var(--ink); background: #fffdf7; font-size: 1rem; font-weight: 750; text-align: left; }
.sheet-option:hover { background: #fff; }
.sheet-option[aria-pressed="true"] { border-color: rgba(168,79,62,.45); background: #fbe9e1; }
.sheet-option[aria-pressed="true"] .icon-heart { color: var(--terracotta); }
.line-note { display: grid; gap: 8px; }
.line-note label { font-weight: 800; }
.line-note textarea { width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid rgba(39,33,57,.3); border-radius: 12px; color: var(--ink); background: #fff; font: inherit; font-size: 1rem; resize: vertical; }
.line-note-actions { display: flex; gap: 8px; }
.line-note-actions .primary { flex: 1 1 auto; min-height: 48px; padding: 0 18px; }
.line-sheet-status { margin: 0; color: var(--muted); font-size: .92rem; }
.line-sheet-status:empty { display: none; }
.line-sheet-status.is-error { color: var(--terracotta); font-weight: 700; }
.line-sheet-close { justify-self: center; min-width: 140px; }
html:has(.line-sheet[open]) { overflow: hidden; }

/* My phrases, at the top of the Scenes sheet. */
.sheet-phrases { grid-column: 1 / -1; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.sheet-phrases h3 { margin: 0 8px 6px; color: var(--gold-ink); font-family: var(--body); font-size: .7rem; font-weight: 900; letter-spacing: .08em; line-height: 1.35; text-transform: uppercase; }
.sheet-phrases ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 12px; }
.phrase { display: flex; align-items: center; gap: 6px; }
.phrase-play { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--ink); background: var(--sage); }
.phrase-play .icon { width: 18px; height: 18px; }
.phrase-go { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 6px 8px; display: grid; text-align: left; border: 0; border-radius: 10px; color: var(--ink); background: transparent; }
.phrase-go:hover { background: var(--paper-deep); }
.phrase-go .filipino { font-size: 1rem; }
.phrase-go .english { margin-top: 1px; font-size: .86rem; }
.phrase-where { margin-top: 2px; color: var(--gold-ink); font-size: .72rem; font-weight: 800; }
.phrases-empty { margin: 0 8px; color: var(--muted); font-size: .9rem; }
.offline progress { flex: 1 1 140px; height: 8px; accent-color: var(--navy); }

/* ---- page turn ---- */
.turn-sheet { position: absolute; top: 0; right: 0; width: 50%; height: 100%; z-index: 20; pointer-events: none; opacity: 0; transform-origin: left center; border-radius: 0 30px 30px 0; background: linear-gradient(90deg, #eadcc0, #fff9ea 20%, #f7edd9); box-shadow: -15px 0 30px rgba(46,30,18,.15); }
.book.turning-next .turn-sheet { animation: turn-next .62s cubic-bezier(.4,.04,.2,1); }
.book.turning-back .turn-sheet { left: 0; right: auto; transform-origin: right center; border-radius: 12px 0 0 12px; animation: turn-back .62s cubic-bezier(.4,.04,.2,1); }
@keyframes turn-next { 0% { opacity: 1; transform: rotateY(0); } 48% { box-shadow: -30px 0 44px rgba(46,30,18,.26); } 100% { opacity: 1; transform: rotateY(-180deg); } }
@keyframes turn-back { 0% { opacity: 1; transform: rotateY(0); } 48% { box-shadow: 30px 0 44px rgba(46,30,18,.26); } 100% { opacity: 1; transform: rotateY(180deg); } }

.book-hint { margin: 15px 0 0; text-align: center; color: #aaaabd; font-size: .82rem; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 999px; color: white; background: #111827; box-shadow: 0 12px 40px rgba(0,0,0,.32); text-align: center; opacity: 0; transform: translate(-50%, 130%); transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) and (min-width: 900px) {
  .line { grid-template-columns: minmax(52px, auto) minmax(0, 1fr) 48px; gap: 9px; padding: 11px 10px 11px 12px; }
  .filipino { font-size: 1.1rem; }
  .english { font-size: .92rem; }
  .line.no-audio { grid-template-columns: minmax(52px, auto) minmax(0, 1fr); }
  .line[data-speaker="Child"] { margin-left: 12px; }
  .segmented span { padding: 0 11px; font-size: .8rem; }
  .play-all { padding: 0 18px 0 12px; }
  .chapter-card h2 { font-size: 1rem; }
}

/* Short laptop windows: tighten the words page so a dialogue page fits without scrolling. */
@media (min-width: 900px) and (max-height: 800px) {
  .is-words { padding-top: 24px; padding-bottom: 18px; }
  .running-head { margin-bottom: 10px; padding-bottom: 8px; }
  .dialogue { gap: 7px; }
  .line { padding-top: 8px; padding-bottom: 8px; }
  .filipino { font-size: 1.1rem; }
  .english { margin-top: 2px; font-size: .9rem; }
  .response-ladder { margin-top: 10px; }
  .response-ladder > * { padding: 8px 12px; }
  .page-foot { padding-top: 10px; }
  .listen-options { margin-bottom: 10px; }
  .page-bar { padding-top: 8px; }
}

/* ---- phone and tablet portrait: one page at a time ---- */
@media (max-width: 899px) {
  .topbar { width: calc(100% - 20px); min-height: 58px; }
  .brand { gap: 9px; }
  .brand-mark { width: 36px; height: 36px; font-size: .86rem; }
  .brand small { display: none; }
  .nav-button { padding: 9px 13px; }
  #contents-button { display: none; }
  main { width: calc(100% - 20px); padding-bottom: 14px; }
  .book, .book-cover, .book-spread, .paper-page { min-height: 0; }
  .book { border-radius: 22px; }
  .book-edge { display: none; }
  .book-cover { min-height: min(700px, calc(100vh - 84px)); border-radius: 22px; }
  .book-cover img { object-position: 72% center; }
  .cover-shade { background: linear-gradient(0deg, rgba(9,15,34,.94) 0%, rgba(9,15,34,.66) 42%, rgba(9,15,34,.08) 72%); }
  .cover-copy { width: 100%; min-height: min(700px, calc(100vh - 84px)); padding: 34px 24px 42px; }
  .book-cover h1 { font-size: clamp(3.8rem, 19vw, 5.25rem); }

  .book-spread { grid-template-columns: 1fr; border-radius: 22px; overflow: visible; background: transparent; }
  .paper-page { padding: 24px 18px 22px; border-radius: 22px; box-shadow: none; }
  .page-left::after { display: none; }
  .page-heading { font-size: clamp(2.1rem, 9vw, 3.4rem); }
  .page-intro { margin: 12px 0 18px; font-size: .98rem; }
  .chapter-list { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
  .status-line { margin-top: 18px; }

  .is-phone { display: flex; flex-direction: column; min-height: calc(100vh - 72px); min-height: calc(100dvh - 72px); padding: 11px 14px 0; }
  .is-phone .running-head { margin: 0 0 9px; padding: 0 2px; border: 0; font-size: .64rem; letter-spacing: .05em; gap: 0 10px; }
  /* The whole picture, never cropped: full width, but no taller than 55% of the screen
     (narrower and centered on short phones). The dialogue scrolls below it. */
  .is-phone .scene-figure { width: min(100%, calc(55vh * var(--picture-wh, .75))); height: auto; aspect-ratio: var(--picture-ratio, 3 / 4); margin: 0 auto; border-radius: 16px; box-shadow: 0 6px 18px rgba(49,39,45,.14); }
  @supports (height: 100svh) { .is-phone .scene-figure { width: min(100%, calc(55svh * var(--picture-wh, .75))); } }
  .scene-title { margin: 9px 2px 8px; font-size: 1.08rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dialogue { gap: 8px; }
  .line { grid-template-columns: minmax(0, 1fr) 48px; grid-template-areas: "role play" "text play"; gap: 1px 10px; padding: 8px 8px 9px 12px; border-radius: 14px; }
  .line.no-audio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "role" "text"; padding: 9px 12px 10px; }
  .line[data-speaker="Child"] { margin-left: 14px; }
  .line-role { grid-area: role; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 18px; }
  .line-text { grid-area: text; }
  .line-audio { grid-area: play; width: 48px; height: 48px; }
  /* Readable at arm's length: Filipino 20px, English 16px, speaker 12px. */
  .speaker { font-size: .75rem; }
  .turn-flag { margin-top: 0; }
  .filipino { font-size: 1.25rem; line-height: 1.28; }
  .english { margin-top: 2px; font-size: 1rem; line-height: 1.3; }
  .line.mini .speaker { font-size: .75rem; }
  .line.mini .filipino { font-size: 1.25rem; }
  .line.mini .english { font-size: 1rem; }
  .response-ladder { margin-top: 12px; gap: 8px; }
  .response-ladder.has-pairs { grid-template-columns: 1fr; }
  .response-ladder > * { padding: 9px 11px; border-radius: 14px; }
  .response-ladder > * > strong { font-size: 1rem; }
  .song-card { margin-top: 4px; padding: 16px 16px 18px; }
  .song-card h2 { margin-bottom: 12px; font-size: 1.32rem; }
  .verse p { font-size: 1.02rem; line-height: 1.45; }
  .moment { margin: 12px 2px 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
  /* The practice choice rides on the bottom bar, so it shows without scrolling. */
  .phone-foot { --ring: var(--gold-bright); position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 5; margin: auto -6px 8px; padding: 6px 5px 5px; border: 1px solid rgba(255,248,232,.3); border-radius: 20px; background: var(--navy); box-shadow: 0 10px 28px rgba(13,20,45,.45); }
  .phone-foot .listen-options { margin: 0 0 6px; flex-wrap: nowrap; align-items: stretch; gap: 6px; }
  .phone-foot .segmented { flex: 1 1 auto; }
  .phone-foot .segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .phone-foot .segmented-row { display: flex; width: 100%; border-color: rgba(255,248,232,.35); background: rgba(255,255,255,.08); }
  .phone-foot .segmented label { flex: 1 1 0; min-width: 0; }
  .phone-foot .segmented span { min-height: 48px; padding: 2px 4px; color: var(--paper); font-size: .8rem; line-height: 1.1; text-align: center; white-space: normal; }
  .phone-foot .segmented input:checked + span { color: var(--navy-deep); background: var(--paper); }
  .phone-foot .chip-toggle { flex: 0 0 auto; padding: 0 12px; color: var(--paper); background: rgba(255,255,255,.08); border-color: rgba(255,248,232,.35); font-size: .8rem; }
  .phone-foot .chip-toggle[aria-pressed="true"] { color: var(--navy-deep); background: var(--paper); border-color: var(--paper); }
  .phone-foot .bar-stop { color: var(--paper); background: rgba(255,255,255,.1); border-color: rgba(255,248,232,.35); }
  .is-phone .page-bar { margin: 0; padding: 0; gap: 6px; border: 0; }
  .is-phone > :nth-last-child(2) { margin-bottom: 16px; }
  .is-phone .bar-button { flex: 1 1 0; color: var(--paper); }
  .is-phone .page-bar.has-audio .bar-button { flex: 0 0 52px; }
  .is-phone .play-all { min-height: 52px; }
  .is-phone .page-bar.has-audio .bar-label { display: none; }
  .is-phone .bar-button:hover { background: rgba(255,255,255,.1); }
  .is-phone .play-all { flex: 1 1 auto; color: var(--navy-deep); background: var(--gold); }
  .is-phone .play-all:hover { background: #e4b950; }
  .is-phone .play-all.is-playing { color: #fff; background: var(--terracotta); }

  .sheet { inset: auto 0 0 0; width: 100%; max-height: 86vh; max-height: 86dvh; border-radius: 22px 22px 0 0; }
  .sheet-list { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 10px; padding: 14px 10px; }
  .line-sheet { width: 100%; max-height: 86vh; max-height: 86dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .turn-sheet { width: 100%; border-radius: 22px; }
  .book.turning-back .turn-sheet { border-radius: 22px; }
}

@media (max-width: 520px) {
  .segmented, .segmented-row { width: 100%; }
  .segmented-row { display: flex; }
  .segmented label { flex: 1 1 auto; }
  .segmented span { padding: 0 6px; font-size: .8rem; }
  .song-verses { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 430px) {
  body[data-view="page"] .brand-text { display: none; }
}

@media (max-width: 340px) {
  .is-phone .page-bar.has-audio .bar-button { flex-basis: 44px; min-width: 44px; }
  .is-phone .play-all { min-width: 0; padding: 0 10px; font-size: .92rem; line-height: 1.1; text-align: left; white-space: normal; }
}

/* ---- split cover: a cover painted as one wide scene keeps its own side, the words theirs ---- */
.book-cover.cover-split img { inset: 0 0 0 auto; width: 62%; object-position: var(--cover-x, 50%) center; }
.book-cover.cover-split .cover-shade { background: linear-gradient(90deg, #111a36 0%, #111a36 38%, rgba(17,26,54,0) 47%); }
.book-cover.cover-split .cover-copy { width: 40%; padding: clamp(30px, 4vw, 60px); padding-right: 8px; }
.book-cover.cover-split h1 { font-size: clamp(2.8rem, 4.6vw, 5.2rem); line-height: .92; }
.book-cover.cover-split .cover-subtitle { margin: 20px 0 24px; }

@media (max-width: 899px) {
  .book-cover.cover-split { display: flex; flex-direction: column; min-height: 0; }
  .book-cover.cover-split img { position: static; width: 100%; height: auto; aspect-ratio: 3 / 2; object-position: center; }
  .book-cover.cover-split .cover-shade { display: none; }
  .book-cover.cover-split .cover-copy { width: 100%; min-height: 0; padding: 22px 22px 30px; }
  .book-cover.cover-split h1 { font-size: clamp(3rem, 15vw, 4.4rem); }
  .book-cover.cover-split .cover-subtitle { margin: 16px 0 20px; }
}

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