:root {
  color-scheme: light;
  --paper: #f5f4ee;
  --surface: #fffef9;
  --ink: #182b27;
  --muted: #515f54;
  --border: #d9ded1;
  --accent: #1e5f48;
  --deep: #11382e;
  --good: #216340;
  --retry: #944321;
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #b76c20; outline-offset: 3px; }
.frame { max-width: 69rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar { display: flex; gap: 1rem; justify-content: space-between; align-items: center; min-height: 4rem; }
.brand { color: var(--ink); font-weight: 750; text-decoration: none; }
main { padding-block: 2rem 4rem; }
h1, h2, h3, p, ul, ol { margin-block: 0 1rem; }
h1, h2, h3 { line-height: 1.18; }
h1 { font-size: clamp(2rem, 5.5vw, 3.35rem); letter-spacing: -.045em; }
h2 { font-size: 1.45rem; letter-spacing: -.02em; }
h3 { font-size: 1.12rem; }
p:last-child, ul:last-child { margin-bottom: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: .9rem; padding: clamp(1rem, 3vw, 1.65rem); min-width: 0; }
.hero { background: var(--deep); color: #f8fcf7; border-radius: 1.1rem; padding: clamp(1.5rem, 5vw, 3.25rem); }
.hero .eyebrow, .hero p { color: #d7e8dd; }
.hero .button { background: #ecf5d8; color: var(--deep); border-color: #ecf5d8; }
.hero .secondary { background: transparent; color: #f8fcf7; }
.hero .button:hover { background: #dcebc4; color: var(--deep); }
.eyebrow { font-size: .82rem; font-weight: 750; letter-spacing: .06em; color: var(--muted); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem 1rem; margin-block: 1rem 0; }
.button { display: inline-block; padding: .56rem .95rem; background: var(--accent); border: 1px solid var(--accent); border-radius: .5rem; color: white; font-weight: 650; text-decoration: none; }
.button:hover { background: var(--deep); color: white; }
.secondary { color: var(--accent); background: var(--surface); }
.link { background: none; border: none; color: var(--accent); padding: .35rem 0; text-decoration: underline; }
.dashboard { display: grid; gap: 2rem; }
.course-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr)); gap: 1rem; }
.topic h3 a { color: var(--ink); }
.skills, .history { list-style: none; padding-inline-start: 0; }
.skills li, .history li { border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: space-between; padding-block: .55rem; }
.history { padding-inline: 1rem; }
.history li:first-child { border-top: 0; }
time, .muted { color: var(--muted); }
.good { color: var(--good); font-weight: 650; }
.retry, .error { color: var(--retry); font-weight: 650; }
.back { margin-bottom: 1rem; }
.lesson, .exercise { max-width: 50rem; }
.lesson h2 { margin-top: 1.8rem; scroll-margin-top: 1rem; }
.lesson h2:target { text-decoration: underline; text-decoration-color: #8db487; text-underline-offset: .26em; }
.lesson img {
  display: block;
  width: 100%;
  max-width: 46rem;
  height: auto;
  margin-block: .9rem 1.25rem;
  background: #fff;
}
.lesson table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin-bottom: 1rem; }
.lesson th, .lesson td { border: 1px solid var(--border); padding: .55rem .65rem; text-align: left; }
code { background: #ecf1e6; padding: .14em .26em; border-radius: .2em; }
.signin { max-width: 32rem; margin: 2rem auto; }
.stack { display: grid; gap: 1rem; }
.stack > .button { justify-self: start; }
.signin label { display: grid; gap: .35rem; }
input:not([type="radio"], [type="hidden"]), select { border: 1px solid #879388; background: white; color: var(--ink); padding: .5rem .6rem; border-radius: .38rem; width: 100%; max-width: 24rem; }
fieldset { margin: 0; min-inline-size: 0; }
.question legend { max-width: 100%; font-weight: 700; padding-inline: .35rem; }
.question legend span { color: var(--muted); }
.option { display: flex; gap: .65rem; align-items: start; padding-block: .42rem; cursor: pointer; }
.option input { accent-color: var(--accent); margin-top: .38rem; }
.hint { display: block; margin-top: .8rem; }
.abandon { margin-top: 1rem; }
.results { padding-left: 1.4rem; margin-top: 1.5rem; }
.results h2 { font-size: 1.18rem; }
.skip { position: absolute; transform: translateY(-140%); background: var(--surface); padding: .5rem; }
.skip:focus { transform: none; }
pre { background: #ecf1e6; border-radius: .45rem; overflow: auto; padding: .75rem; }
pre code { padding: 0; }

.research { display: grid; gap: 1.35rem; max-width: 50rem; }
.research .stack { gap: .85rem; }
.research .stack h2, .research .stack p { margin-bottom: 0; }
.research-field { display: grid; gap: .4rem; }
.research label, .research-summary dt { font-weight: 650; }
.research input[type="text"] { max-width: none; }
.research textarea {
  display: block;
  width: 100%;
  min-height: 5rem;
  padding: .55rem .65rem;
  border: 1px solid #879388;
  border-radius: .38rem;
  background: white;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.research-ai { border: 1px solid var(--border); border-radius: .5rem; padding: .7rem .9rem; }
.research-ai summary { cursor: pointer; font-weight: 650; }
.research-ai textarea { margin-top: .65rem; }
.research [hidden] { display: none; }
.skip-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.fraction-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: .7rem 1rem;
}
.fraction-picks label { display: grid; gap: .32rem; }
.fraction-picks select { max-width: none; min-width: 0; }
.research [id] { scroll-margin-top: .8rem; }
.model-feedback { border-left: 3px solid var(--border); padding-left: .8rem; }
.model-feedback table { border-collapse: collapse; margin-bottom: .55rem; }
.model-feedback th, .model-feedback td { padding: .25rem .75rem; text-align: start; border-bottom: 1px solid var(--border); }
.research-note, .research-summary dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.research-summary { margin: 0; }
.research-summary dd { margin: 0 0 .75rem; }
.research-summary dd:last-child { margin-bottom: 0; }
.fraction-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: .5rem;
}
.fraction-slot {
  border: 1px solid var(--border);
  border-radius: .38rem;
  background: #f4f4ef;
  padding: .55rem .65rem;
}
.fraction-slot p { margin-top: .15rem; color: var(--muted); }
.research-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  column-gap: 1.5rem;
  list-style: none;
  padding: 0;
}
.research-list li { border-top: 1px solid var(--border); padding-block: .6rem; }
.research-lesson { font-size: .85rem; margin: 0; }
.research-list small { display: block; }

.subject-nav { display: flex; gap: .5rem .9rem; flex-wrap: wrap; }
.subject-nav [aria-current="page"] { color: var(--ink); font-weight: 750; text-decoration: none; }
@media (max-width: 38rem) {
  .topbar { flex-wrap: wrap; gap: .15rem .9rem; padding-block: .55rem; }
  .subject-nav { flex-basis: 100%; order: 1; font-size: .93rem; }
}
.number-hint { font-size: .9rem; margin-block: 0 .4rem; }
