/* =========================================================
   CodePear — site styles
   Free, private, in-browser tools · codepear.com
   ========================================================= */

/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("../fonts/atkinson.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("../fonts/atkinson-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f6f8f1;
  --surface: #ffffff;
  --surface-2: #eef2e7;
  --ink: #1c2a1f;
  --ink-2: #4b5b4e;
  --ink-3: #6f7d70;
  --line: #dbe3d2;
  --line-strong: #c3cfb8;
  --pear: #74b72e;
  --pear-soft: #e5f2d3;
  --leaf: #2c5a10;
  --accent: #3b7814;
  --accent-ink: #ffffff;
  --accent-hover: #2f6410;
  --ripe: #f4c542;
  --ripe-ink: #3a2c00;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --focus: #3b7814;
  --shadow-lg: 0 18px 50px -20px rgba(28, 42, 31, .28);
  --shadow-sm: 0 1px 0 rgba(28, 42, 31, .06);

  --font-display: "Bricolage", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-input: 10px;
  --r-panel: 18px;
  --r-pill: 999px;

  --wrap: 1140px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #111712;
  --surface: #182019;
  --surface-2: #1f2a21;
  --ink: #e6eee2;
  --ink-2: #aebcac;
  --ink-3: #8a9a89;
  --line: #2a372c;
  --line-strong: #3a4a3c;
  --pear: #8cc63f;
  --pear-soft: #23331d;
  --leaf: #a8dc6a;
  --accent: #8cc63f;
  --accent-ink: #132008;
  --accent-hover: #a2d65c;
  --ripe: #f4c542;
  --ripe-ink: #2a2000;
  --danger: #ff8a80;
  --danger-soft: #3a1d1a;
  --focus: #a8dc6a;
  --shadow-lg: 0 18px 50px -20px rgba(0, 0, 0, .7);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg, canvas { max-width: 100%; }
a { color: var(--leaf); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  font-weight: 700;
}
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.85rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code, kbd, pre, .mono { font-family: var(--font-mono); font-size: .92em; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  font-size: .78em;
  color: var(--ink-2);
  background: var(--surface);
  line-height: 1.5;
}
::selection { background: var(--pear); color: #102006; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px;
}
.skip-link:focus { top: 12px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
[hidden] { display: none !important; }

/* ---------- Icons ---------- */
.icon { display: inline-block; width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 750; font-size: 1.32rem; letter-spacing: -.03em;
  margin-right: auto;
}
.brand img { width: 34px; height: 34px; }
.brand span b { color: var(--accent); font-weight: inherit; }
:root[data-theme="dark"] .brand span b { color: var(--pear); }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a, .nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-pill);
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .98rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.main-nav a:hover, .nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.search-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px 0 12px; min-width: 210px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-3);
  font: inherit; font-size: .95rem; cursor: pointer;
}
.search-trigger:hover { border-color: var(--accent); color: var(--ink-2); }
.search-trigger kbd { margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.coffee-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--ripe); color: var(--ripe-ink); text-decoration: none;
  font-weight: 700; font-size: .95rem; white-space: nowrap;
}
.coffee-btn:hover { filter: brightness(1.05); text-decoration: none; }
.menu-btn { display: none; }

@media (max-width: 960px) {
  .main-nav, .search-trigger, .header-row > .coffee-btn { display: none; }
  .menu-btn, .search-btn-mobile { display: inline-grid; }
}
@media (min-width: 961px) { .search-btn-mobile { display: none; } }

/* ---------- Drawer (mobile nav) ---------- */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 16, 11, .45);
  display: none;
}
.drawer.open { display: block; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(380px, 92vw);
  background: var(--paper);
  overflow-y: auto; padding: 14px 18px 32px;
  box-shadow: var(--shadow-lg);
  animation: slide-in .22s ease-out;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer h3 { font-size: .95rem; color: var(--ink-3); margin: 18px 0 6px; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer li a {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.drawer li a:hover, .drawer li a[aria-current="page"] { background: var(--surface-2); }
.drawer li a .icon { color: var(--accent); }
.drawer .coffee-btn { margin-top: 20px; width: 100%; justify-content: center; padding: 12px; }

/* ---------- Command palette ---------- */
.palette {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 16, 11, .5);
  display: none; align-items: flex-start; justify-content: center;
  padding: 10vh 14px 14px;
}
.palette.open { display: flex; }
.palette-box {
  width: min(620px, 100%);
  background: var(--surface); border-radius: var(--r-panel);
  box-shadow: var(--shadow-lg); overflow: hidden;
  border: 1px solid var(--line);
}
.palette-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-input-row .icon { color: var(--ink-3); }
.palette input {
  flex: 1; height: 58px; border: 0; outline: 0; background: none;
  font: inherit; font-size: 1.1rem; color: var(--ink);
}
.palette-results { max-height: min(60vh, 460px); overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.palette-results a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  text-decoration: none; color: var(--ink);
}
.palette-results a small { display: block; color: var(--ink-3); font-size: .86rem; }
.palette-results a .icon { color: var(--accent); width: 22px; height: 22px; }
.palette-results li.active a, .palette-results a:hover { background: var(--pear-soft); }
.palette-empty { padding: 22px; color: var(--ink-3); text-align: center; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .82rem; }
@media (max-width: 600px) { .palette { padding-top: 12px; } .palette-foot { display: none; } }

/* ---------- Buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: var(--r-input); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; font-size: 1rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-ghost { background: none; color: var(--leaf); padding: 0 10px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: none; color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .92rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn .icon { width: 1.1em; height: 1.1em; }
.btn.is-done { background: var(--pear); color: #102006; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 700; font-size: .95rem; color: var(--ink); }
.field .hint { font-size: .86rem; color: var(--ink-3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.input, .select, .textarea {
  width: 100%; min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-input);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1rem; /* 16px+ prevents iOS zoom */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.textarea.mono, .input.mono { font-family: var(--font-mono); font-size: .95rem; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%236f7d70' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.check {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 8px 0; font-weight: 600; user-select: none;
}
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
input[type="color"] {
  width: 46px; height: 46px; padding: 3px; border-radius: var(--r-input);
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer;
}

/* Segmented control */
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line);
}
.seg button, .seg label {
  border: 0; background: none; font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--ink-2); padding: 8px 14px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"], .seg label:has(input:checked) {
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); }
.seg-scroll { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll button { white-space: nowrap; }

/* ---------- Page: home ---------- */
.hero { padding: clamp(36px, 7vw, 84px) 0 clamp(20px, 3vw, 32px); }
.hero h1 {
  font-size: clamp(2.3rem, 1.3rem + 4.4vw, 4.4rem);
  font-weight: 760; max-width: 15ch; margin-bottom: 14px; line-height: 1.02;
  letter-spacing: -.035em;
}
.hero-lede { color: var(--ink-2); font-size: clamp(1.05rem, 1rem + .3vw, 1.25rem); max-width: 56ch; margin-bottom: 28px; }
.finder { position: relative; max-width: 760px; }
.finder .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; color: var(--accent); pointer-events: none; }
.finder input {
  width: 100%; height: 68px;
  padding: 0 20px 0 58px;
  font: inherit; font-size: clamp(1.05rem, 1rem + .4vw, 1.3rem); color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink); border-radius: 16px;
  box-shadow: 5px 5px 0 var(--pear);
  transition: box-shadow .15s, transform .15s;
}
.finder input::placeholder { color: var(--ink-3); }
.finder input:focus { outline: none; box-shadow: 7px 7px 0 var(--pear); transform: translate(-1px, -1px); }
.finder-meta { margin-top: 14px; color: var(--ink-3); font-size: .95rem; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.finder-meta span { display: inline-flex; align-items: center; gap: 6px; }
.finder-meta .icon { color: var(--accent); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .count { font-size: .8rem; opacity: .7; }

.directory { padding: 10px 0 40px; }
.cat-block { padding: 26px 0; border-top: 1px solid var(--line); }
.cat-block:first-child { border-top: 0; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.cat-head h2 { font-size: 1.35rem; margin: 0; display: flex; align-items: center; gap: 10px; }
.cat-head h2 .icon { color: var(--accent); }
.cat-head a { font-size: .95rem; font-weight: 600; }
.tool-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px 22px; }
.tool-link {
  display: grid; grid-template-columns: 44px 1fr; gap: 2px 14px; align-items: center;
  padding: 12px 12px 12px 10px; margin: 0 -10px; border-radius: 14px;
  text-decoration: none; color: var(--ink);
}
.tool-link:hover { background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); text-decoration: none; }
.tool-link .tile {
  grid-row: span 2; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--pear-soft); color: var(--leaf);
}
.tool-link .tile .icon { width: 22px; height: 22px; }
.tool-link strong { font-family: var(--font-display); font-weight: 650; font-size: 1.07rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.tool-link span.desc { color: var(--ink-2); font-size: .93rem; line-height: 1.4; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--ripe); color: var(--ripe-ink);
  font-family: var(--font-body); font-size: .72rem; font-weight: 700; letter-spacing: .01em;
}
.no-results { padding: 30px 0; color: var(--ink-2); }
.recent { padding: 6px 0 4px; }
.recent h2 { font-size: 1rem; font-family: var(--font-body); color: var(--ink-3); font-weight: 700; letter-spacing: 0; margin-bottom: 8px; }
.recent-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.recent-row::-webkit-scrollbar { display: none; }
.recent-row a {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 14px 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.recent-row a .icon { color: var(--accent); }
.recent-row a:hover { border-color: var(--accent); }

.promises { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; padding: 44px 0 56px; border-top: 1px solid var(--line); }
.promises h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin-bottom: 6px; }
.promises h3 .icon { color: var(--accent); }
.promises p { color: var(--ink-2); margin: 0; font-size: .98rem; }

/* ---------- Page: tool ---------- */
.crumbs { padding: 18px 0 0; font-size: .92rem; color: var(--ink-3); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--leaf); text-decoration: underline; }
.page-head { padding: 14px 0 24px; max-width: 760px; }
.page-head h1 { margin-bottom: 10px; display: flex; align-items: center; gap: 14px; }
.page-head h1 .tile {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center; background: var(--pear-soft); color: var(--leaf);
}
.page-head h1 .tile .icon { width: 28px; height: 28px; }
.page-head .lede { color: var(--ink-2); font-size: 1.12rem; margin: 0; }
.private-note { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--ink-3); font-size: .9rem; }
.private-note .icon { color: var(--accent); }
@media (max-width: 600px) {
  .page-head h1 .tile { width: 42px; height: 42px; border-radius: 12px; }
  .page-head h1 .tile .icon { width: 22px; height: 22px; }
}

.tool-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 40px; }
.tool-shell.single { grid-template-columns: minmax(0, 1fr); }
.tool-shell.wide-left { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
@media (max-width: 900px) { .tool-shell, .tool-shell.wide-left { grid-template-columns: minmax(0, 1fr); } }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: clamp(18px, 3vw, 26px);
}
.panel + .panel { margin-top: 0; }
.panel h2 { font-size: 1.15rem; margin-bottom: 14px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title h2 { margin: 0; }
.sticky-out { position: sticky; top: calc(var(--header-h) + 16px); }
@media (max-width: 900px) { .sticky-out { position: static; } }
.stack { display: grid; gap: 22px; }

.result-box {
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  border-radius: 14px; padding: 18px; min-height: 64px;
}
.empty-state { color: var(--ink-3); text-align: center; padding: 30px 12px; display: grid; justify-items: center; gap: 10px; }
.empty-state .icon { width: 40px; height: 40px; color: var(--line-strong); }
.big-out {
  font-family: var(--font-mono); font-size: clamp(1.1rem, 1rem + .8vw, 1.5rem);
  word-break: break-all; line-height: 1.4; color: var(--ink);
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: .88rem; }
.kv { display: grid; gap: 8px; }
.kv-row {
  display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.kv-row .k { color: var(--ink-3); font-weight: 700; font-size: .9rem; }
.kv-row .v { font-family: var(--font-mono); font-size: .95rem; word-break: break-all; }
.msg { padding: 12px 14px; border-radius: 12px; font-size: .95rem; margin: 10px 0; }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-ok { background: var(--pear-soft); color: var(--leaf); }
.msg-info { background: var(--surface-2); color: var(--ink-2); }

/* QR output */
.qr-out { display: grid; justify-items: center; gap: 16px; text-align: center; }
.qr-canvas-wrap {
  background: #fff; padding: 14px; border-radius: 16px; border: 1px solid var(--line);
  width: min(300px, 100%); aspect-ratio: 1; display: grid; place-items: center;
}
.qr-canvas-wrap canvas { width: 100%; height: auto; image-rendering: pixelated; display: block; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.qr-tip { color: var(--ink-3); font-size: .88rem; margin: 0; }
.qr-meta { color: var(--ink-3); font-size: .82rem; margin: 0; }
details.more { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--leaf); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); font-weight: 700; }
details.more[open] summary::before { content: "−"; }
details.more > div { padding-top: 12px; }

/* ---------- Content (how-to / FAQ / related) ---------- */
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 48px; padding: 28px 0 56px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .content-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }
.prose { max-width: 68ch; }
.prose h2 { margin-top: 1.4em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 14px 32px 14px 0; position: relative;
  font-weight: 700; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-size: 1.3rem; color: var(--accent); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; color: var(--ink-2); }
.related h2 { font-size: 1.15rem; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.related a { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 0 -10px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.related a:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.related a .icon { color: var(--accent); }
.support-card {
  margin-top: 26px; padding: 18px; border-radius: var(--r-panel);
  background: color-mix(in srgb, var(--ripe) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ripe) 60%, var(--line));
}
.support-card p { color: var(--ink-2); font-size: .95rem; margin-bottom: 12px; }
.support-card strong { color: var(--ink); }

/* ---------- Simple pages (about, coffee, privacy) ---------- */
.page { padding: 20px 0 64px; }
.page .prose { font-size: 1.08rem; }
.page .prose p { color: var(--ink-2); }
.about-hero { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; padding: 30px 0 10px; }
.about-hero img { width: 150px; height: 150px; }
@media (max-width: 700px) { .about-hero { grid-template-columns: 1fr; } .about-hero img { width: 96px; height: 96px; order: -1; } }
.value-list { list-style: none; padding: 0; display: grid; gap: 18px; margin: 24px 0; }
.value-list li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; }
.value-list .tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--pear-soft); color: var(--leaf); }
.value-list b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 1.1rem; }
.coffee-hero {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: center;
  padding: 26px 0;
}
@media (max-width: 800px) { .coffee-hero { grid-template-columns: 1fr; } }
.coffee-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px;
  display: grid; gap: 14px; justify-items: start;
}
.coffee-cup { width: 88px; height: 88px; border-radius: 22px; display: grid; place-items: center; background: var(--ripe); color: var(--ripe-ink); }
.coffee-cup .icon { width: 46px; height: 46px; }
.coffee-card .btn { background: var(--ripe); color: var(--ripe-ink); font-size: 1.08rem; min-height: 54px; padding: 0 26px; }
.coffee-card .btn:hover { filter: brightness(1.05); }
.not-found { text-align: center; padding: 70px 0; }
.not-found img { width: 120px; margin-bottom: 10px; }
.not-found .finder { margin: 26px auto 0; text-align: left; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 44px 0 28px; margin-top: auto; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.site-footer h2 { font-family: var(--font-body); font-size: .92rem; color: var(--ink-3); font-weight: 700; letter-spacing: 0; margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--leaf); text-decoration: underline; }
.site-footer .about-blurb { color: var(--ink-2); max-width: 36ch; margin: 12px 0 16px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .88rem; }
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); }
.theme-switch button { width: 34px; height: 30px; display: grid; place-items: center; border: 0; border-radius: var(--r-pill); background: none; color: var(--ink-3); cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.theme-switch .icon { width: 16px; height: 16px; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: .96rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease-out;
}
.toast .icon { color: var(--pear); }
.toast.error .icon { color: #ff9a8f; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tool-specific ---------- */
/* Time zones */
.tz-now { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; }
.tz-now .time { font-family: var(--font-display); font-weight: 700; font-size: clamp(3rem, 2rem + 5vw, 5.4rem); line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.tz-now .time small { font-size: .35em; letter-spacing: 0; margin-left: 6px; color: var(--ink-2); font-weight: 600; }
.tz-now .where { color: var(--ink-2); margin-top: 8px; }
.tz-now .where b { color: var(--ink); }
.tz-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tz-search { position: relative; }
.tz-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto;
}
.tz-suggest li button {
  width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; font: inherit; color: var(--ink);
}
.tz-suggest li button small { color: var(--ink-3); font-size: .85rem; }
.tz-suggest li button .t { font-family: var(--font-mono); font-size: .9rem; color: var(--ink-2); white-space: nowrap; }
.tz-suggest li.active button, .tz-suggest li button:hover { background: var(--pear-soft); }
.tz-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tz-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 16px 14px; display: grid; gap: 4px;
}
.tz-card.is-local { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tz-card .city { font-family: var(--font-display); font-weight: 650; font-size: 1.1rem; padding-right: 64px; line-height: 1.2; }
.tz-card .zone { color: var(--ink-3); font-size: .84rem; }
.tz-card .clock { font-family: var(--font-display); font-weight: 700; font-size: 2.3rem; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 6px; }
.tz-card .clock small { font-size: .45em; margin-left: 4px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.tz-card .date { color: var(--ink-2); font-size: .95rem; }
.tz-card .diff { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: .8rem; font-weight: 700; }
.pill.day { background: color-mix(in srgb, var(--ripe) 30%, var(--surface)); color: var(--ink); }
.pill.night { background: color-mix(in srgb, #4a5bd1 22%, var(--surface)); color: var(--ink); }
.pill .icon { width: 13px; height: 13px; }
.tz-card .card-actions { position: absolute; top: 8px; right: 8px; display: flex; }
.tz-card .card-actions button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--ink-3); cursor: pointer; }
.tz-card .card-actions button:hover { background: var(--surface-2); color: var(--ink); }
.tz-card .card-actions .icon { width: 16px; height: 16px; }
.tz-bar { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; margin-top: 10px; height: 8px; border-radius: 4px; overflow: hidden; }
.tz-bar i { background: color-mix(in srgb, #4a5bd1 30%, var(--surface-2)); }
.tz-bar i.w { background: color-mix(in srgb, var(--pear) 70%, var(--surface)); }
.tz-bar i.d { background: color-mix(in srgb, var(--ripe) 55%, var(--surface)); }
.tz-bar i.cur { outline: 2px solid var(--ink); outline-offset: -1px; z-index: 1; }
.tz-planner { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
@media (max-width: 640px) { .tz-planner { grid-template-columns: 1fr; } }
.tz-planner .slider-row { display: grid; gap: 4px; }
.tz-planner .slider-labels { display: flex; justify-content: space-between; color: var(--ink-3); font-size: .8rem; }
.shift-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--ripe); color: var(--ripe-ink); padding: 10px 14px; border-radius: 12px; font-weight: 600; margin-bottom: 14px; }
.shift-banner .btn { background: var(--ripe-ink); color: var(--ripe); min-height: 34px; }

/* Color picker */
.swatch-big { height: 160px; border-radius: 16px; border: 1px solid var(--line); display: flex; align-items: flex-end; padding: 14px; font-family: var(--font-mono); font-weight: 600; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.swatches button { aspect-ratio: 1; border-radius: 10px; border: 1px solid rgba(0,0,0,.1); cursor: pointer; padding: 0; }
.swatches button:hover { transform: scale(1.06); }
.shade-strip { display: grid; grid-template-columns: repeat(10, 1fr); border-radius: 12px; overflow: hidden; }
.shade-strip button { height: 52px; border: 0; cursor: pointer; padding: 0; font-family: var(--font-mono); font-size: .62rem; color: transparent; }
.shade-strip button:hover, .shade-strip button:focus-visible { color: inherit; }
.contrast-demo { border-radius: 12px; padding: 16px; font-weight: 700; font-size: 1.2rem; border: 1px solid var(--line); }
.grade { display: inline-block; min-width: 46px; text-align: center; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: .82rem; }
.grade.pass { background: var(--pear-soft); color: var(--leaf); }
.grade.fail { background: var(--danger-soft); color: var(--danger); }

/* Password */
.strength { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 12px 0 6px; }
.strength i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .25s, background-color .25s; }
.pw-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.pw-list li { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; background: var(--surface-2); border-radius: 10px; }
.pw-list code { flex: 1; word-break: break-all; font-size: .95rem; }

/* Image compressor */
.dropzone {
  display: grid; place-items: center; gap: 10px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: 18px; padding: 40px 18px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--pear-soft); }
.dropzone .icon { width: 44px; height: 44px; color: var(--accent); }
.dropzone strong { font-size: 1.1rem; }
.dropzone span { color: var(--ink-3); font-size: .92rem; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.img-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: grid; }
.img-card .thumb { aspect-ratio: 4/3; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 18px 18px; display: grid; place-items: center; }
.img-card .thumb img { max-height: 100%; max-width: 100%; object-fit: contain; }
.img-card .body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.img-card .name { font-weight: 700; font-size: .92rem; word-break: break-all; }
.img-card .sizes { font-size: .88rem; color: var(--ink-2); }
.saving { font-weight: 700; color: var(--leaf); }
.saving.worse { color: var(--danger); }

/* Stopwatch */
.watch { font-family: var(--font-display); font-weight: 700; font-size: clamp(3.2rem, 2rem + 7vw, 6.5rem); letter-spacing: -.04em; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; padding: 20px 0; }
.watch small { font-size: .45em; color: var(--ink-2); }
.laps { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; }
.laps li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.laps li span:first-child { color: var(--ink-3); }

/* Hash / JSON / misc */
.hash-row { display: grid; gap: 6px; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.hash-row header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.hash-row code { word-break: break-all; font-size: .88rem; color: var(--ink-2); }
.code-out { font-family: var(--font-mono); font-size: .9rem; white-space: pre; overflow: auto; max-height: 520px; background: var(--surface-2); padding: 14px; border-radius: 12px; border: 1px solid var(--line); tab-size: 2; }
.code-out.wrap { white-space: pre-wrap; word-break: break-word; }
.j-key { color: #7b3fa0; } .j-str { color: #2c7a15; } .j-num { color: #b25a00; } .j-bool { color: #1a5fb4; } .j-null { color: #8a8a8a; }
:root[data-theme="dark"] .j-key { color: #d4a5f5; } :root[data-theme="dark"] .j-str { color: #a8dc6a; } :root[data-theme="dark"] .j-num { color: #ffb86b; } :root[data-theme="dark"] .j-bool { color: #8ab4ff; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.toolbar .spacer { flex: 1; }
.count-line { color: var(--ink-3); font-size: .88rem; }

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .content-grid, .crumbs, .btn, .qr-actions { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; }
}
.field-row.three { grid-template-columns: 1.2fr 1fr 1fr; }
@media (max-width: 640px) { .field-row.three { grid-template-columns: 1fr 1fr; } .field-row.three > :first-child { grid-column: 1 / -1; } }
.slider-labels { display: flex; justify-content: space-between; color: var(--ink-3); font-size: .8rem; }
.btn-reset { font: inherit; color: inherit; border: 1px dashed var(--line-strong); }
.btn-reset:hover { border-color: var(--accent); }
.btn-reset small { display: block; font-family: var(--font-body); font-size: .85rem; color: var(--ink-3); margin-top: 4px; font-weight: 400; word-break: normal; }

/* coffee buttons keep their colors wherever they appear */
.site-footer a.coffee-btn, .related a.coffee-btn, .drawer a.coffee-btn, a.coffee-btn:hover {
  color: var(--ripe-ink); text-decoration: none;
}
.related a.coffee-btn { display: inline-flex; margin: 0; padding: 8px 14px; font-weight: 700; }
.related a.coffee-btn:hover { box-shadow: none; background: var(--ripe); filter: brightness(1.05); }
.related a.coffee-btn .icon { color: inherit; }
.count-line .icon { color: var(--accent); }
