/* Toolbox — design system
   Editorial, technical, warm paper. No framework. */

:root {
  --paper: #f5f2ea;
  --paper-2: #ece8dd;
  --paper-3: #e2ddcd;
  --ink: #15150f;
  --ink-2: #34342b;
  --muted: #676557;
  --line: #d6d0bf;
  --line-strong: #a9a28d;
  --accent: #f04a1d;
  --accent-ink: #15150f;
  --accent-text: #b83713;
  --ok: #177245;
  --warn: #8a5a00;
  --err: #b42318;
  --field: #fbf9f3;
  --code-bg: #121310;
  --code-ink: #ece9de;
  --code-muted: #7d7b6f;
  --shadow: 8px 8px 0 var(--accent);
  --wrap: 1200px;
  --header-h: 66px;
  --radius: 2px;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #0d0e0f;
  --paper-2: #151612;
  --paper-3: #1d1e18;
  --ink: #f2efe4;
  --ink-2: #cdc9ba;
  --muted: #938f80;
  --line: #2b2c24;
  --line-strong: #4b4a3d;
  --accent: #ff6a3d;
  --accent-ink: #15150f;
  --accent-text: #ff8a63;
  --ok: #62c894;
  --warn: #e0b05c;
  --err: #ff8f83;
  --field: #111210;
  --code-bg: #080907;
  --code-ink: #ece9de;
  --code-muted: #6f6d61;
  --shadow: 8px 8px 0 #33251c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accent-ink); }

img, svg { max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-text); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -0.025em; line-height: 1.12; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }

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

.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: var(--radius);
}
.skip:focus { top: 12px; }

.eyebrow {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 14px;
}
.pulse {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  margin-right: 6px; vertical-align: 1px;
}
.text-link { font-size: 14px; font-weight: 550; border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; }
.text-link:hover { border-color: var(--accent); }
.lede { font-size: 19px; line-height: 1.65; color: var(--ink-2); max-width: 720px; }

kbd {
  font-family: var(--mono); font-size: 10px; line-height: 1; padding: 4px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px;
  background: var(--paper); color: var(--muted);
}

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40; background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 32px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; background: var(--ink); color: var(--paper);
  border-radius: 1px; box-shadow: 3px 3px 0 var(--accent);
}
.brand-mark svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.brand-mark .brand-accent { fill: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 16px; letter-spacing: -0.02em; }
.brand-text small { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--muted); margin-top: 3px; }
.site-nav { display: flex; align-items: center; gap: 26px; margin-left: 16px; }
.site-nav a { font-size: 14px; color: var(--ink-2); }
.site-nav a:hover, .site-nav a.is-active { color: var(--ink); }
.site-nav a.is-active { font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; color: var(--muted);
}
.search-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.search-btn svg { width: 15px; height: 15px; }
.search-btn kbd { margin-left: 4px; background: var(--paper); }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; background: transparent;
  border: 1px solid transparent; border-radius: var(--radius); color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--line); background: var(--paper-2); }
.icon-btn svg { width: 18px; height: 18px; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---------- palette ---------- */

.palette {
  position: fixed; inset: 0; z-index: 90; background: rgba(12, 12, 9, .55);
  padding: 11vh 16px 16px; backdrop-filter: blur(3px);
}
.palette-box {
  width: min(640px, 100%); margin: 0 auto; background: var(--paper);
  border: 1px solid var(--ink); box-shadow: 10px 10px 0 rgba(0,0,0,.22);
}
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette-input input { flex: 1; border: 0; background: transparent; outline: 0; font-size: 17px; min-width: 0; }
.palette-input input::placeholder { color: var(--muted); }
.palette-results { max-height: min(52vh, 420px); overflow: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 2px;
  color: var(--ink); cursor: pointer;
}
.palette-item .p-glyph {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); background: var(--paper-2);
}
.palette-item .p-name { font-size: 14px; font-weight: 550; }
.palette-item .p-cat { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.palette-item[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.palette-item[aria-selected="true"] .p-glyph { border-color: var(--ink-2); background: transparent; color: var(--paper); }
.palette-item[aria-selected="true"] .p-cat { color: var(--line-strong); }
.palette-empty { padding: 28px 16px; color: var(--muted); font-size: 14px; text-align: center; }
.palette-foot {
  display: flex; gap: 18px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .04em;
}
.palette-foot span:last-child { margin-left: auto; }

/* ---------- hero ---------- */

.hero { border-bottom: 1px solid var(--line); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 64px; align-items: center; padding: 76px 0 80px; }
.hero-copy h1 { font-size: clamp(34px, 4.4vw, 62px); line-height: 1.06; letter-spacing: -0.045em; margin: 0 0 24px; }
.hero-lede { font-size: 18px; color: var(--ink-2); max-width: 560px; margin-bottom: 28px; }
.hero-search {
  display: flex; align-items: center; gap: 10px; background: var(--field);
  border: 1px solid var(--ink); padding: 6px 6px 6px 14px; max-width: 540px;
}
.hero-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 42px; font-size: 15px; }
.hero-search button {
  height: 42px; padding: 0 18px; border: 1px solid var(--ink); background: var(--accent); color: var(--accent-ink);
  font-weight: 650; font-size: 14px;
}
.hero-search button:hover { filter: brightness(.94); }
.hero-search.compact { border-color: var(--line-strong); margin: 24px 0 12px; max-width: 480px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.hero-tags a { color: var(--ink-2); border-bottom: 1px solid var(--line); }
.hero-tags a:hover { color: var(--accent-text); border-color: var(--accent); }

.hero-demo { min-width: 0; }
.demo { border: 1px solid var(--ink); background: var(--code-bg); color: var(--code-ink); box-shadow: var(--shadow); }
.demo-bar {
  display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 14px;
  border-bottom: 1px solid #2a2b24; font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: #a5a294; background: #191a16;
}
.demo-file::before { content: "◇"; margin-right: 7px; color: var(--accent); }
.demo-status { display: flex; align-items: center; gap: 2px; }
.demo-status .pulse { background: #7ed6a3; margin-right: 6px; }
.demo-code {
  margin: 0; padding: 20px 18px; min-height: 232px; font-family: var(--mono); font-size: 13px;
  line-height: 1.72; overflow: auto; white-space: pre; tab-size: 2;
}
.demo-code .p { color: #77756a; }
.demo-code .k { color: #ff9b78; }
.demo-code .s { color: #b9d98b; }
.demo-code .n { color: #9dc0ff; }
.demo-code .b { color: #ffd37a; }
.demo-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid #2a2b24; padding: 10px 14px; font-family: var(--mono); font-size: 10px; color: #8c8a7d;
}
.demo-toggle {
  background: transparent; border: 1px solid #3a3b31; color: #d8d5c8; height: 28px; padding: 0 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
}
.demo-toggle:hover { border-color: var(--accent); color: #fff; }
.demo-caption { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 18px; letter-spacing: .03em; }

/* ---------- sections ---------- */

.section { padding: 76px 0 0; }
.section-head {
  display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--ink); margin-bottom: 24px;
}
.section-head .eyebrow { margin: 0 0 6px; flex-basis: 100%; }
.section-head h2 { font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.035em; }
.section-head .text-link { margin-left: auto; margin-bottom: 5px; }

/* ---------- tool cards ---------- */

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tool-card {
  position: relative; display: flex; flex-direction: column; min-height: 196px; padding: 20px;
  background: var(--paper); color: var(--ink); transition: background .12s ease;
}
.tool-card:hover { background: var(--paper-2); color: var(--ink); }
.tool-card:hover .tool-glyph { border-color: var(--ink); background: var(--accent); color: var(--accent-ink); }
.tool-card:hover .arrow { transform: translateX(3px); }
.tool-glyph {
  width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 22px;
  border: 1px solid var(--line-strong); font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: -0.02em; transition: background .12s ease, border-color .12s ease;
}
.tool-card-no { position: absolute; top: 20px; right: 20px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.tool-card h3 { font-size: 18px; margin-bottom: 8px; letter-spacing: -0.02em; }
.tool-card p { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; }
.tool-card-foot {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--muted);
}
.arrow { transition: transform .15s ease; }

/* ---------- categories ---------- */

.cat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cat-card {
  position: relative; display: flex; flex-direction: column; padding: 22px; min-height: 210px;
  border: 1px solid var(--line); background: var(--paper);
}
.cat-card:hover { border-color: var(--ink); background: var(--paper-2); color: var(--ink); }
.cat-glyph { font-family: var(--mono); font-size: 30px; color: var(--accent-text); margin-bottom: auto; }
.cat-name { font-size: 18px; font-weight: 620; margin-top: 36px; }
.cat-count { position: absolute; top: 20px; right: 20px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.cat-desc { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 6px; }

/* ---------- why ---------- */

.why { display: grid; grid-template-columns: .9fr 2.1fr; gap: 56px; }
.why-head h2 { font-size: clamp(30px, 3.8vw, 46px); letter-spacing: -0.04em; }
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--ink); }
.why-item { padding: 20px 22px 0 0; border-right: 1px solid var(--line); }
.why-item:last-child { border-right: 0; padding-right: 0; }
.why-item + .why-item { padding-left: 22px; }
.why-no { font-family: var(--mono); font-size: 10px; color: var(--accent-text); letter-spacing: .1em; }
.why-item h3 { font-size: 17px; margin: 14px 0 8px; }
.why-item p { font-size: 13px; color: var(--muted); line-height: 1.65; margin: 0; }

/* ---------- guides ---------- */

.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.guide-card { display: flex; flex-direction: column; padding: 24px; background: var(--paper); min-height: 240px; }
.guide-card:hover { background: var(--paper-2); color: var(--ink); }
.guide-meta { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.guide-card h3 { font-size: 21px; line-height: 1.3; margin: 18px 0 10px; letter-spacing: -0.03em; }
.guide-card p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.guide-card .text-link { margin-top: auto; align-self: flex-start; }

/* ---------- faq ---------- */

.faq-section { display: grid; grid-template-columns: 300px 1fr; gap: 56px; padding-top: 86px; }
.faq-head h2 { font-size: 34px; letter-spacing: -0.035em; }
.faq { border-top: 1px solid var(--line); }
.faq:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 0; cursor: pointer; font-weight: 550; font-size: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq-mark { font-family: var(--mono); font-size: 18px; color: var(--muted); transition: transform .15s; }
.faq[open] .faq-mark { transform: rotate(45deg); color: var(--accent-text); }
.faq-body { padding: 0 0 20px; max-width: 680px; }
.faq-body p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.7; }

/* ---------- cta ---------- */

.cta { padding: 90px 0 80px; }
.cta-box {
  display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap;
  background: var(--ink); color: var(--paper); padding: 42px; border: 1px solid var(--ink);
}
.cta-box .eyebrow { color: var(--line-strong); }
.cta-box h2 { font-size: clamp(26px, 3.2vw, 40px); letter-spacing: -0.035em; }
.cta-box .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--ink); background: var(--paper-2); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; padding: 54px 0 44px; }
.footer-brand p { font-size: 13px; color: var(--muted); margin: 18px 0 0; line-height: 1.7; }
.footer-brand .footer-note { font-family: var(--mono); font-size: 10px; letter-spacing: .02em; }
.footer-grid h2 { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid li a { font-size: 13px; color: var(--ink-2); display: inline-flex; gap: 8px; }
.footer-grid li a span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.footer-bottom {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 16px 0 22px;
  border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10px; color: var(--muted);
}
.footer-bottom a { margin-left: auto; }
.footer-badge { display: inline-flex; align-items: center; gap: 2px; }
.footer-badge .pulse { background: var(--ok); }

/* ---------- page head / crumbs ---------- */

.page-head { padding: 44px 0 46px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.page-head h1 { font-size: clamp(34px, 5vw, 58px); letter-spacing: -0.045em; margin: 10px 0 16px; }
.page-head .eyebrow { margin-bottom: 0; }
.page-meta { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--muted); margin: 18px 0 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .05em; color: var(--muted); margin-bottom: 26px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-text); }
.crumbs .sep { color: var(--line-strong); }
.crumbs [aria-current] { color: var(--ink-2); }

/* ---------- filter ---------- */

.filter-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.filter-search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); background: var(--field); min-width: 260px;
}
.filter-search svg { width: 15px; height: 15px; color: var(--muted); }
.filter-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); background: transparent; font-size: 12px;
  color: var(--ink-2); border-radius: 999px;
}
.chip span { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-left: 4px; }
.chip:hover { border-color: var(--line-strong); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.is-active span { color: var(--line-strong); }
.filter-empty { padding: 40px 0; color: var(--muted); }
.tool-grid-all .tool-card[hidden] { display: none; }

/* ---------- tool page ---------- */

.tool-page { padding-top: 32px; }
.tool-head { display: flex; align-items: flex-start; gap: 30px; padding-bottom: 30px; }
.tool-head-main { max-width: 820px; }
.tool-head h1 { font-size: clamp(34px, 4.8vw, 56px); letter-spacing: -0.045em; margin: 10px 0 14px; }
.tool-head .lede { font-size: 17px; }
.tool-glyph-large {
  margin-left: auto; flex: none; width: 108px; height: 108px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 26px; font-weight: 650; border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--accent);
}
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chips li {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 8px; border: 1px solid var(--line); color: var(--muted);
}
.tool-grid-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 28px; align-items: start; }
.workbench-wrap { min-width: 0; }
.tool-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--header-h) + 16px); }
.side-box { border: 1px solid var(--line); background: var(--paper); padding: 18px; }
.side-box h2 { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.side-list { list-style: none; }
.side-list li { border-top: 1px solid var(--line); }
.side-list li:first-child { border-top: 0; }
.side-list a { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13px; }
.side-glyph { width: 24px; height: 24px; flex: none; display: grid; place-items: center; font-family: var(--mono); font-size: 8px; border: 1px solid var(--line); color: var(--muted); }
.side-list a:hover .side-glyph { border-color: var(--accent); color: var(--accent-text); }
.side-box .text-link { display: inline-block; margin-top: 12px; font-size: 12px; }
.side-box p { font-size: 12px; color: var(--muted); line-height: 1.65; }
.side-box p:last-child { margin-bottom: 0; }
.kbd-hint { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px !important; }

/* ---------- workbench ---------- */

.workbench { border: 1px solid var(--ink); background: var(--paper); }
.workbench-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 38px; padding: 0 12px; background: var(--paper-2); border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; letter-spacing: .05em; color: var(--muted);
}
.wb-title { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.wb-title .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.wb-meta { text-transform: uppercase; font-size: 9px; letter-spacing: .1em; }
.workbench-body { padding: 14px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pane { min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pane-head label { cursor: pointer; }
.pane-head .pane-meta { letter-spacing: 0; text-transform: none; font-size: 10px; }
.code, .code-out, .input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--field); color: var(--ink);
  border-radius: 1px; font-size: 13px;
}
textarea.code, textarea.textarea {
  font-family: var(--mono); line-height: 1.65; padding: 11px 12px; min-height: 340px; resize: vertical;
  tab-size: 2; outline: 0;
}
textarea.code:focus, textarea.textarea:focus, .input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240, 74, 29, .14); }
.code-out {
  font-family: var(--mono); line-height: 1.65; padding: 11px 12px; min-height: 340px; margin: 0;
  overflow: auto; white-space: pre; tab-size: 2; outline: 0;
}
.code-out:empty::before { content: "结果会显示在这里"; color: var(--muted); font-family: var(--sans); font-size: 13px; }
.code-out .k { color: var(--accent-text); }
.code-out .s { color: var(--ok); }
.code-out .n { color: #2f62c9; }
.code-out .b { color: var(--warn); }
[data-theme="dark"] .code-out .n { color: #9dc0ff; }
.code-out .p { color: var(--muted); }
.input, .select { height: 36px; padding: 0 10px; font-size: 13px; }
.textarea { font-family: var(--mono); line-height: 1.65; padding: 11px 12px; min-height: 130px; resize: vertical; }
.select { width: auto; padding-right: 26px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 13px) 15px, calc(100% - 9px) 15px; background-size: 4px 4px; background-repeat: no-repeat; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar-label { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-right: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); background: transparent;
  font-size: 13px; color: var(--ink); border-radius: 1px; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); background: var(--paper-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 620; }
.btn-primary:hover { background: var(--accent); border-color: var(--ink); filter: brightness(.95); }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { border-color: var(--line); color: var(--ink); background: transparent; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }
.link-btn { border: 0; background: transparent; padding: 0; font-size: 12px; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.notice { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--paper-2); font-size: 13px; line-height: 1.6; }
.notice.error { border-color: var(--err); color: var(--err); background: rgba(180, 35, 24, .06); }
.notice.ok { border-color: var(--ok); color: var(--ok); background: rgba(23, 114, 69, .06); }
.notice code { font-family: var(--mono); font-size: 12px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .03em; }
.meta-row strong { font-weight: 500; color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.field > span { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field-row .field { flex: 1 1 130px; }
.field-row .field.small { flex-basis: 96px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; }
.range { accent-color: var(--accent); width: 100%; }
output { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }

.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv th { text-align: left; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.kv td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv tr:last-child td { border-bottom: 0; }
.kv code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.result-item { border: 1px solid var(--line); padding: 10px 12px; background: var(--field); min-width: 0; }
.result-item .ri-label { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.result-item .ri-value { font-family: var(--mono); font-size: 12px; margin-top: 5px; word-break: break-all; }
.copy-mini { border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 9px; padding: 0; }
.copy-mini:hover { color: var(--accent-text); }
.big-output { font-family: var(--mono); font-size: clamp(20px, 3vw, 30px); letter-spacing: -0.03em; word-break: break-all; padding: 18px 12px; background: var(--field); border: 1px solid var(--line-strong); min-height: 78px; display: flex; align-items: center; }

/* ---------- tool specific ---------- */

.swatch { width: 100%; height: 120px; border: 1px solid var(--ink); background: #f04a1d; }
.swatch-row { display: flex; gap: 0; border: 1px solid var(--line); }
.swatch-step { flex: 1; height: 44px; position: relative; }
.swatch-step span { position: absolute; bottom: -18px; left: 0; font-family: var(--mono); font-size: 8px; color: var(--muted); }
.swatch-steps { margin-bottom: 22px; }

.qr-stage { display: grid; place-items: center; background: #fff; border: 1px solid var(--line-strong); padding: 18px; min-height: 280px; }
.qr-stage canvas, .qr-stage img { width: 240px; height: 240px; image-rendering: pixelated; }

.dropzone {
  border: 1px dashed var(--line-strong); padding: 34px 20px; text-align: center; cursor: pointer;
  background: var(--field); transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--paper-2); }
.dropzone strong { display: block; font-size: 15px; margin-bottom: 6px; }
.dropzone span { font-size: 12px; color: var(--muted); }
.dropzone .dz-glyph { font-family: var(--mono); font-size: 22px; color: var(--accent-text); margin-bottom: 12px; }
.img-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.img-card { border: 1px solid var(--line); padding: 10px; display: flex; gap: 10px; align-items: center; min-width: 0; }
.img-card img { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--line); flex: none; background: var(--paper-2); }
.img-card .img-info { min-width: 0; flex: 1; }
.img-card .img-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-card .img-meta { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-top: 3px; }
.img-card .img-actions { display: flex; gap: 4px; margin-top: 6px; }
.img-card.is-error { border-color: var(--err); }

.diff-view { border: 1px solid var(--line-strong); background: var(--field); max-height: 340px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.diff-line { display: flex; gap: 0; white-space: pre-wrap; word-break: break-word; padding: 1px 8px; }
.diff-line .sign { width: 14px; flex: none; color: var(--muted); }
.diff-line .ln { width: 34px; flex: none; color: var(--muted); text-align: right; padding-right: 10px; user-select: none; }
.diff-line.add { background: rgba(23, 114, 69, .10); }
.diff-line.del { background: rgba(180, 35, 24, .10); }
[data-theme="dark"] .diff-line.add { background: rgba(98, 200, 148, .12); }
[data-theme="dark"] .diff-line.del { background: rgba(255, 143, 131, .12); }

.highlight-box { border: 1px solid var(--line-strong); background: var(--field); padding: 12px; min-height: 120px; max-height: 300px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.highlight-box mark { background: rgba(240, 74, 29, .22); color: inherit; border-bottom: 1px solid var(--accent); }
.highlight-box mark.alt { background: rgba(47, 98, 201, .18); border-color: #2f62c9; }
.match-table { max-height: 220px; overflow: auto; border: 1px solid var(--line); }

.md-preview { border: 1px solid var(--line-strong); background: var(--field); padding: 18px 20px; min-height: 320px; max-height: 520px; overflow: auto; }
.md-preview > :first-child { margin-top: 0; }

.strength { height: 6px; background: var(--paper-3); overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; background: var(--err); transition: width .2s, background .2s; }

.toc { list-style: none; }
.toc li { border-top: 1px solid var(--line); }
.toc li:first-child { border-top: 0; }
.toc a { display: block; padding: 7px 0; font-size: 12px; color: var(--ink-2); }
.toc a:hover { color: var(--accent-text); }

/* ---------- prose / content ---------- */

.tool-copy { margin-top: 44px; border-top: 1px solid var(--ink); padding-top: 34px; }
.prose { max-width: 760px; font-size: 16px; }
.prose h2 { font-size: 25px; margin: 38px 0 14px; letter-spacing: -0.03em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 18px; margin: 26px 0 10px; }
.prose p { color: var(--ink-2); line-height: 1.8; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 18px; color: var(--ink-2); }
.prose li { margin: 7px 0; line-height: 1.75; }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--paper-2); padding: 2px 5px; border: 1px solid var(--line); }
.prose pre { background: var(--code-bg); color: var(--code-ink); padding: 16px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.7; margin: 0 0 20px; }
.prose pre code { background: transparent; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose blockquote { margin: 0 0 20px; padding: 2px 0 2px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose blockquote p { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0 0 20px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { background: var(--paper-2); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 38px; }
.steps li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 3px;
  font-family: var(--mono); font-size: 10px; color: var(--accent-text); border: 1px solid var(--line);
  padding: 1px 4px; line-height: 1.4;
}
.link-list { list-style: none; padding: 0 !important; }
.link-list li { border-top: 1px solid var(--line); margin: 0; }
.link-list li:last-child { border-bottom: 1px solid var(--line); }
.link-list a { display: block; padding: 10px 0; font-size: 14px; }
.updated { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 34px; }
.related-section { padding: 52px 0 80px; }
.page-prose { max-width: 780px; }
.page-prose h2 { font-size: 24px; }
.page-prose h3 { font-size: 17px; }

/* ---------- article ---------- */

.article-page { padding-top: 32px; }
.article-head { max-width: 820px; padding-bottom: 34px; border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.article-head h1 { font-size: clamp(34px, 4.6vw, 54px); letter-spacing: -0.045em; margin: 10px 0 16px; }
.article-meta { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--muted); margin-top: 18px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; align-items: start; }
.article-body { max-width: 740px; }
.article-side { display: flex; flex-direction: column; gap: 14px; }
.article-side .sticky { position: sticky; top: calc(var(--header-h) + 16px); }
.author-box { display: flex; gap: 14px; margin-top: 46px; padding-top: 22px; border-top: 1px solid var(--line); }
.author-mark { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--ink); color: var(--paper); font-family: var(--mono); }
.author-box strong { font-size: 14px; }
.author-box p { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.guide-list { border-top: 1px solid var(--ink); }
.guide-row { display: grid; grid-template-columns: 110px 1fr 30px; gap: 22px; padding: 26px 0; border-bottom: 1px solid var(--line); align-items: start; }
.guide-row:hover { background: var(--paper-2); color: var(--ink); }
.guide-date { font-family: var(--mono); font-size: 10px; color: var(--muted); padding-top: 4px; }
.guide-body { display: flex; flex-direction: column; gap: 7px; }
.guide-tag { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.guide-body strong { font-size: 20px; letter-spacing: -0.025em; }
.guide-body > span:last-child { font-size: 13px; color: var(--muted); line-height: 1.6; }
.guide-arrow { font-size: 18px; color: var(--muted); padding-top: 20px; }

/* ---------- misc ---------- */

.cat-foot { padding-bottom: 80px; }
.cat-foot-box { border-top: 1px solid var(--ink); padding-top: 22px; }
.cat-links { display: flex; flex-wrap: wrap; gap: 12px; }
.cat-links a { border: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }
.cat-links a span { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-left: 6px; }
.cat-links a:hover { border-color: var(--ink); color: var(--ink); }
.notfound { min-height: 52vh; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px); z-index: 120;
  background: var(--ink); color: var(--paper); padding: 10px 16px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; border: 1px solid var(--ink);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.mono { font-family: var(--mono); }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { gap: 40px; }
  .why { grid-template-columns: 1fr; gap: 28px; }
  .faq-section { grid-template-columns: 1fr; gap: 24px; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; padding: 54px 0 60px; }
  .hero-demo { max-width: 580px; }
  .tool-grid-layout { grid-template-columns: 1fr; }
  .tool-side { position: static; display: grid; grid-template-columns: repeat(2, 1fr); }
  .tool-side .side-box:last-child { grid-column: 1 / -1; }
  .tool-glyph-large { display: none; }
  .article-layout { grid-template-columns: 1fr; }
  .article-side { display: grid; grid-template-columns: repeat(2, 1fr); }
  .article-side .sticky { position: static; }
  .guide-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }
  .why-item, .why-item + .why-item { border-right: 0; border-top: 1px solid var(--line); padding: 18px 0; }
  .why-item:first-child { border-top: 0; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
  .split { grid-template-columns: 1fr; }
  textarea.code, .code-out { min-height: 220px; }
}

@media (max-width: 720px) {
  .wrap { width: calc(100% - 32px); }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0 0; row-gap: 0; gap: 12px; }
  .site-nav {
    order: 3; width: 100%; margin: 0; padding: 8px 0 9px; border-top: 1px solid var(--line);
    gap: 22px; overflow-x: auto;
  }
  .site-nav a { font-size: 13px; white-space: nowrap; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { width: 36px; justify-content: center; padding: 0; }
  .hero { margin-top: -1px; }
  .hero h1 { font-size: clamp(32px, 9vw, 48px); }
  .hero-lede { font-size: 16px; }
  .hero-search { padding-left: 12px; }
  .hero-search input { font-size: 14px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-card { min-height: 180px; padding: 16px; }
  .tool-card h3 { font-size: 16px; }
  .tool-card p { font-size: 12px; }
  .tool-card-no { top: 16px; right: 16px; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card { min-height: 160px; }
  .section { padding-top: 56px; }
  .section-head h2 { font-size: 28px; }
  .section-head .text-link { margin-left: 0; }
  .faq summary { font-size: 15px; }
  .cta { padding: 60px 0 56px; }
  .cta-box { padding: 28px 22px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { margin-top: 6px; }
  .tool-head h1 { font-size: 34px; }
  .tool-side, .article-side { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .img-list { grid-template-columns: 1fr; }
  .guide-row { grid-template-columns: 1fr 24px; gap: 10px; }
  .guide-date { display: none; }
  .workbench-body { padding: 10px; }
  .page-head { padding: 30px 0 32px; }
  .page-head h1 { font-size: 38px; }
  .toolbar .btn { flex: 0 1 auto; }
  .toolbar .spacer { display: none; }
}

@media (max-width: 440px) {
  .tool-grid { grid-template-columns: 1fr; }
  .hero-search button { padding: 0 12px; }
  .brand-text small { display: none; }
  .crumbs { display: none; }
  .tool-page { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

@media print {
  .site-header, .site-footer, .tool-side, .hero-demo, .toast, .article-side { display: none !important; }
  body { background: #fff; color: #000; }
}

.diff-inline { padding: 14px; font-family: var(--mono); font-size: 12px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.diff-inline ins { background: rgba(23, 114, 69, .16); text-decoration: none; color: inherit; }
.diff-inline del { background: rgba(180, 35, 24, .14); color: var(--muted); }
[data-theme="dark"] .diff-inline ins { background: rgba(98, 200, 148, .18); }
[data-theme="dark"] .diff-inline del { background: rgba(255, 143, 131, .16); }

.tool-main { min-width: 0; }
.tool-main .tool-copy { margin-top: 40px; }
.tool-card-cta { grid-column: span 2; background: var(--paper-2); }
.tool-card-cta .tool-glyph { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tool-card-cta h3 { font-size: 22px; }
.tool-card-cta:hover { background: var(--paper-3); }
@media (max-width: 900px) {
  .tool-card-cta { grid-column: span 2; }
}
@media (max-width: 440px) {
  .tool-card-cta { grid-column: span 1; }
  .tool-main .tool-copy { margin-top: 28px; }
}

.swatch-step { border: 0; padding: 0; cursor: pointer; }
.swatch-step:hover span { color: var(--accent-text); }

.related-section .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .related-section .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .related-section .tool-grid { grid-template-columns: 1fr; }
  .cat-cta { grid-column: span 1 !important; }
}


/* ---------- directory-first home ---------- */

.directory { padding: 38px 0 74px; }
.dir-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--ink); margin-bottom: 20px; }
.dir-head h1 { font-size: clamp(34px, 4.2vw, 54px); letter-spacing: -0.045em; margin: 0 0 10px; }
.dir-head .eyebrow { margin-bottom: 12px; }
.dir-lede { max-width: 680px; color: var(--ink-2); font-size: 16px; line-height: 1.65; margin: 0; }
.dir-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.dir-search {
  display: flex; align-items: center; gap: 9px; flex: 1 1 460px; max-width: 570px;
  border: 1px solid var(--ink); background: var(--field); padding: 5px 5px 5px 12px;
}
.dir-search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.dir-search input { flex: 1; min-width: 0; height: 38px; border: 0; outline: 0; background: transparent; font-size: 14px; }
.dir-search button { height: 38px; padding: 0 16px; border: 1px solid var(--ink); background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 650; }
.dir-search button:hover { filter: brightness(.95); }
.dir-controls .chips { flex: 1 1 400px; }
.dir-grid .tool-card { min-height: 174px; }
.dir-empty { padding: 34px 0; color: var(--muted); font-size: 14px; }
.dir-foot-note { margin-top: 18px; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .02em; }
.dir-foot-note a { color: var(--ink-2); border-bottom: 1px solid var(--line); }
.cat-faq { padding-top: 56px; }
.cat-faq .faq-head h2 { font-size: 30px; }

@media (max-width: 720px) {
  .directory { padding: 26px 0 54px; }
  .dir-head h1 { font-size: 36px; }
  .dir-search { flex-basis: 100%; max-width: none; }
  .dir-controls .chips { flex-basis: 100%; }
  .dir-grid .tool-card { min-height: 166px; }
  .cat-faq { padding-top: 42px; }
}

/* ---------- file lists / fullscreen ---------- */

.file-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 12px; }
.file-list:empty { display: none; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--paper); }
.file-glyph { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-family: var(--mono); font-size: 9px; border: 1px solid var(--line-strong); color: var(--accent-text); }
.file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-info strong { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info span { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-top: 2px; }
.file-actions { display: flex; align-items: center; gap: 1px; }

.wb-fullscreen {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; margin-left: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.wb-fullscreen:hover { border-color: var(--ink); color: var(--ink); }
.wb-fullscreen svg { width: 14px; height: 14px; fill: none; stroke: currentColor; }
.workbench-bar .wb-meta { margin-left: auto; }

.workbench:fullscreen, .workbench.is-fullscreen {
  position: fixed; inset: 0; z-index: 150; width: auto; height: auto; margin: 0;
  border: 0; background: var(--paper); display: flex; flex-direction: column;
}
.workbench:fullscreen .workbench-bar, .workbench.is-fullscreen .workbench-bar { flex: none; }
.workbench:fullscreen .workbench-body, .workbench.is-fullscreen .workbench-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto;
}
.workbench:fullscreen .split, .workbench.is-fullscreen .split { flex: 1; min-height: 0; }
.workbench:fullscreen .pane, .workbench.is-fullscreen .pane { display: flex; flex-direction: column; min-height: 0; }
.workbench:fullscreen .stack, .workbench.is-fullscreen .stack { flex: 1; min-height: 0; }
.workbench:fullscreen textarea.code, .workbench.is-fullscreen textarea.code,
.workbench:fullscreen .code-out, .workbench.is-fullscreen .code-out {
  flex: 1; min-height: 0; height: auto;
}
.workbench:fullscreen .toolbar, .workbench.is-fullscreen .toolbar { flex: none; }
body.has-fullscreen { overflow: hidden; }

/* ---------- default focus workspace (editor + live preview) ---------- */
/* JSON already has its own custom workspace; these tools use the same idea
   with the regular split/stack layout: hide the marketing chrome, fill the
   viewport, and let the editor and preview consume the remaining height. */
body.tool-focus { overflow: hidden; }
body.tool-focus .site-header,
body.tool-focus .crumbs,
body.tool-focus .tool-head,
body.tool-focus .tool-copy,
body.tool-focus .tool-side,
body.tool-focus .related-section,
body.tool-focus .site-footer { display: none !important; }
body.tool-focus .tool-page { height: 100vh; height: 100dvh; min-height: 0; padding: 0; }
body.tool-focus .tool-page > .wrap { width: 100%; max-width: none; padding: 0; }
body.tool-focus .tool-grid-layout { display: block; }
body.tool-focus .workbench {
  height: 100vh; height: 100dvh; min-height: 0;
  display: flex; flex-direction: column; border: 0; border-radius: 0;
}
body.tool-focus .workbench-bar { flex: none; height: 44px; min-height: 44px; padding: 0 14px; }
body.tool-focus .workbench-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 10px 14px; overflow: auto;
}
body.tool-focus .workbench-body > .toolbar,
body.tool-focus .workbench-body > .field-row,
body.tool-focus .workbench-body > .row,
body.tool-focus .workbench-body > .notice,
body.tool-focus .workbench-body > .meta-row { flex: none; }
body.tool-focus .split { flex: 1; min-height: 0; }
body.tool-focus .pane { display: flex; flex-direction: column; min-height: 0; }
body.tool-focus .pane-head { flex: none; }
body.tool-focus .stack { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.tool-focus .stack > .pane { flex: 1; min-height: 0; }
body.tool-focus .stack > .field-row,
body.tool-focus .stack > .row { flex: none; }
body.tool-focus textarea.code,
body.tool-focus .code-out,
body.tool-focus .md-preview,
body.tool-focus .highlight-box,
body.tool-focus .mermaid-stage,
body.tool-focus .uml-preview,
body.tool-focus .shot-stage,
body.tool-focus .chart-stage {
  flex: 1; min-height: 0; height: auto; max-height: none;
}
body.tool-focus .md-preview,
body.tool-focus .highlight-box,
body.tool-focus .mermaid-stage,
body.tool-focus .uml-preview,
body.tool-focus .shot-stage { overflow: auto; }
body.tool-focus .plantuml-grid { flex: 1; min-height: 0; height: auto; }
body.tool-focus .plantuml-grid .pane { display: flex; flex-direction: column; min-height: 0; }
body.tool-focus .plantuml-editor { flex: 1; min-height: 0 !important; height: auto; }
body.tool-focus .chart-stage { min-height: 260px; }
body.tool-focus .workbench-body > .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
body.tool-focus .workbench-body > .toolbar::-webkit-scrollbar { display: none; }

@media (max-width: 900px) {
  body.tool-focus .split { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  body.tool-focus .plantuml-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  body.tool-focus .plantuml-grid .pane:first-child,
  body.tool-focus .plantuml-grid .pane:last-child { height: auto; min-height: 0; }
}

@media (max-width: 720px) {
  body.tool-focus .workbench-body { padding: 8px; }
  body.tool-focus .workbench-bar .wb-meta { display: none; }
  body.tool-focus .workbench-body > .toolbar { margin-bottom: 6px; }
  body.tool-focus .split { gap: 8px; }
  body.tool-focus .chart-stage { min-height: 220px; }
  body.tool-focus .stack > .field-row,
  body.tool-focus .stack > .row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  body.tool-focus .stack > .field-row::-webkit-scrollbar,
  body.tool-focus .stack > .row::-webkit-scrollbar { display: none; }
  body.tool-focus .stack > .field-row > *,
  body.tool-focus .stack > .row > * { flex: 0 0 auto; }
}

@media (max-width: 1080px) {
  .cat-cta-doc { grid-column: span 2 !important; }
}
@media (max-width: 720px) {
  .cat-cta-doc { grid-column: span 1 !important; }
}


.file-thumb { width: 42px; height: 42px; flex: none; object-fit: cover; border: 1px solid var(--line); background: var(--paper-2); }
.favicon-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.favicon-item { border: 1px solid var(--line); background: var(--field); padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.favicon-item img { width: 40px; height: 40px; object-fit: contain; }
.favicon-item strong { font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--muted); }
.favicon-item .btn { height: 26px; font-size: 10px; padding: 0 7px; }
@media (max-width: 720px) {
  .favicon-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.dir-random { margin-top: 18px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.dir-random a { color: var(--ink-2); border-bottom: 1px solid var(--line); }

.shot-stage {
  border: 1px solid var(--line); background: var(--paper-2); padding: 26px 18px;
  min-height: 330px; overflow: auto; display: flex; align-items: flex-start; justify-content: center;
}
.code-shot {
  --shot-font: 14px; --shot-pad: 32px;
  width: max-content; flex: none; min-width: min(100%, 560px); padding: var(--shot-pad);
  border-radius: 14px; background: var(--shot-bg); color: var(--shot-fg);
  font-family: var(--mono); box-shadow: 0 18px 48px rgba(21, 21, 15, .18);
}
.code-shot[data-theme="midnight"] {
  --shot-bg: #0d1117; --shot-fg: #e6edf3; --shot-muted: #8b949e;
  --shot-keyword: #ff7b72; --shot-string: #a5d6ff; --shot-comment: #8b949e;
  --shot-number: #79c0ff; --shot-function: #d2a8ff; --shot-attr: #ffa657;
}
.code-shot[data-theme="paper"] {
  --shot-bg: #f7f4ec; --shot-fg: #1f1f1a; --shot-muted: #8a8577;
  --shot-keyword: #b83713; --shot-string: #2f6b3a; --shot-comment: #8a8577;
  --shot-number: #1f4bff; --shot-function: #7a3bb5; --shot-attr: #8a5a00;
}
.code-shot[data-theme="sunset"] {
  --shot-bg: linear-gradient(135deg, #1b1024 0%, #3a1220 100%);
  --shot-fg: #ffe8d6; --shot-muted: #c99b98;
  --shot-keyword: #ff9e7a; --shot-string: #f7d488; --shot-comment: #b98b8b;
  --shot-number: #9ed0ff; --shot-function: #f5a3ff; --shot-attr: #ffc078;
}
.code-shot[data-theme="ocean"] {
  --shot-bg: linear-gradient(135deg, #061923 0%, #0b2f3a 100%);
  --shot-fg: #dff7ff; --shot-muted: #84a9b5;
  --shot-keyword: #7ee0d2; --shot-string: #b9e6a7; --shot-comment: #7f9fa9;
  --shot-number: #8ab4ff; --shot-function: #e7b7ff; --shot-attr: #ffcf8a;
}
.shot-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.shot-dots { display: inline-flex; gap: 5px; }
.shot-dots i { width: 8px; height: 8px; border-radius: 50%; background: #ff5f57; }
.shot-dots i:nth-child(2) { background: #febc2e; }
.shot-dots i:nth-child(3) { background: #28c840; }
.shot-title { font-size: 10px; color: var(--shot-muted); letter-spacing: .02em; }
.shot-body { display: flex; align-items: stretch; gap: 16px; }
.shot-lines {
  white-space: pre; text-align: right; color: var(--shot-muted); opacity: .62;
  font-size: var(--shot-font); line-height: 1.65; user-select: none;
  border-right: 1px solid rgba(255, 255, 255, .16);
  border-right-color: color-mix(in srgb, var(--shot-fg) 16%, transparent);
  padding-right: 12px;
}
.shot-code { margin: 0; padding: 0; font-size: var(--shot-font); line-height: 1.65; white-space: pre; color: inherit; }
.shot-code code { background: transparent; border: 0; padding: 0; color: inherit; font-size: inherit; }
.code-shot .hljs-keyword, .code-shot .hljs-selector-tag, .code-shot .hljs-literal { color: var(--shot-keyword); }
.code-shot .hljs-string, .code-shot .hljs-regexp { color: var(--shot-string); }
.code-shot .hljs-comment, .code-shot .hljs-quote { color: var(--shot-comment); font-style: italic; }
.code-shot .hljs-number, .code-shot .hljs-symbol { color: var(--shot-number); }
.code-shot .hljs-title, .code-shot .hljs-function, .code-shot .hljs-section { color: var(--shot-function); }
.code-shot .hljs-attr, .code-shot .hljs-attribute, .code-shot .hljs-name { color: var(--shot-attr); }
.code-shot .hljs-built_in, .code-shot .hljs-type { color: var(--shot-number); }
.code-shot .hljs-variable, .code-shot .hljs-params { color: inherit; }

@media (max-width: 720px) {
  .shot-stage { padding: 16px 10px; justify-content: flex-start; }
  .code-shot { min-width: 300px; }
  .shot-lines { display: none; }
}

.crop-stage {
  min-height: 420px; border: 1px solid var(--line); background: var(--paper-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.crop-stage[hidden], .beautify-stage[hidden], .exif-layout[hidden] { display: none; }
.crop-stage img { display: block; max-width: 100%; max-height: 560px; }
.cropper-container { max-width: 100%; }
.cropper-view-box { outline-color: var(--accent); }
.cropper-line { background-color: var(--accent); }
.cropper-point { background-color: var(--accent); }

.beautify-stage {
  border: 1px solid var(--line); background: var(--paper-2); padding: 16px;
  display: flex; justify-content: center; overflow: auto;
}
.beautify-stage canvas { max-width: 100%; height: auto; display: block; box-shadow: 0 0 0 1px rgba(21,21,15,.06); }
.color-input { padding: 3px; width: 46px; height: 36px; cursor: pointer; }

.exif-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 12px; }
.exif-preview { border: 1px solid var(--line); background: var(--paper-2); display: flex; align-items: center; justify-content: center; min-height: 260px; padding: 10px; }
.exif-preview img { max-width: 100%; max-height: 360px; display: block; }
.exif-data { border: 1px solid var(--line); background: var(--field); padding: 12px; min-width: 0; }
.exif-list { margin: 8px 0 0; max-height: 300px; overflow: auto; }
.exif-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.exif-row:last-child { border-bottom: 0; }
.exif-row dt { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.exif-row dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.exif-privacy { font-size: 11px; color: var(--muted); margin: 12px 0 0; line-height: 1.6; }
.exif-privacy.is-warning { color: var(--accent-text); }
@media (max-width: 820px) {
  .exif-layout { grid-template-columns: 1fr; }
  .exif-preview { min-height: 180px; }
  .exif-row { grid-template-columns: 110px minmax(0, 1fr); }
}

.mermaid-stage {
  border: 1px solid var(--line); background: var(--paper-2); padding: 18px;
  min-height: 420px; overflow: auto; display: flex; justify-content: center; align-items: flex-start;
}
.mermaid-stage.is-dark { background: #0d1117; }
.mermaid-preview { width: 100%; text-align: center; }
.mermaid-preview svg { max-width: 100%; height: auto; }
.http-details { border: 1px solid var(--line); background: var(--field); padding: 8px 10px; }
.http-details summary { cursor: pointer; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.http-details textarea { min-height: 90px; margin-top: 8px; }
.http-details .code-out { min-height: 70px; margin-top: 8px; }
#http-response { min-height: 300px; max-height: 520px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
#http-status.is-ok { color: var(--accent-text); }
#http-status.is-error { color: #b42318; }
@media (max-width: 720px) {
  .mermaid-stage { min-height: 300px; padding: 8px; }
  #http-response { min-height: 220px; }
}

.pdf-org-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.pdf-org-grid:empty { display: none; }
.pdf-page-card { border: 1px solid var(--line); background: var(--field); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pdf-thumb-wrap { background: #fff; min-height: 110px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pdf-thumb-wrap canvas { max-width: 100%; max-height: 150px; display: block; transition: transform .15s ease; }
.pdf-page-card .pane-meta { text-align: center; }
.pdf-page-actions { display: flex; justify-content: center; gap: 1px; flex-wrap: wrap; }
.pdf-page-actions .btn { height: 24px; font-size: 10px; padding: 0 6px; }
.compare-drops { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-drops .dropzone { min-height: 150px; }
.compare-drops .dropzone strong { font-size: 14px; }
#cmp-canvas { max-width: 100%; height: auto; }
@media (max-width: 820px) {
  .pdf-org-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .compare-drops { grid-template-columns: 1fr; }
}

.dir-suggest-bar { margin-top: 16px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.dir-suggest-bar a { color: var(--ink-2); border-bottom: 1px solid var(--line); }

.redact-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.redact-wrap #redact-base { max-width: 100%; height: auto; display: block; }
.redact-wrap #redact-overlay { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

@media (max-width: 720px) {
  .wb-fullscreen { width: 32px; height: 32px; }
  .pdf-page-actions .btn { height: 30px; min-width: 30px; }
  .btn-sm { min-height: 30px; }
}

.table-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); background: var(--field); margin-top: 12px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 12px; }
.table-wrap th, .table-wrap td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
.table-wrap th { position: sticky; top: 0; background: var(--paper-2); font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--muted); z-index: 1; }
.table-wrap tr:last-child td { border-bottom: 0; }

.result-box { border: 1px solid var(--line); background: var(--field); padding: 22px 18px; margin-top: 12px; }
.calc-result { font-family: var(--mono); font-size: clamp(28px, 5vw, 44px); line-height: 1.15; letter-spacing: -.04em; margin: 6px 0 8px; overflow-wrap: anywhere; }
.calc-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
#dc-range, #dc-add { display: flex; gap: 10px; flex-wrap: wrap; }
#dc-range[hidden], #dc-add[hidden] { display: none; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 12px; }
.stat-box { background: var(--field); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat-box span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.stat-box strong { font-family: var(--mono); font-size: 18px; font-weight: 500; letter-spacing: -.03em; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-box strong { font-size: 16px; }
}

.chart-stage { position: relative; height: 330px; min-height: 260px; border: 1px solid var(--line); background: #fff; padding: 10px; }
.dc-chart { width: 100%; height: 100%; min-height: 0; }
.chart-stage .apexcharts-canvas { margin: 0 auto; }
@media (max-width: 720px) { .chart-stage { height: 280px; } }

/* JSON workspace: large editor, text/tree result */
.json-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; height: clamp(480px, 62vh, 680px); }
.json-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.json-pane .pane-head { flex: none; align-items: center; }
.json-editor { flex: 1; min-height: 0 !important; height: 100%; resize: none; }
.json-result-body { position: relative; flex: 1; min-height: 0; border: 1px solid var(--line-strong); background: var(--field); overflow: hidden; }
.json-result-body .code-out { position: absolute; inset: 0; min-height: 0; border: 0; height: 100%; }
.json-tree { position: absolute; inset: 0; overflow: auto; padding: 10px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.7; }
.json-tree details { margin-left: 10px; }
.json-tree > details { margin-left: 0; }
.json-tree summary { cursor: pointer; color: var(--ink-2); padding: 1px 0; }
.json-tree summary::marker { color: var(--accent-text); }
.json-tree .jt-key { color: var(--accent-text); }
.json-tree .jt-string { color: var(--ok); overflow-wrap: anywhere; }
.json-tree .jt-number { color: #2f62c9; }
.json-tree .jt-bool { color: var(--warn); }
.json-tree .jt-null { color: var(--muted); }
.json-tree .jt-type { color: var(--muted); font-size: 10px; margin-left: 5px; }
.json-view-tabs { display: inline-flex; gap: 2px; }
.json-tab { border: 1px solid transparent; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; cursor: pointer; }
.json-tab.is-active { color: var(--ink); border-color: var(--line-strong); background: var(--paper-2); }
.json-statusbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 9px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.json-statusbar .spacer { flex: 1; }
.json-statusbar kbd { font-size: 9px; }
.workbench:fullscreen .json-workspace, .workbench.is-fullscreen .json-workspace { flex: 1; height: auto; min-height: 0; }
.workbench:fullscreen .json-pane, .workbench.is-fullscreen .json-pane { min-height: 0; }
@media (max-width: 720px) {
  .json-workspace { grid-template-columns: 1fr; height: auto; }
  .json-pane { height: 340px; }
  .json-pane-result { height: 380px; }
  .json-statusbar { font-size: 9px; }
}

.json-tab[disabled] { opacity: .35; cursor: not-allowed; }

/* Media / GIF */
.media-video { width: 100%; max-height: 380px; background: #000; border: 1px solid var(--line-strong); display: block; }
.media-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 8px; }
.media-progress { margin-top: 12px; border: 1px solid var(--line); padding: 10px 12px; background: var(--field); }
.media-progress > span { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.progress-track { height: 6px; background: var(--paper-3); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.media-result { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.media-result img { display: block; max-width: 100%; max-height: 420px; margin: 10px 0; border: 1px solid var(--line); background: #fff; }
.gif-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.gif-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line); padding: 8px; background: var(--field); }
.gif-row img { width: 64px; height: 52px; object-fit: cover; border: 1px solid var(--line); background: var(--paper-2); }
.gif-row-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gif-row-info strong { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gif-row-info span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.gif-row-actions { display: flex; gap: 2px; }
@media (max-width: 720px) {
  .gif-row { grid-template-columns: 48px minmax(0, 1fr); }
  .gif-row img { width: 48px; height: 44px; }
  .gif-row-actions { grid-column: 2; }
}

/* Focus mode for the JSON workbench: no side rail, wider editors */
body.tool-page-json .tool-grid-layout { grid-template-columns: minmax(0, 1fr); }
body.tool-page-json .tool-side { display: none; }

.json-toolbar { margin-top: 0; margin-bottom: 10px; }

/* Age calculator */
.age-tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 14px; }
.age-tab { border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.age-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.age-panel[hidden] { display: none; }
.age-hero { border: 1px solid var(--ink); background: var(--field); padding: 18px 18px 16px; margin-top: 14px; position: relative; overflow: hidden; }
.age-hero::after { content: ""; position: absolute; right: -30px; top: -50px; width: 140px; height: 140px; border: 1px solid var(--line); border-radius: 50%; pointer-events: none; }
.age-number { font-family: var(--mono); font-size: clamp(30px, 4.5vw, 52px); line-height: 1.15; letter-spacing: -.055em; margin: 6px 0 8px; overflow-wrap: anywhere; }
.age-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); margin: 0; }
.age-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.age-badges span { font-family: var(--mono); font-size: 9px; letter-spacing: .04em; border: 1px solid var(--line); background: var(--paper); padding: 4px 7px; color: var(--muted); }
.age-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 10px; }
.age-fact { background: var(--field); padding: 11px 12px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.age-fact span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.age-fact strong { font-family: var(--mono); font-size: 17px; font-weight: 500; letter-spacing: -.03em; overflow-wrap: anywhere; }
.age-fact small { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.age-foot { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; border-bottom: 1px solid var(--line); padding: 12px 0; margin-top: 4px; }
.age-foot > div { display: flex; flex-direction: column; gap: 3px; }
.age-foot span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.age-foot strong { font-size: 14px; font-weight: 500; }
@media (max-width: 720px) {
  .age-facts, .age-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .age-number { font-size: clamp(27px, 8vw, 36px); }
  .age-fact strong { font-size: 15px; }
}

/* JSON line-number gutter */
.json-editor-wrap { display: flex; flex: 1; min-height: 0; border: 1px solid var(--line-strong); background: var(--field); overflow: hidden; }
.json-editor-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240, 74, 29, .14); }
.json-gutter { width: 46px; flex: none; overflow: hidden; border-right: 1px solid var(--line); background: var(--paper-2); padding: 11px 8px 11px 0; user-select: none; }
.json-gutter pre { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.65; color: var(--muted); text-align: right; }
.json-gutter span { display: block; height: 21.45px; }
.json-gutter span.is-error { color: var(--err); font-weight: 650; }
.json-editor { flex: 1; min-width: 0; width: auto !important; height: 100% !important; min-height: 0 !important; border: 0 !important; white-space: pre; overflow: auto; resize: none; }
@media (max-width: 720px) { .json-gutter { width: 38px; padding-right: 6px; } }

.table-wrap { -webkit-overflow-scrolling: touch; }
@media (max-width: 720px) {
  .table-wrap { max-height: 300px; }
  .table-wrap table { min-width: max-content; }
  .chart-stage { height: 320px; }
}

.frame-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.frame-grid figure { margin: 0; border: 1px solid var(--line); background: var(--paper-2); min-width: 0; }
.frame-grid img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #fff; }
.frame-grid figcaption { padding: 4px 6px; font-family: var(--mono); font-size: 9px; color: var(--muted); }
@media (max-width: 720px) { .frame-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.json-error-panel { position: absolute; inset: 0; z-index: 3; overflow: auto; padding: 18px; background: var(--field); border-left: 3px solid var(--err); }
.json-error-panel .je-kicker { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--err); }
.json-error-panel h3 { font-size: 18px; margin: 7px 0 4px; letter-spacing: -.02em; }
.json-error-panel .je-loc { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.json-error-panel .je-msg { margin: 14px 0; font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.json-error-panel .je-action { margin-top: 4px; }

/* Inline errors live in the result pane, not below the whole tool. */
.notice.is-inline-source { display: none; }
.inline-error { min-height: 340px; border: 1px solid var(--err); background: var(--field); color: var(--err); padding: 14px 16px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-error.is-overlay { position: absolute; inset: 8px; z-index: 3; min-height: 0; overflow: auto; background: var(--field); }
.chart-stage, .highlight-box { position: relative; }

/* PlantUML */
body.tool-page-plantuml .tool-grid-layout { grid-template-columns: minmax(0, 1fr); }
body.tool-page-plantuml .tool-side { display: none; }
.plantuml-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; height: clamp(460px, 60vh, 620px); }
.plantuml-grid .pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.plantuml-editor { flex: 1; min-height: 0 !important; height: 100%; resize: none; white-space: pre; overflow: auto; }
.uml-preview { position: relative; flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line-strong); background: #fff; padding: 14px; display: grid; place-items: center; }
.uml-preview svg { max-width: 100%; height: auto; min-width: 120px; }
.uml-empty { color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 360px; text-align: center; }
.uml-error-panel { color: var(--err); font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
@media (max-width: 720px) {
  .plantuml-grid { grid-template-columns: 1fr; height: auto; }
  .plantuml-grid .pane:first-child { height: 360px; }
  .plantuml-grid .pane:last-child { height: 380px; }
}

/* JWT */
.jwt-tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 14px; }
.jwt-tab { border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.jwt-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
[data-jwt-panel][hidden] { display: none; }
.jwt-verify-box { border: 1px solid var(--line); background: var(--field); padding: 12px 14px; margin-top: 14px; }
.jwt-verify-box summary { cursor: pointer; font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.jwt-key { height: auto; min-height: 68px; padding: 8px 10px; font-family: var(--mono); font-size: 11px; resize: vertical; }
#jwt-gen-error { margin-top: 8px; min-height: 180px; }
@media (max-width: 720px) { .jwt-key { min-height: 84px; } }

.xml-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; height: clamp(440px, 58vh, 640px); }
.xml-grid .pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.xml-editor { flex: 1; min-height: 0 !important; height: 100%; resize: none; white-space: pre; overflow: auto; }
.xml-result-body { position: relative; flex: 1; min-height: 0; border: 1px solid var(--line-strong); background: var(--field); overflow: hidden; }
.xml-result-body .code-out { position: absolute; inset: 0; min-height: 0; border: 0; }
.xml-error-panel { position: absolute; inset: 0; z-index: 3; padding: 18px; overflow: auto; background: var(--field); border-left: 3px solid var(--err); color: var(--err); }
.xml-error-panel h3 { margin: 8px 0; font-size: 18px; color: var(--ink); }
.xml-error-panel p { font-family: var(--mono); font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
body.tool-page-xml .tool-grid-layout { grid-template-columns: minmax(0, 1fr); }
body.tool-page-xml .tool-side { display: none; }
@media (max-width: 720px) { .xml-grid { grid-template-columns: 1fr; height: auto; } .xml-grid .pane { height: 330px; } }

/* Grouped tool directory */
.home-sections { display: flex; flex-direction: column; gap: 34px; margin-top: 18px; }
.home-section[hidden] { display: none; }
.home-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-top: 1px solid var(--ink); padding-top: 12px; margin-bottom: 10px; }
.home-section-head .eyebrow { margin: 0 0 4px; }
.home-section-head h2 { font-size: clamp(20px, 2.3vw, 28px); letter-spacing: -.035em; margin: 0; }
.home-section-head .text-link { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
@media (max-width: 720px) {
  .home-sections { gap: 26px; }
  .home-section-head { align-items: flex-start; }
  .home-section-head h2 { font-size: 21px; }
}

.home-section .tool-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); background: var(--paper); }
.home-section .tool-card { box-shadow: inset -1px -1px 0 var(--line); }

/* JSON focus mode: the workspace owns the viewport under the site header */
body.tool-page-json { overflow: hidden; }
body.tool-page-json .tool-page { padding: 0; }
body.tool-page-json .tool-page > .wrap { width: 100%; }
body.tool-page-json .crumbs,
body.tool-page-json .tool-head,
body.tool-page-json .tool-copy,
body.tool-page-json .tool-side,
body.tool-page-json .related-section,
body.tool-page-json .site-footer { display: none !important; }
body.tool-page-json .tool-grid-layout { display: block; }
body.tool-page-json .workbench {
  height: var(--json-workspace-height, calc(100dvh - var(--header-h)));
  min-height: 0; display: flex; flex-direction: column;
  border-left: 0; border-right: 0; border-bottom: 0;
}
body.tool-page-json .workbench-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 14px; }
body.tool-page-json .json-workspace { flex: 1; min-height: 0; height: auto; }
body.tool-page-json .json-statusbar { flex: none; }
@media (max-width: 720px) {
  body.tool-page-json .workbench-body { padding: 8px; }
  body.tool-page-json .json-workspace {
    grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
  body.tool-page-json .json-pane,
  body.tool-page-json .json-pane-result { height: auto; min-height: 0; }
  body.tool-page-json .json-statusbar { font-size: 9px; }
}

/* Fullscreen work areas fill the viewport instead of sitting at the top */
.workbench:fullscreen .xml-grid, .workbench.is-fullscreen .xml-grid,
.workbench:fullscreen .plantuml-grid, .workbench.is-fullscreen .plantuml-grid {
  flex: 1; height: auto; min-height: 0;
}
.workbench:fullscreen .stack, .workbench.is-fullscreen .stack {
  display: flex; flex-direction: column; min-height: 0;
}
.workbench:fullscreen .stack > .pane, .workbench.is-fullscreen .stack > .pane {
  flex: 1; min-height: 0;
}
.workbench:fullscreen .stack textarea.code, .workbench.is-fullscreen .stack textarea.code {
  flex: 1; min-height: 0; height: auto;
}
.workbench:fullscreen .shot-stage, .workbench.is-fullscreen .shot-stage {
  flex: 1; min-height: 0; max-height: none;
}

/* Code screenshot preview: never center an oversized image out of reach */
.shot-stage { justify-content: flex-start; max-height: min(60vh, 560px); }
.code-shot { margin-inline: auto; }

/* A focused page and the native/fallback fullscreen overlay must not fight over height */
body.tool-page-json .workbench:fullscreen,
body.tool-page-json .workbench.is-fullscreen { height: auto; }

/* Percentage calculator */
.pct-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 12px; }
.pct-tab { border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pct-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.pct-mode-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.pct-mode { border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); font-size: 12px; padding: 7px 10px; cursor: pointer; }
.pct-mode:hover { border-color: var(--line-strong); }
.pct-mode.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pct-input-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 92px auto auto; align-items: end; gap: 8px; }
.pct-input-grid .field { min-width: 0; }
.pct-decimals { min-width: 0; }
.pct-result { border-top: 1px solid var(--ink); margin-top: 16px; padding-top: 14px; }
.pct-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.pct-number { font-family: var(--mono); font-size: clamp(34px, 5vw, 56px); line-height: 1.05; letter-spacing: -.06em; margin: 4px 0 6px; overflow-wrap: anywhere; }
.pct-formula { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.pct-result-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.pct-direction { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; border: 1px solid var(--line); padding: 4px 7px; color: var(--muted); }
.pct-direction.is-up { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.pct-direction.is-down { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pct-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 16px; }
.pct-stat { background: var(--field); padding: 12px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pct-stat span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.pct-stat strong { font-family: var(--mono); font-size: 18px; font-weight: 500; letter-spacing: -.03em; overflow-wrap: anywhere; }
.pct-steps { margin-top: 12px; border-top: 1px dashed var(--line); }
.pct-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: start; }
.pct-step > span { font-family: var(--mono); font-size: 9px; color: var(--muted); padding-top: 3px; }
.pct-step p { margin: 0; font-family: var(--mono); font-size: 11px; line-height: 1.65; color: var(--ink-2); overflow-wrap: anywhere; }
.pct-error { margin-top: 12px; border-left: 3px solid var(--err); background: var(--err-bg); color: var(--err); padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.pct-quick { margin-top: 16px; border: 1px solid var(--line); }
.pct-quick-head { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pct-quick-row { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); padding: 8px 10px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); cursor: pointer; text-align: left; }
.pct-quick-row:last-child { border-bottom: 0; }
.pct-quick-row:hover { background: var(--paper-2); }
.pct-quick-row strong { color: var(--ink); font-weight: 500; }
@media (max-width: 720px) {
  .pct-input-grid { grid-template-columns: 1fr 1fr; }
  .pct-decimals { grid-column: 1; }
  .pct-input-grid .btn { grid-column: auto; }
  .pct-result-head { flex-direction: column-reverse; gap: 8px; }
  .pct-result-actions { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .pct-stats { grid-template-columns: 1fr; }
  .pct-number { font-size: clamp(30px, 10vw, 42px); }
}

/* Keep the JSON page's h1/description available to assistive tech without showing page chrome */
body.tool-page-json .tool-head {
  display: block !important; position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.id-output { min-height: 300px; max-height: 520px; }

.ipv4-presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ipv4-presets button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); padding: 5px 8px; font-family: var(--mono); font-size: 10px; cursor: pointer; }
.ipv4-presets button:hover { border-color: var(--line-strong); color: var(--ink); }
.ipv4-error { margin-top: 10px; border-left: 3px solid var(--err); background: var(--err-bg); color: var(--err); padding: 10px 12px; font-size: 13px; }
.ipv4-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 12px; }
.ipv4-stat { background: var(--field); padding: 11px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ipv4-stat span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.ipv4-stat strong { font-family: var(--mono); font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.ipv4-stat small { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.ipv4-binary { margin-top: 10px; border: 1px solid var(--line); }
.ipv4-binary > div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.ipv4-binary > div:last-child { border-bottom: 0; }
.ipv4-binary span { font-family: var(--mono); font-size: 9px; color: var(--muted); padding-top: 2px; }
.ipv4-binary code { font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
#ip-table { min-width: 680px; }
@media (max-width: 720px) { .ipv4-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pw-output { min-height: 250px; max-height: 420px; letter-spacing: .04em; }
.pw-strength { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.pw-strength span, .pw-strength small { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.pw-strength strong { font-family: var(--mono); font-size: 18px; font-weight: 500; }
.pw-strength em { font-style: normal; font-size: 11px; padding: 3px 7px; border: 1px solid var(--line); }
.pw-strength em.is-strong { color: var(--ok); }
.pw-strength em.is-mid { color: var(--warn); }
.pw-strength em.is-weak { color: var(--err); }

.hmac-input { min-height: 150px; }
.hmac-output { min-height: 90px; overflow-wrap: anywhere; white-space: pre-wrap; }

.up-out { min-height: 120px; white-space: pre-wrap; overflow-wrap: anywhere; }
.up-output { min-height: 200px; max-height: 360px; }

.jc-input { min-height: 390px; }
.jc-output { min-height: 390px; max-height: 520px; white-space: pre; }

.toml-input { min-height: 390px; }

.cron-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 9px 0; margin-top: 12px; }
.cron-summary span { font-family: var(--mono); font-size: 9px; color: var(--muted); }
.cron-summary strong { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.cron-summary em { font-style: normal; font-size: 12px; color: var(--muted); margin-left: auto; }

/* ApexCharts uses heavier defaults for axis text; keep chart labels aligned with the site */
#dc-chart .apexcharts-xaxis-label,
#dc-chart .apexcharts-yaxis-label,
#dc-chart .apexcharts-legend-text { font-weight: 400 !important; }
#dc-chart .apexcharts-title-text { font-weight: 600 !important; }

/* --------------------------------------------------------------------------
   Directory polish: compact first screen, calmer cards, mobile list
   Keeps the warm-paper/technical identity, but gives the directory hierarchy.
   -------------------------------------------------------------------------- */

.directory { padding: 28px 0 64px; }
.dir-head { padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line-strong); }
.dir-head h1 { font-size: clamp(34px, 4.2vw, 48px); letter-spacing: -.05em; margin-bottom: 8px; }
.dir-head .eyebrow { margin-bottom: 9px; }
.dir-lede { max-width: 660px; font-size: 15px; line-height: 1.62; color: var(--ink-2); }
.dir-controls {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 25;
  gap: 8px 12px; margin: 0 0 16px; padding: 9px 0 8px;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
.dir-search { max-width: 520px; flex-basis: 430px; border-color: var(--line-strong); background: var(--field); }
.dir-search input { height: 36px; }
.dir-search button { height: 36px; border-color: var(--ink); }
.dir-controls .chips { flex: 1 1 380px; gap: 5px; }
.dir-controls .chip { height: 30px; padding: 0 10px; font-size: 11px; background: var(--paper); }
.dir-controls .chip span { font-size: 9px; }
.home-sections { gap: 30px; margin-top: 4px; }
.home-section-head { padding-top: 11px; margin-bottom: 12px; }
.home-section-head h2 { font-size: clamp(20px, 2vw, 23px); }
.home-section-head .eyebrow { font-size: 9px; }
.home-section .tool-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; background: transparent; border: 0;
}
.home-section .tool-card {
  min-height: 168px; padding: 17px;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: none;
  transition: transform .16s var(--ease, ease), border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.home-section .tool-card:hover {
  background: var(--field); border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(21, 21, 15, .06);
}
.home-section .tool-glyph { width: 38px; height: 38px; margin-bottom: 18px; border-radius: 5px; font-size: 11px; }
.home-section .tool-card h3 { font-size: 17px; margin-bottom: 6px; }
.home-section .tool-card p {
  font-size: 12.5px; line-height: 1.55; margin-bottom: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.home-section .tool-card-no { top: 16px; right: 16px; font-size: 9px; }
.home-section .tool-card-foot { font-size: 9px; }
.home-section .tool-card:hover .tool-glyph { border-color: var(--ink); background: var(--accent); color: var(--accent-ink); }

.site-header {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

@media (max-width: 1080px) {
  .home-section .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dir-controls { position: static; padding: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .dir-controls .chips { flex-wrap: nowrap; overflow-x: auto; padding: 2px 1px 5px; scrollbar-width: none; }
  .dir-controls .chips::-webkit-scrollbar { display: none; }
  .dir-controls .chip { flex: 0 0 auto; }
  .home-section .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .directory { padding: 18px 0 48px; }
  .dir-head { padding-bottom: 13px; margin-bottom: 11px; }
  .dir-head h1 { font-size: 32px; margin-bottom: 6px; }
  .dir-lede { font-size: 14px; line-height: 1.58; }
  .dir-controls { margin-bottom: 12px; }
  .dir-search { flex-basis: 100%; max-width: none; }
  .dir-controls .chips { flex-basis: 100%; }
  .home-sections { gap: 24px; }
  .home-section-head { align-items: center; padding-top: 9px; }
  .home-section-head h2 { font-size: 20px; }
  .home-section-head .text-link { font-size: 9px; }
  .home-section .tool-grid {
    display: flex; flex-direction: column; gap: 0;
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  }
  .home-section .tool-card {
    display: grid; grid-template-columns: 36px minmax(0, 1fr);
    grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px;
    min-height: 0; padding: 13px 14px;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    box-shadow: none; transform: none;
  }
  .home-section .tool-card:last-child { border-bottom: 0; }
  .home-section .tool-card:hover { transform: none; box-shadow: none; }
  .home-section .tool-glyph { grid-row: 1 / 3; width: 36px; height: 36px; margin: 0; font-size: 10px; }
  .home-section .tool-card h3 { grid-column: 2; margin: 0; font-size: 15px; line-height: 1.35; }
  .home-section .tool-card p {
    grid-column: 2; margin: 0; font-size: 11.5px; line-height: 1.45;
    -webkit-line-clamp: 1;
  }
  .home-section .tool-card-no { display: none; }
  .home-section .tool-card-foot { display: none; }
  .home-section .tool-card:hover .tool-glyph { background: transparent; color: var(--ink); border-color: var(--line-strong); }
}

.dir-controls .chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.dir-controls .chip.is-active span { color: var(--line-strong); }

@media (max-width: 900px) {
  .dir-controls .chips {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
    padding-right: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-section .tool-card,
  .home-section .tool-card:hover { transform: none; }
}

/* Category/related grids share the calmer card surface, while the home directory
   keeps its own list/grid rhythm. */
.tool-grid:not(.dir-grid) {
  gap: 12px;
  background: transparent;
  border: 0;
}
.tool-grid:not(.dir-grid) .tool-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}
.tool-grid:not(.dir-grid) .tool-card:hover {
  background: var(--field);
  border-color: var(--line-strong);
}

/* JSON focus workspace: full viewport, resizable split, queryable */
body.tool-page-json .site-header { display: none !important; }
body.tool-page-json .tool-page { height: 100dvh; min-height: 0; }
body.tool-page-json .workbench {
  height: 100dvh;
  border: 0;
  border-radius: 0;
}
body.tool-page-json .json-bar { height: 44px; min-height: 44px; padding: 0 14px; }
.json-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  min-height: 28px;
  margin-right: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .03em;
  text-decoration: none;
}
.json-back:hover { color: var(--ink); border-color: var(--line-strong); background: var(--paper-2); }
body.tool-page-json .json-workspace {
  grid-template-columns: minmax(220px, var(--json-split, 50%)) 12px minmax(220px, 1fr);
  gap: 0;
}
.json-splitter {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  touch-action: none;
  outline: 0;
}
.json-splitter::before {
  content: "";
  width: 1px;
  height: 100%;
  background: var(--line);
  transition: width .14s ease, background .14s ease;
}
.json-splitter:hover::before,
.json-splitter:focus-visible::before,
body.json-resizing .json-splitter::before {
  width: 3px;
  background: var(--accent);
}
.json-splitter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.json-splitter span { position: absolute; width: 12px; height: 32px; }
body.json-resizing { cursor: col-resize; user-select: none; }
body.json-resizing .json-pane { pointer-events: none; }

.json-querybar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 36px;
  margin: -2px 0 8px;
  padding: 0 0 7px;
  border-bottom: 1px solid var(--line);
}
.json-querybar label {
  flex: none;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}
.json-querybar .input {
  flex: 1 1 220px;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  font-size: 11px;
}
.json-querybar .btn { min-height: 30px; padding: 0 9px; font-size: 11px; }
.json-querybar > span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}
body.tool-page-json .json-toolbar { flex: none; }
#json-stats { color: var(--muted); }
body.tool-page-json .json-statusbar { flex: none; min-height: 16px; }

@media (max-width: 720px) {
  body.tool-page-json .json-bar { height: 40px; min-height: 40px; padding: 0 8px; }
  body.tool-page-json .json-bar .wb-meta { display: none; }
  body.tool-page-json .workbench-body { padding: 7px 8px; }
  body.tool-page-json .json-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
  }
  body.tool-page-json .json-toolbar::-webkit-scrollbar { display: none; }
  body.tool-page-json .json-toolbar > * { flex: none; }
  body.tool-page-json .json-toolbar .spacer { display: none; }
  body.tool-page-json .json-querybar { margin-bottom: 6px; }
  body.tool-page-json .json-querybar > span { display: none; }
  body.tool-page-json .json-querybar .btn { padding-inline: 8px; }
  .json-splitter { display: none; }
  body.tool-page-json .json-workspace { grid-template-columns: 1fr; gap: 8px; }
  body.tool-page-json .json-statusbar { font-size: 9px; gap: 8px; }
  body.tool-page-json .json-statusbar > span:nth-last-child(2) { display: none; }
}

.json-editor.is-dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--accent) 7%, var(--field));
}

.json-splitter span {
  width: 4px;
  height: 38px;
  border-radius: 2px;
  background: var(--line-strong);
  opacity: .7;
  transition: background .14s ease, opacity .14s ease;
}
.json-splitter:hover span,
.json-splitter:focus-visible span,
body.json-resizing .json-splitter span {
  background: var(--accent);
  opacity: 1;
}

@media (max-width: 720px) {
  body.tool-page-json .json-split-hint { display: none; }
}

@media (max-width: 720px) {
  body.tool-page-json .json-toolbar {
    padding-right: 20px;
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  }
}
