/* Fonts, served from our own site (fonts/, SIL Open Font License) and preloaded by every page, so a page draws in
   them from its first frame instead of drawing a fallback and swapping. Figtree is one variable file for all weights. */
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/fonts/figtree-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Red Rose"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/fonts/red-rose-500-latin.woff2) format("woff2");
}
:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --line: #ececee;
  --line-strong: #dedee2;
  --text: #16171a;
  --muted: #6b6e76;
  --faint: #9a9da5;
  /* Brand colours, from the logo: a warm sunset gradient (coral → orange → amber); coral is the working accent.
     (--violet is the secondary accent; the name is kept so the stylesheet doesn't churn.) */
  --accent: #cf4c50;
  --accent-ink: #a8323d;
  --accent-soft: #fcedef;
  --violet: #d65c80;
  --violet-soft: #fdf0f4;
  /* Brand: red into rose. */
  --grad: linear-gradient(120deg, #c7463c 0%, #cf505a 50%, #d75e84 100%);
  --tint: #fff9fa;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* Figtree for the interface; Red Rose only for the headline. Numbers use tabular figures, not a mono face. */
  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Red Rose", var(--font);
  --icon: #16171a;
  --size: 28px;
  --nav-h: 64px;
  --bar-h: 67px; /* toolbar row: 14 + 38 control + 14 + 1 rule */
  /* Surfaces that differ between the light and dark themes. */
  --nav-bg: rgba(255, 255, 255, .86);
  --glass: rgba(255, 255, 255, .85);
  --hover-border: #cfd0d6;
  --warm-border: #f3cdd4;
  --grid-line: #f8e5e9;
  --stage-tint: linear-gradient(135deg, #fdeeef, #fcf0f3 55%, #fdf4f7);
  --shadow: 16, 17, 20;
  color-scheme: light;
}

/* Dark theme: follows the system unless the visitor picked one with the toggle (data-theme on <html>). The brand
   coral is lifted a little so it keeps its contrast on the dark ground. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0f1013;
    --surface: #17181c;
    --line: #25262c;
    --line-strong: #33353c;
    --text: #ececef;
    --muted: #9b9da6;
    --faint: #6d7079;
    --accent: #e3666c;
    --accent-ink: #f08d96;
    --accent-soft: #2c1518;
    --violet: #e8759a;
    --violet-soft: #2b1520;
    --tint: #181213;
    --icon: #ececef;
    --nav-bg: rgba(15, 16, 19, .82);
    --glass: rgba(23, 24, 28, .88);
    --hover-border: #3e4048;
    --warm-border: #4a222a;
    --grid-line: #251b1e;
    --stage-tint: linear-gradient(135deg, #25141a, #23141d 55%, #25171f);
    --shadow: 0, 0, 0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1013;
  --surface: #17181c;
  --line: #25262c;
  --line-strong: #33353c;
  --text: #ececef;
  --muted: #9b9da6;
  --faint: #6d7079;
  --accent: #e3666c;
  --accent-ink: #f08d96;
  --accent-soft: #2c1518;
  --violet: #e8759a;
  --violet-soft: #2b1520;
  --tint: #181213;
  --icon: #ececef;
  --nav-bg: rgba(15, 16, 19, .82);
  --glass: rgba(23, 24, 28, .88);
  --hover-border: #3e4048;
  --warm-border: #4a222a;
  --grid-line: #251b1e;
  --stage-tint: linear-gradient(135deg, #25141a, #23141d 55%, #25171f);
  --shadow: 0, 0, 0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ── Navigation ─────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 20; height: var(--nav-h);
  background: var(--nav-bg); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-in {
  max-width: 1280px; height: 100%; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; gap: 40px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.brand-name { font-family: var(--display); font-weight: 500; font-size: 17px; letter-spacing: -0.01em; } /* the wordmark, in the display face */
.brand-name span { color: var(--muted); font-weight: 500; }
.mark { width: 22px; height: 22px; display: block; filter: drop-shadow(0 2px 5px rgba(242, 80, 106, .35)); }
.links { display: flex; gap: 28px; font-size: 14px; color: var(--muted); }
.links a { transition: color .15s var(--ease); display: inline-flex; align-items: center; gap: 6px; }
.links a:hover, .links a[aria-current="page"] { color: var(--text); }
.soon {
  font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--violet-soft); color: var(--violet);
}
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.theme-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: transparent;
  display: grid; place-items: center; color: var(--text); transition: background .15s var(--ease), border-color .15s var(--ease);
}
.theme-btn:hover { background: var(--surface); border-color: var(--line-strong); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .moon { display: none; }
:root[data-dark] .theme-btn .sun { display: none; }
:root[data-dark] .theme-btn .moon { display: block; }
/* Docked search: once the big search box scrolls under the nav (html.docked), a compact field fades into the nav.
   Both fields edit the same query. Phones have no room for it: a search button opens it over the whole nav row. */
.nav-search {
  position: relative; flex: 0 1 420px; margin: 0 auto; height: 38px; display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 36px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg);
  opacity: 0; transform: translateY(-6px); pointer-events: none; visibility: hidden;
  transition: opacity .18s var(--ease), transform .22s var(--ease), border-color .15s var(--ease), visibility 0s linear .22s;
}
html.docked .nav-search { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.nav-search:hover { border-color: var(--hover-border); }
.nav-search:focus-within { border-color: var(--accent); }
.nav-search-ico { position: absolute; left: 12px; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.nav-search:focus-within .nav-search-ico { stroke: var(--accent); }
#nav-q { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 14px; }
#nav-q::placeholder { color: var(--faint); }
#nav-q::-webkit-search-cancel-button { display: none; }
.nav-search .kbd { margin: 0; padding: 0 6px; font-size: 11px; }
.nav-search:focus-within .kbd, .nav-search .kbd[hidden] { display: none; }
.nav-search-close, .nav-search-btn { display: none; }
@media (max-width: 640px) {
  .nav-search {
    position: absolute; left: 12px; right: 12px; top: 13px; margin: 0; z-index: 1;
    opacity: 0; visibility: hidden; pointer-events: none;
  }
  html.docked .nav-search { opacity: 0; visibility: hidden; pointer-events: none; }
  html.nav-searching .nav-search { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  html.nav-searching .nav-in > :not(.nav-search) { visibility: hidden; }
  html.docked .nav-search-btn { display: grid; }
  .nav-search-close { display: block; flex: none; border: 0; background: none; font-size: 14px; color: var(--muted); padding: 0 4px; }
  .nav-search .kbd { display: none; }
}
/* The glyph that appears turns in as the theme changes. */
.theme-btn svg { animation: theme-glyph .45s var(--ease); }
@keyframes theme-glyph { from { transform: rotate(-90deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
/* Theme change: the new theme is revealed as a growing circle (see app.js), so the default cross-fade is off. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn { background: var(--grad); color: #fff; border: 0; box-shadow: 0 1px 2px rgba(176, 52, 62, .24), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn:hover { filter: brightness(1.06) saturate(1.05); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface); }
.btn:active, .btn-ghost:active { transform: scale(.98); }

/* ── Hero ───────────────────────────────────────────── */
main { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.hero { position: relative; isolation: isolate; padding: 56px 0 48px; text-align: center; }
/* The icons page opens straight on the search: its heading is for screen readers only. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 {
  margin: 0 0 36px; font-family: var(--display); font-size: clamp(34px, 5vw, 54px); line-height: 1.08; font-weight: 500; letter-spacing: -0.03em;
}

/* Search: one calm field — a soft resting shadow, a stronger lift on hover, the brand ring on focus. The
   placeholder cycles through example queries so people see the three ways to search. */
.search {
  position: relative; max-width: 680px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; height: 62px; padding: 0 12px 0 56px;
  border: 1px solid var(--line-strong); border-radius: 18px; background: var(--bg);
  box-shadow: 0 1px 2px rgba(var(--shadow), .04), 0 10px 30px -14px rgba(var(--shadow), .14);
  transition: border-color .15s var(--ease), box-shadow .2s var(--ease);
}
.search:hover { border-color: var(--hover-border); box-shadow: 0 1px 2px rgba(var(--shadow), .05), 0 14px 36px -14px rgba(var(--shadow), .18); }
.search:focus-within { border-color: var(--accent); box-shadow: none; }
/* The "/" shortcut hint is only useful before the field has focus. */
.search:focus-within .kbd { display: none; }
.search:focus-within .search-ico { stroke: var(--accent); }
.search-ico { position: absolute; left: 20px; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; transition: stroke .15s var(--ease); }
.search input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; height: 100%; min-width: 0; letter-spacing: -0.005em; }
.search input::placeholder { color: var(--faint); transition: opacity .25s var(--ease); }
.search input.swap::placeholder { opacity: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.search[hidden] { display: none; }
.link-btn { border: 0; padding: 2px 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }
/* The three ways to search, as tabs over the field. */
.modes { display: inline-flex; gap: 2px; padding: 3px; margin: 0 auto 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.modes button { height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: none; font-size: 14px; color: var(--muted); transition: background .15s var(--ease), color .15s var(--ease); }
@media (hover: hover) { .modes button:hover { color: var(--text); } }
.modes button[aria-selected="true"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(var(--shadow), .06); }
/* Once the script measures the tabs, the selected look is one pill that slides between them. */
.modes.pill { position: relative; }
.modes.pill::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: var(--pill-x); width: var(--pill-w); border-radius: 9px;
  background: var(--bg); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(var(--shadow), .06);
  transition: left .42s cubic-bezier(.16, 1, .3, 1), width .42s cubic-bezier(.16, 1, .3, 1);
}
.modes.pill button { position: relative; z-index: 1; }
.modes.pill button[aria-selected="true"] { background: none; box-shadow: none; }
.mode-help { max-width: 680px; margin: 14px auto 0; min-height: 20px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.mode-help .link-btn { margin-left: 6px; }
.batch-help { color: var(--muted); }
/* List: the same bar as Search; it grows downwards only when several lines are pasted. */
.list-box {
  position: relative; max-width: 680px; margin: 0 auto; display: flex; align-items: flex-start; gap: 10px;
  min-height: 62px; padding: 10px 10px 10px 56px; text-align: left;
  border: 1px solid var(--line-strong); border-radius: 18px; background: var(--bg);
  box-shadow: 0 1px 2px rgba(var(--shadow), .04), 0 10px 30px -14px rgba(var(--shadow), .14);
  transition: border-color .15s var(--ease), box-shadow .2s var(--ease);
}
.list-box:hover { border-color: var(--hover-border); }
.list-box:focus-within { border-color: var(--accent); box-shadow: none; }
.list-box[hidden] { display: none; }
.list-box .search-ico { top: 19px; }
.list-box:focus-within .search-ico { stroke: var(--accent); }
#cards-text {
  flex: 1; min-width: 0; height: 40px; max-height: 220px; resize: none; overflow-y: auto; padding: 8px 0; border: 0; outline: 0;
  background: none; color: var(--text); font: inherit; font-size: 17px; line-height: 24px;
}
#cards-text::placeholder { color: var(--faint); }
.list-box .cards-count { flex: none; line-height: 40px; font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-box .cards-count:empty { display: none; }
.list-box .btn { flex: none; height: 40px; }
.btn:disabled, .btn-ghost:disabled { opacity: .45; pointer-events: none; }
.link-btn { border: 0; padding: 2px 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }
.search-clear {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--surface); color: var(--muted); transition: background .15s var(--ease), color .15s var(--ease);
}
.search-clear:hover { background: var(--accent-soft); color: var(--accent-ink); }
.search-clear svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.search-clear[hidden], .kbd[hidden] { display: none; }
.kbd {
  flex: none; font-size: 12px; color: var(--muted); border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 7px; padding: 2px 8px; background: var(--bg); margin-right: 6px;
}

/* ── Workspace ──────────────────────────────────────── */
.workspace { display: grid; grid-template-columns: 196px 1fr; gap: 40px; padding-bottom: 96px; }
/* The sidebar shares the toolbar's rows: its heading sits in the toolbar row (same height, same rule under it)
   and its first item lines up with the results line, so both columns read as one grid, scrolled or not. */
/* The sidebar scrolls, which clips anything past its box, so it reaches 10px past the column on both sides
   (padding gives the room back): the highlighted row can bleed evenly while names and counts stay on the column. */
.side { position: sticky; top: var(--nav-h); align-self: start; max-height: calc(100vh - var(--nav-h)); overflow: auto; scrollbar-width: none; margin: 0 -10px; padding: 0 10px 24px; }
.side::-webkit-scrollbar { display: none; }
.side-h {
  margin: 0; height: var(--bar-h); display: flex; align-items: center;
  border-bottom: 1px solid var(--line); font-size: 12px; color: var(--faint);
}
.side ul { list-style: none; margin: 0; padding: 11px 0 0; }
.side li button {
  display: flex; justify-content: space-between; align-items: center;
  border: 0; background: none; padding: 6px 10px; margin: 0 -10px; width: calc(100% + 20px); border-radius: 8px;
  font-size: 14px; color: var(--muted); text-align: left;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.side li button:hover { color: var(--text); }
.side li button[aria-current="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.side li button[aria-current="true"] .n { color: var(--accent); }
.side li .n { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

.toolbar {
  position: sticky; top: var(--nav-h); z-index: 10; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  min-height: var(--bar-h); padding: 14px 0; border-bottom: 1px solid var(--line);
}
.seg { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.seg button {
  border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 9px;
  font-size: 13px; color: var(--muted); transition: background .15s var(--ease), color .15s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--bg); color: var(--accent-ink); font-weight: 500; box-shadow: 0 1px 2px rgba(var(--shadow), .08), 0 0 0 1px var(--line); }
/* The settings sit in one capsule the height of the style tabs: Stroke | Size | colour, split by hairlines. */
.tools {
  display: flex; align-items: center; height: 38px; padding: 0 5px 0 0; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.ctl { position: relative; display: inline-flex; align-items: center; gap: 10px; height: 100%; padding: 0 14px; font-size: 13px; color: var(--muted); }
.tools > :not(:first-child)::before { content: ""; position: absolute; left: 0; top: 50%; width: 1px; height: 16px; margin-top: -8px; background: var(--line-strong); }
.ctl.off { opacity: .35; pointer-events: none; }
.ctl output { font-size: 12px; color: var(--text); width: 20px; text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 96px; height: 2px; background: var(--line-strong); border-radius: 2px; accent-color: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--accent); box-shadow: 0 1px 3px rgba(176, 52, 62, .2); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-strong); }
/* ══ Wake slider (wake-slider.js) ═════════════════════════
   Thin bars instead of a thumb. The bars are data marks, so they take the ink strengths: ink when lit,
   faint after the value. Bencho's --fill-on / --fill-slab map to our own --text (ink) and --bg (ground),
   so the slider follows light and dark mode. Heights are written by the script. */
.wks-native { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.wks-track {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; flex: 1; min-width: 0;
  cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; border-radius: 6px; color: var(--text);
}
.wks-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.wks-track.off { cursor: default; } /* the row around it already dims */
.wks-bar {
  flex: none; width: 3px; border-radius: 3px;
  background: color-mix(in srgb, var(--text) 22%, var(--bg));
  transform-origin: 50% 50%;
  transition: background-color 160ms ease;
}
.wks-bar[data-on] { background: var(--text); }
.ctl .wks-track { width: 80px; flex: none; }
/* The colour: a round dot in a ring, after the last hairline. */
.swatch { position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 100%; cursor: pointer; }
.swatch input { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer; background: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-strong); }
.swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch input::-moz-color-swatch { border: 0; border-radius: 50%; }
.swatch.off { opacity: .35; pointer-events: none; }
.swatch[hidden], .pal[hidden] { display: none; }

/* Colours for Flat and 3D: a main and an accent colour, or the natural palette. */
.pal { position: relative; display: flex; align-items: center; height: 100%; padding-left: 9px; }
.pal-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px 0 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--text);
}
.pal-btn:hover { border-color: var(--line-strong); }
.pal-dots { display: inline-flex; }
.pal-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--bg); }
.pal-dots i + i { margin-left: -5px; }
.pal-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 264px; padding: 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(var(--shadow), .04), 0 12px 32px -12px rgba(var(--shadow), .18);
}
.pal-h { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.pal-h:not(:first-child) { margin-top: 14px; }
.pal-row { display: grid; grid-template-columns: repeat(7, 28px); gap: 8px; }
.pal-row button, .pal-row label {
  position: relative; width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--c); box-shadow: inset 0 0 0 1px rgba(var(--shadow), .08);
}
.pal-row [aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }
.pal-row .same { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 10px; color: var(--muted); }
.pal-row .same[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }
.pal-row label.custom { background: conic-gradient(#e9443f, #f4ac1a, #23b26d, #2aa6e2, #8a5ceb, #e64b8f, #e9443f); overflow: hidden; }
.pal-row label.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pal-reset { margin-top: 14px; width: 100%; height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: none; font-size: 13px; color: var(--text); }
.pal-reset:hover { background: var(--surface); }

.results-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 14px; }
#status { margin: 0; font-size: 13px; color: var(--muted); }
#status b { color: var(--text); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
/* Colour styles carry their own padding and shadow, so they show a little larger to read at the same weight. */
.grid.colour { --icon-size: calc(var(--size) * 1.3); }
.content { min-width: 0; }
/* Tile hover: a quiet neutral card (no shadow, no lift), the icon nudges up to make room for its name, and a
   quick-copy button appears in the corner. Touch screens (no hover) skip all of it. */
.cell { position: relative; }
.tile {
  position: relative; width: 100%; aspect-ratio: 1 / 1; border: 1px solid transparent; border-radius: var(--radius);
  background: none; display: flex; align-items: center; justify-content: center;
  color: var(--icon); padding: 8px;
  transition: background .18s var(--ease), border-color .18s var(--ease), box-shadow .22s var(--ease), transform .22s var(--ease);
}
.tile svg { width: var(--icon-size, var(--size)); height: var(--icon-size, var(--size)); display: block; flex: none; transition: transform .22s var(--ease); }
.tile-name {
  position: absolute; left: 50%; bottom: 9px; max-width: calc(100% - 16px); transform: translate(-50%, 4px);
  font-size: 11px; line-height: 1.2; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; transition: opacity .18s var(--ease), transform .22s var(--ease);
}
.tile-copy {
  position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; border-radius: 8px; border: 0; padding: 0;
  display: grid; place-items: center; background: var(--bg); color: var(--muted);
  box-shadow: 0 0 0 1px var(--line); opacity: 0; transform: scale(.94);
  transition: opacity .15s var(--ease), transform .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.tile-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tile-copy:hover { color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.tile-copy.done { background: var(--text); color: var(--bg); box-shadow: none; }
@media (hover: hover) {
  .cell:hover .tile { background: var(--surface); border-color: var(--line); }
  .cell:hover .tile svg { transform: translateY(-5px); }
  .cell:hover .tile-name { opacity: 1; transform: translate(-50%, 0); }
  .cell:hover .tile-copy { opacity: 1; transform: scale(1); }
}
.tile:focus-visible .tile-name { opacity: 1; transform: translate(-50%, 0); }
.tile:focus-visible svg { transform: translateY(-5px); }
/* Selected: a crisp accent border on white, no glow; it wins over hover so the two never stack. */
.tile[aria-pressed="true"], .cell:hover .tile[aria-pressed="true"] { border-color: var(--accent); background: var(--bg); box-shadow: none; }
.group-h { grid-column: 1 / -1; margin: 22px 0 4px; font-size: 13px; font-weight: 500; color: var(--text); }
.group-h:first-child { margin-top: 0; }
.group-h span { color: var(--faint); font-size: 12px; margin-left: 8px; font-weight: 400; font-variant-numeric: tabular-nums; }
/* Best match: the top results as wide cards, the drawing larger and the name always shown. */
.best-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 232px)); gap: 8px; }
@media (max-width: 640px) { .best-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cell.best .tile { aspect-ratio: auto; height: 116px; padding-bottom: 26px; background: var(--surface); border-color: var(--line); --icon-size: calc(var(--size) * 1.45); }
.grid.colour .cell.best .tile { --icon-size: calc(var(--size) * 1.8); }
.cell.best .tile-name { opacity: 1; transform: translate(-50%, 0); color: var(--text); font-size: 12px; }
@media (hover: hover) {
  .cell.best:hover .tile { border-color: var(--line-strong); }
  .cell.best:hover .tile svg { transform: none; }
}
.tile-why { position: absolute; left: 50%; bottom: 10px; max-width: calc(100% - 16px); transform: translateX(-50%); font-size: 11px; line-height: 1.2; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.cell.best:has(.tile-why) .tile { height: 128px; padding-bottom: 40px; }
.cell.best:has(.tile-why) .tile-name { bottom: 26px; }
/* Touch screens have no hover, so the three answers keep copy and save in reach there. */
@media (hover: none) {
  .cell.best .tile-copy, .cell.best .tile-save { opacity: 1; transform: scale(1); }
  /* …and the drawing moves down clear of them. */
  .cell.best .tile, .cell.best:has(.tile-why) .tile { height: auto; min-height: 140px; padding-top: 44px; }
}
.group-h.related { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-weight: 400; }

.empty { text-align: center; padding: 72px 0; }
.understood { margin: -6px 0 16px; font-size: 13px; color: var(--faint); min-height: 0; }
.understood:empty { display: none; }
.u-word { color: var(--accent-ink); font-weight: 500; }
.u-via { color: var(--muted); }
.u-sep { color: var(--line-strong); }
#did-you-mean button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.empty-t { margin: 0; font-weight: 500; }
.empty-s { margin: 6px 0 20px; color: var(--muted); font-size: 14px; }

/* ── Detail panel ───────────────────────────────────── */
.panel {
  position: fixed; top: calc(var(--nav-h) + 12px); right: 12px; bottom: 12px; width: 380px; z-index: 30;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 20px;
  box-shadow: 0 24px 48px -24px rgba(var(--shadow), .18), 0 2px 6px rgba(var(--shadow), .04);
  overflow: auto; transform: translateX(16px); opacity: 0;
  transition: transform .22s var(--ease), opacity .18s var(--ease);
}
.panel.open { transform: none; opacity: 1; }
/* Desktop: the panel docks instead of covering icons. While it (or the Saved tray) is open the workspace makes
   exactly the room the panel would overlap — none on very wide screens — so the grid reflows beside it and every
   icon stays visible. The tiles glide to their new places in app.js (glide), not by animating this padding. Panel: 380px + 12px edge + 16px gap; content edge: 50vw + 640px - 32px padding above 1280px, so never more
   than the panel's own 376px footprint below it. */
@media (min-width: 901px) {
  html.panel-open .workspace, html.tray-open .workspace { padding-right: clamp(0px, calc(1016px - 50vw), 376px); }
}
/* Mid-size screens: the categories step aside while the panel is docked, so the grid keeps room for icons. */
@media (min-width: 901px) and (max-width: 1199px) {
  html.panel-open .workspace, html.tray-open .workspace { grid-template-columns: minmax(0, 1fr); }
  html.panel-open .side, html.tray-open .side { display: none; }
}
.panel-h { display: flex; justify-content: space-between; align-items: center; }
.panel-nav { display: flex; gap: 2px; }
.panel-cat { margin: 0; font-size: 12px; color: var(--violet); letter-spacing: .01em; }
.icon-btn { width: 32px; height: 32px; border-radius: 9px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
/* Stage: the icon large, on a background people can switch; the size tag shows the preview's real px. */
.stage {
  position: relative; margin: 14px 0 18px; height: 236px; border-radius: var(--radius);
  display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.stage[data-bg="grid"] {
  background-color: var(--tint);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 12px 12px; background-position: center;
}
.stage[data-bg="light"] { background: #fff; }
.stage[data-bg="tint"] { background: var(--stage-tint); border-color: transparent; }
.stage[data-bg="dark"] { background: #15161b; border-color: #15161b; }
.stage[data-bg="light"] { border-color: var(--line); }
.stage-icon { display: grid; place-items: center; }
.stage-icon svg { width: var(--play-size, 64px); height: var(--play-size, 64px); display: block; }
.stage-icon.pop { animation: pop .32s var(--ease); }
@keyframes pop { from { transform: translateY(6px) scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }
.stage-bgs {
  position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; padding: 5px;
  background: var(--glass); border-radius: 99px; box-shadow: 0 1px 3px rgba(var(--shadow), .1);
}
.stage-bgs button { width: 16px; height: 16px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 1px rgba(var(--shadow), .15); }
.stage-bgs [data-bg="grid"] { background: repeating-linear-gradient(90deg, #dfe6f8 0 1px, #f7f9ff 1px 4px); }
.stage-bgs [data-bg="light"] { background: #fff; }
.stage-bgs [data-bg="tint"] { background: linear-gradient(135deg, #f6d0d3, #f8d8e2, #fbe4ec); }
.stage-bgs [data-bg="dark"] { background: #15161b; }
.stage-bgs [aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }
.stage-size {
  position: absolute; right: 12px; bottom: 12px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--glass); padding: 2px 8px; border-radius: 99px;
}

/* Playground controls. */
.play { display: grid; gap: 12px; padding: 14px 0 18px; border-top: 1px solid var(--line); margin-top: 2px; }
.play-row { display: grid; grid-template-columns: 52px 1fr 30px; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.play-row.off { opacity: .35; pointer-events: none; }
.play-row input[type=range] { width: 100%; }
.play-row output { font-size: 12px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.play-colours { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.play-colours button, .play-colours label {
  position: relative; flex: none; box-sizing: border-box; width: 20px; height: 20px; margin: 0; border-radius: 50%; border: 0;
  padding: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgba(var(--shadow), .1);
}
.play-colours [aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }
.play-colours .natural { background: conic-gradient(#3e7bef, #23b26d, #f4ac1a, #f2741e, #e64b8f, #8a5ceb, #3e7bef); }
.play-colours label.custom { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong); overflow: hidden; }
/* The plus is two centred 1.5px bars, not a text glyph, so it sits dead centre at any font. */
.play-colours label.custom::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%); pointer-events: none;
  background: linear-gradient(var(--muted), var(--muted)) center / 100% 1.5px no-repeat, linear-gradient(var(--muted), var(--muted)) center / 1.5px 100% no-repeat;
}
.play-colours label.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* At real size: the icon at common interface sizes, pixel for pixel. */
.ladder { display: flex; align-items: flex-end; justify-content: space-between; padding: 14px 16px 10px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.ladder div { display: grid; justify-items: center; gap: 8px; }
.ladder span { display: grid; place-items: center; }
.ladder svg { width: 100%; height: 100%; display: block; }
.ladder small { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* In use: three small mock-ups. */
.inuse { display: grid; gap: 8px; margin-bottom: 20px; }
.mock { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.mock .g { display: grid; place-items: center; flex: none; }
.mock svg { width: 100%; height: 100%; display: block; }
.mock-btn { justify-self: start; height: 34px; padding: 0 14px 0 12px; border-radius: 10px; background: var(--grad); color: #fff; font-weight: 500; }
.mock-btn .g { width: 16px; height: 16px; }
.mock-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.mock-row .tile-ico { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--tint); }
.mock-row b { display: block; font-weight: 500; color: var(--text); }
.mock-row small { display: block; color: var(--muted); font-size: 12px; }
.mock-tabs { justify-content: space-around; height: 52px; border: 1px solid var(--line); border-radius: 12px; }
.mock-tabs .dot { width: 18px; height: 18px; border-radius: 6px; background: var(--line); }
.mock-tabs .tab { display: grid; justify-items: center; gap: 4px; }
.mock-tabs .tab .g { width: 22px; height: 22px; }
.mock-tabs .tab::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.p-name { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.p-meaning { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.p-styles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 18px; }
.p-styles button {
  aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 10px; background: none;
  display: grid; place-items: center; color: var(--icon); padding: 0;
}
.p-styles button[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }
.p-styles svg { width: 24px; height: 24px; }
.p-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.p-actions-2 { margin-bottom: 8px; }
.p-actions-2 .btn-ghost { flex: 1; }
.p-actions .btn { flex: 1; }
.p-label { margin: 0 0 8px; font-size: 12px; color: var(--faint); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.tags button {
  border: 1px solid var(--line); background: none; border-radius: 99px; padding: 3px 10px; font-size: 12px; color: var(--muted);
}
.tags button:hover { color: var(--accent-ink); border-color: var(--warm-border); background: var(--accent-soft); }
.p-variants { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.p-variants button { aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 10px; background: none; display: grid; place-items: center; color: var(--icon); }
.p-variants button:hover { border-color: var(--line-strong); background: var(--surface); }
.p-variants svg { width: 22px; height: 22px; }
.p-similar { margin-bottom: 20px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 8px); opacity: 0; z-index: 40;
  background: var(--text); color: var(--bg); font-size: 13px; padding: 9px 14px; border-radius: 10px;
  transition: opacity .18s var(--ease), transform .18s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Small screens ──────────────────────────────────── */
@media (max-width: 900px) {
  .links { display: none; }
  .workspace { grid-template-columns: 1fr; gap: 0; }
  .side { position: static; max-height: none; overflow-x: auto; margin: 0 0 4px; padding: 0; }
  .side-h { display: none; }
  .side ul { display: flex; gap: 4px; padding: 12px 0 8px; }
  .side li button { white-space: nowrap; margin: 0; width: auto; }
  .side li .n { display: none; }
  .panel { left: 12px; width: auto; top: auto; max-height: 78vh; overscroll-behavior: contain; }
  /* The panel is a sheet here: the page behind is dimmed and stays put. */
  html.panel-open { overflow: hidden; }
  html.panel-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(10, 11, 14, .32); animation: ghost-in .2s ease-out; }
}
@media (max-width: 640px) {
  .nav-in, main { padding: 0 16px; }
  .hero { padding: 32px 0 28px; }
  .ctl { padding: 0 10px; }
  .ctl input[type=range], .ctl .wks-track { width: 56px; }
  /* All six styles fit the row: each button grows from its label's width, so none is cut off or crowded. */
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 auto; min-width: 0; padding: 0 6px; }
  .tools { width: 100%; justify-content: space-between; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ── Colour picker (color-picker.js) ── one small popover in the site's own style, replacing the browser dialog. */
.cp {
  position: fixed; z-index: 60; width: 236px; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px;
  box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(var(--shadow), .14), 0 2px 6px rgba(var(--shadow), .06);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.cp.open { opacity: 1; transform: none; }
.cp[hidden] { display: none; }
.cp-field {
  position: relative; height: 148px; border-radius: 10px; cursor: crosshair; touch-action: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--hue, red));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.cp-hue {
  position: relative; height: 12px; border-radius: 999px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00);
}
.cp-knob {
  position: absolute; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%);
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .25); pointer-events: none;
}
.cp-hue .cp-knob { top: 50%; width: 16px; height: 16px; }
.cp-field:focus-visible, .cp-hue:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-row { display: flex; align-items: center; gap: 8px; }
.cp-preview { flex: none; width: 32px; height: 32px; box-sizing: border-box; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.cp-hex {
  flex: 1; min-width: 0; height: 32px; box-sizing: border-box; display: flex; align-items: center; gap: 2px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13px; color: var(--muted);
}
.cp-hex:focus-within { border-color: var(--accent); }
.cp-hex input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; color: var(--text);
  text-transform: uppercase; letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.cp-drop {
  flex: none; width: 32px; height: 32px; box-sizing: border-box; padding: 0; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--muted); cursor: pointer;
}
.cp-drop:hover { color: var(--text); border-color: var(--hover-border, var(--line-strong)); }
.cp-drop svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cp-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cp-presets button {
  width: 100%; min-width: 0; height: auto; aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--c);
  box-shadow: inset 0 0 0 1px var(--line-strong); transition: transform .12s var(--ease);
}
.cp-presets button:hover { transform: scale(1.08); }
.cp-presets button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }
@media (prefers-reduced-motion: reduce) { .cp { transition: none; } }
/* A slider's name resets it; it hints that on hover. */
.reset { cursor: pointer; border-radius: 4px; transition: color .15s var(--ease); }
.reset:hover { color: var(--text); text-decoration: underline dotted; text-underline-offset: 3px; }
/* Style switch: the pen redraws it (app.js restyle()). The ghost (old drawing) fades straight out. A new line
   drawing traces each stroke from start to end — every shape gets pathLength="1", so one dash of length 1 sliding
   from offset 1 to 0 draws it, whatever its real length; its fills (Duotone) fade in under the ink. A new filled
   drawing blooms open from the centre. Delays (the ripple) are set per icon; `both` holds each in its start state. */
.tile, .stage-icon { position: relative; }
.ghost { position: absolute; margin: 0; pointer-events: none; animation: ghost-out .14s ease-out both; }
.swap-in.in-line [pathLength] { stroke-dasharray: 1 1.01; animation: pen .3s cubic-bezier(.45, 0, .2, 1) var(--d, 0ms) both; }
.swap-in.in-line [fill="currentColor"] { animation: ghost-in .3s ease-out var(--d, 0ms) both; }
.swap-in.in-fill { animation: bloom .3s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes ghost-out { to { opacity: 0; transform: scale(.96); } }
@keyframes ghost-in { from { opacity: 0; } }
@keyframes pen { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes bloom { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }

/* Line styles in the grid take their width from the Stroke slider through this variable, so dragging it never
   rebuilds the tiles. CSS beats the drawings' stroke-width attributes. */
.grid.line .tile > svg:not(.ghost), .grid.line .tile > svg:not(.ghost) [stroke-width] { stroke-width: var(--stroke, 1); }
/* Tiles off screen skip layout and paint until they scroll near; Size changes and re-renders stay cheap. */
.cell { content-visibility: auto; contain-intrinsic-size: auto 92px; }

/* Version label in the header: text, not a button. */
.ver { font-size: 13px; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }
/* Tiles sit in contained cells (content-visibility), which clip anything outside them: their focus rings go
   inside the edge instead. */
.tile:focus-visible, .tile-copy:focus-visible { outline-offset: -2px; }
/* The quick-copy button is in the tab order; it shows while its tile or itself has keyboard focus. */
/* Only keyboard focus shows it: a mouse click leaves focus on the button, which must not keep it showing. */
.cell:has(:focus-visible) .tile-copy { opacity: 1; transform: scale(1); }
/* Touch screens: controls get finger-sized hit areas (44px), the drawings stay the same size. */
@media (pointer: coarse) {
  .seg button { height: 40px; }
  .stage-bgs { gap: 12px; padding: 8px 10px; }
  .stage-bgs button, .play-colours button, .play-colours .custom { position: relative; }
  .stage-bgs button::after, .play-colours button::after, .play-colours .custom::after { content: ""; position: absolute; inset: -12px; }
  .play-colours .custom { overflow: visible; }
  .play-colours { gap: 14px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ══ Saved collections (saved.js) ═════════════════════ */
/* Tile bookmark: top-left, mirroring quick copy. A saved icon keeps its filled bookmark showing. */
.tile-save {
  position: absolute; top: 7px; left: 7px; width: 26px; height: 26px; border-radius: 8px; border: 0; padding: 0;
  display: grid; place-items: center; background: var(--bg); color: var(--muted);
  box-shadow: 0 0 0 1px var(--line); opacity: 0; transform: scale(.94);
  transition: opacity .15s var(--ease), transform .15s var(--ease), color .15s var(--ease);
}
.tile-save svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.tile-save:hover { color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
/* Saved: a short flash of the filled bookmark; the tile is never left marked. */
.tile-save.done { opacity: 1; transform: scale(1); color: var(--accent); }
.tile-save.done svg { fill: currentColor; }
.cell:has(:focus-visible) .tile-save { opacity: 1; transform: scale(1); }
@media (hover: hover) { .cell:hover .tile-save { opacity: 1; transform: scale(1); } }
.tile-save:focus-visible { outline-offset: -2px; }

/* Header: Saved, with a count once something is saved. */
.saved-btn { gap: 6px; padding: 0 12px; }
/* The studio behind Bicon: a quiet link out, next to the main action. */
.hexline-btn { gap: 4px; padding: 0 10px 0 12px; color: var(--muted); }
.hexline-btn:hover { color: var(--text); }
.hexline-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) { .hexline-btn { display: none; } }
/* Site footer, on every page. */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; }
.site-foot-in { max-width: 1280px; margin: 0 auto; padding: 28px 32px 36px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.site-foot a:hover { text-decoration-color: currentColor; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
@media (max-width: 640px) { .site-foot-in { padding: 24px 16px 32px; flex-direction: column; align-items: flex-start; } }
.saved-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.saved-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.saved-count[hidden] { display: none; }
@media (max-width: 640px) { .saved-label, .ver { display: none; } .saved-btn { padding: 0 10px; } }

/* Panel: Save to [group], under the downloads. The group picker is a ghost field with its own chevron. */
.p-save { display: flex; gap: 8px; margin-bottom: 22px; }
.p-save .btn-ghost { flex: none; }
.p-save .btn-ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.p-select { position: relative; flex: 1; min-width: 0; display: flex; color: var(--muted); }
.p-select::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; pointer-events: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.p-select select {
  flex: 1; min-width: 0; height: 36px; padding: 0 36px 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  -webkit-appearance: none; appearance: none; cursor: pointer; text-overflow: ellipsis;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
@media (hover: hover) { .p-select select:hover { border-color: var(--line-strong); background: var(--surface); } }
.p-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tray: the saved groups, in a panel like the details one. */
.tray { z-index: 31; }
.t-groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; }
.t-groups button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--line); background: none; font-size: 13px; color: var(--muted); max-width: 100%;
}
.t-groups button span { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.t-groups button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.t-groups button[aria-pressed="true"] span { color: inherit; }
.t-groups .t-new { border-style: dashed; color: var(--muted); }
.t-groups button:hover { color: var(--text); border-color: var(--line-strong); }
.t-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.t-head .p-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-rename {
  flex: 1; min-width: 0; height: 36px; font: inherit; font-size: 20px; font-weight: 500; color: var(--text);
  border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 0 10px; background: var(--bg); outline: 0;
}
.t-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 18px; }
.t-grid:empty { display: none; }
.t-cell { position: relative; }
.t-icon {
  width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 10px; background: none;
  display: grid; place-items: center; align-content: center; gap: 3px; padding: 0;
}
.t-icon small { font-size: 9.5px; line-height: 1; color: var(--faint); }
.t-icon:hover { border-color: var(--line-strong); background: var(--surface); }
.t-icon svg { width: 26px; height: 26px; }
.t-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: var(--text); color: var(--bg); opacity: 0; transform: scale(.8);
  transition: opacity .12s var(--ease), transform .12s var(--ease);
}
.t-remove svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.t-cell:hover .t-remove, .t-cell:has(:focus-visible) .t-remove { opacity: 1; transform: none; }
@media (hover: none) { .t-remove { opacity: 1; transform: none; } }
.t-empty { margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.t-empty[hidden] { display: none; }
.t-formats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 3px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.t-formats button { height: 30px; border: 0; border-radius: 9px; background: none; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.t-formats button[aria-checked="true"] { background: var(--bg); color: var(--accent-ink); font-weight: 500; box-shadow: 0 1px 2px rgba(var(--shadow), .08), 0 0 0 1px var(--line); }
#t-actions .p-actions { margin-bottom: 18px; }
.t-foot { display: flex; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.t-link { border: 0; background: none; padding: 0; font-size: 13px; color: var(--muted); }
.t-link:hover { color: #d2453b; }
.t-link[data-armed] { color: #d2453b; font-weight: 500; }
.t-note { margin: 16px 0 0; font-size: 12px; color: var(--faint); }
button:disabled { opacity: .45; pointer-events: none; }
@media (max-width: 900px) {
  html.tray-open { overflow: hidden; }
  html.tray-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(10, 11, 14, .32); animation: ghost-in .2s ease-out; }
}
@media (pointer: coarse) { .tile-save, .tile-copy { width: 32px; height: 32px; } }
/* Very narrow screens: the header's buttons sit closer so Download never runs off the edge. */
@media (max-width: 640px) { .nav-actions { gap: 6px; } .nav-actions .btn { padding: 0 12px; } }
@media (max-width: 380px) { .nav-in { padding: 0 12px; } .brand-name { display: none; } }
.swatch, .pal { flex: none; }
@media (max-width: 380px) { .ctl { padding: 0 8px; gap: 8px; } .ctl .wks-track { width: 44px; } }

/* "Already saved" popup: small, by the button pressed, in the site's quiet style. */
.sv-pop {
  position: fixed; z-index: 50; width: 252px; padding: 12px; border-radius: 14px; background: var(--bg);
  border: 1px solid var(--line); box-shadow: 0 18px 40px -18px rgba(var(--shadow), .28), 0 2px 6px rgba(var(--shadow), .06);
  font-size: 13px; color: var(--muted);
}
.sv-pop[hidden] { display: none; }
.sv-pop.in { animation: sv-in .16s var(--ease); }
@keyframes sv-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.sv-pop p { margin: 0 0 10px; line-height: 1.4; }
.sv-pop b { color: var(--text); font-weight: 500; }
.sv-pop-b { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-pop-b button {
  height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: none;
  font-size: 12.5px; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sv-pop-b button:hover { border-color: var(--line-strong); background: var(--surface); }
.sv-pop-b .sv-new { border-color: var(--warm-border, var(--line)); color: var(--accent-ink); background: var(--accent-soft); }
.sv-pop-b .sv-no { border-color: transparent; color: var(--muted); }
.t-icon.on-dark { background: #15161b; border-color: #15161b; }
.t-icon.on-dark small { color: #8b8e98; }

/* Many cards: the table that takes the grid's place (html.mode-list). */
.cards-view[hidden] { display: none; }
/* The category list doesn't apply to a list of cards, so the table takes the full width. */
html.mode-list .results-h, html.mode-list #understood, html.mode-list #grid, html.mode-list #empty { display: none; }
html.mode-list .side { display: none; }
html.mode-list .workspace { grid-template-columns: minmax(0, 1fr); }
html.mode-list .cards-view { display: block; }
.cv-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 14px; }
.cv-title { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.cv-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.cv-sub:empty { display: none; }
.cv-actions { display: flex; gap: 8px; flex: none; }
.cv-cols, .cr { display: grid; grid-template-columns: minmax(0, 1fr) 168px 104px; align-items: center; gap: 20px; }
.cv-cols { padding: 0 0 8px; font-size: 12px; color: var(--faint); border-bottom: 1px solid var(--line); }
.cards-list { list-style: none; margin: 0; padding: 0; }
.cr { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cr-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-text b { font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.cr-text span { overflow-wrap: anywhere; font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cr-main, .cr-alt { border: 1px solid transparent; border-radius: 12px; background: none; color: var(--icon); display: grid; place-items: center; transition: background .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease); }
.cr-main { width: 100%; height: 84px; gap: 2px; align-content: center; background: var(--surface); border-color: var(--line); padding: 6px; }
@media (hover: hover) { .cr-main:hover { border-color: var(--line-strong); } }
.cr-main svg { width: 30px; height: 30px; margin-bottom: 4px; }
.cr-name { font-size: 12px; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-why { font-size: 11px; color: var(--faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-alts { display: flex; gap: 4px; }
.cr-alt { width: 48px; height: 48px; opacity: .72; }
.cr-alt svg { width: 22px; height: 22px; }
@media (hover: hover) { .cr-alt:hover { opacity: 1; background: var(--surface); border-color: var(--line); } }
.cr-alt:focus-visible { opacity: 1; }
.cr-none { grid-column: 2 / -1; font-size: 13px; color: var(--faint); }
.cv-empty { padding: 48px 0; text-align: center; font-size: 14px; color: var(--muted); }
.cv-empty[hidden] { display: none; }
@media (max-width: 640px) {
  .cv-head { flex-direction: column; align-items: stretch; }
  .cv-actions .btn, .cv-actions .btn-ghost { flex: 1; white-space: nowrap; }
  .cv-cols { display: none; }
  .cr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "text text" "main alts"; gap: 10px; }
  .cr-text { grid-area: text; }
  .cr-main { grid-area: main; height: 76px; }
  .cr-alts { grid-area: alts; }
  .modes button { padding: 0 11px; }
  .list-box .cards-count { display: none; }
}

/* ── Page transitions ─────────────────────────────────
   Every page comes into focus as it loads (a short rise and un-blur, as the landing page's reveals), so moving
   between the landing page and /icons always feels like one motion, in every browser. Where the browser supports
   cross-document view transitions, the old page also fades out under a header that holds still. */
@view-transition { navigation: auto; }
.nav { view-transition-name: site-nav; }
::view-transition-old(root) { animation: vt-out .18s ease-in both; }
::view-transition-new(root) { animation: none; }
::view-transition-group(site-nav) { animation-duration: 0s; }
/* A theme switch is a same-page transition with its own circle reveal: none of the above applies to it. */
html.theme-vt::view-transition-old(root), html.theme-vt::view-transition-new(root) { animation: none; }
html.theme-vt .nav { view-transition-name: none; }
@keyframes vt-out { to { opacity: 0; } }
/* The landing page's reveal (landing.css): rise 36px, grow from 97%, sharpen from a 10px blur, a beat apart. The
   workspace waits for its first icons (app.js adds html.ready), so the grid is in place when it comes in. */
@keyframes page-in { from { opacity: 0; transform: translateY(36px) scale(.97); filter: blur(10px); } }
.hero > * { animation: page-in 1s cubic-bezier(.16, 1, .3, 1) both; }
.hero > :nth-child(3) { animation-delay: 110ms; }
.hero > :nth-child(4), .hero > :nth-child(5) { animation-delay: 220ms; }
html:not(.ready) .workspace, html:not(.ready) body:not(.landing) .site-foot { opacity: 0; }
html.ready .workspace { animation: page-in 1.1s cubic-bezier(.16, 1, .3, 1) both; }
html.ready body:not(.landing) .site-foot { transition: opacity .6s ease .4s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root), .hero > *, html.ready .workspace { animation: none; }
  html:not(.ready) .workspace, html:not(.ready) body:not(.landing) .site-foot { opacity: 1; }
}
