/* Responsive refinements, 2026-10-11. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}body{min-width:280px}button,input,select,textarea{font-size:16px}button,summary{min-height:44px}button{min-width:44px}button:disabled{transform:none}.top{max-width:1120px}.brand{min-width:0}.brand>span:last-child{min-width:0}.logo{flex-shrink:0}h1,h2,h3,p,strong{overflow-wrap:anywhere}.hero>div,.setup>.card,.form-grid>*{min-width:0}.setup{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}.form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.field{min-width:0}input[type=text],select{min-width:0;min-height:48px;font-size:16px}.section-head{flex-wrap:wrap;align-items:center}.history-row>div{min-width:0;flex:1}.history-row button{flex-shrink:0}.actions>*{max-width:100%}.exam-head>div:first-child{min-width:0}.exam-head>div:last-child{flex-shrink:0}.exam-layout{grid-template-columns:minmax(0,1fr) 300px}.question,.aside{min-width:0}.q-top{flex-wrap:wrap;align-items:center;gap:10px}.q-code{flex:1 1 150px;line-height:1.6}.q-top button{flex-shrink:0}.option{min-height:56px;align-items:flex-start;gap:10px}.option input{width:20px;height:20px;margin:3px 0 0;flex-shrink:0}.option b{min-width:20px;flex-shrink:0}.option span{min-width:0;overflow-wrap:anywhere;line-height:1.65}.question h2{font-weight:650}.passage{line-height:1.95}.grid{grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:8px;padding:4px;max-height:300px}.grid button{min-width:44px;min-height:44px;padding:8px 0;font-size:12px;font-variant-numeric:tabular-nums}.answer-panel>summary{cursor:pointer;font-size:14px;font-weight:650;line-height:1.5;padding:10px 2px;color:var(--accent)}.answer-panel>summary::marker{color:var(--accent)}.answer-panel .grid{margin:10px 0 16px}.aside .actions{gap:8px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.aside .actions button{padding:10px 4px;font-size:13px}.save-line{line-height:1.65;margin-top:12px}.nav-actions{gap:12px}.nav-actions button{flex:1;max-width:220px}.question textarea{min-height:280px;height:clamp(280px,38vh,420px);font-size:16px;line-height:1.9}.word-counter{line-height:1.7;margin-top:8px}.result-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(100px,1fr));gap:18px;max-width:650px;margin:20px auto}.result-stats>div{min-width:0;font-size:14px}.result-stats b{line-height:1.5}.score{font-variant-numeric:tabular-nums}.export-card .actions{align-items:stretch}.export-card button{min-height:48px}.review-item summary{line-height:1.7;min-height:54px}.status{margin-left:8px;line-height:1.7}.answer-box{line-height:1.85}.inline-options{overflow-wrap:anywhere}dialog{max-height:calc(100dvh - 32px);overflow:auto}dialog .actions{justify-content:flex-end}dialog h2{font-size:22px}#toast{bottom:max(20px,env(safe-area-inset-bottom));line-height:1.6;max-width:calc(100vw - 32px);overflow-wrap:anywhere}footer{padding-bottom:max(28px,env(safe-area-inset-bottom))}
@media(max-width:980px){.hero{display:block}.stats{margin:20px 0}.setup{grid-template-columns:1fr}.exam-layout{grid-template-columns:minmax(0,1fr)}.aside{position:static;order:-1;padding:16px 20px}.aside .help{margin-top:10px}.aside .progress{margin:8px 0}.answer-panel:not([open])~.save-line{margin-top:4px}.grid{max-height:260px}.question{padding:26px}.results-hero{padding:26px}.exam-head h1{font-size:23px}.tag{display:none}}
@media(max-width:600px){.top{padding:18px 16px}.hero{margin-top:12px;margin-bottom:24px}.hero h1{font-size:30px;line-height:1.35}.hero p{font-size:15px}.stats{gap:30px}.stats b{font-size:30px}.card,.question{padding:20px}.form-grid{grid-template-columns:minmax(0,1fr);gap:0}.section-head{gap:12px}.section-head>label{width:100%}.section-head select{width:100%}.exam-head{align-items:flex-start;gap:12px}.exam-head h1{font-size:21px}.exam-head .eyebrow{font-size:11px;letter-spacing:1px}.time{font-size:24px;line-height:1.5}.exam-head>div:last-child{min-width:96px}.exam-head .ghost{padding:8px 4px;font-size:13px}.q-code{font-size:12px;flex-basis:110px}.q-top button{padding:9px 12px;font-size:13px}.question h2{font-size:19px;line-height:1.7}.passage{padding:14px;font-size:16px}.option{padding:13px;gap:8px}.aside{padding:14px 16px}.aside .grid{max-height:240px}.question textarea{min-height:300px;height:340px}.result-stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 12px}.result-stats>div{font-size:13px}.results-hero{padding:22px 18px}.score{font-size:52px}.export-card .actions{display:grid;grid-template-columns:minmax(0,1fr)}.export-card .actions button{width:100%;padding:13px 10px}.history-row{flex-wrap:wrap;align-items:center}.history-row p{font-size:15px}.history-row small{font-size:12px}.review-item summary{padding:16px}.review-body{padding:0 16px 18px}.nav-actions button{padding:12px 10px;font-size:15px}.notice{font-size:13px}.brand{font-size:18px}.brand small{font-size:11px}.answer-panel summary{padding:10px 2px}.help{line-height:1.85}dialog .actions{display:grid;grid-template-columns:1fr 1fr}.actions .primary{flex-grow:0}}
@media(max-width:360px){.exam-head{flex-wrap:wrap}.exam-head>div:last-child{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;text-align:left!important}.exam-head>div:last-child .muted{font-size:12px}.exam-head>div:last-child .time{font-size:21px}.q-top{align-items:flex-start}.q-top button{font-size:12px;padding:8px 10px}.question,.card{padding:18px}.aside{padding:14px}.brand small{font-size:10px}.stats{justify-content:space-between;gap:12px}.result-stats b{font-size:23px}.score small{font-size:19px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/* Keep the home summary on one stable, shared alignment grid. */
.hero>.stats{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:0;
  flex:0 0 360px;
  min-width:0;
  margin:0;
  padding:18px 0;
  background:#edf2ec;
  border:1px solid var(--line);
  border-radius:16px;
}
.stats>div{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  min-width:0;
  padding:0 12px;
  gap:7px;
  text-align:center;
}
.stats>div+div{border-left:1px solid #ccd9d1}
.stats dt{
  order:1;
  margin:0;
  color:#526864;
  font-size:13px;
  font-weight:500;
  line-height:1.5;
  white-space:nowrap;
}
.stats dd{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:4px;
  margin:0;
  line-height:1.15;
}
.stat-value{
  font-size:32px;
  font-weight:750;
  font-variant-numeric:tabular-nums lining-nums;
  letter-spacing:-.5px;
}
.stat-unit{color:#526864;font-size:12px;font-weight:500;line-height:1.5}
@media(max-width:980px){
  .hero>.stats{width:100%;margin:24px 0 0;flex-basis:auto}
}
@media(max-width:600px){
  .hero>.stats{margin-top:20px;padding:16px 0;border-radius:14px}
  .stats>div{padding:0 6px;gap:6px}
  .stat-value{font-size:30px}
}
@media(max-width:360px){
  .stat-value{font-size:28px}
  .stats dt{font-size:12px}
  .stat-unit{font-size:11px}
}

/* Match the question-card navigation and give the answer card clear sections. */
.mobile-card-toggle{display:none}
.exam-progress{display:flex;align-items:center;gap:8px}
.answer-summary-content{display:inline-flex;width:calc(100% - 20px);align-items:center;justify-content:space-between;gap:10px;vertical-align:middle}
.answer-summary-content .muted{white-space:nowrap;font-weight:400}
.aside[hidden]{display:none}
.answer-groups{max-height:480px;max-height:min(56vh,480px);overflow-y:auto;overscroll-behavior:contain;padding:4px}
.answer-subject+.answer-subject{margin-top:24px}
.answer-subject-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:4px 0 14px}
.answer-subject-head h2{font-size:17px;line-height:1.5;margin:0;color:var(--accent)}
.answer-group+.answer-group{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.answer-group-head{display:flex;align-items:baseline;justify-content:space-between;gap:6px 12px;flex-wrap:wrap}
.answer-group-head h3{font-size:13px;font-weight:650;line-height:1.6;margin:0}
.group-status{color:var(--muted);font-size:11px;line-height:1.6;white-space:nowrap}
.answer-groups .grid{max-height:none;overflow:visible;margin:8px 0 0;padding:3px}
@media(max-width:980px){
  body[data-view=exam]{--exam-navigation-gap:max(48px,env(safe-area-inset-bottom));--exam-navigation-bottom:calc(var(--exam-navigation-gap) + var(--exam-keyboard-inset,0px))}
  body[data-view=exam] .top,body[data-view=exam] footer{display:none}
  body[data-view=exam] main{padding-top:8px;padding-bottom:calc(32px + env(safe-area-inset-bottom))}
  .exam-head{
    position:sticky;top:0;z-index:10;display:flex;flex-wrap:nowrap;align-items:center;
    gap:10px;min-height:64px;margin:0 0 10px;padding:8px 0;
    background:var(--bg);border-bottom:1px solid var(--line);
  }
  .exam-head .eyebrow{display:none}
  .exam-head h1{font-size:18px;line-height:1.4;letter-spacing:0;margin-bottom:2px}
  .exam-head>div:first-child .muted{font-size:12px;white-space:nowrap}
  .exam-progress{gap:6px}
  .exam-progress .mobile-card-toggle{display:block;min-height:44px;min-width:44px;padding:4px;color:var(--accent);font-size:12px;white-space:nowrap}
  body[data-view=exam] .exam-head>.exam-clock{
    display:grid;grid-template-columns:auto auto;align-items:center;gap:2px 8px;
    min-width:0;width:auto;flex-shrink:0;
  }
  .exam-head .exam-clock>.muted{font-size:10px;line-height:1.4;white-space:nowrap;text-align:right}
  .exam-head .exam-clock .time{font-size:20px;line-height:1.25;text-align:right}
  .exam-clock #home{grid-column:2;grid-row:1 / 3;min-width:72px;min-height:44px;padding:8px 6px;font-size:12px;white-space:nowrap}
  .exam-layout{gap:10px}
  .aside{order:-1;padding:0 12px 14px;border-radius:16px;box-shadow:none;scroll-margin-top:var(--exam-header-offset,80px)}
  .answer-panel>summary{min-height:44px;padding:10px 0;font-size:14px;line-height:1.6}
  .answer-groups{max-height:420px;max-height:min(52vh,420px)}
  .aside .help{margin:10px 0 0}
  .aside .save-line{margin-top:12px}
  .question{padding:16px;scroll-margin-top:var(--exam-header-offset,80px)}
  .q-top{align-items:center;gap:8px;margin-bottom:12px}
  .q-code{font-size:12px;letter-spacing:0;flex-basis:100px}
  .q-top button{min-height:44px;padding:8px 10px;font-size:12px}
  .question h2{font-size:19px;line-height:1.6;margin-bottom:16px}
  .options{gap:12px}
  .option{min-height:52px;padding:12px;gap:8px;scroll-margin-bottom:calc(100px + var(--exam-navigation-bottom))}
  .option span{font-size:16px;line-height:1.5}
  .question #clear{font-size:13px;margin-top:4px}
  .question textarea{height:clamp(220px,40dvh,340px);min-height:220px;scroll-margin-bottom:calc(100px + var(--exam-navigation-bottom))}
  .nav-actions{
    position:sticky;bottom:var(--exam-navigation-bottom);z-index:5;
    display:flex;justify-content:space-between;gap:12px;
    margin:24px 0 0;padding:10px 0 0;background:var(--paper);
  }
  .nav-actions button{flex:1;width:auto;max-width:220px;min-width:44px;min-height:48px;padding:11px 8px;font-size:15px;line-height:1.4;white-space:nowrap}
  .nav-actions .nav-arrow{display:inline}
  body[data-view=exam] #toast{bottom:calc(100px + var(--exam-navigation-bottom))}
}
@media(max-width:980px) and (max-height:560px){
  body[data-view=exam]{--exam-navigation-gap:max(32px,env(safe-area-inset-bottom))}
}

/* Show the question first; math explanations are optional help. */
.question [hidden]{display:none!important}
.answer-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px}
.lesson-open{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:8px 12px;font-size:14px;white-space:nowrap}
.help-dot{display:inline-grid;place-items:center;width:18px;height:18px;border:1px solid currentColor;border-radius:50%;font-size:12px;line-height:1;flex-shrink:0}
.lesson-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 16px}
.lesson-tools button{flex-shrink:0;min-height:44px;padding:8px 12px;font-size:14px}
.lesson-tools .muted{font-size:12px;text-align:right}
.spelling-analysis{margin-top:20px}
.spelling-analysis h3{font-size:16px;line-height:1.7;margin:0 0 12px}
.spelling-list{list-style:none;margin:0;padding:0;display:grid;gap:12px}
.spelling-item{padding:14px;border:1px solid var(--line);border-radius:12px;background:#fafbf7}
.spelling-head{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:14px;margin-bottom:12px}
.spelling-outcome{padding:3px 8px;border-radius:8px;font-size:12px;font-weight:600;white-space:nowrap}
.spelling-outcome.has-error{background:#fae9e1;color:#924b35}
.spelling-outcome.is-correct{background:#e5f0e5;color:#276642}
.spelling-comparison{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:8px}
.spelling-comparison.single-word{grid-template-columns:minmax(0,1fr)}
.spelling-word{min-width:0}
.spelling-word small{display:block;font-size:11px;color:var(--muted);margin-bottom:4px}
.spelling-word>div{font-size:22px;line-height:1.6;overflow-wrap:anywhere}
.spelling-wrong,.spelling-right{padding:0 2px;border-radius:4px;font-weight:750;text-decoration:underline;text-underline-offset:4px}
.spelling-wrong{color:#924b35;background:#fae9e1}
.spelling-right{color:#276642;background:#e5f0e5}
.spelling-arrow{font-size:18px;color:var(--muted)}
.spelling-item p{margin:12px 0 0;font-size:14px;line-height:1.85;overflow-wrap:anywhere}
.lesson-intro{padding:18px;background:#edf4ed;border:1px solid #d4e3d6;border-radius:14px;margin:0 0 24px}
.lesson-label{display:block;color:var(--accent);font-size:12px;font-weight:650;margin-bottom:6px}
.lesson-intro h3{font-size:19px;line-height:1.6;margin:0 0 10px}
.lesson-intro p{font-size:15px;line-height:1.85;margin:0}
.lesson-block{margin:0 0 24px}
#math-lesson h4{font-size:16px;line-height:1.6;font-weight:700;margin:0 0 12px}
.lesson-block p,.lesson-example p,.lesson-example li,.lesson-memory li,.lesson-pitfall{font-size:16px;line-height:1.85;overflow-wrap:anywhere}
.lesson-block p:last-child{margin-bottom:0}
.lesson-terms{margin:0;border-top:1px solid var(--line)}
.lesson-terms>div{display:grid;grid-template-columns:minmax(90px,1fr) minmax(0,2.8fr);gap:16px;padding:13px 0;border-bottom:1px solid var(--line)}
.lesson-terms dt{font-size:15px;line-height:1.8;font-weight:650;color:var(--accent);overflow-wrap:anywhere}
.lesson-terms dd{margin:0;font-size:15px;line-height:1.8;overflow-wrap:anywhere}
.lesson-example{padding:18px;border:1px solid #e5ddc8;border-radius:14px;background:#faf7ef;margin:0 0 24px}
.lesson-example .example-prompt{font-weight:600;margin:0 0 12px}
.lesson-example ol{padding-left:24px;margin:0 0 14px}
.lesson-example li{padding-left:2px;margin-bottom:10px}
.lesson-example li:last-child{margin-bottom:0}
.lesson-example .example-conclusion{margin:0;padding-top:12px;border-top:1px solid #e5ddc8;font-size:15px;color:#735827}
.lesson-memory{margin:0 0 20px;padding-left:14px;border-left:3px solid #8aab92}
.lesson-memory ul{margin:0;padding-left:20px}
.lesson-memory li+li{margin-top:8px}
.lesson-pitfall{margin:0 0 20px;color:#735827}
.lesson-finish{font-size:13px;line-height:1.85;color:var(--muted);margin:0}
.lesson-diagram{margin:16px 0 0;padding:12px;border:1px solid var(--line);border-radius:12px;background:#f7faf5}
.lesson-diagram svg{display:block;width:100%;max-width:330px;height:auto;margin:0 auto}
.lesson-diagram text{fill:var(--ink);font-family:inherit;font-size:15px}
.lesson-diagram figcaption{text-align:center;font-size:12px;line-height:1.7;color:var(--muted);margin-top:6px}
@media(max-width:600px){
 .lesson-intro{padding:14px;margin-bottom:20px}
 .lesson-intro h3{font-size:18px}
 .lesson-terms>div{grid-template-columns:minmax(76px,1fr) minmax(0,2.4fr);gap:12px}
 .lesson-terms dt,.lesson-terms dd{font-size:15px}
 .lesson-example{padding:14px;margin-bottom:20px}
 .lesson-memory{padding-left:12px}
 .lesson-diagram{padding:8px}
 .question[data-math-stage=answer] .q-top{margin-bottom:8px}
 .question[data-math-stage=answer] h2{margin-bottom:12px}
 .question[data-math-stage=answer] .options{gap:10px}
 .question[data-math-stage=answer] .option{min-height:48px;padding:10px 12px}
 .question[data-math-stage=answer] .option b{line-height:1.5}
}
