/* Tell Me Another, for kids. System fonts only: nothing is fetched from anywhere else. */
:root {
  --paper: #FFF6E5;
  --card: #FFFFFF;
  --ink: #2A2342;
  --soft: #5D5676;
  --line: #EAD9B8;
  --go: #C8421C;        /* white text on this is 4.9 to 1 */
  --go-ink: #FFFFFF;
  --a: #2F3FA3;         /* first choice: white on indigo, 8.6 to 1 */
  --a-ink: #FFFFFF;
  --b: #FFC94D;         /* second choice: ink on yellow, 10 to 1 */
  --b-ink: #2A2342;
  --note: #FFE9B8;
  --round: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", "Varela Round", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --read: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}
:root.night {
  --paper: #171C38;
  --card: #222A4F;
  --ink: #FBF3E0;
  --soft: #C2C0D8;
  --line: #36406E;
  --go: #FFC94D;
  --go-ink: #2A2342;
  --a: #8FA2FF;
  --a-ink: #141833;
  --b: #FFC94D;
  --b-ink: #2A2342;
  --note: #2C3566;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); transition: background-color 0.6s ease, color 0.6s ease; }
body { margin: 0; font-family: var(--round); font-size: 1.125rem; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--card); color: var(--ink); padding: 10px 14px; border-radius: 12px; z-index: 5; }
.sky { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.8s ease; z-index: 0;
  background-image: radial-gradient(circle, #FBF3E0 0 1px, transparent 1.6px), radial-gradient(circle, #FBF3E0 0 1.3px, transparent 2px), radial-gradient(circle, #C9D2FF 0 1px, transparent 1.6px);
  background-size: 190px 170px, 310px 260px, 250px 330px; background-position: 20px 30px, 120px 90px, 60px 200px; }
:root.night .sky { opacity: 0.5; }
.top, main, .foot { position: relative; z-index: 1; width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 20px; }
.top { padding-top: 18px; padding-bottom: 6px; }
.mark { display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap; color: var(--ink); text-decoration: none; }
.mark-name { font-family: var(--read); font-style: italic; font-size: 1.75rem; line-height: 1.1; }
.mark-name i { color: var(--go); font-style: italic; }
.mark-kids { font-weight: 800; font-size: 0.9375rem; letter-spacing: 0.04em; background: var(--b); color: var(--b-ink); padding: 3px 12px; border-radius: 999px; }
main { flex: 1; padding-top: 10px; padding-bottom: 40px; outline: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 4px solid var(--a); outline-offset: 3px; }
:root.night a:focus-visible, :root.night button:focus-visible { outline-color: var(--b); }

/* ----- the shelf ----- */
.hello h1 { font-size: clamp(2.25rem, 7vw, 3.5rem); line-height: 1.05; margin: 18px 0 8px; font-weight: 800; }
.hello p { margin: 0 0 24px; font-size: 1.25rem; color: var(--soft); max-width: 34rem; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 22px; }
.book { display: flex; flex-direction: column; background: var(--card); color: var(--ink); text-decoration: none; border-radius: 26px; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 7px 0 var(--ink); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.book:hover { transform: translateY(-3px); box-shadow: 0 10px 0 var(--ink); }
.book:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.book-cover { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--ground, #3F6B4F); }
.book-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 20px; }
.book-title { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.book-meta { color: var(--soft); font-size: 1.0625rem; }
.book-going { align-self: flex-start; background: var(--b); color: var(--b-ink); font-weight: 700; font-size: 0.9375rem; padding: 4px 12px; border-radius: 999px; }

/* ----- buttons ----- */
.big, .small, .choice { font-family: var(--round); cursor: pointer; text-decoration: none; text-align: center; display: block; width: 100%; }
.big { background: var(--go); color: var(--go-ink); font-size: 1.5rem; font-weight: 800; line-height: 1.2; padding: 18px 26px; min-height: 68px; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.big:active, .choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.small { background: none; border: 0; color: var(--ink); font-size: 1.125rem; font-weight: 700; padding: 14px; min-height: 52px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
:root.night .big, :root.night .choice { border-color: #0B0E22; box-shadow: 0 6px 0 #0B0E22; }
.back { display: inline-block; color: var(--soft); font-weight: 700; font-size: 1.0625rem; text-decoration: none; padding: 10px 0; min-height: 44px; }
.back:hover { color: var(--ink); text-decoration: underline; }

/* ----- a story's front page ----- */
.story { display: grid; gap: 24px; margin-top: 10px; }
.story-cover { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 26px; border: 3px solid var(--ink); box-shadow: 0 7px 0 var(--ink); }
.story h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.08; margin: 0 0 6px; font-weight: 800; }
.byline { margin: 0 0 14px; color: var(--soft); font-weight: 700; }
.hook { font-family: var(--read); font-size: 1.375rem; line-height: 1.5; margin: 0 0 22px; }
.go { display: grid; gap: 6px; max-width: 26rem; }
.chapters { list-style: none; margin: 26px 0 6px; padding: 0; display: grid; gap: 10px; max-width: 30rem; }
.chapters li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.ch-label { grid-row: span 2; align-self: center; font-weight: 800; background: var(--note); border-radius: 999px; padding: 4px 12px; font-size: 0.9375rem; }
.ch-title { font-weight: 800; font-size: 1.1875rem; line-height: 1.2; }
.ch-len { color: var(--soft); font-size: 1rem; }
.chapters li.done .ch-len { font-weight: 800; color: var(--ink); }
@media (min-width: 52rem) { .story { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ----- reading ----- */
.page { max-width: 40rem; margin: 0 auto; }
.where { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 6px; color: var(--soft); font-weight: 700; font-size: 1.0625rem; }
.plate { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 22px; border: 3px solid var(--ink); margin: 6px 0 18px; background: var(--line); }
:root.night .plate { border-color: #0B0E22; }
.plate.small { max-width: 22rem; margin: 22px auto 10px; }
.stamp { margin: 0 0 10px; font-weight: 800; font-size: 0.9375rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
.prose { font-family: var(--read); font-size: clamp(1.3125rem, 2.6vw + 0.8rem, 1.5rem); line-height: 1.62; margin: 0 0 0.9em; }
.cost { background: var(--note); border-radius: 18px; padding: 14px 18px; margin: 0 0 16px; font-weight: 700; font-size: 1.125rem; border-left: 8px solid var(--b); }
.act { display: grid; gap: 16px; margin-top: 30px; }
.ask { font-size: 1.625rem; line-height: 1.2; font-weight: 800; margin: 0 0 2px; text-align: center; }
.choice { font-size: 1.3125rem; font-weight: 800; line-height: 1.3; padding: 20px 22px; min-height: 76px; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.choice.a { background: var(--a); color: var(--a-ink); }
.choice.b { background: var(--b); color: var(--b-ink); }
.page > * { animation: rise 0.4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ----- the end of a chapter ----- */
.end h1 { font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.1; margin: 0 0 18px; font-weight: 800; }
.keep { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 16px 20px; margin: 0 0 14px; }
.keep h2 { margin: 0 0 8px; font-size: 1.0625rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }
.keep ul { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-family: var(--read); font-size: 1.25rem; line-height: 1.45; }
.closing { font-family: var(--read); font-style: italic; font-size: 1.5rem; text-align: center; margin: 26px 0 0; }
.next-up { text-align: center; font-weight: 700; margin: 0; }
.grown { margin-top: 44px; border-top: 2px solid var(--line); padding-top: 14px; color: var(--soft); font-size: 1rem; }
.grown summary { cursor: pointer; font-weight: 700; padding: 8px 0; min-height: 44px; }
.grown h3 { margin: 16px 0 4px; font-size: 1.0625rem; color: var(--ink); }
.grown p { margin: 0 0 6px; }
.grown .chose { font-style: italic; }

/* ----- plain pages ----- */
.plainpage { font-size: 1.125rem; }
.plainpage h1 { font-size: 2.25rem; line-height: 1.1; margin: 16px 0 12px; }
.plainpage h2 { font-size: 1.375rem; margin: 28px 0 8px; }
.plainpage p, .plainpage li { font-family: var(--read); line-height: 1.6; }
.plainpage ul { padding-left: 1.2em; display: grid; gap: 8px; }
.plainpage .note { color: var(--soft); }
.plain-note { padding: 40px 0; }

.foot { padding-top: 16px; padding-bottom: 22px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; color: var(--soft); font-size: 0.9375rem; border-top: 2px solid var(--line); }
.foot a { color: var(--ink); font-weight: 700; padding: 8px 0; }

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