:root {
  color-scheme: light;
  --bg: #f3f5f1;
  --panel: #fff;
  --panel-soft: #f8f9f6;
  --ink: #182925;
  --soft: #536862;
  --line: #dbe3dd;
  --accent: #136653;
  --accent-ink: #fff;
  --accent-light: #e3f1e8;
  --hero: #143b32;
  --hero-ink: #f2faf2;
  --hero-soft: #c4e1d2;
  --warn-bg: #fff4dd;
  --warn-ink: #704710;
  --danger: #a52f37;
  --shadow: 0 14px 46px #34443a10;
  --radius: 16px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft Yahei", sans-serif;
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111a18; --panel: #1b2623; --panel-soft: #18231f; --ink: #e8f2ed; --soft: #a3b9af;
    --line: #33453e; --accent: #a5e2c5; --accent-ink: #102a21; --accent-light: #263e34;
    --hero: #183f34; --hero-ink: #f0fbf2; --hero-soft: #c3e2d5; --warn-bg: #3d3020;
    --warn-ink: #f4d399; --danger: #f1989b; --shadow: 0 14px 45px #0003;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111a18; --panel: #1b2623; --panel-soft: #18231f; --ink: #e8f2ed; --soft: #a3b9af;
  --line: #33453e; --accent: #a5e2c5; --accent-ink: #102a21; --accent-light: #263e34;
  --hero: #183f34; --hero-ink: #f0fbf2; --hero-soft: #c3e2d5; --warn-bg: #3d3020;
  --warn-ink: #f4d399; --danger: #f1989b; --shadow: 0 14px 45px #0003;
}
* { box-sizing: border-box; }
html { min-width: 0; background: var(--bg); color: var(--ink); }
body { margin: 0; line-height: 1.62; }
main { min-width: 0; outline: none; }
a { color: inherit; text-decoration: none; }
a, button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, label:has(input:focus-visible) {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
button, select, input, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip { position: fixed; z-index: 5; margin: 8px; padding: 10px 14px; color: var(--accent-ink); background: var(--accent); }
.shell { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100svh; }
.sidebar {
  position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column;
  padding: 32px 18px 22px; border-right: 1px solid var(--line); background: var(--panel-soft);
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 7px 33px; font-size: 1.25rem; font-weight: 750; line-height: 1.1; }
.brand-mark {
  display: grid; place-items: center; width: 43px; height: 43px; border-radius: 12px;
  background: var(--hero); color: var(--hero-ink); font-size: 1.45rem; font-weight: 750;
}
.brand-sub { display: block; margin-top: 4px; font-size: .74rem; color: var(--soft); font-weight: 560; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { min-height: 46px; border-radius: 9px; font-size: .93rem; font-weight: 620; padding: 10px 13px; color: var(--soft); }
.sidebar nav a:hover, .sidebar nav a[aria-current="page"] { background: var(--accent-light); color: var(--accent); }
.sidebar .secondary { margin-top: auto; border-top: 1px solid var(--line); padding-top: 13px; }
.workspace { width: min(100%, 1256px); padding: 46px clamp(25px, 4.2vw, 64px) 0; min-width: 0; margin: 0 auto; }
footer { margin: 55px 0 26px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--soft); font-size: .82rem; }
footer span { margin: 0 5px; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.55rem); line-height: 1.2; letter-spacing: -.045em; font-weight: 760; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.35; letter-spacing: -.02em; font-weight: 710; }
h3 { font-size: 1rem; line-height: 1.4; font-weight: 700; }
p + p { margin-top: .65em; }
.muted { color: var(--soft); }
.hero {
  padding: clamp(28px, 5vw, 58px); background: var(--hero); color: var(--hero-ink);
  border-radius: 24px; box-shadow: var(--shadow);
}
.hero h1 { margin: .3em 0 .45em; font-size: clamp(2rem, 4.1vw, 3.5rem); }
.hero-context { font-size: .88rem; font-weight: 650; color: var(--hero-soft); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--hero-soft); font-size: .92rem; }
.hero .actions { margin-top: 29px; }
.hero .hero-button { color: #15392d; background: #e7f6e9; border-color: #e7f6e9; }
.hero .hero-button:hover { background: #fff; border-color: #fff; }
.section { margin-top: 31px; }
.section > h2, .section-title { margin-bottom: 12px; }
.section-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 3px 15px; }
.section-title .muted { font-size: .85rem; }
.subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.subject-card {
  display: flex; flex-direction: column; min-height: 190px; gap: 7px; padding: 21px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, transform .15s;
}
.subject-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.subject-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.subject-symbol {
  display: grid; place-items: center; min-width: 45px; height: 43px; padding: 0 8px; border-radius: 10px;
  color: #155144; background: #e0f1e9; font: 660 1.5rem Georgia, serif;
}
.subject-card.econ .subject-symbol { color: #715024; background: #f7eddc; }
.subject-card.english .subject-symbol { color: #304c71; background: #e7eef9; }
.subject-arrow { color: var(--soft); font-size: 1.15rem; }
.subject-card h3 { font-size: 1.25rem; }
.subject-card p, .subject-card small { color: var(--soft); font-size: .86rem; }
.subject-card small { margin-top: auto; padding-top: 10px; font-weight: 660; }
.page-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 13px; margin: 4px 0 24px; }
.page-head p { margin-top: 8px; font-size: .93rem; }
.breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: -8px 0 18px; color: var(--soft); font-size: .84rem; }
.breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
.directory-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 51px; }
.directory-row + .directory-row { border-top: 1px solid var(--line); }
.directory-row:hover { background: var(--panel-soft); }
.directory-row:focus-visible { outline-offset: -3px; }
.row-title { display: block; min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.row-title small { display: block; margin-top: 2px; color: var(--soft); font-size: .82rem; font-weight: 450; }
.row-end { display: inline-flex; gap: 12px; color: var(--soft); white-space: nowrap; align-items: center; font-size: .83rem; }
.row-end span { font-size: 1.1rem; }
.actions, .head-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button {
  appearance: none; display: inline-flex; justify-content: center; align-items: center; gap: 5px; min-height: 44px;
  padding: 8px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
  color: var(--ink); font-size: .91rem; line-height: 1.35; font-weight: 640; text-align: center;
}
.button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.danger { border-color: var(--danger); color: var(--danger); }
.button:disabled, .button[aria-disabled="true"] { opacity: .52; cursor: default; }
.file-button { position: relative; cursor: pointer; }
.end-actions { margin-top: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 17px; }
select, input[type="search"], textarea {
  max-width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); font-size: max(1rem, 16px);
}
.filters input { width: min(100%, 275px); }
textarea { display: block; resize: vertical; width: 100%; margin: 8px 0; }
.list-summary { font-size: .87rem; margin: 8px 0; }
.pager { justify-content: center; margin-top: 15px; }
.message { padding: 12px 15px; border-radius: 9px; background: var(--accent-light); color: var(--ink); }
.message.warn { background: var(--warn-bg); color: var(--warn-ink); }
.message:empty, p:empty { display: none; }
.study-card, .settings-card, .article-reading {
  min-width: 0; padding: clamp(16px, 3vw, 30px); background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line);
}
.study-card > :first-child { margin-top: 0; }
.study-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.study-text .katex { white-space: normal; }
.question-stem { font-size: 1.08rem; margin-bottom: 15px; }
.question-page { max-width: 900px; }
.study-card form { margin-top: 16px; }
.study-card form .actions { margin-top: 14px; }
.form-status { margin-top: 8px; font-size: .88rem; }
.option-list { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.option {
  display: grid; grid-template-columns: 1.1rem 1.55rem minmax(0, 1fr); align-items: start; gap: 8px;
  min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.option input { width: 1rem; height: 1rem; margin: .3em 0; accent-color: var(--accent); }
.option-letter { font-weight: 720; color: var(--accent); }
.reference { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.reference h3 { margin-bottom: 8px; }
.reference .study-text + .study-text { margin-top: 7px; }
.answer-details, .detail-field, .blank-answers > div { margin-top: 14px; }
.detail-field h3 { color: var(--soft); font-size: .9rem; margin-bottom: 6px; }
.detail-field ul { padding-inline-start: 1.25em; margin: 0; }
.source-note { margin: 6px 0; font-size: .82rem; }
blockquote { margin: 10px 0; padding-left: 12px; border-left: 2px solid var(--accent); }
.math-display { max-width: 100%; overflow-x: auto; }
.math-inline { display: inline-block; max-width: 100%; }
.math-fallback { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.media:empty { display: none; }
.media img { display: block; max-width: 100%; height: auto; margin: 12px auto; border-radius: 6px; }
details { margin-top: 8px; }
summary { min-height: 44px; padding: 9px 0; color: var(--accent); font-weight: 620; }
.passage-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.passage-grid > .message { grid-column: 1 / -1; }
.article-reading { font-family: Georgia, "Times New Roman", serif; font-size: 1.06rem; line-height: 1.75; }
.article-reading p + p { margin-top: 1em; }
.article-reading p { scroll-margin: 16px; }
.article-reading p:focus { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 2px; }
.reading-questions { min-width: 0; }
.reading-questions > .study-card { margin-bottom: 13px; padding: 15px; }
.small-title { margin: 0 0 7px; font-size: .95rem; color: var(--soft); }
.blank {
  min-width: 44px; min-height: 44px; padding: 3px 8px; border: 0; border-bottom: 2px solid var(--line);
  background: var(--panel-soft); border-radius: 5px; color: var(--accent); font: 620 .86rem system-ui; vertical-align: baseline;
}
.blank[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-light); }
.blank:disabled { color: var(--soft); }
.word-pool, .sentence-pool { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.sentence-pool { display: grid; }
.pool-option {
  display: flex; gap: 6px; align-items: baseline; min-height: 44px; padding: 8px; text-align: left;
  border: 1px solid var(--line); color: var(--ink); background: var(--panel);
  border-radius: 7px; min-width: 0; overflow-wrap: anywhere;
}
.pool-option[aria-pressed="true"] { background: var(--accent-light); border-color: var(--accent); }
.pool-option:disabled { opacity: .55; cursor: default; }
.settings-card .actions { margin: 14px 0 8px; }
.settings-card { font-size: .93rem; max-width: 820px; }
.theme-field, .check-label { display: flex; gap: 10px; align-items: center; min-height: 44px; }
dialog { width: min(430px, 92vw); padding: 22px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
dialog::backdrop { background: #10231e99; }
dialog p { margin-top: 10px; }
progress { width: min(100%, 330px); height: 12px; accent-color: var(--accent); display: block; margin: 12px 0; }
.plot canvas { max-width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 8px; }
.plot figcaption { color: var(--soft); font-size: .85rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
td, th { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.formula-back .actions, .study-card > .actions { margin-top: 13px; }
#notice { position: fixed; z-index: 4; bottom: max(20px, env(safe-area-inset-bottom)); right: 20px; padding: 10px 14px;
  max-width: min(350px, calc(100% - 40px)); background: var(--hero); color: var(--hero-ink); border-radius: 9px; box-shadow: var(--shadow); }
@media (max-width: 950px) {
  .shell { grid-template-columns: 165px minmax(0, 1fr); }
  .sidebar { padding-left: 13px; padding-right: 13px; }
  .workspace { padding: 31px 24px 0; }
  .subject-card { padding: 15px; min-height: 170px; }
}
@media (max-width: 740px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; display: block; padding: max(10px, env(safe-area-inset-top)) 12px 8px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 1px 4px 5px; min-height: 44px; font-size: 1rem; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; font-size: 1.18rem; border-radius: 9px; }
  .brand-sub { display: inline; margin-inline-start: 5px; }
  .sidebar nav, .sidebar .secondary { display: inline-flex; flex-wrap: wrap; gap: 1px; padding: 0; border: 0; }
  .sidebar nav a { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 5px 8px; font-size: .84rem; }
  .workspace { padding: 20px 14px 0; }
  .hero { border-radius: 17px; padding: 23px 19px; }
  .hero-meta { font-size: .83rem; }
  .subject-grid { grid-template-columns: 1fr; gap: 8px; }
  .subject-card { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto; min-height: 77px; gap: 2px 10px; padding: 11px; }
  .subject-top { display: contents; }
  .subject-symbol { grid-area: 1 / 1 / 3 / 2; align-self: center; min-width: 0; }
  .subject-arrow { grid-area: 1 / 3 / 2 / 4; justify-self: end; }
  .subject-card h3 { grid-area: 1 / 2 / 2 / 3; align-self: end; font-size: 1.08rem; }
  .subject-card p { grid-area: 2 / 2 / 3 / 3; font-size: .77rem; }
  .subject-card small { grid-area: 2 / 3 / 3 / 4; padding-top: 0; white-space: nowrap; font-size: .77rem; }
  .breadcrumbs { margin: -8px 0 6px; }
  .passage-grid { grid-template-columns: minmax(0, 1fr); }
  .article-reading { font-size: 1rem; }
  .page-head { margin-bottom: 16px; }
  .section { margin-top: 23px; }
  footer { margin-top: 35px; }
}
@media (min-width: 741px) {
  .article-reading { position: sticky; top: 13px; max-height: calc(100svh - 26px); overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.install-progress{margin:1rem auto;padding:.6rem 1rem;color:var(--muted);font-size:.94rem}.install-progress:empty{display:none}

.book-reader{max-width:48rem;margin-inline:auto}.book-reader .textbook-card{line-height:1.88}
.book-reader>section{margin-block:2rem}.book-shelf{border-bottom:1px solid var(--line);padding:.4rem 0}
.book-shelf summary{padding:.8rem .5rem;font-weight:600}.book-search{display:flex;flex-wrap:wrap;gap:.5rem;margin:1.4rem 0}
.book-search input{min-width:8rem;flex:1;border:1px solid var(--line);background:var(--panel);padding:.7rem;border-radius:.6rem}
.book-hits{flex-basis:100%}.book-reader .actions{position:sticky;bottom:0;background:var(--bg);padding-block:.6rem max(.6rem,env(safe-area-inset-bottom))}
@media(min-width:760px){.home>.section:last-child .rows{display:grid;grid-template-columns:1fr 1fr}.home>.section:last-child .directory-row{padding:1.35rem}}

.manual-review { margin: .75rem 1rem; }
.manual-review summary { cursor: pointer; padding: .65rem 0; }
.manual-review label { display: grid; gap: .35rem; max-width: 34rem; margin-bottom: .8rem; }
.manual-review p { white-space: pre-wrap; overflow-wrap: anywhere; }

.training-filters { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,12rem),1fr)); gap: .85rem; margin-bottom: 1.2rem; }
.training-filters label { display:grid; gap:.35rem; min-width:0; font-size:.9rem; }
.training-filters [hidden] { display:none; }
.training-filters select,.training-filters input { width:100%; min-width:0; min-height:44px; }
.training-passage { max-width:70ch; line-height:1.85; margin-block:1.25rem; }
.grade-result { font-weight:650; }

.reader-layout { min-width:0; }
.reader-outline { display:none; }
@media(min-width:1000px) {
  .reader-layout { display:grid; grid-template-columns:minmax(11rem,14rem) minmax(0,1fr); align-items:start; gap:clamp(1rem,2vw,2rem); }
  .reader-outline { display:grid; position:sticky; top:1rem; max-height:calc(100svh - 2rem); overflow:auto; padding-right:.75rem; border-right:1px solid var(--line); }
  .reader-outline h2 { font-size:1.05rem; }
  .reader-outline a { padding:.6rem .4rem; min-height:44px; overflow-wrap:anywhere; }
  .reader-outline [data-depth=subsection] { padding-inline-start:1.25rem; }
  .reader-outline [aria-current] { color:var(--accent); background:var(--accent-light); border-radius:.4rem; }
  .compact-outline { display:none; }
}
.reader-layout .book-reader { min-width:0; width:100%; }
.figure-preview { display:block; max-width:100%; min-height:44px; margin:auto; padding:0; border:0; background:transparent; cursor:zoom-in; }
.image-viewer { width:min(95vw,62rem); max-height:94svh; padding:.8rem; }
.zoom-viewport { max-height:72svh; overflow:auto; overscroll-behavior:contain; }
.zoom-viewport img { display:block; width:100%; max-width:none; height:auto; }
.zoom-controls { display:flex; flex-wrap:wrap; align-items:center; gap:.7rem; padding:.5rem .2rem 0; }
.zoom-controls input { min-height:44px; max-width:100%; }

.exam-coverage { margin:0; }
.exam-coverage>div { display:grid; grid-template-columns:minmax(8rem,.45fr) 1fr; gap:1rem; padding:.7rem 0; border-bottom:1px solid var(--line); }
.exam-coverage dt { font-weight:600; }
.exam-coverage dd { margin:0; color:var(--muted); }

.pet-card{position:relative;isolation:isolate;overflow:hidden;border:1px solid var(--line);border-radius:var(--radius,16px);margin-block:1.25rem}
.pet-card{
  display:grid;grid-template-columns:minmax(0,1fr) 48%;grid-template-rows:minmax(106px,1fr) auto;
  align-items:center;min-height:210px;padding:17px 16px 13px;
  border-color:#ead9bf;background:linear-gradient(135deg,#f9ecd9,#fff6e7 69%,#f4e2c6)
}
.pet-info{min-width:0;padding:0;z-index:2}
.pet-eyebrow{color:#805237}
.pet-info h2{color:#44332a;font-size:clamp(22px,3vw,30px);overflow-wrap:anywhere}
.pet-info p{color:#6b594a;font-size:13px}
.pet-halo{position:absolute;right:7%;top:0;width:43%;height:75%;border-radius:48%;background:#ffe8b7a0;z-index:-1}
.pet-button{background:none;border:0;position:relative;min-height:120px;padding:0;color:#8d533b;align-self:stretch}
.pet-button .pet-image{position:absolute;bottom:0;right:0;width:100%;height:100%;max-height:156px;object-fit:contain;object-position:center bottom;mix-blend-mode:normal;mask-image:none;transform-origin:50% 95%;z-index:1;filter:drop-shadow(0 8px 8px #a1734440);animation:puppy-breathe 4.6s ease-in-out infinite}
.pet-button.is-patted .pet-image{animation:puppy-hop .65s ease-out}
.dog-heart{position:absolute;right:6%;top:-9px;font-size:25px;color:#ac5c54;z-index:3;animation:puppy-heart .95s ease-out forwards}
@keyframes puppy-breathe{0%,100%{transform:rotate(-2deg) scale(1)}50%{transform:rotate(2deg) scale(1.035,1.055)}}
@keyframes puppy-hop{0%,100%{transform:translateY(0)}36%{transform:translateY(-15px) rotate(-7deg)}63%{transform:translateY(-5px) rotate(4deg)}}
@keyframes puppy-heart{from{transform:translateY(8px) scale(.6);opacity:0}32%{opacity:1}to{transform:translateY(-17px) scale(1);opacity:0}}
.pet-progress{z-index:2;grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;margin-top:8px;padding:10px;border:1px solid #ead8bf;border-radius:10px;background:#fffcf6bd;font-size:13px;font-weight:700;color:#71503a}
.pet-progress>span:first-child{display:flex;align-items:center;gap:5px}
.pet-progress strong{color:#754527}
.pet-meter{grid-column:1/-1;height:5px;border-radius:20px;background:#eadec9;overflow:hidden}
.pet-meter i{display:block;height:100%;background:#a67544}
.pet-card[data-tier="1"]{background:linear-gradient(135deg,#f8e4db,#fff5e5)}
.pet-card[data-tier="2"]{background:linear-gradient(135deg,#e1ecdc,#f6f4e3)}
.pet-card[data-tier="3"]{background:linear-gradient(135deg,#f8e9ba,#fff3df)}
.pet-card[data-tier="4"]{background:linear-gradient(135deg,#eee4f1,#fff2e7)}
.pet-card[data-tier="5"]{background:linear-gradient(135deg,#e5ebd8,#ffeacc)}
.pet-card[data-tier]:not([data-tier="0"]) .pet-halo{background:#fff9da}
.reward-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px;text-align:center}
.reward-week>div>span{display:grid;place-items:center;min-height:35px;border-radius:8px;background:#f3eee5;color:#766c5f}
.reward-week>div>span.lit{background:#dfeadd;color:#365843}
.reward-week small{color:var(--muted);font-size:12px}
@media(prefers-reduced-motion:reduce){.pet-button .pet-image,.dog-heart{animation:none}}
.pet-unlocked{position:absolute;z-index:2;color:#9e7545;filter:drop-shadow(0 2px 3px #b7813640);pointer-events:none}
.pet-unlocked-star{right:10px;top:10px}.pet-unlocked-moon{right:45%;top:9px;color:#a0848e}.pet-unlocked-lamp{right:12px;top:44%}

/* Shared application surfaces and typography. */
:root {
  --bg: #f7f6f2;
  --panel: #fffefa;
  --panel-soft: #efeee8;
  --ink: #242c27;
  --soft: #53615a;
  --line: #dddcd3;
  --accent: #245d4b;
  --accent-light: #e6efe8;
  --space: clamp(16px, 2.4vw, 30px);
  --muted: var(--soft);
  --nav-width: 216px;
  --success-bg: #e6f1e7;
  --success-ink: #28523c;
  --error-bg: #fae8e6;
}
:root[data-theme="dark"] {
  --bg:#151a17; --panel:#1e2520; --panel-soft:#202b25; --ink:#f2f3eb;
  --soft:#b5c1b7; --line:#3b4940; --accent:#b2e1c6; --accent-light:#304439; --success-bg:#233e2e; --success-ink:#b5e7c6; --error-bg:#452929;
}
@media(prefers-color-scheme:dark) {
  :root:not([data-theme="light"]) {
    --bg:#151a17; --panel:#1e2520; --panel-soft:#202b25; --ink:#f2f3eb;
    --soft:#b5c1b7; --line:#3b4940; --accent:#b2e1c6; --accent-light:#304439; --success-bg:#233e2e; --success-ink:#b5e7c6; --error-bg:#452929;
  }
}
body { line-height: 1.68; }
.shell { grid-template-columns: var(--nav-width) minmax(0,1fr); }
.sidebar { padding-inline:16px; background:var(--panel-soft); }
.sidebar nav a { display:flex; align-items:center; gap:12px; font-size:.94rem; }
.sidebar nav a::before {
  content:""; flex:0 0 7px; width:7px; height:7px; border:1px solid currentColor; border-radius:50%;
}
.sidebar nav a[aria-current="page"]::before { background:currentColor; }
.workspace { width:min(100%,1300px); padding-inline:clamp(18px,4vw,62px); }
.page-head { padding-bottom:18px; border-bottom:1px solid var(--line); }
.page-head h1 { max-width:34ch; letter-spacing:-.035em; }
.page-head p { color:var(--soft); }
.directory-row { min-height:56px; }
.row-title small { font-size:.875rem; }
.button { min-height:44px; }
.button.primary:hover { filter:brightness(.94); }
select,input:not([type]),input[type="number"],input[type="date"],textarea {
  min-height:44px; max-width:100%; padding:8px 12px; border:1px solid var(--line);
  border-radius:9px; background:var(--panel); color:var(--ink);
}
.question-page .study-card, .reading-questions .study-card { padding:clamp(18px,3vw,34px); }
.question-stem { max-width:72ch; line-height:1.8; margin-bottom:24px; }
.option { min-height:48px; }
.answer-slot:not(:empty) { margin-top:24px; }
.form-status[data-outcome] { width:fit-content; border-radius:8px; }
.form-status[data-outcome='correct'] { padding:6px 10px; color:var(--success-ink); background:var(--success-bg); }
.form-status[data-outcome='incorrect'] { padding:6px 10px; color:var(--danger); background:var(--error-bg); }
.reference { padding:var(--space); border-left:3px solid var(--accent); }
.textbook-card { line-height:1.85; }
.image-viewer .zoom-controls { padding-bottom:max(12px,env(safe-area-inset-bottom)); }

/* Home arranges subjects, daily work, the companion and reference material in that order. */
.desk-header {
  display:flex; justify-content:space-between; align-items:end; gap:var(--space);
  padding:0 0 var(--space); border-bottom:1px solid var(--line);
}
.desk-header h1 { font-size:clamp(2rem,4vw,3.125rem); margin:.28rem 0 .3rem; }
.desk-date { color:var(--accent); font-size:.92rem; font-weight:650; }
.desk-intro { color:var(--soft); font-size:.94rem; }
.desk-home .section { margin-top:var(--space); }
.desk-home .subject-grid { gap:clamp(8px,1.6vw,18px); }
.desk-home .subject-card { min-height:0; flex-direction:row; align-items:flex-start; padding:clamp(13px,1.7vw,22px); gap:12px; }
.desk-home .subject-card:hover { transform:none; background:var(--panel-soft); }
.subject-copy { min-width:0; }
.subject-copy h3 { font-size:1.05rem; }
.subject-copy p,.subject-copy small { display:block; padding:0; margin:.25rem 0 0; line-height:1.5; }
.subject-copy small { font-size:.8rem; }
.desk-home .subject-symbol { flex:none; min-width:36px; height:36px; font-size:1.2rem; }
.day-grid { display:grid; grid-template-columns:minmax(0,1.55fr) minmax(0,1fr); gap:var(--space); margin-top:var(--space); }
.day-panel { min-width:0; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:var(--space); }
.day-panel .section-title { align-items:center; }
.text-action { display:inline-flex; align-items:center; min-height:44px; color:var(--accent); font-weight:650; }
.text-action:hover { text-decoration:underline; text-underline-offset:3px; }
.day-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border-block:1px solid var(--line); margin:0 0 16px; }
.day-metrics a { display:flex; flex-direction:column; justify-content:center; min-height:76px; padding:8px; text-align:center; }
.day-metrics a + a { border-left:1px solid var(--line); }
.day-metrics a:hover { background:var(--panel-soft); }
.day-metrics strong { font-size:clamp(1.2rem,2vw,1.65rem); font-variant-numeric:tabular-nums; line-height:1.2; }
.day-metrics small { font-size:.8rem; color:var(--soft); margin-top:4px; }
.day-entries { margin:0; padding-inline-start:1.25rem; }
.day-reminder { color:var(--accent); margin-top:.5rem; }
.desk-home .pet-card { margin:0; min-height:0; align-self:stretch; }
.desk-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space); }
@media(max-width:1050px) and (min-width:761px) {
  :root { --nav-width:168px; }
  .desk-home .subject-card { flex-direction:column; }
}
@media(max-width:760px) {
  .sidebar { padding-inline:max(12px,env(safe-area-inset-left)); }
  .sidebar nav a { justify-content:center; gap:0; padding:6px 8px; }
  .sidebar nav a::before { display:none; }
  .brand { margin-bottom:4px; }
  .workspace { padding-inline:16px; }
  .desk-header { display:grid; gap:14px; }
  .desk-header .actions { margin:0; }
  .desk-home .subject-grid,.day-grid,.desk-columns { grid-template-columns:minmax(0,1fr); }
  .desk-home .subject-card { align-items:center; padding:11px 13px; }
  .subject-copy { flex:1; }
  .desk-home .subject-copy small { display:none; }
  .desk-columns { gap:0; }
  .page-head { padding-bottom:12px; margin-bottom:18px; }
  .directory-row { padding-inline:12px; }
}

.subject-hub .page-head { border-top:3px solid var(--course-accent,var(--accent)); padding-top:18px; }
.economics-hub { --course-accent:#9a7448; }
.english-hub { --course-accent:#537497; }
.subject-columns { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(0,1fr); gap:var(--space); align-items:start; }
.subject-columns .section { min-width:0; margin-top:1rem; }
.english-hub .exam-coverage { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:8px 16px; }
.english-hub .exam-coverage>div:last-child { border-bottom:0; }
@media(max-width:900px){.subject-columns{grid-template-columns:minmax(0,1fr);gap:0}}
.day-panel > .rows { margin-top:12px; }
.desk-home > p.muted { margin-top:var(--space); }

/* The study surfaces stay neutral. Color is reserved for actions and status. */
:root { --bg:#f8f7f4; --panel:#fffefa; --panel-soft:#f0efeb; --line:#e4e1da; --ink:#282b29; --soft:#5d625e; }
:root[data-theme="dark"] { --bg:#1a1a1b; --panel:#222225; --panel-soft:#2a2a2c; --line:#3d3d41; --ink:#f1f0ec; --soft:#c0bfbc; --accent:#b0dec6; }
@media(prefers-color-scheme:dark) {
  :root:not([data-theme="light"]) { --bg:#1a1a1b; --panel:#222225; --panel-soft:#2a2a2c; --line:#3d3d41; --ink:#f1f0ec; --soft:#c0bfbc; --accent:#b0dec6; }
}
.desk-header h1 { font-size:clamp(1.95rem,3.3vw,2.65rem); }
h1 { font-weight:700; }
h2,.row-title { font-weight:630; }
.desk-home .subject-card { border:0; border-radius:0; border-bottom:1px solid var(--line); padding-inline:10px; background:transparent; }
.desk-home .subject-card:hover { background:var(--panel-soft); }
.desk-home .pet-compact {
  display:grid; grid-template-columns:66px minmax(0,1fr); grid-template-rows:auto 1fr;
  align-self:center; align-items:center; column-gap:14px; padding:10px 0;
  background:none; border:0; border-radius:0; min-height:0;
}
.pet-compact .pet-button { grid-area:1/1/3/2; min-height:66px; }
.pet-compact .pet-button .pet-image { filter:none; }
.pet-compact .pet-info { grid-area:1/2/2/3; }
.pet-compact .pet-info h2 { color:var(--ink); font-size:1.05rem; }
.pet-compact .pet-info p { color:var(--soft); }
.pet-compact .pet-progress {
  grid-area:2/2/3/3; border:0; background:none; color:var(--soft);
  width:max-content; max-width:100%; align-items:center; margin:0; min-height:44px; padding:0; gap:10px;
}
.pet-compact .pet-progress strong { color:var(--soft); font-weight:650; }
@media(max-width:760px){.desk-home .pet-compact { margin-top:0; padding:0 8px; }}
