/* =========================================================
   Text Tidy — design tokens
   ========================================================= */
:root {
  --bg: #f4f6f3;
  --bg-2: #eaeee9;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #15201c;
  --ink-2: #33403b;
  --muted: #5d6b65;
  --line: #dce3de;
  --line-2: #c9d2cc;

  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfc;

  --c-writing: #1f4fd1;
  --c-writing-soft: #e6ecfc;
  --c-convert: #0b7f63;
  --c-convert-soft: #dff3ec;
  --c-compare: #c8501f;
  --c-compare-soft: #fbe9e0;

  --good: #0b7f63;
  --good-soft: #dcf2ea;
  --bad: #c2352b;
  --bad-soft: #fbe3e0;
  --warn: #a86400;
  --warn-soft: #fbefd9;

  --cat: var(--accent);
  --cat-soft: var(--accent-soft);

  --shadow-sm: 0 1px 2px rgba(20, 32, 28, .06);
  --shadow: 0 1px 2px rgba(20, 32, 28, .05), 0 8px 24px -12px rgba(20, 32, 28, .18);
  --radius: 14px;
  --radius-sm: 9px;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1413;
    --bg-2: #151c1a;
    --surface: #171f1d;
    --surface-2: #1c2522;
    --ink: #e9efec;
    --ink-2: #c9d3cf;
    --muted: #93a39c;
    --line: #27322f;
    --line-2: #34413d;
    --accent: #7b9cff;
    --accent-ink: #0c1330;
    --accent-soft: #1b2644;
    --c-writing: #7b9cff;
    --c-writing-soft: #1b2644;
    --c-convert: #46c9a2;
    --c-convert-soft: #12302a;
    --c-compare: #f08a5d;
    --c-compare-soft: #3a2219;
    --good: #46c9a2;
    --good-soft: #12302a;
    --bad: #ff7b70;
    --bad-soft: #3b1c1a;
    --warn: #f2b454;
    --warn-soft: #3a2b12;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1413;
  --bg-2: #151c1a;
  --surface: #171f1d;
  --surface-2: #1c2522;
  --ink: #e9efec;
  --ink-2: #c9d3cf;
  --muted: #93a39c;
  --line: #27322f;
  --line-2: #34413d;
  --accent: #7b9cff;
  --accent-ink: #0c1330;
  --accent-soft: #1b2644;
  --c-writing: #7b9cff;
  --c-writing-soft: #1b2644;
  --c-convert: #46c9a2;
  --c-convert-soft: #12302a;
  --c-compare: #f08a5d;
  --c-compare-soft: #3a2219;
  --good: #46c9a2;
  --good-soft: #12302a;
  --bad: #ff7b70;
  --bad-soft: #3b1c1a;
  --warn: #f2b454;
  --warn-soft: #3a2b12;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

.cat-writing { --cat: var(--c-writing); --cat-soft: var(--c-writing-soft); }
.cat-convert { --cat: var(--c-convert); --cat-soft: var(--c-convert-soft); }
.cat-compare { --cat: var(--c-compare); --cat-soft: var(--c-compare-soft); }

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; margin: 0; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 650; }
h3 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; }
.mono { font-family: var(--f-mono); }
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 20px; }
@media (max-width: 480px) { .container { padding-inline: 16px; } }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--f-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-size: .8rem; font-weight: 700; letter-spacing: -0.04em; white-space: nowrap; flex: none; }
.brand-mark span { color: var(--c-compare); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-group { position: relative; }
.nav-btn, .nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 9px; border: 0; background: none; cursor: pointer;
  color: var(--ink-2); font-weight: 550; font-size: .95rem; text-decoration: none;
}
.nav-btn:hover, .nav-link:hover, .nav-group:focus-within .nav-btn { background: var(--bg-2); color: var(--ink); }
.nav-btn svg { width: 14px; height: 14px; transition: transform .15s; }
.nav-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(4px);
  min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; opacity: 0; visibility: hidden; transition: opacity .15s, transform .15s, visibility .15s;
}
.nav-group:hover .nav-menu, .nav-group:focus-within .nav-menu, .nav-group.open .nav-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.nav-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .94rem; font-weight: 500; }
.nav-menu a:hover { background: var(--cat-soft); }
.nav-menu a .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--cat-soft); color: var(--cat); display: grid; place-items: center; flex: none; }
.nav-menu a .ico svg { width: 17px; height: 17px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.menu-toggle { display: none; }

/* Mobile drawer */
.drawer { position: fixed; inset: 0; z-index: 80; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 11, .45); opacity: 0; transition: opacity .2s; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); background: var(--surface);
  border-left: 1px solid var(--line); padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); overflow-y: auto;
  transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-section { padding-block: 10px; border-top: 1px solid var(--line); }
.drawer-section h4 { margin: 4px 6px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 650; }
.drawer-section a { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 500; }
.drawer-section a:hover, .drawer-section a[aria-current="page"] { background: var(--cat-soft); }
.drawer-section a .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); flex: none; }

@media (max-width: 860px) {
  .nav { display: none; }
  .menu-toggle { display: inline-grid; }
  .header-actions { margin-left: auto; }
}
.header-actions { display: flex; gap: 8px; }

/* =========================================================
   Page hero (tool pages)
   ========================================================= */
.page-hero { padding-block: 28px 8px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .sep { opacity: .5; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--cat); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--cat); }
.page-hero h1 { margin-top: 8px; }
.lead { margin-top: 10px; color: var(--muted); font-size: 1.06rem; max-width: 64ch; }

/* sibling tool switcher */
.switcher { display: flex; gap: 6px; margin-top: 18px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.switcher::-webkit-scrollbar { display: none; }
.switcher a {
  flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); text-decoration: none; font-size: .88rem; font-weight: 550; white-space: nowrap;
}
.switcher a:hover { border-color: var(--cat); color: var(--cat); }
.switcher a[aria-current="page"] { background: var(--cat); border-color: var(--cat); color: var(--surface); }

/* =========================================================
   Layout
   ========================================================= */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; padding-block: 18px 56px; align-items: start; }
.main-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.side-col { display: flex; flex-direction: column; gap: 20px; position: sticky; top: calc(var(--header-h) + 16px); }
@media (max-width: 1060px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; }
  .side-col .ad-slot { display: none; }
}

/* =========================================================
   Cards & panels
   ========================================================= */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.tool { overflow: hidden; }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tool-head .label { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.btn:hover { border-color: var(--line-2); color: var(--ink); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--cat); border-color: var(--cat); color: var(--surface); }
.btn-primary:hover { background: color-mix(in srgb, var(--cat) 88%, var(--ink)); border-color: transparent; color: var(--surface); }
.btn-lg { height: 44px; padding: 0 20px; font-size: .96rem; border-radius: 11px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
@media (max-width: 520px) {
  .toolbar .btn .txt { display: none; }
  .toolbar .btn:has(.txt) { width: 38px; padding: 0; }
}

.editor {
  display: block; width: 100%; min-height: 260px; resize: vertical; border: 0; outline: none;
  background: var(--surface); color: var(--ink); padding: 16px 18px; font-size: 1.02rem; line-height: 1.7;
}
.editor::placeholder { color: var(--muted); opacity: .8; }
.editor:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--cat-soft); border-radius: 0; }
.editor.tall { min-height: 320px; }
.editor.mono { font-family: var(--f-mono); font-size: .92rem; line-height: 1.65; }

/* status strip under the editor */
.statusbar { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: .84rem; color: var(--muted); }
.statusbar b { font-family: var(--f-mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* big stat tiles */
.stats { --n: 4; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.stat .v.sm { font-size: 1.1rem; padding-top: 6px; }
.stats[data-n="5"] { --n: 5; }
.stats[data-n="6"] { --n: 6; }
@media (max-width: 900px) { .stats[data-n="6"], .stats[data-n="5"] { --n: 3; } }
.stat { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .v { font-family: var(--f-mono); font-size: 1.55rem; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 550; }
.stat.hero .v { color: var(--cat); font-size: 2.1rem; }
@media (max-width: 520px) {
  .stats[data-n] { --n: 2; }
  .stats .stat:last-child:nth-child(odd) { grid-column: span 2; }
  .stat .v { font-size: 1.3rem; }
  .stat.hero .v { font-size: 1.7rem; }
}

.sub-panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.sub-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sub-head h2, .sub-head h3 { font-size: 1.08rem; }
.hint { font-size: .86rem; color: var(--muted); }
.empty { padding: 22px; text-align: center; color: var(--muted); font-size: .92rem; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }

/* form bits */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .flabel { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.input, .select {
  height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 11px; background: var(--surface); color: var(--ink); min-width: 0;
}
.input:focus, .select:focus { outline: none; border-color: var(--cat); box-shadow: 0 0 0 3px var(--cat-soft); }
.options { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--cat); margin: 0; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* progress meters */
.meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.meter { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; display: flex; flex-direction: column; gap: 7px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; }
.meter-top span:first-child { font-weight: 600; color: var(--ink-2); }
.meter-top span:last-child { font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; }
.bar { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--cat); border-radius: inherit; transition: width .25s ease; }
.meter.over .bar i { background: var(--bad); }
.meter.over .meter-top span:last-child { color: var(--bad); font-weight: 600; }

/* data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; }
table.data th.num { text-align: right; }
.density { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.density .bar { width: 60px; }

/* list of sentences / paragraphs */
.rows { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; padding-right: 2px; }
.row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .93rem; }
.row .n { font-family: var(--f-mono); font-size: .78rem; color: var(--muted); padding-top: 2px; }
.row .t { overflow-wrap: anywhere; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 650; white-space: nowrap; background: var(--bg-2); color: var(--ink-2); font-family: var(--f-mono); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.row.long { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.row.vlong { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

/* two-pane editors */
.panes { display: grid; grid-template-columns: 1fr 1fr; }
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); min-height: 50px; }
.pane-head .label { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pane-head .count { font-family: var(--f-mono); font-size: .76rem; color: var(--muted); }
.pane .editor { flex: 1; }
.editor[readonly] { background: var(--surface-2); }
@media (max-width: 760px) {
  .panes { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  .pane .editor { min-height: 200px; }
}
.tool-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* =========================================================
   Grammar checker
   ========================================================= */
.gc-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gc-preview { padding: 16px 18px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 360px; overflow-y: auto; background: var(--surface-2); }
.gc-preview mark { background: none; color: inherit; border-bottom: 2.5px solid var(--bad); cursor: pointer; padding: 0 1px; border-radius: 2px; }
.gc-preview mark.t-grammar { border-color: var(--warn); }
.gc-preview mark.t-style { border-color: var(--accent); }
.gc-preview mark.t-typo { border-color: var(--muted); border-bottom-style: dashed; }
.gc-preview mark:hover, .gc-preview mark.active { background: var(--bad-soft); }
.gc-issues { display: flex; flex-direction: column; gap: 10px; }
.issue { border: 1px solid var(--line); border-left: 4px solid var(--bad); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 90px; transition: box-shadow .2s; }
.issue.t-grammar { border-left-color: var(--warn); }
.issue.t-style { border-left-color: var(--accent); }
.issue.t-typo { border-left-color: var(--muted); }
.issue.flash { box-shadow: 0 0 0 3px var(--cat-soft); }
.issue-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.issue-cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.issue-msg { font-weight: 550; color: var(--ink); font-size: .95rem; }
.issue-ctx { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.issue-ctx b { color: var(--bad); font-weight: 650; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.issue-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg { border: 1px solid color-mix(in srgb, var(--good) 40%, var(--line)); background: var(--good-soft); color: var(--good); font-weight: 650; font-size: .88rem; padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.sugg:hover { background: var(--good); color: var(--surface); }
.linkish { border: 0; background: none; color: var(--muted); font-size: .84rem; cursor: pointer; padding: 5px 6px; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--ink); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { font-size: .86rem; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--accent-soft); color: var(--accent); }

/* =========================================================
   Diff
   ========================================================= */
.diff-out { font-family: var(--f-mono); font-size: .9rem; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); max-height: 560px; overflow: auto; }
.diff-out ins { background: var(--good-soft); color: var(--good); text-decoration: none; border-radius: 3px; padding: 0 1px; }
.diff-out del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; border-radius: 3px; padding: 0 1px; }
.diff-lines { padding: 0; white-space: normal; }
.dl { display: grid; grid-template-columns: 44px 44px 22px minmax(0, 1fr); font-size: .86rem; }
.dl > span { padding: 1px 6px; }
.dl .ln { color: var(--muted); text-align: right; user-select: none; font-size: .76rem; padding-top: 3px; border-right: 1px solid var(--line); }
.dl .sg { text-align: center; user-select: none; color: var(--muted); }
.dl .tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.dl.add { background: color-mix(in srgb, var(--good-soft) 70%, transparent); }
.dl.add .sg, .dl.add .tx { color: var(--good); }
.dl.del { background: color-mix(in srgb, var(--bad-soft) 70%, transparent); }
.dl.del .sg, .dl.del .tx { color: var(--bad); }
.dl.add ins { background: color-mix(in srgb, var(--good) 22%, transparent); color: inherit; }
.dl.del del { background: color-mix(in srgb, var(--bad) 22%, transparent); color: inherit; }
.dl.gap .tx { color: var(--muted); font-style: italic; }
@media (max-width: 520px) { .dl { grid-template-columns: 34px 34px 18px minmax(0, 1fr); } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* =========================================================
   List compare
   ========================================================= */
.results3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .results3 { grid-template-columns: 1fr; } }
.rcol { border: 1px solid var(--line); border-radius: var(--radius-sm); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.rcol-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rcol-head h3 { font-size: .95rem; display: flex; gap: 8px; align-items: center; }
.rcol-head .sw { width: 10px; height: 10px; border-radius: 3px; }
.rcol ul { list-style: none; margin: 0; padding: 6px; max-height: 320px; overflow-y: auto; font-size: .92rem; }
.rcol li { padding: 5px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.rcol li:nth-child(odd) { background: var(--surface-2); }
.rcol .none { color: var(--muted); font-style: italic; padding: 14px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .8rem; }

/* =========================================================
   Article / content
   ========================================================= */
.content { padding: clamp(20px, 3vw, 34px); display: flex; flex-direction: column; gap: 14px; }
.content h2 { margin-top: 10px; }
.content h2:first-child { margin-top: 0; }
.content h3 { margin-top: 6px; }
.content p, .content li { color: var(--ink-2); max-width: 70ch; }
.content ul, .content ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.content strong { color: var(--ink); }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; background: var(--surface); }
.faq summary { cursor: pointer; padding: 13px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-mono); color: var(--muted); font-size: 1.1rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding-bottom: 14px; }

/* related tools & sidebar */
.side-card { padding: 16px; }
.side-card h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 8px; font-family: var(--f-body); font-weight: 700; }
.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-list a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; text-decoration: none; color: var(--ink); font-size: .93rem; font-weight: 550; }
.side-list a:hover { background: var(--bg-2); }
.side-list a[aria-current="page"] { background: var(--cat-soft); color: var(--cat); }
.side-list .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--cat-soft); color: var(--cat); flex: none; }
.side-list .ico svg { width: 16px; height: 16px; }

/* =========================================================
   Tool cards (home + related)
   ========================================================= */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tcard {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tcard:hover { border-color: var(--cat); transform: translateY(-2px); box-shadow: var(--shadow); }
.tcard .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--cat-soft); color: var(--cat); display: grid; place-items: center; }
.tcard .ico svg { width: 22px; height: 22px; }
.tcard h3 { font-size: 1.05rem; }
.tcard p { font-size: .9rem; color: var(--muted); line-height: 1.5; }
.tcard .go { position: absolute; top: 18px; right: 18px; color: var(--line-2); transition: color .15s, transform .15s; }
.tcard .go svg { width: 18px; height: 18px; }
.tcard:hover .go { color: var(--cat); transform: translateX(2px); }
.tcard .tag { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); margin-top: auto; }

/* =========================================================
   Home
   ========================================================= */
.home-hero { padding-block: clamp(36px, 6vw, 72px) 28px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; }
.home-hero h1 { font-size: clamp(2.2rem, 1.4rem + 3.6vw, 3.9rem); font-weight: 750; letter-spacing: -0.035em; }
.home-hero h1 em { font-style: normal; color: var(--c-compare); position: relative; white-space: nowrap; }
.home-hero h1 em::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: .08em; height: .16em; background: var(--c-compare); opacity: .22; border-radius: 3px; }
.home-hero .lead { font-size: 1.12rem; margin-top: 16px; }
.search { position: relative; margin-top: 24px; max-width: 520px; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 52px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px 0 46px; font-size: 1rem; box-shadow: var(--shadow-sm); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.hero-points span { display: inline-flex; gap: 6px; align-items: center; }
.hero-points svg { width: 16px; height: 16px; color: var(--good); }

/* live demo card in hero */
.demo { padding: 0; overflow: hidden; }
.demo-head { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); align-items: center; }
.demo-head i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.demo-head span { margin-left: 8px; font-size: .78rem; color: var(--muted); font-family: var(--f-mono); }
.demo textarea { width: 100%; border: 0; resize: none; min-height: 150px; padding: 16px; background: var(--surface); color: var(--ink); outline: none; font-size: 1rem; line-height: 1.6; }
.demo .stat .v { font-size: 1.35rem; }
.demo .stat .k { font-size: .74rem; }
.demo .stat { padding: 12px 14px; }
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; gap: 28px; }
}


.cat-section[data-cat] .cards { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
.cat-section { padding-block: 22px; display: flex; flex-direction: column; gap: 16px; }
.cat-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cat-title p { color: var(--muted); font-size: .95rem; margin-top: 4px; }
.cat-title .count { font-family: var(--f-mono); font-size: .8rem; color: var(--cat); background: var(--cat-soft); padding: 4px 10px; border-radius: 99px; font-weight: 600; }
.no-results { display: none; padding: 30px; text-align: center; color: var(--muted); }

.features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding-block: 30px 10px; }
.feature { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.feature .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; color: var(--ink); }
.feature .ico svg { width: 20px; height: 20px; }
.feature h3 { font-size: 1rem; }
.feature p { font-size: .9rem; color: var(--muted); line-height: 1.5; }
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }

/* =========================================================
   Ads
   ========================================================= */
.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-width: 0; }
.ad-slot .ad-label { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); opacity: .8; }
.ad-slot ins { display: block; width: 100%; }
.ad-slot.ad-top ins, .ad-slot.ad-top .ad-ph { min-height: 100px; }
.ad-slot.ad-incontent ins, .ad-slot.ad-incontent .ad-ph { min-height: 250px; }
.ad-slot.ad-sidebar ins, .ad-slot.ad-sidebar .ad-ph { min-height: 600px; }
.ad-ph {
  width: 100%; border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); display: grid; place-items: center; text-align: center;
  color: var(--muted); font-size: .8rem; font-family: var(--f-mono); padding: 12px;
  background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--bg-2) 60%, transparent) 10px 20px);
}
@media (max-width: 520px) {
  .ad-slot.ad-top ins, .ad-slot.ad-top .ad-ph { min-height: 60px; }
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 40px calc(28px + env(safe-area-inset-bottom, 0px)); margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 28px; }
.footer-grid h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.footer-grid a { color: var(--ink-2); text-decoration: none; font-size: .92rem; }
.footer-grid a:hover { color: var(--ink); text-decoration: underline; }
.footer-about p { color: var(--muted); font-size: .9rem; margin-top: 10px; max-width: 34ch; }
.footer-bottom { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .84rem; color: var(--muted); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-about { grid-column: 1 / -1; } }

/* static pages */
.prose-page { max-width: 820px; margin-inline: auto; padding-block: 12px 56px; }
.prose-page .content { gap: 12px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 11px; font-size: .9rem; font-weight: 550;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; display: flex; gap: 8px; align-items: center; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 16px; height: 16px; color: var(--c-convert); }

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