/* ============================================================
   Prompt Library — styles (v2)
   Premium developer-handbook aesthetic. Per-category color,
   terminal-style prompt panels, refined type. Dark + light.
   ============================================================ */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Fira Code", Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1300px;
  --sidebar-w: 264px;
  --topbar-h: 70px;
  --ease: cubic-bezier(.4, 0, .2, 1);

  /* per-card category accent (set inline per card) */
  --c: var(--accent);
}

/* ---------- Dark theme (default) ---------- */
[data-theme="dark"] {
  --bg: #080a0f;
  --bg-grad:
    radial-gradient(1200px 680px at 88% -12%, rgba(139,125,255,.13), transparent 58%),
    radial-gradient(1000px 560px at -8% -4%, rgba(56,189,248,.09), transparent 56%);
  --grid: rgba(255,255,255,.022);
  --surface: #0f1219;
  --surface-2: #141822;
  --surface-3: #1a1f2b;
  --border: #222936;
  --border-soft: #1a2029;
  --text: #eef1f7;
  --text-soft: #b3bccd;
  --text-dim: #79839a;
  --accent: #8b7dff;
  --accent-2: #5ed3dc;
  --accent-soft: rgba(139,125,255,.13);
  --accent-ring: rgba(139,125,255,.5);
  --code-bg: #090b11;
  --code-text: #cdd6e6;
  --code-bar: #0e1118;
  --success: #43d399;
  --shadow: 0 1px 1px rgba(0,0,0,.5), 0 18px 44px -18px rgba(0,0,0,.7);
  --shadow-card: 0 1px 0 rgba(255,255,255,.02) inset, 0 14px 36px -20px rgba(0,0,0,.65);
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-grad:
    radial-gradient(1200px 680px at 88% -12%, rgba(124,108,255,.12), transparent 58%),
    radial-gradient(1000px 560px at -8% -4%, rgba(56,189,248,.13), transparent 56%);
  --grid: rgba(15,23,42,.025);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef1f7;
  --border: #e4e8f0;
  --border-soft: #edf0f6;
  --text: #131722;
  --text-soft: #475063;
  --text-dim: #8590a4;
  --accent: #6b5cff;
  --accent-2: #0f9aa6;
  --accent-soft: rgba(107,92,255,.09);
  --accent-ring: rgba(107,92,255,.4);
  --code-bg: #0b0e15;
  --code-text: #d2dbec;
  --code-bar: #141925;
  --success: #16a34a;
  --shadow: 0 1px 2px rgba(20,24,40,.05), 0 18px 40px -22px rgba(20,24,40,.25);
  --shadow-card: 0 1px 2px rgba(20,24,40,.04), 0 14px 32px -22px rgba(20,24,40,.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; /* decorative bleed (.hero-glow) must never create horizontal scroll */ }

body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--bg-grad);
  background-size: 46px 46px, 46px 46px, 100% 100%;
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, kbd, pre { font-family: var(--font-mono); }

:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 3px; border-radius: 7px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { left: 12px; }

kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; color: var(--text-soft);
}

/* ===================== Topbar ===================== */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); height: 100%; margin: 0 auto; padding: 0 26px;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 21px; font-weight: 700;
  box-shadow: 0 8px 22px -8px var(--accent-ring);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.16; }
.brand-title { font-weight: 700; font-size: 15.5px; letter-spacing: -.015em; }
.brand-sub { font-size: 11.5px; color: var(--text-dim); letter-spacing: .005em; }

.search-wrap { position: relative; flex: 1; max-width: 580px; margin: 0 auto; }
.search-icon {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; fill: none; stroke: var(--text-dim); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
#search {
  width: 100%; height: 44px; padding: 0 46px 0 44px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 14px; font-family: var(--font-sans);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
#search::placeholder { color: var(--text-dim); }
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-kbd { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; }

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.result-count { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  color: var(--text-soft); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .i-sun { display: block; } [data-theme="dark"] .i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; } [data-theme="light"] .i-moon { display: block; }

/* ===================== Layout ===================== */
.layout {
  max-width: var(--maxw); margin: 0 auto; padding: 0 26px;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 40px; align-items: start;
}

/* ===================== Sidebar ===================== */
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: start;
  padding: 28px 0; max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.cat-nav { display: flex; flex-direction: column; gap: 4px; }
.cat-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 10px 12px; background: transparent;
  border: 1px solid transparent; border-radius: 11px;
  color: var(--text-soft); font-size: 13.5px; font-weight: 500; font-family: var(--font-sans);
  text-align: left; cursor: pointer;
  transition: background .13s var(--ease), color .13s var(--ease), border-color .13s var(--ease);
}
.cat-link:hover { background: var(--surface-2); color: var(--text); }
.cat-link.is-active {
  background: color-mix(in srgb, var(--c) 13%, transparent);
  color: var(--text); border-color: color-mix(in srgb, var(--c) 32%, transparent);
}
.cat-label { display: flex; align-items: center; gap: 10px; }
.cat-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex-shrink: 0; box-shadow: 0 0 10px -1px var(--c); }
.all-dot { background: linear-gradient(135deg, #38bdf8, #a78bfa, #fb7185); }
.cat-count {
  font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums;
  background: var(--surface-3); border-radius: 20px; padding: 1px 8px; min-width: 24px; text-align: center;
}
.cat-link.is-active .cat-count { background: color-mix(in srgb, var(--c) 20%, transparent); color: var(--text); }

.sidebar-foot { margin-top: 24px; padding: 16px 12px 0; border-top: 1px solid var(--border-soft); }
.foot-lead { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.sidebar-foot p:not(.foot-lead) { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.sidebar-foot code { font-size: 11px; color: var(--text-soft); background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }

/* ===================== Hero ===================== */
.main { padding: 38px 0 30px; min-width: 0; }
.hero { position: relative; margin-bottom: 18px; max-width: 800px; }
.hero-glow {
  position: absolute; inset: -60px -40px auto -40px; height: 240px; z-index: -1;
  background: radial-gradient(540px 180px at 18% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  filter: blur(20px); opacity: .8;
}
.hero-eyebrow {
  margin: 0 0 14px; font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent-2);
  display: inline-flex; align-items: center; gap: 9px;
}
.hero-eyebrow::before { content: ""; width: 26px; height: 1.5px; background: var(--accent-2); border-radius: 2px; }
.hero h1 {
  margin: 0 0 16px; font-size: clamp(28px, 4vw, 44px); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.06; color: var(--text);
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { margin: 0 0 22px; font-size: 16px; color: var(--text-soft); line-height: 1.6; max-width: 640px; }

.principles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.principles li {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 13px 6px 11px;
}
.principles li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.principles li code { font-size: 11.5px; color: var(--accent-2); background: none; padding: 0; }

/* ===================== Operating-context banner ===================== */
.ops {
  margin: 8px 0 4px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.ops-main { display: flex; gap: 16px; align-items: flex-start; }
.ops-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.ops-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ops-text { flex: 1; min-width: 0; }
.ops-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ops-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ops-text > p { margin: 7px 0 0; font-size: 13.5px; color: var(--text-soft); line-height: 1.55; }

.ops-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; color: var(--text-soft); font-weight: 500; user-select: none; }
.ops-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ops-switch { position: relative; width: 38px; height: 22px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); transition: background .16s var(--ease), border-color .16s var(--ease); flex-shrink: 0; }
.ops-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim); transition: transform .16s var(--ease), background .16s var(--ease); }
.ops-toggle input:checked + .ops-switch { background: color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.ops-toggle input:checked + .ops-switch::after { transform: translateX(16px); background: #fff; }
.ops-toggle input:focus-visible + .ops-switch { box-shadow: 0 0 0 4px var(--accent-soft); }
body.no-ctx .ops-toggle-label { color: var(--text-dim); }

.ops-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.ops-reveal { padding: 6px 0; }
.ops-copy { height: 32px; padding: 0 12px; font-size: 12.5px; }
.ops-pre {
  margin: 14px 0 0; padding: 16px 18px; background: var(--code-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: auto; max-height: 340px;
}
.ops-pre code { display: block; font-size: 12.6px; line-height: 1.62; color: var(--code-text); white-space: pre-wrap; word-break: break-word; }
.ops-pre[hidden] { display: none; }

/* Panel footnote about appended context */
.panel-foot {
  padding: 9px 14px; font-size: 11.5px; color: #7c879d;
  background: var(--code-bar); border-top: 1px solid color-mix(in srgb, #fff 6%, var(--code-bar));
  font-family: var(--font-mono);
}
.panel-foot .ops-jump { color: #9aa6bd; text-decoration: underline; text-underline-offset: 2px; }
.panel-foot .ops-jump:hover { color: #cdd6e6; }
body.no-ctx .panel-foot { display: none; }

/* ===================== Category group headings ===================== */
.cat-group-head {
  display: flex; align-items: center; gap: 13px;
  margin: 46px 0 18px; padding-bottom: 13px;
  border-bottom: 1px solid var(--border-soft);
}
.cat-group-head:first-of-type { margin-top: 14px; }
.group-ico {
  display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.group-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat-group-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.cat-group-head .cat-group-blurb { font-size: 13px; color: var(--text-dim); margin-left: 2px; }
.cat-group-head .group-n { margin-left: auto; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ===================== Cards ===================== */
.prompt-list { display: flex; flex-direction: column; gap: 16px; }
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px 22px 26px; box-shadow: var(--shadow-card);
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
  scroll-margin-top: calc(var(--topbar-h) + 18px);
}
.card:hover { border-color: color-mix(in srgb, var(--c) 42%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); opacity: .85; }
.card.flash { animation: flash 1.2s var(--ease); }
@keyframes flash {
  0%, 100% { border-color: var(--border); }
  30% { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent), var(--shadow); }
}

.card-head { display: flex; align-items: flex-start; gap: 18px; }
.card-head-text { flex: 1; min-width: 0; }
.card-cat {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--c); margin-bottom: 9px;
}
.cat-ico { display: inline-grid; place-items: center; width: 16px; height: 16px; }
.cat-ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.card-title { margin: 0 0 6px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.card-desc { margin: 0; font-size: 14px; color: var(--text-soft); line-height: 1.55; }

.copy-btn {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  height: 36px; padding: 0 14px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-soft); font-size: 13px; font-weight: 600; font-family: var(--font-sans); cursor: pointer;
  transition: all .14s var(--ease);
}
.copy-btn:hover { color: var(--c); border-color: color-mix(in srgb, var(--c) 50%, var(--border)); background: color-mix(in srgb, var(--c) 11%, transparent); transform: translateY(-1px); }
.copy-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn .i-check, .panel-copy .i-check { display: none; }
.copy-btn.copied { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, transparent); background: color-mix(in srgb, var(--success) 12%, transparent); }
.copy-btn.copied .i-copy { display: none; } .copy-btn.copied .i-check { display: block; }

/* When-to-use callout */
.card-when {
  display: flex; gap: 11px; align-items: baseline; margin-top: 17px;
  padding: 12px 15px; background: color-mix(in srgb, var(--c) 5%, var(--surface-2));
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--c); border-radius: var(--radius-sm); font-size: 13.5px;
}
.when-label {
  flex-shrink: 0; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--c); padding-top: 2px;
}
.when-text { color: var(--text-soft); line-height: 1.5; }

/* Reveal + terminal-style prompt panel */
.card-body { margin-top: 15px; }
.reveal-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 0;
  background: none; border: none; color: var(--text-dim);
  font-size: 13px; font-weight: 600; font-family: var(--font-sans); cursor: pointer;
  transition: color .13s var(--ease);
}
.reveal-btn:hover { color: var(--c); }
.reveal-btn .i-chevron { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.reveal-btn[aria-expanded="true"] .i-chevron { transform: rotate(180deg); }

.prompt-panel {
  display: none; margin-top: 12px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 30px -18px rgba(0,0,0,.6);
}
.prompt-panel.open { display: block; }
.panel-bar {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 13px; background: var(--code-bar);
  border-bottom: 1px solid color-mix(in srgb, #fff 6%, var(--code-bar));
}
.panel-dots { display: inline-flex; gap: 6px; }
.panel-dots i { width: 11px; height: 11px; border-radius: 50%; background: #2c3340; }
.panel-dots i:nth-child(1) { background: #ff5f57; } .panel-dots i:nth-child(2) { background: #febc2e; } .panel-dots i:nth-child(3) { background: #28c840; }
.panel-name { font-family: var(--font-mono); font-size: 12px; color: #8c97ad; letter-spacing: .01em; }
.panel-copy {
  margin-left: auto; display: inline-grid; place-items: center; width: 30px; height: 28px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: #8c97ad; cursor: pointer; transition: all .14s var(--ease);
}
.panel-copy:hover { color: #fff; background: rgba(255,255,255,.08); }
.panel-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.panel-copy.copied { color: var(--success); } .panel-copy.copied .i-copy { display: none; } .panel-copy.copied .i-check { display: block; }

.prompt-pre {
  margin: 0; padding: 18px 20px; background: var(--code-bg);
  overflow: auto; max-height: 480px;
}
.prompt-pre code {
  display: block; font-size: 12.8px; line-height: 1.65; color: var(--code-text);
  white-space: pre-wrap; word-break: break-word;
}
.prompt-pre::-webkit-scrollbar { width: 11px; height: 11px; }
.prompt-pre::-webkit-scrollbar-thumb { background: #2a313e; border-radius: 8px; border: 3px solid var(--code-bg); }
.prompt-pre::-webkit-scrollbar-track { background: transparent; }

/* Tags */
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 17px; }
.tag {
  font-size: 11.5px; color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 20px; padding: 2px 10px;
  transition: color .13s var(--ease), border-color .13s var(--ease);
}
.tag::before { content: "#"; opacity: .5; }
.card:hover .tag { border-color: var(--border); }

/* Empty state */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty-mark { font-size: 40px; opacity: .25; margin-bottom: 12px; }
.empty-state strong { color: var(--text); }
.text-btn {
  margin-top: 16px; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent); padding: 9px 20px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; font-family: var(--font-sans); cursor: pointer;
}
.text-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* Footer */
.page-foot {
  max-width: var(--maxw); margin: 0 auto; padding: 26px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border-top: 1px solid var(--border-soft); margin-top: 30px;
  font-size: 12.5px; color: var(--text-dim);
}
.foot-kbd-hint { display: flex; align-items: center; gap: 6px; }

/* Toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 18px);
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  padding: 12px 22px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease); z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast::before { content: "✓ "; color: var(--success); font-weight: 700; }

mark { background: color-mix(in srgb, var(--accent) 32%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ===================== Responsive ===================== */
@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: static; max-height: none; padding: 18px 0 6px; overflow: visible; }
  .cat-nav { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .cat-link { width: auto; }
  .cat-link .cat-count { display: none; }
  .sidebar-foot { display: none; }
  .main { padding-top: 18px; }
}
@media (max-width: 680px) {
  .topbar { height: auto; }
  .topbar-inner { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .brand { order: 1; } .topbar-actions { order: 2; margin-left: auto; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .brand-sub { display: none; }
  .layout { padding: 0 16px; }
  .card { padding: 18px 16px 18px 18px; }
  .card-head { flex-direction: column; gap: 12px; }
  .copy-btn { align-self: flex-start; }
  .result-count, .search-kbd { display: none; }
  .page-foot { flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 16px; }
  .cat-group-head .cat-group-blurb { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; transition: none !important; } }
