/* ToolDrop shared styles — one source of truth for every tool.
   Hosted at https://tooldrop.dev/assets/tooldrop.css and loaded cross-origin by each subdomain. */
:root {
  --bg: #f5f5f7; --fg: #1d1d1f; --muted: #636366; --border: #d2d2d7;
  --card: #ffffff; --accent: #0066cc; --accent-fg: #fff;
  --err: #b32d2e; --ok: #1a7f37; --code-bg: #f5f5f7; --ad: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --fg: #f5f5f7; --muted: #a1a1a6; --border: #424245;
    --card: #1d1d1f; --accent: #2997ff; --accent-fg: #000000;
    --err: #f28b82; --ok: #7ee787; --code-bg: #161617; --ad: #1d1d1f;
  }
}
* { box-sizing: border-box; }
/* Root font-size drives the accessibility text-size control (rem-based UI scales). */
html { font-size: 100%; }
:root[data-font="large"] { font-size: 112.5%; }
:root[data-font="xl"] { font-size: 125%; }
body {
  margin: 0; padding: 1.5rem; background: var(--bg); color: var(--fg);
  font: 0.9375rem/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 820px; margin: 0 auto; }

/* Top nav (injected) */
#td-topnav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center;
  margin-bottom: 1.4rem; font-size: .85rem; }
#td-topnav .brand { font-weight: 700; color: var(--fg); text-decoration: none; margin-right: .3rem; }
#td-topnav a { color: var(--muted); text-decoration: none; }
#td-topnav a:hover { color: var(--accent); }
#td-topnav a.active { color: var(--accent); font-weight: 600; }
.td-example { margin-top: .5rem; }
.td-inmeta { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: .5rem; }
.td-count { font-size: .75rem; color: var(--muted); }
.td-clear { font-size: .75rem; padding: .25rem .6rem; }

/* Category dropdown menus — scales as tools are added. */
.td-menu { display: flex; flex-wrap: wrap; gap: .1rem .4rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.td-menu-item { position: relative; }
.td-menu-btn { background: none; border: 1px solid transparent; color: var(--muted); font: inherit; font-size: .85rem;
  cursor: pointer; padding: .3rem .55rem; border-radius: 6px; }
.td-menu-btn::after { content: " ▾"; opacity: .6; }
.td-menu-btn:hover, .td-menu-btn.active { color: var(--accent); }
.td-menu-btn[aria-expanded="true"] { color: var(--fg); border-color: var(--border); background: var(--card); }
.td-menu-panel { display: none; position: absolute; top: 100%; left: 0; z-index: 1000; min-width: 210px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: .35rem; margin-top: .35rem; }
/* Invisible bridge over the visual gap so the hover path button→panel never breaks. */
.td-menu-panel::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: .45rem; }
.td-menu-item.open > .td-menu-panel { display: block; }
@media (hover: hover) { .td-menu-item:hover > .td-menu-panel { display: block; } }
.td-menu-panel a { display: block; padding: .45rem .6rem; border-radius: 6px; color: var(--fg);
  text-decoration: none; font-size: .85rem; white-space: nowrap; }
.td-menu-panel a:hover { background: var(--code-bg); color: var(--accent); }
.td-menu-panel a.active { color: var(--accent); font-weight: 600; }
@media (max-width: 640px) {
  #td-topnav { position: relative; }
  .td-menu-item { position: static; }
  .td-menu-panel { left: .5rem; right: .5rem; top: calc(100% + .35rem); min-width: 0; }
}

header h1 { font-size: 1.45rem; margin: 0 0 .3rem; line-height: 1.25; }
p.sub { margin: 0 0 1.25rem; color: var(--muted); font-size: .92rem; }

/* Trust chips (landing hero) — the value prop, stated up front. */
.td-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.6rem; padding: 0; list-style: none; }
.td-chips li { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; line-height: 1.5; color: var(--fg);
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: .32rem .8rem; }
.td-chips .ic { font-size: .95em; line-height: 1; flex: 0 0 auto; }
.td-chips b { font-weight: 600; }
/* Per-tool trust line — reinforces "nothing uploaded" on the exact page people land on. */
.td-trust { display: inline-flex; align-items: center; gap: .4rem; margin: 0 0 1.1rem;
  font-size: .78rem; color: var(--muted); }
.td-trust::before { content: "🔒"; font-size: .85rem; }

/* Text field paired with a native color-picker swatch. */
.td-colorrow { display: flex; gap: .5rem; align-items: stretch; }
.td-colorrow input[type="text"] { flex: 1 1 auto; }
/* Match the text input's box height exactly: line-box (.82rem × 1.5) + padding (.7rem × 2)
   + border (2 × 1px). rem-based so it tracks the text-size accessibility control. */
.td-cpick { flex: 0 0 auto; height: calc(0.82rem * 1.5 + 1.4rem + 2px); aspect-ratio: 1 / 1; width: auto;
  padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--code-bg); cursor: pointer; }
.td-cpick::-webkit-color-swatch-wrapper { padding: 3px; }
.td-cpick::-webkit-color-swatch { border: none; border-radius: 5px; }
.td-cpick::-moz-color-swatch { border: none; border-radius: 5px; }
/* Pass/fail badges (contrast checker). */
.td-pass { color: var(--ok); font-weight: 700; }
.td-fail { color: var(--err); font-weight: 700; }

/* Serialized tree editor. */
.td-tree { font: 0.82rem/1.9 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.td-tree .tchildren { padding-left: 1rem; border-left: 1px solid var(--border); margin-left: .35rem; }
.td-tree .tr { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .25rem 0; }
.td-tree .tchildren { padding-top: .1rem; padding-bottom: .1rem; }
.td-tree .tk { color: var(--accent); }
.td-tree .tidx { color: var(--muted); }
.td-tree .tb { font-size: .7rem; color: var(--muted); background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 .35rem; }
.td-tree .ti { padding: .12rem .4rem; border: 1px solid var(--border); border-radius: 5px; background-color: var(--card); color: var(--fg); font: inherit; min-width: 6rem; }
.td-tree .ti.num { max-width: 9rem; min-width: 0; }
.td-tree select.ti { padding-right: 1.6rem; min-width: 0; }
.td-tree .tdel { border: none; background: none; color: var(--err); cursor: pointer; font-size: .85rem; line-height: 1; padding: 0 .15rem; }
.td-tree .tdel:hover { transform: scale(1.15); }
.td-tree .tnull { color: var(--muted); }

/* Two-column input layout (stacks on narrow screens). */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

/* Drop-a-file-onto-the-textarea affordance. */
.td-dragover { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* JSON syntax-highlight tokens. */
.jk { color: var(--accent); }
.js { color: var(--ok); }
.jl { color: var(--err); }
.jn { color: #8250df; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .jn { color: #b392f0; } }
:root[data-theme="dark"] .jn { color: #b392f0; }

/* Smart-paste box on the landing. */
.td-smart { margin: 0 0 1.4rem; }
.td-smart textarea { width: 100%; min-height: 3.2rem; }
.td-smart-res { margin-top: .6rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.td-smart-res .btn { padding: .4rem .9rem; }
.td-smart-res .muted { color: var(--muted); }

/* Popular tools row + category icons. */
.pop-row { margin: 0 0 1.8rem; }
.pop-row .group-heading { margin-top: 0; }
.group-heading .cat-ico { margin-right: .4rem; }

/* Consistent <select> across browsers (Safari ignores most styling on native selects). */
select {
  -webkit-appearance: none; appearance: none;
  padding: .45rem 1.9rem .45rem .6rem;
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--fg); font: inherit; cursor: pointer;
  background-color: var(--code-bg);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right .6rem center;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Cron visual builder. */
.cron-ctl { padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--code-bg); color: var(--fg); font: inherit; }
.cron-fields { margin-top: .6rem; display: grid; gap: .1rem; }
.cron-fields .crow { display: grid; grid-template-columns: 9.5rem 7.5rem 6rem; gap: .5rem; align-items: center; padding: .35rem 0; border-top: 1px solid var(--border); }
.cron-fields .crow:first-child { border-top: 0; }
.cron-fields .crow > .clabel { color: var(--fg); font-size: .9rem; }
.cron-fields .cval { width: 100%; }
@media (max-width: 480px) { .cron-fields .crow { grid-template-columns: 1fr 1fr; } .cron-fields .crow > .clabel { grid-column: 1 / -1; } }

/* JSON structural diff. */
.td-jdiff { font: 0.82rem/1.7 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.td-jdiff .jrow { display: flex; gap: .5rem; padding: .12rem 0; align-items: baseline; flex-wrap: wrap; }
.td-jdiff .jsym { flex: 0 0 1rem; font-weight: 700; }
.td-jdiff .jpath { color: var(--accent); }
.td-jdiff .add .jsym, .td-jdiff .jnew { color: var(--ok); }
.td-jdiff .rem .jsym, .td-jdiff .jold { color: var(--err); }
.td-jdiff .jarrow { color: var(--muted); }
.td-jdiff .jnone { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
label { display: block; font-weight: 600; font-size: .82rem; text-transform: none;
  letter-spacing: 0; color: var(--muted); margin-bottom: .5rem; }

.modes { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.modes button { flex: 0 0 auto; padding: .4rem .8rem; border: 1px solid var(--border);
  background: transparent; color: var(--fg); border-radius: 6px; cursor: pointer; font-size: .85rem; }
.modes button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.modes .sep { flex: 0 0 1px; align-self: stretch; background: var(--border); margin: .1rem .3rem; }
.modes .td-check { display: flex; align-items: center; gap: .4rem; margin: 0; text-transform: none;
  letter-spacing: 0; font-size: .82rem; color: var(--fg); cursor: pointer; }

textarea, input[type=text] { width: 100%; padding: .7rem .8rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--code-bg); color: var(--fg);
  font: 0.82rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
textarea { min-height: 140px; resize: vertical; }
.field { margin-bottom: .8rem; }
/* A field directly before a hint drops its bottom margin so the hint sits the same
   distance below as on single-input tools (avoids a double gap). */
.field:has(+ .hint) { margin-bottom: 0; }
/* .field label now inherits the unified label style (normal case, .82rem). */
.hint { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }

.btn { padding: .5rem 1rem; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-fg); border-radius: 8px; cursor: pointer; font-size: .9rem; font-weight: 600; text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }

pre { margin: 0; padding: .8rem; background: var(--code-bg); border-radius: 8px;
  border: 1px solid var(--border); overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  font: 0.82rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; min-height: 2.5rem; }
pre.error { color: var(--err); }
pre.ok-note { color: var(--ok); border-color: var(--ok); }
.row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.copy { padding: .35rem .7rem; border: 1px solid var(--border); background: transparent;
  color: var(--fg); border-radius: 6px; cursor: pointer; font-size: .8rem; text-decoration: none; }
.copy:hover { border-color: var(--accent); }
.meta { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }

/* SEO content */
.content { margin-top: 2rem; content-visibility: auto; contain-intrinsic-size: auto 600px; }
.content h2 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
.content h3 { font-size: .98rem; margin: 1.1rem 0 .3rem; }
.content p { margin: .4rem 0; }
.content code { background: var(--code-bg); padding: .1rem .35rem; border-radius: 4px;
  font: 12.5px ui-monospace, Menlo, monospace; }
/* Links inside prose are underlined so they're distinguishable without colour (WCAG). */
.content a, .content a:visited { color: var(--accent); text-decoration: underline; }
.content a:hover { text-decoration: none; }
.td-related { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .3rem; }
.td-related a { display: inline-block; padding: .35rem .7rem; border: 1px solid var(--border);
  border-radius: 999px; font-size: .85rem; color: var(--accent) !important; text-decoration: none !important; }
.td-related a:hover { border-color: var(--accent); }

/* Footer (injected) */
#td-footer { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--muted); }
#td-footer a { color: var(--accent); text-decoration: none; }
#td-footer a:hover { text-decoration: underline; }
#td-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1.5rem; }
#td-footer .cols strong { display: block; color: var(--fg); margin-bottom: .3rem; font-size: .8rem; }
#td-footer ul { list-style: none; margin: 0; padding: 0; }
#td-footer li { margin: .15rem 0; }
/* Footer column links: enlarge to the 24px minimum tap-target (WCAG 2.2). */
#td-footer .cols a { display: inline-block; padding: .35rem 0; line-height: 1.25; }
#td-footer .fine { margin-top: 1rem; }
/* The inline link in the footer sentence sits in a text block — underline it. */
#td-footer .fine a { text-decoration: underline; }

/* Ad slot — hidden until an ad unit is configured; the .td-ad class (added by JS when
   ads are live) reserves the box so the live ad doesn't shift content. */
.td-ad { margin: 2rem 0 0; padding: .5rem; background: var(--ad);
  border: 1px dashed var(--border); border-radius: 8px; text-align: center;
  min-height: 110px; display: flex; flex-direction: column; justify-content: center; }
.td-ad .ad-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: .35rem; }
.td-ad .ph { font-size: .78rem; color: var(--muted); }

/* Diff */
.td-diff span { display: block; }
.td-diff-add { color: var(--ok); }
.td-diff-del { color: var(--err); }
.td-diff-ctx { color: var(--muted); }

/* Regex tester */
.td-regex-hl { border: 1px solid var(--border); border-radius: 8px; background: var(--code-bg);
  padding: .7rem .8rem; white-space: pre-wrap; word-break: break-word; min-height: 2.5rem; margin-bottom: .6rem;
  font: 0.82rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.td-regex-hl mark { background: var(--accent); color: var(--accent-fg); border-radius: 3px; padding: 0 1px; }
.td-regex-empty { color: var(--muted); }

/* Color swatch */
.td-swatch { height: 54px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .6rem; }

/* Contrast preview */
.td-contrast-prev { padding: 1.1rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .7rem;
  font-size: 1.15rem; font-weight: 600; text-align: center; }

/* chmod grid */
.td-chmod { border-collapse: collapse; font-size: .9rem; }
.td-chmod th, .td-chmod td { padding: .35rem .8rem; text-align: center; }
.td-chmod thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.td-chmod tbody th { text-align: left; color: var(--fg); font-weight: 600; }

/* QR code */
.td-qr { display: flex; justify-content: center; padding: .6rem; }
.td-qr svg { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }

/* Command palette (⌘K / Ctrl+K) */
.td-cmd { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 1rem 1rem; }
.td-cmd-box { width: min(520px, 100%); background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.4); padding: .5rem; }
.td-cmd-input { width: 100%; border: 1px solid var(--border); border-radius: 8px;
  background: var(--code-bg); color: var(--fg); font-size: 1rem; padding: .75rem .85rem; outline: none; }
.td-cmd-input:focus, .td-cmd-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px;
  border-color: var(--accent); box-shadow: none; }
.td-cmd-list { list-style: none; margin: .4rem 0 0; padding: 0; max-height: 50vh; overflow: auto; }
.td-cmd-list li { padding: .5rem .7rem; border-radius: 8px; cursor: pointer; }
.td-cmd-name { display: block; font-size: .9rem; }
.td-cmd-desc { display: block; font-size: .75rem; color: var(--muted); margin-top: .1rem; }
.td-cmd-list li.on { background: var(--accent); color: var(--accent-fg); }
.td-cmd-list li.on .td-cmd-desc { color: var(--accent-fg); opacity: .85; }
.td-cmd-empty { color: var(--muted); cursor: default; padding: .5rem .7rem; font-size: .9rem; }
.td-cmd-group { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); padding: .7rem .7rem .25rem; margin-top: .3rem; border-top: 1px solid var(--border); cursor: default; }
.td-cmd-group:first-child { border-top: none; margin-top: 0; padding-top: .25rem; }

/* Email viewer (eml / msg) */
.drop { border: 2px dashed var(--border); border-radius: 10px; padding: 1.4rem; text-align: center;
  color: var(--muted); cursor: pointer; transition: border-color .15s; }
.drop.over { border-color: var(--accent); color: var(--fg); }
.hdr-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.hdr-table th { text-align: left; vertical-align: top; color: var(--muted); font-weight: 600;
  width: 6.5rem; padding: .2rem .6rem .2rem 0; white-space: nowrap; }
.hdr-table td { padding: .2rem 0; word-break: break-word; }
.bodyframe { width: 100%; height: 60vh; min-height: 340px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; }
/* Resizable wrapper (resize works on the div, not the replaced iframe). */
.td-frame { width: 100%; height: 60vh; min-height: 200px; resize: vertical; overflow: hidden;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.td-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.att { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.att:first-child { border-top: none; }
.att .name { font-weight: 600; }
.att .size { color: var(--muted); font-size: .8rem; }
.att a { margin-left: auto; }
.viewtabs button { font-size: .8rem; }

/* Landing hub */
[hidden] { display: none !important; }
.tools-search { margin: 2.2rem 0 1.8rem; position: relative; }
.tools-search input { width: 100%; padding: .7rem 3.6rem .7rem .9rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--card); color: var(--fg); font-size: .95rem; }
.td-kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  font: 500 .78rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; letter-spacing: .03em;
  color: var(--muted); background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: .2rem .45rem; }
.tool-group { margin: 0; }
.group-heading { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 1.6rem 0 .2rem; }
.group-heading:first-child { margin-top: .5rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .9rem; margin: .6rem 0 1.2rem; }
.tool-card { display: block; text-decoration: none; color: inherit; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem; }
.tool-card:hover { border-color: var(--accent); }
.tool-card h3 { margin: 0 0 .3rem; font-size: 1rem; color: var(--accent); }
.tool-card p { margin: 0; font-size: .85rem; color: var(--muted); }

/* ===================== Accessibility ===================== */

/* Manual theme override (wins over the prefers-color-scheme media query above). */
:root[data-theme="light"] {
  --bg: #f5f5f7; --fg: #1d1d1f; --muted: #636366; --border: #d2d2d7;
  --card: #ffffff; --accent: #0066cc; --accent-fg: #fff;
  --err: #b32d2e; --ok: #1a7f37; --code-bg: #f5f5f7; --ad: #ffffff;
}
:root[data-theme="dark"] {
  --bg: #000000; --fg: #f5f5f7; --muted: #a1a1a6; --border: #424245;
  --card: #1d1d1f; --accent: #2997ff; --accent-fg: #000000;
  --err: #f28b82; --ok: #7ee787; --code-bg: #161617; --ad: #1d1d1f;
}

/* High-contrast mode (WCAG AAA-leaning). Light variant by default; dark variant when dark. */
:root[data-contrast="high"] {
  --bg: #ffffff; --fg: #000000; --muted: #1a1a1a; --border: #000000;
  --card: #ffffff; --accent: #0b4a86; --accent-fg: #ffffff;
  --err: #8a0000; --ok: #0a5a24; --code-bg: #eeeeee; --ad: #ffffff;
}
:root[data-theme="dark"][data-contrast="high"] {
  --bg: #000000; --fg: #ffffff; --muted: #f2f2f2; --border: #ffffff;
  --card: #000000; --accent: #7ec3ff; --accent-fg: #000000;
  --err: #ff9b9b; --ok: #8bf3a0; --code-bg: #111111; --ad: #000000;
}
@media (prefers-color-scheme: dark) {
  :root[data-contrast="high"]:not([data-theme="light"]) {
    --bg: #000000; --fg: #ffffff; --muted: #f2f2f2; --border: #ffffff;
    --card: #000000; --accent: #7ec3ff; --accent-fg: #000000;
    --err: #ff9b9b; --ok: #8bf3a0; --code-bg: #111111; --ad: #000000;
  }
}

/* Focus: solid ring for regular (mouse/programmatic) focus; dashed while tabbing
   with the keyboard (the root gets .td-kbd-nav on Tab, removed on pointer input). */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:root.td-kbd-nav :focus-visible { outline-style: dashed; }

/* Reduced motion — by OS preference or the in-page toggle. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; scroll-behavior: auto !important;
}

/* Skip-to-content link — visible only when focused. */
.td-skip { position: absolute; left: -9999px; top: 0; z-index: 1001;
  background: var(--accent); color: var(--accent-fg); padding: .5rem .85rem;
  border-radius: 0 0 6px 0; font-size: .9rem; font-weight: 600; text-decoration: none; }
.td-skip:focus { left: 0; }
#td-main:focus { outline: none; }

/* Accessibility controls — floating widget, bottom-right (baked <details>). */
.td-a11y { position: fixed; right: 1rem; bottom: 1rem; z-index: 1000; }
.td-a11y > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .4rem;
  background: var(--accent); color: var(--accent-fg); border: 1px solid var(--accent);
  padding: .5rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.22); }
.td-a11y > summary::-webkit-details-marker { display: none; }
.td-a11y-body { position: absolute; right: 0; bottom: calc(100% + .5rem);
  width: 260px; max-width: calc(100vw - 2rem);
  display: flex; flex-direction: column; gap: .75rem; padding: .9rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.td-a11y-body .grp { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.td-a11y-body .grp > span { font-size: .78rem; color: var(--muted); width: 100%; margin-bottom: .15rem; }
/* Segmented groups (theme, text size). */
.td-a11y-body .grp button { padding: .32rem .6rem; border: 1px solid var(--border); background: transparent;
  color: var(--fg); border-radius: 6px; cursor: pointer; font-size: .8rem; }
.td-a11y-body .grp button:hover { border-color: var(--accent); }
.td-a11y-body .grp button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* Toggle rows + iOS-style switches. */
.td-a11y-body .td-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.td-a11y-body .td-row .lbl { font-size: .85rem; }
.td-a11y-body .td-row .lbl small { display: block; color: var(--muted); font-size: .72rem; }
.td-switch { flex: 0 0 auto; width: 40px; height: 22px; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); background: var(--border); position: relative; cursor: pointer;
  transition: background .15s; }
.td-switch::after { content: ""; position: absolute; top: 1px; left: 1px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s; }
.td-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.td-switch[aria-checked="true"]::after { transform: translateX(18px); }
/* High-contrast: token-based so the switch is visible in dark high-contrast too. */
:root[data-contrast="high"] .td-switch { border-color: var(--fg); background: transparent; }
:root[data-contrast="high"] .td-switch::after { background: var(--fg); }
:root[data-contrast="high"] .td-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
:root[data-contrast="high"] .td-switch[aria-checked="true"]::after { background: var(--accent-fg); }
.td-a11y-reset { align-self: flex-start; margin-top: .1rem; background: none; border: none; padding: .2rem 0;
  color: var(--accent); font-size: .8rem; cursor: pointer; text-decoration: underline; }

/* Readable font — self-hosted Atkinson Hyperlegible. */
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-400.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-700.woff2") format("woff2"); }
:root[data-face="atkinson"] body { font-family: "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* Increased text spacing (WCAG 1.4.12). */
:root[data-spacing="loose"] body { line-height: 1.9; letter-spacing: .02em; word-spacing: .05em; }
:root[data-spacing="loose"] p, :root[data-spacing="loose"] li { margin-top: .7em; }

/* Underline all links (override id-scoped nav/footer rules) — but not button-styled links. */
:root[data-underline="on"] a:not(.copy):not(.btn) { text-decoration: underline !important; }

/* Always show focus (not only keyboard). */
:root[data-focus="always"] a:focus, :root[data-focus="always"] button:focus,
:root[data-focus="always"] input:focus, :root[data-focus="always"] textarea:focus,
:root[data-focus="always"] select:focus, :root[data-focus="always"] summary:focus,
:root[data-focus="always"] [tabindex]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Print — drop the interactive chrome, print the content in black on white. */
@media print {
  #td-topnav, #td-footer, #td-ad, .td-a11y, .td-cmd, .td-skip, .tools-search,
  .copy, .btn, .td-example, .td-inmeta, .td-clear, .drop, .modes, .td-related { display: none !important; }
  body { color: #000; background: #fff; padding: 0; }
  .wrap { max-width: none; }
  .card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; }
  pre, .content, .content p, .content code, textarea, input { color: #000 !important; background: #fff !important; }
  a { color: #000 !important; text-decoration: underline; }
  .content { content-visibility: visible; }
}

/* ===== UI overhaul — neutral canvas, bold type, fluid feel =====
   Big confident headlines on a quiet grey/black canvas, borderless tiles, pill
   controls, translucent chrome. Motion is transform/opacity only. */
:root { --shadow: 0, 0, 0; --ease: cubic-bezier(.2, .8, .2, 1);
  /* Liquid Glass: a clear tinted layer, a bright rim where light catches the edge, a soft drop.
     Used only for the floating layer (bar, menus, palette, popovers) — content stays solid. */
  --glass: rgba(255, 255, 255, .56); --glass-thick: rgba(255, 255, 255, .78);
  --glass-rim: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 0 1px rgba(255, 255, 255, .45), inset 0 -1px 1px rgba(0, 0, 0, .05);
  --glass-drop: 0 0 0 .5px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .05), 0 14px 38px rgba(0, 0, 0, .13);
  --glass-fx: saturate(190%) blur(18px); --glass-fx-thick: saturate(190%) blur(34px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --glass: rgba(48, 48, 52, .5); --glass-thick: rgba(38, 38, 42, .76);
  --glass-rim: inset 0 1px 0 rgba(255, 255, 255, .26), inset 0 0 0 1px rgba(255, 255, 255, .09), inset 0 -1px 1px rgba(0, 0, 0, .35);
  --glass-drop: 0 0 0 .5px rgba(0, 0, 0, .7), 0 14px 40px rgba(0, 0, 0, .6); } }
:root[data-theme="dark"] {
  --glass: rgba(48, 48, 52, .5); --glass-thick: rgba(38, 38, 42, .76);
  --glass-rim: inset 0 1px 0 rgba(255, 255, 255, .26), inset 0 0 0 1px rgba(255, 255, 255, .09), inset 0 -1px 1px rgba(0, 0, 0, .35);
  --glass-drop: 0 0 0 .5px rgba(0, 0, 0, .7), 0 14px 40px rgba(0, 0, 0, .6); }
body { font-size: 1rem; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* --- Top bar: a glass capsule floating above the page; content scrolls underneath --- */
.topbar { position: sticky; top: .75rem; z-index: 900; margin: -.75rem 0 2.5rem; }
.topbar .wrap-wide { position: relative; isolation: isolate; margin: 0 auto; border-radius: 999px; }
/* The glass lives on a pseudo-element so the menus (descendants of the bar) can carry
   their own backdrop-filter — a filtered ancestor would cut theirs off. */
.topbar .wrap-wide::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-fx); backdrop-filter: var(--glass-fx);
  box-shadow: var(--glass-rim), var(--glass-drop); }
#td-topnav { margin-bottom: 0; padding: .5rem .55rem .5rem 1.4rem; font-size: .875rem; }
#td-topnav .brand { font-size: 1.15rem; font-weight: 700; letter-spacing: -.022em; margin-right: .8rem; }
.td-menu-btn { font-size: .875rem; color: color-mix(in srgb, var(--fg) 78%, transparent); }
.td-menu-btn:hover { color: var(--fg); }
.td-menu-btn.active { color: var(--accent); }
/* Brand left, menus centred, search right. */
#td-topnav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .4rem 1rem; }
#td-topnav .brand { justify-self: start; }
.td-menu { justify-content: center; }
.td-search-btn { justify-self: end; display: inline-flex; align-items: center; gap: .45rem;
  font: inherit; font-size: .875rem; color: color-mix(in srgb, var(--fg) 78%, transparent); cursor: pointer;
  background: color-mix(in srgb, var(--fg) 7%, transparent); border: 1px solid transparent; border-radius: 999px;
  padding: .38rem .9rem .38rem .7rem; -webkit-tap-highlight-color: transparent;
  transition: transform .18s var(--ease), background-color .15s ease, color .15s ease; }
.td-search-btn:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 12%, transparent); }
.td-search-btn:active { transform: scale(.96); transition-duration: .06s; }
:root[data-contrast="high"] .td-search-btn { border-color: var(--border); background: none; color: var(--fg); }
.td-nav-toggle { display: none; }
#td-main, .content h2 { scroll-margin-top: 5.5rem; }

/* Small screens: one-row capsule; the menus become a glass sheet that drops out of it. */
@media (max-width: 760px) {
  #td-topnav { position: static; grid-template-columns: 1fr auto auto; gap: .5rem; padding-left: 1.15rem; }
  .td-nav-toggle { display: block; position: relative; width: 2.25rem; height: 2.25rem; padding: 0; cursor: pointer;
    border: 1px solid transparent; border-radius: 50%; color: var(--fg);
    background: color-mix(in srgb, var(--fg) 7%, transparent); -webkit-tap-highlight-color: transparent;
    transition: transform .18s var(--ease), background-color .15s ease; }
  .td-nav-toggle:active { transform: scale(.92); transition-duration: .06s; }
  /* Two bars that cross into a close mark — the control shows what it will do next. */
  .td-nav-toggle span { position: absolute; left: 50%; top: 50%; width: 1rem; height: 1.6px; margin: -.8px 0 0 -.5rem;
    border-radius: 2px; background: currentColor; transition: transform .3s var(--ease); }
  .td-nav-toggle span:first-child { transform: translateY(-3.5px); }
  .td-nav-toggle span:last-child { transform: translateY(3.5px); }
  .nav-open .td-nav-toggle span:first-child { transform: rotate(45deg); }
  .nav-open .td-nav-toggle span:last-child { transform: rotate(-45deg); }

  #td-topnav .td-menu { display: none; position: absolute; top: calc(100% + .6rem); left: 0; right: 0;
    max-height: calc(100dvh - 100% - 2.6rem); margin: 0; padding: .5rem 1.3rem .8rem; overflow-y: auto; overscroll-behavior: contain;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; gap: 0;
    border-radius: 28px; background: var(--glass-thick);
    -webkit-backdrop-filter: var(--glass-fx-thick); backdrop-filter: var(--glass-fx-thick);
    box-shadow: var(--glass-rim), var(--glass-drop);
    transform-origin: calc(100% - 1.6rem) 0; opacity: 0; transform: translateY(-8px) scale(.95);
    transition: opacity .18s ease, transform .3s var(--ease), display .3s allow-discrete; }
  #td-topnav.nav-open .td-menu { display: flex; opacity: 1; transform: none; }
  @starting-style { #td-topnav.nav-open .td-menu { opacity: 0; transform: translateY(-8px) scale(.95); } }
  /* Dim the page while the sheet is up: it is a focused, modal moment. */
  .topbar:has(.nav-open)::before { content: ""; position: fixed; inset: 0; z-index: -1;
    background: rgba(0, 0, 0, .3); animation: td-fade .25s ease both; }
  :root.td-nav-lock { overflow: hidden; }

  /* Categories as an accordion of large rows. */
  #td-topnav .td-menu-item { position: static; border-bottom: 1px solid color-mix(in srgb, var(--fg) 10%, transparent); }
  #td-topnav .td-menu-item:last-child { border-bottom: 0; }
  #td-topnav .td-menu-btn { display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 1rem 0; border: 0; border-radius: 0; background: none; text-align: left;
    font-size: 1.6rem; font-weight: 700; letter-spacing: -.028em; line-height: 1.15; color: var(--fg); }
  #td-topnav .td-menu-btn.active { color: var(--accent); }
  #td-topnav .td-menu-btn:active { transform: none; opacity: .6; }
  #td-topnav .td-menu-btn::after { content: ""; flex: 0 0 auto; width: .55rem; height: .55rem; margin-right: .3rem; opacity: .5;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg); transition: transform .3s var(--ease); }
  #td-topnav .td-menu-item.open > .td-menu-btn::after { transform: translateY(2px) rotate(-135deg); }
  #td-topnav .td-menu-panel { position: static; min-width: 0; margin: 0; padding: 0 0 1rem; border: 0; border-radius: 0;
    background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
    transform: none; opacity: 1; transition: none;
    grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  #td-topnav .td-menu-panel::before { content: none; }
  #td-topnav .td-menu-item:not(.open) > .td-menu-panel { display: none; }
  #td-topnav .td-menu-item.open > .td-menu-panel { display: grid; animation: td-reveal .3s var(--ease) both; }
  #td-topnav .td-menu-panel a { padding: .6rem 0; font-size: 1.02rem; white-space: normal; border-radius: 8px; }
  #td-topnav .td-menu-panel a:hover { background: none; color: var(--accent); }
}
@keyframes td-fade { from { opacity: 0; } }
@keyframes td-reveal { from { opacity: 0; transform: translateY(-6px); } }
:root[data-contrast="high"] #td-topnav .td-menu { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-contrast="high"] .td-nav-toggle { border-color: var(--border); background: none; }
@media (prefers-reduced-transparency: reduce) {
  #td-topnav .td-menu { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { #td-topnav .td-menu, .td-nav-toggle { transform: none !important; } }
:root[data-motion="reduce"] :is(#td-topnav .td-menu, .td-nav-toggle) { transform: none !important; }

/* --- Layout widths --- */
.wrap { max-width: 860px; }
.wrap-wide { max-width: 1180px; }
.wrap-wide #td-main > .content { max-width: 760px; margin-inline: auto; }

/* --- Type: big and tight up top, calm at body size --- */
header h1 { font-size: clamp(2.1rem, 5vw, 3rem); font-weight: 700; letter-spacing: -.028em; line-height: 1.08;
  margin: 0 0 .6rem; text-wrap: balance; }
p.sub { font-size: 1.2rem; line-height: 1.42; letter-spacing: -.01em; margin-bottom: 1.6rem; text-wrap: pretty; }
.td-trust { font-size: .85rem; margin-bottom: .9rem; }

/* Landing hero: centred, generous, the headline does the talking. */
.wrap-wide #td-main > header { max-width: 940px; margin: 0 auto; padding: clamp(2rem, 7vw, 5rem) 0 1rem; text-align: center; }
.kicker { font-size: 1.15rem; font-weight: 600; letter-spacing: -.012em; color: var(--accent); margin: 0 0 .7rem; }
.wrap-wide #td-main > header h1 {
  font-size: clamp(2.9rem, 8.4vw, 5.6rem); font-weight: 700; line-height: 1.03; letter-spacing: -.04em;
  color: var(--fg); margin: 0 0 1.3rem; }
mark.hl { background: none; color: inherit; }
.wrap-wide #td-main > header .sub { font-size: clamp(1.2rem, 2.3vw, 1.6rem); line-height: 1.32; letter-spacing: -.017em;
  font-weight: 500; max-width: 720px; margin: 0 auto 2rem; }
.td-chips { gap: .6rem; margin-bottom: 2.4rem; }
.wrap-wide #td-main > header .td-chips { justify-content: center; }
.td-chips li { font-size: .9rem; padding: .5rem 1.05rem; background: var(--card); }

.content { margin-top: 3.5rem; }
.content h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.024em; line-height: 1.15; margin: 2.6rem 0 .7rem; }
.content h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.014em; margin: 1.5rem 0 .35rem; }
.content p { margin: .55rem 0; }
.content code { font-size: .85em; background: color-mix(in srgb, var(--fg) 7%, transparent); }

/* --- Section headings --- */
.group-heading { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 700; text-transform: none; letter-spacing: -.03em; line-height: 1.1;
  color: var(--fg); margin: 0 0 1.3rem; display: flex; align-items: center; }
.tool-group + .tool-group, #td-recent, #toolgrid { margin-top: 4.5rem; }
.pop-row { margin-bottom: 0; }
.group-heading .cat-ico { font-size: .8em; margin-right: .75rem; }

/* --- Controls: pills, with instant feedback on the press itself --- */
.btn, .copy, .modes button, .td-menu-btn, .td-a11y > summary, .td-a11y-body .grp button, .td-related a {
  transition: transform .18s var(--ease), background-color .15s ease, border-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent; }
.btn:active, .copy:active, .modes button:active, .td-menu-btn:active, .td-a11y > summary:active,
.td-a11y-body .grp button:active, .td-related a:active { transform: scale(.96); transition-duration: .06s; }
.btn { border-radius: 999px; padding: .62rem 1.3rem; font-size: .95rem; }
.copy { border-radius: 999px; padding: .42rem .95rem; font-size: .85rem; }
.modes { gap: .5rem; margin-bottom: 1.1rem; }
.modes button { border-radius: 999px; padding: .5rem 1.1rem; font-size: .92rem; font-weight: 500; }
.td-menu-btn { border-radius: 999px; padding: .35rem .75rem; }
.td-related a { padding: .5rem 1rem; font-size: .9rem; }
.td-switch { transition: background-color .2s ease, border-color .2s ease; }
.td-switch::after { transition: transform .28s var(--ease), width .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
/* The thumb stretches toward where it is going while held. */
.td-switch:active::after { width: 22px; }
.td-switch[aria-checked="true"]:active::after { transform: translateX(14px); }

/* --- Tiles: borderless surfaces lifted off the canvas --- */
.tools-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 0; }
.card { border-radius: 22px; padding: 1.5rem; margin-bottom: 1.2rem; }
label { font-size: .88rem; }
.tool-card { position: relative; border-radius: 22px; padding: 1.5rem 1.5rem 1.6rem; min-height: 8.2rem;
  transition: transform .32s var(--ease), box-shadow .32s var(--ease);
  -webkit-tap-highlight-color: transparent; }
:root:not([data-contrast="high"]) :is(.card, .tool-card, .td-chips li) { border-color: transparent; }
.tool-card h3 { font-size: 1.3rem; font-weight: 650; letter-spacing: -.024em; line-height: 1.15;
  color: var(--fg); margin-bottom: .45rem; padding-right: 1.6rem; }
.tool-card p { font-size: .95rem; line-height: 1.4; }
/* Arrow hints where the tile leads; it travels in the direction of the action. */
.tool-card::after { content: "→"; position: absolute; top: 1.4rem; right: 1.35rem; color: var(--accent);
  font-size: 1.15rem; line-height: 1.3; opacity: 0; transform: translateX(-6px);
  transition: opacity .2s ease, transform .28s var(--ease); }
@media (hover: hover) {
  .tool-card:hover { transform: scale(1.025); border-color: transparent;
    box-shadow: 0 4px 10px rgba(var(--shadow), .05), 0 22px 48px rgba(var(--shadow), .14); }
  .tool-card:hover::after { opacity: 1; transform: none; }
}
.tool-card:focus-visible::after { opacity: 1; transform: none; }
.tool-card:active { transform: scale(.975); transition-duration: .08s; box-shadow: none; }

/* --- Fields --- */
textarea, input[type=text], .tools-search input, .td-cmd-input {
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
textarea, input[type=text] { border-radius: 14px; padding: .9rem 1rem; font-size: .88rem; }
pre { border-radius: 14px; padding: 1rem; font-size: .88rem; }
:is(textarea, input[type=text], input[type=search]):focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
/* The ring above is the focus indicator for fields; the outline returns for keyboard / a11y modes. */
:root:not(.td-kbd-nav):not([data-contrast="high"]):not([data-focus="always"])
  :is(textarea, input[type=text], input[type=search]):focus-visible { outline: none; }
/* Landing: the paste box is the centrepiece; search sits under it as a pill. */
.td-smart, .tools-search { max-width: 780px; margin-left: auto; margin-right: auto; }
.td-smart { margin-bottom: 1rem; }
.td-smart textarea { min-height: 5.5rem; padding: 1.25rem 1.4rem; border-radius: 24px; font-size: .95rem;
  background: var(--card); border-color: transparent;
  box-shadow: 0 2px 6px rgba(var(--shadow), .04), 0 18px 44px rgba(var(--shadow), .1); }
.td-smart-res { justify-content: center; margin-top: 1rem; font-size: 1rem; }
.tools-search { margin-top: 1rem; margin-bottom: 4.5rem; }
.tools-search input { border-radius: 999px; padding: .95rem 4rem .95rem 1.4rem; font-size: 1.05rem; }
.td-kbd { right: 1rem; border-radius: 8px; }
:root[data-contrast="high"] .td-smart textarea { border-color: var(--border); box-shadow: none; }

/* --- Floating surfaces: thicker material, arriving from their trigger, leaving the same way --- */
.td-menu-panel { border-radius: 22px; padding: .5rem; margin-top: .7rem; border-color: transparent;
  background: var(--glass-thick);
  -webkit-backdrop-filter: var(--glass-fx-thick); backdrop-filter: var(--glass-fx-thick);
  box-shadow: var(--glass-rim), var(--glass-drop);
  transform-origin: 1.5rem 0; opacity: 0; transform: translateY(-4px) scale(.96);
  transition: opacity .14s ease, transform .22s var(--ease), display .22s allow-discrete; }
.td-menu-item.open > .td-menu-panel { opacity: 1; transform: none; }
@media (hover: hover) { .td-menu-item:hover > .td-menu-panel { opacity: 1; transform: none; } }
@starting-style {
  .td-menu-item.open > .td-menu-panel { opacity: 0; transform: translateY(-4px) scale(.96); }
  @media (hover: hover) { .td-menu-item:hover > .td-menu-panel { opacity: 0; transform: translateY(-4px) scale(.96); } }
}
.td-menu-panel::before { height: .8rem; }
.td-menu-panel a { border-radius: 14px; padding: .5rem .75rem; font-size: .92rem;
  transition: background-color .12s ease, color .12s ease; }
.td-menu-panel a:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--fg); }

/* Command palette: a modal task — dim the page, bring the surface forward. */
.td-cmd { background: rgba(0, 0, 0, .32);
  transition: opacity .18s ease, display .18s allow-discrete; }
.td-cmd[hidden] { opacity: 0; }
.td-cmd-box { width: min(600px, 100%); border-radius: 28px; padding: .65rem;
  border-color: transparent; background: var(--glass-thick);
  -webkit-backdrop-filter: var(--glass-fx-thick); backdrop-filter: var(--glass-fx-thick);
  box-shadow: var(--glass-rim), var(--glass-drop), 0 34px 90px rgba(var(--shadow), .3);
  transition: transform .26s var(--ease); }
.td-cmd[hidden] .td-cmd-box { transform: translateY(-8px) scale(.97); }
@starting-style {
  .td-cmd:not([hidden]) { opacity: 0; }
  .td-cmd:not([hidden]) .td-cmd-box { transform: translateY(-8px) scale(.97); }
}
.td-cmd-input { border-radius: 999px; padding: .85rem 1.2rem; font-size: 1.1rem; font-family: inherit;
  background: color-mix(in srgb, var(--fg) 7%, transparent); border-color: transparent; }
.td-cmd-list li { border-radius: 16px; padding: .6rem .85rem; }
.td-cmd-name { font-size: 1rem; font-weight: 500; }
.td-cmd-desc { font-size: .82rem; }
.td-cmd-group { color: var(--muted); letter-spacing: .04em; }

/* Accessibility popover grows out of its pill. */
.td-a11y > summary { background: var(--glass); color: var(--fg); border-color: transparent; padding: .6rem 1.05rem; font-size: .88rem;
  -webkit-backdrop-filter: var(--glass-fx); backdrop-filter: var(--glass-fx);
  box-shadow: var(--glass-rim), var(--glass-drop); }
.td-a11y-body { border-radius: 26px; padding: 1.1rem; width: 280px; transform-origin: calc(100% - 2.5rem) 100%;
  border-color: transparent; background: var(--glass-thick);
  -webkit-backdrop-filter: var(--glass-fx-thick); backdrop-filter: var(--glass-fx-thick);
  box-shadow: var(--glass-rim), var(--glass-drop); }
.td-a11y-body .grp button { border-radius: 999px; padding: .38rem .8rem; }
.td-a11y[open] > .td-a11y-body { animation: td-pop .24s var(--ease) both; }
@keyframes td-pop { from { opacity: 0; transform: translateY(6px) scale(.95); } }

/* Footer */
#td-footer { margin-top: 5rem; padding-top: 2rem; padding-bottom: 3rem; font-size: .85rem; }
#td-footer .cols strong { font-size: .85rem; margin-bottom: .5rem; }
#td-footer a { color: var(--muted); }
#td-footer a:hover { color: var(--fg); }
#td-footer .fine a { color: var(--accent); }

/* --- Respect user preferences --- */
/* Reduced motion: keep the colour/opacity feedback, drop the travel. */
@media (prefers-reduced-motion: reduce) {
  .tool-card, .tool-card::after, .td-menu-panel, .td-cmd-box, .td-a11y-body,
  .btn, .copy, .modes button, .td-menu-btn, .td-search-btn, .td-a11y > summary { transform: none !important; }
}
:root[data-motion="reduce"] :is(.tool-card, .td-menu-panel, .td-cmd-box, .td-a11y-body,
  .btn, .copy, .modes button, .td-menu-btn, .td-search-btn, .td-a11y > summary) { transform: none !important; }
:root[data-motion="reduce"] .tool-card::after { transform: none !important; }
/* Reduced transparency / high contrast: glass becomes a solid surface with a defined edge. */
@media (prefers-reduced-transparency: reduce) {
  .topbar .wrap-wide::before, .td-menu-panel, .td-cmd-box, .td-a11y > summary, .td-a11y-body, #td-topnav .td-menu {
    background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
:root[data-contrast="high"] :is(.td-menu-panel, .td-cmd-box, .td-a11y > summary, .td-a11y-body) {
  background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 1px solid var(--border); }
:root[data-contrast="high"] .topbar .wrap-wide::before { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 0 0 1px var(--border); }
:root[data-contrast="high"] .td-cmd { background: rgba(0,0,0,.7); }
:root[data-contrast="high"] .tool-card { box-shadow: none; }
@media print { .topbar { display: none; } }
