/* Layout: fixed top bar, sticky left menu (off-canvas on mobile), content column, right drawer for a prompt.
   Identity: an engineering drawing set. Drafting paper, ink rules, square corners, registers instead of cards,
   one safety-orange accent, isometric line drawings. The dark theme is a blueprint. */
:root {
  --paper: #f2f2ec;
  --sheet: #fcfcf9;
  --sunk: #e8e8e0;
  --ink: #17212b;
  --ink-2: #3a4752;
  --muted: #65707a;
  --faint: #8d969d;
  --rule: #d5d6ce;
  --rule-2: #b4b8b2;
  --accent: #e4571b;
  --accent-ink: #b5400c;
  --accent-soft: #fbe5d8;
  --ok: #1c7a4c;
  --ok-soft: #dcf1e4;
  --grid: rgba(23, 33, 43, .055);
  --scrim: rgba(23, 33, 43, .5);
  --lift: 0 14px 34px rgba(23, 33, 43, .16);
  /* isometric drawings: three tones per material */
  --iso-ink: #17212b;
  --iso-t: #fcfcf9; --iso-l: #e0e2dc; --iso-r: #c4c8c3;
  --iso-pad-t: #eaeae2; --iso-pad-l: #d6d7cf; --iso-pad-r: #c6c7c0;
  --iso-dt: #5f6b76; --iso-dl: #46515b; --iso-dr: #333c45;
  --iso-at: #ff9f69; --iso-al: #ec6627; --iso-ar: #c44a12;
  --iso-glass: #c9dbe3; --iso-white: #ffffff; --iso-paper: #ffffff;
  --f-display: "Barlow Semi Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --top: 60px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0b2035; --sheet: #102a43; --sunk: #081a2c; --ink: #e8eff6; --ink-2: #c4d1dd; --muted: #92a6b9; --faint: #67809a;
  --rule: #1e3c5a; --rule-2: #2f5478;
  --accent: #ff8a4c; --accent-ink: #ffa26e; --accent-soft: #3b2415; --ok: #5fd19a; --ok-soft: #12392b;
  --grid: rgba(160, 200, 240, .07); --scrim: rgba(3, 10, 18, .66); --lift: 0 14px 34px rgba(0, 0, 0, .5);
  --iso-ink: #cfe0f0;
  --iso-t: #2c4f72; --iso-l: #1f3e5d; --iso-r: #16304b;
  --iso-pad-t: #153350; --iso-pad-l: #102942; --iso-pad-r: #0c2136;
  --iso-dt: #0e2238; --iso-dl: #0a1a2c; --iso-dr: #071422;
  --iso-glass: #47779e; --iso-white: #dbe8f4; --iso-paper: #3a6288;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }
img { max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.offscreen { position: fixed; opacity: 0; pointer-events: none; }

/* ---------- isometric drawings ---------- */
.iso { display: block; width: 100%; height: 100%; stroke: var(--iso-ink); stroke-width: 1.15; stroke-linejoin: round; stroke-linecap: round; overflow: visible; }
.iso path, .iso ellipse { vector-effect: non-scaling-stroke; }
.iso .t { fill: var(--iso-t); } .iso .l { fill: var(--iso-l); } .iso .r { fill: var(--iso-r); }
.iso .pad.t { fill: var(--iso-pad-t); } .iso .pad.l { fill: var(--iso-pad-l); } .iso .pad.r { fill: var(--iso-pad-r); }
.iso .d.t { fill: var(--iso-dt); } .iso .d.l { fill: var(--iso-dl); } .iso .d.r { fill: var(--iso-dr); }
.iso .a.t { fill: var(--iso-at); } .iso .a.l { fill: var(--iso-al); } .iso .a.r { fill: var(--iso-ar); }
.iso .g { fill: var(--iso-glass); } .iso .p { fill: var(--iso-paper); }
.iso .ns { stroke: none; }
.iso .ln { fill: none; }
.iso .ln.a { stroke: var(--iso-al); stroke-width: 1.8; }
.iso .ln.w { stroke: var(--iso-white); stroke-width: 1.5; }
.iso .ln.thick { stroke-width: 2.6; }
.iso .ln.thin, .iso .ln.grid { stroke-width: .7; opacity: .6; }
.iso .ln.grid { opacity: .22; }
.iso .ln.d2 { stroke-dasharray: 4 4; }

/* ---------- shared pieces ---------- */
.code {
  display: inline-block; flex: none; font: 500 12px/1.5 var(--f-mono); white-space: nowrap; color: var(--ink-2);
  border: 1px solid var(--rule-2); background: var(--sheet); padding: 0 5px;
}
.kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; font: 500 12.5px var(--f-mono); color: var(--muted); }
.pill, .cnt { font: 500 12px var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; cursor: pointer; text-decoration: none;
  border: 1px solid var(--ink); background: var(--sheet); border-radius: 2px; padding: 8px 15px; font-weight: 600; font-size: 14px;
  transition: background-color .12s, color .12s, border-color .12s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary[data-done="1"] { background: var(--ok); border-color: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn.primary:hover, :root[data-theme="dark"] .btn.primary[data-done="1"] { color: #06131f; }
.btn:disabled { opacity: .4; cursor: default; pointer-events: none; }
.btn.sm { padding: 5px 10px; font-size: 13px; font-weight: 500; border-color: var(--rule-2); }
.btn .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.linkbtn { border: 0; background: none; padding: 0; cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--accent-ink); }
.iconbtn {
  border: 1px solid var(--rule-2); background: var(--sheet); color: var(--ink-2); border-radius: 2px; width: 36px; height: 36px;
  display: inline-grid; place-items: center; cursor: pointer; flex: none; transition: background-color .12s, color .12s, border-color .12s;
}
.iconbtn:hover { border-color: var(--ink); color: var(--ink); }
.iconbtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.iconbtn[aria-pressed="true"] svg { fill: currentColor; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 2px; background: var(--sheet); flex: none; }
.seg button { border: 0; background: transparent; padding: 0 11px; height: 34px; cursor: pointer; font: 500 13px var(--f-mono); color: var(--muted); }
.seg button + button { border-left: 1px solid var(--rule-2); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg.small button { font-family: var(--f-body); height: 32px; }
.kbd { font: 500 11px var(--f-mono); color: var(--muted); border: 1px solid var(--rule-2); border-radius: 2px; padding: 1px 6px; background: var(--sheet); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  padding: env(safe-area-inset-top, 0px) 20px 0;
  display: flex; align-items: center; gap: 16px;
  background: var(--sheet); border-bottom: 1px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font: 700 17px/1.1 var(--f-display); letter-spacing: .01em; white-space: nowrap; }
.brand-sub { font: 500 10.5px var(--f-mono); color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.search-wrap { position: relative; flex: 1; max-width: 620px; margin-left: auto; min-width: 0; }
.search {
  display: flex; align-items: center; gap: 8px; min-width: 0; height: 38px;
  background: var(--paper); border: 1px solid var(--rule-2); border-radius: 2px; padding: 0 10px;
  transition: border-color .12s, background-color .12s;
}
.search:focus-within { border-color: var(--ink); background: var(--sheet); box-shadow: inset 0 -2px 0 var(--accent); }
.search svg { color: var(--muted); width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14.5px; text-overflow: ellipsis; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.menu-btn { display: none; }
#themeBtn .i-moon, :root[data-theme="dark"] #themeBtn .i-sun { display: none; }
:root[data-theme="dark"] #themeBtn .i-moon { display: block; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 45; max-height: min(72vh, 560px); overflow-y: auto;
  background: var(--sheet); border: 1px solid var(--ink); box-shadow: var(--lift); padding: 4px 0 6px;
}
.sg-group + .sg-group { border-top: 1px solid var(--rule); margin-top: 4px; }
.sg-label { margin: 9px 12px 3px; font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--faint); }
.sg-item { display: flex; align-items: center; gap: 10px; padding: 6px 12px; text-decoration: none; border-left: 3px solid transparent; }
.sg-item:hover, .sg-item.active { background: var(--paper); }
.sg-item.active { border-left-color: var(--accent); }
.sg-item .code { min-width: 34px; text-align: center; }
.sg-ico { display: grid; place-items: center; width: 34px; color: var(--muted); }
.sg-ico svg { width: 16px; height: 16px; }
.sg-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.sg-main { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout + sidebar ---------- */
.layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.sidebar {
  position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--rule-2); background: var(--paper); padding: 0 0 40px; scrollbar-width: thin;
}
.nav-top { display: grid; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.nav-label { font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--faint); margin: 16px 16px 6px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.nav-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 13px; text-decoration: none; font-weight: 500; font-size: 14px; color: var(--ink-2);
  border-left: 3px solid transparent;
}
.nav-link svg { width: 17px; height: 17px; color: var(--muted); }
.nav-link .nm { flex: 1; min-width: 0; }
.nav-link .code { border: 0; background: none; padding: 0; min-width: 30px; color: var(--faint); font-size: 11.5px; }
.nav-top .nav-link:hover { background: var(--sunk); }
.nav-top .nav-link[aria-current] { background: var(--sheet); border-left-color: var(--accent); color: var(--ink); font-weight: 600; }
.nav-top .nav-link[aria-current] svg { color: var(--ink); }

.nav-row { display: flex; align-items: center; background: var(--paper); }
.nav-row:hover { background: var(--sunk); }
/* The open discipline's row stays pinned while its tasks scroll, so it can always be folded again. */
.nav-item.open > .nav-row { position: sticky; top: 0; z-index: 2; }
.nav-item.current > .nav-row { background: var(--sheet); box-shadow: 0 1px 0 var(--rule), 0 -1px 0 var(--rule); }
.nav-item.current > .nav-row .nav-link { border-left-color: var(--accent); color: var(--ink); font-weight: 600; }
.nav-item.current > .nav-row .code { color: var(--accent-ink); }
.nav-toggle {
  width: 34px; height: 34px; margin-right: 4px; border: 0; background: transparent; cursor: pointer; flex: none;
  display: grid; place-items: center; color: var(--muted);
}
.nav-toggle:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); }
.nav-toggle svg { width: 15px; height: 15px; transition: transform .18s ease; }
.nav-item.open .nav-toggle svg { transform: rotate(90deg); }
.subwrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease; }
.nav-item.open > .subwrap { grid-template-rows: 1fr; }
.sidebar .subnav { overflow: hidden; min-height: 0; visibility: hidden; margin-left: 28px; border-left: 1px solid var(--rule-2); transition: visibility 0s linear .2s; }
.nav-item.open .subnav { visibility: visible; transition-delay: 0s; }
.subnav li:first-child { padding-top: 4px; }
.subnav li:last-child { padding-bottom: 10px; }
.subnav a { display: flex; gap: 9px; padding: 4px 10px 4px 12px; text-decoration: none; font-size: 13.5px; line-height: 1.45; color: var(--muted); margin-left: -1px; border-left: 1px solid transparent; }
.subnav a .n { font: 400 11px/1.8 var(--f-mono); color: var(--faint); }
.subnav a:hover { color: var(--ink); background: var(--sunk); }
.subnav a[aria-current] { color: var(--ink); font-weight: 600; border-left-color: var(--accent); background: var(--sheet); }
.subnav a[aria-current] .n { color: var(--accent-ink); }
#savedCount { margin-right: 8px; }

main { min-width: 0; padding: 26px clamp(16px, 4vw, 44px) 24px; outline: none; }
main:focus-visible { outline: none; } /* focused by script after navigation, not a control */
#view { max-width: 1100px; margin: 0 auto; min-height: 60vh; }
.foot { max-width: 1100px; margin: 64px auto 0; padding-top: 14px; border-top: 1px solid var(--ink); display: flex; align-items: center; gap: 10px; color: var(--muted); font: 400 12px var(--f-mono); }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--f-display); line-height: 1.12; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(32px, 4.2vw, 50px); font-weight: 700; letter-spacing: -.005em; }
h1.h1-sm { font-size: clamp(27px, 3.2vw, 36px); }
h2 { font-size: clamp(22px, 2.4vw, 26px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
.lead { font-size: 16.5px; color: var(--ink-2); max-width: 60ch; margin: 12px 0 0; }
.lead.sm { font-size: 14.5px; color: var(--muted); margin-top: 6px; }
p { max-width: 70ch; }

/* ---------- home ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); border: 1px solid var(--ink); background: var(--sheet);
}
.hero-text { padding: clamp(22px, 3.4vw, 40px); align-self: center; }
.hero-art {
  min-height: 300px; padding: 18px; border-left: 1px solid var(--rule-2); display: grid; place-items: center;
  background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 20px 20px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 20px 20px, var(--paper);
}
.hero-art .iso { height: auto; max-height: 400px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.try { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 18px 0 0; font-size: 13.5px; color: var(--muted); }
.ex { border: 0; background: none; padding: 0; cursor: pointer; font: 400 13px var(--f-mono); color: var(--ink-2); border-bottom: 1px dashed var(--rule-2); }
.ex:hover { color: var(--accent-ink); border-bottom-color: currentColor; }
.titleblock { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-top: 1px solid var(--ink); }
.titleblock > div { padding: 12px 18px 13px; }
.titleblock > div + div { border-left: 1px solid var(--rule-2); }
.titleblock dd { margin: 0; font: 700 28px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.titleblock dt { font: 400 11.5px var(--f-mono); color: var(--muted); margin-top: 5px; }
.titleblock > div:last-child dd { color: var(--accent-ink); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 44px 0 14px; flex-wrap: wrap; }
.more-link { font-size: 14px; font-weight: 500; text-underline-offset: 3px; }
.more-link:hover { color: var(--accent-ink); }
.group-label { font: 500 12px var(--f-mono); text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; display: flex; align-items: center; gap: 12px; }
.group-label::after { content: ""; flex: 1; height: 1px; background: var(--rule-2); }
.section-head + .group-label { margin-top: 0; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 14px; }
.dcard { display: flex; flex-direction: column; text-decoration: none; background: var(--sheet); border: 1px solid var(--rule-2); transition: border-color .12s; }
.dcard:hover { border-color: var(--ink); }
.dcard .art {
  height: 170px; padding: 10px; border-bottom: 1px solid var(--rule-2);
  background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, var(--paper);
}
.dcard .art .iso { transition: transform .2s ease; }
.dcard:hover .art .iso { transform: translateY(-4px); }
.dcard .tb { display: flex; align-items: baseline; gap: 9px; padding: 12px 14px 0; }
.dcard .nm { font: 600 18.5px/1.2 var(--f-display); }
.dcard:hover .nm { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.dcard .desc { padding: 5px 14px 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); flex: 1; }
.dcard .meta { padding: 10px 14px 12px; font: 400 11.5px var(--f-mono); color: var(--faint); }

/* ---------- discipline / task / style pages ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { color: var(--rule-2); }
.crumbs [aria-current] { color: var(--ink-2); font-weight: 500; }
.dhead { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.dhead > div:first-child { min-width: 0; flex: 1; }
.dhead.sheet { align-items: stretch; gap: 0; border: 1px solid var(--ink); background: var(--sheet); }
.dhead.sheet > div:first-child { padding: clamp(18px, 2.6vw, 28px); align-self: center; }
.dh-art {
  flex: none; width: 250px; padding: 14px; border-left: 1px solid var(--rule-2); display: grid; place-items: center;
  background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, var(--paper);
}
.dh-art .iso { height: auto; max-height: 180px; }
.pager { display: flex; gap: 8px; flex: none; max-width: 100%; }
.pager .btn { max-width: 220px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--rule-2); margin-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: baseline; gap: 7px; padding: 8px 0 9px; text-decoration: none; font: 600 17px var(--f-display);
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

/* register: a ruled list of rows */
.reg { border-top: 1px solid var(--ink); }
.tabs + .reg { border-top: 0; }
.reg-head, .prow { display: grid; grid-template-columns: 104px minmax(0, 1fr) minmax(0, 1.5fr) 18px 20px; gap: 14px; align-items: baseline; padding-inline: 10px; }
.reg-head { padding-block: 7px; border-bottom: 1px solid var(--rule-2); font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--faint); }
.prow { padding-block: 9px; text-decoration: none; border-bottom: 1px solid var(--rule); transition: background-color .1s; }
.prow:hover { background: var(--sheet); }
.prow .code { border: 0; background: none; padding: 0; font-size: 12.5px; color: var(--muted); }
.prow:hover .code { color: var(--accent-ink); }
.prow .ttl { font-weight: 600; line-height: 1.4; }
.prow .sub { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.prow .star { align-self: center; color: var(--accent); visibility: hidden; }
.prow .star svg { width: 14px; height: 14px; fill: currentColor; display: block; }
.prow.saved .star { visibility: visible; }
.prow .go { color: var(--faint); transition: transform .12s, color .12s; }
.prow:hover .go { color: var(--accent-ink); transform: translateX(3px); }
.prow .cnt { text-align: right; }
.reg.styles .reg-head, .reg.styles .prow { grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1.5fr) 70px 20px; }
.reg.styles .reg-head span:nth-child(4) { text-align: right; }
.reg.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; }
.reg.two .prow { grid-template-columns: 26px minmax(0, 1fr) auto 20px; }
.prow.skel { height: 41px; background: linear-gradient(100deg, transparent 30%, var(--sunk) 50%, transparent 70%) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
select {
  appearance: none; border: 1px solid var(--rule-2); background: var(--sheet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23889' stroke-width='2'/%3E%3C/svg%3E") right 10px center / 16px no-repeat;
  color: var(--ink); border-radius: 2px; padding: 7px 34px 7px 11px; font-size: 14px; max-width: 100%;
}
.count { color: var(--muted); font: 400 12.5px var(--f-mono); margin-left: auto; font-variant-numeric: tabular-nums; }
.btn.more { display: flex; margin: 22px auto 0; }
.empty { padding: 44px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--rule-2); }

/* ---------- guide ---------- */
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 24px; border: 1px solid var(--ink); background: var(--sheet); overflow: hidden; }
.step { padding: 16px 18px 18px; border-right: 1px solid var(--rule-2); margin-right: -1px; border-bottom: 1px solid var(--rule-2); margin-bottom: -1px; }
.step::before { counter-increment: s; content: counter(s, decimal-leading-zero); display: block; font: 700 30px/1 var(--f-display); color: var(--accent-ink); margin-bottom: 10px; }
.step p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.tbl-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--faint); border-bottom-color: var(--rule-2); }
td.n { font: 400 12.5px/1.8 var(--f-mono); color: var(--muted); white-space: nowrap; }
.recipes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.recipe { background: var(--sheet); border: 1px solid var(--rule-2); padding: 14px 18px 16px; }
.recipe ol { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; font-size: 14px; color: var(--ink-2); }
.keys div { display: flex; align-items: center; gap: 10px; }
.callout { margin-top: 36px; background: var(--sheet); border: 1px solid var(--rule-2); border-left: 4px solid var(--accent); padding: 14px 18px 16px; }
.callout ul { margin: 6px 0 0; padding-left: 20px; }
.anatomy { background: var(--sheet); border: 1px solid var(--rule-2); padding: 6px 18px; }
.arow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 38%); gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.arow:last-child { border-bottom: 0; }
.arow code { font: 13.5px/1.6 var(--f-mono); min-width: 0; overflow-wrap: anywhere; }
.arow .an { font-size: 13px; color: var(--muted); }
.arow .an::before { content: "← "; color: var(--accent); }
@media (max-width: 640px) { .arow { grid-template-columns: 1fr; gap: 2px; } }
.anatomy .k { font-weight: 600; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; justify-content: flex-end; animation: fade .16s ease; }
.drawer-panel {
  width: min(700px, 100%); height: 100%; background: var(--sheet); border-left: 1px solid var(--ink);
  display: flex; flex-direction: column; box-shadow: var(--lift); animation: slide .2s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(28px); opacity: .5; } }
.drawer-head { padding: calc(14px + env(safe-area-inset-top, 0px)) 24px 16px; border-bottom: 1px solid var(--ink); }
.d-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.d-meta { margin: 0; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); min-width: 0; }
.d-meta .code { color: var(--accent-ink); border-color: var(--accent); background: none; }
.d-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-actions { display: flex; gap: 6px; flex: none; }
#dTitle { font-size: 28px; }
.d-use { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }
.d-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 22px; display: flex; flex-direction: column; gap: 14px; background: var(--paper); }
.d-scroll > * { flex-shrink: 0; }
.fill { border: 1px solid var(--rule-2); background: var(--sheet); }
.fill summary { cursor: pointer; padding: 9px 14px; font: 600 16px var(--f-display); }
.fill-fields { display: grid; gap: 10px; padding: 2px 14px 4px; }
.field { display: grid; gap: 4px; }
.field > span { font: 500 11.5px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--rule-2); background: var(--paper); border-radius: 2px; padding: 8px 10px; font-size: 14px; line-height: 1.5; resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.field ::placeholder { color: var(--faint); }
.fill-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; padding: 6px 14px 12px; }
.fill-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.flow-t { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.flow-t b { color: var(--ink); font-weight: 600; }
.flow ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.flow li { display: flex; align-items: center; gap: 6px; }
.flow li + li::before { content: "→"; color: var(--faint); }
.flow button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--rule-2); background: var(--sheet); border-radius: 2px; padding: 4px 9px 4px 4px; font-size: 13px; cursor: pointer; }
.flow button .n { display: grid; place-items: center; width: 20px; height: 20px; font: 500 11px var(--f-mono); background: var(--sunk); }
.flow button:hover { border-color: var(--ink); }
.flow button[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; cursor: default; }
.flow button[aria-current] .n { background: var(--accent); color: #fff; }
.d-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.prompt {
  position: relative; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.7;
  background: var(--sheet); border: 1px solid var(--rule-2); padding: 18px 20px 30px; min-height: 200px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.prompt::after {
  content: "© Lâm Văn Phong"; position: absolute; right: 14px; bottom: 8px; font: 400 11px var(--f-mono);
  color: var(--muted); opacity: .5; pointer-events: none;
}
.prompt .ph { background: var(--accent-soft); color: var(--accent-ink); padding: 1px 3px; font-weight: 600; }
.prompt .filled { background: var(--ok-soft); color: var(--ok); padding: 1px 3px; font-weight: 600; }
.prompt .lbl { font-weight: 700; }
.prompt.loading { color: var(--muted); }
.d-hint { margin: 0; font-size: 13px; color: var(--muted); }
.d-nav {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px;
  padding: 11px 24px calc(11px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--ink); background: var(--sheet);
}
.d-nav .btn { font-weight: 500; font-size: 13.5px; padding: 7px 12px; border-color: var(--rule-2); }
.d-nav #dPrev { justify-self: start; max-width: 100%; }
.d-nav #dNext { justify-self: end; max-width: 100%; }
.d-pos { font: 400 12px var(--f-mono); color: var(--muted); white-space: nowrap; }

/* ---------- site chrome: top navigation, and which pages get the library sidebar ---------- */
.topnav { display: flex; gap: 2px; margin-left: 6px; flex: none; }
.topnav a { padding: 6px 10px 5px; text-decoration: none; font: 600 16px var(--f-display); color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.topnav a:hover { color: var(--ink); }
.topnav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.top-cta { display: none; height: 36px; }
body.mode-site .top-cta { display: inline-flex; }
body.mode-site .search-wrap { display: none; }
body.mode-site .top-actions { margin-left: auto; }
.nav-site { display: none; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
.nav-site .nav-link:hover { background: var(--sunk); }
.nav-site .nav-link[aria-current] { background: var(--sheet); border-left-color: var(--accent); color: var(--ink); font-weight: 600; }
.nav-site .nav-link[aria-current] svg { color: var(--ink); }
body.mode-site .nav-lib { display: none; }
body.mode-site .layout { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { body.mode-site .sidebar, body.mode-site .scrim { display: none; } }
@media (max-width: 1279px) { .support-btn .lbl { display: none; } .support-btn { width: 36px; padding: 0; } }
@media (max-width: 1099px) {
  .topnav { display: none; }
  .nav-site { display: grid; }
  body.mode-site .menu-btn { display: inline-grid; }
  body.mode-site .sidebar {
    position: fixed; z-index: 55; top: 0; left: 0; bottom: 0; height: auto; width: min(310px, 88vw);
    padding-top: env(safe-area-inset-top, 0px); transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.mode-site .sidebar.open { transform: none; visibility: visible; transition-delay: 0s; box-shadow: var(--lift); }
  body.mode-site .scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); }
}
@media (max-width: 760px) { body.mode-site .top-cta { display: none; } }

/* ---------- portfolio pages ---------- */
.hero.me h1 { font-size: clamp(40px, 5.2vw, 62px); }
.hero.me.about h1 { font-size: clamp(27px, 3.2vw, 36px); }
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.role { margin: 8px 0 0; font: 600 19px/1.3 var(--f-display); color: var(--accent-ink); max-width: none; }
.hero-art.portrait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.portrait .qr-frame { width: min(100%, 290px); }
.portrait img { display: block; width: 100%; height: auto; border: 1px solid var(--rule-2); background: var(--sheet); }
.facts { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 26px; }
.facts dt { font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.titleblock dd.sm { font-size: 19px; line-height: 1.2; }
.doors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.door { display: flex; flex-direction: column; text-decoration: none; background: var(--sheet); border: 1px solid var(--rule-2); transition: border-color .12s; }
.door:hover { border-color: var(--ink); }
.door .art {
  height: 160px; padding: 10px; border-bottom: 1px solid var(--rule-2);
  background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, var(--paper);
}
.door .art .iso { transition: transform .2s ease; }
.door:hover .art .iso { transform: translateY(-4px); }
.door .k { padding: 14px 18px 0; font: 500 11.5px var(--f-mono); text-transform: uppercase; color: var(--accent-ink); }
.door h3 { padding: 2px 18px 0; font-size: 23px; }
.door p { flex: 1; margin: 0; padding: 6px 18px 0; font-size: 14px; color: var(--muted); }
.door .go { padding: 12px 18px 16px; font-weight: 600; font-size: 14px; }
.door:hover .go { color: var(--accent-ink); }
.xgrid { list-style: none; counter-reset: x; margin: 0; padding: 0; display: grid; border: 1px solid var(--ink); background: var(--sheet); overflow: hidden; }
.xgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.xgrid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.xgrid li { counter-increment: x; padding: 16px 18px 18px; border-right: 1px solid var(--rule-2); margin-right: -1px; border-bottom: 1px solid var(--rule-2); margin-bottom: -1px; }
.xgrid li::before { content: counter(x, decimal-leading-zero); display: block; margin-bottom: 6px; font: 500 12px var(--f-mono); color: var(--accent-ink); }
.xgrid h3 { font-size: 19.5px; }
.xgrid p { margin: 5px 0 0; font-size: 14px; color: var(--muted); }
.band { margin-top: 44px; margin-bottom: 0; }
.band h2 { font-size: clamp(24px, 2.8vw, 32px); }
.band .note { margin: 12px 0 0; padding-left: 12px; border-left: 3px solid var(--accent); font-size: 13.5px; color: var(--ink-2); }
.band .hero-cta { margin-top: 16px; }
.band .dh-art { width: 280px; }
.tl { border-top: 1px solid var(--ink); }
.tl-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding: 14px 10px 16px; border-bottom: 1px solid var(--rule); }
.tl-date { margin: 4px 0 0; font: 500 12.5px var(--f-mono); color: var(--muted); }
.tl h3 { font-size: 20.5px; }
.tl-org { margin: 2px 0 6px; font-size: 14px; font-weight: 500; color: var(--accent-ink); }
.tl-row div > p:last-child { margin: 0; font-size: 14.5px; color: var(--ink-2); max-width: 82ch; }
.quote { margin: 44px 0 0; padding: 22px 26px; background: var(--sheet); border: 1px solid var(--ink); border-left: 4px solid var(--accent); }
.quote p { margin: 0; max-width: 42em; font: 600 clamp(20px, 2.4vw, 27px)/1.3 var(--f-display); }
.quote footer { margin-top: 12px; font: 400 12px var(--f-mono); color: var(--muted); }
.creds { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; }
.creds > div { background: var(--sheet); border: 1px solid var(--rule-2); padding: 16px 18px 4px; }
.creds ul { margin: 8px 0 16px; padding-left: 18px; font-size: 14.5px; display: grid; gap: 4px; }
.creds .lvl { color: var(--muted); font-size: 13px; }
.intro { margin: -6px 0 14px; }
.compat.svc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.svc .more-link { display: inline-block; margin-top: 10px; }
.svc h3 + p { margin-top: 6px; }
.prow.lrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 20px; }
.prow.arow { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.5fr) 20px; }
.group-label + .hero-cta, .ticks + .hero-cta { margin-top: 18px; }
.contact .muted { font: 400 12px var(--f-mono); margin-top: 10px; }
@media (max-width: 900px) { .xgrid.three, .xgrid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .band .dh-art { display: none; } }
@media (max-width: 760px) {
  .doors, .creds, .compat.svc { grid-template-columns: minmax(0, 1fr); }
  .tl-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .portrait .qr-frame { width: min(100%, 200px); }
  .prow.lrow, .prow.arow { grid-template-columns: minmax(0, 1fr) 20px; }
  .prow.arow .code { grid-column: 1 / -1; }
  .prow.lrow .sub, .prow.arow .sub { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 560px) { .xgrid.three, .xgrid.four { grid-template-columns: minmax(0, 1fr); } }

/* ---------- motion ---------- */
/* JS adds these classes only when motion is allowed; without them every element is simply in place. */
#view.enter { animation: view-in .22s ease-out; }
@keyframes view-in { from { opacity: 0; } }
.rv { opacity: 0; }
.rv.in { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.iso.build > * { opacity: 0; }
.iso.build.go > * { animation: piece .38s ease-out both; }
@keyframes piece { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.wait { opacity: 0; }
.pop { animation: pop .32s ease-out both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tw .off, .cmd .off { visibility: hidden; }
.caret { display: inline-block; width: 2px; height: 1.05em; margin: 0 1px -2px 1px; background: var(--accent); animation: blink .9s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- project page ---------- */
.shot { display: block; background: var(--sheet); border: 1px solid var(--ink); box-shadow: var(--lift); min-width: 0; }
.shot-bar { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-bottom: 1px solid var(--ink); background: var(--sunk); font: 500 11.5px var(--f-mono); color: var(--ink-2); }
.shot-bar i { width: 8px; height: 8px; border: 1px solid var(--ink-2); }
.shot-bar b { margin-left: 8px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-bar em { margin-left: auto; font-style: normal; color: var(--muted); white-space: nowrap; }
.shot img { display: block; width: 100%; height: auto; }
.hero.proj .hero-art { padding: 22px; }
.hero.proj .hero-art .shot { width: 100%; }
.band.feat { align-items: center; gap: 0; margin-top: 44px; }
.band.feat .shot { flex: none; width: min(46%, 520px); margin: 22px; transition: transform .2s ease; }
.band.feat .shot:hover { transform: translateY(-3px); }
.tour { display: grid; grid-template-columns: minmax(0, 1fr) 250px; border: 1px solid var(--ink); background: var(--sheet); }
.tour-screen { padding: 16px; background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, var(--paper); border-right: 1px solid var(--rule-2); min-width: 0; }
.tour-screen .shot { box-shadow: none; }
#tourImg.swap { animation: swap .35s ease-out; }
@keyframes swap { from { opacity: .25; transform: scale(1.012); } }
.tour-progress { height: 3px; margin-top: 12px; background: var(--rule); }
.tour-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.tour-progress i.run { animation: fill 5s linear forwards; }
.tour:hover .tour-progress i.run, .tour:focus-within .tour-progress i.run { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
.tour-steps { list-style: none; margin: 0; padding: 8px 0; display: grid; align-content: start; }
.tour-steps button { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; border: 0; border-left: 3px solid transparent; background: none; cursor: pointer; padding: 8px 14px 8px 13px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.tour-steps button .n { font: 400 11px var(--f-mono); color: var(--faint); }
.tour-steps button:hover { background: var(--paper); }
.tour-steps button[aria-current="true"] { border-left-color: var(--accent); background: var(--paper); color: var(--ink); font-weight: 600; }
.tour-steps button[aria-current="true"] .n { color: var(--accent-ink); }
.tour-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--ink); }
.tour-cap { margin: 0; font-size: 14.5px; color: var(--ink-2); max-width: none; min-height: 2.9em; }
.tour-cap b { color: var(--ink); }
.tour-ctl { display: flex; gap: 6px; flex: none; }
.stack { list-style: none; counter-reset: k; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.stack li { counter-increment: k; position: relative; display: grid; grid-template-columns: 54px minmax(0, 300px) minmax(0, 1fr); gap: 4px 18px; align-items: baseline; padding: 11px 10px; border-bottom: 1px solid var(--rule); }
.stack li::before { content: counter(k, decimal-leading-zero); font: 500 12px var(--f-mono); color: var(--accent-ink); }
.stack h3 { font-size: 19px; }
.stack p { margin: 0; font-size: 14px; color: var(--muted); max-width: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; max-width: none; }
.ticks.plain li::before { width: 7px; height: 7px; border: 0; background: var(--accent); transform: none; top: 17px; left: 13px; }

/* ---------- standalone pages and the RBI tools ---------- */
body.page .seg a { display: inline-flex; align-items: center; height: 34px; padding: 0 11px; text-decoration: none; font: 500 13px var(--f-mono); color: var(--muted); }
body.page .seg a + a { border-left: 1px solid var(--rule-2); }
body.page .seg a:hover { color: var(--ink); }
body.page .seg a[aria-current] { background: var(--ink); color: var(--paper); }
@media (max-width: 1099px) {
  /* no menu drawer on these pages: the links become a second, scrollable row */
  body.page .topbar { flex-wrap: wrap; height: auto; padding-block: 10px 0; row-gap: 8px; }
  body.page .topnav { display: flex; order: 5; flex-basis: 100%; margin: 0 -6px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--rule); }
}
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.duo-card { display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--ink); }
.duo-card .art { display: block; height: 170px; padding: 12px; border-bottom: 1px solid var(--rule-2);
  background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, var(--paper); }
.duo-card > div { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.duo-card h3 { font-size: 25px; }
.duo-card p { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-2); max-width: none; }
.duo-card .kicker { margin: 0 0 6px; color: var(--accent-ink); text-transform: uppercase; font-size: 11.5px; }
.duo-card .note, .band-note { margin: 12px 0 0; padding-left: 12px; border-left: 3px solid var(--accent); font-size: 13.5px; color: var(--ink-2); max-width: none; }
.duo-card .hero-cta { margin-top: auto; padding-top: 16px; }
.rbi-tool { border: 1px solid var(--ink); background: var(--sheet); }
#matrix { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); }
.mx { padding: 18px; min-width: 0; }
.mx-y, .mx-x { margin: 0 0 8px; font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.mx-x { margin: 8px 0 0; text-align: right; }
.mx-grid { display: grid; grid-template-columns: minmax(104px, auto) repeat(5, minmax(0, 1fr)); gap: 4px; }
.mx-lab { display: flex; align-items: center; gap: 7px; padding-right: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mx-lab b { font: 500 12px var(--f-mono); color: var(--ink); }
.mx-lab i, .mx-col i { font-style: normal; }
.mx-cell { height: 46px; border: 1px solid var(--ink); cursor: pointer; font: 500 13px var(--f-mono); color: #17212b; }
.mx-cell.low { background: #dcecd9; } .mx-cell.med { background: #f6e9b8; } .mx-cell.mh { background: #f7cda3; } .mx-cell.high { background: #ee9373; }
.mx-cell:hover { filter: brightness(.95); }
.mx-cell[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 1px; font-weight: 700; }
.mx-col { display: grid; justify-items: center; padding-top: 4px; font-size: 11.5px; line-height: 1.3; color: var(--muted); text-align: center; }
.mx-col b { font: 500 12px var(--f-mono); color: var(--ink); }
.mx-out { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 18px 20px; border-left: 1px solid var(--rule-2); background: var(--paper); min-width: 0; }
.mx-out p { margin: 0; max-width: none; }
.mx-pick, .mx-where { font: 500 12px var(--f-mono); color: var(--muted); text-transform: uppercase; }
.mx-level { font: 700 34px/1.1 var(--f-display); }
.mx-level.high { color: var(--accent-ink); }
.mx-advice { font-size: 14.5px; color: var(--ink-2); }
.calc { display: grid; gap: 14px; padding: 18px; }
.calc-in { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.calc-out { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.calc-out > div { padding: 12px 0 0; }
.calc-out dt { font: 500 11.5px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.calc-out dd { margin: 2px 0 0; font: 700 30px/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.calc-msg { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--accent-ink); max-width: none; }
.prow.srow { grid-template-columns: 170px minmax(0, 1fr); cursor: default; }
.prow.srow .code { color: var(--ink); font-weight: 600; }
@media (max-width: 760px) {
  .duo, #matrix { grid-template-columns: minmax(0, 1fr); }
  .mx-out { border-left: 0; border-top: 1px solid var(--rule-2); }
  .calc-in { grid-template-columns: minmax(0, 1fr); }
  .mx-grid { grid-template-columns: 26px repeat(5, minmax(0, 1fr)); }
  .mx-lab i, .mx-col i { display: none; }
  .prow.srow { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- free library band on the home page ---------- */
.tag { display: inline-block; font: 600 10.5px/1.6 var(--f-mono); text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--accent); padding: 0 6px; }
:root[data-theme="dark"] .tag { color: #06131f; }
.topnav .tag { margin-left: 6px; vertical-align: 2px; font-size: 9.5px; }
.btn.free { border-color: var(--accent); gap: 8px; }
.btn.free:hover { background: var(--accent); color: #fff; }
.btn.free:hover .tag { background: #fff; color: var(--accent-ink); }
.libband { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); margin-top: 22px; background: var(--sheet); border: 1px solid var(--ink); box-shadow: inset 0 5px 0 var(--accent); }
.lb-main { padding: clamp(22px, 3vw, 34px); padding-top: clamp(26px, 3vw, 38px); min-width: 0; }
.libband h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; color: var(--ink-2); }
.libband h2 .big { display: block; font-size: clamp(56px, 8vw, 96px); line-height: .95; font-weight: 700; color: var(--ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.lb-title { margin: 10px 0 0; font: 600 20px/1.25 var(--f-display); color: var(--accent-ink); }
.lb-search { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding: 5px 5px 5px 12px; background: var(--paper); border: 1px solid var(--ink); }
.lb-search:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.lb-search svg { color: var(--muted); width: 18px; height: 18px; }
.lb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 8px 0; text-overflow: ellipsis; }
.lb-search input::placeholder { color: var(--faint); }
.lb-side { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: clamp(22px, 3vw, 34px); padding-top: clamp(26px, 3vw, 38px); border-left: 1px solid var(--rule-2); min-width: 0;
  background: linear-gradient(var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px -1px / 16px 16px, var(--paper); }
.lb-facts { margin: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 4px 22px; }
.lb-facts dd { margin: 0; font: 700 26px/1 var(--f-display); }
.lb-facts dt { font: 400 11.5px var(--f-mono); color: var(--muted); margin-top: 3px; }
.lb-label { margin: 6px 0 -4px; font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.lb-samples { width: 100%; background: var(--sheet); border: 1px solid var(--rule-2); border-top: 1px solid var(--ink); }
.prow.lbrow { grid-template-columns: 92px minmax(0, 1fr) 20px; gap: 2px 12px; padding-block: 8px; }
.prow.lbrow .sub { grid-column: 2; font-size: 13px; }
.prow.lbrow .go { grid-row: 1; grid-column: 3; }
.lb-samples .prow:last-child { border-bottom: 0; }
.lb-codes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; border-top: 1px solid var(--ink); }
.lb-codes a { flex: 1 1 auto; display: flex; align-items: baseline; gap: 7px; padding: 8px 12px; text-decoration: none; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); margin: 0 -1px -1px 0; white-space: nowrap; }
.lb-codes a b { font: 500 11px var(--f-mono); color: var(--accent-ink); }
.lb-codes a:hover { background: var(--paper); color: var(--ink); }
@media (max-width: 900px) { .libband { grid-template-columns: minmax(0, 1fr); } .lb-side { border-left: 0; border-top: 1px solid var(--rule-2); } }
@media (max-width: 560px) { .lb-search { flex-wrap: wrap; padding: 6px 8px; } .lb-search .btn { width: 100%; } .lb-facts { grid-template-columns: repeat(2, auto); gap: 10px 22px; } .lb-codes a { flex: 1 1 45%; white-space: normal; } }

/* ---------- skill pack page ---------- */
.promo { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 14px; text-decoration: none; background: var(--sheet); border: 1px solid var(--rule-2); border-left: 4px solid var(--accent); }
.promo:hover { border-color: var(--ink); border-left-color: var(--accent); }
.promo .txt { flex: 1; min-width: 0; font-size: 14.5px; }
.promo .go { flex: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.promo:hover .go { color: var(--accent-ink); }
.skhero .hero-art .iso { max-height: 300px; }
table.cmp th[scope="row"] { font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--muted); white-space: nowrap; width: 1%; vertical-align: baseline; padding-top: 11px; }
table.cmp td { width: 46%; }
.ticks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.ticks li { position: relative; padding: 9px 10px 9px 34px; border-bottom: 1px solid var(--rule); max-width: none; }
.ticks li::before { content: ""; position: absolute; left: 11px; top: 15px; width: 11px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
/* four plans side by side; the long lists open on request */
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.plan { display: flex; flex-direction: column; min-width: 0; background: var(--sheet); border: 1px solid var(--rule-2); padding: 16px 16px 16px; }
.plan.featured { border-color: var(--ink); box-shadow: inset 0 4px 0 var(--accent); }
.plan-tag { margin: 0 0 4px; font: 500 10.5px var(--f-mono); text-transform: uppercase; color: var(--accent-ink); }
.plan h3 { font-size: 21px; }
.plan-for { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); min-height: 2.9em; }
.plan-price { margin: 10px 0 0; font: 700 27px/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.plan-save { align-self: flex-start; margin: 6px 0 0; padding: 1px 7px; font: 500 11px/1.6 var(--f-mono); background: var(--ok-soft); color: var(--ok); }
.plan-tag.none, .plan-save.none { visibility: hidden; }
.plan-support { align-self: flex-start; margin: 6px 0 0; padding: 1px 7px; font: 600 12px/1.6 var(--f-body); border: 1px solid var(--ink); }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; align-content: start; }
.plan li { position: relative; padding-left: 20px; }
.plan ul.key { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 13.5px; line-height: 1.45; flex: 1; }
.plan ul.key li::before, .plan ul.win li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 9px; height: 5px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.plan-more { display: none; }
.plans.open .plan-more { display: block; }
.plan h4 { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--rule); font: 500 10.5px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.plan-more ul { font-size: 13px; line-height: 1.45; }
.plan ul.get li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 6px; height: 6px; background: var(--ink-2); }
.plan ul.win li { font-weight: 500; }
.plan-pick { margin: 12px 0 0; padding: 8px 10px; background: var(--paper); border-left: 3px solid var(--accent); font-size: 13px; color: var(--ink-2); max-width: none; }
.plan-pick b { display: block; font: 500 10.5px var(--f-mono); text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.plan > .btn { margin-top: 14px; padding: 8px 10px; }
.plans-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 12px; }
.plans-foot .price-note { margin: 0; }
.plans-foot .btn { flex: none; }
@media (max-width: 1020px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } .plan-for { min-height: 0; } }
@media (max-width: 560px) { .plans { grid-template-columns: minmax(0, 1fr); } .plans-foot { flex-direction: column; } }
table.pcmp th[scope="row"] { font-weight: 500; font-size: 14px; color: var(--ink-2); text-transform: none; font-family: var(--f-body); }
table.pcmp thead th { font: 600 15px var(--f-display); text-transform: none; color: var(--ink); min-width: 120px; }
table.pcmp td { text-align: center; font-weight: 500; }
table.pcmp thead th:not(:first-child) { text-align: center; }
table.pcmp td:last-child, table.pcmp thead th:last-child { background: var(--sheet); }
table.pcmp .y { display: inline-block; width: 12px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg) translateY(-3px); }
table.pcmp .n { color: var(--faint); }
table.pcmp tr.price td, table.pcmp tr.price th { border-top: 1px solid var(--ink); font: 700 17px var(--f-display); }
@media (max-width: 760px) { table.pcmp { min-width: 640px; } }
/* mock of a working session: tabs, a chat turn, what the skill chose, the document it wrote */
.mock { border: 1px solid var(--ink); background: var(--sheet); }
.mock-top { display: flex; align-items: stretch; justify-content: space-between; background: var(--sunk); border-bottom: 1px solid var(--ink); }
.mock-bar { display: flex; gap: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mock-ctl { display: flex; align-items: center; gap: 6px; padding: 0 10px; flex: none; }
.mock-bar button { flex: none; border: 0; border-right: 1px solid var(--rule-2); border-top: 3px solid transparent; background: none; cursor: pointer; padding: 8px 16px 10px; font: 600 16px var(--f-display); color: var(--ink-2); white-space: nowrap; }
.mock-bar button:hover { background: var(--paper); }
.mock-bar button[aria-selected="true"] { background: var(--sheet); border-top-color: var(--accent); color: var(--ink); box-shadow: 0 1px 0 var(--sheet); position: relative; }
.mock-bar button:focus-visible { outline-offset: -3px; }
.mock-body { padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.turn { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: start; }
.turn .who { font: 500 11px/2.1 var(--f-mono); text-transform: uppercase; color: var(--muted); }
.turn.ai .who { color: var(--accent-ink); }
.bubble { justify-self: start; max-width: 74ch; background: var(--paper); border: 1px solid var(--rule-2); padding: 10px 14px; font-size: 14.5px; }
.bubble .file { display: flex; align-items: center; gap: 7px; width: fit-content; max-width: 100%; margin-bottom: 8px; padding: 4px 9px; border: 1px solid var(--rule-2); background: var(--sheet); font: 500 12px var(--f-mono); overflow-wrap: anywhere; }
.bubble .file svg { width: 16px; height: 16px; color: var(--accent-ink); }
.work { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 7px; border: 1px solid var(--rule-2); background: var(--paper); padding: 3px 9px; font-size: 13px; }
.chip b { font: 500 10.5px var(--f-mono); text-transform: uppercase; color: var(--accent-ink); }
.doc { position: relative; border: 1px solid var(--rule-2); background: var(--paper); padding: 16px 18px 14px; }
.doc h3 { font-size: 21px; }
.doc h4 { margin: 14px 0 6px; font: 600 16px var(--f-display); }
.doc ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 3px; }
.doc-tbl { overflow-x: auto; border-top: 1px solid var(--ink); background: var(--sheet); }
.doc-tbl table { font-size: 13px; min-width: 520px; }
.doc-tbl th, .doc-tbl td { padding: 6px 9px; }
.doc .more { margin: 12px 0 0; font: 400 12px var(--f-mono); color: var(--muted); }
.mock-note { margin: 0; padding: 9px 18px 10px; border-top: 1px solid var(--rule-2); font: 400 12px var(--f-mono); color: var(--muted); max-width: none; }
/* three stages joined by arrows */
.flow3 { list-style: none; counter-reset: f; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px; }
.flow3 li { position: relative; counter-increment: f; background: var(--sheet); border: 1px solid var(--ink); padding: 14px 16px 16px; }
.flow3 li::before { content: counter(f, decimal-leading-zero); display: block; font: 700 26px/1 var(--f-display); color: var(--accent-ink); margin-bottom: 8px; }
.flow3 li + li::after { content: "→"; position: absolute; left: -27px; top: 50%; transform: translateY(-50%); font: 500 20px var(--f-mono); color: var(--ink); }
.flow3 p { margin: 5px 0 0; font-size: 14px; color: var(--muted); }
.compat { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); border: 1px solid var(--ink); background: var(--sheet); overflow: hidden; margin-bottom: 4px; }
.compat > div { padding: 16px 18px 18px; border-right: 1px solid var(--rule-2); margin-right: -1px; border-bottom: 1px solid var(--rule-2); margin-bottom: -1px; }
.compat h3 { font-size: 21px; }
.compat .eg { margin: 4px 0 8px; font: 500 12px var(--f-mono); color: var(--accent-ink); }
.compat p { margin: 0; font-size: 14px; color: var(--ink-2); }
/* the install window */
.term-box { position: relative; }
.term { margin: 0; overflow-x: auto; background: #111a23; color: #dfe7ee; border: 1px solid var(--ink); padding: 16px 18px; font: 400 13px/1.65 var(--f-mono); }
:root[data-theme="dark"] .term { background: #06121e; border-color: var(--rule-2); }
.term .p { color: #ff9a62; }
.term .dim { color: #8fa0b0; }
.term .ln { display: inline-block; min-height: 1.65em; }
.term-replay { position: absolute; top: 10px; right: 10px; background: transparent; color: #dfe7ee; border-color: #4a5a69; }
.term-replay:hover { background: #dfe7ee; color: #111a23; }
.price-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); max-width: none; }
.faq { border-top: 1px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 11px 10px; font-weight: 600; }
.faq summary:hover { background: var(--sheet); }
.faq p { margin: 0; padding: 0 10px 14px 10px; color: var(--ink-2); max-width: 78ch; }
.contact { scroll-margin-top: calc(var(--top) + 16px); outline: none; }
.contact p { margin: 6px 0 0; }
.contact .muted { color: var(--muted); }
.contact-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.contact-row .v { font: 500 13px var(--f-mono); color: var(--muted); }
.contact-row .btn:hover .v { color: inherit; }
#skPlans { scroll-margin-top: calc(var(--top) + 16px); }
@media (max-width: 900px) {
  .tour { grid-template-columns: minmax(0, 1fr); }
  .tour-screen { border-right: 0; border-bottom: 1px solid var(--rule-2); }
  .tour-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .band.feat { flex-direction: column; align-items: stretch; }
  .band.feat .shot { width: auto; margin: 0 16px 18px; }
  .stack li { grid-template-columns: 34px minmax(0, 1fr); }
  .stack p { grid-column: 2; }
}
@media (max-width: 760px) {
  .tour-foot { flex-direction: column; align-items: stretch; }
  .tour-ctl { justify-content: flex-end; }
  .mock-top { flex-direction: column; }
  .mock-ctl { padding: 6px 10px; border-top: 1px solid var(--rule-2); justify-content: flex-end; }
  .flow3 { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .flow3 li + li::after { content: "↓"; left: 50%; top: -27px; transform: translateX(-50%); }
  .turn { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .mock-body { padding: 14px 12px; }
}
@media (max-width: 640px) { .promo { flex-wrap: wrap; } table.cmp td { width: auto; } }

/* ---------- support ---------- */
.support-btn { height: 36px; }
.foot-support { margin-left: auto; font: inherit; text-decoration: none; }
.foot-support:hover { text-decoration: underline; text-underline-offset: 3px; }
.fab {
  position: fixed; z-index: 35; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--lift); transition: background-color .12s, border-color .12s, transform .12s;
}
.fab svg { width: 24px; height: 24px; }
.fab:hover, .fab:focus-visible { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .fab:hover, :root[data-theme="dark"] .fab:focus-visible { color: #06131f; }
.fab:active { transform: scale(.96); }
.fab-label {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 5px 12px; font: 500 13px var(--f-body);
  opacity: 0; visibility: hidden; transition: opacity .12s;
}
@media (hover: hover) { .fab:hover .fab-label, .fab:focus-visible .fab-label { opacity: 1; visibility: visible; } }
.fab.pulse { animation: fab-pulse .9s ease-out 1; }
@keyframes fab-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
/* never sit on top of an open prompt, the support dialog or the mobile menu */
body.lock .fab, body.menu-open .fab { display: none; }

.modal { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: grid; place-items: center; padding: 20px; animation: fade .16s ease; }
.modal-card {
  width: min(720px, 100%); max-height: min(92vh, 800px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet); border: 1px solid var(--ink); box-shadow: var(--lift);
}
.modal-head { display: flex; align-items: center; gap: 16px; padding: 16px 20px 16px 16px; }
.modal-art { flex: none; width: 84px; height: 84px; }
.modal-head > div:nth-child(2) { flex: 1; min-width: 0; }
.modal-head .iconbtn { align-self: flex-start; }
.modal-head h2 { font-size: 30px; }
.modal-head p { margin: 5px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); max-width: 52ch; }
/* tabs: a row of drawing-sheet tabs; the selected one joins the panel below */
.sup-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--sunk); border-block: 1px solid var(--ink); }
.sup-tabs button {
  display: grid; gap: 1px; text-align: left; min-width: 0; cursor: pointer; padding: 9px 16px 11px; background: none;
  border: 0; border-top: 3px solid transparent; transition: background-color .12s;
}
.sup-tabs button + button { border-left: 1px solid var(--rule-2); }
.sup-tabs .k { font: 500 10.5px var(--f-mono); text-transform: uppercase; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-tabs .n { font: 600 19px/1.2 var(--f-display); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-tabs button:hover { background: var(--paper); }
.sup-tabs button[aria-selected="true"] { background: var(--sheet); border-top-color: var(--accent); box-shadow: 0 1px 0 var(--sheet); }
.sup-tabs button[aria-selected="true"] .n { color: var(--ink); }
.sup-tabs button[aria-selected="true"] .k { color: var(--accent-ink); }
.sup-tabs button:focus-visible { outline-offset: -3px; }
.sup-body { padding: 24px 22px 22px; }
.sup-tabs[hidden] + .sup-body { border-top: 1px solid var(--ink); }
.pay { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 28px; align-items: center; }
.pay.noqr { grid-template-columns: minmax(0, 1fr); }
/* crop marks at the corners, like a print sheet; the plate itself stays white in both themes so the code always scans */
.qr-frame {
  padding: 9px;
  background:
    linear-gradient(var(--ink), var(--ink)) left top / 16px 1.5px, linear-gradient(var(--ink), var(--ink)) left top / 1.5px 16px,
    linear-gradient(var(--ink), var(--ink)) right top / 16px 1.5px, linear-gradient(var(--ink), var(--ink)) right top / 1.5px 16px,
    linear-gradient(var(--ink), var(--ink)) left bottom / 16px 1.5px, linear-gradient(var(--ink), var(--ink)) left bottom / 1.5px 16px,
    linear-gradient(var(--ink), var(--ink)) right bottom / 16px 1.5px, linear-gradient(var(--ink), var(--ink)) right bottom / 1.5px 16px;
  background-repeat: no-repeat;
}
.qr-plate { background: #fff; padding: 12px; border: 1px solid var(--rule-2); }
.qr-plate img { display: block; width: 100%; height: auto; image-rendering: pixelated; -webkit-user-drag: none; }
.qr-hold { display: none; margin: 8px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.pay-info { min-width: 0; }
.pay-info .kicker { margin-bottom: 4px; color: var(--accent-ink); text-transform: uppercase; font-size: 11.5px; }
.pay-info h3 { font-size: 34px; font-weight: 700; }
.pay-info dl { margin: 14px 0 0; border-top: 1px solid var(--ink); }
.pay-info dl > div { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.pay-info dt { font: 500 11px var(--f-mono); text-transform: uppercase; color: var(--muted); }
.pay-info dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.pay-info dd.acct { font: 500 21px/1.3 var(--f-mono); letter-spacing: .03em; }
.pay-info dd.acct.sm { font-size: 15.5px; letter-spacing: 0; }
.pay-steps { counter-reset: st; list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.pay-steps li { counter-increment: st; display: flex; align-items: baseline; gap: 6px; }
.pay-steps li::before { content: counter(st); font: 500 11.5px var(--f-mono); color: var(--accent-ink); }
.pay-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pay-actions .btn { padding: 9px 16px; }
.sup-note { margin: 0; padding: 11px 22px 13px; font: 400 12px var(--f-mono); color: var(--muted); background: var(--paper); border-top: 1px solid var(--rule-2); max-width: none; }

/* the toast clears the floating button whenever that button is showing */
body:not(.lock):not(.menu-open) .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 640px), (hover: none) { .qr-hold { display: block; } }
@media (max-width: 640px) {
  .modal { place-items: end center; padding: 0; }
  .modal-card { width: 100%; max-height: 90vh; border-width: 1px 0 0; border-radius: 14px 14px 0 0; animation: sheet .2s ease; }
  .modal-head { padding: 14px 14px 12px; gap: 10px; align-items: flex-start; }
  .modal-art { width: 54px; height: 54px; }
  .modal-head h2 { font-size: 24px; }
  .modal-head p { font-size: 13.5px; }
  .sup-tabs button { padding: 8px 10px 9px; }
  .sup-tabs .n { font-size: 16px; }
  .sup-tabs .k { font-size: 9.5px; }
  .sup-body { padding: 18px 16px 16px; }
  .pay { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .pay-qr { width: min(100%, 250px); margin-inline: auto; }
  .pay-info h3 { font-size: 28px; }
  .pay-info dl > div { grid-template-columns: 104px minmax(0, 1fr); }
  .pay-info dd.acct { font-size: 19px; }
  .pay-actions .btn { flex: 1; }
  .sup-note { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .foot { flex-wrap: wrap; }
  /* one more button in the bar: let the name give way instead of pushing the actions onto a new row */
  .topbar { gap: 8px; padding-inline: 10px; }
  .brand { flex: 1 1 0; gap: 8px; }
  .brand-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
  .top-actions { gap: 6px; margin-left: 0; }
  .seg button { padding: 0 9px; }
}
@keyframes sheet { from { transform: translateY(24px); opacity: .6; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--paper); padding: 9px 16px; font-size: 14px; box-shadow: var(--lift); max-width: calc(100vw - 32px); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); } }
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; z-index: 55; top: 0; left: 0; bottom: 0; height: auto; width: min(310px, 88vw);
    padding-top: env(safe-area-inset-top, 0px); transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  }
  .sidebar.open { transform: none; visibility: visible; transition-delay: 0s; box-shadow: var(--lift); }
  .scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); }
  .dhead.split { flex-direction: column; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-art { border-left: 0; border-bottom: 1px solid var(--rule-2); min-height: 0; order: -1; padding: 12px; }
  .hero-art .iso { max-height: 230px; }
  .titleblock { grid-template-columns: repeat(2, 1fr); }
  .titleblock > div:nth-child(3) { border-left: 0; }
  .titleblock > div:nth-child(n + 3) { border-top: 1px solid var(--rule-2); }
  .dh-art { display: none; }
  .reg.two { grid-template-columns: minmax(0, 1fr); }
  .reg-head { display: none; }
  .prow, .reg.styles .prow { grid-template-columns: minmax(0, 1fr) 18px 20px; gap: 2px 10px; }
  .prow .code { grid-column: 1 / -1; }
  .prow .sub { grid-column: 1 / -1; grid-row: 3; }
  .prow.trow, .reg.two .prow.trow, .reg.styles .prow.trow { grid-template-columns: 26px minmax(0, 1fr) 20px; }
  .prow.trow .cnt { display: none; }
  .prow.trow .code { grid-column: auto; }
  .prow.trow .sub { grid-column: 2 / -1; grid-row: auto; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding-inline: 12px; flex-wrap: wrap; height: auto; padding-bottom: 10px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  :root { --top: 106px; }
  .brand-sub { display: none; }
  .search-wrap { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .top-actions { margin-left: auto; }
  .search .kbd { display: none; }
  .drawer-head, .d-scroll, .d-nav { padding-inline: 16px; }
  .d-pos { display: none; }
  .d-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .d-tools .btn.primary { flex: 1; }
  main { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; animation: none !important; } }
