

:root{color-scheme:light;--ink:#172522;--muted:#51635c;--dark:#122f2a;--surface:#fff;--background:#f3f5f0;--border:#dbe3da;--accent:#ccef9b;--green:#20543a;--radius:18px}
*{box-sizing:border-box}
body{margin:0;background:var(--background);color:var(--ink);font:16px/1.55 "Segoe UI",system-ui,sans-serif}
button,select{font:inherit}
button{cursor:pointer}
a{color:inherit}
:focus-visible{outline:3px solid #527a29;outline-offset:4px}
[hidden]{display:none!important}
.skip{position:absolute;top:8px;left:8px;z-index:3;background:white;padding:8px;transform:translateY(-200%)}
.skip:focus{transform:none}
.shell{min-height:100vh;display:grid;grid-template-columns:232px minmax(0,1fr)}
.sidebar{background:var(--dark);color:#fff;padding:30px 20px;position:sticky;top:0;height:100vh;display:flex;flex-direction:column;gap:42px}
.brand{display:flex;align-items:center;gap:12px;font-size:29px;font-weight:760;letter-spacing:-.05em}
.brand-icon{display:grid;place-items:center;width:42px;height:42px;background:var(--accent);color:var(--dark);border-radius:12px;font-size:21px;letter-spacing:0}
.nav-label{display:block;margin:0 0 9px 12px;color:#bbccc1;font-size:.78rem;font-weight:700}
.nav{display:grid;gap:5px}
.nav button{display:flex;align-items:center;gap:10px;text-align:left;padding:11px 12px;border:0;border-radius:10px;background:transparent;color:#e0e9e2;font-weight:600;min-width:0}
.nav button[aria-current="page"]{background:#2a493e;color:#e2f6c7}
.nav button:hover{background:#2a493e}
.nav button:focus-visible{outline-color:var(--accent)}
.side-note{margin:auto 0 0;padding:12px;color:#b8ccc0;font-size:.82rem}
.main{width:100%;max-width:1260px;margin:0 auto;padding:36px clamp(20px,4vw,60px) 56px;min-width:0}
.breadcrumb{color:var(--muted);font-weight:650;font-size:.86rem;margin:0 0 13px}
.hero{position:relative;overflow:hidden;isolation:isolate;background:#dfebd4;border:1px solid #d5e3c8;border-radius:22px;padding:29px clamp(20px,3.7vw,43px);margin-bottom:22px}
.hero::after{content:"";position:absolute;z-index:-1;right:-24px;top:-51px;width:260px;height:260px;border-radius:50%;background:repeating-radial-gradient(circle,#b8ccaa 0 1px,transparent 1px 18px);opacity:.62;mask-image:linear-gradient(90deg,transparent,#000)}
h1,h2,h3,p{margin-top:0}
h1{font:700 clamp(2rem,4.7vw,3.4rem)/1.06 Georgia,serif;letter-spacing:-.046em;margin-bottom:10px}
.hero p{color:#3e5846;margin:0;max-width:39rem}
.filters,.question,.index,.progress-panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius)}
.filters{padding:16px 20px;display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin-bottom:20px}
.filters label{display:grid;gap:5px;flex:1 1 135px;color:var(--muted);font-size:.84rem;font-weight:650;min-width:0}
select{width:100%;min-height:42px;border:1px solid #cbd7cb;border-radius:9px;padding:7px 29px 7px 10px;background:#fbfcfa;color:var(--ink)}
.button{border:1px solid #cbd7cb;border-radius:9px;padding:9px 13px;background:white;color:var(--ink);font-weight:650;min-height:42px}
.button:hover:not(:disabled){background:#eff4eb}
.button:disabled{opacity:.55;cursor:default}
.primary{background:var(--dark);color:#fff;border-color:var(--dark)}
.primary:hover:not(:disabled){background:#254b3e}
.workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(188px,225px);gap:18px;align-items:start}
.question{padding:clamp(17px,3vw,31px);min-width:0}
.question-top,.actions,.question-nav,.progress-line{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.tag{display:inline-block;padding:4px 10px;background:#e6f1df;color:#28513a;border-radius:999px;font-weight:750;font-size:.8rem}
.count,.source,.index p,.muted{color:var(--muted)}
.count,.source{font-size:.83rem}
.topic{margin:15px 0 7px;font-size:1.28rem;line-height:1.3}
.source{margin-bottom:19px}
.stem{overflow-wrap:anywhere}
.stem p:last-child{margin-bottom:0}
.math-line{overflow-x:auto;max-width:100%;padding-block:2px}
math{font-size:1.12em}
.figure{margin:17px 0;max-width:520px}
.figure img{display:block;max-width:100%;max-height:340px;object-fit:contain;object-position:left;border:1px solid var(--border);border-radius:9px;background:white}
.figure figcaption{color:var(--muted);font-size:.82rem;margin-top:5px}
fieldset{padding:0;border:0;margin:18px 0 20px;min-width:0}
legend{padding:0;margin-bottom:8px;font-weight:650;font-size:.91rem}
.choices{display:grid;gap:8px}
.choice{display:flex;align-items:center;gap:11px;min-height:47px;border:1px solid var(--border);border-radius:10px;padding:7px 10px;cursor:pointer;overflow-wrap:anywhere}
.choice:hover{background:#f5f8f2}
.choice:has(input:disabled){cursor:default}
.choice:has(input:checked){border-color:#568447;background:#edf5e7}
.choice.correct{border-color:#63935e;background:#e6f4e4}
.choice.wrong{border-color:#a85e57;background:#f9ecea}
.choice input{position:absolute;opacity:0;width:18px;height:18px;margin:0}
.choice:has(input:focus-visible){outline:3px solid #527a29;outline-offset:2px}
.letter{flex:0 0 28px;height:28px;border-radius:8px;background:#ecf1e9;display:grid;place-items:center;font-weight:750;font-size:.84rem}
.choice-note{margin-left:auto;font-size:.82rem;font-weight:650}
.feedback{background:#edf5e7;border:1px solid #caddc3;border-radius:10px;padding:13px;margin:14px 0 0}
.feedback.wrong{background:#fbf1ee;border-color:#e8c9c2}
.feedback p{margin:5px 0 0}
.question-nav{border-top:1px solid var(--border);margin-top:19px;padding-top:14px}
.index{padding:17px}
.index h2{font-size:1rem;margin-bottom:3px}
.index p{font-size:.83rem;margin-bottom:10px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(38px,1fr));gap:6px}
.grid button{min-height:39px;padding:2px;background:white;color:var(--ink);border:1px solid var(--border);border-radius:8px;font-weight:700}
.grid button.done{background:#e4efdc}
.grid button[aria-current="true"]{background:var(--dark);color:white;border-color:var(--dark)}
.progress-panel{padding:clamp(16px,3vw,28px)}
.progress-panel h2{font-size:1.19rem}
.progress-line{margin-bottom:7px;font-weight:650}
progress{display:block;width:100%;height:14px;accent-color:#497c47;margin-bottom:15px}
.metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:0 0 22px}
.metrics div{border:1px solid var(--border);padding:10px;border-radius:10px}
.metrics dt{font-size:.82rem;color:var(--muted)}
.metrics dd{margin:0;font-weight:750;font-size:1.4rem}
.empty p:last-child{margin-bottom:0}
.notice{background:#fff0cc;border-radius:8px;padding:10px}
.sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

@media(max-width:960px){.shell{grid-template-columns:192px minmax(0,1fr)}.sidebar{padding-inline:14px}.workspace{grid-template-columns:minmax(0,1fr)}.grid{grid-template-columns:repeat(auto-fill,minmax(42px,1fr))}}
@media(max-width:650px){.shell{display:block}.sidebar{height:auto;position:static;gap:10px;padding:10px 15px 12px}.brand{font-size:23px}.brand-icon{width:32px;height:32px;font-size:17px}.nav{display:flex;flex-wrap:wrap}.nav button{font-size:.9rem;padding:7px 9px;min-height:40px}.side-note,.nav-label{display:none}.main{padding:17px 12px 35px}.breadcrumb{margin-bottom:8px}.hero{padding:21px 16px;margin-bottom:13px}.hero::after{opacity:.32;width:160px;height:160px}.filters{padding:12px;gap:8px;margin-bottom:13px}.filters label{flex-basis:120px}.filters button{flex:1 1 120px}.workspace{gap:12px}}

.study-filters{display:grid;gap:15px}
.study-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.study-filters label{min-width:0}
.study-filters input[type=search]{width:100%;min-height:42px;border:1px solid #cbd7cb;border-radius:9px;padding:7px 10px;background:#fbfcfa;color:var(--ink);font:inherit;font-size:1rem;font-weight:400}
.study-filters select{text-overflow:ellipsis}
.study-filters .study-check{display:flex;align-items:center;gap:8px;justify-self:start;color:var(--ink);font-size:.93rem}
.study-check input{width:18px;height:18px;accent-color:var(--dark);margin:0}
.study-checks{display:flex;flex-wrap:wrap;gap:8px 20px}
.study-filter-footer,.study-filter-actions,.study-chips{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.study-filter-footer{border-top:1px solid var(--border);padding-top:12px;justify-content:space-between}
.study-filter-actions{margin-left:auto}
.study-filter-actions .button{flex:0 0 auto}
.study-chip{border:1px solid #c4d8ba;border-radius:999px;background:#edf5e7;padding:5px 10px;color:#264835;font-size:.85rem}
.study-chip:hover{background:#e1eed7}
.study-toolbar,.study-paging{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:13px}
.study-toolbar p{margin:0;font-size:.93rem}
.study-paging{margin-top:16px}
.study-results{display:grid;gap:14px}
.study-card .topic{margin:10px 0 15px}
.study-card .question-top .count{font-size:.9rem}
.study-card .actions{justify-content:flex-start}
.study-figure{margin:0 0 16px}
.study-figure img{display:block;width:auto;max-width:100%;height:auto;border-radius:8px}
.study-excerpt{margin:0 0 12px}
.study-excerpt img{display:block;max-width:100%;height:auto;object-fit:contain}
.study-transcript{margin:12px 0;font-size:.93rem;color:var(--muted)}
.study-transcript summary{cursor:pointer}
.study-transcript .study-stem{margin:8px 0 0;color:var(--ink)}
.study-note{font-size:.9rem;color:var(--muted)}
.study-letter-options{display:flex;flex-wrap:wrap;gap:7px}
.study-letter-options .choice{min-width:56px}
.study-stem,.study-option{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%;min-width:0}
.study-card fieldset{min-width:0;max-width:100%}
.study-card .letter{flex-shrink:0}
.study-stem p:last-child{margin-bottom:0}
.study-card [data-retry]{margin-top:10px}
.study-metrics-section{margin:24px 0 0}
.study-metrics-section p{margin-bottom:0}
@media(max-width:560px){.study-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.study-search{grid-column:1/-1}.study-paging{gap:8px}.study-paging button{flex:1 1 120px}}

#adaptive-content{display:grid;gap:1rem}
.adaptive-panel{background:var(--surface);border:1px solid var(--border);border-radius:1.2rem;padding:clamp(1rem,3vw,1.7rem);min-width:0}
.adaptive-panel h2{margin:0 0 .45rem;font-size:1.25rem}
.adaptive-panel h3{margin:0;font-size:1rem;overflow-wrap:anywhere}
.adaptive-panel p{margin:.45rem 0;overflow-wrap:anywhere}
.adaptive-config{display:flex;gap:.75rem;align-items:end;flex-wrap:wrap;margin-top:1rem}
.adaptive-config label{display:grid;gap:.3rem;flex:1 1 11rem;min-width:0;color:var(--muted);font-size:.9rem;font-weight:650}
.adaptive-config select{width:100%;min-width:0}
.adaptive-actions{display:flex;gap:.55rem;align-items:center;flex-wrap:wrap;margin-top:1rem}
.adaptive-actions button{overflow-wrap:anywhere}
.adaptive-stem{margin:1rem 0;overflow-wrap:anywhere}
.adaptive-transcript{white-space:pre-wrap}
.adaptive-figure{margin:1rem 0}
.adaptive-figure img{display:block;max-width:100%;height:auto}
.adaptive-review{margin-top:1rem;padding:.7rem .85rem;border:1px solid var(--border);border-radius:.7rem;background:#f6f8f5}
.adaptive-review strong{display:block}
.adaptive-stem p,.adaptive-review p{white-space:normal}
.adaptive-themes{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,17rem),1fr));gap:.65rem;margin-top:1rem}
.adaptive-theme{display:grid;gap:.45rem;border:1px solid var(--border);border-radius:.75rem;padding:.75rem;min-width:0}
.adaptive-theme p{margin:0}
.adaptive-theme .button{justify-self:start}
.adaptive-theme progress{width:100%;height:.75rem;accent-color:#286148}
.adaptive-status{color:var(--muted);font-size:.9rem}
@media(max-width:420px){.adaptive-config label,.adaptive-config>.button,.adaptive-actions>.button{flex:1 1 100%}}

.study-hero {
  display: grid;
  gap: 16px;
  align-items: start;
}

.study-hero:has(.account-controls:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; }

.account-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px 10px;
  max-width: 22rem;
  min-width: 0;
}

.account-status,
.account-email {
  color: var(--dark);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.account-email {
  font-weight: 650;
  max-width: 15rem;
}

.account-status {
  flex: 1 0 100%;
  text-align: end;
}

.account-status:empty { display: none; }

.account-dialog {
  width: min(28rem, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: clamp(16px, 4vw, 26px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
}

.account-dialog::backdrop { background: rgb(14 35 31 / 65%); }

.account-heading, .account-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.account-heading { margin-bottom: 18px; }
.account-heading h2 { margin: 0; font-size: 1.35rem; }
.account-actions { margin-top: 12px; }
.account-dialog form, .account-dialog label { display: grid; gap: 6px; }
.account-dialog form { gap: 14px; }
.account-dialog label { font-weight: 650; }

.account-dialog input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #9dab9f;
  border-radius: 9px;
  color: var(--ink);
  background: #fbfcfa;
  font: inherit;
}

.account-link {
  min-height: 44px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--green);
  text-decoration: underline;
  font-weight: 650;
}

.account-link:disabled { opacity: .55; }
.account-message { margin: 0; color: var(--green); font-size: .94rem; }
.account-message[data-error] { color: #8b2c23; }

.comments-ready .question-comments { display: block; }

.question-comments {
  display: none;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.question-comments summary {
  width: fit-content;
  min-height: 44px;
  padding: 10px 2px;
  color: var(--green);
  font-weight: 650;
  cursor: pointer;
}

.comments-panel, .comments-list, .comments-form:not([hidden]), .comments-form label {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.comments-panel > button { justify-self: start; }
.comments-list { margin: 0; padding: 0; list-style: none; }
.comments-list:empty, .comments-status:empty, .comments-actions:not(:has(:not([hidden]))) { display: none; }

.comments-list li {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.comment-heading, .comments-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.comment-heading time, .comments-status { color: var(--dark); font-size: .875rem; }
.comment-remove { margin-inline-start: auto; font-size: .875rem; }
.comment-text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments-actions p, .comments-status { margin: 0; }
.comments-form .comments-actions { justify-content: space-between; }
.comments-form label { font-weight: 650; }

.comments-form textarea {
  width: 100%;
  min-height: 5.5rem;
  padding: 10px 12px;
  border: 1px solid #9dab9f;
  border-radius: 9px;
  color: var(--ink);
  background: #fbfcfa;
  font: inherit;
  resize: vertical;
}

@media (max-width: 780px) {
  .study-hero:has(.account-controls:not([hidden])) { grid-template-columns: 1fr; }
  .account-controls { justify-content: flex-start; }
  .account-status { text-align: start; }
}

