:root{font:16px/1.55 'Inter',system-ui,sans-serif;color:#1d2341;background:#f5f7ff;--bg:#f5f7ff;--surface:#fff;--ink:#1d2341;--muted:#56617d;--line:#e3e8f5;--accent:#5144d6;--soft:#eceaff;--hero:#e8e6ff;--shadow:0 12px 35px #3538700a}
:root.dark{color-scheme:dark;color:#eef0ff;background:#171829;--bg:#171829;--surface:#21243a;--ink:#eef0ff;--muted:#b5bed9;--line:#373d59;--accent:#a49bff;--soft:#373154;--hero:#2e2959;--shadow:none}
:root.large{font-size:19px}
*{box-sizing:border-box}
body{margin:0}
button,input,select{font:inherit}
button,a{touch-action:manipulation}
button{cursor:pointer}
button:disabled{opacity:.6;cursor:wait}
a{color:var(--accent)}
h1,h2,h3,p{margin:0 0 .65rem}
h1,h2,h3{line-height:1.15;letter-spacing:-.035em}
h1{font-size:clamp(2rem,4vw,3.4rem)}
h2{font-size:1.45rem}
h3{font-size:1.2rem}
p{color:var(--muted)}
label{display:grid;gap:.35rem;font-weight:650}
input:not([type=radio]),select{display:block;width:100%;max-width:100%;min-height:44px;border:1px solid var(--line);border-radius:.7rem;color:var(--ink);background:var(--surface);padding:.55rem .7rem}
input:focus,select:focus,button:focus-visible,a:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.primary,.secondary,.link,.word{display:inline-flex;justify-content:center;align-items:center;min-height:44px;padding:.55rem 1rem;border-radius:.7rem;font-weight:750;text-decoration:none;border:1px solid transparent}
.primary{background:#5144d6;color:white}
.primary:hover{background:#4234bf}
.secondary,.word{background:var(--soft);color:var(--accent)}
.link{background:transparent;color:var(--accent);padding-inline:.4rem}
.link:hover,.secondary:hover,.word:hover{background:var(--soft);text-decoration:underline}
.brand{display:flex;align-items:center;gap:.65rem;font-weight:800;line-height:1.08;font-size:.98rem;letter-spacing:-.02em}
.brand strong,.profile-mini small{display:block}
.brand strong{color:var(--accent)}
.brand-icon{width:44px;height:44px;flex:none}
.brand-icon img{width:100%;height:100%}
.login{min-height:100svh;display:grid;grid-template-columns:1.08fr 1fr}
.login-art{min-height:33rem;position:relative;isolation:isolate;overflow:hidden;padding:clamp(1.8rem,5vw,5rem);background:radial-gradient(circle at 80% 80%,#8579fa 0%,transparent 48%),linear-gradient(145deg,#30217f,#5546d4 70%);color:white;display:flex;flex-direction:column;justify-content:space-between}
.login-art .brand strong,.login-art p{color:#eeebff}
.login-art p{max-width:27rem;font-size:1.1rem}
.login-copy{padding-block:4rem 5rem;max-width:32rem}
.login-copy h1{font-size:clamp(2.6rem,5.8vw,5rem);margin-top:1rem}
.eyebrow{font-weight:800;letter-spacing:.12em;font-size:.85rem;color:var(--accent)}
.login-art .eyebrow{color:#ded8ff}
.orbit{position:absolute;right:-3rem;bottom:-4rem;height:19rem;width:19rem;border:1px solid #ffffff55;border-radius:50%;z-index:-1}
.orbit i,.hero-art span{position:absolute;display:grid;place-items:center;aspect-ratio:1;border-radius:1rem;font-style:normal;font-weight:800;box-shadow:0 12px 25px #24206126}
.orbit i:nth-child(1){left:-1rem;top:3rem;width:4rem;background:#f2b47d;color:#56307a;transform:rotate(-14deg)}
.orbit i:nth-child(2){left:5rem;top:-.5rem;width:5rem;background:#f2edff;color:#5144d6;transform:rotate(13deg)}
.orbit i:nth-child(3){right:4rem;top:6rem;width:3.5rem;background:#b8f1e3;color:#285975}
.login-form{display:grid;place-items:center;padding:2rem}
.login-form>div{width:min(100%,25rem)}
.login-form h2{font-size:2.4rem;margin-top:.55rem}
form{display:grid;gap:1rem}
.login-form form{margin-top:1.6rem}
.layout{display:grid;grid-template-columns:15.5rem minmax(0,1fr);min-height:100svh}
aside{position:sticky;top:0;height:100svh;overflow:auto;background:var(--surface);border-right:1px solid var(--line);padding:1.6rem 1rem;display:flex;flex-direction:column;gap:1rem}
aside .brand{margin:.1rem .35rem .8rem}
nav{display:grid;gap:.2rem}
nav button{border:0;background:transparent;color:var(--muted);text-align:left;border-radius:.65rem;padding:.55rem .7rem;min-height:42px;font-size:.9rem;font-weight:650;display:flex;align-items:center;gap:.65rem;white-space:nowrap}
nav button span{width:1.25rem;text-align:center;font-weight:800}
nav button:hover,nav .selected{background:var(--soft);color:var(--accent)}
.profile-mini{display:flex;align-items:center;gap:.55rem;margin-top:auto;padding:.55rem .3rem 0;overflow-wrap:anywhere}
.avatar{display:grid;place-items:center;background:var(--soft);color:var(--accent);border-radius:50%;width:2.2rem;height:2.2rem;flex:none;font-weight:800}
small,.quiet,.topic{color:var(--muted)}
small,.quiet{font-size:.88rem}
#main{padding:0 clamp(1.2rem,4vw,3.5rem) 3rem;width:100%;max-width:88rem;margin:0 auto}
.top{height:4.7rem;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);margin-bottom:1.7rem;color:var(--muted);font-weight:700}
.date{color:var(--muted);font-weight:650;margin:0 0 .75rem;text-transform:capitalize}
.hero{position:relative;overflow:hidden;background:var(--hero);border-radius:1.4rem;min-height:15rem;padding:clamp(1.3rem,4vw,2.65rem);display:flex;align-items:center;justify-content:space-between;gap:1rem}
.hero h1{margin-top:.45rem}
.hero p{margin-bottom:1.1rem}
.hero-art{width:12rem;height:10rem;position:relative;flex:none;background:radial-gradient(circle,#a9a1fb80,transparent 66%)}
.hero-art span:nth-child(1){width:2.8rem;right:0;top:.25rem;background:#f9d47b;color:#784e14;transform:rotate(13deg)}
.hero-art span:nth-child(2){width:5.4rem;right:4rem;top:.6rem;background:#5d51dc;color:white;font-size:2.8rem;transform:rotate(-12deg)}
.hero-art span:nth-child(3){width:4.3rem;right:1.1rem;bottom:.2rem;background:#fff;color:#5144d6;font-size:1.6rem;transform:rotate(10deg)}
.metrics,.cards{display:grid;gap:1rem;grid-template-columns:repeat(auto-fit,minmax(min(100%,13.5rem),1fr));margin:1.2rem 0}
.metrics article,.card,.empty,.table-wrap{background:var(--surface);border:1px solid var(--line);border-radius:1rem;padding:1.15rem;box-shadow:var(--shadow);min-width:0;overflow-wrap:anywhere}
.metrics strong{display:block;font-size:1.9rem;line-height:1.2;margin-top:.3rem}
.metrics span,.topic{font-weight:700;font-size:.9rem}
.card h3{margin-top:.45rem}
.card label,.card details{margin-bottom:.55rem}
.card .primary{margin-top:.35rem}
.card progress{width:100%;accent-color:var(--accent)}
.subject-icon{display:inline-grid;place-items:center;width:2.65rem;height:2.65rem;border-radius:.7rem;font-weight:850;font-size:1.3rem;margin-bottom:.5rem}
.blue{background:#e4efff;color:#2456a5}.orange{background:#fff0db;color:#985112}.green{background:#d9f2e6;color:#166047}
.subheading,.profile,.inline,.tabs{display:flex;align-items:center;gap:.7rem;flex-wrap:wrap}
.subheading,.profile{justify-content:space-between;margin:1.2rem 0 .6rem}
.subheading h2,.profile p:last-child{margin-bottom:0}
.empty{color:var(--muted);border-style:dashed;margin:.75rem 0 1.1rem}
.table-wrap{overflow:auto;padding:0;margin-bottom:1.3rem}
table{border-collapse:collapse;width:100%;min-width:29rem}
th,td{padding:.65rem .9rem;text-align:left;border-bottom:1px solid var(--line)}
th{color:var(--muted);font-size:.9rem}
tr:last-child td{border-bottom:0}
.section-heading{margin:1rem 0 1.35rem}
.section-heading h1{font-size:clamp(2rem,4vw,2.85rem)}
.stack{display:grid;gap:1rem;margin-top:1rem}
fieldset{min-inline-size:0;margin:0}
legend{color:var(--accent);font-weight:800;padding:0 .4rem}
.question{font-weight:750;color:var(--ink)}
label.option{display:flex;gap:.4rem;align-items:center;border:1px solid var(--line);border-radius:.65rem;padding:.55rem;min-height:44px;cursor:pointer}
.option:has(input:checked){background:var(--soft);border-color:var(--accent)}
input[type=radio]{accent-color:var(--accent);width:1rem;height:1rem}
.score{font-size:3rem;color:var(--accent);font-weight:850;letter-spacing:-.07em;line-height:1.1}
.result-summary{border-top:4px solid var(--accent)}
.answer.correct{border-inline-start:4px solid #248561}
.answer.wrong,.answer.blank{border-inline-start:4px solid #c77728}
.form-card{max-width:39rem}
.form-card button{justify-self:start}
#notice:not(:empty){position:fixed;z-index:3;bottom:1rem;right:1rem;max-width:min(27rem,calc(100% - 2rem));border-radius:.75rem;background:#25234c;color:#fff;padding:.85rem 1.2rem;box-shadow:var(--shadow)}
.loading{padding:2rem}
@media(max-width:850px){.layout{grid-template-columns:12rem minmax(0,1fr)}aside{padding-inline:.65rem}.hero-art{width:9rem}.hero-art span:nth-child(2){right:2rem}.hero-art span:nth-child(1){right:-.4rem}}
@media(max-width:650px){.layout,.login{display:block}aside{position:static;height:auto;padding:.7rem;gap:.5rem;border-right:0;border-bottom:1px solid var(--line)}aside .brand{margin:0}aside nav{display:flex;overflow:auto;padding-bottom:.1rem}aside .profile-mini{display:none}aside>.link{position:absolute;right:.65rem;top:.55rem}.top{display:none}#main{padding-top:1rem}.login-art{min-height:17rem;padding:1.2rem}.login-copy{padding:2rem 0 .1rem}.login-copy h1{font-size:2.45rem}.login-copy p{max-width:19rem}.login-form{padding:1.4rem}.hero-art{display:none}.metrics{grid-template-columns:repeat(3,minmax(0,1fr));gap:.4rem}.metrics article{padding:.55rem}.metrics span{font-size:.85rem}.metrics strong{font-size:1.4rem}}
@media print{aside,.top,button,#notice{display:none!important}.layout{display:block}#main{max-width:none}.card{break-inside:avoid}}
.quiz-status{position:sticky;top:0;z-index:1;display:flex;flex-wrap:wrap;gap:.65rem 1rem;padding:.65rem .9rem;background:var(--surface);border:1px solid var(--line);border-radius:.7rem}
#save-status{color:var(--muted)}
.draft{margin-top:1rem}

.login-profiles{display:grid;gap:.45rem;margin-top:1rem}
.login-profile{display:flex;align-items:center;gap:.65rem;text-align:left;padding:.5rem .65rem;min-height:50px;border:1px solid var(--line);border-radius:.7rem;background:var(--surface);color:var(--ink)}
.login-profile[aria-pressed=true]{background:var(--soft);border-color:var(--accent)}
.login-profile small{display:block}
.avatar-panda,.avatar-cat,.avatar-parent{font-size:1.35rem}
.avatar-panda{background:#dff4ed}.avatar-cat{background:#e3efff}.avatar-parent{background:#f3e7ff}
.remember{display:flex;align-items:center;gap:.5rem;font-weight:500}
.credential-page{max-width:38rem;padding:1.5rem;margin:2rem auto}
.credential-page .card{margin-bottom:.8rem}
.profile h2 .avatar{display:inline-grid;vertical-align:middle}
.avatar-panda,.avatar-cat,.avatar-parent{background-image:url('/family-avatars.svg');background-size:300% 100%;background-repeat:no-repeat}
.avatar-panda{background-position:0 50%}.avatar-cat{background-position:50% 50%}.avatar-parent{background-position:100% 50%}
.remember input[type=checkbox]{width:1rem;min-height:0;height:1rem;margin:0;accent-color:var(--accent)}
@media(max-width:650px){
  aside>.link[data-action=switch-profile]{position:static;align-self:start}
  aside>.link[data-action=logout]{position:absolute}
}
#login-error{color:#9a2539;background:#ffedf0;padding:.7rem .8rem;border-radius:.6rem;margin:0}
.dark #login-error{color:#ffd9e0;background:#5a293a}

.library-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,11rem),1fr));gap:.8rem}
.library-filters label{margin:0}
.library-search{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:end;gap:.5rem}
.library-search label{flex:1 1 12rem}
.library-summary,.library-index,.library-reader{margin-block:1rem}
.library-reader{max-width:57rem}
.library-reader details,.library-index details{border-top:1px solid var(--line);padding:.7rem 0}
.library-reader summary,.library-index summary{cursor:pointer;font-weight:700}
.library-reader details p{margin:.5rem 0}
.library-index details ul{padding-inline-start:1.3rem;margin:.3rem 0}
.library-index li small{display:inline-block;margin-inline-start:.35rem}
.library-flow{display:flex;flex-wrap:wrap;align-items:center;gap:.45rem;margin:1rem 0}
.library-flow span:nth-child(odd){padding:.4rem .6rem;border-radius:.5rem;background:var(--soft);font-weight:650}
.library-pager,.library-exercise,.library-actions{margin-top:1rem}
.library-pager button{white-space:normal}
@media print{.library-filters,.library-summary,.library-actions,.library-pager,.library-exercise,#main:has(.library-reader) .section-heading{display:none!important}.library-reader{border:0;box-shadow:none}}
.library-formula{overflow-x:auto;padding:.45rem .65rem;background:var(--soft);border-radius:.55rem;color:var(--ink)}
.library-formula math{margin-inline:auto;min-width:max-content}
.math7-body{margin-block:1.2rem}
.math7-body ol{margin:0;padding-inline-start:1.45rem}
.math7-body li{margin-bottom:.35rem}
.lesson-figure{max-width:30rem;margin:0;padding:.7rem;background:var(--soft);border-radius:.6rem}
.lesson-figure svg{display:block;width:100%;height:auto}
fieldset textarea{width:100%;min-width:0;padding:.65rem;font:inherit}
.geometry-figure{max-width:38rem;margin:.65rem 0;padding:.55rem;background:var(--surface);border:1px solid var(--line);border-radius:.6rem}
.geometry-expanded{max-width:none}
.geometry-svg{display:block;width:100%;height:auto;color:var(--ink)}
.geo-stroke{fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.geo-dot,.geo-text,.geo-fill{fill:currentColor}
.geo-text{font-family:inherit;font-size:13px;font-weight:620}
.geo-fill{fill-opacity:.24}
.geometry-svg .known,.geo-legend .known{color:#135cae}
.geometry-svg .target,.geo-legend .target{color:#985215}
.geometry-svg .aux,.geo-legend .aux{color:#7354bd}
.geometry-svg .result,.geo-legend .result{color:#176744}
.dark .geometry-svg .known,.dark .geo-legend .known{color:#86baff}
.dark .geometry-svg .target,.dark .geo-legend .target{color:#ffc077}
.dark .geometry-svg .aux,.dark .geo-legend .aux{color:#c7adff}
.dark .geometry-svg .result,.dark .geo-legend .result{color:#86e2b6}
.geo-stroke.aux{stroke-dasharray:6 4}
.geometry-figure figcaption,.geo-legend{font-size:.87rem;color:var(--muted)}
.geo-legend{display:flex;flex-wrap:wrap;gap:.65rem;font-weight:700}
.geometry-solution{margin-block:.8rem}
.geometry-solution details{padding-block:.45rem}
.geometry-dialog{width:min(96vw,60rem);max-width:none;border:1px solid var(--line);border-radius:.8rem;background:var(--surface);color:var(--ink);padding:.8rem}
.geometry-dialog::backdrop{background:#080f21a0}
.geometry-dialog form{display:flex;justify-content:end}
.geo-controls{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr));gap:.45rem .8rem}
.geo-sim-drawing{max-width:47rem;margin:auto}
.geo-sim-drawing [data-geo-drag]{cursor:grab;touch-action:none}
.geo-sim-reading{font-weight:650}

.english-audio { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.english-audio audio { width: min(100%, 20rem); }
.english-card summary { cursor: pointer; }
.english-card button[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: 1px; }
#quiz blockquote { margin: .5rem 0; padding: .5rem 1rem; border-inline-start: .2rem solid currentColor; }

#quiz-exit { width: min(92vw, 32rem); padding: 1.25rem; border-radius: .85rem; border: 1px solid currentColor; }
#quiz-exit::backdrop { background: rgb(25 35 53 / 55%); }
#quiz [data-quiz-index] { scroll-margin-top: 5rem; }
.library-back, .library-pager { margin-block: 1rem; }

.library-filters { align-items: start; }
.library-field, .library-search { border-radius: .75rem; padding: .55rem .65rem; color: #271e49; background: var(--library-tone, #F0EDFF); }
.library-field > span, .library-search label > span { display:block; font-weight: 650; font-size: .875rem; margin-bottom: .35rem; }
.library-field select, .library-search input {
  width: 100%; min-width: 0; height: 46px; min-height: 46px; margin: 0; color: #211a38;
  border: 1px solid #655e78; background-color: var(--library-tone, #F0EDFF);
}
.library-field-subject { --library-tone: #EAE5FF; }
.library-field-source { --library-tone: #E0EDFF; }
.library-field-semester { --library-tone: #DFF3E8; }
.library-field-chapter { --library-tone: #FFF0D8; }
.library-field-topic { --library-tone: #FCE5EE; }
.library-field-level { --library-tone: #E1F3F4; }
.library-search { --library-tone: #F0EDFF; min-width: 0; }
.library-search button { min-height: 46px; }
.library-sources { padding: .55rem .85rem; margin-block: .65rem 1rem; }
.library-subject { border-inline-start: .22rem solid var(--subject-accent); padding-inline-start: .4rem; }
.library-subject.math { --subject-accent: #4791e2; }
.library-subject.english { --subject-accent: #cf8b25; }
.library-subject.science { --subject-accent: #3a9f69; }
.science-formula { border-inline-start: .24rem solid #3a9f69; padding: .7rem 1rem; font-weight: 650; }
.science-sim svg { width: 100%; height: auto; display: block; max-height: 21rem; }
.science-sim input[type="range"] { width: 100%; min-height: 44px; }
@media (max-width: 420px) {
  .library-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; padding: .6rem; }
  .library-field { padding-inline: .45rem; }
}

.primary-reader { font-size: 1.065rem; }
.primary-reader.math { border-top: .4rem solid #a8d2ff; }
.primary-reader.english { border-top: .4rem solid #ffce85; }
.primary-reader button { min-height: 46px; }
.primary-reader .english-card { border-inline-start: .3rem solid #f3bd65; }
.primary-game { margin-block: .6rem; }
.primary-clock svg { display: block; width: min(15rem,100%); height:auto; margin-inline:auto; }
.primary-game [data-apple], .primary-game .picture-choice { font-size: 1.5rem; min-width: 46px; }
.primary-game [aria-pressed="true"] { outline: 2px solid #6045af; }
