:root {
  --log-ink: #163e46;
  --log-sea: #176457;
  --log-paper: #fff9e8;
  --log-gold: #dca952;
  --log-night: #12213b;
  --log-ease: cubic-bezier(.22,.72,.22,1);
  --header-height: 68px;
  --dock-height: 74px;
  --radius-lg: 18px;
}
html { scroll-behavior: auto; scroll-padding-top: calc(var(--header-height) + 16px); }
body {
  background: repeating-linear-gradient(165deg, #ffffff26 0 1px, transparent 1px 24px), #e4eee6;
}
::selection { color: #143b34; background: #b7e3cf; }
[hidden] { display: none !important; }
:where(a,button,summary,[tabindex]):focus-visible { outline: 3px solid #078677; outline-offset: 3px; }
.night-theme :focus-visible, .photo-dialog :focus-visible { outline-color: #ffe49c; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 150; padding: 8px 14px; background: white; color: var(--log-ink); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.logbar { display: block; padding: 0; background: #fffaf0; border-bottom: 1px solid #c3cfc0; color: var(--log-ink); backdrop-filter: none; }
.logbar-inner { max-width: 1080px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px clamp(10px,3vw,28px); }
.log-brand { display: flex; align-items: center; gap: 9px; color: var(--log-ink); text-decoration: none; font-weight: 800; line-height: 1.15; min-height: 44px; }
.log-brand-mark { color: var(--log-sea); font-size: 1.45rem; }
.log-settings { position: relative; }
.log-settings summary { list-style: none; white-space: nowrap; cursor: pointer; }
.log-settings summary::-webkit-details-marker { display: none; }
.log-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(330px, calc(100vw - 24px)); max-height: min(70vh, 570px); overflow: auto; background: #fffaf0; border: 1px solid #bdc9bb; border-radius: 12px; padding: 10px; box-shadow: 0 18px 35px #163e4629; }
.log-panel .topbar-nav { display: grid; grid-template-columns: 1fr; gap: 2px; }
.log-panel .nav-pill { display: flex; align-items: center; gap: 9px; padding: 7px 10px; min-height: 44px; background: none; border-radius: 6px; white-space: normal; transform: none; }
.log-panel .nav-pill:is(:hover,[aria-current]) { background: #dfede3; color: #163e46; }
.nav-sticker { margin-left: auto; }
.log-options { border-top: 1px solid #ddd4bc; padding-top: 8px; margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.log-progress { height: 4px; background: #d6e0d2; position: relative; }
.log-progress::before { content: ''; position: absolute; inset: 0; background: var(--log-sea); transform-origin: left; transform: scaleX(var(--voyage,0)); transition: transform .42s var(--log-ease); }
.log-boat-track { position: absolute; inset: 0 14px; pointer-events: none; }
.log-progress svg { position: absolute; left: calc(var(--voyage,0) * 100%); bottom: 0; transform: translateX(-50%); width: 23px; height: 19px; color: var(--log-sea); transition: left .42s var(--log-ease); }
.log-btn { display: inline-flex; justify-content: center; align-items: center; gap: .42em; min-height: 44px; border: 1px solid #bdc9b6; border-radius: 9px; padding: 7px 13px; color: var(--log-ink); background: #fffdf4; font: 800 .88rem/1.3 'Nunito',system-ui,sans-serif; text-align: center; text-decoration: none; cursor: pointer; }
.log-btn:hover { background: #e9f0e7; }
.log-btn.primary { background: var(--log-sea); border-color: var(--log-sea); color: white; }
.log-btn.primary:hover { background: #0d5248; }
.log-btn[aria-disabled=true], .log-btn:disabled { opacity: .48; cursor: default; }

.book { gap: 34px; margin-block: clamp(16px,3vw,32px) 30px; }
.page { background: var(--log-paper); border: 1px solid #cdbb90; }
.page-inner { padding-inline: clamp(16px,4vw,46px); }
.chapter-head { display: flex; flex-wrap: nowrap; align-items: start; }
.chapter-num { border-radius: 50%; width: clamp(36px,6vw,54px); height: auto; aspect-ratio: 1; font-size: clamp(1rem,3vw,1.4rem); background: var(--log-sea); box-shadow: none; }
.chapter-title-wrap { min-width: 0; }
.chapter-title-wrap h2 { text-wrap: pretty; }
.chapter-sub, .cover-subtitle, .story-text { overflow-wrap: break-word; }
.story-text { max-width: 62ch; margin-inline: auto; font-size: clamp(1.06rem,1.8vw,1.24rem); line-height: 1.68; }
.photo-card, .polaroid { min-width: 0; margin-inline: 0; }
.photo-grid.cols-2, .photo-grid.cols-3, .photo-grid.asymmetric { min-width: 0; }
.photo-frame picture { display: block; width: 100%; height: 100%; }
.photo-frame, .story-illus { isolation: isolate; }
.story-illus img { height: auto; }
.photo-grid + .story-text { margin-top: 26px; }
.cover { max-width: 100%; background: linear-gradient(155deg,#fffdf3,var(--log-paper) 55%,#f4e8cc); }
.cover-art-wrap { border-bottom: 1px solid #daccaa; }
.cover-art { height: auto; aspect-ratio: auto; }
.cover-badge { top: 10px; left: 10px; max-width: calc(100% - 20px); padding: 5px 10px; border: 1px solid #fff2d7; border-radius: 4px; font-size: .72rem; line-height: 1.3; box-shadow: 0 1px 6px #3840382b; }
.cover-content { min-width: 0; padding: clamp(20px,4.3vw,42px) clamp(16px,4.5vw,42px); }
.cover-eyebrow { text-transform: none; letter-spacing: .035em; color: #7c4821; font-size: .79rem; line-height: 1.4; text-wrap: balance; }
.cover-title { margin-bottom: .55em; color: var(--log-ink); text-shadow: none; font-size: clamp(1.72rem,5vw,3.1rem); line-height: 1.15; text-wrap: balance; }
.cover-subtitle { max-width: 47ch; margin-bottom: 16px; font-size: clamp(1rem,1.8vw,1.14rem); line-height: 1.5; }
.meta-chip { border: none; padding: 4px 8px; background: #eee6cd; color: #4a462d; font-size: .78rem; line-height: 1.4; border-radius: 5px; }
.cover-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.cover-actions .btn-start { font-size: 1rem; padding: 10px 17px; border-radius: 9px; box-shadow: 0 2px 6px #163e4626; }
.cover-actions .btn-start:hover { transform: none; }
.cover .narrator { justify-content: center; margin: 10px 0 0; }
.cover-meta { gap: 6px; margin: 17px 0 0; }
.cover-compass { display: none; width: 42px; height: 42px; color: #98713a; margin: 0 auto 10px; }
.scope-dialog {
  width: min(450px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: clamp(12px,3vw,24px);
  border: 1px solid #bc955f; border-radius: 17px;
  background: radial-gradient(ellipse at center, #2e5659, #193940 72%); color: #fff3d3;
  box-shadow: 0 20px 50px #0d1e22a6; overscroll-behavior: contain;
}
.scope-dialog:not([open]) { display: none; }
.scope-dialog[open] { display: grid; justify-items: center; gap: 12px; animation: log-reveal .27s var(--log-ease) both; }
.scope-dialog::backdrop { background: #0e222cdc; }
html:has(.scope-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.scope-header { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.scope-header h2 { margin: 0; font-size: clamp(1.04rem,4vw,1.4rem); }
.scope-rim {
  width: min(100%, 21.5rem, max(8rem, calc(100dvh - 13rem))); padding: clamp(7px,2vw,12px); border-radius: 50%;
  background: linear-gradient(135deg,#68482b 4%,#ecc080 25%,#fff4bf 33%,#ad7944 54%,#573c2b 70%,#dab17b 88%);
  box-shadow: 0 0 0 1px #322918, 0 7px 20px #0c1c20bb;
}
.scope-lens { display: block; width: 100%; border: 2px solid #583923; border-radius: 50%; background: #83b9c9; }
.scope-dialog p { max-width: 34ch; margin: 0; text-align: center; line-height: 1.45; font-size: .94rem; }
.scope-dialog :focus-visible { outline-color: #ffe49c; }
@media print { .scope-dialog { display: none !important; } }
.reader-ready[data-mode=book] { scroll-padding-bottom: calc(var(--dock-height) + 12px); }
.reader-ready[data-mode=book] body { padding-bottom: var(--dock-height); }
.reader-ready[data-mode=book] .book > .page { box-shadow: inset 5px 0 0 #a46d2419, 0 4px 0 -1px #f5ebcd, 0 5px 0 -1px #cbb98d, 0 9px 0 -2px #e4d6b4, 0 18px 40px #163e4626; }
.reader-ready[data-mode=book] .book > .page:not(.cover)::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 15px; pointer-events: none; background: linear-gradient(90deg,#63522a2f,transparent); }
.reader-ready[data-mode=book] .book :is(.page,.cover-art-wrap,.story-illus,.photo-frame,.illustration-playground,.pebble-stage),
.reader-ready[data-mode=book] .book { touch-action: pan-y pinch-zoom; }
.reader-dock { position: fixed; z-index: 90; inset: auto 0 0; padding: 8px max(12px,env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); background: #fffaf0; border-top: 1px solid #c3cfc0; box-shadow: 0 -4px 24px #173f4710; }
.dock-inner { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(6px,2vw,16px); align-items: center; max-width: 600px; margin: auto; }
.dock-inner .log-btn { min-height: 48px; }
.dock-place { color: var(--log-ink); font-size: .82rem; font-weight: 800; text-align: center; line-height: 1.25; }
.turn-corner { position: absolute; bottom: 0; right: 0; width: 54px; height: 54px; border: 0; cursor: pointer; background: linear-gradient(135deg, transparent 49%, #d7c08c 50% 54%, #eee0b3 55%); color: var(--log-ink); display: none; padding: 19px 0 0 20px; }
@media (hover:hover) and (pointer:fine) { .turn-corner:not([hidden]) { display: block; } .turn-corner:hover { background-color: #dfc58915; } }

/* The sheet is bounded by the viewport; real chapters never leave normal flow. */
.paper-stage { position: fixed; z-index: 80; pointer-events: none; overflow: clip; perspective: 1500px; border-radius: var(--radius-lg); isolation: isolate; }
.paper-leaf { position: absolute; inset: 0; transform-origin: left center; background: linear-gradient(90deg,#e3d3ae 0%,#fff9e8 12%,#fff9e8 87%,#ecd9ab 100%); color: var(--log-ink); border: 1px solid #cdbb90; border-radius: inherit; backface-visibility: hidden; overflow: hidden; box-shadow: 12px 3px 32px #52422335; }
.paper-stage.backward .paper-leaf { transform-origin: right center; }
.paper-stage[data-night] .paper-leaf { background: linear-gradient(90deg,#0c1b34,#203554 20%,#172944 86%,#0c1b34); color: #ffe49c; }
.paper-leaf::after { content: ''; position: absolute; inset: -10% -35%; background: linear-gradient(105deg,transparent 37%,#ffffff88 47%,#7c541736 55%,transparent 66%); animation: leaf-sheen .52s ease-out both; }
@keyframes leaf-sheen { from { transform: translateX(50%); opacity: 0; } 40% { opacity: .85; } to { transform: translateX(-55%); opacity: .1; } }
.paper-copy { position: absolute; inset: 0; background: inherit; border-radius: inherit; overflow: hidden; }
.paper-copy > .page { width: 100%; min-height: 100%; margin: 0; border: none; box-shadow: none; transform: translateY(var(--leaf-offset,0px)); }
@keyframes log-reveal { from { opacity: .67; translate: 0 8px; } to { opacity: 1; translate: none; } }
@keyframes compass-settle { from { transform: rotate(-26deg); } to { transform: none; } }
.log-enter { animation: log-reveal .37s var(--log-ease) both; }
.cover-compass { animation: compass-settle .55s var(--log-ease) both; }
.ripple-scene { pointer-events: none; position: absolute; z-index: 2; inset: auto 5% 17% 5%; height: 16%; }
.ripple-scene::before,.ripple-scene::after { content: ''; position: absolute; width: 32%; height: 38%; left: 38%; bottom: 3%; border: 2px solid #fff4beaa; border-radius: 50%; opacity: 0; }
.ripple-scene.log-enter { animation: none; }
.ripple-scene.log-enter::before,.ripple-scene.log-enter::after { animation: sea-ripple .85s ease-out both; }
.ripple-scene.log-enter::after { animation-delay: .17s; }
@keyframes sea-ripple { from { transform: scale(.55); opacity: .7; } to { transform: scale(1.4); opacity: 0; } }

.recording-controls { margin: 0 0 12px; }
.recording-panel {
  position: fixed; z-index: 91; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(400px, calc(100% - 20px)); box-sizing: border-box;
  border: 1px solid #648e85; border-radius: 10px 10px 5px 5px;
  background: var(--log-ink); color: var(--log-paper); box-shadow: 0 4px 16px #12213b35;
  font: 700 .86rem/1.3 'Nunito', system-ui, sans-serif;
}
.recording-panel::after {
  content: ''; position: absolute; inset: auto 6px 0; height: 2px; pointer-events: none;
  background: linear-gradient(to right, #efc773 var(--recording-progress, 0%), #557773 var(--recording-progress, 0%));
}
.recording-strip { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 44px; gap: 4px; align-items: center; padding: 2px 4px; }
.recording-panel button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border: 0; border-radius: 6px; padding: 0 4px; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.recording-panel button:hover { background: #fff9e81a; }
.recording-panel :is(button, input):focus-visible { outline: 2px solid #ffe49c; outline-offset: -2px; }
.recording-panel svg { width: 18px; height: 18px; flex: none; }
.recording-toggle svg { width: 32px; height: 32px; padding: 6px; box-sizing: border-box; border-radius: 50%; background: #efc773; fill: var(--log-ink); }
.recording-pause-icon, .recording-panel[data-playing] .recording-play-icon { display: none; }
.recording-panel[data-playing] .recording-pause-icon { display: initial; }
.recording-panel .recording-expand { justify-content: flex-start; gap: 4px; text-align: left; }
.recording-expand svg, .recording-close svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.recording-expand[aria-expanded=true] svg { transform: rotate(180deg); }
.recording-time { white-space: nowrap; font-size: .78rem; font-variant-numeric: tabular-nums; color: #e3e8db; }
.recording-details { border-top: 1px solid #557773; padding: 10px 14px 4px; }
.recording-title { font-size: .92rem; font-weight: 800; overflow-wrap: anywhere; }
.recording-seek { width: 100%; display: block; min-height: 44px; margin: 0; accent-color: #efc773; cursor: pointer; }
.recording-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.recording-place { color: #efc773; font-size: .8rem; }
.recording-panel .recording-text { margin-inline-start: auto; padding-inline: 9px; gap: .45em; }
.recording-text svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media screen {
  .reading-now {
    background-color: #f5e6b7;
    border-radius: 4px;
    box-shadow: 5px 0 #f5e6b7, -5px 0 #f5e6b7, -8px 0 #946124;
  }
  .night-theme .reading-now {
    background-color: #31405b;
    box-shadow: 5px 0 #31405b, -5px 0 #31405b, -8px 0 #efc773;
  }
}
.recording-note { padding: 0 14px 9px; font-size: .8rem; }
.recording-note:empty { display: none; }
[data-mode=book] .recording-panel { bottom: calc(var(--dock-height) + 7px); }
html.recording-open { --recording-clearance: calc(var(--recording-height, 50px) + env(safe-area-inset-bottom) + 12px); scroll-padding-bottom: var(--recording-clearance); }
html.recording-open[data-mode=book] { --recording-clearance: calc(var(--recording-height, 50px) + var(--dock-height) + 12px); }
html.recording-open body { padding-bottom: var(--recording-clearance); }
@media print { .recording-panel, .recording-controls { display: none !important; } html.recording-open body { padding-bottom: 0 !important; } }
.narrator { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 17px; align-items: center; }
.narrator .speech-note { font-size: .86rem; }
.saying { background: #ffdf7c; color: #302719; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
::highlight(reader-voice) { background: #fff1bd; color: #302719; }
::highlight(reader-word) { background: #f4c85e; color: #302719; }
.voice-bar { position: fixed; z-index: 91; bottom: calc(8px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(540px,calc(100% - 16px)); display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 4px 7px; padding: 7px 9px; background: #153e46; color: #fff9e8; border: 1px solid #659b89; border-radius: 12px; box-shadow: 0 3px 20px #12213b44; }
[data-mode=book] .voice-bar { bottom: calc(var(--dock-height) + 7px); }
html.voice-open body { padding-bottom: calc(var(--voice-height,66px) + 12px); }
html.voice-open[data-mode=book] body { padding-bottom: calc(var(--dock-height) + var(--voice-height,66px) + 12px); }
.voice-art { display: grid; place-items: center; width: clamp(28px,7vw,42px); aspect-ratio: 1; font-size: 1.2rem; border-radius: 50%; color: #ffdf7c; background: #24555c; }
.voice-art.voice-moving { animation: voice-sail 1.7s ease-in-out infinite; }
.voice-art.voice-paused { animation-play-state: paused; }
@keyframes voice-sail { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-3px) rotate(5deg); } }
.voice-label { font-size: clamp(.69rem,2.8vw,.88rem); font-weight: 800; line-height: 1.3; }
.voice-bar .log-btn { padding-inline: 8px; }
.voice-bar .voice-stop { color: #44291a; background: #ffdfa5; }
.voice-meter { grid-column: 1/-1; width: 100%; height: 4px; accent-color: #f4c85e; }
@media print { html.voice-open body { padding-bottom: 0 !important; } }
.sound-word[role=button] { cursor: pointer; }
.gull-button { display: grid; place-items: center; width: 44px; height: 44px; background: #fff9e8f2; border: 1px solid #c9b982; border-radius: 50%; color: var(--log-ink); font-size: 1.25rem; cursor: pointer; position: absolute; top: 8px; left: 8px; z-index: 3; }
.gull-button.is-found { background: #e2efda; }
.gull-button > * { grid-area: 1 / 1; pointer-events: none; }
.gull-check, .gull-button.is-found svg { visibility: hidden; }
.gull-button.is-found .gull-check { visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .gull-button.is-taking-off svg { overflow: visible; visibility: visible; }
  .gull-button.is-taking-off .gull-flight { animation: gull-takeoff .94s cubic-bezier(.45,.06,.44,1) both; }
  .gull-button.is-taking-off .gull-feather { animation: gull-wing .32s ease-in-out 2; }
  .gull-button.is-taking-off .gull-check { animation: gull-check-in .2s .35s both; }
}
@keyframes gull-takeoff { 18% { transform: translate(2px,2px) rotate(5deg); } 62% { transform: translate(27px,-13px) rotate(-12deg); opacity: 1; } to { transform: translate(52px,-23px) rotate(-4deg) scale(.6); opacity: 0; } }
@keyframes gull-check-in { from { opacity: 0; } }
.lightbox-opener:focus-visible { outline-offset: -4px; }
.page-tail { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 24px; padding-top: 18px; border-top: 1px solid #b09b585c; }

.photo-dialog { width: min(980px, calc(100% - 18px)); max-width: none; max-height: calc(100% - 18px); border: 1px solid #6d8b8f; padding: clamp(9px,2.2vw,22px); border-radius: 14px; background: #102d37; color: #fff9ea; overflow: auto; overscroll-behavior: contain; }
.photo-dialog:not([open]) { display: none; }
.photo-dialog::backdrop { background: #12252de0; }
.photo-dialog[open] { animation: log-reveal .23s var(--log-ease) both; }
.photo-dialog-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.photo-context { margin: 0; font-weight: 800; font-size: .93rem; line-height: 1.3; }
.photo-dialog-stage { height: clamp(160px, 56dvh, 640px); width: 100%; background: #071e27; overflow: hidden; border-radius: 8px; position: relative; touch-action: none; }
.photo-dialog-stage.zoomed { cursor: grab; }
.photo-dialog-stage.zoomed:active { cursor: grabbing; }
.photo-dialog-stage img { position: absolute; inset: 0; display: block; height: 100%; width: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.photo-dialog-controls { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin-top: 9px; }
.photo-dialog-controls .log-btn { min-width: 44px; }
#photoScale { min-width: 4.5ch; text-align: center; font-size: .86rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.photo-zoom-hint { margin: 7px 0 0; text-align: center; color: #c2d6d8; font-size: .77rem; line-height: 1.35; }
.photo-dialog-caption { font-size: .91rem; line-height: 1.45; margin: 9px 0 0; }
.photo-dialog .speech-note { margin: 6px 0 0; }
html.photo-open { overflow: hidden; scrollbar-gutter: stable; }

@media screen and (min-width: 760px) {
  .cover { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); align-items: center; gap: clamp(20px,3vw,36px); padding: clamp(18px,2.5vw,32px); }
  .cover-art-wrap { border: 1px solid #c9b88c; border-radius: 10px; background: #f6e8c4; box-shadow: 0 8px 18px #76623f20; }
  .cover-content { padding: 12px 0; }
  .cover-compass { display: block; }
  .cover-title { font-size: clamp(2rem,3.65vw,2.7rem); }
}
@media screen and (min-width: 760px) and (max-height: 560px) {
  .book { margin-top: 16px; }
  .cover-content { padding-block: 4px; }
  .cover-compass { width: 32px; height: 32px; margin-bottom: 6px; }
  .cover-subtitle { line-height: 1.42; }
  .cover-meta { margin-top: 12px; }
}
@media (max-width: 480px) {
  .book { padding-inline: 9px; }
  .logbar-inner { gap: 8px; }
  .log-brand { font-size: .86rem; }
  .log-settings > summary { padding-inline: 9px; }
  .dock-inner { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); }
  .dock-inner .log-btn { padding-inline: 6px; }
  .chapter-head { gap: 10px; }
  .archive-grid { grid-template-columns: 1fr; }
  .interactive-panel,.scroll-box,.questions-box,.diploma { padding-inline: 13px; }
  .photo-dialog-stage { height: 48dvh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
  .paper-stage { display: none !important; }
}
.scene.discovery { display: block; margin-block: 24px; background: #faf1d7; color: #163e46; border: 1px solid #cdbc8e; border-radius: 13px; padding: clamp(12px,3vw,20px); }
.discovery > h3 { margin: 0 0 6px; color: #163e46; }
.discovery > p { margin: 0 0 10px; font-size: .94rem; line-height: 1.4; }
.discovery-art { position: relative; background: #cfe7dc; overflow: hidden; border: 1px solid #9cb6a6; border-radius: 9px; margin: 12px 0; }
.discovery-art svg { display: block; width: 100%; height: auto; }
.discovery-buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.discovery-buttons [aria-pressed=true] { background: #1e6354; color: white; border-color: #1e6354; }
.discovery-buttons .log-btn { min-width: 44px; }
.discovery-tools { margin-top: 10px; }
.discovery-counter { font-size: .83rem; font-weight: 800; margin-left: auto; }
.discovery .discovery-status:not(:empty) { margin-top: 9px; font-weight: 800; }
.exhibit {
  min-width: 0;
  align-self: start;
  margin: 24px 0;
  padding: clamp(7px, 1.4vw, 13px) clamp(7px, 1.4vw, 13px) 14px;
  border: 1px solid #d9bd91;
  border-radius: 17px;
  background: #fffaf0;
}
.photo-grid > .exhibit { margin-block: 0; }
.exhibit .photo-cap { font-size: .99rem; }
.exhibit-note { display: block; margin-top: 5px; color: inherit; font-size: .83rem; }
.photo-frame.exhibit-frame { height: auto; aspect-ratio: auto; background: #f7ead0; }
.photo-frame.exhibit-frame img { height: auto; object-fit: contain; }
.photo-frame.exhibit-frame .exhibit-painted { width: min(100%, 509px); margin-inline: auto; }
.photo-frame.exhibit-frame .archive-painted { position: absolute; inset: 0; width: 100%; height: 100%; }
.archive-card .photo-frame.exhibit-frame { aspect-ratio: 8 / 5; display: grid; place-items: center; }
.page.night-theme .exhibit { background: #193749; border-color: #6f8d96; }
.archive-card.archive-exhibit { margin: 0; }
@media (max-width: 480px) {
  .exhibit .photo-cap { font-size: .94rem; }
}
@page { margin: 12mm; }
@media print {
  .logbar,.reader-dock,.paper-stage,.narrator,.turn-corner,.gull-button,.page-tail,.photo-dialog,.cover-actions,.skip-link,.ripple-scene,.book-ui,#magic-dust { display: none !important; }
  html.reader-ready body { padding: 0; }
  .book { display: block; }
  html .book > .page, html .book > .page[hidden] { display: block !important; break-inside: auto; overflow: visible; border: none; box-shadow: none !important; background: white; color: #183339; page-break-after: auto; }
  .book > .page + .page { break-before: page; }
  .page-inner { padding: 0; }
  .chapter-head { break-after: avoid; }
  .photo-grid,.archive-grid,.polaroid-row { display: block; }
  .photo-card,.archive-card,.exhibit,.polaroid,.diploma,.story-illus { break-inside: avoid; margin-block: 9mm; box-shadow: none; transform: none !important; }
  .photo-frame { width: auto; height: 85mm; aspect-ratio: auto !important; background: none !important; }
  .photo-frame img { object-fit: contain; }
  .photo-frame.exhibit-frame img { width: auto; max-width: 100%; max-height: 85mm; margin-inline: auto; }
  .book .page.night-theme .exhibit { background: #fffaf0; }
  .reader-ready .cover-art-wrap { min-height: 0; height: auto; }
  .reader-ready .cover-art { position: static; height: auto; }
  .book .night-theme :is(h2,h3,.chapter-sub,.photo-cap,.photo-cap strong,.illus-caption,.part-detail,.part-btn) { color: #183339; }
  .book .night-theme :is(.photo-card,.interactive-panel,.illus-caption) { background: #edf3f6; }
  .saying { background: none; color: inherit; }
}

/* A small, touch-friendly stage for each illustrated scene. */
.illustration-playground { position: relative; overflow: hidden; isolation: isolate; }
.story-illus .illustration-playground img { cursor: default; }
.story-illus:hover .illustration-playground img { transform: none; }
.photo-frame.exhibit-frame { cursor: default; }
.story-layers { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.has-story-layers > img { opacity: 0; }
.story-layers :is(.art-breaker,.art-whale-spout,.art-sawdust,.art-north-trace,.art-voyage-wake,.art-basket,.art-crowing) { visibility: hidden; }
.story-layers[data-action="0"] :is(.art-breaker,.art-sawdust,.art-north-trace,.art-basket),
.story-layers[data-action="1"] :is(.art-whale-spout,.art-voyage-wake,.art-crowing) { visibility: visible; }
.story-layers[data-action="0"] .art-water, .story-layers[data-action="1"] .art-shimmer { animation: art-water 2.3s ease-in-out infinite; }
.story-layers[data-action="0"] .art-breaker { opacity: .74; animation: art-breaker 2.6s ease-in-out infinite; }
.story-layers[data-action="0"] .art-yacht { animation: art-bob 2.1s ease-in-out infinite; }
.story-layers[data-action="0"] .art-yacht:nth-of-type(2n) { animation-delay: .5s; }
.story-layers[data-action="1"] .art-gulls { stroke-width: 4; animation: art-gulls 4.2s ease-in-out infinite; }
.story-layers[data-action="1"] .art-gulls path { transform-box: fill-box; transform-origin: center; animation: art-flap .42s ease-in-out infinite; }
.story-layers[data-action="0"] .art-spokes { transform-box: fill-box; transform-origin: center; animation: art-spokes 3.4s ease-in-out infinite; }
.story-layers[data-action="0"] .art-timber { animation: art-hoist 3.4s ease-in-out infinite; }
.story-layers[data-action="0"] .art-hoist-rope { transform-box: fill-box; transform-origin: center top; animation: art-reel 3.4s ease-in-out infinite; }
.story-layers[data-action="1"] .art-eye { transform-box: fill-box; transform-origin: center; animation: art-wink 1.5s ease-in-out infinite; }
.story-layers[data-action="1"] .art-whale-spout { opacity: .84; animation: art-spout 2.2s ease-in-out infinite; }
.story-layers[data-action="1"] .art-ribs path { stroke: #ce9160; animation: art-ribs 2.4s calc(var(--rib-i,0) * 120ms) ease-in-out infinite; }
.story-layers[data-action="1"] .art-ribs path:nth-child(2) { --rib-i:1 }
.story-layers[data-action="1"] .art-ribs path:nth-child(3) { --rib-i:2 }
.story-layers[data-action="1"] .art-ribs path:nth-child(4) { --rib-i:3 }
.story-layers[data-action="1"] .art-ribs path:nth-child(5) { --rib-i:4 }
.story-layers[data-action="1"] .art-ribs path:nth-child(6) { --rib-i:5 }
.story-layers[data-action="1"] .art-ribs path:nth-child(7) { --rib-i:6 }
.story-layers[data-action="1"] .art-ribs path:nth-child(8) { --rib-i:7 }
.story-layers[data-action="0"] .art-saw { animation: art-saw .62s ease-in-out infinite; }
.story-layers[data-action="0"] .art-shavings { animation: art-shavings 1.5s ease-in-out infinite; }
.story-layers[data-action="0"] .art-sawdust circle { animation: art-dust 1.3s ease-in-out infinite; }
.story-layers[data-action="0"] .art-sawdust circle:nth-child(even) { animation-delay: .45s; }
.story-layers[data-action="1"] .art-joint { animation: art-join 2.8s ease-in-out infinite; }
.story-layers[data-action="1"] .art-peg { animation: art-peg 2.8s ease-in-out infinite; }
.story-layers .art-constellation { opacity: 0; transition: opacity .35s ease-out; }
.story-layers[data-constellations] .art-constellation { opacity: 1; transition-duration: .75s; }
.story-layers[data-constellations] .art-little-bear-outline { transition-delay: .2s; }
.story-layers[data-constellations] .art-dragon-outline { transition-delay: .4s; }
.story-layers[data-constellations] .art-north-trace { visibility: visible; stroke-dasharray: 1; animation: north-trace 1s .45s ease-out both; }
@keyframes north-trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.story-layers[data-action="1"] .art-voyage-wake { stroke-dasharray: 1; animation: art-trace 2.4s ease-in-out infinite; }
.story-layers[data-action="1"] .art-night-boat { transform-box: fill-box; transform-origin: center 85%; animation: art-voyage 4.6s ease-in-out infinite; }
.story-layers[data-action="0"] .art-fruit circle { animation: art-fruit 2.1s ease-in-out infinite; }
.story-layers[data-action="0"] .art-fruit g:nth-child(2n) circle { animation-delay: .35s; }
.story-layers[data-action="0"] .art-fruit g:nth-child(3n) circle { animation-delay: .7s; }
.story-layers[data-action="1"] :is(.art-rooster,.art-rooster-head,.art-hen) { transform-box: fill-box; transform-origin: center bottom; animation: art-crow 1.3s ease-in-out infinite; }
.story-layers[data-action="1"] .art-hen { animation-delay: .4s; }
.story-layers[data-action="1"] .art-crowing { animation: art-spout 1.3s ease-in-out infinite; }
@keyframes art-water { 0%,100% { translate: 0; } 50% { translate: 52px 8px; opacity: .98; } }
@keyframes art-breaker { 0%,100% { translate: 47px -83px; opacity: 0; } 37%,62% { opacity: 1; translate: -30px 38px; } }
@keyframes art-bob { 0%,100% { translate: 0; } 50% { translate: 7px -13px; } }
@keyframes art-gulls { 0%,100% { translate: 0; } 50% { translate: 90px -24px; } }
@keyframes art-flap { 50% { scale: 1 2.2; } }
@keyframes art-spokes { 0%,100% { rotate: 0deg; } 42%,66% { rotate: -225deg; } }
@keyframes art-hoist { 0%,100% { translate: 0; } 42%,66% { translate: 0 -78px; } }
@keyframes art-reel { 0%,100% { scale: 1; } 42%,66% { scale: 1 .48; } }
@keyframes art-wink { 0%,100% { scale: 1; } 30%,48% { scale: 1 .2; } 62% { fill: #ffce64; } }
@keyframes art-spout { 0%,100% { opacity: 0; translate: 0 25px; } 45%,68% { opacity: 1; translate: 0; } }
@keyframes art-ribs { 0%,100% { stroke: #8e5633; } 50% { stroke: #ffce70; stroke-width: 17; } }
@keyframes art-saw { 50% { translate: 47px 10px; } }
@keyframes art-shavings { 0%,100% { translate: 0; opacity: 1; } 50% { translate: 14px -20px; opacity: .8; } }
@keyframes art-dust { 0%,100% { opacity: 0; translate: 0; } 20%,45% { opacity: 1; } 75% { translate: 43px 52px; opacity: 0; } }
@keyframes art-join { 0%,100% { translate: 0; } 28%,46% { translate: 48px 0; } 68%,84% { translate: -16px 0; } }
@keyframes art-peg { 0%,100% { translate: 0; } 32%,52% { translate: 0 -38px; } 72%,86% { translate: 0 4px; } }
@keyframes art-trace { 0%,100% { stroke-dashoffset: 1; } 45%,75% { stroke-dashoffset: 0; } }
@keyframes art-voyage { 0%,100% { translate: 0; rotate: 0deg; } 50% { translate: -120px -6px; rotate: -3deg; } }
@keyframes art-fruit { 0%,100% { translate: 0; } 42% { translate: calc(var(--fruit-x) * .48) calc(var(--fruit-y) * .45 - 42px); } 72% { translate: calc(var(--fruit-x) * .9) calc(var(--fruit-y) * .9 - 12px); } }
@keyframes art-crow { 0%,100% { rotate: 0deg; } 36% { rotate: -9deg; scale: 1 1.13; } 69% { rotate: 5deg; } }
@media (prefers-reduced-motion: reduce) {
  .story-layers[data-action="0"] .art-timber { translate: 0 -78px; }
  .story-layers[data-action="0"] .art-hoist-rope { scale: 1 .48; }
  .story-layers[data-action="0"] .art-spokes { rotate: -225deg; }
  .story-layers[data-action="0"] .art-sawdust { translate: 40px 30px; }
}
.illustration-game { padding: 10px 12px 12px; background: #f6e8c4; color: #234b4a; }
.illustration-game-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.illustration-game-button { display: inline-flex; align-items: center; gap: .4em; min-height: 44px; border: 1px solid #277c79; border-radius: 9px; padding: 6px 11px; background: #fffdf1; color: #165258; font: inherit; font-size: .88rem; font-weight: 800; cursor: pointer; }
.illustration-game-button:hover, .illustration-game-button.is-current, .illustration-game-button[aria-expanded=true] { background: #176c6b; color: #fff; }
.illustration-game-button:focus-visible { outline: 3px solid #b34322; outline-offset: 2px; }
.illustration-game-message { margin: 6px 0 0; font-size: .92rem; line-height: 1.42; }
.illustration-game-message:empty { display: none; }
.cover-art-wrap .illustration-game { padding: 8px; border-top: 1px solid #c9b88c; }
.cover-art-wrap .illustration-game-buttons { justify-content: center; gap: 8px; }
.cover-art-wrap .illustration-game-button { justify-content: center; padding-inline: 8px; }
.cover-art-wrap .illustration-game-message { text-align: center; }
/* Magic-dust celebration host: fixed, above the book, never blocks input. */
#magic-dust { position: fixed; inset: 0; z-index: 130; pointer-events: none; overflow: hidden; }
#magic-dust * { position: absolute; }
.magic-spark { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 9px 2px currentColor; background-clip: padding-box; }
.magic-spark.leaf-dust { width: 6px; height: 6px; box-shadow: 0 0 7px 1px currentColor; }

/* Full-screen star rain for the book's grand finale. */
.magic-star { width: var(--star-size,12px); height: var(--star-size,12px); background: currentColor; }
.wax-seal { position: relative; isolation: isolate; }
.wax-seal.stamped::before { content: ''; position: absolute; z-index: -1; inset: -13px; border-radius: 50%; box-shadow: 0 0 28px 9px #e5a23d; opacity: .27; }
@media (prefers-reduced-motion: no-preference) {
  .wax-seal.stamped::before { animation: wax-breathe 2.7s ease-in-out .7s 3; }
}
@keyframes wax-breathe { 50% { opacity: .66; } }
.diploma .seal-message { margin: 13px auto 0; color: #654128; font-weight: 800; }
.diploma .stamp-shine { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.diploma .stamp-shine::before { content: ''; position: absolute; inset: -30% -40%; background: linear-gradient(105deg, transparent 38%, #ffffff8f 48%, #ffd97d4d 54%, transparent 64%); opacity: 0; }
.diploma .stamp-shine.is-shining::before { animation: stamp-shine 1.3s ease-out 1; }
@keyframes stamp-shine { 0% { opacity: 0; transform: translateX(30%); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateX(-40%); } }

.night-theme .illustration-game { background: #142c43; color: #ffebaf; }
.night-theme .illustration-game-button { border-color: #c4a66a; background: #244a66; color: #fff4d1; }
.night-theme .illustration-game-button:is(:hover, .is-current, [aria-expanded=true]) { background: #f7dc88; color: #182e46; }
.archive-exhibit .illustration-game { border-radius: 0 0 10px 10px; }
.wax-seal.is-pressing { animation: seal-press .72s cubic-bezier(.28,.69,.32,1) both; }
@keyframes seal-press {
  0% { transform: translateY(-45px) rotate(-15deg) scale(1.26); opacity: 0; }
  36% { transform: translateY(-10px) rotate(-10deg) scale(1.1); opacity: 1; }
  58% { transform: translateY(3px) rotate(-8deg) scale(1.08,.87); }
  82% { transform: translateY(-3px) rotate(-8deg) scale(.99,1.02); }
  100% { transform: rotate(-8deg); opacity: 1; }
}
.photo-album { margin-top: 27px; }
.photo-album h3 { font-size: clamp(1.04rem,2.3vw,1.3rem); margin: 0 0 12px; }
@media screen {
  .wax-seal:not(.stamped) { display: none; }
  .photo-album .photo-grid { margin-top: 0; align-items: start; }
  .photo-album .photo-frame { aspect-ratio: auto; }
  .photo-album .photo-frame img { height: auto; }
  .photo-album.matching-previews .photo-frame { aspect-ratio: 4 / 3; }
  .photo-album.matching-previews .photo-frame img { height: 100%; object-fit: cover; }
  .photo-album.matching-previews .photo-frame img[data-full$="IMG_2510.jpg"] { object-position: center 51%; }
  .photo-album .photo-card:only-child { width: min(100%, 33rem); justify-self: center; }
}
@media screen and (min-width: 821px) {
  .photo-album .photo-grid.cols-2 > .photo-card:nth-child(odd):last-child { grid-column: 1 / -1; }
  .photo-album .photo-grid.cols-2:has(> .photo-card:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .photo-album .photo-grid.cols-2 > .photo-card:nth-child(3):last-child { grid-column: auto; }
}
@media screen and (max-width: 600px) {
  .archive-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .story-layers * { animation: none !important; }
  .story-layers .art-constellation { transition: none !important; }
}
@media print {
  .illustration-game, .story-layers { display: none !important; }
  .has-story-layers > img { opacity: 1; }
}
