:root {
  color-scheme: dark;
  --desk: #211a29;
  --ink: #30243a;
  --paper: #f7e7c7;
  --paper-edge: #d4b783;
  --brass: #bd9055;
  --muted: #c8b4c6;
  font-family: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--desk);
  color: var(--paper);
  background-image: radial-gradient(ellipse at 50% 35%, #38293e 0, transparent 72%);
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .34; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #ffbd69; outline-offset: 5px; }
[hidden] { display: none !important; }
.reader-shell { width: min(1440px, 100%); padding: 12px 32px 15px; margin: auto; }
.reader-header { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 16px; }
.sample-note { width: min(100%, 1180px); margin: 4px auto 0; color: #e7ba7f; text-align: center; font-family: Arial, "Microsoft YaHei", sans-serif; font-size: 12px; line-height: 1.6; }
.series-name { font-size: 16px; margin: 0; color: #decbdd; font-style: italic; }
.header-actions { display: flex; gap: 24px; align-items: center; }
.quiet-button { border: 0; background: none; padding: 12px 4px; min-height: 44px; font-size: 14px; color: var(--muted); }
.quiet-button:hover { color: var(--paper); }
.language-switch { display: flex; border: 1px solid #6d536e; border-radius: 5px; padding: 2px; gap: 2px; }
.language-switch button { border: 0; background: none; min-width: 44px; min-height: 38px; padding: 4px 10px; font-size: 14px; border-radius: 3px; }
.language-switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.skip-link { position: fixed; z-index: 10; top: 0; left: 20px; transform: translateY(-130%); padding: 12px 16px; background: var(--paper); color: var(--ink); }
.skip-link:focus { transform: translateY(8px); }
.book {
  --art-ratio: 1.777778;
  width: min(100%, var(--book-width, 1180px));
  margin: 13px auto 0;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #b89a72;
  box-shadow: 0 4px 0 #cbb080, 0 8px 0 #806446, 0 22px 46px #09060e90;
  border-radius: 2px;
  container-type: inline-size;
  transform-origin: center bottom;
  overflow: hidden;
}
.illustration-page { position: relative; display: grid; width: 100%; aspect-ratio: var(--art-ratio); margin: 0; overflow: hidden; background: #30243a; }
#page-image { width: 100%; height: 100%; display: block; object-fit: contain; }
#page-image[hidden] { display: none; }
.missing-illustration { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px; text-align: center; color: var(--paper); background: #30243a; }
.missing-illustration p:first-child { font-size: clamp(20px, 3vw, 32px); line-height: 1.3; margin: 0; max-width: 24em; }
.missing-illustration p:last-child { color: var(--muted); font-size: 15px; margin: 16px 0 0; }
.caption-page { position: relative; padding: 20px clamp(20px, 6cqw, 88px) 22px; min-height: 88px; display: grid; place-content: center; background: var(--paper); text-align: center; }
.caption-page::before { content: ""; height: 1px; width: 30px; background: var(--brass); position: absolute; top: 0; left: calc(50% - 15px); }
#page-title { margin: 0 0 10px; font-size: clamp(24px, 4cqw, 48px); font-weight: 400; line-height: 1.05; }
.book:not(.is-cover) #page-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.page-copy { max-width: 68ch; font-size: clamp(17px, 1.9cqw, 24px); line-height: 1.45; }
.page-copy p { margin: 0; }
.page-copy p + p { margin-top: 8px; }
.page-hook { font-style: italic; }
#paragraphs:empty + .page-hook { font-style: normal; }
.page-copy:has(#paragraphs:not(:empty)) .page-hook:not(:empty) { margin-top: 3px; }
.book.is-cover .caption-page { padding-top: 18px; padding-bottom: 19px; }
.book.is-cover .page-copy { font-size: clamp(16px, 1.7cqw, 20px); }
.book.is-cover .page-hook { font-style: normal; }
.page-navigation { width: min(100%, var(--nav-width, 1180px)); margin: 21px auto 0; display: grid; grid-template-columns: minmax(110px, 1fr) minmax(100px, 180px) minmax(110px, 1fr); align-items: center; gap: 18px; }
.turn-button { min-height: 48px; display: inline-flex; align-items: center; gap: 14px; border: 0; background: none; padding: 6px 0; font-size: 17px; }
.turn-button:not(:disabled):hover { color: #ffd89b; }
.previous-button { justify-self: start; }
.next-button { justify-self: end; text-align: right; }
.turn-button svg { width: 28px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reading-progress { text-align: center; font-family: Arial, "Microsoft YaHei", sans-serif; font-size: 12px; color: #d3c0d1; }
.progress-track { height: 2px; background: #604a63; width: 100%; margin-top: 9px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--brass); transition: width 180ms ease; }
.reader-footer { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 1px auto 0; min-height: 34px; }
.reader-footer p { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; color: #ac96ad; font-size: 12px; }
.reader-footer .quiet-button { min-height: 34px; padding: 8px 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.story-status, .noscript-message { max-width: 600px; margin: 24px auto; padding: 18px; background: #55383f; line-height: 1.6; text-align: center; }
.book.turn-forward { animation: next-page 260ms ease both; }
.book.turn-back { animation: previous-page 260ms ease both; }
@keyframes next-page { 0% { opacity: .55; transform: perspective(1600px) rotateY(-2deg) translateX(8px); } 100% { opacity: 1; transform: none; } }
@keyframes previous-page { 0% { opacity: .55; transform: perspective(1600px) rotateY(2deg) translateX(-8px); } 100% { opacity: 1; transform: none; } }
dialog { color-scheme: light; background: var(--paper); color: var(--ink); width: min(700px, calc(100% - 28px)); border: 1px solid #ba9965; padding: 25px 30px 30px; max-height: min(80svh, 800px); box-shadow: 0 24px 100px #0008; }
dialog::backdrop { background: #130d1bc9; }
.dialog-heading { display: flex; align-items: center; gap: 20px; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-size: 28px; font-weight: 400; }
.dialog-heading button { border: 0; background: transparent; color: var(--ink); width: 44px; height: 44px; font-size: 30px; }
#source-content { font-size: 16px; line-height: 1.65; }
#source-content a { color: #5b3a74; text-underline-offset: 3px; }
#source-content ul { padding-left: 24px; }
#source-content li + li { margin-top: 12px; }
@media (min-width: 760px) and (max-height: 700px) { .reader-shell { padding-top: 4px; } .reader-header { min-height: 44px; } .book { margin-top: 5px; } .caption-page { padding-top: 13px; padding-bottom: 14px; min-height: 68px; } .page-copy { font-size: 17px; } .page-navigation { margin-top: 15px; } .reader-footer { display: none; } }
@media (max-width: 759px) {
  .reader-shell { padding: 9px 14px 15px; }
  .reader-header { min-height: 48px; gap: 8px; }
  .series-name { font-size: 13px; max-width: 12em; }
  .header-actions { gap: 12px; }
  .header-actions .quiet-button { font-size: 12px; }
  .language-switch button { min-width: 38px; padding: 4px 7px; font-size: 12px; }
  .book { width: 100%; margin-top: 11px; }
  .caption-page { min-height: 76px; padding: 13px 17px 15px; }
  .page-copy { font-size: clamp(16px, 4.25vw, 20px); line-height: 1.4; }
  #page-title { font-size: clamp(25px, 6.9vw, 37px); line-height: 1.08; margin-bottom: 9px; }
  .book.is-cover .page-copy { font-size: 15px; }
  .page-navigation { grid-template-columns: 1fr 80px 1fr; gap: 10px; margin-top: 23px; }
  .turn-button { font-size: 14px; gap: 8px; min-height: 48px; }
  .turn-button svg { width: 23px; }
  .reader-footer { margin-top: 8px; flex-direction: column; gap: 0; }
  .reader-footer p { text-align: center; font-size: 11px; }
  .reader-footer .quiet-button { font-size: 12px; }
  .missing-illustration { padding: 20px; }
  .missing-illustration p:first-child { font-size: 21px; }
  .missing-illustration p:last-child { font-size: 12px; margin-top: 10px; }
  dialog { padding: 18px 20px; }
  .dialog-heading h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.library-link { display:inline-flex; align-items:center; gap:4px; text-decoration:none; white-space:nowrap; }
@media(max-width:480px){.header-actions{gap:7px}.library-link{font-size:12px}.series-name{max-width:7em}}


/* Release: a continuous mobile picturebook, including phone landscape. */
.story-shortcuts{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:8px 24px;margin:6px auto 9px;font-family:Arial,"Microsoft YaHei",sans-serif}
.story-shortcuts .quiet-button{border:1px solid #806178;border-radius:8px;padding:9px 14px;min-height:42px;font-size:12px;text-decoration:none;color:#f7dfbb}
.story-shortcuts .origins-pending{border-style:dashed;color:#c4adbf;opacity:.75;cursor:default}
.story-library-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:20px}
.story-library-grid a{display:block;color:var(--ink);text-decoration:none;font-size:14px;line-height:1.5;border:1px solid #c5a87f;background:#f9edda;border-radius:8px;overflow:hidden}
.story-library-grid a:hover,.story-library-grid a[aria-current=page]{outline:2px solid #925b79;outline-offset:2px}
.story-library-grid img{display:block;width:100%;height:auto;aspect-ratio:1.5;object-fit:cover}
.story-library-grid span{display:block;padding:9px 10px}
.story-language-note{font-family:Arial,"Microsoft YaHei",sans-serif;font-size:12px;line-height:1.6;color:#70566b;margin-bottom:0}
.continuous-book{display:none}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.scroll-reading .book,.scroll-reading #page-navigation{display:none}
.scroll-reading .reader-shell{padding:10px max(12px,env(safe-area-inset-right)) 26px max(12px,env(safe-area-inset-left));max-width:820px}
.scroll-reading .reader-header{align-items:flex-start;gap:12px;flex-wrap:wrap}
.scroll-reading .series-name{font-size:14px;max-width:none;padding-top:12px}
.scroll-reading .header-actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-left:auto}
.scroll-reading .header-actions .quiet-button{font-size:12px}
.scroll-reading .story-shortcuts{justify-content:flex-start;margin-block:12px 18px;gap:8px}
.scroll-reading .story-shortcuts .quiet-button{font-size:12px;padding:8px 11px}
.scroll-reading .continuous-book{display:block;width:100%;margin:0 auto;background:var(--paper);color:var(--ink);border:1px solid #c5a87f;box-shadow:0 12px 35px #09060e70}
.scroll-story-page{scroll-margin-top:12px;position:relative}
.scroll-story-page+ .scroll-story-page{border-top:1px solid #ccb58f}
.scroll-story-page figure{margin:0;background:#30243a;overflow:hidden}
.scroll-story-page figure img{display:block;width:100%;height:auto;object-fit:contain}
.scroll-story-copy{padding:22px clamp(18px,5vw,40px) 19px;text-align:center;font-size:clamp(17px,2.7vw,22px);line-height:1.7}
.scroll-story-copy h1{font-size:clamp(25px,5vw,38px);line-height:1.3;font-weight:400;margin:0 0 15px}
.scroll-story-copy p{margin:0}
.scroll-story-copy p+p{margin-top:8px}
.scroll-page-number{display:block;font-family:Arial,"Microsoft YaHei",sans-serif;font-size:10px;letter-spacing:.5px;color:#91795e;margin-top:14px}
.scroll-image-error{padding:60px 20px;color:var(--paper);text-align:center}
.scroll-reading .reader-footer{display:flex;margin-top:18px;flex-wrap:wrap;gap:4px 18px}
.scroll-reading .reader-footer p{font-size:12px}
@media(max-width:500px){.story-library-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.story-library-grid span{font-size:12px}}

/* One language control stays compact on phones; Chinese is the final option. */
.language-switch select { color: var(--paper); background: #30243a; border: 0; border-radius: 4px; min-width: 110px; max-width: 150px; min-height: 42px; padding: 7px 24px 7px 10px; font: 14px/1.4 Arial,"Microsoft YaHei",sans-serif; cursor: pointer; }
.language-switch select:focus-visible { outline: 3px solid #ffbd69; outline-offset: 3px; }
.language-switch option { color: var(--paper); background: #30243a; }
.scroll-page-number { direction: ltr; unicode-bidi: isolate; }
.reader-header { flex-wrap: wrap; }
.header-actions { flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-inline-start: auto; }
html[dir=rtl] .page-copy, html[dir=rtl] .scroll-story-copy, html[dir=rtl] #source-content { line-height: 1.85; }
.page-navigation { direction: ltr; }
html[dir=rtl] .turn-button span { direction: rtl; }
#source-content ul { padding-inline-start: 24px; padding-inline-end: 0; }
@media(max-width:480px) { .header-actions { width: 100%; gap: 8px; justify-content: space-between; } .language-switch select { max-width: 130px; } }

.image-retry{min-height:44px;margin-top:14px;padding:10px 18px;border:1px solid #e5bb7c;border-radius:8px;background:#f2d19e;color:#30243a;font:600 15px/1.4 Arial,"Microsoft YaHei",sans-serif;cursor:pointer}.scroll-story-page img[hidden]{display:none}.story-library-grid img{object-fit:contain}

/* A completed mobile book offers the library and home at its actual end. */
.reader-end-actions{display:none}
.scroll-reading .reader-end-actions{display:flex;flex:0 0 100%;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:8px}
.scroll-reading .reader-end-actions .quiet-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 16px;border:1px solid #806178;border-radius:8px;text-decoration:none;color:#f7dfbb;font-size:14px}
