/* RetireReady Academy: one stylesheet, no build step.
   Identity: Atkinson Hyperlegible throughout (legibility is the brand), a cool paper ground,
   spruce for structure, gold reserved for "this changed" and the plan ribbon's key number.
   House style: no italics anywhere. */

@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }

:root {
  --spruce: #1f5a54; --spruce-dark: #133f3b; --spruce-tint: #e4eeec;
  --gold: #c8962e; --gold-tint: #f7edd6;
  --paper: #f4f6f5; --card: #ffffff; --ink: #1b2522; --muted: #56635f; --line: #d9e1de;
  --rust: #b3412e; --rust-tint: #f7e3df; --good: #2f7d57; --good-tint: #e1f0e7; --slate: #4a6fa5;
  --radius: 6px; --radius-lg: 10px;
  --base: 17px;
  --measure: 68ch;
}
body.text-large { --base: 19px; }
body.text-larger { --base: 21px; }
body.high-contrast { --ink: #000; --muted: #222; --line: #555; --paper: #fff; --spruce: #0b3d38; --gold: #8a5e00; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
body.reduced-motion * { animation: none !important; transition: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--base); }
body { margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55; font-variant-numeric: tabular-nums; }
em, i, cite, var, dfn, address { font-style: normal; font-weight: 700; }
a { color: var(--spruce); text-underline-offset: 2px; }
a:hover { color: var(--spruce-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 1.4em 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; margin-top: .4em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.18rem; }
p, ul, ol { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.muted { font-size: .92rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
mark { background: var(--gold-tint); color: inherit; padding: 0 2px; border-radius: 2px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 700; }
td.num, th.num { text-align: right; white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .5rem 1rem; z-index: 100; }

/* ---------- header ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .inner { display: flex; align-items: center; gap: 1.25rem; max-width: 1240px; margin: 0 auto;
  padding: .7rem 1.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; color: var(--ink);
  text-decoration: none; }
.brand svg { flex: none; }
.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; padding: .25rem 0;
  border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.on { border-bottom-color: var(--spruce); }
.header-search { flex: 1; min-width: 200px; max-width: 380px; position: relative; margin-left: auto; }
.header-search input { width: 100%; }
.search-pop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(19,63,59,.12);
  max-height: 70vh; overflow: auto; }
.search-pop:empty { display: none; }
.acct { display: flex; gap: .8rem; align-items: center; font-size: .95rem; }
.site-menu { display: contents; }   /* wide screens: its children sit in the header bar */
.menu-btn { display: none; }
.badge { display: inline-block; background: var(--gold); color: #fff; border-radius: 99px; font-size: .72rem;
  padding: 0 .45rem; font-weight: 700; vertical-align: 2px; }

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.narrow { max-width: 760px; margin: 0 auto; }
.prose { max-width: var(--measure); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem 1.4rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.5rem 0; color: var(--muted);
  font-size: .88rem; }
.footer .inner { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: space-between; }
.disclaimer { max-width: 72ch; }

/* ---------- messages ---------- */
.flash { border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; border: 1px solid var(--line);
  background: var(--card); }
.flash.success { border-color: var(--good); background: var(--good-tint); }
.flash.error { border-color: var(--rust); background: var(--rust-tint); }
.flash.info, .flash.warning { border-color: var(--gold); background: var(--gold-tint); }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: .93rem; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=month], input[type=datetime-local], select, textarea {
  font: inherit; font-size: 1rem; padding: .5rem .6rem; border: 1px solid #b8c4c0; border-radius: var(--radius);
  background: #fff; color: var(--ink); width: 100%; }
input[type=range] { width: 100%; accent-color: var(--spruce); }
input[type=checkbox], input[type=radio] { accent-color: var(--spruce); width: 1.1rem; height: 1.1rem; vertical-align: -3px; }
.field { margin-bottom: 1rem; }
.field .help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.field .err, .errorlist { color: var(--rust); font-size: .88rem; margin: .25rem 0 0; list-style: none; padding: 0; font-weight: 700; }
.input-money, .input-pct { position: relative; }
.input-money input { padding-left: 1.4rem; }
.input-money::before { content: "$"; position: absolute; left: .6rem; top: .52rem; color: var(--muted); }
.input-pct input { padding-right: 1.6rem; }
.input-pct::after { content: "%"; position: absolute; right: .6rem; top: .52rem; color: var(--muted); }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
.btn { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 700; font-size: .98rem;
  padding: .55rem 1.1rem; border-radius: var(--radius); border: 2px solid var(--spruce); background: var(--spruce);
  color: #fff; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { background: var(--spruce-dark); border-color: var(--spruce-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--spruce); }
.btn.ghost:hover { background: var(--spruce-tint); color: var(--spruce-dark); }
.btn.small { font-size: .85rem; padding: .3rem .7rem; }
.btn.danger { background: var(--rust); border-color: var(--rust); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1b1407; }
.linkbtn { background: none; border: 0; color: var(--spruce); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- the plan ribbon (the memorable element) ---------- */
.ribbon { position: sticky; top: 0; z-index: 30; background: var(--spruce-dark); color: #fff; }
.ribbon .inner { max-width: 1240px; margin: 0 auto; padding: .55rem 1.25rem; display: flex; column-gap: 1.4rem; row-gap: .15rem;
  align-items: baseline; flex-wrap: wrap; }
.ribbon .who { font-size: .82rem; opacity: .85; }
.ribbon .who a, .ribbon .who button { color: #fff; }
.ribbon .verdict { font-size: 1.25rem; font-weight: 700; }
.ribbon .verdict .num { color: #f2c76a; }
.ribbon .verdict.short .num { color: #ffb3a3; }
.ribbon .stat { font-size: .9rem; opacity: .95; }
.ribbon .stat b { font-size: 1.02rem; }
.ribbon.pulse .verdict .num, .ribbon.pulse .stat b { animation: pulse 1.6s ease-out 1; }
@keyframes pulse { 0% { background: rgba(242,199,106,.55); } 100% { background: transparent; } }

/* ---------- lessons ---------- */
.lesson-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 980px) { .lesson-layout { grid-template-columns: minmax(0, 1fr); } .rail { order: 2; position: static; } }
.rail { position: sticky; top: 4.5rem; font-size: .92rem; }
.rail ol { list-style: none; padding: 0; margin: 0; counter-reset: l; }
.rail li { counter-increment: l; }
.rail li a, .rail li span { display: flex; gap: .55rem; padding: .35rem .5rem; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.rail li a::before, .rail li span::before { content: counter(l); flex: none; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  display: inline-grid; place-items: center; font-size: .78rem; font-weight: 700; border: 1.5px solid var(--line); background: #fff; }
.rail li.done a::before { content: "✓"; background: var(--spruce); color: #fff; border-color: var(--spruce); }
.rail li.current a { background: var(--spruce-tint); font-weight: 700; }
.rail li.locked span { color: var(--muted); }
.lesson-head .crumbs { font-size: .9rem; color: var(--muted); }
.lesson-head h1 { margin: .2rem 0 .3rem; }
.steps { counter-reset: s; }
.step { position: relative; padding-left: 3.1rem; margin: 2.25rem 0; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: .05rem; width: 2.1rem; height: 2.1rem;
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--spruce); color: #fff; }
.step > h2 { margin-top: 0; font-size: 1.3rem; }
.step .lead { color: var(--muted); margin-top: -.3rem; }
.concept { max-width: var(--measure); }
.example { border-left: 4px solid var(--slate); background: #eef2f8; padding: 1rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; max-width: var(--measure); }
.example .who { font-weight: 700; color: var(--slate); margin-bottom: .3rem; }
a.term { color: inherit; text-decoration: underline dotted var(--spruce); text-decoration-thickness: 2px; position: relative; }
a.term:hover::after, a.term:focus::after { content: attr(data-def); position: absolute; left: var(--tip-left, 0); top: 1.6em; z-index: 20; width: min(340px, 80vw);
  background: var(--ink); color: #fff; font-size: .85rem; font-weight: 400; line-height: 1.45; padding: .6rem .75rem; border-radius: var(--radius); }

/* widgets */
.widget { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1100px) { .widget { grid-template-columns: minmax(0, 1fr); } }
.widget.wide, .widget.stacked { grid-template-columns: minmax(0, 1fr); }
.widget .inputs { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.2rem; }
.widget .inputs h3 { margin-top: 0; }
.widget .effect { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; min-height: 120px; }
.effect.changed { box-shadow: 0 0 0 3px var(--gold-tint); }
.effect .changed-note { background: var(--gold-tint); border-radius: var(--radius); padding: .4rem .7rem; font-size: .9rem; margin-bottom: .8rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin: .5rem 0 1rem; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; background: #fbfcfc; }
.kpi .v { font-size: 1.35rem; font-weight: 700; }
.kpi .l { font-size: .82rem; color: var(--muted); }
.kpi.good { border-color: var(--good); background: var(--good-tint); }
.kpi.bad { border-color: var(--rust); background: var(--rust-tint); }
.kpi.gold { border-color: var(--gold); background: var(--gold-tint); }
.editor-table td { padding: .3rem .25rem; }
.editor-table input, .editor-table select { padding: .35rem .45rem; font-size: .93rem; }
.explain-btn { border: 1px solid var(--line); background: #fff; border-radius: 99px; width: 1.35rem; height: 1.35rem; font-size: .75rem;
  font-weight: 700; color: var(--spruce); cursor: pointer; padding: 0; line-height: 1; vertical-align: 1px; }
.explain { background: #fff; border: 1px solid var(--spruce); border-radius: var(--radius); padding: .8rem 1rem; margin: .5rem 0; font-size: .92rem; }
.explain .formula { font-family: inherit; background: var(--spruce-tint); padding: .4rem .6rem; border-radius: var(--radius); margin: .4rem 0; }
.bar { height: .7rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--spruce); }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: var(--spruce-tint); color: var(--spruce-dark); }
.tag.gold { background: var(--gold-tint); color: #6b4c0b; }
.tag.rust { background: var(--rust-tint); color: var(--rust); }
.tag.good { background: var(--good-tint); color: var(--good); }
.event { padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.event .when { color: var(--muted); font-size: .82rem; }
.event.bad { color: var(--rust); }
.htmx-request .effect, .effect.htmx-request { opacity: .6; transition: opacity .2s; }

/* quiz */
.quiz fieldset { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.2rem; margin: 0 0 1rem; background: var(--card); }
.quiz legend { font-weight: 700; padding: 0 .3rem; }
.quiz .opt { display: flex; gap: .55rem; padding: .45rem .5rem; border-radius: var(--radius); font-weight: 400; cursor: pointer; }
.quiz .opt:hover { background: var(--spruce-tint); }
.quiz .opt.right { background: var(--good-tint); }
.quiz .opt.wrong { background: var(--rust-tint); }
.quiz .why { font-size: .9rem; color: var(--muted); margin: -.1rem 0 .4rem 2.2rem; }
.quiz .why p { margin: 0; }
.hint { background: var(--gold-tint); border-radius: var(--radius); padding: .5rem .75rem; font-size: .92rem; margin: .4rem 0; }
.result { border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.result.pass { background: var(--good-tint); border: 1px solid var(--good); }
.result.fail { background: var(--rust-tint); border: 1px solid var(--rust); }
details.faq { border-bottom: 1px solid var(--line); padding: .6rem 0; max-width: var(--measure); }
details.faq summary { font-weight: 700; cursor: pointer; }
details.faq div { margin-top: .5rem; }

/* course map */
.module { margin-bottom: 1.5rem; }
.module h3 { margin: 0 0 .4rem; display: flex; gap: .6rem; align-items: baseline; }
.module ol { margin: 0; padding-left: 1.4rem; }
.module li { padding: .2rem 0; }
.progress-line { display: flex; gap: .8rem; align-items: center; }
.progress-line .bar { flex: 1; }

/* home */
.hero { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 2.5rem; align-items: center; padding: 2.5rem 0 1.5rem; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-size: 2.7rem; line-height: 1.08; margin: 0 0 1rem; max-width: 18ch; }
.hero p.sub { font-size: 1.15rem; max-width: 52ch; color: var(--muted); }
.ledger { background: var(--spruce-dark); color: #fff; border-radius: var(--radius-lg); padding: 1.4rem 1.5rem; }
.ledger .line { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid rgba(255,255,255,.18); }
.ledger .line:last-child { border-bottom: 0; }
.ledger .line b { font-size: 1.15rem; }
.ledger .line.key b { color: #f2c76a; font-size: 1.5rem; }
.ledger .cap { font-size: .82rem; opacity: .8; margin-top: .6rem; }
.offer { display: flex; flex-direction: column; gap: .6rem; }
.offer .price { font-size: 1.6rem; font-weight: 700; }
.offer .was { text-decoration: line-through; color: var(--muted); font-size: 1rem; margin-left: .4rem; }

/* tabs */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 1.25rem; }
.tabs a { padding: .5rem .85rem; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .95rem;
  border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { border-bottom-color: var(--spruce); color: var(--spruce); }

/* staff */
.staff-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.status-new { color: var(--rust); font-weight: 700; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: .6rem; background: var(--card); }
.msg.agent { border-left: 4px solid var(--spruce); }
.msg.note { background: var(--gold-tint); }
.msg .meta { font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
pre.mail { white-space: pre-wrap; font-family: inherit; background: var(--card); border: 1px solid var(--line); padding: 1rem; border-radius: var(--radius); }

/* help */
.results .hit { padding: .7rem .9rem; border-bottom: 1px solid var(--line); display: block; text-decoration: none; color: var(--ink); }
.results .hit:hover, .results .hit:focus { background: var(--spruce-tint); }
.results .hit .kind { font-size: .75rem; font-weight: 700; color: var(--spruce); }
.results .hit .t { font-weight: 700; }
.results .hit .s { font-size: .88rem; color: var(--muted); }
.glossary dt { font-weight: 700; margin-top: 1rem; scroll-margin-top: 5rem; }
.glossary dt:target { background: var(--gold-tint); }
.glossary dd { margin: .2rem 0 0; max-width: var(--measure); }

/* charts */
figure.chart { margin: .75rem 0 1.25rem; }
figure.chart figcaption { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.plotly { width: 100%; }

/* print (plan report and certificate) */
@media print {
  .site-header, .footer, .ribbon, .no-print, .rail { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .wrap { padding: 0; }
  .panel { border: 0; padding: 0; }
  .page-break { page-break-before: always; }
  a { color: inherit; text-decoration: none; }
}
.cert { max-width: 820px; margin: 2rem auto; background: #fff; border: 10px double var(--spruce); padding: 3rem; text-align: center; }
.cert h1 { font-size: 2.4rem; margin: .5rem 0 1.5rem; }
.cert .name { font-size: 2rem; font-weight: 700; border-bottom: 2px solid var(--gold); display: inline-block; padding: 0 1rem .3rem; }
[x-cloak]{display:none!important}
.editor-table .input-money input { padding-left: 1.35rem; }
.editor-table .input-money::before { top: .4rem; left: .5rem; }
.editor-table .input-pct input { padding-right: 1.5rem; }
.editor-table .input-pct::after { top: .4rem; }
@media (max-width: 640px) {
  .step { padding-left: 0; }
  .step::before { position: static; display: inline-grid; margin-bottom: .4rem; }
  .editor-table thead { display: none; }
  .editor-table, .editor-table tbody { display: block; }
  .editor-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .editor-table td { display: block; border: 0; padding: 0; }
  .editor-table td:first-child { grid-column: 1 / -1; }
  .hero h1 { font-size: 2.1rem; }
  h1 { font-size: 1.7rem; }
  .ribbon .verdict { font-size: 1.1rem; }
}

/* Money Basics tables */
.basics-table { margin: .6rem 0 1rem; font-size: .95rem; }
.basics-table th, .basics-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.basics-table thead th { text-align: left; background: var(--panel-2, #eef3f1); }
.basics-table th[scope=row] { font-weight: 400; text-align: left; color: var(--ink); font-size: inherit; }
.basics-table tr.net th, .basics-table tr.net td { border-top: 2px solid currentColor; font-weight: 700; }
.basics-table tr.pretax th { color: #8a6516; }
.basics-table caption { text-align: left; padding-bottom: .3rem; }
@media (max-width: 640px) { .basics-table { font-size: .88rem; } .basics-table th, .basics-table td { padding: .35rem .3rem; } }

/* Tester mode */
.tester-bar { background: #fff4d6; border-bottom: 1px solid #e8d49a; font-size: .9rem; }
.tester-bar .inner { max-width: 1240px; margin: 0 auto; padding: .5rem 1.25rem; }
.feedback-fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; background: var(--spruce); color: #fff;
  padding: .6rem 1rem; border-radius: 999px; font-weight: 700; text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.feedback-fab:hover, .feedback-fab:focus { background: var(--spruce-dark); color: #fff; }
@media print { .feedback-fab, .tester-bar, .menu-btn { display: none; } }
body.has-fab .footer { padding-bottom: 5rem; }   /* keep the last footer links clear of the Feedback button */

/* ---------- phones and touch screens ---------- */
/* Header: on phones the bar holds only the logo and a Menu button; the menu opens below it.
   Without JavaScript (no .js class) everything stays visible, wrapped, as before. */
@media (max-width: 760px) {
  .site-header .inner { padding: .5rem 1rem; gap: .5rem 1rem; }
  .site-header.js .menu-btn { display: inline-flex; align-items: center; gap: .4rem; margin-left: auto; font: inherit;
    font-weight: 700; font-size: .95rem; color: var(--ink); background: transparent; border: 1px solid var(--line);
    border-radius: var(--radius); padding: .45rem .8rem; min-height: 2.75rem; cursor: pointer; }
  .site-header.js .menu-btn[aria-expanded="true"] { background: var(--spruce-tint); border-color: var(--spruce); }
  .site-header.js .site-menu { display: none; }
  .site-header.js.menu-open .site-menu { display: flex; flex-direction: column; align-items: stretch; gap: .25rem;
    width: 100%; padding: .4rem 0 .6rem; }
  .site-header.js .nav { flex-direction: column; gap: 0; }
  .site-header.js .nav a, .site-header.js .acct a:not(.btn) { display: block; padding: .7rem .25rem; font-size: 1rem;
    border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; }
  .site-header.js .header-search { max-width: none; margin: .6rem 0 .3rem; flex: none; }
  .site-header.js .acct { flex-direction: column; align-items: stretch; gap: 0; }
  .site-header.js .acct .btn { justify-content: center; margin-top: .6rem; padding: .7rem 1rem; font-size: 1rem; }
  .site-header:not(.js) .header-search { min-width: 0; max-width: none; flex-basis: 100%; }
  .wrap { padding: 1rem 1rem 3rem; }
  .footer .inner { padding: 0 1rem; }
  .tester-bar .inner, .ribbon .inner { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 640px) {
  /* Plan ribbon: one pinned line instead of four; swipe it sideways for the other numbers. */
  .ribbon .inner { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding-top: .45rem; padding-bottom: .45rem;
    scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent); }
  .ribbon .inner::-webkit-scrollbar { display: none; }
  .ribbon .verdict { order: -1; }
  .ribbon .stat, .ribbon .who { font-size: .85rem; }
  /* Tabs and the staff menu: one row you can swipe, instead of three wrapped rows. */
  .tabs, .staff-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar, .staff-nav::-webkit-scrollbar { display: none; }
  .tabs a, .staff-nav a { white-space: nowrap; flex: none; }
  .staff-nav { padding-bottom: .3rem; }
  /* iPhones zoom into any field whose text is under 16px; keep every field at 16px or more. */
  .editor-table input, .editor-table select { font-size: max(16px, .93rem); }
  /* Wide tables scroll inside their own box instead of squeezing every column. */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll > table { min-width: 34rem; }
  .panel { padding: 1rem 1.05rem; }
  .widget .inputs, .widget .effect { padding: 1rem; }
  .cert { padding: 1.5rem 1rem; border-width: 6px; }
  .cert h1 { font-size: 1.7rem; } .cert .name { font-size: 1.5rem; }
  .row > .btn { flex: 0 1 auto; }
}

/* Touch screens: give small controls a finger-sized target (about 44px) without changing their look much. */
@media (pointer: coarse) {
  .btn { min-height: 2.75rem; }
  .btn.small { min-height: 2.4rem; padding: .4rem .8rem; }
  .explain-btn { width: 1.9rem; height: 1.9rem; font-size: .85rem; }
  .tabs a { padding: .7rem .9rem; }
  .rail li a, .rail li span { padding: .6rem .5rem; }
  .quiz .opt { padding: .7rem .6rem; }
  .linkbtn { padding: .4rem 0; }
  input[type=checkbox], input[type=radio] { width: 1.35rem; height: 1.35rem; }
  /* Glossary terms: the first tap shows the definition (app.js), the second opens the glossary. */
  a.term:hover::after, a.term:focus::after { content: none; }
  a.term.show::after { content: attr(data-def); position: absolute; left: var(--tip-left, 0); top: 1.6em; z-index: 20;
    width: min(340px, 86vw); background: var(--ink); color: #fff; font-size: .9rem; font-weight: 400; line-height: 1.45;
    padding: .6rem .75rem; border-radius: var(--radius); white-space: normal; }
}
.footer .build { flex-basis: 100%; margin: 0; font-size: .8rem; color: var(--muted); }
