:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #25352e;
  background: #f6f2e9;
  --green: #315a46;
  --ink: #25352e;
  --muted: #737d75;
  --paper: #fffdf8;
  --line: #e8e2d5;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #b3c9a8; outline-offset: 2px; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px max(5vw, 22px); border-bottom: 1px solid var(--line); background: #f6f2e9; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -.3px; white-space: nowrap; }
.brand em { color: var(--green); font-family: var(--serif); font-weight: 500; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font: 20px var(--serif); }
.main-nav { display: flex; gap: 6px; align-items: center; }
.main-nav button { border: 0; border-radius: 20px; padding: 9px 12px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.main-nav button[aria-current="page"] { background: #e8ece3; color: var(--green); font-weight: 700; }
.profile-picker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.profile-picker select, .rate-picker select { color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 9px 11px; }
main { max-width: 1100px; margin: 0 auto; padding: 52px 28px 80px; }
.welcome { max-width: 900px; margin: 0 auto; }
.eyebrow, .card-kicker { color: #9b7550; font-size: 10px; font-weight: 700; letter-spacing: 1.6px; }
.welcome h1, .reader-title { margin: 16px 0; font: 600 clamp(42px, 6vw, 64px)/1.05 var(--serif); letter-spacing: -1.4px; }
.welcome h1 span { color: var(--green); }
.welcome > p { max-width: 480px; margin: 0 0 46px; color: var(--muted); line-height: 1.7; }
.library-heading { display: flex; align-items: end; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.library-heading h2, .add-book-panel h2 { margin: 7px 0 0; font: 600 25px var(--serif); }
.muted { color: var(--muted); font-size: 12px; }
.book-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-top: 20px; }
.book-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.book-open { display: flex; align-items: flex-start; gap: 15px; padding: 18px; }
.cover { width: 66px; height: 94px; flex: 0 0 66px; display: grid; place-items: center; border-radius: 7px; background: linear-gradient(145deg, #839179, #526a53); box-shadow: inset -7px 0 #ffffff17; color: white; font: 28px var(--serif); }
.cover svg { width: 100%; height: 100%; border-radius: inherit; }
.cover-mercado { background: linear-gradient(145deg, #d29265, #9d6049); }
.cover-isla { background: linear-gradient(145deg, #708da0, #405d70); }
.book-info { min-width: 0; flex: 1; }
.book-info h3 { margin: 0 0 4px; font: 600 18px var(--serif); }
.book-title-button { padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; }
.book-title-button:hover h3 { color: var(--green); }
.english-title { color: #7d827c; font: italic 12px var(--serif); }
.book-info p { margin: 9px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.book-meta { display: block; margin-top: 5px; color: #858a82; font-size: 11px; }
.progress-track { height: 5px; overflow: hidden; margin-top: 12px; border-radius: 8px; background: #ece9df; }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: #67846c; }
.book-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.text-button { border: 0; padding: 4px 0; background: none; color: var(--green); font-size: 12px; font-weight: 700; cursor: pointer; text-align: left; }
.expand-button { width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--green); font-size: 18px; cursor: pointer; }
.chapter-list { padding: 7px 18px 12px; border-top: 1px solid var(--line); }
.chapter-link { display: flex; justify-content: space-between; width: 100%; padding: 10px 2px; border: 0; background: none; color: #536459; font-size: 12px; cursor: pointer; text-align: left; }
.chapter-link:hover { color: var(--green); }
.add-book-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: #eeece3; }
.add-book-panel p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.add-book-panel a { color: var(--green); }
.add-book-panel form { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; font-size: 12px; }
.add-book-panel input { max-width: 100%; }
#add-book-result { color: var(--green); font-size: 12px; }
.reader-view, .dashboard-view { max-width: 840px; margin: 0 auto; }
.back-button { padding: 0; border: 0; background: none; color: var(--green); font-size: 13px; font-weight: 700; cursor: pointer; }
.reader-head { margin: 31px 0 20px; }
.reader-head .eyebrow { margin-bottom: 9px; }
.reader-title { margin: 0 0 7px; font-size: clamp(34px, 5vw, 52px); }
.reader-title-en { color: #7d827c; font: italic 16px var(--serif); letter-spacing: 0; }
.reader-subtitle { color: var(--muted); font-size: 13px; }
.chapter-illustration { margin: 20px 0 25px; overflow: hidden; border-radius: 14px; background: #283943; }
.chapter-illustration svg { display: block; width: 100%; height: auto; max-height: 255px; }
.chapter-illustration figcaption { padding: 9px 13px; color: #e3e1d8; font-size: 11px; }
.reader-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0; padding: 13px 0; border-block: 1px solid var(--line); }
.tool-button, .chapter-select, .rate-picker select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.tool-button:hover { border-color: #b5c5b3; }
.tool-button:disabled { opacity: .5; cursor: default; }
.rate-picker { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.rate-picker select { padding: 8px; }
.chapter-select { margin-left: auto; max-width: 260px; }
.reader-progress { color: var(--muted); font-size: 11px; }
.chapter-title { margin: 31px 0 18px; font: 600 27px var(--serif); }
.story-page { margin: 12px 0; padding: 22px 27px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: #354139; font: 20px/1.75 var(--serif); }
.sentence-block + .sentence-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid #efebe2; }
.story-sentence { margin: 0; }
.word-wrap { white-space: nowrap; }
.word { appearance: none; display: inline; margin: 0; padding: 0 1px; border: 0; border-radius: 3px; background: none; color: inherit; font: inherit; cursor: pointer; }
.word:hover, .word:focus-visible { background: #edf0e5; outline: 0; }
.word.active { background: #e1eadc; }
.word-gloss { display: inline-block; margin: 0 3px; padding: 2px 7px; border-radius: 5px; background: #e8eee3; color: var(--green); font: 12px/1.5 -apple-system, sans-serif; white-space: normal; }
.sentence-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; }
.sentence-audio, .sentence-translation-toggle { padding: 3px 0; border: 0; background: none; color: var(--green); font: 600 11px -apple-system, sans-serif; cursor: pointer; }
.sentence-translation { margin: 7px 0 0; color: #63786a; font: 13px/1.6 -apple-system, sans-serif; }
.reader-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.reader-footer .tool-button:last-child { border-color: var(--green); background: var(--green); color: white; }
.dashboard-welcome { margin-bottom: 20px; }
.dashboard-welcome h2 { margin: 8px 0; font: 600 34px var(--serif); }
.dashboard-welcome p { color: var(--muted); font-size: 13px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dashboard-card { padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.dashboard-card h3 { margin: 9px 0; font: 600 21px var(--serif); }
.dashboard-card > p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.target-card > strong { display: block; margin: 13px 0 5px; font: 600 33px var(--serif); }
.target-card > strong small { color: var(--muted); font: 13px -apple-system, sans-serif; }
.target-card label { display: block; margin-top: 14px; color: var(--muted); font-size: 11px; }
.target-card input { width: 58px; margin: 0 4px; padding: 5px; border: 1px solid var(--line); border-radius: 5px; }
.plan-settings { margin: 14px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.plan-settings legend { color: var(--muted); font-size: 11px; }
.plan-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.plan-edit-grid label { min-width: 0; margin: 0; }
.plan-edit-grid input { display: block; width: 100%; margin: 5px 0; }
.recommendation-list { padding-left: 19px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.recommendation-list li + li { margin-top: 8px; }
.section-heading { margin: 28px 0 9px; font: 600 24px var(--serif); }
.comprehension-check { margin: 20px 0; }
.comprehension-options { display: grid; gap: 8px; }
.comprehension-options .tool-button { text-align: left; }
.comprehension-feedback { min-height: 1.5em; color: var(--green); }
.weekly-report { align-self: start; }
.plan-split { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 10px; }
.plan-split b { color: var(--ink); }
.week-chart { display: flex; align-items: stretch; justify-content: space-between; height: 128px; gap: 8px; margin-top: 13px; }
.week-day { display: flex; min-width: 0; flex: 1; flex-direction: column; align-items: center; justify-content: end; gap: 4px; color: var(--muted); font-size: 10px; }
.week-bar-wrap { display: flex; width: 22px; height: 75px; align-items: end; border-radius: 6px; background: #f0eee7; }
.week-bar { width: 100%; border-radius: 6px; background: #739075; }
.week-day b { color: var(--ink); font-size: 9px; }
.stat-pair { display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0; }
.stat-pair span { color: var(--muted); font-size: 12px; }
.stat-pair strong { display: block; color: var(--ink); font: 600 27px var(--serif); }
.level-note { padding-top: 11px; border-top: 1px solid var(--line); }
.vocabulary-list { margin: 12px 0; }
.vocabulary-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid #efebe2; }
.vocabulary-row b, .vocabulary-row span, .vocabulary-row small { display: block; }
.vocabulary-row b { font: 600 16px var(--serif); }
.vocabulary-row span { margin-top: 3px; color: #627367; font-size: 12px; }
.vocabulary-row small { margin-top: 3px; color: #94968d; font-size: 10px; }
.review-word { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #f4f5ee; color: var(--green); font-size: 11px; cursor: pointer; }
.due-label { color: #96978e; font-size: 10px; white-space: nowrap; }
.tutor-notice, .starter-advice { padding: 10px; border-radius: 8px; background: #f1f2eb; color: #606d62!important; }
#tutor-form { display: flex; flex-direction: column; gap: 7px; font-size: 12px; }
#tutor-question { width: 100%; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: 13px/1.5 -apple-system, sans-serif; }
.tutor-answer { margin-top: 10px; color: var(--green); font-size: 12px; line-height: 1.6; }
.starter-advice { margin-top: 14px; }
.vocabulary-practice-list { display: grid; gap: 10px; }
.vocabulary-practice { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.vocabulary-practice h3 { margin: 6px 0; font: 600 23px var(--serif); }
.practice-meaning { margin: 5px 0; color: var(--green); font-size: 13px; }
.review-actions { display: flex; gap: 8px; margin-top: 8px; }
.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; padding: 22px 6vw; border-top: 1px solid var(--line); color: #91938a; font-size: 11px; }
.toast { position: fixed; z-index: 5; bottom: 24px; left: 50%; max-width: calc(100vw - 30px); transform: translate(-50%, 15px); opacity: 0; padding: 11px 15px; border-radius: 9px; background: #25352e; color: white; font-size: 12px; pointer-events: none; transition: .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .topbar { min-height: 65px; flex-wrap: wrap; gap: 8px; padding: 10px 15px; }
  .brand { font-size: 13px; }
  .brand-mark { width: 30px; height: 30px; }
  .main-nav { order: 3; width: 100%; justify-content: space-around; border-top: 1px solid var(--line); padding-top: 6px; }
  .main-nav button { min-width: 0; flex: 1; padding: 8px 3px; font-size: 10px; line-height: 1.2; }
  .profile-picker { margin-left: auto; font-size: 0; }
  .profile-picker select { font-size: 13px; }
  main { padding: 36px 16px 58px; }
  .welcome > p { margin-bottom: 36px; }
  .book-list { grid-template-columns: 1fr; gap: 11px; }
  .book-open { gap: 12px; padding: 15px; }
  .cover { width: 58px; height: 84px; flex-basis: 58px; }
  .add-book-panel { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .add-book-panel { padding: 16px; }
  .chapter-illustration svg { min-height: 130px; object-fit: cover; }
  .reader-tools { gap: 7px; }
  .chapter-select { max-width: 100%; margin-left: 0; }
  .reader-progress { margin-left: auto; }
  .story-page { padding: 18px 15px; font-size: 19px; line-height: 1.8; }
  .sentence-block + .sentence-block { margin-top: 15px; padding-top: 13px; }
  .reader-footer { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
