/* ─── Design tokens ──────────────────────────────────────────────────── */
:root {
  --bg:        #0e0e0e;
  --bg-2:      #161616;
  --bg-3:      #1e1e1e;
  --border:    #2a2a2a;
  --text:      #e8e8e8;
  --text-2:    #999;
  --text-3:    #555;
  --accent:    #f5a623;
  --accent-dim:#b87718;
  --success:   #3ecf8e;
  --error:     #e05252;
  --mono:      'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --sans:      'Inter', system-ui, sans-serif;
  --radius:    4px;
  --max-w:     860px;
  /* Make native controls (color picker, scrollbars, selects) render dark */
  color-scheme: dark;
}

/* ─── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The HTML `hidden` attribute must always win. Layout rules like
   `.form-group{display:flex}`, `.rtc-room{display:flex}`, `.pg-cols{display:grid}`
   and `.btn{display:inline-flex}` otherwise out-rank the UA `[hidden]` rule, so
   `el.hidden = true` silently fails to hide panels (hit across /trigstop /signal
   /board /call /screen /proxygen). This reset makes the attribute authoritative. */
[hidden] { display: none !important; }
html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;       /* fallback for browsers without dynamic viewport units */
  min-height: 100dvh;      /* tracks the visible viewport on mobile so the footer
                              sits at the true bottom, not behind the address bar */
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ─── Nav ────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.05;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.5px;
}
.nav-brand-dot { color: var(--accent); }
.nav-brand-tag {
  font-family: var(--sans);
  font-size: 0.64rem;
  color: var(--text-3);
  letter-spacing: 0.2px;
}
@media (max-width: 540px) { .nav-brand-tag { display: none; } }

/* Slogan: absolute-centered in the nav so it stays put regardless of the
   brand/controls widths. Hidden when the bar gets tight to avoid collisions. */
.nav-slogan {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text-2);
  letter-spacing: 0.2px;
  white-space: nowrap;
  pointer-events: none;
}
/* On narrow screens absolute-centering would overlap the logo/menu, so let the
   slogan flow inline right after the brand (the quick links are hidden here). */
@media (max-width: 820px) {
  .nav-slogan {
    position: static;
    transform: none;
    font-size: 0.7rem;
  }
}
/* Tiniest phones: hide the slogan so the logo + menu stay uncrowded. */
@media (max-width: 400px) { .nav-slogan { display: none; } }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.nav-quick { display: flex; gap: 0.25rem; }
@media (max-width: 720px) { .nav-quick { display: none; } }
/* admin layout uses a simple inline tool row */
.nav-tools { display: flex; gap: 0.25rem; margin-left: auto; flex-wrap: wrap; }

.nav-tool {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-2);
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tool:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ─── Tools dropdown ─────────────────────────────────────────────────── */
.nav-menu { position: relative; }
.nav-menu-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}
.nav-menu-summary::-webkit-details-marker { display: none; }
.nav-menu[open] > .nav-menu-summary { color: var(--accent); border-color: var(--accent); }
.nav-menu-caret { font-size: 0.7rem; transition: transform 0.15s; }
.nav-menu[open] .nav-menu-caret { transform: rotate(180deg); }

.nav-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(88vw, 290px);
  max-height: min(74vh, 560px);
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
}
.nav-cat { border-bottom: 1px solid var(--border); }
.nav-cat:last-child { border-bottom: none; }
.nav-cat-title {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-2);
}
.nav-cat-title::-webkit-details-marker { display: none; }
.nav-cat-title::after {
  content: "▾";
  font-size: 0.7rem;
  color: var(--text-3);
  transition: transform 0.15s;
}
.nav-cat-title:hover { color: var(--accent); }
.nav-cat[open] > .nav-cat-title { color: var(--accent); }
.nav-cat[open] > .nav-cat-title::after { transform: rotate(180deg); }
.nav-cat-items { padding: 0 0.25rem 0.4rem; }
.nav-cat-items a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 0.84rem;
}
.nav-cat-items a:hover { background: var(--bg-3); color: var(--accent); text-decoration: none; }
.nav-cat-items a .s {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  min-width: 2.7rem;
}
.nav-cat-items a:hover .s { color: var(--accent); }

/* ─── Main ───────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ─── Wide mode (nav toggle, persisted in localStorage) ────────────────
   Lifts the .main max-width cap. The discover rail is position:fixed at
   calc(50% + var(--max-w)/2 + 2rem), anchored to the narrow column, so once
   content flows underneath it in wide mode it must hide. */
html[data-wide="1"] .main { max-width: none; }
html[data-wide="1"] .discover-rail { display: none; }

/* ─── Footer ─────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-brand { color: var(--text-2); font-family: var(--mono); }
.footer-brand:hover { color: var(--accent); }
.footer-credit a { color: var(--text-3); text-decoration: underline; text-underline-offset: 2px; }
.footer-credit a:hover { color: var(--accent); }
.footer-page-link { color: var(--text-3); text-decoration: underline; text-underline-offset: 2px; }
.footer-page-link:hover { color: var(--accent); }
.footer-build { color: var(--text-3); }
.footer-fb { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-fb-btn, .footer-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-3);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-fb-btn:hover, .footer-link-btn:hover { color: var(--accent); }
.footer-coffee {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  line-height: 1;
}
.footer-coffee:hover { background: var(--accent); color: var(--bg); }

/* ─── Feedback dialog ────────────────────────────────────────────────── */
.fb-dialog {
  width: min(440px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
}
.fb-dialog::backdrop { background: rgba(0,0,0,0.55); }
.fb-form { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.fb-head { display: flex; align-items: center; justify-content: space-between; }
.fb-head strong { font-size: 1rem; }
.fb-x {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 1.4rem; line-height: 1; padding: 0;
}
.fb-x:hover { color: var(--text); }
.fb-context { font-size: 0.75rem; color: var(--text-3); margin: 0; font-family: var(--mono); }
.fb-textarea {
  width: 100%;
  resize: vertical;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.875rem;
}
.fb-textarea:focus { outline: none; border-color: var(--accent); }
.fb-name-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.85rem;
}
.fb-name-input:focus { outline: none; border-color: var(--accent); }
.fb-status { font-size: 0.8rem; min-height: 1rem; color: var(--text-3); }
.fb-status-ok { color: var(--success); }
.fb-status-error { color: var(--error); }
.fb-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.fb-diag { display: flex; flex-direction: column; gap: 0.4rem; }
.fb-diag-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-2); cursor: pointer; }
.fb-diag-row input { cursor: pointer; }
.fb-diag-note { font-size: 0.74rem; color: var(--text-3); margin: 0; line-height: 1.45; }
.fb-diag-details { font-size: 0.74rem; color: var(--text-3); }
.fb-diag-details summary { cursor: pointer; color: var(--accent); }
.fb-diag-details > .fb-diag-note, .fb-diag-details > .fb-watch-note { margin-top: 0.4rem; }
.fb-diag-preview { display: block; margin-top: 0.4rem; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); font-family: var(--mono); font-size: 0.72rem; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

/* Opt-in "notify me when resolved" row + note (reuses .fb-diag-row layout). */
.fb-watch-row { margin-top: 0.2rem; }
.fb-watch-note { font-size: 0.74rem; color: var(--text-3); margin: 0; line-height: 1.45; }

/* Toast shown on load when a watched report has shipped (public/_feedback.js).
   Deliberately loud: this is the one moment we get to tell a reporter their
   idea shipped, so it's big, accent-bordered and animated (fbdkgyt). */
.fb-toast { position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 1rem; max-width: calc(100vw - 2rem); padding: 1rem 1.1rem 1rem 1.3rem; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--bg-2); box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.15), 0 12px 40px rgba(0,0,0,0.5); font-size: 1rem; color: var(--text); animation: fb-toast-in 0.4s cubic-bezier(0.18, 1.25, 0.4, 1) both; }
@keyframes fb-toast-in {
  from { transform: translateX(-50%) translateY(1.5rem); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-toast { animation: none; }
}
.fb-toast-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.fb-toast-msg { line-height: 1.4; font-weight: 600; }
.fb-toast-quote { font-size: 0.85rem; font-weight: 400; font-style: italic; color: var(--text-2); line-height: 1.4; overflow-wrap: anywhere; }
.fb-toast-link { border: 1px solid var(--accent-dim); background: var(--bg); color: var(--accent); border-radius: var(--radius); padding: 0.35rem 0.8rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.fb-toast-link:hover { border-color: var(--accent); background: var(--bg-3); }
.fb-toast-x { border: none; background: none; color: var(--text-3); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 0.2rem; }
.fb-toast-x:hover { color: var(--text); }

/* ─── Changelog dialog ───────────────────────────────────────────────── */
.changelog-dialog { width: min(560px, calc(100vw - 2rem)); }
.changelog-body { max-height: min(60vh, 460px); overflow-y: auto; font-size: 0.85rem; }
.changelog-date { margin: 0.9rem 0 0.3rem; font-size: 0.78rem; color: var(--text-3); font-family: var(--mono); position: sticky; top: 0; background: var(--bg-2); padding: 0.2rem 0; }
.changelog-date:first-child { margin-top: 0; }
.changelog-list { margin: 0 0 0.2rem; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.changelog-list li { color: var(--text-2); line-height: 1.4; }

/* ─── In-app update popup (public/_native-bridge.js, app-only) ──────────── */
.app-update {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(360px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
  font-family: var(--sans);
}
.app-update-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.app-update-line { font-size: 0.82rem; color: var(--text-2); font-family: var(--mono); }
.app-update-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ─── API & MCP docs page ────────────────────────────────────────────── */
.api-disabled-banner {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--error);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--error) 12%, transparent);
  color: var(--error);
  font-size: 0.85rem;
}
.api-doc { display: flex; flex-direction: column; gap: 2rem; }
.api-block h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.api-block p { color: var(--text-2); margin: 0 0 0.6rem; }
.api-pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0 0 0.9rem;
}
.api-pre code { color: var(--text); white-space: pre; }
.api-note { font-size: 0.8rem; color: var(--text-3); }
.api-count { color: var(--text-3); font-weight: 400; font-size: 0.85rem; }
.api-tools { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.api-tool { background: var(--bg-2); padding: 1rem 1.1rem; }
.api-tool-name code { font-family: var(--mono); color: var(--accent); font-size: 0.95rem; }
.api-tool-desc { color: var(--text-2); font-size: 0.85rem; margin: 0.3rem 0 0.5rem; }
.api-params { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.api-params td { padding: 0.2rem 0.5rem 0.2rem 0; vertical-align: top; border-top: 1px solid var(--border); }
.api-param-name { font-family: var(--mono); color: var(--text); white-space: nowrap; }
.api-param-type { font-family: var(--mono); color: var(--text-3); white-space: nowrap; }
.api-param-desc { color: var(--text-2); }

/* ─── Homepage grid ──────────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.5rem;
  background: var(--bg-2);
  border: none;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  position: relative;
}
.tool-card:hover { background: var(--bg-3); text-decoration: none; }
.tool-icon {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.tool-slug {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  letter-spacing: 0.5px;
}
.tool-name {
  font-weight: 500;
  font-size: 1rem;
}
.tool-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}
/* "from <home category>" label naming where a tool actually lives. Rendered on
   every card but hidden by default; revealed only (a) on a card borrowed onto a
   secondary category page via `also` (.is-borrowed), and (b) on every result
   while searching (.home-grid.searching) — the search list hides its section
   headers, so this keeps each result's section visible. */
.tool-from {
  display: none;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  color: var(--text-3);
  margin-top: -0.15rem;
}
.tool-from.is-borrowed,
.home-grid.searching .tool-from { display: block; }
.grid-section-header {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 0.45rem 1.5rem;
  background: var(--bg);
}

/* ─── Homepage "Discover" side rail (wide screens only) ──────────────── */
.discover-rail { display: none; }
@media (min-width: 1400px) {
  .discover-rail {
    display: block;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: calc(50% + var(--max-w) / 2 + 2rem);
    width: 210px;
    max-height: 82vh;
    overflow-y: auto;
  }
}
.discover-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3);
  margin-bottom: 0.6rem; padding: 0 0.2rem;
}
.discover-shuffle {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 0.95rem; line-height: 1; padding: 0.1rem 0.35rem; border-radius: var(--radius);
}
.discover-shuffle:hover { color: var(--accent); }
.discover-list {
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.discover-item {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.7rem 0.8rem; background: var(--bg-2); color: var(--text);
  text-decoration: none; transition: background 0.15s;
}
.discover-item:hover { background: var(--bg-3); text-decoration: none; }
.discover-ic { font-family: var(--mono); color: var(--accent); font-size: 1rem; line-height: 1.3; }
.discover-tx { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.discover-nm { font-size: 0.85rem; font-weight: 500; }
.discover-ds {
  font-size: 0.72rem; color: var(--text-2); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ─── Homepage search ────────────────────────────────────────────────── */
/* Sticks just below the (sticky) nav so you can search at any scroll depth.
   --nav-h is measured by _nav.js; the fallback covers first paint / no-JS. */
.home-search-wrap {
  position: sticky;
  top: var(--nav-h, 3.4rem);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
/* The input + its clear button; flexes to fill the row beside the back chip. */
.home-search-field { position: relative; flex: 1 1 auto; min-width: 0; }
.home-search-wrap input[type="search"] {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-family: var(--sans);
  font-size: 0.9rem; padding: 0.55rem 2.5rem 0.55rem 0.75rem;
  transition: border-color 0.15s; outline: none; -webkit-appearance: none;
}
.home-search-wrap input[type="search"]:focus { border-color: var(--accent); }
.home-search-wrap input[type="search"]::-webkit-search-cancel-button { display: none; }
.home-search-clear {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); font-family: var(--mono);
  font-size: 0.9rem; cursor: pointer; padding: 0.2rem 0.3rem; display: none; line-height: 1;
}
.home-search-clear:hover { color: var(--text-2); }
/* Keyboard-selected search result (arrow keys / Enter to open) */
.tool-card.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.home-no-results {
  display: none; grid-column: 1 / -1; padding: 2rem; text-align: center;
  color: var(--text-3); font-family: var(--mono); font-size: 0.85rem;
}
.home-no-results.show {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
/* Persistent "request a tool" bar. Lives at the BOTTOM of the page while idle or
   when a search has results (its text adapts). When a search returns nothing,
   _catalogue.js adds .surfaced to lift it up under the search box as the no-match
   CTA, and accents it so the dead-end search turns into a one-click request. */
.home-search-request {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
  margin-top: 1.5rem; margin-bottom: 0.5rem; padding: 0.6rem 0.7rem 0.6rem 0.95rem;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.home-search-request.surfaced {
  margin-top: 0; margin-bottom: 1rem;
  border-color: var(--accent-dim);
}
.home-search-request .hsr-text {
  color: var(--text-2); font-size: 0.82rem; line-height: 1.3;
}
.home-search-request .hsr-btn { flex-shrink: 0; }

/* ─── Back link (category + all-tools pages) ─────────────────────────────
   A small, mono "← back" affordance in the site idiom: bordered chip, muted
   text, accent on hover. Sits above the page content. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  transition: border-color 0.15s, color 0.15s;
}
.back-link:hover { color: var(--accent); border-color: var(--accent-dim); text-decoration: none; }
/* "Available via API" chip — shown under the nav on tool pages that are also
   reachable over /api + /mcp (set on res.locals.apiTool in app.js). Deep-links
   to the tool's card on the API docs page. */
.api-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  margin: 0 0 1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  transition: border-color 0.15s, background 0.15s;
}
.api-chip:hover { border-color: var(--accent); background: var(--bg-3); text-decoration: none; }
.api-chip-n {
  background: var(--accent); color: #000; border-radius: 999px;
  padding: 0 0.35rem; font-size: 0.66rem; font-weight: 600;
}
/* "Runs in your browser / on the server" chip — the privacy signal shown under
   the nav on every tool page (set on res.locals.procBadge in app.js, from
   core/tool-proc.js). Colour says it all: green = your data stays private,
   amber = it's stored, neutral = sent to the server to process. */
.proc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
  padding: 0.25rem 0.6rem;
  margin: 0 0 1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  cursor: help;
}
.proc-chip-glyph { font-size: 0.8rem; line-height: 1; }
/* Data never leaves the device (local), stays encrypted (e2e) or is only
   relayed and never kept (p2p) → reassuring green. */
.proc-local, .proc-e2e, .proc-p2p { color: var(--success); }
/* Persisted on the server → amber heads-up. */
.proc-stored { color: var(--accent); }
/* Sent to the server to process, then discarded → neutral. */
.proc-server { color: var(--text-2); }
/* /all "where is my data handled" filter row (views/all.ejs, wired by
   _catalogue.js). Pills echo the page chip's colour coding on their glyph. */
.proc-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.2rem; }
.proc-fbtn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--mono); font-size: 0.74rem; color: var(--text-2);
  cursor: pointer; padding: 0.3rem 0.7rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-2);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.proc-fbtn:hover { border-color: var(--accent-dim); }
.proc-fbtn.active { border-color: var(--accent); color: var(--text); background: var(--bg-3); }
.proc-fic { font-size: 0.85rem; line-height: 1; }
.proc-fct { color: var(--text-3); font-size: 0.68rem; }
.proc-fbtn.active .proc-fct { color: var(--text-2); }
.proc-fbtn.proc-local .proc-fic,
.proc-fbtn.proc-e2e .proc-fic,
.proc-fbtn.proc-p2p .proc-fic { color: var(--success); }
.proc-fbtn.proc-stored .proc-fic { color: var(--accent); }
/* Inline variant: the back chip lives INSIDE the sticky search row, to the left
   of the input, so the search box keeps the same position on home/all/category. */
.home-search-wrap .back-link { margin-bottom: 0; flex-shrink: 0; }
.home-search-wrap .back-link .bl-arrow + .bl-label { margin-left: 0.4rem; }
/* On narrow screens drop the label so the back chip stays a compact arrow and
   the search box keeps as much width as possible. */
@media (max-width: 520px) {
  .home-search-wrap .back-link .bl-label { display: none; }
}

/* "app: <benefit>" chip — a quieter sibling to the proc chip, shown right
   after it on tool pages that also carry a data-app-cap app-hint (set on
   res.locals.appCapBadge in app.js, from core/app-caps.js). Reuses the
   app-hint's accent colour but stays text-only and low-contrast so it never
   competes with the privacy chip for attention. Auto-hides inside the app via
   /_native-bridge.js (it carries the same data-app-cap attribute). */
.app-cap-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  margin: 0 0 1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  transition: border-color 0.15s, color 0.15s;
}
.app-cap-chip:hover { border-color: var(--accent-dim); color: var(--accent); text-decoration: none; }

/* "Better in the app" callout — shown by pages that unlock more when running
   inside the 1234.nu Android app (data-app-cap="CAP" on the element; see
   /_native-bridge.js, which auto-hides it once app.info.caps already has CAP).
   Quiet by design: a thin accent tick, small text, no box shadow or icon. */
.app-hint {
  display: block;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-2);
  padding: 0.5rem 0.8rem;
  margin: 0 0 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.app-hint a { color: var(--accent); font-weight: 500; }
.app-hint a:hover { text-decoration: underline; }

/* ─── Shortcut chips box (Pinned / Recently added) ───────────────────────
   Filled in by /_catalogue.js. A bordered panel above the catalogue so the
   shortcut chips read as their own block; collapses entirely when empty. */
.shortcuts {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.shortcuts:empty { display: none; }

/* ─── Home category tiles ────────────────────────────────────────────────
   One tile per category (+ a final "All tools" tile). Same grid metrics as the
   tool grid so the two views feel like one place. */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.5rem;
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}
.cat-card:hover { background: var(--bg-3); text-decoration: none; }
.cat-card-ic {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.cat-card-nm { font-weight: 600; font-size: 1.05rem; }
.cat-card-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent-dim);
  letter-spacing: 0.03em;
}
.cat-card-tools {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* The "All tools" tile: the muted icon marks it as the classic-view escape
   hatch rather than a category. */
.cat-card-all .cat-card-ic { color: var(--text-2); }

/* The Android app promo tile: same muted treatment as "All tools" so it sits
   quietly among real categories rather than shouting for attention. Hidden
   entirely inside the app itself (see [data-hide-in-app] in /_native-bridge.js). */
.cat-card-app .cat-card-ic { color: var(--text-2); }

/* ─── Page header ────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
}
.page-title {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.page-sub {
  font-size: 0.82rem;
  color: var(--text-2);
}
/* Category page: the category glyph sits just before the title (inherits the
   page-title's mono + accent). */
.cat-head-icon { margin-right: 0.4rem; }

/* ─── Forms ──────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1rem; }

label {
  font-size: 0.78rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 0.35rem;
}
input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s;
  outline: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
textarea {
  font-family: var(--mono);
  font-size: 0.85rem;
  resize: vertical;
  min-height: 260px;
  line-height: 1.6;
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row > * { flex: 1; min-width: 160px; }

.form-group { display: flex; flex-direction: column; }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-3);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 500;
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #000; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
.btn-danger { border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }

/* Style the native file-picker button so a bare <input type="file"> matches the
   site's buttons instead of the raw browser default. Drop-zone inputs (opacity:0)
   are unaffected; this only shows on visible file inputs (e.g. /exif). */
input[type="file"] { font-family: var(--sans); font-size: 0.85rem; color: var(--text-2); }
input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-3);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Flash messages ─────────────────────────────────────────────────── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.flash-success { background: rgba(62,207,142,0.08); border-color: var(--success); color: var(--success); }
.flash-error   { background: rgba(224,82,82,0.08);  border-color: var(--error);   color: var(--error); }
.flash-info    { background: rgba(245,166,35,0.08); border-color: var(--accent);  color: var(--accent); }

/* ─── Result box (shown after creation) ─────────────────────────────── */
.result-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.result-url {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--accent);
  word-break: break-all;
}
.result-token {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--bg-3);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  word-break: break-all;
}
.result-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.result-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 90px;
  flex-shrink: 0;
}

/* ─── Code / paste view ──────────────────────────────────────────────── */
.paste-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.paste-meta-item {
  font-size: 0.78rem;
  color: var(--text-3);
  font-family: var(--mono);
}
.paste-meta-item span { color: var(--text-2); }
.paste-actions { margin-left: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; }

.code-wrap {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}
.code-wrap pre {
  margin: 0;
  padding: 1.25rem;
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}
.code-wrap code { font-family: inherit; }
.line-numbers {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1.25rem 0.75rem;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.65;
  border-right: 1px solid var(--border);
  pointer-events: none;
  text-align: right;
  min-width: 3rem;
  user-select: none;
}

/* ─── File / image share ─────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(245,166,35,0.04);
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-icon { font-family: var(--mono); font-size: 2rem; color: var(--text-3); display: block; margin-bottom: 0.75rem; }
.drop-text { color: var(--text-2); font-size: 0.85rem; }
.drop-hint { font-size: 0.75rem; color: var(--text-3); margin-top: 0.35rem; }

.progress-wrap {
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  height: 4px;
  display: none;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.2s;
}

.file-info {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.file-name { font-family: var(--mono); font-size: 0.9rem; margin-bottom: 0.5rem; }
.file-meta { font-size: 0.78rem; color: var(--text-2); display: flex; gap: 1.5rem; flex-wrap: wrap; }
.file-meta-item strong { color: var(--text); }

/* ─── Note/image view ────────────────────────────────────────────────── */
.note-body {
  font-size: 1rem;
  line-height: 1.8;
  max-width: 680px;
}
.note-body h1 { font-size: 1.6rem; margin: 1.5rem 0 0.75rem; }
.note-body h2 { font-size: 1.25rem; margin: 1.25rem 0 0.6rem; }
.note-body h3 { font-size: 1.05rem; margin: 1rem 0 0.5rem; }
.note-body p  { margin-bottom: 1rem; }
.note-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-2);
}
.note-body code {
  font-family: var(--mono);
  font-size: 0.83em;
  background: var(--bg-3);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.note-body pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.note-body pre code { background: none; padding: 0; }
.note-body a { color: var(--accent); }
.note-body ul, .note-body ol { margin-left: 1.5rem; margin-bottom: 1rem; }
.note-body li { margin-bottom: 0.25rem; }
.note-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.note-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.note-meta {
  font-size: 0.78rem;
  color: var(--text-3);
  font-family: var(--mono);
  margin-bottom: 2rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ─── Network tool ───────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab {
  padding: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Button-style tab group: pill buttons (use with .btn .btn-sm); the selected
   tab gets the accent fill, matching the home "Request a tool" button. */
.tab-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 500; }
.tab-btn.active:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #000; }

/* EN/NL toggle for the Dutch tax-tool suite (public/_finance-lang.js).
   Same accent-fill pattern as .tab-btn.active; sits just under the page
   header on the 12 belasting tools only. */
.fin-lang-toggle { display: inline-flex; gap: 0.35rem; margin-top: 0.6rem; }
.fin-lang-toggle .btn.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 500; }
.fin-lang-toggle .btn.active:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #000; }

.output-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  min-height: 140px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-2);
}
.output-block .out-line { color: var(--text); }
.output-block .out-err  { color: var(--error); }
.output-block .out-done { color: var(--success); }

/* ─── Image view ─────────────────────────────────────────────────────── */
.img-preview {
  text-align: center;
  margin-bottom: 1.5rem;
}
.img-preview img {
  max-height: 500px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.embed-codes { display: flex; flex-direction: column; gap: 0.75rem; }
.embed-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.embed-code {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  word-break: break-all;
  color: var(--text-2);
}

/* ─── Copy button ────────────────────────────────────────────────────── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-family: var(--mono);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { border-color: var(--success); color: var(--success); }

/* ─── Stats page ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.stat-cell {
  background: var(--bg-2);
  padding: 1.25rem;
}
.stat-label { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.4rem; }
.stat-value { font-family: var(--mono); font-size: 1.4rem; color: var(--text); }

/* ─── Util ───────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--text-2); font-size: 0.82rem; }
.mono { font-family: var(--mono); }

/* ─── Light theme ────────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg:         #f7f7f7;
  --bg-2:       #ffffff;
  --bg-3:       #ebebeb;
  --border:     #d8d8d8;
  --text:       #111111;
  --text-2:     #555555;
  --text-3:     #999999;
  --accent:     #d48a10;
  --accent-dim: #b87718;
  color-scheme: light;
}

/* ─── Theme toggle button ────────────────────────────────────────────── */
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ─── Wide-mode toggle button (nav) ──────────────────────────────────────
   Hidden on narrow viewports (nothing to widen into); shown once there's
   room to actually go wider. Look matches .theme-btn (also carries that
   class); only display is overridden here. */
.wide-btn { display: none; }
@media (min-width: 1100px) {
  .wide-btn { display: inline-block; }
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .main { padding: 1.25rem 1rem; }
  .nav { padding: 0.65rem 1rem; }
  .nav-tool { padding: 0.2rem 0.35rem; font-size: 0.72rem; }
  .home-grid, .cat-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
}
@media (max-width: 400px) {
  .home-grid, .cat-grid { grid-template-columns: 1fr; }
}

/* ─── Error page (404) ────────────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 32rem;
  margin: 0 auto;
}
.error-code {
  font-family: var(--mono);
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.error-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1rem;
}
.error-sub {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 0.75rem;
}
.error-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.75rem;
}

/* ─── Local Drop (/drop) ──────────────────────────────────────────────── */
.drop-self {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.drop-self-emoji { font-size: 1.6rem; line-height: 1; }
.drop-self-label { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.drop-self-name { font-family: var(--mono); font-weight: 600; color: var(--text); }
.drop-status {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-2);
}

.drop-peers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.drop-empty {
  grid-column: 1 / -1;
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
}
.drop-peer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  cursor: pointer;
  font-family: var(--sans);
  transition: border-color 0.15s, transform 0.1s;
}
.drop-peer:hover { border-color: var(--accent); transform: translateY(-2px); }
.drop-peer:active { transform: translateY(0); }
.drop-peer-emoji { font-size: 2rem; line-height: 1; }
.drop-peer-name { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.drop-peer-hint { font-size: 0.7rem; color: var(--text-3); }

.drop-code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}
.drop-code > label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.drop-code-row { display: flex; gap: 0.5rem; }
.drop-code-row input {
  flex: 0 0 auto;
  width: 9rem;
  font-family: var(--mono);
  letter-spacing: 0.2em;
}
.drop-code-hint { font-size: 0.75rem; color: var(--text-2); margin-top: 0.5rem; line-height: 1.5; }
.drop-code-status { font-size: 0.8rem; margin-top: 0.4rem; min-height: 1em; }
.drop-code-status.ok { color: var(--success); }
.drop-code-status.err { color: var(--error); }

.drop-transfers { display: flex; flex-direction: column; gap: 0.5rem; }
.drop-xfer {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
}
.drop-xfer.err { border-color: var(--error); }
.drop-xfer-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.drop-xfer-dir { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.drop-xfer-name { font-weight: 600; color: var(--text); font-size: 0.85rem; }
.drop-xfer-meta { font-size: 0.72rem; color: var(--text-2); margin-left: auto; }
.drop-xfer-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.drop-xfer-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

/* ─── Image lightbox ─────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(2px);
}
.lightbox.open { display: block; }
.lightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.lightbox-stage:active { cursor: grabbing; }
.lightbox-img {
  max-width: none;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-bar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.4rem;
}
.lightbox-bar button {
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.lightbox-bar button:hover { color: var(--accent); border-color: var(--accent-dim); }
.lightbox-hint {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-2);
  font-size: 0.75rem;
  font-family: var(--mono);
  background: rgba(30, 30, 30, 0.7);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  white-space: nowrap;
  pointer-events: none;
}
@media (max-width: 560px) { .lightbox-hint { display: none; } }
/* Signal the share-page preview is clickable */
.img-preview a[data-lightbox] { cursor: zoom-in; display: inline-block; }

/* ─── Games (/play) ──────────────────────────────────────────────────── */
.game-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.game-hud { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; font-family: var(--mono); font-size: 0.85rem; }
.game-stat { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem 0.7rem; color: var(--text-2); }
.game-stat b { color: var(--text); font-weight: 600; }
.game-canvas { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; max-width: 100%; height: auto; display: block; }
.game-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; align-items: center; }
.game-msg { min-height: 1.4rem; font-family: var(--mono); color: var(--accent); text-align: center; }
.game-board { display: grid; gap: 4px; touch-action: manipulation; user-select: none; }
.game-board > * { box-sizing: border-box; }
.game-back { font-size: 0.82rem; color: var(--text-2); }
/* Fullscreen (shared /_fullscreen.js helper — see .claude/docs/GAME-FULLSCREEN.md).
   .game-fake-full is the CSS fallback applied when the Fullscreen API is
   missing or refuses (app WebView pre-1.4.2, iPhone Safari): same element,
   fixed over the viewport. The :fullscreen rules give the real API parity on
   plain .game-wrap stages; content stays top-aligned and scrollable rather
   than vertically centered so oversized boards never clip. Keep the prefixed
   and unprefixed selectors in separate rules — one unknown selector would
   invalidate a shared group. */
.game-fake-full { position: fixed !important; inset: 0; z-index: 60; margin: 0 !important; padding: 12px; background: var(--bg); overflow: auto; box-sizing: border-box; }
.game-wrap:fullscreen { padding: 12px; background: var(--bg); overflow: auto; box-sizing: border-box; }
.game-wrap:-webkit-full-screen { padding: 12px; background: var(--bg); overflow: auto; box-sizing: border-box; }
/* On-screen touch controls — only shown on coarse-pointer (touch) devices, so
   keyboard players on desktop never see redundant buttons. */
.game-pad { display: none; gap: 0.5rem; flex-wrap: wrap; justify-content: center; align-items: center; touch-action: manipulation; }
.game-pad button {
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--mono); font-size: 1.3rem; line-height: 1;
  width: 3.4rem; height: 3.4rem; cursor: pointer;
}
.game-pad button:active { background: var(--bg-3); border-color: var(--accent); }
.game-pad button.game-pad-wide { width: auto; padding: 0 1rem; font-size: 0.95rem; }
@media (pointer: coarse) { .game-pad { display: flex; } }

/* ── Homepage pin buttons + Pinned/Recent sections ─────────────────────── */
.home-grid .tool-card { position: relative; }
.pin-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.2rem;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.tool-card:hover .pin-btn, .pin-btn:focus-visible { opacity: 1; }
.pin-btn.pinned { opacity: 1; color: var(--accent); }
.pin-btn:hover { color: var(--accent); }
@media (hover: none) { .pin-btn { opacity: 0.45; } }

/* Per-tile popularity badge (global open count). Sits bottom-right, out of the
   way of the top-right pin button. */
.tool-hits {
  position: absolute;
  bottom: 0.5rem;
  right: 0.7rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  color: var(--text-3);
  pointer-events: none;
}

/* "New" badge on a recently-added grid tile (registry `added` date, date-based
   and self-expiring — see core/tools-registry.js). Top-left so it never collides
   with the bottom-right open-count badge. */
.tool-new {
  position: absolute;
  top: 0.45rem;
  left: 0.55rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  pointer-events: none;
}

/* Compact chip rows for the Pinned / Recently-added shortcut sections — dense
   one-line pills, distinct from the full catalogue tiles below. Span the whole
   grid width and wrap. */
.chip-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.15rem 1.5rem 0.65rem;
  background: var(--bg);
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s;
}
.tool-chip:hover { background: var(--bg-3); border-color: var(--accent-dim); text-decoration: none; }
.tool-chip-ic { font-family: var(--mono); color: var(--accent); font-size: 0.78rem; }
.tool-chip-nm { font-weight: 500; }
.tool-chip-ct { font-family: var(--mono); font-size: 0.64rem; color: var(--text-3); }

/* ─── Code editor (/_codeedit.js) + syntax highlight tokens ───────────────
   A transparent textarea over a <pre><code> highlight layer. The two layers
   MUST share identical font metrics, padding and wrapping or the caret drifts.
   Token colours are theme-aware (one-dark-ish / one-light-ish) so the same
   rules style the live editors, the formatter outputs and the paste view. */
:root {
  --syn-comment: #6a737d;
  --syn-key:     #c678dd;
  --syn-str:     #98c379;
  --syn-num:     #d19a66;
  --syn-fn:      #61afef;
  --syn-type:    #e5c07b;
  --syn-attr:    #56b6c2;
  --syn-tag:     #e06c75;
  --syn-meta:    #56b6c2;
}
html[data-theme="light"] {
  --syn-comment: #a0a1a7;
  --syn-key:     #a626a4;
  --syn-str:     #50a14f;
  --syn-num:     #986801;
  --syn-fn:      #4078f2;
  --syn-type:    #c18401;
  --syn-attr:    #0184bc;
  --syn-tag:     #e45649;
  --syn-meta:    #0184bc;
}

.codeedit {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
}
.codeedit:focus-within { border-color: var(--accent); }
.codeedit-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.55rem;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.codeedit-barlabel {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
}
.codeedit-lang {
  width: auto;
  min-width: 9rem;
  font-size: 0.78rem;
  padding: 0.2rem 1.7rem 0.2rem 0.55rem;
  background-color: var(--bg-2);
}
.codeedit-detected {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-2);
}
.codeedit-body { position: relative; min-height: 18rem; }
/* The shared text box: identical here on both the highlight layer and the
   textarea so glyphs line up exactly. */
.codeedit-hl,
.codeedit-ta {
  margin: 0;
  border: 0;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  tab-size: 2;
  padding: 0.75rem 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  letter-spacing: normal;
}
.codeedit-hl {
  position: relative;
  min-height: inherit;
  pointer-events: none;
  color: var(--text);
  background: transparent;
}
/* The highlight text lives in a <code> inside the <pre>. The UA stylesheet's
   `code { font-family: monospace }` matches <code> directly, so it does NOT
   inherit the <pre>'s font — the highlight layer would render in generic
   monospace while the textarea uses var(--mono) (JetBrains Mono). The ~7% width
   difference makes the invisible caret drift ever further past the visible text
   ("extra spaces after the text"). Force <code> to share every metric. */
.codeedit-hl code {
  font: inherit;
  letter-spacing: inherit;
  tab-size: inherit;
}
.codeedit-ta {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  resize: none;
  outline: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--accent);
  overflow: hidden;
}
.codeedit-ta::selection { background: rgba(245,166,35,0.28); }
.codeedit-ta::-moz-selection { background: rgba(245,166,35,0.28); }
/* Bare mode: drop all chrome and inherit the host layout (e.g. the /js REPL). */
.codeedit-bare { border: 0; border-radius: 0; background: transparent; overflow: visible; }
.codeedit-bare .codeedit-body { min-height: 0; }
.codeedit-bare .codeedit-hl,
.codeedit-bare .codeedit-ta { padding: 0; }

/* ── highlight.js token colours (shared) ─────────────────────────────────── */
.hljs { color: var(--text); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--syn-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-doctag { color: var(--syn-key); }
.hljs-string, .hljs-regexp, .hljs-symbol, .hljs-bullet, .hljs-meta .hljs-string, .hljs-addition { color: var(--syn-str); }
.hljs-number, .hljs-selector-attr, .hljs-selector-pseudo { color: var(--syn-num); }
.hljs-title, .hljs-title.function_, .hljs-built_in { color: var(--syn-fn); }
.hljs-title.class_, .hljs-class .hljs-title, .hljs-type { color: var(--syn-type); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable, .hljs-template-variable, .hljs-params { color: var(--syn-attr); }
.hljs-name, .hljs-tag, .hljs-selector-id, .hljs-selector-class { color: var(--syn-tag); }
.hljs-meta, .hljs-meta .hljs-keyword { color: var(--syn-meta); }
.hljs-deletion { color: var(--error); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* ─── Realtime collaboration: /screen /call /board ──────────────────────── */
.rtc-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem .75rem; margin-bottom: 1rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .85rem;
}
.rtc-status { color: var(--text-2); }
.rtc-self { color: var(--text); font-family: var(--mono); }

.rtc-room {
  display: flex; align-items: center; flex-wrap: wrap; gap: .75rem;
  padding: 1.25rem; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.rtc-or { color: var(--text-3); }
.rtc-join { display: flex; gap: .5rem; }
.rtc-join input {
  width: 9rem; padding: .5rem .6rem; font-family: var(--mono); letter-spacing: .15em;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.rtc-err { flex-basis: 100%; color: var(--error); font-size: .85rem; min-height: 1em; }

.rtc-codebox {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  padding: .6rem .75rem; margin-bottom: .75rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem;
}
.rtc-codebox strong { font-family: var(--mono); font-size: 1.15rem; letter-spacing: .2em; color: var(--accent); }
.rtc-peercount { color: var(--text-2); }
.rtc-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.rtc-hint { color: var(--text-3); font-size: .8rem; }

.rtc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; }
.rtc-grid-call { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.rtc-tile {
  position: relative; background: #000; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9;
}
.rtc-tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.rtc-grid-call .rtc-tile video { object-fit: cover; }
.rtc-tile-self { outline: 2px solid var(--accent); }
.rtc-tile-self video { transform: scaleX(-1); }   /* mirror our own camera */
.rtc-tile-camoff { background: var(--bg-3); }
.rtc-tile-camoff video { visibility: hidden; }
.rtc-tile-label {
  position: absolute; left: .4rem; bottom: .4rem;
  padding: .15rem .45rem; font-size: .75rem; color: #fff;
  background: rgba(0,0,0,.6); border-radius: var(--radius);
}
.rtc-empty { grid-column: 1 / -1; padding: 2rem 1rem; text-align: center; color: var(--text-3); }

/* Whiteboard */
.board-tools { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.board-swatch input[type=color] {
  width: 2.4rem; height: 2.4rem; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
}
.board-tools input[type=range] { width: 8rem; }
.board-tools .is-active { border-color: var(--accent); color: var(--accent); }
.board-wrap { position: relative; }
#board-canvas {
  width: 100%; height: auto; display: block; cursor: crosshair;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  touch-action: none;
}
.board-cursor {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--accent); pointer-events: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,.4); transition: left .05s linear, top .05s linear;
}
.board-note-edit {
  position: absolute; z-index: 4; box-sizing: border-box; resize: none; overflow: hidden;
  border: 1px dashed rgba(0,0,0,.45); border-radius: 2px; outline: none;
  padding: .5em; font-family: system-ui, sans-serif; line-height: 1.25; text-align: center;
  box-shadow: 3px 4px 9px rgba(0,0,0,.28);
}

/* ─── Sound Triangulation: /echoloc ──────────────────────────────────────── */
.el-steps {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem;
}
.el-step {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .65rem; font-size: .85rem; color: var(--text-3);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.el-step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.3rem; height: 1.3rem; font-size: .75rem; font-family: var(--mono);
  border: 1px solid var(--border); border-radius: 50%;
}
.el-step.is-active { color: var(--accent); border-color: var(--accent); }
.el-step.is-active .el-step-n { border-color: var(--accent); }
.el-step.is-done { color: var(--success); }
.el-step.is-done .el-step-n { border-color: var(--success); }

.el-mic {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  padding: .5rem .75rem; margin-bottom: .75rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .85rem;
}
.el-mic-status { color: var(--text-2); }
.el-level {
  flex: 1 1 6rem; min-width: 6rem; height: .5rem; overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius);
}
.el-level-bar { display: block; height: 100%; width: 0; background: var(--success); transition: width .15s linear; }

.el-guide { margin-bottom: .5rem; color: var(--text-2); font-size: .9rem; min-height: 1.2em; }
.el-warn {
  margin-bottom: .75rem; padding: .5rem .75rem; font-size: .85rem;
  color: var(--error); background: var(--bg-2);
  border: 1px solid var(--error); border-radius: var(--radius);
}

.el-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.el-file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.el-quiet, .el-wake { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-2); font-size: .85rem; }
.el-wake { margin-left: auto; }

.el-scale-form {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  padding: .6rem .75rem; margin-bottom: .75rem; font-size: .9rem;
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: var(--radius);
}
.el-scale-form input[type=number] {
  width: 6.5rem; padding: .4rem .5rem; font-family: var(--mono);
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}

.el-canvas-wrap { position: relative; margin-bottom: .75rem; }
#el-canvas {
  width: 100%; height: auto; display: block; cursor: crosshair;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  touch-action: none;
}

.el-cols { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 720px) { .el-cols { grid-template-columns: 1fr 1fr; } }
.el-panel {
  padding: .75rem; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.el-panel-title { margin-bottom: .5rem; font-size: .8rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.el-matrix { overflow-x: auto; font-size: .85rem; color: var(--text-2); }
.el-matrix table { width: 100%; border-collapse: collapse; }
.el-matrix th, .el-matrix td {
  padding: .3rem .5rem; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border); font-weight: normal;
}
.el-matrix th { color: var(--text-3); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.el-matrix td { color: var(--text); font-family: var(--mono); font-size: .8rem; }
.el-pair-warn td { color: var(--accent); }
.el-pair-bad td { color: var(--error); }

.el-log { max-height: 16rem; overflow-y: auto; font-size: .85rem; color: var(--text-2); }
.el-log-row { padding: .2rem 0; font-family: var(--mono); font-size: .8rem; color: var(--text); border-bottom: 1px solid var(--border); }

.el-notes { margin-top: 1.5rem; color: var(--text-2); font-size: .85rem; }
.el-notes p { margin-bottom: .6rem; line-height: 1.5; }

/* ─── QR share modal (public/_qr-share.js) ───────────────────────────────── */
.qr-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(0, 0, 0, .65);
}
.qr-modal {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  max-width: min(92vw, 22rem); padding: 1.25rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
}
/* Codes need a light background with dark modules to scan reliably, so the
   QR panel stays white in both themes. */
.qr-modal-code { padding: .75rem; background: #fff; border-radius: var(--radius); line-height: 0; }
.qr-modal-code svg { display: block; width: min(64vw, 240px); height: auto; }
.qr-modal-url {
  max-width: 100%; font-family: var(--mono); font-size: .75rem;
  color: var(--text-2); word-break: break-all; text-align: center;
}

/* ─── App settings suite (/app/settings, /my, /share) ──────────────────
   Minimal net-new classes; sections reuse .api-block, controls reuse
   .form/.form-row/.form-group/.btn, results reuse .result-row/.result-url/
   .copy-btn, and the favorites grid reuses .home-grid/.tool-card/
   .grid-section-header so all three pages match the site's existing look. */

/* Generic empty-state note, shared by history/favorites/share ("nothing
   here yet" style messages) so we don't invent three near-identical rules. */
.empty-note {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 0.85rem;
  text-align: center;
}

/* Small mono badge — tool slug on a history row, or TEXT/FILE kind on a
   share card. */
.tool-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-3);
  color: var(--accent-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── /app/settings: labeled info rows + save/error feedback ───────────── */
.settings-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { color: var(--text-2); }
.settings-row-value { font-family: var(--mono); color: var(--text); text-align: right; }
.settings-radio-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  cursor: pointer;
}
.settings-radio-row input[type="text"] { width: auto; flex: 1; min-width: 140px; }
.settings-feedback {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  min-height: 1.1em;
  color: var(--text-2);
}
.settings-feedback.ok { color: var(--success); }
.settings-feedback.err { color: var(--error); }

/* ── Share history rows (/app/settings "Share history" section) ───────── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-2);
  flex-wrap: wrap;
}
.history-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 0.15rem; }
.history-label { font-weight: 500; font-size: 0.9rem; color: var(--text); }
.history-meta { font-size: 0.72rem; color: var(--text-3); font-family: var(--mono); }
.history-link {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  word-break: break-all;
}
.history-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.history-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
}
.history-remove:hover { color: var(--error); }

/* ── Favorites (/my): star toggle on tool cards + list rows ────────────── */
/* Sits alongside .pin-btn (homepage recents) but is a distinct feature/state,
   so a tool can be pinned and starred independently without visual clash. */
.star-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  transition: color 0.15s;
}
.star-btn:hover { color: var(--accent); }
.star-btn.active,
.star-btn[aria-pressed="true"] { color: var(--accent); }
.home-grid .tool-card .star-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  opacity: 0;
}
.home-grid .tool-card:hover .star-btn,
.home-grid .tool-card .star-btn:focus-visible,
.home-grid .tool-card .star-btn.active { opacity: 1; }
@media (hover: none) { .home-grid .tool-card .star-btn { opacity: 0.45; } }

/* Catalogue below the favorites grid: a search box + a plain row layout
   (lighter than tiles for the full ~340-tool list). */
.fav-search-input { width: 100%; max-width: 28rem; }
.fav-catalog { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fav-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-2);
}
.fav-row-icon { font-family: var(--mono); color: var(--accent); font-size: 1.05rem; width: 1.6rem; text-align: center; flex-shrink: 0; }
.fav-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.fav-row-name { font-weight: 500; font-size: 0.9rem; }
.fav-row-desc { font-size: 0.78rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Share cards (/share) ────────────────────────────────────────────── */
.share-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.share-card-meta { font-size: 0.78rem; color: var(--text-3); font-family: var(--mono); }
.share-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.share-card-result { margin-top: 0.25rem; }

/* ── Print ────────────────────────────────────────────────────────────────
   A tool's output is the only thing worth a printout — the nav, footer,
   privacy/app chips, app-hints and any "related tools" strip are all
   on-screen chrome. `.related-tools`/`related-tool-strip` don't exist yet
   as of this writing, so the attribute selector is a defensive catch-all for
   whatever class name that strip ships under. Browse-page furniture (search
   box, category tiles, discover rail) isn't "content" either, so it goes too.
   What's left (.main) is stretched full width since there's no nav/footer
   column to balance against anymore. */
@media print {
  .nav,
  .footer,
  .proc-chip,
  .app-cap-chip,
  .api-chip,
  .app-hint,
  .related-tools,
  .related-tool-strip,
  [class~="related-tools"],
  [class*="related-tool-"],
  .home-search-wrap,
  .cat-grid,
  .shortcuts,
  .discover-rail,
  .proc-filter,
  #search-request,
  dialog {
    display: none !important;
  }
  .main {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0;
  }
}
