:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --text: #12141c;
  --muted: #5b6474;
  --line: #e3e7f0;
  --brand: #4f46e5;
  --brand-2: #9333ea;
  --brand-ink: #ffffff;
  --brand-soft: #eceafe;
  --ok: #0f7a55;
  --bad: #c0392b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22, 28, 60, .05), 0 10px 30px -12px rgba(22, 28, 60, .14);
  --shadow-lg: 0 2px 4px rgba(22, 28, 60, .06), 0 24px 48px -16px rgba(60, 50, 200, .28);
  --glow-a: hsl(262 90% 62% / .18);
  --glow-b: hsl(198 95% 55% / .18);
  /* icon tile lightness/saturation, tinted per category via --h */
  --tile-s: 90%; --tile-l: 95%; --ico-s: 68%; --ico-l: 44%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e15; --surface: #151924; --text: #eef1f8; --muted: #9aa3b6; --line: #262c3b;
    --brand: #8b85ff; --brand-2: #c084fc; --brand-ink: #0d0b2b; --brand-soft: #211f45;
    --ok: #4fd1a1; --bad: #ff8a7a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, .7);
    --glow-a: hsl(262 90% 60% / .22); --glow-b: hsl(198 95% 50% / .14);
    --tile-s: 45%; --tile-l: 19%; --ico-s: 90%; --ico-l: 76%;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0e15; --surface: #151924; --text: #eef1f8; --muted: #9aa3b6; --line: #262c3b;
  --brand: #8b85ff; --brand-2: #c084fc; --brand-ink: #0d0b2b; --brand-soft: #211f45;
  --ok: #4fd1a1; --bad: #ff8a7a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5); --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, .7);
  --glow-a: hsl(262 90% 60% / .22); --glow-b: hsl(198 95% 50% / .14);
  --tile-s: 45%; --tile-l: 19%; --ico-s: 90%; --ico-l: 76%;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
img, canvas { max-width: 100%; }
svg.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; text-decoration: none; color: var(--text); letter-spacing: -.02em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #9333ea); box-shadow: 0 6px 16px -6px rgba(99, 70, 229, .7);
}
.logo-mark svg { width: 18px; height: 18px; }
.logo em { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--bg); }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center; margin-left: 6px; }
.theme-btn:hover { border-color: var(--brand); }

/* ---------- hero band ---------- */
.band {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(55% 90% at 15% 0%, var(--glow-a), transparent 70%),
    radial-gradient(45% 80% at 88% 8%, var(--glow-b), transparent 70%),
    var(--surface);
}
.hero { padding: 64px 0 48px; text-align: center; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: 6px 14px; margin-bottom: 20px;
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }
.hero h1 { font-size: clamp(32px, 6vw, 58px); line-height: 1.08; margin: 0 0 16px; letter-spacing: -.035em; text-wrap: balance; font-weight: 800; }
.grad { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 600px; margin: 0 auto 28px; font-size: clamp(16px, 2.2vw, 19px); text-wrap: pretty; }
.search-box { position: relative; max-width: 560px; margin: 0 auto; }
.search-box svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input[type=search] {
  width: 100%; height: 58px; padding: 0 20px 0 50px; font-size: 17px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; align-items: center; font-size: 14px; color: var(--muted); }
.chips a { color: var(--text); text-decoration: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-weight: 500; }
.chips a:hover { border-color: var(--brand); color: var(--brand); }
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; margin-top: 32px; font-size: 14px; color: var(--muted); font-weight: 500; }
.trust span { display: inline-flex; align-items: center; gap: 8px; }
.trust svg { color: var(--ok); }

/* ---------- category filter + grid ---------- */
.pills { display: flex; gap: 8px; margin: 32px 0 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 8px 16px; min-height: 40px; cursor: pointer; }
.pill:hover { color: var(--text); border-color: var(--brand); }
.pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.cat-title { display: flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: -.01em; margin: 32px 0 14px; }
.cat-title small { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: hsl(var(--h) var(--tile-s) var(--tile-l)); color: hsl(var(--h) var(--ico-s) var(--ico-l));
}
.tile svg { width: 22px; height: 22px; }
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.tool-card:hover { transform: translateY(-3px); border-color: hsl(var(--h) 70% 60%); box-shadow: 0 18px 36px -18px hsl(var(--h) 70% 45% / .55); }
.tool-card .tile { margin-bottom: 10px; }
.tool-card b { font-size: 17px; letter-spacing: -.01em; }
.tool-card small { color: var(--muted); font-size: 14px; line-height: 1.5; }
.tool-card .go { position: absolute; top: 22px; right: 20px; color: var(--muted); opacity: 0; transform: translateX(-6px); transition: .15s; }
.tool-card:hover .go { opacity: 1; transform: none; color: hsl(var(--h) var(--ico-s) var(--ico-l)); }

/* ---------- feature cards ---------- */
.section-title { text-align: center; font-size: clamp(24px, 3.5vw, 32px); letter-spacing: -.02em; margin: 64px 0 8px; }
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 28px; max-width: 560px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.feature h3 { margin: 14px 0 6px; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }
.cta {
  margin-top: 56px; border-radius: 24px; padding: 40px 24px; text-align: center; color: #fff;
  background: radial-gradient(60% 120% at 10% 0%, rgba(255, 255, 255, .22), transparent 60%), linear-gradient(135deg, #4f46e5, #9333ea);
}
.cta h2 { margin: 0 0 8px; font-size: clamp(22px, 3.5vw, 30px); letter-spacing: -.02em; }
.cta p { margin: 0 0 20px; opacity: .9; }
.cta .btn { background: #fff; color: #4338ca; border-color: #fff; }

/* ---------- tool page ---------- */
.tool-head { padding: 24px 0 32px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.title-row { display: flex; gap: 16px; align-items: center; }
.title-row .tile { width: 60px; height: 60px; border-radius: 17px; }
.title-row .tile svg { width: 28px; height: 28px; }
.page-title { font-size: clamp(26px, 4.5vw, 40px); margin: 0; letter-spacing: -.03em; line-height: 1.15; font-weight: 800; }
.lead { color: var(--muted); margin: 14px 0 0; max-width: 720px; font-size: 17px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.tags svg { color: var(--ok); width: 15px; height: 15px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; margin-top: 28px; }
.side { position: sticky; top: 88px; display: grid; gap: 16px; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.side-box h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px; }
.side-link:hover { background: var(--bg); }
.side-link .tile { width: 36px; height: 36px; border-radius: 10px; }
.side-link .tile svg { width: 18px; height: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); margin-bottom: 24px; }
.card h3 { font-size: 16px; margin: 22px 0 10px; }
.content h2 { font-size: 22px; margin: 36px 0 14px; letter-spacing: -.02em; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--text); }
.steps li::before {
  content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--brand-soft); color: var(--brand);
}
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 44px 16px 18px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); }
.prose { max-width: 720px; padding-top: 8px; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; letter-spacing: -.01em; }
.prose p, .prose li { color: var(--muted); }
.prose p { margin: 0 0 12px; }

/* ---------- forms ---------- */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 180px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
textarea.plain { font-family: inherit; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
button:focus-visible, a:focus-visible, summary:focus-visible, .drop:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=range] { width: 100%; accent-color: var(--brand); }
input[type=checkbox] { accent-color: var(--brand); width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-bottom: 16px; }
.checks label { font-weight: 400; font-size: 15px; margin: 0; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 8px 18px -10px rgba(99, 70, 229, .9);
  border-radius: 12px; padding: 10px 20px; min-height: 46px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--brand); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.drop {
  border: 2px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: var(--radius); padding: 40px 16px; text-align: center; color: var(--muted);
  cursor: pointer; margin-bottom: 18px; background: color-mix(in srgb, var(--brand-soft) 45%, transparent); transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop b { color: var(--text); display: block; font-size: 18px; margin-bottom: 2px; }

/* ---------- results ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; letter-spacing: -.02em; }
.out {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 19px; font-weight: 600; overflow-wrap: anywhere; min-height: 54px;
}
.msg { margin-top: 12px; font-size: 15px; color: var(--muted); }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); }
.preview { margin-top: 18px; text-align: center; }
.preview img, .preview canvas { border-radius: 12px; border: 1px solid var(--line); max-height: 360px; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .2s; }
table.sched { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.sched th, table.sched td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); }
table.sched th { color: var(--muted); font-size: 13px; }
table.sched th:first-child, table.sched td:first-child { text-align: left; }
.scroll-x { overflow-x: auto; }

.kv { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.kv > span { width: 68px; flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.kv code { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; }
.kv .btn { padding: 8px 14px; }
@media (max-width: 560px) { .kv { flex-wrap: wrap; } .kv > span { width: 100%; } }

/* ads: only rendered when an AdSense id is configured */
.ad { margin: 24px 0; min-height: 100px; text-align: center; }
.ad::before { content: "Advertisement"; display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ---------- footer ---------- */
.site-footer { margin-top: 72px; border-top: 1px solid var(--line); background: var(--surface); padding: 48px 0 24px; font-size: 14px; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 32px 24px; }
.foot-brand { grid-column: 1 / -1; }
.foot-grid p { margin: 12px 0 0; max-width: 280px; }
.foot-grid h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin: 0 0 12px; }
.foot-grid a:not(.logo) { display: block; color: var(--muted); text-decoration: none; padding: 4px 0; }
.foot-grid a:not(.logo):hover { color: var(--brand); }
.foot-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 560px) {
  .nav a.hide-s { display: none; }
  .hero { padding: 40px 0 36px; }
  .card { padding: 18px; border-radius: 18px; }
  .title-row .tile { width: 50px; height: 50px; border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
