/* ==========================================================================
   Site styles. Colors are variables, so changing --accent re-themes the site.
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --text: #141726;
  --muted: #5b6275;
  --border: #e2e5ee;
  --border-strong: #cdd2df;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --link: #4338ca;
  --ok: #12804c;
  --ok-soft: #e5f6ed;
  --danger: #c9302c;
  --danger-soft: #fdeceb;
  --warn: #8a5a00;
  --warn-soft: #fff5dc;
  --c-pdf: #e5484d;
  --c-image: #0e9384;
  --c-text: #3e63dd;
  --c-calc: #e2700b;
  --c-dev: #8e4ec6;
  --chart-a: #c4c8f5;
  --chart-b: #4f46e5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px -14px rgba(16, 24, 40, .16);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f15;
    --surface: #161922;
    --surface-2: #1d212c;
    --text: #eceef5;
    --muted: #a1a8bb;
    --border: #272c39;
    --border-strong: #3a4152;
    --accent: #5b54e8;
    --accent-hover: #6d67f0;
    --accent-soft: #23234a;
    --link: #a9a4ff;
    --ok: #4cc38a;
    --ok-soft: #133324;
    --danger: #ff7b72;
    --danger-soft: #3a1714;
    --warn: #f0c060;
    --warn-soft: #33270b;
    --c-pdf: #ff6b6f;
    --c-image: #2cc4b2;
    --c-text: #7d9bff;
    --c-calc: #ff9a40;
    --c-dev: #c08bf0;
    --chart-a: #3a3d6b;
    --chart-b: #8b85ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg, canvas { max-width: 100%; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.75rem); font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .05em .35em; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.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; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 860px; }
@media (min-width: 720px) { .container { padding: 0 24px; } }

.skip-link { position: absolute; left: 8px; top: -60px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #d946ef); box-shadow: 0 4px 12px -4px rgba(99, 102, 241, .6); }
.logo-mark svg { width: 20px; height: 20px; fill: #fff; }
.site-nav { margin-left: auto; display: flex; gap: 4px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (prefers-color-scheme: dark) { .site-nav a[aria-current="page"] { color: var(--link); } }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 10px; width: 42px; height: 42px; place-items: center; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: grid; }
  .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 2px; padding: 8px 16px 16px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; font-size: 1rem; }
}

/* ---------- Buttons ---------- */
.btn { --b: var(--border-strong); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 11px; border: 1px solid var(--b); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: .95rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { --b: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { --b: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-lg { min-height: 50px; padding: 0 26px; font-size: 1.02rem; border-radius: 13px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .88rem; border-radius: 9px; }
.btn.copied { --b: var(--ok); color: var(--ok); }
.btn-primary.copied { background: var(--ok); color: #fff; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn .icon { width: 18px; height: 18px; }

/* ---------- Home hero ---------- */
.hero { padding: 56px 0 36px; text-align: center; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); }
.grad { background: linear-gradient(120deg, #6366f1, #a855f7 60%, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 640px; margin: 0 auto 1.4em; }
.search { position: relative; display: block; max-width: 560px; margin: 0 auto; }
.search .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 56px; padding: 0 20px 0 50px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 1.05rem; box-shadow: var(--shadow); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; padding: 0; margin: 22px 0 0; color: var(--muted); font-size: .92rem; font-weight: 600; }
.chips li { display: inline-flex; align-items: center; gap: 6px; }
.chips .icon { width: 17px; height: 17px; color: var(--ok); }

/* ---------- Tool grid ---------- */
.cat-section { margin: 0 0 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 1.3rem; }
.section-head h2 .tool-icon { width: 34px; height: 34px; border-radius: 10px; }
.section-head h2 .tool-icon .icon { width: 18px; height: 18px; }
.section-head a { font-weight: 600; font-size: .92rem; text-decoration: none; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tool-link { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.tool-text { display: flex; flex-direction: column; min-width: 0; }
.tool-text strong { font-size: 1rem; line-height: 1.3; }
.tool-text span { font-size: .88rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.tool-icon { --c: var(--accent); flex-shrink: 0; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.tool-icon .icon { width: 22px; height: 22px; }
.c-pdf { --c: var(--c-pdf); } .c-image { --c: var(--c-image); } .c-text { --c: var(--c-text); } .c-calc { --c: var(--c-calc); } .c-dev { --c: var(--c-dev); }
.search-empty { text-align: center; color: var(--muted); padding: 32px 0 48px; }

/* ---------- Tool page ---------- */
.tool-hero { padding: 36px 0 22px; text-align: center; }
.tool-hero .lead { margin-bottom: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.tool-wrap { max-width: 900px; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; position: relative; }
@media (min-width: 720px) { .tool-card { padding: 28px; } }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--muted); font-size: .9rem; margin: 14px 0 0; }
.privacy-note .icon { width: 17px; height: 17px; color: var(--ok); }

/* Dropzone */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; min-height: 270px; padding: 32px 16px; border: 2px dashed var(--border-strong); border-radius: 16px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dragging .dropzone { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .dz-icon { color: var(--link); } }
.dz-icon .icon { width: 28px; height: 28px; }
.dz-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }
.dz-hint { color: var(--muted); font-size: .88rem; margin: 12px 0 0; }
.tool-card.dragging::after { content: "Drop files to add them"; position: absolute; inset: 0; display: grid; place-items: center; border-radius: 22px; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent-soft) 92%, transparent); color: var(--accent); font-weight: 700; font-size: 1.1rem; pointer-events: none; }

/* Workspace */
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ws-title { font-size: 1.05rem; margin: 0; }
.file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; max-height: 420px; overflow-y: auto; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.file-row.has-error { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); background: var(--danger-soft); }
.file-row.has-error .file-meta { color: var(--danger); }
.file-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex-shrink: 0; }
.file-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { color: var(--muted); font-size: .84rem; }
.file-actions { display: flex; gap: 2px; }
.busy .file-list, .busy .options, .busy .ws-head { pointer-events: none; opacity: .55; }

/* Options & form fields */
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 20px; padding: 18px; margin-bottom: 20px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-wide { grid-column: 1 / -1; }
.field > label, .field > legend { font-weight: 650; font-size: .92rem; padding: 0; }
.field legend { margin-bottom: 6px; }
.help { color: var(--muted); font-size: .84rem; margin: 0; }
.note { display: flex; gap: 8px; color: var(--muted); font-size: .88rem; margin: 0; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"]:not(.search input), input[type="password"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; margin: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
input[type="color"] { width: 48px; height: 40px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
output { font-weight: 700; color: var(--accent); }
@media (prefers-color-scheme: dark) { output { color: var(--link); } }
.range-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: .95rem; cursor: pointer; user-select: none; }
.checks { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.color-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input-group input, .input-group select { border: 0; border-radius: 0; box-shadow: none !important; min-width: 0; flex: 1; }
.addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); color: var(--muted); font-size: .92rem; font-weight: 600; white-space: nowrap; }

/* Segmented control (radio buttons styled as tabs) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.seg label, .seg button { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: 9px; font: inherit; font-weight: 650; font-size: .9rem; color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg label:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.options .seg { background: var(--surface); }
.options .seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
@media (prefers-color-scheme: dark) { .options .seg label:has(input:checked) { color: var(--link); } }

/* Choice cards (big radio buttons) */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.choice input { margin-top: 3px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-body { display: flex; flex-direction: column; gap: 2px; }
.choice-body strong { font-size: .95rem; }
.choice-body small { color: var(--muted); font-size: .84rem; line-height: 1.4; }

/* Actions, progress, results */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hint { color: var(--muted); font-size: .9rem; }
.progress { margin-top: 22px; }
.progress-track { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #a855f7); transition: width .25s ease; }
.progress-text { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.results { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.results-title { display: flex; align-items: center; gap: 12px; }
.results-title strong { font-size: 1.1rem; }
.results-title p { margin: 0; color: var(--muted); font-size: .92rem; }
.ok-badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); flex-shrink: 0; }
.notice { flex-basis: 100%; display: flex; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: .94rem; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.result-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.result-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; border-bottom: 1px solid var(--border); }
.result-icon { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); color: var(--c-pdf); border-bottom: 1px solid var(--border); }
.result-icon .icon { width: 36px; height: 36px; }
.result-info { padding: 10px 12px 4px; min-width: 0; }
.result-card .btn { margin: 6px 12px 12px; }
.result-grid.single { grid-template-columns: minmax(0, 340px); }

/* Toasts */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: #1f2333; color: #fff; font-size: .94rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); transition: opacity .3s, transform .3s; animation: toast-in .25s ease; }
.toast-error { background: #b42318; }
.toast.hide { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Page content (how-to, FAQ) ---------- */
.content { padding-top: 40px; padding-bottom: 8px; }
.content section { margin-bottom: 40px; }
.content p { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding: 14px 16px 14px 60px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
@media (prefers-color-scheme: dark) { .steps li::before { color: var(--link); } }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.feature { display: flex; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.feature > .icon { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
@media (prefers-color-scheme: dark) { .feature > .icon { color: var(--link); } }
.feature h3 { margin: 0 0 4px; font-size: 1rem; }
.feature p { margin: 0; font-size: .92rem; color: var(--muted); }
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 18px; }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0; font-weight: 650; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--muted); line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); }
.related { padding-bottom: 32px; }
.home-about { padding-top: 16px; }
.other-cats { margin: 40px 0; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { padding: 8px 16px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 600; font-size: .94rem; }
.pill:hover { border-color: var(--border-strong); }
.prose { padding-bottom: 48px; }
.prose h2 { font-size: 1.3rem; margin-top: 1.8em; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }

/* ---------- Ads ---------- */
.ad { margin: 28px auto; text-align: center; min-height: 100px; }
.ad-label { display: block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ad-preview { display: grid; place-items: center; height: 110px; margin: 28px auto; border: 2px dashed var(--border-strong); border-radius: 14px; color: var(--muted); font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: repeating-linear-gradient(-45deg, transparent 0 10px, var(--surface-2) 10px 20px); }
.content .ad-preview, .content .ad { margin: 0 0 40px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 40px; padding: 48px 0 28px; background: var(--surface); border-top: 1px solid var(--border); font-size: .92rem; }
.footer-top { display: grid; gap: 32px; }
@media (min-width: 900px) { .footer-top { grid-template-columns: 260px 1fr; gap: 48px; } }
.footer-brand p { color: var(--muted); margin-top: 12px; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; }
.footer-col h2 { font-size: .95rem; margin-bottom: 10px; }
.footer-col h2 a { color: var(--text); text-decoration: none; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-col a { color: var(--muted); text-decoration: none; }
.footer-col a:hover, .footer-bottom a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); }
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-bottom a { color: var(--muted); text-decoration: none; }
.footer-bottom p { margin: 0; }

/* ==========================================================================
   Tool-specific styles
   ========================================================================== */

/* Text tools */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 720px) { .stats-grid { grid-template-columns: repeat(6, 1fr); } }
.stat { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; min-width: 0; }
.stat-value { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.big-textarea { min-height: 300px; font-size: 1.02rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar .muted { font-size: .9rem; }
.keywords { margin-top: 20px; }
.keywords h3 { font-size: .95rem; margin-bottom: 10px; }
.kw-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.kw-list li { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: .9rem; }
.kw-list b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.case-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.two-col { display: grid; gap: 16px; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }
.two-col .field textarea { min-height: 320px; font-family: var(--mono); font-size: .92rem; }
.inline-options { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 14px 16px; margin: 16px 0 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }

/* Calculators */
.calc { display: grid; gap: 24px; }
@media (min-width: 820px) { .calc { grid-template-columns: 1.05fr 1fr; align-items: start; } }
.calc-form { display: grid; gap: 16px; }
.calc-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-result { padding: 22px; border-radius: 18px; background: linear-gradient(160deg, var(--accent-soft), var(--surface-2)); border: 1px solid var(--border); }
.result-label { margin: 0; color: var(--muted); font-weight: 650; font-size: .92rem; }
.result-big { margin: 2px 0 16px; font-size: clamp(2rem, 6vw, 2.7rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-list { margin: 0; display: grid; gap: 0; }
.result-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.result-list dt { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.result-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.stack-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface); margin: 0 0 16px; border: 1px solid var(--border); }
.stack-bar span { height: 100%; transition: width .3s ease; }
.calc-empty { color: var(--muted); }
.disclaimer { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }
.schedule { margin-top: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.schedule summary { cursor: pointer; padding: 14px 18px; font-weight: 650; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); max-height: 480px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 16px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 650; color: var(--muted); font-size: .84rem; }
.chart { margin-top: 24px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar-a { fill: var(--chart-a); }
.chart .bar-b { fill: var(--chart-b); }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Percentage calculator */
.pct-list { display: grid; gap: 14px; }
.pct-card { padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }
.pct-card h2 { font-size: 1rem; margin: 0 0 12px; }
.pct-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 1.02rem; }
.pct-row input { width: 130px; flex: 0 1 130px; }
.pct-answer { margin: 14px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.pct-answer strong { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pct-answer span { color: var(--muted); font-size: .9rem; }
.up { color: var(--ok); } .down { color: var(--danger); }

/* Age calculator */
.age-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
@media (min-width: 720px) { .age-stats { grid-template-columns: repeat(4, 1fr); } }
.age-facts { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.age-facts li { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }

/* QR code */
.qr-layout { display: grid; gap: 24px; }
@media (min-width: 780px) { .qr-layout { grid-template-columns: 1fr 300px; } }
.qr-form { display: grid; gap: 16px; align-content: start; }
.qr-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); align-self: start; }
.qr-preview canvas { width: 100%; max-width: 260px; height: auto; aspect-ratio: 1; border-radius: 10px; image-rendering: pixelated; background: #fff; box-shadow: var(--shadow-sm); }
.qr-preview .actions { justify-content: center; }
.qr-msg { margin: 0; font-size: .88rem; text-align: center; color: var(--warn); }

/* Password generator */
.pw-output { display: flex; gap: 8px; align-items: stretch; }
.pw-output input { flex: 1; min-width: 0; font-family: var(--mono); font-size: clamp(1rem, 3vw, 1.3rem) !important; min-height: 56px !important; letter-spacing: .02em; }
.pw-output .btn { min-height: 56px; }
.strength { display: flex; align-items: center; gap: 12px; margin: 14px 0 20px; }
.strength-track { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.strength-fill { height: 100%; width: 0; border-radius: 99px; transition: width .25s, background .25s; }
.strength-label { font-weight: 700; font-size: .92rem; min-width: 90px; text-align: right; }
.s-weak .strength-fill { background: var(--danger); } .s-weak .strength-label { color: var(--danger); }
.s-fair .strength-fill { background: #e2a20b; } .s-fair .strength-label { color: var(--warn); }
.s-strong .strength-fill, .s-very .strength-fill { background: var(--ok); } .s-strong .strength-label, .s-very .strength-label { color: var(--ok); }

/* JSON formatter */
.code-output { margin: 0; min-height: 320px; max-height: 560px; overflow: auto; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); font: .9rem/1.55 var(--mono); white-space: pre; tab-size: 4; }
.code-output:empty::before { content: "Formatted JSON will appear here"; color: var(--muted); font-family: var(--font); }
.j-key { color: #8e4ec6; } .j-str { color: #12804c; } .j-num { color: #c2570c; } .j-bool { color: #3e63dd; } .j-null { color: #c9302c; }
@media (prefers-color-scheme: dark) { .j-key { color: #c99cf7; } .j-str { color: #7ee2a8; } .j-num { color: #ffb172; } .j-bool { color: #8fb0ff; } .j-null { color: #ff8f88; } }
.status { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; font-size: .92rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.err { background: var(--danger-soft); color: var(--danger); }

/* Crop */
.crop-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.crop-size { color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.crop-stage { display: flex; justify-content: center; padding: 16px; margin-bottom: 18px; border-radius: 14px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; border: 1px solid var(--border); }
.crop-wrap { position: relative; display: inline-block; overflow: hidden; line-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.crop-img { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; pointer-events: none; }
.crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(10, 12, 20, .55); outline: 2px solid #fff; cursor: move; touch-action: none; }
.crop-grid { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
  linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
/* Corner brackets sit inside the box so they never get clipped at the image edge. */
.crop-handle { position: absolute; width: 26px; height: 26px; border: 0 solid #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,.5)); }
.crop-handle::before { content: ""; position: absolute; inset: -10px; }
.crop-handle[data-h="nw"] { left: -3px; top: -3px; border-left-width: 5px; border-top-width: 5px; cursor: nwse-resize; }
.crop-handle[data-h="ne"] { right: -3px; top: -3px; border-right-width: 5px; border-top-width: 5px; cursor: nesw-resize; }
.crop-handle[data-h="sw"] { left: -3px; bottom: -3px; border-left-width: 5px; border-bottom-width: 5px; cursor: nesw-resize; }
.crop-handle[data-h="se"] { right: -3px; bottom: -3px; border-right-width: 5px; border-bottom-width: 5px; cursor: nwse-resize; }
.crop-box:focus-visible { outline: 3px solid var(--accent); border-radius: 0; }

/* PDF page previews (Rotate PDF, Split PDF) */
.thumb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.thumb-toolbar .spacer { flex: 1; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; max-height: 600px; overflow-y: auto; padding: 4px; margin: -4px; }
.thumb { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
button.thumb:hover, .thumb:has(.thumb-main:hover) { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.thumb.selected, .thumb.turned { border-color: var(--accent); background: var(--accent-soft); }
.thumbs.static .thumb { cursor: default; }
.thumbs.static .thumb:hover { box-shadow: none; }
.thumb-main { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.thumb-frame { display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: var(--surface-2); }
.thumb-frame canvas { display: block; height: auto; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); transform: rotate(var(--turn, 0deg)); transition: transform .25s ease; }
.thumb-loading { width: 62%; aspect-ratio: 1 / 1.41; border-radius: 4px; background: var(--border); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.thumb-bar { display: flex; align-items: center; gap: 2px; min-height: 30px; }
.thumb-num { font-weight: 700; font-size: .88rem; padding-left: 2px; }
.thumb-angle, .thumb-badge { margin-left: auto; font-size: .76rem; font-weight: 750; color: var(--accent); white-space: nowrap; }
.thumb-angle { margin-right: 2px; }
.thumb-bar .icon-btn { width: 30px; height: 30px; }
@media (prefers-color-scheme: dark) { .thumb-angle, .thumb-badge { color: var(--link); } }

/* Category page tips */
.tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tips li { position: relative; padding: 14px 16px 14px 46px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.tips li::before { content: "💡"; position: absolute; left: 16px; top: 13px; }
