*{box-sizing:border-box}html{background:#f4f0e7;color:#36533e;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif}body{margin:0;min-width:280px}button,input{font:inherit}button{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}button:focus-visible,a:focus-visible{outline:3px solid #d9a03e;outline-offset:3px}[hidden]{display:none!important}.toolbar{position:fixed;inset:0 0 auto;z-index:3;display:flex;justify-content:space-between;align-items:center;padding:calc(10px + env(safe-area-inset-top)) 18px 10px;background:#f4f0e7ed;backdrop-filter:blur(12px)}.icon-button{width:48px;height:48px;display:grid;place-items:center;border:0;border-radius:16px;background:#e5eadc;color:#476647;font-size:29px}.icon-button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8}#show-chinese{min-height:44px;padding:0 18px;border:1px solid #cdd6c6;background:transparent;border-radius:24px;color:#53694e;font-size:15px}#show-chinese[aria-pressed=true]{background:#dae5cf;border-color:#76916c}.reader{padding:calc(82px + env(safe-area-inset-top)) 16px calc(126px + env(safe-area-inset-bottom));min-height:100svh;display:flex;flex-direction:column;justify-content:center;align-items:center}.book{width:min(100%,760px)}.page{overflow:hidden;border-radius:24px;background:#fffdf6;box-shadow:0 6px 30px #4d492318;touch-action:pan-y pinch-zoom}.art{aspect-ratio:1;background-size:300% 300%;background-repeat:no-repeat;width:100%}.speech-area{display:flex;flex-direction:column;gap:10px;padding:14px}.speech{min-width:0}.read-line{display:block;width:100%;min-height:48px;border:1.5px dashed #8ca27c;border-radius:16px;background:#f7f9ed;color:#263f32;padding:11px 14px;text-align:left;font-size:clamp(19px,5.2vw,25px);line-height:1.35;overflow-wrap:break-word}.translation{margin-top:6px;background:#fff6df;border-color:#c9b789;color:#745e37;font-size:17px;line-height:1.5}.playing{background:#ffedaa;border-style:solid;box-shadow:0 0 0 2px #dca943}.loading{opacity:.65}.words .speech-area{display:grid;grid-template-columns:1fr 1fr}.words .read-line{text-align:center}.words .english{font-size:23px;min-height:64px;display:grid;place-items:center}.words .art{max-height:240px;aspect-ratio:1;background-size:300% 300%}.words{max-width:480px;margin:auto}.words .art{width:240px;margin:auto}#navigation{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,600px);padding:10px 18px max(16px,env(safe-area-inset-bottom));display:flex;align-items:center;justify-content:space-between;gap:10px;background:#f4f0e7f5;border-radius:24px 24px 0 0;z-index:2}.arrow{width:60px;height:60px;flex-shrink:0;border:0;border-radius:20px;background:#dae5cf;color:#3c6542;font-size:32px}.arrow:disabled{opacity:.25}.page-progress{min-width:0;text-align:center;max-width:260px}#choose-page{min-height:44px;padding:5px 10px;border:0;border-radius:12px;background:transparent;color:#385b3d;font-weight:650;font-size:18px}#scene-dots{display:flex;overflow-x:auto;max-width:100%;scrollbar-width:none;min-height:24px}#scene-dots button{flex:0 0 24px;height:24px;border:0;background:transparent;display:grid;place-items:center}#scene-dots i{width:6px;height:6px;background:#c6cdbb;border-radius:50%}#scene-dots [aria-current=true] i{width:9px;height:9px;background:#56774d}#scene-dots:has(button:only-child){justify-content:center}#shelf{max-width:850px;padding:96px 20px 40px;margin:auto}h1{font-size:28px;margin:12px 0 8px}.subtitle{color:#8a947e;font-size:14px;margin:0 0 22px}.continue{background:#466b49;color:white;padding:17px 22px;border:0;border-radius:16px;font-size:17px;margin-bottom:24px}.card-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.card{overflow:hidden;padding:0 0 16px;background:#fffdf8;border:2px solid transparent;border-radius:18px;text-align:left;color:#36533e;min-width:0}.card[aria-current=true]{border-color:#789969}.thumbnail{display:block;width:100%;aspect-ratio:1;background-size:300% 300%;background-repeat:no-repeat}.card strong{display:block;font-size:19px;margin:13px 12px 6px}.card small{display:block;margin:0 12px;color:#7c8972;font-size:12px}dialog{border:0;border-radius:24px;padding:22px;width:min(94vw,620px);max-height:85svh;background:#f4f0e7;color:#36533e;box-shadow:0 20px 80px #0003}dialog::backdrop{background:#26392577}.dialog-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;gap:12px}h2{font-size:22px;margin:0}.jump{display:flex;gap:10px;align-items:center;margin-bottom:16px}.jump input{width:90px;min-height:46px;border:1px solid #cad2bd;border-radius:12px;padding:8px;color:#36533e;background:#fffdf8}.jump button{min-height:46px;border:0;border-radius:12px;padding:8px 16px;color:#fff;background:#56774d}#jump-error{font-size:14px;color:#995a3a}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}#error{padding:12px 18px;border-radius:16px;background:#fff2df;color:#834d35;max-width:90vw;font-size:14px;text-align:center}details{margin:30px 0 20px;color:#78846d;font-size:14px;line-height:1.8}summary{cursor:pointer;padding:12px 0}a{color:#466b49}.legacy-link{display:inline-block;padding:12px 0;font-size:14px}@media(min-width:650px){.page:not(.words){display:grid;grid-template-columns:1fr 1fr;align-items:center}.speech-area{padding:20px}.card-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.read-line{font-size:23px}}@media(max-width:360px){.reader{padding-left:10px;padding-right:10px}.read-line{font-size:19px}.words .english{font-size:20px}.speech-area{padding:10px;gap:8px}.page-progress{max-width:180px}}

@media(max-width:649px){.bilingual .page .art{width:min(100%,220px);margin:auto}.bilingual .speech-area{gap:8px}.bilingual .read-line{padding:8px 12px}.bilingual .translation{margin-top:4px}}

/* Portrait comics: balloons live in illustrated sky/wall space above the cast. */
.page.comic{display:block;position:relative;max-width:620px;margin:auto;isolation:isolate;background:#f6f1df}
.comic .art,.bilingual .page.comic .art{position:absolute;inset:auto 0;top:var(--art-top,0px);left:var(--art-left,0px);transform:none;width:var(--art-width,100%);height:var(--art-height,133vw);max-height:none;margin:0;aspect-ratio:3/4;mask-image:var(--art-mask,none)}
.comic-bubble{position:absolute;left:var(--bubble-left);max-width:var(--bubble-width);width:max-content;top:12px;padding:5px;background:#fffef9;border:1.5px solid #78816b;border-radius:22px;box-shadow:0 2px 3px #3745270d}
.comic-bubble::after{content:"";position:absolute;left:var(--tail);bottom:-16px;width:17px;height:18px;background:#fffef9;clip-path:polygon(0 0,100% 0,30% 100%);filter:drop-shadow(0 1px 0 #78816b)}
.comic-bubble.caption{border-radius:12px;background:#fff9e9}
.comic-bubble.caption::after{display:none}
.comic .read-line,.bilingual .comic .read-line{font-size:clamp(18px,4.8vw,25px);line-height:1.22;min-height:36px;padding:4px 6px;background:transparent;border:1px dashed #a5b195;border-radius:15px}
.comic .read-line+.english{margin-top:4px}
.comic .translation,.bilingual .comic .translation{font-size:clamp(14px,3.8vw,19px);line-height:1.3;min-height:28px;margin-top:3px;padding:3px 6px;color:#77613e;border-color:#d3c5a2}
.comic .playing{background:#ffedaa;border-style:solid}
@media(max-width:649px){
 html,body{background:#f6f1df}
 .reader{padding:calc(64px + env(safe-area-inset-top)) 0 calc(94px + env(safe-area-inset-bottom));min-height:0;justify-content:flex-start}
 .book{width:100%}
 .page.comic{border-radius:0;box-shadow:none;max-width:none}
 .toolbar{padding:calc(6px + env(safe-area-inset-top)) 12px 6px;background:#f6f1dff5}
 .icon-button{width:44px;height:44px}
 #navigation{padding:6px 12px max(8px,env(safe-area-inset-bottom));border-radius:0;background:#f6f1dff5}
 .arrow{width:52px;height:52px;border-radius:17px}
}

/* Vocabulary uses the same bounded illustration as dialogue, with words inside it. */
.page.vocabulary .speech-area{position:absolute;left:4%;right:4%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:0;z-index:1}
.vocabulary .speech{padding:5px;background:#fffef8f5;border:1px solid #8b977b;border-radius:20px;box-shadow:0 2px 4px #37452712}
.vocabulary .read-line,.bilingual .vocabulary .read-line{text-align:center;min-height:40px;font-size:clamp(18px,5vw,25px);padding:5px 6px}
.vocabulary .translation,.bilingual .vocabulary .translation{font-size:clamp(14px,3.8vw,19px);min-height:28px;padding:3px 5px}
.vocabulary .speech-area:has(.speech:only-child){grid-template-columns:minmax(0,1fr);left:20%;right:20%}

.comic-bubble::after{height:var(--tail-height,18px);bottom:calc(-1 * var(--tail-height,18px) + 2px)}

.comic-bubble:has(.anchor-tail)::after{display:none}.anchor-tail{position:absolute;left:0;top:calc(100% - 1px);width:100%;overflow:visible;pointer-events:none}

.state-words .comic-bubble{padding:4px}.state-words .read-line,.bilingual .state-words .read-line{padding:4px;font-size:18px}.state-words .translation,.bilingual .state-words .translation{font-size:14px}

.family-labels .comic-bubble{padding:4px}.family-labels .read-line,.bilingual .family-labels .read-line{font-size:clamp(16px,4.4vw,23px);padding:4px}.family-labels .translation,.bilingual .family-labels .translation{font-size:14px}

.family-labels .read-line,.bilingual .family-labels .read-line{min-height:32px;padding:3px}.family-labels .translation,.bilingual .family-labels .translation{font-size:13px;min-height:23px;padding:2px}

/* Cover cards use an undistorted 3:4 crop contained within each atlas panel. */
.thumbnail{aspect-ratio:3/4}

.shelf-translation{display:block;margin-top:4px;font-size:.85em;font-weight:400;line-height:1.4}.card strong{overflow-wrap:break-word;line-height:1.3}

.unit-title{position:absolute;z-index:2;top:12px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 24px);text-align:center}.unit-title .read-line,.bilingual .unit-title .read-line{min-height:44px;text-align:center;font-size:clamp(23px,6vw,30px);font-weight:700;padding:6px 16px;background:#fffdf2ed;line-height:1.25}.unit-title .translation,.bilingual .unit-title .translation{font-size:18px;min-height:36px;font-weight:400}

.action-words .read-line,.bilingual .action-words .read-line{font-size:18px;min-height:32px;padding:3px 6px}.action-words .translation,.bilingual .action-words .translation{font-size:14px;min-height:24px;padding:2px 5px}
.action-words .comic-bubble{padding:4px}.action-words .read-line,.bilingual .action-words .read-line{line-height:1.2}
.page.comic.action-words .read-line{font-size:18px;min-height:26px;padding:2px 5px;line-height:1.2}.page.comic.action-words .translation{font-size:14px;min-height:20px;margin-top:2px}

/* Explicit dimensions prevent image layout shifts while lazy thumbnails load. */
img.thumbnail{height:auto;object-fit:cover;background:#e5eadc}

.mode-switch{display:flex;gap:4px;padding:4px;border-radius:18px;background:#e5eadc;width:max-content;margin:0 0 20px}.mode-switch button{border:0;border-radius:14px;padding:12px 20px;min-height:48px;background:transparent;color:#466b49}.mode-switch [aria-pressed=true]{background:#466b49;color:white}.mode-switch button:disabled{opacity:.6}
.page.textbook{display:block;width:100%;background:white;height:auto!important;border-radius:12px}.textbook-sheet{position:relative;width:100%}.textbook-image{display:block;width:100%;height:auto}.textbook-hotspot{position:absolute;border:1px dashed #648d5880;border-radius:4px;background:transparent;padding:0;min-width:12px;min-height:12px;cursor:pointer}.textbook-hotspot.playing{background:#ffdb6066;border-color:#bf8f27}.textbook-hotspot.loading{background:#e0ebd799}.textbook-translations{padding:0 12px}.textbook-translations:has(.translation:not([hidden])),.textbook-translations:has(.english){padding:12px}.textbook-translations .read-line{margin:6px 0}.textbook-translations small{display:block;color:#54704e;font-size:14px;margin-bottom:4px}img.textbook-thumbnail{object-fit:contain;background:white;aspect-ratio:3/4}
