:root {
  --bg: #F7F6F2; --card: #FDFCFA; --text: #1E2533; --muted: #4A5568;
  --accent: #2459C7; --hi: #E3893B; --head: #14213D;
  --ok: #1F7A45; --bad: #B42318; --line: #D9D6CC; --on-accent: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1626; --card: #16213A; --text: #E6EAF2; --muted: #A9B3C6;
    --accent: #7FA2FF; --hi: #F0A35E; --head: #F7F6F2;
    --ok: #5BC77A; --bad: #FF7A70; --line: #2B3857; --on-accent: #0E1626;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1.1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { color: var(--head); line-height: 1.25; }
h1 { font-size: 2rem; margin: 1.2rem 0 .4rem; }
h2 { font-size: 1.45rem; margin: 2rem 0 .6rem; }
h3, .h3 { font-size: 1.15rem; margin: 1.2rem 0 .4rem; }
a { color: var(--accent); }
p, li { max-width: 68ch; }
.muted { color: var(--muted); }
.lead { font-size: 1.2rem; color: var(--text); margin: 0 0 1.2rem; max-width: 60ch; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; z-index: 50; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1:focus { outline: none; }

.topbar { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--head); text-decoration: none; }
#nav { display: flex; gap: .25rem; flex-wrap: wrap; }
#nav a { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .8rem; border-radius: 8px; text-decoration: none; color: var(--text); }
#nav a:hover { background: var(--bg); }
#nav a[aria-current="page"] { color: var(--accent); font-weight: 700; box-shadow: inset 0 -3px 0 var(--hi); }
.notice, .notice-inline { background: var(--card); border: 1px solid var(--hi); border-left-width: 6px; padding: .6rem 1rem; margin: 0; }
.notice-inline { margin: 0 0 1rem; border-radius: 6px; max-width: 68ch; }

main { max-width: 56rem; margin: 0 auto; padding: 0 1rem 3rem; }
main:focus { outline: none; }
.foot { max-width: 56rem; margin: 0 auto; padding: 0 1rem 2rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin: .8rem 0; }
.card > :first-child { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
ul.plain, ol.steps { list-style: none; padding: 0; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }
.crumb { margin: 1rem 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .4rem 1.1rem; font: inherit; font-size: 1rem; border: 2px solid var(--accent); background: transparent; color: var(--accent); border-radius: 8px; cursor: pointer; text-decoration: none; }
.btn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 44px; padding: .2rem .8rem; }

.meter { height: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--hi); transition: width .3s; }
.meter-label { margin: 0 0 .4rem; }
.step-head { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; }
.step-head h3 { margin: 0; flex: 1 1 14rem; }
.time { color: var(--muted); } .status { font-weight: 600; }
.step.done { border-left: 6px solid var(--ok); } .step.doing { border-left: 6px solid var(--hi); }
.step ul { margin-top: .5rem; }
.list-cards > li { margin: 0; max-width: none; }

.tag-answer { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--hi); }
.keyidea { border: 2px solid var(--accent); border-radius: 10px; padding: .8rem 1.2rem; background: var(--card); margin: .6rem 0 1.4rem; }
.keyidea p { margin: .2rem 0 0; font-size: 1.25rem; font-weight: 600; color: var(--head); }
.prose { max-width: 68ch; }
.prose h3 { margin-top: 1.6rem; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; font-size: .98rem; min-width: 100%; }
th, td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--card); color: var(--head); }

.before, .after { border-left: 6px solid var(--muted); padding: .2rem 0 .2rem 1rem; margin: .8rem 0; background: transparent; }
.after { border-left-color: var(--accent); }
.lbl { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.after .lbl { color: var(--accent); }
.plain-text { white-space: pre-wrap; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ba > div { min-width: 0; margin: 0; }
.ex-body p, .ex-body li { max-width: none; }
.example { margin: 2rem 0; }
.why { margin: .6rem 0; } .why summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent); font-weight: 600; }
@media (max-width: 760px) { .ba { grid-template-columns: 1fr; } }

/* quiz and drills */
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 1rem 0; padding: .8rem 1.2rem; background: var(--card); min-width: 0; }
legend { font-weight: 600; padding: 0 .4rem; color: var(--head); }
.opt { display: flex; gap: .7rem; align-items: flex-start; min-height: 44px; padding: .45rem .3rem; cursor: pointer; }
.opt input { width: 1.3rem; height: 1.3rem; margin-top: .25rem; flex: none; accent-color: var(--accent); }
.feedback { margin: .5rem 0 0; }
.feedback.ok { color: var(--ok); } .feedback.bad { color: var(--bad); }
.feedback strong { white-space: nowrap; }
.items { list-style: decimal; padding-left: 1.6rem; }
.item { display: flex; flex-direction: column; gap: .5rem; }
.item label { font-weight: 500; }
select, textarea, input[type=text] { font: inherit; font-size: 1rem; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 8px; padding: .5rem .6rem; max-width: 100%; }
select { min-height: 44px; }
textarea.big { width: 100%; max-width: 68ch; display: block; line-height: 1.5; }
.fieldlabel { display: block; margin: 1.2rem 0 .3rem; font-weight: 600; }
.order { list-style: decimal; padding-left: 1.6rem; }
.order-item { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.ordtext { flex: 1 1 16rem; } .btns { display: flex; gap: .4rem; }
.result { border-left: 6px solid var(--hi); }
.timer { font-size: 3rem; font-weight: 700; margin: 1rem 0 .2rem; font-variant-numeric: tabular-nums; color: var(--head); }
.prompt { border-left: 6px solid var(--accent); }
pre.tpl { white-space: pre-wrap; word-wrap: break-word; font: .95rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .8rem; margin: .6rem 0 0; overflow-x: auto; }
.tpl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: center; }
.tpl-head h3 { margin: 0; }

/* build drill */
.tray { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.tray li { max-width: none; }
.cardbtn { font: inherit; font-size: .95rem; text-align: left; min-height: 44px; padding: .5rem .8rem; border: 2px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; cursor: pointer; max-width: 22rem; }
.cardbtn.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.cardbtn.sel::before { content: '● Selected: '; font-weight: 700; color: var(--accent); }
.buildpyr { margin: .5rem 0; }
.bp-top { margin-bottom: .8rem; }
.bp-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.bp-col { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.slot { font: inherit; font-size: .95rem; text-align: left; width: 100%; min-height: 4.5rem; padding: .5rem .7rem; border: 2px dashed var(--muted); background: var(--card); color: var(--text); border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; }
.slot.filled { border-style: solid; border-color: var(--accent); }
.slot.target { border-color: var(--hi); border-style: solid; }
.slot:disabled { cursor: default; color: var(--text); opacity: 1; }
.slotlabel { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
@media (max-width: 700px) { .bp-cols { grid-template-columns: 1fr; } .bp-col { padding-bottom: .6rem; border-bottom: 1px solid var(--line); } }

/* flashcards */
.boxes { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: .15rem .8rem; font-size: .95rem; }
.flash { min-height: 14rem; }
.flash h2 { margin-top: .2rem; }

/* lesson 1 diagram */
.pyr { margin: 1.2rem 0; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.pyr-grid { display: grid; grid-template-columns: 8.5rem repeat(3, 1fr); column-gap: .7rem; align-items: center; }
.pyr-col { display: contents; }
.pyr-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pyr-l-top { grid-column: 1; grid-row: 1; } .pyr-top { grid-column: 2 / 5; grid-row: 1; }
.pyr-q-top { grid-column: 2 / 5; grid-row: 2; }
.pyr-l-key { grid-column: 1; grid-row: 3; }
.pyr-l-sup { grid-column: 1; grid-row: 5; }
.c1 > * { grid-column: 2; } .c2 > * { grid-column: 3; } .c3 > * { grid-column: 4; }
.pyr-key { grid-row: 3; } .pyr-col .pyr-q { grid-row: 4; } .pyr-sup { grid-row: 5; }
.pyr-box { border: 2px solid var(--line); border-radius: 8px; padding: .6rem .7rem; font-size: .95rem; background: var(--bg); text-align: center; height: 100%; }
.pyr-box.box-accent { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); font-weight: 700; font-size: 1.05rem; }
.pyr-key { border-color: var(--hi); font-weight: 600; }
.pyr-q { text-align: center; color: var(--accent); font-weight: 700; font-size: .95rem; padding: .3rem 0; }
.pyr-side { margin-top: 1rem; font-weight: 700; color: var(--accent); }
.pyr figcaption { color: var(--muted); font-size: .95rem; margin-top: .2rem; }
@media (max-width: 700px) {
  .pyr-grid { display: block; }
  .pyr-col { display: block; margin: .6rem 0; padding: .5rem; border: 1px dashed var(--line); border-radius: 8px; }
  .pyr-l-top, .pyr-l-key { display: block; margin: .6rem 0 .2rem; }
  .pyr-l-sup { display: none; }
  .pyr-key::before { content: 'Key: '; font-weight: 400; color: var(--muted); }
  .pyr-sup::before { content: 'Support: '; font-weight: 400; color: var(--muted); }
  .pyr-col .pyr-q { padding: .15rem 0; }
}

/* phone: bottom tab bar */
@media (max-width: 700px) {
  body { padding-bottom: 68px; }
  .topbar { position: static; }
  #nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; padding: 0 0 env(safe-area-inset-bottom); }
  #nav a { flex-direction: column; gap: 0; justify-content: center; padding: .2rem 0; font-size: .72rem; border-radius: 0; min-height: 56px; }
  #nav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--hi); }
  .ico { font-size: 1.15rem; line-height: 1; }
  h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.guide-overview { margin: 2rem 0; }
.guide-overview > h2 { margin-top: 0; font-size: 1.8rem; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.guide-grid .guide-link { display: block; margin: 0; text-decoration: none; color: var(--text); }
.guide-link:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.guide-link .eyebrow { display: block; font-size: .7rem; }
.guide-link h3 { display: flex; justify-content: space-between; margin-top: .5rem; font-size: 1.4rem; }
.guide-link p { font-size: 1rem; color: var(--muted); }
.guide-arrow { color: var(--accent); }
@media (max-width: 700px) { .guide-grid { grid-template-columns: 1fr; } }

/* A quiet, editorial workspace; all decoration stays local. */
body { background-image: radial-gradient(ellipse at 90% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 45rem); }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -.045em; font-weight: 750; margin-top: 1.8rem; }
h2 { letter-spacing: -.025em; }
a { text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.topbar { padding: .8rem max(1.25rem, calc((100vw - 72rem) / 2)); gap: 2rem; }
.brand { display: inline-flex; align-items: center; gap: .35rem; font-size: 1.3rem; letter-spacing: -.04em; white-space: nowrap; }
.brand-light { font-weight: 400; margin-left: -.25rem; }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-right: .3rem; color: var(--on-accent); background: var(--accent); border-radius: 9px; clip-path: polygon(50% 0, 100% 100%, 0 100%); font-size: 0; }
#nav { margin-left: auto; }
#nav a { font-size: .9rem; padding: 0 .75rem; border-radius: 9px; }
#nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 8%, var(--card)); box-shadow: none; }
main { max-width: 70rem; padding: 1.4rem 1.5rem 4rem; }
main > div > .lead { margin-bottom: 2rem; }
.card { border-radius: 16px; padding: 1.4rem 1.5rem; margin: 1rem 0; box-shadow: 0 3px 12px color-mix(in srgb, var(--head) 3%, transparent); }
.btn { border-radius: 10px; border-width: 1px; font-weight: 600; padding: .6rem 1.2rem; }
.btn.primary { box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 18%, transparent); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 750; color: var(--accent); margin: 0 0 .7rem; }
.hero { display: grid; grid-template-columns: 1.6fr 1fr; align-items: center; gap: 3rem; padding: 2rem 0 2.5rem; }
.hero h1 { font-size: clamp(2.7rem, 5vw, 4.25rem); line-height: 1.05; max-width: 11ch; margin: .7rem 0 1.25rem; }
.hero .lead { font-size: 1.25rem; max-width: 36ch; margin-bottom: 1rem; }
.hero-copy > .muted { max-width: 47ch; font-size: 1rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1.4rem; font-size: .8rem; color: var(--muted); }
.hero-meta span::before { content: '✓ '; color: var(--accent); font-weight: 700; }
.hero-pyramid { display: flex; flex-direction: column; align-items: center; padding: 2.5rem 1rem; border-radius: 28px; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 9%, var(--card)), var(--bg)); border: 1px solid var(--line); transform: rotate(-3deg); }
.pyramid-tier { display: block; text-align: center; border-radius: 10px; padding: .85rem .5rem; font-size: .9rem; font-weight: 650; }
.tier-answer { width: 55%; color: var(--on-accent); background: var(--accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 20%, transparent); }
.tier-reasons { width: 75%; background: color-mix(in srgb, var(--accent) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); }
.tier-details { width: 95%; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.pyramid-connector { font-size: 1rem; line-height: 1.8; color: var(--muted); }
.progress-card { border-top: 3px solid var(--accent); }
.meter { height: 9px; border: 0; background: var(--line); border-radius: 99px; }
.meter-fill { border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--hi)); }
.meter-label { font-size: .9rem; display: flex; justify-content: space-between; max-width: none; }
.meter-label strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.progress-card .row { margin-bottom: 0; }
.progress-card .muted { font-size: .9rem; }
.path-heading { margin: 3rem 0 1.5rem; }
.path-heading h2 { margin: 0; font-size: 1.8rem; }
.path-heading > .muted { margin: .5rem 0; font-size: 1rem; }
.steps { counter-reset: path; }
.steps .step { position: relative; margin-left: 3rem; padding: 1.35rem 1.5rem; max-width: none; }
.steps .step::before { counter-increment: path; content: counter(path, decimal-leading-zero); position: absolute; left: -3.1rem; top: 1.3rem; width: 2.2rem; height: 2.2rem; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--card); }
.steps .step.doing::before { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.steps .step.done::before { color: var(--ok); border-color: var(--ok); }
.step-head h3 { font-size: 1.1rem; }
.step-head .time { font-size: .85rem; font-variant-numeric: tabular-nums; }
.status { font-size: .75rem; padding: .15rem .6rem; border-radius: 99px; background: var(--bg); color: var(--muted); }
.done .status { color: var(--ok); }
.doing .status { color: var(--accent); }
.step ul { font-size: .95rem; }
.step ul li { margin-top: .4rem; }
.list-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.list-cards > .card { margin: 0; }
.list-cards p { font-size: 1rem; }
.list-cards .muted { font-size: .85rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.keyidea { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 0 14px 14px 0; padding: 1.2rem 1.5rem; background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.tag-answer { color: var(--accent); }
.prose { margin: 2rem 0; }
.prose p, .prose li { line-height: 1.8; }
.crumb { font-size: .9rem; }
fieldset { border-radius: 14px; padding: 1rem 1.25rem; }
.opt { border-radius: 8px; padding: .65rem; }
.opt:hover { background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
select, textarea, input[type=text] { border-width: 1px; padding: .7rem; }
textarea:focus, input[type=text]:focus, select:focus { border-color: var(--accent); }
.before, .after { padding: 1rem; border-left-width: 3px; border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--muted) 4%, var(--card)); }
.after { background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.flash { display: flex; flex-direction: column; justify-content: center; min-height: 20rem; padding: 2rem; border-top: 3px solid var(--accent); }
.pill { font-size: .85rem; padding: .3rem .9rem; }
.foot { max-width: 67rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--muted); }
.footer-identity { display: flex; flex-direction: column; gap: .25rem; }
.footer-brand { display: inline-flex; align-items: center; min-height: 44px; align-self: flex-start; font-size: 1rem; font-weight: 700; letter-spacing: -.03em; color: var(--head); text-decoration: none; }
.footer-description { font-size: .8rem; }
.footer-about { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .5rem; color: var(--muted); text-decoration: none; }
.footer-brand:hover, .footer-about:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 900px) { .topbar { gap: .5rem; } #nav { margin-left: 0; } }
@media (max-width: 700px) {
  main { padding: .6rem 1rem 2.5rem; }
  .topbar { padding: 1rem; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem 0; }
  .hero h1 { font-size: 3rem; max-width: 11ch; }
  .hero-pyramid { transform: none; padding: 1.25rem; max-width: 26rem; width: 100%; justify-self: center; }
  .pyramid-tier { padding: .6rem; }
  .list-cards { grid-template-columns: 1fr; }
  .card { padding: 1.1rem; }
  .steps .step { padding: 1rem; margin-left: 2.4rem; }
  .steps .step::before { left: -2.6rem; width: 1.9rem; height: 1.9rem; }
  .step-head { gap: .4rem .6rem; }
  .step-head h3 { flex-basis: 100%; }
  .foot { margin: 0 1rem; align-items: flex-start; }
  .footer-description { max-width: 25ch; }
  #nav a { font-size: .72rem; padding: .25rem 0; border-radius: 0; }
  #nav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--accent); }
}

@media print {
  .topbar, #nav, .foot, .notice, .no-print, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; padding: 0; }
  main { max-width: none; padding: 0; }
  .hero-pyramid { display: none; }
  .hero, .list-cards { display: block; }
  .card { border: 1px solid #999; break-inside: avoid; background: #fff; }
  h1, h2, h3 { color: #000; }
  .opt input { accent-color: #000; }
}
