/* RxAce design system — v2
   Vernacular: prescription labels, counting-tray teal, amber vials, package-insert monographs,
   herbarium specimen sheets. One bold element per screen; everything else quiet. */

@font-face { font-family: 'Atkinson Next'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(../fonts/atkinson-next.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Next'; font-style: italic; font-weight: 200 800; font-display: swap; src: url(../fonts/atkinson-next-italic.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif'; font-style: normal; font-weight: 200 900; font-display: swap; src: url(../fonts/source-serif-4.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif'; font-style: italic; font-weight: 200 900; font-display: swap; src: url(../fonts/source-serif-4-italic.woff2) format('woff2'); }

:root {
  --ink: #13343B;
  --ink-2: #3B5960;
  --ink-3: #536B71;
  --paper: #F4F7F6;
  --sheet: #FFFFFF;
  --sheet-2: #EEF3F2;
  --line: #D6E0DE;
  --line-2: #B4C5C2;
  --tray: #1D6B74;
  --tray-hover: #165961;
  --tray-ink: #FFFFFF;
  --tray-soft: #E1EFEF;
  --amber: #B5650F;
  --amber-text: #8A4D08;
  --amber-soft: #FBEEDA;
  --leaf: #46663A;
  --leaf-soft: #E7EFE0;
  --caution: #A1371B;
  --caution-soft: #FBE8E1;
  --ok: #276338;
  --ok-soft: #E0F0E4;
  --focus: #0A58A8;
  --herbarium: #FBFAF4;
  --shadow: 0 1px 2px rgba(19, 52, 59, .06), 0 6px 20px rgba(19, 52, 59, .07);

  --sans: 'Atkinson Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Source Serif', 'Source Serif 4', Georgia, 'Times New Roman', serif;

  /* type scale: 1.25 (major third) from a 17px base; --ts lets learners enlarge text */
  --ts: 1;
  --f-0: calc(13.5px * var(--ts));
  --f-1: calc(15px * var(--ts));
  --f-2: calc(17px * var(--ts));
  --f-3: calc(20px * var(--ts));
  --f-4: calc(25px * var(--ts));
  --f-5: calc(31px * var(--ts));
  --f-6: calc(39px * var(--ts));

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --gutter: 16px;
  --top-h: 56px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #E2EDEB;
  --ink-2: #B3C6C3;
  --ink-3: #93AAA6;
  --paper: #0D1C20;
  --sheet: #13272C;
  --sheet-2: #183238;
  --line: #24403F;
  --line-2: #33585A;
  --tray: #62B8C0;
  --tray-hover: #7CC7CE;
  --tray-ink: #04272B;
  --tray-soft: #163A3F;
  --amber: #E3A04B;
  --amber-text: #EDB46A;
  --amber-soft: #3A2A14;
  --leaf: #A3C585;
  --leaf-soft: #1D3220;
  --caution: #F39373;
  --caution-soft: #3A1E16;
  --ok: #82CF95;
  --ok-soft: #153222;
  --focus: #8CC6FF;
  --herbarium: #1B2B2A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + var(--safe-t) + 12px); scroll-padding-bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: var(--f-2); line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--tray); text-underline-offset: 2px; }
a:hover { color: var(--tray-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--sheet); padding: 10px 14px; border-radius: var(--r-s); box-shadow: var(--shadow); }
.skip:focus { top: calc(8px + var(--safe-t)); }
[hidden] { display: none !important; }

/* ---------- headings ---------- */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
.h-display { font-family: var(--serif); font-size: var(--f-5); line-height: 1.12; font-weight: 600; font-optical-sizing: auto; }
h1, .h1 { font-family: var(--serif); font-size: var(--f-5); line-height: 1.15; font-optical-sizing: auto; }
h2, .h2 { font-family: var(--serif); font-size: var(--f-4); line-height: 1.2; }
h3, .h3 { font-size: var(--f-3); line-height: 1.3; font-weight: 650; }
h4, .h4 { font-size: var(--f-2); line-height: 1.35; font-weight: 700; }
p { margin: 0 0 .8em; }
.lede { font-size: var(--f-3); color: var(--ink-2); line-height: 1.45; }
.muted { color: var(--ink-3); }
.small { font-size: var(--f-1); }
.tiny { font-size: var(--f-0); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 8px 0 var(--gutter);
  display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--f-2); color: var(--ink); text-decoration: none; margin-right: auto; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; }
.trackchip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: var(--sheet); font-size: var(--f-1); font-weight: 650; cursor: pointer;
}
.trackchip svg { width: 16px; height: 16px; }
.iconbtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 12px; cursor: pointer; color: var(--ink); }
.iconbtn:hover { background: var(--sheet-2); }
.iconbtn svg { width: 22px; height: 22px; }

.shell { display: block; }
main { padding: 16px var(--gutter) calc(var(--tab-h) + var(--safe-b) + 28px); max-width: 760px; margin: 0 auto; min-height: 60vh; }
main:focus { outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--sheet); border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
  color: var(--ink-3); font-size: 12.5px; font-weight: 650; min-height: 48px;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--tray); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
.rail { display: none; }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--top-h) + var(--safe-t)); height: calc(100vh - var(--top-h));
    padding: 20px 12px; border-right: 1px solid var(--line);
  }
  .rail a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 650; }
  .rail a svg { width: 22px; height: 22px; }
  .rail a:hover { background: var(--sheet-2); color: var(--ink); }
  .rail a[aria-current="page"] { background: var(--tray-soft); color: var(--tray); }
  .rail .railfoot { margin-top: auto; font-size: var(--f-0); color: var(--ink-3); padding: 0 14px; line-height: 1.7; }
  .rail .railfoot a { display: inline; padding: 0; border-radius: 0; color: var(--ink-3); font-weight: 400; text-decoration: underline; }
  .rail .railfoot a:hover { background: none; color: var(--ink); }
  main { padding: 32px 40px 64px; max-width: 820px; margin: 0; }
  main.wide { max-width: 1120px; }
  :root { --f-5: calc(34px * var(--ts)); --f-6: calc(44px * var(--ts)); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: var(--r-m); border: 1.5px solid transparent; background: var(--tray); color: var(--tray-ink);
  font-weight: 700; font-size: var(--f-2); cursor: pointer; text-decoration: none; line-height: 1.2; text-align: center;
}
.btn:hover { background: var(--tray-hover); color: var(--tray-ink); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.quiet { background: var(--sheet); color: var(--ink); border-color: var(--line-2); }
.btn.quiet:hover { background: var(--sheet-2); color: var(--ink); }
.btn.text { background: transparent; color: var(--tray); padding: 0 10px; min-height: 44px; }
.btn.text:hover { background: var(--tray-soft); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: var(--f-1); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- surfaces ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; }
.section { margin: 28px 0; }
.section > h2, .section > h3 { margin-bottom: 12px; }
.sechead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.sechead a { font-size: var(--f-1); font-weight: 650; }
.stack > * + * { margin-top: 12px; }

/* list rows: plain rows with dividers instead of a wall of cards */
.rows { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.rows > li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; text-decoration: none; color: var(--ink);
  background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
}
a.row:hover, button.row:hover { background: var(--sheet-2); color: var(--ink); }
.row .ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--tray-soft); color: var(--tray); }
.row .ico svg { width: 22px; height: 22px; }
.row .ico.leaf { background: var(--leaf-soft); color: var(--leaf); }
.row .ico.amber { background: var(--amber-soft); color: var(--amber-text); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 650; line-height: 1.3; }
.row .s { color: var(--ink-3); font-size: var(--f-1); line-height: 1.4; margin-top: 2px; }
.row .end { color: var(--ink-3); font-size: var(--f-1); flex: none; display: flex; align-items: center; gap: 6px; }
.row .end svg { width: 18px; height: 18px; }
.row .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--sheet-2); }

/* status markers: shape + text, never color alone */
.mark { display: inline-flex; align-items: center; gap: 5px; font-size: var(--f-0); font-weight: 700; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--sheet-2); color: var(--ink-2); white-space: nowrap; line-height: 1.4; }
.mark svg { width: 14px; height: 14px; }
.mark.done { background: var(--ok-soft); color: var(--ok); }
.mark.caution { background: var(--caution-soft); color: var(--caution); }
.mark.amber { background: var(--amber-soft); color: var(--amber-text); }
.mark.leaf { background: var(--leaf-soft); color: var(--leaf); }
.mark.tray { background: var(--tray-soft); color: var(--tray); }

/* ---------- Today: the plan (the one bold element on home) ---------- */
.plan {
  position: relative; background: var(--sheet); border-radius: var(--r-l); border: 1.5px solid var(--ink);
  box-shadow: var(--shadow); overflow: hidden;
}
.plan-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: var(--f-1); }
:root[data-theme="dark"] .plan-head { background: var(--tray-soft); color: var(--ink); }
.plan-head .rx { font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1; color: var(--amber); font-weight: 700; }
.plan-head .when { margin-left: auto; font-weight: 600; opacity: .85; }
.plan-body { padding: 18px 18px 6px; }
.plan-title { font-family: var(--serif); font-size: var(--f-4); line-height: 1.2; font-weight: 600; margin-bottom: 4px; }
.plan-meta { color: var(--ink-3); font-size: var(--f-1); margin-bottom: 8px; }
.plan-steps { list-style: none; margin: 8px 0 0; padding: 0; }
.plan-steps li { border-top: 1px dashed var(--line-2); }
.plan-steps a, .plan-steps button { display: flex; align-items: center; gap: 12px; padding: 13px 0; text-decoration: none; color: var(--ink); width: 100%; background: none; border: 0; text-align: left; cursor: pointer; min-height: 56px; }
.plan-steps .n { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-weight: 700; font-size: var(--f-1); color: var(--ink-2); }
.plan-steps .done .n { background: var(--ok); border-color: var(--ok); color: var(--sheet); }
.plan-steps .done .t { text-decoration: line-through; text-decoration-color: var(--line-2); color: var(--ink-3); }
.plan-steps .t { flex: 1; font-weight: 650; line-height: 1.3; }
.plan-steps .t small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--f-1); margin-top: 2px; }
.plan-steps .min { color: var(--ink-3); font-size: var(--f-1); white-space: nowrap; }
.plan-foot { padding: 6px 18px 18px; }

.resume { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-l); background: var(--amber-soft); color: var(--ink); text-decoration: none; border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); }
.resume:hover { color: var(--ink); filter: brightness(.98); }
.resume svg { width: 26px; height: 26px; color: var(--amber-text); flex: none; }
.resume .t { font-weight: 700; }
.resume .s { font-size: var(--f-1); color: var(--ink-2); }

.searchbox { position: relative; }
.searchbox input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--sheet);
  padding: 0 16px 0 48px; font-size: var(--f-2);
}
.searchbox input:focus { border-color: var(--tray); outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; }
.searchbox svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--ink-3); pointer-events: none; }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-m); background: var(--tray-soft); color: var(--ink); font-size: var(--f-1); margin-bottom: 14px; }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--tray); }
.banner.amber { background: var(--amber-soft); }
.banner.amber svg { color: var(--amber-text); }
.banner.caution { background: var(--caution-soft); }
.banner.caution svg { color: var(--caution); }
.banner .grow { flex: 1; }

/* Today on wide screens: plan and search on the left, week and focus alongside */
.today-grid { display: block; }
@media (min-width: 1180px) {
  .today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; align-items: start; }
  .today-grid .tside > .section:first-child { margin-top: 0; }
}

/* ---------- learn: units & lessons ---------- */
.unit { margin: 0 0 14px; }
.unit-head { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.unit-head .prog { margin-left: auto; flex: none; }
.ring { --p: 0; width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--tray) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.ring::after { content: attr(data-label); width: 34px; height: 34px; border-radius: 50%; background: var(--sheet); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; margin: 0 0 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--sheet);
  font-weight: 650; font-size: var(--f-1); cursor: pointer; color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center;
}
.tabs [aria-selected="true"], .tabs [aria-current="true"], .tabs [aria-pressed="true"], .tabs [aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- lesson reading ---------- */
.crumbs { font-size: var(--f-1); color: var(--ink-3); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.crumbs a { color: var(--ink-3); }
.crumbs svg { width: 14px; height: 14px; }
.lesson-head h1 { margin: 2px 0 10px; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.plainbox { border-left: 4px solid var(--tray); background: var(--tray-soft); padding: 14px 16px; border-radius: 0 var(--r-m) var(--r-m) 0; margin: 0 0 22px; }
.plainbox h2 { font-family: var(--sans); font-size: var(--f-1); font-weight: 700; color: var(--tray); margin-bottom: 4px; }
.plainbox p { font-size: var(--f-3); line-height: 1.45; margin: 0; }
.objectives { margin: 0 0 22px; }
.objectives h2 { font-family: var(--sans); font-size: var(--f-2); font-weight: 700; margin-bottom: 6px; }
.objectives ul { margin: 0; padding-left: 22px; }
.objectives li { margin: 4px 0; }

.prose { font-family: var(--serif); font-size: calc(18px * var(--ts)); line-height: 1.68; max-width: 68ch; font-optical-sizing: auto; }
.prose h3 { font-family: var(--sans); font-size: var(--f-3); margin: 1.6em 0 .5em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .3em 0; }
.prose code { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: var(--sheet-2); padding: 1px 5px; border-radius: 5px; }
.prose strong { font-weight: 700; }
.deeper { margin: 8px 0 24px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--sheet); }
.deeper > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 56px; }
.deeper > summary::-webkit-details-marker { display: none; }
.deeper > summary svg { width: 20px; height: 20px; transition: transform .2s; }
.deeper[open] > summary svg { transform: rotate(90deg); }
.deeper > summary .s { font-weight: 400; color: var(--ink-3); font-size: var(--f-1); }
.deeper > .prose { padding: 0 16px 8px; }

.note { display: grid; grid-template-columns: 24px 1fr; gap: 4px 12px; padding: 14px 16px; border-radius: var(--r-m); margin: 0 0 1.1em; font-family: var(--sans); font-size: var(--f-2); line-height: 1.5; background: var(--sheet-2); border-left: 4px solid var(--line-2); }
.note svg { width: 22px; height: 22px; margin-top: 1px; }
.note .lbl { font-weight: 700; }
.note .body { grid-column: 2; }
.note .body p:last-child { margin: 0; }
.note.caution { background: var(--caution-soft); border-left-color: var(--caution); }
.note.caution svg, .note.caution .lbl { color: var(--caution); }
.note.pearl { background: var(--amber-soft); border-left-color: var(--amber); }
.note.pearl svg, .note.pearl .lbl { color: var(--amber-text); }
.note.exam { background: var(--tray-soft); border-left-color: var(--tray); }
.note.exam svg, .note.exam .lbl { color: var(--tray); }

.tablewrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--sheet); -webkit-overflow-scrolling: touch; }
.tablewrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: var(--f-1); line-height: 1.45; }
caption { text-align: left; font-weight: 700; padding: 12px 14px 4px; font-size: var(--f-1); color: var(--ink-2); }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
thead th { background: var(--sheet-2); font-weight: 700; border-top: 0; white-space: nowrap; }
tbody th { font-weight: 650; }
.tablenote { font-size: var(--f-0); color: var(--ink-3); padding: 8px 14px 12px; font-family: var(--sans); }

.worked { border: 1.5px solid var(--line-2); border-radius: var(--r-l); padding: 16px; margin: 0 0 1.2em; background: var(--sheet); font-family: var(--sans); font-size: var(--f-2); }
.worked h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.worked h4 svg, .worked h2 svg { width: 20px; height: 20px; flex: none; color: var(--tray); }
.worked h2 { font-family: var(--sans); }
.worked ol { counter-reset: s; list-style: none; padding: 0; margin: 12px 0; }
.worked li { counter-increment: s; position: relative; padding: 0 0 12px 40px; }
.worked li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--tray-soft); color: var(--tray); font-weight: 700; display: grid; place-items: center; font-size: var(--f-1); }
.calc { display: block; margin-top: 6px; padding: 8px 12px; border-radius: var(--r-s); background: var(--sheet-2); font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .92em; overflow-x: auto; white-space: pre-wrap; }
.worked .ans { border-top: 1px dashed var(--line-2); padding-top: 10px; font-weight: 700; }
.worked .round { font-size: var(--f-1); color: var(--ink-3); margin-top: 4px; }

.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin: 0 0 1.2em; font-family: var(--sans); font-size: var(--f-1); list-style: none; padding: 0; }
.flow li { display: flex; align-items: center; }
.flow .step { background: var(--sheet); border: 1.5px solid var(--line-2); border-radius: 10px; padding: 8px 12px; font-weight: 650; line-height: 1.3; }
.flow li + li::before { content: ''; width: 18px; height: 2px; background: var(--line-2); margin: 0 2px; }
.flow-title { font-family: var(--sans); font-weight: 700; font-size: var(--f-1); color: var(--ink-2); margin-bottom: 6px; }

.case { border: 1.5px solid var(--line-2); border-radius: var(--r-l); background: var(--sheet); margin: 0 0 1.2em; overflow: hidden; font-family: var(--sans); font-size: var(--f-2); }
.case-head { padding: 12px 16px; background: var(--sheet-2); display: flex; gap: 10px; align-items: center; font-weight: 700; }
.case-head svg { width: 20px; height: 20px; color: var(--tray); }
.case-body { padding: 14px 16px; }
.case dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; font-size: var(--f-1); }
.case dt { font-weight: 700; color: var(--ink-2); }
.case dd { margin: 0; }
.case details { border-top: 1px solid var(--line); padding: 10px 0; }
.case summary { cursor: pointer; font-weight: 650; min-height: 40px; display: flex; align-items: center; }
.case .synthetic { font-size: var(--f-0); color: var(--ink-3); }

.compare { display: grid; gap: 12px; margin: 0 0 1.2em; font-family: var(--sans); font-size: var(--f-1); }
@media (min-width: 640px) { .compare { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.compare > div { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; background: var(--sheet); }
.compare h4 { margin-bottom: 6px; }
.compare ul { margin: 0; padding-left: 18px; }

.keypoints { background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--r-l); padding: 16px 18px; margin: 24px 0; }
.keypoints h2 { font-family: var(--sans); font-size: var(--f-2); font-weight: 700; margin-bottom: 8px; }
.keypoints ul { margin: 0; padding-left: 20px; }
.keypoints li { margin: 6px 0; }

.sources { font-size: var(--f-1); margin: 24px 0; }
.sources ol { padding-left: 22px; margin: 8px 0; }
.sources li { margin: 6px 0; overflow-wrap: anywhere; }
.reviewline { display: flex; gap: 10px; align-items: flex-start; font-size: var(--f-1); color: var(--ink-2); padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: var(--r-m); margin: 16px 0; }
.reviewline svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }

.lesson-actions { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 5; display: flex; gap: 10px; margin: 20px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter); background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgba(19, 52, 59, .06); }
.lesson-actions .btn { font-size: var(--f-1); min-height: 48px; padding: 0 12px; }
@media (min-width: 1024px) { .lesson-actions { bottom: 0; margin: 20px 0 0; padding: 10px 0; } }
.lesson-actions .btn { flex: 1; }

/* ---------- practice ---------- */
.qcard { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; }
.qtop { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: var(--f-1); color: var(--ink-3); margin-bottom: 12px; }
.qprogress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.qprogress i { display: block; height: 100%; background: var(--tray); border-radius: 999px; transition: width .25s; }
.stem { font-size: var(--f-3); line-height: 1.45; margin-bottom: 16px; font-weight: 500; }
.choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.choice {
  width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; text-align: left; min-height: 56px;
  padding: 10px 14px; border-radius: var(--r-m); border: 1.5px solid var(--line-2); background: var(--sheet); cursor: pointer; font-size: var(--f-2); line-height: 1.4; color: var(--ink);
}
.choice:hover:not([disabled]) { border-color: var(--tray); background: var(--tray-soft); }
.choice .k { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; background: var(--sheet-2); font-size: var(--f-1); }
.choice .v { display: flex; align-items: center; gap: 4px; font-size: var(--f-0); font-weight: 700; white-space: nowrap; }
.choice .v svg { width: 18px; height: 18px; }
.choice[aria-pressed="true"] { border-color: var(--tray); background: var(--tray-soft); }
.choice[aria-pressed="true"] .k { background: var(--tray); color: var(--tray-ink); }
.choice.right { border-color: var(--ok); background: var(--ok-soft); }
.choice.right .k { background: var(--ok); color: var(--sheet); }
.choice.right .v { color: var(--ok); }
.choice.wrong { border-color: var(--caution); background: var(--caution-soft); }
.choice.wrong .k { background: var(--caution); color: var(--sheet); }
.choice.wrong .v { color: var(--caution); }
.choice[disabled] { cursor: default; }
.numeric { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.numeric input { flex: 1; min-width: 140px; min-height: 52px; border-radius: var(--r-m); border: 1.5px solid var(--line-2); padding: 0 14px; font-size: var(--f-3); background: var(--sheet); }
.numeric input.wrong { border-color: var(--caution); background: var(--caution-soft); }
.numeric input.right { border-color: var(--ok); background: var(--ok-soft); }
.numeric .unit { display: grid; place-items: center; padding: 0 14px; border-radius: var(--r-m); background: var(--sheet-2); font-weight: 700; }
.feedback { margin-top: 16px; padding: 16px; border-radius: var(--r-m); background: var(--sheet-2); }
.feedback .verdict { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: var(--f-3); margin-bottom: 8px; }
.feedback .verdict svg { width: 24px; height: 24px; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.no .verdict { color: var(--caution); }
.feedback .why { font-family: var(--serif); font-size: calc(17.5px * var(--ts)); line-height: 1.6; }
.feedback .dis { margin-top: 10px; font-size: var(--f-1); }
.feedback .dis dt { font-weight: 700; margin-top: 8px; }
.feedback .dis dd { margin: 2px 0 0; color: var(--ink-2); }
.qnav { display: flex; gap: 10px; margin-top: 16px; }
.qnav .btn { flex: 1; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.timer svg { width: 18px; height: 18px; }
.confidence { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; font-size: var(--f-1); }
.confidence button { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--sheet); cursor: pointer; font-weight: 650; }
.confidence button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.flash { min-height: 260px; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 28px 22px; border-radius: var(--r-l); border: 1.5px solid var(--line-2); background: var(--sheet); white-space: pre-line; cursor: pointer; width: 100%; font-size: var(--f-3); line-height: 1.45; color: var(--ink); }
.flash .face { font-family: var(--serif); font-size: var(--f-4); line-height: 1.25; }
.flash .back { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line-2); }
.flash .note2 { font-size: var(--f-1); color: var(--ink-3); margin-top: 10px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.grades .btn { padding: 0 6px; flex-direction: column; gap: 0; min-height: 60px; }
.grades .btn small { font-weight: 500; font-size: 12px; opacity: .85; }

.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat > div { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; }
.stat b { display: block; font-family: var(--serif); font-size: var(--f-4); line-height: 1.1; font-weight: 600; }
.stat span { font-size: var(--f-1); color: var(--ink-3); }

.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 16px; }
.bar .track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--tray); }
.bar .lbl { font-weight: 650; }
.bar .val { font-size: var(--f-1); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar .sub { grid-column: 1 / -1; font-size: var(--f-0); color: var(--ink-3); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 52px)); justify-content: start; gap: 8px; text-align: center; font-size: var(--f-0); color: var(--ink-3); }
.week .d { aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed var(--line-2); display: grid; place-items: center; }
.week .d.on { border: 0; background: var(--tray); color: var(--tray-ink); }
.week .d.on svg { width: 16px; height: 16px; }
.week .d.today { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- plants: atlas + herbarium plate (the signature element) ---------- */
.atlas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 720px) { .atlas { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }
.specimen { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: var(--herbarium); border: 1px solid var(--line); border-radius: 6px; padding: 8px 8px 0; height: 100%; }
.specimen:hover { color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow); }
.specimen img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; background: var(--sheet-2); }
.specimen .label { margin: -18px 0 8px auto; width: 88%; position: relative; background: var(--sheet); border: 1px solid var(--line-2); padding: 8px 10px; font-size: var(--f-0); line-height: 1.35; }
.specimen .cn { font-weight: 700; font-size: var(--f-1); }
.specimen .sn { font-family: var(--serif); font-style: italic; color: var(--ink-2); }
.specimen .flags { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 2px 10px; margin-top: auto; }

@media (min-width: 1024px) {
  .plantgrid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; column-gap: 32px; }
  .plantgrid > header { grid-column: 1 / -1; }
  .plantgrid > section { padding-top: 6px; }
}
.plate { background: var(--herbarium); border: 1px solid var(--line-2); border-radius: 6px; padding: 12px; position: relative; }
.plate-photo { position: relative; border-radius: 3px; overflow: hidden; background: var(--sheet-2); cursor: zoom-in; border: 0; padding: 0; width: 100%; display: block; }
.plate-photo img { width: 100%; max-height: 62vh; object-fit: cover; }
.plate-label { margin: -34px 8px 0 auto; position: relative; width: min(340px, 92%); background: var(--sheet); border: 1px solid var(--ink); padding: 10px 12px; font-size: var(--f-0); line-height: 1.45; box-shadow: var(--shadow); }
.plate-label .sn { font-family: var(--serif); font-style: italic; font-size: var(--f-3); line-height: 1.2; color: var(--ink); }
.plate-label dl { display: grid; grid-template-columns: max-content 1fr; gap: 1px 8px; margin: 6px 0 0; }
.plate-label dt { font-weight: 700; color: var(--ink-2); }
.plate-label dd { margin: 0; overflow-wrap: anywhere; }

.explode { margin: 22px 0; }
.explode-stage { position: relative; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.explode-stage .core { grid-column: 1 / -1; position: relative; }
.explode-stage .core img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; }
.part {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 6px 6px 10px; border-radius: 8px;
  border: 1.5px solid var(--line-2); background: var(--herbarium); cursor: pointer; color: var(--ink); min-height: 48px;
}
.part img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--sheet-2); }
.part .noimg { width: 100%; aspect-ratio: 1; border-radius: 4px; display: grid; place-items: center; text-align: center; padding: 10px; background: repeating-linear-gradient(135deg, var(--sheet-2) 0 8px, transparent 8px 16px); font-size: var(--f-0); color: var(--ink-3); }
.part .pl { font-weight: 700; margin-top: 8px; padding: 0 4px; line-height: 1.25; }
.part .pu { font-size: var(--f-0); color: var(--ink-3); padding: 0 4px; display: flex; gap: 4px; align-items: center; }
.part .pu svg { width: 14px; height: 14px; }
.part[aria-pressed="true"] { border-color: var(--leaf); box-shadow: 0 0 0 3px color-mix(in srgb, var(--leaf) 35%, transparent); }
@media (min-width: 720px) {
  .explode-stage { grid-template-columns: 1fr 1.5fr 1fr; align-items: center; }
  .explode-stage .core { grid-column: 2; grid-row: 1 / span 3; }
  .explode-stage .core img { aspect-ratio: 4 / 5; }
  .explode-stage .part.l { grid-column: 1; }
  .explode-stage .part.r { grid-column: 3; }
  .explode-stage .part::after { content: ''; position: absolute; top: 50%; width: 22px; height: 0; border-top: 1.5px dashed var(--line-2); }
  .explode-stage .part.l::after { right: -24px; }
  .explode-stage .part.r::after { left: -24px; }
}
.explode.go .part { animation: burst .55s cubic-bezier(.2, .8, .2, 1) both; }
.explode.go .part:nth-of-type(2) { animation-delay: .05s; }
.explode.go .part:nth-of-type(3) { animation-delay: .1s; }
.explode.go .part:nth-of-type(4) { animation-delay: .15s; }
.explode.go .part:nth-of-type(5) { animation-delay: .2s; }
.explode.go .part:nth-of-type(6) { animation-delay: .25s; }
.explode.go .part:nth-of-type(7) { animation-delay: .3s; }
@keyframes burst { from { opacity: 0; transform: scale(.6) translate(var(--dx, 0), 0); } to { opacity: 1; transform: none; } }
.part.l { --dx: 60%; }
.part.r { --dx: -60%; }
.partpanel { margin-top: 14px; border: 1.5px solid var(--leaf); border-radius: var(--r-l); background: var(--sheet); padding: 16px; }
.partpanel h3 { display: flex; gap: 8px; align-items: center; }
.partpanel dl { margin: 10px 0 0; }
.partpanel dt { font-weight: 700; margin-top: 10px; font-size: var(--f-1); color: var(--ink-2); }
.partpanel dd { margin: 2px 0 0; }
.credit { font-size: var(--f-0); color: var(--ink-3); margin-top: 6px; overflow-wrap: anywhere; }
.credit a { color: var(--ink-3); }

.evid { display: flex; align-items: center; gap: 6px; font-size: var(--f-0); font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.evid svg { width: 14px; height: 14px; }
.evid.good { background: var(--ok-soft); color: var(--ok); }
.evid.some { background: var(--tray-soft); color: var(--tray); }
.evid.little { background: var(--sheet-2); color: var(--ink-2); }
.evid.against { background: var(--caution-soft); color: var(--caution); }
.evsum { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.evsum li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--f-1); }
.evlist { list-style: none; padding: 0; margin: 0; }
.evlist li { padding: 12px 0; border-top: 1px solid var(--line); }
.evlist .eh { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-weight: 700; }
.ix { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 10px; background: var(--sheet); }
.ix .ih { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-weight: 700; }

/* ---------- dialogs / sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(8, 24, 28, .5); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 720px) { .scrim { align-items: center; } }
.dialog { background: var(--sheet); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + var(--safe-b)); box-shadow: var(--shadow); }
@media (min-width: 720px) { .dialog { border-radius: 22px; } }
.dialog h2 { margin-bottom: 8px; }
.dialog .x { float: right; margin: -8px -8px 0 0; }
.field { width: 100%; min-height: 48px; border-radius: var(--r-m); border: 1.5px solid var(--line-2); background: var(--sheet); padding: 10px 14px; font-size: var(--f-2); }
textarea.field { min-height: 110px; resize: vertical; }
label.lbl { display: block; font-weight: 700; margin: 14px 0 6px; font-size: var(--f-1); }
.hint { font-size: var(--f-1); color: var(--ink-3); margin-top: 4px; }
.err { color: var(--caution); font-weight: 650; }
.viewer { position: fixed; inset: 0; z-index: 90; background: #0a1416; display: flex; flex-direction: column; }
.viewer .vbar { display: flex; gap: 6px; align-items: center; padding: calc(8px + var(--safe-t)) 10px 8px; color: #fff; }
.viewer .vbar .iconbtn { color: #fff; }
.viewer .vbar .iconbtn:hover { background: rgba(255, 255, 255, .12); }
.viewer .vimg { flex: 1; overflow: auto; display: grid; place-items: center; touch-action: pan-x pan-y pinch-zoom; }
.viewer .vimg img { max-width: none; transition: width .15s; }
.viewer .vcap { color: #cfdcdc; font-size: var(--f-0); padding: 8px 14px calc(10px + var(--safe-b)); }
.viewer .vcap a { color: #9fd7dd; }

.choicegrid { display: grid; gap: 10px; }
.pickcard { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; padding: 14px 16px; border-radius: var(--r-l); border: 1.5px solid var(--line-2); background: var(--sheet); cursor: pointer; min-height: 72px; color: var(--ink); }
.pickcard:hover { border-color: var(--tray); }
.pickcard[aria-pressed="true"], .pickcard[aria-checked="true"] { border-color: var(--tray); background: var(--tray-soft); box-shadow: inset 0 0 0 1px var(--tray); }
.pickcard .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--sheet-2); flex: none; }
.pickcard .ico svg { width: 24px; height: 24px; }
.pickcard .t { font-weight: 700; }
.pickcard .s { font-size: var(--f-1); color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); z-index: 100; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-weight: 650; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1024px) { .toast { bottom: 24px; } }

.empty { text-align: left; padding: 22px 18px; border: 1.5px dashed var(--line-2); border-radius: var(--r-l); color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; color: var(--ink); }
.loading { padding: 40px 0; color: var(--ink-3); display: flex; gap: 10px; align-items: center; }
.loading::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--tray); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- onboarding ---------- */
.onb { max-width: 560px; margin: 0 auto; padding: 8px 0 40px; }
.onb .h-display { margin: 18px 0 10px; }
.onb .steps { display: flex; gap: 6px; margin: 8px 0 20px; }
.onb .steps i { flex: 1; height: 4px; border-radius: 99px; background: var(--line); }
.onb .steps i.on { background: var(--tray); }

/* ---------- paywall ---------- */
.paywall { position: fixed; inset: 0; z-index: 85; background: rgba(8, 24, 28, .55); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.pwcard { background: var(--sheet); max-width: 480px; width: 100%; border-radius: 22px; padding: 26px 22px; box-shadow: var(--shadow); position: relative; margin: auto; }
.pwcard .pwx { position: absolute; right: 8px; top: 8px; }
.pwcard h2 { margin: 6px 0 8px; }
.pwrx { font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 30px; color: var(--amber); }
.pwlist { padding-left: 0; list-style: none; margin: 14px 0 18px; }
.pwlist li { display: flex; gap: 10px; margin: 8px 0; }
.pwlist svg { width: 20px; height: 20px; color: var(--ok); flex: none; margin-top: 2px; }
.pwrow { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }
.pwrow button { background: none; border: 0; color: var(--tray); font-weight: 650; cursor: pointer; padding: 10px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 2px; }
.pwmsg { min-height: 1.4em; margin-top: 8px; font-size: var(--f-1); }
.pwmsg.err { color: var(--caution); }
.pwfine { font-size: var(--f-0); color: var(--ink-3); margin-top: 14px; }
.lickey { font-family: ui-monospace, Consolas, monospace; font-size: 14px; padding: 12px; border-radius: var(--r-m); background: var(--sheet-2); overflow-wrap: anywhere; user-select: all; margin: 10px 0; }

/* ---------- misc ---------- */
.kbd { font-family: ui-monospace, Consolas, monospace; font-size: .85em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.foot { margin: 40px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: var(--f-0); color: var(--ink-3); line-height: 1.6; }
.foot a { color: var(--ink-3); }
.pill-scope { font-size: var(--f-0); font-weight: 700; color: var(--ink-3); }
mark { background: var(--amber-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.sigout { font-family: var(--serif); font-size: var(--f-4); line-height: 1.3; margin: 14px 0 8px; }
.toks { display: flex; flex-wrap: wrap; gap: 6px; }
.toks span { font-size: var(--f-1); padding: 4px 10px; border-radius: 8px; background: var(--sheet-2); }
.toks b { font-family: ui-monospace, Consolas, monospace; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }

@media print {
  .topbar, .tabbar, .rail, .lesson-actions, .noprint, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .deeper { border: 0; }
  .deeper > summary { display: none; }
  .deeper:not([open]) > * { display: block; }
  a { color: #000; }
  .prose a::after { content: ' (' attr(href) ')'; font-size: .8em; }
}

/* headings receive focus programmatically on page change; they are not interactive */
[tabindex="-1"]:focus { outline: none; }

/* reflow at 320px with enlarged text: let long words wrap instead of clipping */
fieldset { min-width: 0; }
.row .main, .row .t, .row .s { overflow-wrap: anywhere; }
.case dl { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
.case dd, .case dt, .plate-label dd, .partpanel dd { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .case dl { grid-template-columns: minmax(0, 1fr); }
  .case dd { margin-bottom: 6px; }
}

/* icons inside headings stay text-sized wherever they appear */
h1 svg, h2 svg, h3 svg, h4 svg { width: 1.1em; height: 1.1em; flex: none; }
.partpanel h3 svg { width: 22px; height: 22px; color: var(--leaf); }
.row > svg { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.plan-steps .n svg { width: 16px; height: 16px; }
/* safety net: an icon without a sizing rule never grows past text size */
main svg:not([class]), .dialog svg:not([class]) { max-width: 24px; max-height: 24px; flex-shrink: 0; }
.row .t, .row .s { display: block; }
.units .row .s { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row[disabled] { opacity: .62; cursor: default; }
.row[disabled]:hover { background: none; }
