:root {
  color-scheme: light;
  --ink: #153730;
  --muted: #4c645d;
  --brand: #174f43;
  --accent: #e1f391;
  --line: #d0dbd1;
  --paper: #fffefa;
  --canvas: #f2f3ed;
  font: 16px/1.55 system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); text-underline-offset: .22em; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid #a05e19; outline-offset: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: .75rem; top: -5rem; z-index: 2; background: var(--paper); padding: .65rem; }
.skip:focus { top: .75rem; }
.header { display: flex; align-items: center; justify-content: space-between; padding: .9rem max(1.15rem, calc((100% - 1160px) / 2)); border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: inline-flex; gap: .6rem; align-items: center; text-decoration: none; color: var(--ink); font-size: 1.1rem; font-weight: 750; }
.brand span { display: grid; place-items: center; width: 2rem; height: 2rem; background: var(--brand); color: var(--accent); border-radius: .6rem; font-weight: 850; }
.top-signin { font-weight: 650; padding: .25rem .1rem; }
.header-links { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .25rem .7rem; font-size: .9rem; margin-left: .6rem; }
.layout { width: min(1160px, 100%); margin-inline: auto; padding: 2rem 1rem 4rem; display: grid; grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.65rem); align-items: start; }
.topic-sidebar { position: sticky; top: 1rem; }
#topic-nav { border: 1px solid var(--line); background: var(--paper); border-radius: .9rem; padding: 1rem .75rem; max-height: calc(100vh - 2rem); overflow: auto; }
#topic-nav h2 { font-size: 1rem; margin: 0 .45rem .55rem; }
#topic-nav details { border-top: 1px solid var(--line); padding: .25rem 0; }
#topic-nav summary { cursor: pointer; font-weight: 650; padding: .45rem; }
#topic-nav a { display: block; padding: .35rem .5rem .35rem 1rem; line-height: 1.4; border-radius: .4rem; font-size: .875rem; text-decoration: none; }
#topic-nav a:hover { text-decoration: underline; }
#topic-nav a[aria-current] { background: var(--brand); color: white; font-weight: 600; }
.topic-toggle { display: none; }
main { min-width: 0; scroll-margin-top: 1rem; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -.025em; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.45rem); font-weight: 760; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 720; }
h3 { font-size: 1.3rem; }
p { margin-block: .7rem 0; }
.intro { font-size: 1.05rem; color: var(--muted); max-width: 65ch; }
.course-label { color: var(--muted); font-weight: 700; font-size: .875rem; margin: 0 0 .45rem; }
.lesson-links, .result-actions { display: flex; gap: .5rem 1rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.lesson-links a { font-weight: 600; font-size: .9rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1rem, 3vw, 1.65rem); margin-top: 1.1rem; scroll-margin-top: 1rem; }
.diagram { margin: .85rem 0 .5rem; background: #edf2e8; border-radius: .75rem; }
.diagram svg { width: 100%; max-height: 18rem; display: block; }
.range-label { display: flex; justify-content: space-between; font-weight: 650; }
input[type="range"] { width: 100%; min-height: 1.9rem; margin: .2rem 0 .6rem; accent-color: var(--brand); }
button, .button { display: inline-block; cursor: pointer; padding: .55rem .9rem; border: 1px solid var(--brand); border-radius: .5rem; background: var(--brand); color: white; font-weight: 650; text-decoration: none; }
button:hover, .button:hover { filter: brightness(.93); }
button:disabled { opacity: .65; cursor: default; }
.quiet { background: var(--paper); color: var(--brand); border-color: #a1b4a9; }
.explanation, .results { margin: .85rem 0 0; background: #eaf2e4; border-left: 4px solid var(--brand); border-radius: .4rem; padding: .8rem 1rem; }
.explanation p { margin-top: .3rem; }
.steps { margin-bottom: 0; padding-left: 1.4rem; }
.steps li + li { margin-top: .3rem; }
#questions { margin: .85rem 0; display: grid; gap: .95rem; }
fieldset { min-width: 0; margin: 0; padding: .65rem .7rem .7rem; border-radius: .6rem; border: 1px solid var(--line); }
legend { padding: 0 .28rem; font-weight: 650; }
.options { display: flex; gap: .4rem; flex-wrap: wrap; }
.options label { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; border: 1px solid var(--line); border-radius: .45rem; padding: .45rem .7rem; min-height: 2.65rem; }
.options label:has(:checked) { background: #e2efe7; border-color: var(--brand); }
.options input { accent-color: var(--brand); }
.feedback { font-size: .95rem; }
.feedback strong { color: var(--brand); }
#topic-overview .result-actions { margin-top: 1.2rem; }

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; gap: .85rem; padding-top: .85rem; }
  .topic-sidebar { position: static; }
  .topic-toggle { display: inline-flex; gap: 1rem; align-items: center; }
  #topic-nav { display: none; margin-top: .5rem; max-height: min(45vh, 25rem); }
  .topic-toggle[aria-expanded="true"] + #topic-nav { display: block; }
}
