:root {
  color-scheme: light;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  color: #26312d;
  background: #e9e4d8;
}

* { box-sizing: border-box; }
html, body { height: var(--frame-h, 100dvh); overflow: hidden; }
body { margin: 0; background: radial-gradient(circle at top, #f8f4eb, #ddd6c7); }
button { font: inherit; cursor: pointer; }
.book-app { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; width: min(2100px, 100%); height: var(--frame-h, 100dvh); max-height: var(--frame-h, 100dvh); margin: 0 auto; padding: 10px 16px 12px; overflow: hidden; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 6px; color: #9b6547; font: 700 11px/1.2 system-ui, sans-serif; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(22px, 3.2vw, 36px); font-weight: 500; }
.page-indicator { color: #6c756e; font: 600 14px system-ui, sans-serif; }
.book-shell { display: grid; grid-template-columns: 54px minmax(0, 1fr) 54px; align-items: stretch; gap: 12px; min-height: 0; }
.page { display: flex; flex-direction: column; min-height: 0; height: 100%; padding: clamp(14px, 1.6vw, 24px); overflow: auto; border: 1px solid #d1c5ae; border-radius: 4px; background: #fffdf7; box-shadow: 0 20px 55px #6f604026; }
.page:has(.storybook-reading-layout) { overflow: hidden; }
.page h2 { flex: none; margin: 0 0 12px; font-size: clamp(20px, 2.6vw, 32px); font-weight: 500; }
.lesson-kicker { flex: none; margin-bottom: 6px; color: #9b6547; font: 700 11px/1.2 system-ui, sans-serif; letter-spacing: .18em; }
.lesson-illustration-stage { position: relative; flex: 0 0 auto; width: fit-content; max-width: 100%; margin: 0 auto 10px; overflow: hidden; border-radius: 18px; box-shadow: 0 10px 25px #6f60401f; }
.lesson-illustration { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(var(--frame-h, 100dvh) - 16rem); margin: 0; object-fit: contain; }
.photo-stage { box-shadow: 0 10px 25px #6f60401f; }
.storybook-reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: clamp(16px, 2vw, 32px); align-items: stretch; flex: 1 1 auto; min-height: 0; }
.storybook-reading-layout .photo-stage { display: flex; align-items: center; justify-content: center; width: 100%; max-width: none; height: 100%; min-height: 0; margin: 0; background: #f4efe4; }
.storybook-reading-layout .lesson-illustration { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
.storybook-text-column { min-width: 0; min-height: 0; overflow: auto; }
.storybook-text-column .lesson-section { margin-top: 18px; }
.storybook-text-column .dialogue-bubble { max-width: 100%; font-size: clamp(17px, 1.65vw, 23px); line-height: 1.45; }
.illustration-hotspot { position: absolute; z-index: 2; padding: 0; border: 3px solid transparent; border-radius: 18px; background: transparent; appearance: none; }
.illustration-hotspot:hover, .illustration-hotspot:focus-visible { border-color: #ff9f43cc; background: #fff4c933; outline: none; }
.lesson-section { margin-top: 28px; }
.lesson-section h3 { margin: 0 0 14px; color: #617263; font: 700 13px/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.word-grid, .phonics-grid, .letter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.word-card, .phonics-card, .letter-card { min-height: 82px; padding: 12px; border: 1px solid #ded3c2; border-radius: 12px; background: #fffaf1; color: #293c32; text-align: left; transition: transform .15s, background .15s; }
.word-card:hover, .phonics-card:hover, .letter-card:hover, .dialogue-bubble:hover { transform: translateY(-2px); background: #f8ead9; }
.word-card strong, .phonics-card strong { display: block; font-size: 23px; font-weight: 500; }
.word-card span, .phonics-card span { display: block; margin-top: 6px; color: #8b8173; font: 14px system-ui, sans-serif; }
.phonics-card { background: #f1f5ee; }
.phonics-card strong { color: #496454; }
.letter-card { min-height: 64px; color: #9b6547; font-size: 25px; text-align: center; }
.dialogue-list { display: flex; flex-direction: column; gap: 14px; }
.dialogue-bubble { max-width: 82%; padding: 15px 18px; border: 0; border-radius: 18px; color: #263c31; background: #f1f5ee; font-size: clamp(19px, 3vw, 26px); text-align: left; transition: transform .15s, background .15s; }
.dialogue-bubble.right { align-self: flex-end; color: #754b37; background: #f8e4d3; }
.translation-list { display: grid; gap: 10px; }
.translation-item { display: flex; width: 100%; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 0; border-left: 3px solid #d8b48f; border-radius: 8px; color: #5e665f; background: #faf5eb; font: 16px/1.7 system-ui, sans-serif; text-align: left; transition: background .15s, transform .15s; }
.translation-item:hover { background: #f5e9d9; transform: translateY(-1px); }
.example-row { display: grid; gap: 7px; }
.example-row .dialogue-bubble { max-width: 100%; padding: 11px 14px; font-size: clamp(16px, 1.4vw, 20px); }
.example-row .translation-item { font-size: 15px; }
.translation-index { flex: 0 0 24px; color: #9b6547; font-weight: 700; }
.image-stage { position: relative; width: 100%; margin: 0 auto 26px; overflow: hidden; }
.page-image { display: block; width: 100%; height: auto; max-height: none; object-fit: contain; margin: 0 auto; border-radius: 3px; }
.image-hotspot { position: absolute; z-index: 2; padding: 0; border: 2px solid transparent; border-radius: 12px; background: transparent; appearance: none; pointer-events: auto; }
.image-hotspot:hover, .image-hotspot:focus-visible { border-color: #c77b4d99; background: #fff5df44; outline: none; }
.page-note { color: #7a817b; font: 14px/1.7 system-ui, sans-serif; }
.line { display: block; width: fit-content; max-width: 100%; margin: 14px 0; padding: 8px 12px; border-radius: 8px; color: #243b31; background: #f2f5ee; font-size: clamp(19px, 3vw, 28px); line-height: 1.5; text-align: left; }
.line:hover, .word:hover { background: #f4e6d5; }
.word { display: inline-block; margin: 5px 6px 5px 0; padding: 5px 9px; border: 1px solid #d8c4ac; border-radius: 5px; color: #9b5d3d; background: #fff8ed; cursor: pointer; font-size: 20px; }
.translation { display: block; margin: -7px 0 12px 14px; color: #81857c; font: 15px/1.6 system-ui, sans-serif; }
.nav-button { width: 54px; height: 80px; border: 0; border-radius: 12px; color: #8f5e45; background: #fffdf7aa; font-size: 48px; }
.nav-button:disabled { opacity: .3; cursor: default; }
.controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.controls button { border: 1px solid #c9bda9; border-radius: 999px; padding: 11px 20px; }
.primary-button { color: #fffaf1; background: #9b6547; }
.secondary-button { color: #5e675f; background: #fffdf7; }
.contents-panel { position: fixed; inset: 0 auto 0 0; width: min(360px, 90vw); padding: 28px; overflow: auto; background: #fffdf7; box-shadow: 8px 0 35px #54483233; z-index: 3; }
.progress-panel { left: auto; right: 0; box-shadow: -8px 0 35px #54483233; }
.contents-header { display: flex; justify-content: space-between; align-items: center; }
.contents-header h2 { margin: 0 0 22px; font-weight: 500; }
.contents-header button { border: 0; background: none; font-size: 30px; }
.contents-item { display: block; width: 100%; padding: 13px 0; border: 0; border-bottom: 1px solid #e5ddcf; color: #4d6658; background: transparent; text-align: left; }
.progress-summary, .empty-progress { color: #7a817b; font: 14px/1.6 system-ui, sans-serif; }
.progress-item { display: grid; gap: 6px; padding: 15px 0; border-bottom: 1px solid #e5ddcf; }
.progress-item strong { color: #4d6658; font-size: 17px; }
.progress-item span { color: #7a817b; font: 13px/1.5 system-ui, sans-serif; }
.progress-item button, .clear-progress-button { width: fit-content; padding: 7px 11px; border: 1px solid #d8c4ac; border-radius: 999px; color: #8f5e45; background: #fff8ed; font: 13px system-ui, sans-serif; }
.clear-progress-button { margin-top: 24px; color: #8a5b54; background: #fffdf7; }
@media (max-width: 850px) {
  .storybook-reading-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .storybook-reading-layout .photo-stage { height: min(48dvh, 100%); }
  .storybook-reading-layout .lesson-illustration { max-height: calc(var(--frame-h, 100dvh) * 0.48); }
  .storybook-text-column { max-height: calc(var(--frame-h, 100dvh) * 0.38); }
}
@media (max-width: 650px) { .book-app { padding: 10px 8px 12px; } .book-shell { grid-template-columns: 32px minmax(0, 1fr) 32px; gap: 5px; } .page { padding: 14px 12px; } .nav-button { width: 32px; font-size: 36px; } }
