/* =========================================================================
   ToolHub — shared stylesheet
   Aesthetic: calm "instrument panel". Neutral slate surfaces, a single
   trust-green accent, monospace eyebrows/labels for a technical identity.
   ========================================================================= */

:root {
  /* light theme (default) */
  --bg: #fbfcfd;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #eaeef2;
  --border: #e2e6ec;
  --border-strong: #cfd6df;
  --text: #16202b;
  --muted: #5c6673;
  --accent: #0ca678;
  --accent-hover: #099268;
  --accent-weak: rgba(12, 166, 120, .10);
  --accent-ink: #075c44;
  --danger: #e03131;
  --danger-weak: rgba(224, 49, 49, .10);
  --warn: #e8a317;
  --ring: rgba(12, 166, 120, .35);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px -4px rgba(16, 24, 40, .12);
  --shadow-lg: 0 18px 48px -12px rgba(16, 24, 40, .22);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --maxw: 1140px;
  --header-h: 62px;
}

[data-theme="dark"] {
  --bg: #0c1117;
  --surface: #151b23;
  --surface-2: #1b222c;
  --surface-3: #232b36;
  --border: #29313d;
  --border-strong: #3a4452;
  --text: #e6edf3;
  --muted: #93a1b1;
  --accent: #2bd4a0;
  --accent-hover: #4fdcb0;
  --accent-weak: rgba(43, 212, 160, .12);
  --accent-ink: #7defc7;
  --danger: #ff6b6b;
  --danger-weak: rgba(255, 107, 107, .12);
  --ring: rgba(43, 212, 160, .40);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 20px 52px -14px rgba(0, 0, 0, .7);
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

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

h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .4em; font-weight: 750; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.85rem); }
h3 { font-size: 1.15rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 .6rem;
  display: inline-flex;
  align-items: center;
  gap: .5em;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }

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

/* ---------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; font-size: 1.15rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand .logo {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--accent); color: #fff; border-radius: 9px; box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .brand .logo { color: #06231a; }
.brand .logo svg { width: 18px; height: 18px; }

.header-search { flex: 1; max-width: 460px; position: relative; }
.header-search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text); font-size: .92rem; font-family: inherit;
}
.header-search input:focus { border-color: var(--accent); background: var(--surface); }
.header-search .s-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.header-search .s-results {
  position: absolute; top: 48px; left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; max-height: 60vh; overflow: auto;
}
.header-search .s-results.open { display: block; }
.s-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); }
.s-item:hover, .s-item.active { background: var(--accent-weak); color: var(--text); }
.s-item .s-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); flex: none; }
.s-item .s-ico svg { width: 16px; height: 16px; }
.s-item .s-name { font-weight: 600; font-size: .9rem; }
.s-item .s-cat { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.s-empty { padding: 16px; color: var(--muted); text-align: center; font-size: .9rem; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { color: var(--muted); font-weight: 600; font-size: .9rem; padding: 8px 12px; border-radius: var(--r-sm); }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 10px; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .menu-btn { display: grid; }
  .header-search { max-width: none; }
}

/* Mobile nav sheet */
.mobile-nav { display: none; border-bottom: 1px solid var(--border); background: var(--surface); }
.mobile-nav.open { display: block; }
.mobile-nav .wrap { padding: 12px 20px; display: grid; gap: 2px; }
.mobile-nav a { color: var(--text); padding: 10px 12px; border-radius: var(--r-sm); font-weight: 600; }
.mobile-nav a:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------ Hero */
.hero { padding: 56px 0 34px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 44px; align-items: center; }
.hero p.lede { font-size: 1.12rem; color: var(--muted); max-width: 46ch; margin: 0 0 24px; }
.hero .cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stat-row { display: flex; gap: 26px; margin-top: 30px; }
.hero-stat b { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.hero-stat span { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* Live demo card in hero — the "signature" element */
.demo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.demo-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.demo-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.demo-head .demo-title { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-left: 6px; }
.demo-body { padding: 18px; }
.demo-body textarea { width: 100%; resize: vertical; }
.demo-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.demo-metric { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; text-align: center; }
.demo-metric b { display: block; font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.demo-metric span { font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.demo-note { font-family: var(--font-mono); font-size: .68rem; color: var(--muted); margin: 12px 0 0; display: flex; align-items: center; gap: 6px; }
.demo-note svg { width: 13px; height: 13px; color: var(--accent); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero { padding: 34px 0 20px; }
}

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: .92rem; font-weight: 650; line-height: 1;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; transition: .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .btn-primary { color: #05261c; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
[data-theme="dark"] .btn-primary:hover { color: #05261c; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: .8rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --------------------------------------------------------- Section frame */
.section { padding: 40px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.section-head .link-more { font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

/* ------------------------------------------------------------ Tool cards */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; }
.tool-card {
  position: relative; display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px; transition: .16s ease; color: var(--text); overflow: hidden;
}
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow); color: var(--text); transform: translateY(-2px); }
.tool-card .tc-ico { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.tool-card .tc-ico svg { width: 22px; height: 22px; }
.tool-card h3 { font-size: 1.02rem; margin: 0 0 5px; }
.tool-card p { margin: 0; color: var(--muted); font-size: .87rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool-card .tc-cat {
  position: absolute; top: 16px; right: 16px; font-family: var(--font-mono);
  font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); padding: 3px 7px; border-radius: 20px; border: 1px solid var(--border);
}

/* Category tiles */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-tile { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 15px 16px; color: var(--text); transition: .15s ease; }
.cat-tile:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-tile .ct-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; flex: none; }
.cat-tile .ct-ico svg { width: 20px; height: 20px; }
.cat-tile b { display: block; font-size: .96rem; }
.cat-tile span { font-family: var(--font-mono); font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ----------------------------------------------------------- Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em; color: var(--muted); padding: 20px 0 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }

/* ------------------------------------------------------- Tool page layout */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: start; padding: 22px 0 60px; }
.tool-head { margin-bottom: 22px; }
.tool-head .eyebrow a { color: var(--accent); }
.tool-head p.intro { font-size: 1.05rem; color: var(--muted); max-width: 62ch; margin: 10px 0 0; }
.tool-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); }

.content-block { margin-top: 44px; }
.content-block h2 { margin-bottom: 16px; }
.howto-list { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 14px; }
.howto-list li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; }
.howto-list li::before { content: counter(step, decimal-leading-zero); font-family: var(--font-mono); font-size: .82rem; font-weight: 700; color: var(--accent); background: var(--accent-weak); border-radius: 9px; width: 34px; height: 34px; display: grid; place-items: center; }
.howto-list li b { display: block; }
.howto-list li p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; }
.feature-card b { display: block; margin-bottom: 4px; }
.feature-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.faq-item { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 16px 18px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-family: var(--font-mono); color: var(--accent); font-size: 1.3rem; transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 18px 16px; color: var(--muted); margin: 0; }

.related-side { position: sticky; top: calc(var(--header-h) + 18px); }
.related-side h2 { font-size: .78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 12px; }
.related-list { display: grid; gap: 8px; }
.related-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
.related-item:hover { border-color: var(--accent); color: var(--text); }
.related-item .ri-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; flex: none; }
.related-item .ri-ico svg { width: 15px; height: 15px; }
.related-item b { font-size: .87rem; font-weight: 600; }

.privacy-note { display: flex; align-items: flex-start; gap: 11px; background: var(--accent-weak); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--r); padding: 13px 15px; margin-top: 26px; font-size: .9rem; color: var(--accent-ink); }
.privacy-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent); }

@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; gap: 26px; }
  .related-side { position: static; }
  .tool-panel { padding: 18px; }
}

/* -------------------------------------------------- Form / tool controls */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: .82rem; font-weight: 650; margin-bottom: 6px; }
.io {
  width: 100%; font-family: inherit; font-size: .94rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 13px; transition: border-color .15s;
}
textarea.io { resize: vertical; min-height: 44px; line-height: 1.5; }
.io:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }
.io[readonly] { background: var(--surface-3); }
.io.mono, .mono { font-family: var(--font-mono); font-size: .88rem; }
.io-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.io-head label { font-size: .82rem; font-weight: 650; }
.io-inline { font-family: inherit; font-size: .88rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; }
.io-inline.wide { min-width: 220px; }
.io-inline:focus { border-color: var(--accent); outline: none; }
.io-color { width: 54px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; vertical-align: middle; }
.io-color.wide { width: 100%; height: 44px; }

.tool-actions { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; flex-wrap: wrap; }
.tool-actions.wrap { row-gap: 8px; }
.seg { display: inline-flex; align-items: center; gap: 8px; }
.seg.grow { flex: 1; min-width: 180px; }
.mono-label { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; color: var(--text); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.range { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; background: var(--surface-3); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 3px solid var(--surface); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 3px solid var(--surface); }

.status { min-height: 20px; font-size: .88rem; margin: -6px 0 12px; }
.status.err { color: var(--danger); }
.status.ok { color: var(--accent); }
.result { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 13px; min-height: 44px; white-space: pre-wrap; word-break: break-word; overflow: auto; margin: 0; font-size: .86rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.fs { border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin: 0 0 16px; }
.fs legend { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 8px; }

/* Stat grids */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin: 6px 0 16px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 10px; text-align: center; }
.stat-num { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.stat-label { font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.result-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; margin-top: 8px; }
.big-number { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; text-align: center; margin-bottom: 12px; }
.big-number small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.badge { display: inline-block; font-family: var(--font-mono); font-size: .78rem; padding: 5px 12px; border-radius: 20px; background: var(--accent-weak); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); text-transform: uppercase; letter-spacing: .06em; }
.badge.ok { background: var(--accent-weak); color: var(--accent-ink); }
.badge.bad { background: var(--danger-weak); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* Calculator inline rows */
.calc-block { padding: 16px 0; border-bottom: 1px dashed var(--border); }
.calc-block:last-of-type { border-bottom: none; }
.calc-h { font-size: 1rem; margin-bottom: 10px; }
.calc-h .hl { color: var(--accent); }
.inline-calc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .92rem; }
.inline-calc .io-inline { width: 100px; }
.inline-calc .io-inline.wide { width: 220px; }
.eq { color: var(--muted); font-weight: 700; }
.calc-out { font-weight: 800; font-size: 1.2rem; color: var(--accent); min-width: 60px; }

/* BMI scale + bars */
.bmi-scale { position: relative; height: 10px; border-radius: 6px; overflow: hidden; display: flex; margin: 14px 0 8px; }
.bmi-scale .s { height: 100%; }
.bmi-scale .under { flex: 18.5; background: #4dabf7; }
.bmi-scale .normal { flex: 6.5; background: var(--accent); }
.bmi-scale .over { flex: 5; background: var(--warn); }
.bmi-scale .obese { flex: 10; background: var(--danger); }
.bmi-scale .marker { position: absolute; top: -3px; width: 3px; height: 16px; background: var(--text); border-radius: 2px; transition: left .3s ease; }
.bar-split { display: flex; height: 14px; border-radius: 8px; overflow: hidden; margin: 14px 0 8px; background: var(--surface-3); }
.bar-split .bar-p { background: var(--accent); }
.bar-split .bar-i { background: var(--warn); }
.key { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: middle; }
.key-p { background: var(--accent); } .key-i { background: var(--warn); }

/* Dropzone + image compare */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r); padding: 34px 20px; text-align: center; cursor: pointer; transition: .15s; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-weak); }
.dropzone p { margin: 4px 0; }
.dz-icon { width: 46px; height: 46px; margin: 0 auto 8px; color: var(--accent); }
.dz-icon svg { width: 100%; height: 100%; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.compare.single { grid-template-columns: 1fr; max-width: 340px; }
.compare figure { margin: 0; }
.compare figcaption { font-family: var(--font-mono); font-size: .7rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.compare img { width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border); background: repeating-conic-gradient(var(--surface-3) 0% 25%, var(--surface) 0% 50%) 50% / 18px 18px; }
@media (max-width: 560px) { .compare { grid-template-columns: 1fr; } }
.thumb-list { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.thumb-list li { position: relative; width: 66px; height: 66px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.thumb-list img { width: 100%; height: 100%; object-fit: cover; }
.thumb-list .idx { position: absolute; top: 2px; left: 2px; font-family: var(--font-mono); font-size: .6rem; background: rgba(0,0,0,.6); color: #fff; padding: 1px 4px; border-radius: 4px; }

/* Character-counter ring */
.counter-row { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 58px; height: 58px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .ring-bg { stroke: var(--surface-3); }
.ring .ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100.5; stroke-dashoffset: 0; transition: stroke-dashoffset .2s, stroke .2s; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: .8rem; font-weight: 700; }
.ring.over .ring-fg { stroke: var(--danger); }
.ring.over span { color: var(--danger); }
.counter-meta { display: flex; flex-direction: column; gap: 2px; }
.counter-meta span:first-child { font-weight: 650; }

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.tag-cloud .tag { font-family: var(--font-mono); font-size: .8rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 5px 11px; cursor: pointer; }
.tag-cloud .tag:hover { border-color: var(--accent); color: var(--accent); }

/* QR + color stages */
.qr-stage { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; margin-top: 8px; }
.qr-out { width: 220px; height: 220px; background: #fff; border: 1px solid var(--border); border-radius: var(--r); display: grid; place-items: center; padding: 10px; }
.qr-out img, .qr-out svg, .qr-out canvas { width: 100%; height: 100%; }
.qr-controls { display: grid; gap: 12px; }
@media (max-width: 560px) { .qr-stage { grid-template-columns: 1fr; justify-items: center; } }
.color-stage { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: stretch; }
.swatch { border-radius: var(--r); border: 1px solid var(--border); min-height: 160px; box-shadow: var(--shadow-sm) inset; }
.color-inputs { display: grid; gap: 10px; }
@media (max-width: 560px) { .color-stage { grid-template-columns: 1fr; } .swatch { min-height: 90px; } }
.contrast-preview { border: 1px solid var(--border); border-radius: var(--r); padding: 20px; margin: 16px 0; transition: .2s; }
.contrast-preview .big { font-size: 2.4rem; font-weight: 800; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.grade { font-family: var(--font-mono); font-size: .74rem; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.grade b.pass { color: var(--accent); } .grade b.fail { color: var(--danger); }

/* Password display */
.pw-display { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.pw-field { flex: 1; font-size: 1.05rem !important; letter-spacing: .5px; }
.pw-strength { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-bottom: 18px; }
.pw-strength span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }

.kv-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.kv-list li { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.kv-list li span:first-child { color: var(--muted); font-family: var(--font-mono); font-size: .78rem; }

/* --------------------------------------------------------------- Toasts */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: toast-in .2s ease; }
.toast svg { width: 15px; height: 15px; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------ Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .es-ico { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--border-strong); }

/* ---------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 30px; padding: 46px 0 30px; }
.footer-brand p { color: var(--muted); font-size: .9rem; max-width: 32ch; margin: 12px 0 0; }
.footer-col h4 { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 12px; }
.footer-col a { display: block; color: var(--text); font-size: .88rem; padding: 4px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; } }

/* Ad slot placeholders (safe to leave empty; won't break layout) */
.ad-slot { min-height: 90px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: var(--r); color: var(--muted); font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; margin: 24px 0; background: var(--surface-2); }
.ad-slot:empty::after { content: "Ad space"; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
