:root {
  color-scheme: light;
  --paper: #fbf5e8;
  --surface: #fffcf4;
  --ink: #183b32;
  --body: #263931;
  --muted: #506558;
  --line: #dfd3b8;
  --leaf: #205646;
  --accent: #c5873c;
  --focus: #06579e;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
.sb-wrap { width: min(100% - 2.5rem, 72rem); margin-inline: auto; }
a { color: inherit; text-underline-offset: .18em; }
a:focus-visible, [data-page-heading]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
.sb-skip {
  position: fixed; z-index: 10; inset-block-start: .5rem; inset-inline-start: .5rem;
  border-radius: .4rem; padding: .7rem 1rem; background: #fff; transform: translateY(-150%);
}
.sb-skip:focus { transform: translateY(0); }
.sb-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0;
}
.sb-mast, .sb-reader-bar {
  background: #fffaf0; border-block-end: 1px solid var(--line);
}
.sb-mast-inner, .sb-reader-bar nav {
  display: flex; align-items: center; justify-content: space-between; gap: .7rem 1rem;
  min-height: 66px; padding-block: .35rem;
}
.sb-brand { display: inline-flex; align-items: center; min-width: 0; gap: .6rem; font-weight: 720; line-height: 1.2; text-decoration: none; }
.sb-brand img { flex: none; border-radius: .4rem; }
.sb-framework-link { flex: none; }
.sb-framework-link, .sb-reader-bar nav a {
  display: inline-flex; align-items: center; min-height: 44px; font-size: .91rem; font-weight: 700;
}
.sb-shelf {
  padding-block: clamp(2.2rem, 7vw, 5rem) clamp(3rem, 7vw, 5.8rem);
}
.sb-shelf-intro { max-width: 46rem; margin-block-end: clamp(1.9rem, 5vw, 3.4rem); }
.sb-shelf-intro p:first-child {
  font-size: .82rem; line-height: 1.4; margin: 0 0 .6rem; font-weight: 750;
  letter-spacing: .08em; text-transform: uppercase; color: var(--leaf);
}
.sb-shelf-intro h1, .sb-cover h1 {
  font: 700 clamp(2.35rem, 7.2vw, 5.1rem)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.037em;
  text-wrap: balance;
  margin: 0;
}
.sb-shelf-intro p:last-child {
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  line-height: 1.55; max-width: 35rem; color: var(--body); margin: 1.12rem 0 0;
}
.sb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.4rem), 1fr));
  gap: clamp(.8rem, 2.9vw, 1.9rem);
  margin: 0; padding: 0; list-style: none;
}
.sb-book { min-width: 0; }
.sb-book-link {
  display: flex; flex-direction: column; height: 100%; position: relative;
  border-radius: .28rem .8rem .8rem .28rem; overflow: hidden;
  text-decoration: none; background: var(--surface); color: var(--ink);
  border: 1px solid #dfd0ae; box-shadow: 0 2px 1px #422d2416, 0 8px 20px #502e1812;
}
.sb-book-link::before {
  position: absolute; content: ""; inset: 0 auto 0 0; z-index: 1; width: .32rem;
  background: #24715a6e; pointer-events: none;
}
.sb-book-link:focus-visible { outline-offset: 3px; }
@media (hover: hover) {
  .sb-book-link { transition: transform .18s ease, box-shadow .18s ease; }
  .sb-book-link:hover { transform: translateY(-3px); box-shadow: 0 10px 20px #502e1827; }
  .sb-book-link:hover h2 { text-decoration: underline; }
}
.sb-card-copy { flex: 1; padding: .78rem .8rem .96rem 1rem; }
.sb-card-copy h2 { font: 700 clamp(1.14rem, 2.3vw, 1.53rem)/1.14 Georgia, "Times New Roman", serif; margin: .35rem 0 0; }
.sb-place { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.4; font-weight: 720; overflow-wrap: anywhere; }
.sb-art { position: relative; width: 100%; overflow: hidden; background: #dfd8c3; }
.sb-art img {
  display: block; position: absolute; inset: 0 auto auto 0; width: 200%; max-width: none;
  height: 200%; max-height: none; user-select: none;
}
.sb-art-1 img { transform: translateX(-50%); }
.sb-art-2 img { transform: translateY(-50%); }
.sb-art-3 img { transform: translate(-50%, -50%); }
.sb-reader-bar .sb-wrap, .sb-reader { max-width: 53rem; }
.sb-reader-bar nav a { gap: .35rem; flex: none; }
.sb-reader-bar nav a span { font-size: 1.5em; line-height: .7; }
.sb-bar-title {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 700 1rem/1.2 Georgia, "Times New Roman", serif; color: var(--muted);
}
.sb-reader { padding-block: clamp(.8rem, 2.7vw, 1.5rem) 3rem; touch-action: pan-y pinch-zoom; }
.sb-sheet {
  background: var(--surface); border: 1px solid var(--line); border-radius: clamp(.65rem, 1.5vw, 1rem);
  box-shadow: 0 9px 24px #3f2b1712; margin-block-end: 1.1rem;
  overflow: hidden; scroll-margin-block-start: .8rem;
}
.sb-sheet[hidden] { display: none; }
.sb-reading { padding: clamp(1rem, 4vw, 2rem) clamp(1rem, 5.2vw, 3rem); }
.sb-cover h1 { font-size: clamp(2.1rem, 7vw, 4.4rem); margin-block: .45rem .76rem; }
.sb-summary, .sb-prose {
  max-width: 40rem; color: var(--body); font: 400 clamp(1.2rem, 3.7vw, 1.5rem)/1.52 Georgia, "Times New Roman", serif;
  overflow-wrap: anywhere;
}
.sb-summary, .sb-prose p { margin: 0; }
.sb-prose p + p { margin-block-start: .74em; }
.sb-controls {
  display: flex; align-items: center; justify-content: space-between; gap: .4rem .6rem; flex-wrap: wrap;
  margin-block-start: clamp(1.35rem, 4vw, 2.1rem);
}
.sb-cover .sb-controls { justify-content: flex-end; }
.sb-arrow {
  display: inline-flex; min-height: 46px; padding: .56rem .72rem;
  align-items: center; justify-content: center; gap: .32rem; border-radius: .6rem;
  border: 1px solid var(--leaf); color: var(--leaf); font-size: .91rem;
  font-weight: 750; text-decoration: none;
}
.sb-arrow span { font-size: 1.32em; line-height: .7; }
.sb-next { background: var(--leaf); color: white; }
.sb-arrow:hover { text-decoration: underline; }
.sb-page-number { color: var(--muted); font-size: .83rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sb-footer {
  border-block-start: 1px solid var(--line); color: var(--muted); font-size: .86rem; padding-block: 1.25rem 1.6rem;
}
.sb-footer nav { display: flex; flex-wrap: wrap; gap: .62rem 1rem; }
.sb-footer a { line-height: 1.6; }
.sb-footer p { margin-block-end: 0; }
@media (max-width: 600px) {
  .sb-wrap { width: calc(100% - 1.4rem); }
  .sb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sb-card-copy { padding: .68rem .55rem .8rem .73rem; }
  .sb-card-copy h2 { font-size: clamp(1.12rem, 4vw, 1.45rem); overflow-wrap: anywhere; }
  .sb-place { font-size: .72rem; }
}
@media (max-width: 350px) {
  .sb-bar-title { display: none; }
  .sb-shelf-intro h1 { font-size: clamp(2.15rem, 11vw, 2.4rem); }
  .sb-arrow { padding-inline: .59rem; font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
}
@media print {
  .sb-sheet[hidden] { display: block; break-before: page; }
  .sb-reader-bar, .sb-controls, .sb-footer { display: none; }
  .sb-sheet { box-shadow: none; break-inside: avoid; }
}

.sb-language[hidden], .sb-reader-settings[hidden], .sb-speech[hidden] { display: none; }
.sb-language { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; }
.sb-language select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--leaf); min-height: 44px; border-radius: .5rem; padding: .3rem .46rem; }
.sb-language-links { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.sb-reader-settings { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .3rem .5rem; max-width: 53rem; padding-block: .1rem .6rem; }
.sb-reader-settings summary { cursor: pointer; font-weight: 750; min-height: 44px; display: list-item; padding-block: .68rem; }
.sb-setting-buttons { display: flex; flex-wrap: wrap; gap: .4rem; padding-block-end: .4rem; }
.sb-reader-settings button { cursor: pointer; min-height: 44px; font: 700 .85rem/1.2 system-ui, sans-serif; border-radius: .45rem; border: 1px solid var(--leaf); padding: .5rem .62rem; color: var(--leaf); background: var(--surface); }
.sb-reader-settings button[aria-pressed=true] { color: var(--surface); background: var(--leaf); }
.sb-speech { white-space: nowrap; }
.sb-summary p { margin: 0; }
.sb-lesson h2 { font: 700 clamp(1.8rem, 5vw, 3rem)/1.1 Georgia, serif; margin: 0 0 .9rem; }
.sb-lesson h3 { font: 700 1.14rem/1.24 system-ui, sans-serif; margin: 1.15rem 0 .38rem; }
.sb-lesson a { overflow-wrap: anywhere; }
.sb-large .sb-prose, .sb-large .sb-summary { font-size: clamp(1.5rem, 4.3vw, 1.9rem); }
.sb-spaced .sb-prose, .sb-spaced .sb-summary { line-height: 1.85; letter-spacing: .028em; word-spacing: .08em; }
.sb-contrast { --paper:#fff; --surface:#fff; --ink:#08140e; --body:#08140e; --muted:#16251a; --line:#141414; --leaf:#111; }
.sb-contrast .sb-mast, .sb-contrast .sb-reader-bar { background:white; }
select:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
@media(max-width: 600px) {
 .sb-reader-bar nav, .sb-mast-inner { flex-wrap: wrap; }
 .sb-bar-title { display: none; }
 .sb-reader-bar nav a { white-space: normal; padding-inline-end: .15rem; }
 .sb-shelf-intro p:first-child { text-transform: none; letter-spacing: .045em; }
}
@media(max-width: 390px) {
 .sb-mast .sb-brand { flex-basis: 100%; }
 .sb-language { font-size: .75rem; }
 .sb-reader-bar nav a { flex: 1 1 7rem; font-size: .85rem; }
 .sb-arrow { padding-inline: .55rem; }
}
@media print {
 .sb-language, .sb-language-links, .sb-reader-settings { display: none !important; }
}

/* Edition 3: volume shelf and a separate, low-chrome reading mode. */
.sb-volume { margin-block: 1.8rem 3.4rem; scroll-margin-top: 1.2rem; }
.sb-volume > h2 { font: 700 clamp(1.55rem, 4vw, 2.45rem)/1.14 Georgia, serif; margin: 0 0 .95rem; }
.sb-book-link:hover h3 { text-decoration: underline; }
.sb-card-copy h3 { font: 700 clamp(1.14rem, 2.3vw, 1.53rem)/1.14 Georgia, serif; margin: .35rem 0 0; overflow-wrap: anywhere; }
.sb-volume-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-block: .9rem 1.4rem; }
.sb-volume-links a { display: inline-flex; align-items: center; min-height: 44px; border: 1px solid var(--leaf); border-radius: 99px; padding-inline: .84rem; font-weight: 700; font-size: .91rem; text-decoration: none; }
.sb-volume-links a:hover { text-decoration: underline; }

.sb-immersive { min-height: 100svh; background: var(--surface); }
.sb-immersive .sb-reader {
  width: 100%; max-width: none; margin: 0 auto; padding: 0 0 2rem;
}
.sb-immersive .sb-sheet {
  width: 100%; max-width: none; border: 0; border-radius: 0; box-shadow: none;
  overflow: clip; background: var(--surface); margin: 0;
}
.sb-immersive .sb-sheet[hidden] { display: none; }
.sb-immersive .sb-sheet + .sb-sheet { border-block-start: 1px solid var(--line); }
.sb-immersive .sb-art { max-width: none; margin-inline: auto; }
.sb-immersive .sb-reading {
  max-width: min(100%, 60rem); margin: 0 auto;
  padding: clamp(.95rem, 3vw, 2rem) clamp(.96rem, 5vw, 3rem) clamp(1rem, 3vw, 2.3rem);
}
.sb-immersive .sb-cover .sb-reading { max-width: min(100%, 62rem); }
.sb-immersive .sb-puzzle .sb-reading, .sb-immersive .sb-lesson .sb-reading { max-width: min(100%, 60rem); }
.sb-immersive .sb-puzzle h2 { font: 700 clamp(1.55rem, 4vw, 2.65rem)/1.13 Georgia, serif; margin: 0 0 .7rem; }
.sb-immersive .sb-lesson { padding-block-start: clamp(3.7rem, 10vw, 6.6rem); }
.sb-reveals {
  max-width: 40rem; margin-block: .75rem; display: flex; flex-wrap: wrap; align-items: flex-start; gap: .52rem;
}
.sb-reveals details {
  border: 1px solid var(--line); border-radius: .52rem; background: var(--surface); padding-inline: .7rem;
}
.sb-reveals summary {
  color: var(--ink); cursor: pointer; font-weight: 740; min-height: 44px; padding-block: .66rem;
}
.sb-reveals details[open] { flex: 1 1 100%; }
.sb-reveals details p { max-width: 39rem; color: var(--body); line-height: 1.58; margin: 0 0 .7rem; }

.sb-tools {
  display: flex; justify-content: space-between; align-items: flex-start; padding: .5rem .56rem;
  position: relative; z-index: 5; pointer-events: none;
}
.sb-tools > * { pointer-events: auto; }
.sb-exit, .sb-tools-menu > summary {
  min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  border: 1px solid #fff9; padding: .45rem .65rem; border-radius: 99px;
  background: #1a372ff2; color: #fff; font: 760 .87rem/1.1 system-ui, sans-serif;
  text-decoration: none; cursor: pointer;
}
.sb-tools-menu { max-width: min(19rem, 100vw - 1.1rem); }
.sb-tools-menu > summary { margin-inline-start: auto; display: flex; width: max-content; list-style: none; }
.sb-tools-menu > summary::-webkit-details-marker { display: none; }
.sb-tools-menu > summary span:first-child { font-size: 1.09rem; }
.sb-tool-popover {
  margin-block-start: .37rem; padding: .75rem; border: 1px solid var(--line); border-radius: .65rem;
  background: var(--surface); color: var(--ink); box-shadow: 0 .35rem 1.5rem #172a2540;
}
.sb-tool-popover .sb-reader-settings { width: 100%; padding: .35rem 0 0; }
.sb-tool-popover .sb-setting-buttons { padding: 0; }
.sb-tool-popover .sb-language { width: 100%; justify-content: space-between; }
.sb-tool-popover .sb-speech { margin-block-start: .12rem; }
.sb-tool-popover [data-speech-status]:not(.sb-visually-hidden) { font-size: .79rem; color: var(--muted); }
[data-immersive-active] .sb-tools {
  position: fixed; inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) auto env(safe-area-inset-left, 0px);
}
[data-immersive-active] .sb-immersive .sb-reader { padding-block-end: calc(6.5rem + env(safe-area-inset-bottom, 0px)); }
[data-immersive-active] .sb-immersive .sb-controls {
  position: fixed; z-index: 4; inset: auto 0 calc(.45rem + env(safe-area-inset-bottom, 0px));
  width: min(100% - 1.1rem, 31rem); margin: 0 auto; border-radius: .82rem;
  padding: .4rem .45rem; gap: .34rem .35rem; backdrop-filter: blur(8px);
  border: 1px solid var(--line); background: var(--surface); box-shadow: 0 .2rem 1.15rem #172a2529;
}
[data-immersive-active] .sb-immersive .sb-cover .sb-controls { justify-content: center; }
.sb-immersive .sb-controls .sb-arrow { min-height: 44px; }
.sb-immersive .sb-page-number { white-space: normal; text-align: center; line-height: 1.2; }
.sb-contrast .sb-tool-popover, .sb-contrast .sb-immersive .sb-controls { border-width: 2px; }
.sb-contrast .sb-exit, .sb-contrast .sb-tools-menu > summary { background: #111; border-color: #fff; }
@media (min-width: 700px) {
  /* Keep the full scene. On short/wide displays the image narrows instead of cropping. */
  .sb-immersive .sb-art { width: min(100%, calc(70svh * var(--sb-ratio, 1.5))); }
  .sb-immersive .sb-puzzle .sb-art { width: min(100%, calc(61svh * var(--sb-ratio, 1.5))); }
}
@media (max-width: 390px) {
  .sb-tools-menu { min-width: 44px; }
  [data-immersive-active] .sb-immersive .sb-controls { width: calc(100% - .6rem); }
  .sb-immersive .sb-controls .sb-arrow { padding-inline: .43rem; font-size: .83rem; }
  .sb-immersive .sb-page-number { font-size: .75rem; }
}
@media print {
  .sb-tools, [data-immersive-active] .sb-immersive .sb-controls { display: none !important; }
  .sb-immersive .sb-sheet[hidden] { display: block; }
}

.sb-choice-group {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; max-width: 46rem;
}
.sb-choice {
  min-height: 48px; padding: .6rem .76rem; border: 2px solid var(--leaf); border-radius: .52rem;
  background: var(--surface); color: var(--ink); font: 710 1rem/1.3 system-ui, sans-serif;
  text-align: start; cursor: pointer; overflow-wrap: anywhere;
}
.sb-choice:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sb-choice[data-result="right"] { background: var(--ink); color: var(--surface); }
.sb-choice[data-result="retry"] { border-style: dashed; }
.sb-choice-feedback { color: var(--ink); font-weight: 650; line-height: 1.42; max-width: 46rem; }
.sb-choice-feedback:empty { margin: 0; }
.sb-large .sb-choice { font-size: 1.28rem; }
.sb-spaced .sb-choice { line-height: 1.6; }
@media (max-width: 560px) {
  .sb-choice-group { grid-template-columns: 1fr; gap: .46rem; }
  .sb-has-choices .sb-art { width: min(100%, calc(33svh * var(--sb-ratio, 1.5))); }
  .sb-has-choices .sb-reading { padding-block-start: .75rem; }
}
@media (min-width: 700px) {
  .sb-immersive .sb-has-choices .sb-art { width: min(100%, calc(45svh * var(--sb-ratio, 1.5))); }
}

.sb-size-1200x800 { --sb-ratio: 1.5000000000; aspect-ratio: 1200 / 800; }
/* Larger default book type; graphic games do not change the shelf styling. */
.sb-immersive .sb-summary, .sb-immersive .sb-prose {
  font-size: clamp(1.4rem, calc(1.24rem + .85vw), 1.8rem);
  line-height: 1.54;
  max-width: 37ch;
}
.sb-large .sb-immersive .sb-summary, .sb-large .sb-immersive .sb-prose {
  font-size: clamp(1.65rem, calc(1.38rem + 1.6vw), 2.16rem);
}
.sb-spaced .sb-immersive .sb-prose, .sb-spaced .sb-immersive .sb-summary { line-height: 1.85; }
.sb-immersive .sb-choice { font-size: clamp(1.1rem,2.4vw,1.24rem); min-height: 48px; }
.sb-large .sb-immersive .sb-choice { font-size: 1.4rem; }
.sb-immersive .sb-choice-feedback { font-size: 1.1rem; }
.sb-immersive .sb-reveals { font-size: 1rem; }
.sb-game { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; max-width: 42rem; margin-block: 1rem .65rem; }
.sb-game > p { grid-column: 1 / -1; margin: 0; overflow-wrap: anywhere; }
.sb-game .sb-choice { text-align: start; }
.sb-game-instruction, .sb-arcade-score { color: var(--ink); font-size: 1rem; line-height: 1.45; }
.sb-blank { border-bottom: .14em solid currentColor; padding-inline: .2em; }
.sb-game-arcade { border: 3px solid var(--leaf); padding: clamp(.65rem,3vw,1.1rem); background: var(--surface); box-shadow: 4px 4px 0 var(--leaf); }
.sb-arcade-score { font-family: ui-monospace, "Courier New", monospace; font-weight: 700; }
.sb-arcade-card { color: var(--ink); background: var(--page, var(--surface)); border: 2px dashed var(--leaf); padding: .8rem; font-size: 1.2rem; line-height: 1.45; }
.sb-arcade-card:focus-visible, .sb-choice-feedback:focus-visible { outline: 3px solid var(--focus); }
.sb-immersive .sb-has-game .sb-marker {
  width: 46px; height: 46px; min-height: 46px; min-width: 46px;
  position: absolute; z-index: 2; transform: translate(-50%,-50%);
  border: 3px solid white; border-radius: 50%; padding: 0; text-align: center;
  background: #173d2d; color: white; box-shadow: 0 1px 4px #000a;
  font: 800 1.1rem/1 ui-monospace,monospace;
}
.sb-immersive .sb-has-game .sb-marker[data-result="right"] { background:#fff;color:#172d20;border-color:#172d20; }
.sb-immersive .sb-has-game .sb-marker[data-result="retry"] { border-style:dashed; }
.sb-immersive .sb-has-game .sb-marker:focus-visible { outline:3px solid white; outline-offset:2px; box-shadow:0 0 0 6px #111; }
.sb-immersive .sb-has-game[data-game-mode="find"] .sb-art { width: min(100%, calc(58svh * var(--sb-ratio, 1.5))); }
@media (max-width: 520px) {
  .sb-game { grid-template-columns: 1fr; }
}

/* The art itself can be narrow on a short landscape screen. Use the panel width. */
.sb-immersive .sb-has-game[data-game-mode="find"] .sb-art {
  container: sb-picture / inline-size;
}
.sb-immersive .sb-has-game .sb-marker { display: none; }
.sb-marker-reference {
  position: absolute; z-index: 2; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 27px; height: 27px;
  pointer-events: none; border: 2px solid #fff; border-radius: 50%;
  background: #173d2d; color: #fff; box-shadow: 0 1px 4px #000a;
  font: 800 .9rem/1 ui-monospace, monospace;
}
@container sb-picture (min-width: 371px) {
  .sb-immersive .sb-has-game .sb-marker { display: inline-grid; place-items: center; }
  .sb-marker-reference { display: none; }
}
