/* ==========================================================================
   QuickTools design system
   Light and dark themes, system fonts, no external assets.
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #5c6679;
  --border: #e2e7f1;
  --border-strong: #cbd4e4;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #0891b2;
  --success: #047857;
  --success-soft: #ecfdf5;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .28);
  --radius: 16px;
  --radius-sm: 10px;
  --header: 66px;
  --max: 1180px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #080b13;
  --bg-soft: #0c111c;
  --surface: #101624;
  --surface-2: #0b101a;
  --text: #e9edf8;
  --text-soft: #cbd3e4;
  --muted: #98a3b9;
  --border: #1f283a;
  --border-strong: #2d3950;
  --primary: #8b8cff;
  --primary-600: #a5a6ff;
  --primary-soft: #1a1f3d;
  --accent: #22d3ee;
  --success: #34d399;
  --success-soft: #052e24;
  --danger: #f87171;
  --danger-soft: #2a1114;
  --warning: #fbbf24;
  --warning-soft: #2a1f08;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 34px -14px rgba(0, 0, 0, .65);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- reset */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 16px);
}

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

img, svg, canvas { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .6em; font-weight: 750; }
h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: -.035em; line-height: 1.08; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-top: 1.8em; }
h3 { font-size: 1.12rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: .1em .35em; border-radius: 5px; }
pre code { background: none; border: 0; padding: 0; }
::selection { background: var(--primary); color: #fff; }

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

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  text-decoration: none;
}
.skip:focus { left: 0; }

/* -------------------------------------------------------------- layout */
.w { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 22px; }
main { min-height: 60vh; }
main.w { padding-block: 0; }
.section { padding-block: 40px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); }

/* -------------------------------------------------------------- header */
header.site {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--header);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.14rem;
  letter-spacing: -.03em;
  color: var(--text);
  text-decoration: none;
  flex: none;
}
.logo b { color: var(--primary); font-weight: 800; }
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .55);
}
.logo-mark svg { width: 17px; height: 17px; display: block; }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: .925rem;
  font-weight: 550;
  padding: 8px 11px;
  border-radius: 9px;
  transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface); }

.nav-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-links + .nav-tools { margin-left: 6px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 10px;
  transition: border-color .15s, color .15s, transform .15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.menu-btn { display: none; }
.mobile-menu {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 22px 16px;
}
.mobile-menu a {
  display: block;
  padding: 11px 4px;
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 550;
  border-bottom: 1px solid var(--border);
}
.mobile-menu a:last-child { border-bottom: 0; }
header.site[data-open="true"] .mobile-menu { display: block; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  padding: clamp(38px, 7vw, 76px) 0 clamp(26px, 4vw, 44px);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%; top: -260px;
  width: min(1000px, 130vw);
  height: 640px;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side, rgba(79, 70, 229, .20), transparent 72%),
    radial-gradient(closest-side at 68% 40%, rgba(8, 145, 178, .16), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}
[data-theme="dark"] .hero::before {
  background:
    radial-gradient(closest-side, rgba(139, 140, 255, .22), transparent 72%),
    radial-gradient(closest-side at 68% 40%, rgba(34, 211, 238, .14), transparent 70%);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.hero h1 { max-width: 880px; margin-inline: auto; }
.hero .lede {
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.16rem);
  max-width: 660px;
  margin: 18px auto 26px;
}
.hero .lede b { color: var(--text-soft); font-weight: 650; }

.search {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
  text-align: left;
}
.search svg {
  position: absolute;
  left: 18px; top: 50%;
  width: 20px; height: 20px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 58px;
  padding: 0 112px 0 50px;
  font-size: 1.02rem;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow-md);
}
.search kbd {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 3px 7px;
  border-radius: 6px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 22px;
  color: var(--muted);
  font-size: .875rem;
}
.hero-stats span { display: inline-flex; align-items: center; gap: 6px; }
.hero-stats b { color: var(--text); font-weight: 700; }
.hero-stats svg { width: 15px; height: 15px; color: var(--success); }

/* --------------------------------------------------------------- chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .855rem;
  font-weight: 550;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s, transform .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .count { opacity: .65; font-size: .78em; }

/* -------------------------------------------------------------- toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 0 6px;
}
.toolbar .field { margin: 0; min-width: 170px; }
.toolbar .field-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toolbar .result-count { margin-left: auto; color: var(--muted); font-size: .875rem; }

/* ---------------------------------------------------------------- grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
  padding-block: 8px 12px;
}
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: var(--shadow-md);
}
.card .ic {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 1.28rem;
  line-height: 1;
  background: var(--primary-soft);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, transparent);
}
.card .title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.015em;
  color: var(--text);
  text-decoration: none;
}
.card .title::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); z-index: 1; }
.card p { margin: 0; color: var(--muted); font-size: .885rem; line-height: 1.55; }
.card .meta { margin-top: auto; padding-top: 4px; font-size: .75rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.card .fav {
  position: absolute;
  right: 10px; top: 10px;
  z-index: 3;
  width: 32px; height: 32px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.card:hover .fav, .card .fav[aria-pressed="true"], .card .fav:focus-visible { opacity: 1; }
.card .fav:hover { background: var(--surface-2); color: var(--primary); }
.card .fav[aria-pressed="true"] { color: #d97706; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------------------------------------------------------- category grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cat-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.cat-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.cat-card .cat-icon { font-size: 1.4rem; }
.cat-card h3 { margin: 8px 0 4px; font-size: 1.02rem; }
.cat-card p { margin: 0; color: var(--muted); font-size: .86rem; }
.cat-card .cat-count { display: inline-block; margin-top: 10px; font-size: .78rem; color: var(--primary); font-weight: 650; }

/* ----------------------------------------------------------- page header */
.page-head { padding: clamp(26px, 4vw, 44px) 0 10px; }
.page-head h1 { margin-bottom: .35em; }
.page-head .lede { color: var(--muted); max-width: 720px; font-size: 1.04rem; margin: 0; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: .84rem;
  color: var(--muted);
  padding-top: 18px;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs .sep { opacity: .5; }

/* ------------------------------------------------------------- tool page */
.tool-layout { display: grid; gap: 26px; padding-bottom: 10px; }
.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(16px, 2.6vw, 26px);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.tool-panel h3 { font-size: 1.02rem; margin: 22px 0 10px; }
.tool-panel h3:first-child { margin-top: 0; }
.tool-panel .loading { color: var(--muted); font-size: .9rem; }

.subtool {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface-2);
}
.subtool h3 { margin-top: 0; }

.prose { max-width: 780px; }
.prose h2 { font-size: 1.32rem; margin-top: 2.1em; }
.prose h3 { font-size: 1.04rem; margin-top: 1.6em; }
.prose p, .prose li { color: var(--text-soft); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin-bottom: .4em; }
.prose ol.steps { counter-reset: step; list-style: none; padding: 0; }
.prose ol.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  margin-bottom: 12px;
}
.prose ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: .85rem;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0 16px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 650;
  padding: 13px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--primary); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 14px; color: var(--text-soft); }

.related { padding-block: 10px 20px; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  font-size: .925rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .12s, box-shadow .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 80%, transparent);
}
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-row, .tool-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 14px 0 6px; align-items: center; }

/* --------------------------------------------------------------- forms */
.field { display: block; margin: 0 0 14px; min-width: 0; }
.field-label {
  display: block;
  font-size: .86rem;
  font-weight: 650;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.field-head .field-label { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .83rem; margin: 4px 0 0; line-height: 1.5; }

input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="color"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border-strong)); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
textarea.tall { min-height: 220px; }
textarea.code, input.code, .out.code, .code-block { font-family: var(--mono); font-size: .86rem; }
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input[type="color"] { padding: 3px; height: 42px; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
input[type="file"] {
  width: 100%;
  padding: 9px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  font-size: .86rem;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: .84rem;
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.row > * { flex: 1 1 150px; min-width: 0; }
.row.four > * { flex: 1 1 130px; }
.row > .field { margin-bottom: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .89rem;
  color: var(--text-soft);
  cursor: pointer;
  margin: 2px 0;
  font-weight: 500;
}
.check.grow { flex: 1; min-width: 0; }
.check.grow span { overflow-wrap: anywhere; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; margin: 8px 0 14px; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--primary); flex: none; cursor: pointer; }

.range { accent-color: var(--primary); padding: 0; height: 24px; background: transparent; border: 0; }
.range:focus { box-shadow: none; }
.range-value {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-soft);
  padding: 1px 7px;
  border-radius: 6px;
  min-width: 46px;
  text-align: center;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.segment {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
}
.segment:hover { color: var(--text); }
.segment.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* -------------------------------------------------------------- outputs */
.out {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: .87rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
  min-height: 44px;
}
.out:empty::before { content: "Result appears here"; color: var(--muted); font-family: var(--font); font-size: .85rem; }
.msg { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); margin: 12px 0 0; font-family: var(--font); font-size: .89rem; white-space: pre-wrap; }
.msg.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.msg.er { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.msg.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }

.big-result {
  font-size: clamp(1.35rem, 3.2vw, 1.95rem);
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.2;
  margin: 14px 0;
  color: var(--text);
  overflow-wrap: anywhere;
}
.big-result + .big-result { margin-top: -6px; }

.result-block { margin-top: 8px; }
.result { font-size: 1.22rem; font-weight: 700; color: var(--primary); margin: 8px 0; }
.result.muted { color: var(--muted); font-weight: 500; font-size: .95rem; }
.formula { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 14px 0; }
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-value { font-size: 1.28rem; font-weight: 750; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stats-grid .stats { margin-top: 0; }

.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 0; margin: 12px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.kv dt, .kv dd { padding: 9px 13px; margin: 0; border-bottom: 1px solid var(--border); font-size: .89rem; }
.kv dt { color: var(--muted); background: var(--surface-2); font-weight: 600; }
.kv dd { color: var(--text); overflow-wrap: anywhere; }
.kv > :nth-last-child(2), .kv > :last-child { border-bottom: 0; }
.kv.compact dt, .kv.compact dd { padding: 7px 12px; font-size: .86rem; }

.table-wrap { overflow: auto; max-height: 460px; border: 1px solid var(--border); border-radius: 12px; margin: 12px 0; background: var(--surface); }
.table-wrap.tall { max-height: 560px; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; z-index: 1; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table code { white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .8rem; font-weight: 650; margin: 0 0 10px; }
.pill.good { background: var(--success-soft); color: var(--success); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }

.meter { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.meter-bar { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }
.meter-bar.good { background: var(--success); }
.meter-bar.warn { background: #d97706; }
.meter-bar.bad { background: var(--danger); }

.preview-wrap { margin-top: 12px; }
.preview { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; border: 1px solid var(--border); margin-top: 10px; }

/* --------------------------------------------------------- tool specifics */
.diff { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; overflow: auto; max-height: 520px; font-family: var(--mono); font-size: .84rem; background: var(--surface); }
.diff:empty { display: none; }
.diff-row { display: grid; grid-template-columns: 46px 20px 1fr; gap: 4px; padding: 2px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-n { color: var(--muted); text-align: right; user-select: none; font-size: .76rem; }
.diff-sign { font-weight: 700; user-select: none; }
.diff-add { background: var(--success-soft); }
.diff-del { background: var(--danger-soft); }
.diff-add .diff-sign { color: var(--success); }
.diff-del .diff-sign { color: var(--danger); }

.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.calc-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); }
.calc-card h3 { margin: 0 0 12px; font-size: .98rem; }
.calc-card .row { gap: 10px; }
.calc-card .result { margin: 12px 0 4px; }

.password-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.password-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.password { flex: 1; font-size: .95rem; overflow-wrap: anywhere; background: none; border: 0; padding: 0; }
.password-item .btn { flex: none; }

.timer-display {
  font-family: var(--mono);
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 600;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 12px;
  color: var(--text);
}
.timer-display.done { color: var(--danger); }
.laps { margin: 12px 0 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; }
.laps li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 6px 2px; border-bottom: 1px solid var(--border); font-size: .86rem; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; }
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 12px 0 4px; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--success); transition: width .3s; }

.palettes { display: grid; gap: 16px; }
.palette h3 { font-size: .92rem; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  flex: 1 1 90px;
  min-width: 86px;
  padding: 18px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 600;
  text-align: center;
  transition: transform .15s;
}
.swatch:hover { transform: translateY(-2px); }
.swatch.large { padding: 22px 8px; }

.color-input { height: 52px; }
.color-preview { height: 120px; border-radius: 14px; display: grid; place-items: center; border: 1px solid var(--border); margin: 14px 0; font-weight: 700; }
.format-list { display: flex; flex-direction: column; gap: 6px; }
.format-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; }
.format-key { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.format-row code { background: none; border: 0; padding: 0; font-size: .86rem; overflow-wrap: anywhere; }
.contrast-row { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.contrast-item { display: flex; align-items: center; gap: 9px; font-size: .87rem; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid; display: inline-block; flex: none; }
.contrast-results .check-line { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.contrast-results .check-line:last-of-type { border-bottom: 0; }
.check-icon { width: 20px; text-align: center; font-weight: 700; }
.check-line.pass .check-icon { color: var(--success); }
.check-line.fail .check-icon { color: var(--danger); }
.check-threshold { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.contrast-sample { padding: 18px; border-radius: 12px; border: 1px solid var(--border); font-size: 1.05rem; line-height: 1.6; }

.zone-row { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--surface-2); }
.zone-row.highlight { border-color: var(--primary); background: var(--primary-soft); }
.zone-name { color: var(--muted); font-size: .85rem; }
.zone-time { font-weight: 650; }

.countdown { margin: 16px 0; }
.countdown-label { color: var(--muted); margin: 0 0 8px; font-size: .9rem; }
.countdown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.countdown-cell { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 6px; text-align: center; }
.countdown-value { display: block; font-family: var(--mono); font-size: clamp(1.4rem, 4.4vw, 2.1rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown-unit { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.qr-wrap { display: flex; justify-content: center; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; margin-top: 12px; }
.qr-canvas { width: min(100%, 340px); height: auto; image-rendering: pixelated; border-radius: 6px; }

.file-list { padding-left: 1.2em; margin: 10px 0; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .88rem; flex-wrap: wrap; }
.file-name { flex: 1 1 180px; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: .8rem; }
.file-list .btn { flex: none; }

.crop-preview { background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 18px 18px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; place-items: center; margin-top: 12px; overflow: auto; }
.crop-canvas { max-height: 320px; width: auto; max-width: 100%; }
.filter-stage { background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 18px 18px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; place-items: center; margin: 12px 0; }
.filter-preview { max-height: 360px; border-radius: 8px; }

.slider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; }
.stops { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.stop-row { display: grid; grid-template-columns: 46px 1fr 56px auto; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; }
.stop-row input[type="color"] { height: 34px; }
.gradient-preview { height: 200px; border-radius: 14px; border: 1px solid var(--border); margin: 14px 0; }
.shadow-stage { background-color: var(--surface-2); background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 16px 16px; border: 1px solid var(--border); border-radius: 14px; padding: 44px 20px; display: grid; place-items: center; margin: 14px 0; }
.shadow-box { width: min(240px, 100%); height: 130px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: grid; place-items: center; color: var(--muted); font-weight: 600; }

.picker-result { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.winner { background: var(--primary-soft); color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); padding: 9px 15px; border-radius: 999px; font-weight: 650; }
.winner.first { background: var(--primary); color: #fff; }
.dice-result { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.die { width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; font-weight: 700; font-size: 1.1rem; }
.die-total { margin-left: 8px; color: var(--muted); font-size: .88rem; }
.coin { font-weight: 700; font-size: 1.2rem; padding: 8px 18px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }

.number-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.number-chip { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .9rem; }

.fraction-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.fraction { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.fraction .field { margin: 0; }
.fraction .field-label { font-size: .72rem; color: var(--muted); }
.fraction-line { display: none; }

.history { margin: 8px 0 0; padding-left: 1.2em; color: var(--muted); font-family: var(--mono); font-size: .84rem; }
.history li { cursor: pointer; padding: 2px 0; }
.history li:hover { color: var(--primary); }

.regex-highlight { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px; font-family: var(--mono); font-size: .87rem; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 70px; }
.regex-highlight mark { background: #fde68a; color: #111827; border-radius: 3px; padding: 0 1px; }

.markdown-body { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-height: 220px; max-height: 520px; overflow: auto; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1em; }
.markdown-body h1 { font-size: 1.7rem; }
.markdown-body h2 { font-size: 1.35rem; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body p { color: var(--text-soft); }
.markdown-body pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow: auto; }
.markdown-body blockquote { margin: 1em 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--primary); color: var(--muted); }
.markdown-body ul, .markdown-body ol { padding-left: 1.3em; }
.markdown-body hr { margin: 1.4em 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split > div { min-width: 0; }
.split .field { margin-bottom: 0; }
.split .field-label { margin-bottom: 8px; }

.snippets { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.snippet { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; flex-wrap: wrap; }
.snippet-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.snippet code { background: none; border: 0; font-size: .8rem; flex: 1; overflow-wrap: anywhere; }
.code-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; overflow: auto; font-size: .84rem; line-height: 1.55; margin: 8px 0 14px; }

.advice { margin: 10px 0 0; padding-left: 1.2em; color: var(--text-soft); font-size: .89rem; }
.advice li { margin-bottom: .35em; }
.frequency h3 { margin-top: 18px; }
.unit-table { margin-top: 8px; }

/* -------------------------------------------------------------- footer */
footer.site {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 44px 0 26px;
  font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.footer-grid h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }
.footer-grid a { display: block; color: var(--text-soft); text-decoration: none; padding: 3px 0; font-size: .875rem; }
.footer-grid a:hover { color: var(--primary); }
.footer-brand p { color: var(--muted); font-size: .875rem; margin: 8px 0 0; max-width: 280px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; }

/* --------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------- helpers */
.hide { display: none !important; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  .menu-btn { display: grid; }
  .nav-tools { margin-left: auto; }
  .split { grid-template-columns: 1fr; }
  .search input { padding-right: 18px; }
  .search kbd { display: none; }
}

@media (max-width: 640px) {
  .w { padding-inline: 16px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }
  .hero { padding-top: 30px; }
  .hero-stats { gap: 6px 16px; font-size: .82rem; }
  .row > * { flex-basis: 100%; }
  .row.four > * { flex-basis: calc(50% - 6px); }
  .tool-panel { border-radius: 16px; padding: 16px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 2px; }
  .kv dd { padding-top: 0; }
  .countdown-grid { grid-template-columns: repeat(2, 1fr); }
  .format-row { grid-template-columns: 52px 1fr; }
  .format-row .btn { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .section { padding-block: 28px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stop-row { grid-template-columns: 42px 1fr 46px auto; }
  .search input { height: 52px; font-size: .98rem; }
}

@media (max-width: 420px) {
  h1 { font-size: 1.9rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .countdown-grid { gap: 6px; }
}

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

/* -------------------------------------------------------------- print */
@media print {
  header.site, footer.site, .tool-actions, .chips, .btn, .skip, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .tool-panel, .card, .out, .table-wrap { border-color: #999; box-shadow: none; }
  a { color: #000; text-decoration: underline; }
  .prose { max-width: none; }
}

/* ------------------------------------------------------- build additions */
html { scroll-padding-top: calc(var(--header, 64px) + 14px); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
.no-js .js-only { display: none !important; }
.card[hidden] { display: none !important; }
.meta-line { color: var(--muted); font-size: .86rem; margin: 12px 0 0; }
.grad {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .search { margin-top: 26px; }
.footer-brand .badge { margin: 14px 0 0; }
.cat-card .cat-icon { display: inline-flex; align-items: center; }
.cat-icon svg { width: 24px; height: 24px; color: var(--primary); }
.tool-panel #tool-mount { min-height: 90px; }
.related .grid { padding-bottom: 0; }
.related .section-head { margin-bottom: 12px; }
.crumbs span[aria-current="page"] { color: var(--text); }

.search input[type="search"] {
  height: 58px;
  padding: 0 112px 0 50px;
  font-size: 1.02rem;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
  .meta-line { font-size: .8rem; }
  .hero .search { margin-top: 20px; }
}

@media (max-width: 860px) {
  .search input[type="search"] { padding-right: 18px; }
}

/* Locale selector: compact, keyboard-accessible and RTL-aware. */
.language-picker { display:inline-flex; align-items:center; }
.language-picker select { min-width:7.2rem; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--text); padding:.48rem 1.9rem .48rem .65rem; font:inherit; }
[dir="rtl"] .language-picker select { padding:.48rem .65rem .48rem 1.9rem; }
@media (max-width:700px) { .language-picker select { min-width:5.8rem; max-width:7rem; } }
