/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --brand:        #4f46e5;
  --brand-dark:   #4338ca;
  --brand-soft:   #eef2ff;

  --bg:           #ffffff;
  --bg-alt:       #f7f8fb;
  --bg-sunken:    #f0f2f7;
  --surface:      #ffffff;
  --border:       #e3e6ee;
  --border-strong:#cbd1e0;

  --text:         #12141c;
  --text-soft:    #565d73;
  --text-faint:   #858ca3;

  --success:      #0f9960;
  --warn:         #b45309;
  --danger:       #dc2626;

  --radius:       12px;
  --radius-lg:    18px;
  --radius-sm:    8px;

  --shadow-sm:    0 1px 2px rgba(18,20,28,.06);
  --shadow:       0 2px 8px rgba(18,20,28,.07), 0 1px 2px rgba(18,20,28,.05);
  --shadow-lg:    0 12px 32px rgba(18,20,28,.13);

  --header-h:     58px;
  --wrap:         1240px;
  --wrap-narrow:  760px;

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

  --cat-color: var(--brand);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { color-scheme: dark; }
}
:root[data-theme="auto"], :root[data-theme="dark"] { color-scheme: light dark; }

:root[data-theme="dark"],
:root[data-theme="auto"] { }

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:#0d0f16; --bg-alt:#12151f; --bg-sunken:#171b27; --surface:#151925;
    --border:#252b3b; --border-strong:#39415a;
    --text:#e9ecf5; --text-soft:#a4abc2; --text-faint:#767e97;
    --brand:#7c7cf0; --brand-dark:#6d6ce8; --brand-soft:#1c1f36;
    --shadow-sm:0 1px 2px rgba(0,0,0,.4);
    --shadow:0 2px 10px rgba(0,0,0,.45);
    --shadow-lg:0 14px 38px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg:#0d0f16; --bg-alt:#12151f; --bg-sunken:#171b27; --surface:#151925;
  --border:#252b3b; --border-strong:#39415a;
  --text:#e9ecf5; --text-soft:#a4abc2; --text-faint:#767e97;
  --brand:#7c7cf0; --brand-dark:#6d6ce8; --brand-soft:#1c1f36;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow:0 2px 10px rgba(0,0,0,.45);
  --shadow-lg:0 14px 38px rgba(0,0,0,.6);
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1,h2,h3,h4 { line-height: 1.22; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); }
h3 { font-size: 1.08rem; }
p  { margin: 0 0 1em; }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brand); color: #fff; padding: .7rem 1.1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }
.wrap.narrow { max-width: var(--wrap-narrow); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; height: var(--header-h); }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); font-size: 1.06rem; }
.brand:hover { text-decoration: none; }
/* Explicit box so the header cannot shift while the image loads. The PNG is
   200×91; scaling by height keeps it crisp on retina at header size. */
.brand-logo { height: 44px; width: auto; display: block; flex: none; }
/* The logo's navy wordmark sinks into the near-black dark header, and no
   filter fixes it without wrecking the brand colours — so in dark mode the
   logo sits on a small light chip instead. Same auto/dark selector pair as
   the theme tokens above. */
:root[data-theme="dark"] .brand-logo {
  background: #f2f4f9; border-radius: 8px; padding: 3px 8px; box-sizing: border-box;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .brand-logo {
    background: #f2f4f9; border-radius: 8px; padding: 3px 8px; box-sizing: border-box;
  }
}

.main-nav { display: flex; gap: 2px; margin-left: 8px; flex: 1; overflow: hidden; }
.main-nav a {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 11px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-size: .9rem; font-weight: 500;
}
.main-nav a:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }

.header-actions { display: flex; gap: 4px; margin-left: auto; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }

.nav-toggle { display: none; }
.mobile-nav { border-top: 1px solid var(--border); background: var(--surface); padding: 8px 0 14px; }
.mobile-nav .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.mobile-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 10px; border-radius: var(--radius-sm);
  color: var(--text); font-size: .92rem;
}
.mobile-nav a:hover { background: var(--bg-sunken); text-decoration: none; }

/* ==========================================================================
   Buttons / controls
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--bg-sunken); }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: 1rem; padding: 0 26px; }

/* The hidden attribute must win over display:grid/flex set by a class — the UA
   default loses to any author rule, so tools toggling el.hidden on a grid/flex
   container would stay visible without this. */
[hidden]:not([hidden="until-found"]) { display: none !important; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.input, input[type="text"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 140px; resize: vertical; font-family: var(--mono); font-size: .9rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }

input[type="range"] { width: 100%; accent-color: var(--brand); height: 32px; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  color: var(--text-soft); font-size: .87rem; font-weight: 500;
}
.chip:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); text-decoration: none; }

.badge {
  position: absolute; top: 8px; right: 8px;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 999px;
}
.badge-new { background: var(--success); color: #fff; }
.badge-desktop { background: var(--bg-sunken); border: 1px solid var(--border); font-size: .75rem; padding: 1px 5px; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  background: linear-gradient(180deg, var(--brand-soft), transparent);
  padding: clamp(36px, 6vw, 68px) 0 clamp(28px, 4vw, 44px);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 { margin-bottom: .4em; }
.hero-accent { color: var(--brand); }
.hero-sub { max-width: 620px; margin: 0 auto 28px; color: var(--text-soft); font-size: 1.05rem; }

.hero-search {
  display: flex; align-items: center; gap: 8px;
  max-width: 620px; margin: 0 auto 18px; padding: 6px 6px 6px 14px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; box-shadow: var(--shadow);
}
.hero-search svg { color: var(--text-faint); flex-shrink: 0; }
.hero-search input {
  flex: 1; border: none; background: transparent; min-height: 42px; padding: 0;
}
.hero-search input:focus { box-shadow: none; }
.hero-search .btn { border-radius: 999px; }

.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ==========================================================================
   Tool grid + cards
   ========================================================================== */
.category-block { padding: 30px 0 4px; }
.category-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.category-head h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.category-head h2 a { color: var(--text); }
.cat-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; font-size: 1.05rem;
  background: color-mix(in srgb, var(--cat-color) 14%, transparent);
}
.see-all { font-size: .88rem; font-weight: 600; white-space: nowrap; }
.category-tagline { color: var(--text-soft); font-size: .93rem; margin-bottom: 16px; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 12px;
}
.tool-grid-sm { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }

.tool-card {
  position: relative;
  display: flex; flex-direction: column; gap: 9px;
  padding: 15px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.tool-card:hover {
  text-decoration: none;
  border-color: var(--cat-color, var(--brand));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.tool-card-icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 9px; font-size: 1.1rem;
  background: var(--bg-sunken);
}
.tool-card-name { display: block; font-weight: 600; font-size: .93rem; line-height: 1.3; }
.tool-card-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text-faint); font-size: .8rem; line-height: 1.4; margin-top: 3px;
}

/* ==========================================================================
   Category page
   ========================================================================== */
.category-hero { padding: 22px 0 18px; }
.category-hero h1 { display: flex; align-items: center; gap: 12px; }
.category-sub { color: var(--text-soft); }
.category-toolbar { margin: 18px 0 14px; }
.filter-input { max-width: 340px; }

.desktop-only-section {
  margin: 26px 0;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg-alt);
}
.desktop-only-section > summary {
  padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: .93rem;
  display: flex; align-items: center; gap: 8px;
}
.desktop-only-section > summary em { color: var(--text-faint); font-weight: 400; font-size: .84rem; font-style: normal; }
.desktop-only-section > .tool-grid { padding: 0 16px 16px; }

/* ==========================================================================
   Tool page
   ========================================================================== */
.breadcrumb { padding: 12px 16px 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; font-size: .82rem; color: var(--text-faint); }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--border-strong); }
.breadcrumb a { color: var(--text-soft); }

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 30px;
  align-items: start;
  padding-top: 14px; padding-bottom: 50px;
}
.tool-aside { position: sticky; top: calc(var(--header-h) + 14px); }

.tool-head { margin-bottom: 18px; }
.tool-head h1 { margin-bottom: .3em; }
.tool-tagline { color: var(--text-soft); font-size: 1.02rem; margin-bottom: 12px; }
.trust-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.trust-pill {
  font-size: .78rem; font-weight: 600; color: var(--text-soft);
  background: var(--bg-sunken); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px;
}

.tool-workspace {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tool-inner { padding: 20px; }

/* --- responsive gating ---------------------------------------------------
   The "too narrow" card lives in the DOM for every visitor and every crawler.
   CSS alone decides whether it replaces the workspace, so a narrow desktop
   window behaves exactly like a phone. app.js sets .is-too-narrow by comparing
   the container width against data-min-vw.                                  */
.tool-too-narrow { display: none; padding: 40px 24px; text-align: center; }
.tool-workspace.is-too-narrow > .tool-inner { display: none; }
.tool-workspace.is-too-narrow > .tool-too-narrow { display: block; }
.tnw-icon { font-size: 2.4rem; display: block; margin-bottom: 10px; }
.tool-too-narrow h2 { font-size: 1.15rem; }
.tool-too-narrow p { color: var(--text-soft); max-width: 380px; margin: 0 auto 20px; }
.tnw-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.mobile-hint {
  font-size: .82rem; color: var(--text-faint);
  margin: 10px 0 0; padding-left: 2px;
}

/* --- shared tool UI primitives (ToolKit) --------------------------------- */
.dropzone {
  display: grid; place-items: center; gap: 10px;
  min-height: 210px; padding: 28px 20px; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg-alt); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-dragging { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-icon { font-size: 2rem; }
.dropzone-title { font-weight: 600; }
.dropzone-hint { font-size: .84rem; color: var(--text-faint); }

.file-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .88rem;
}
.file-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-size { color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-row-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }

.result-panel {
  margin-top: 16px; padding: 16px;
  background: color-mix(in srgb, var(--success) 8%, var(--bg-alt));
  border: 1px solid color-mix(in srgb, var(--success) 32%, var(--border));
  border-radius: var(--radius);
}
.result-stat { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.result-saving { color: var(--success); font-weight: 700; }

.progress { height: 6px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.output-box {
  width: 100%; font-family: var(--mono); font-size: .87rem;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; min-height: 120px; white-space: pre-wrap; word-break: break-word;
  max-height: 460px; overflow: auto;
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin: 14px 0; }
.stat-tile {
  padding: 12px; text-align: center;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.stat-tile b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-tile span { font-size: .74rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }

.notice { padding: 13px 15px; border-radius: var(--radius-sm); font-size: .9rem; margin: 12px 0; }
.notice-info { background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.notice-warn { background: color-mix(in srgb, var(--warn) 12%, var(--bg-alt)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.notice-error{ background: color-mix(in srgb, var(--danger) 10%, var(--bg-alt)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.notice p:last-child { margin-bottom: 0; }

.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* --- content sections ---------------------------------------------------- */
.prose { max-width: 68ch; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--bg-sunken); padding: .15em .4em; border-radius: 4px; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .9rem; }
.prose th, .prose td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border); }

.tool-intro, .tool-howto, .tool-body { margin-top: 34px; }

.faq-section { margin-top: 40px; max-width: 68ch; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary {
  padding: 15px 0; cursor: pointer; font-weight: 600; font-size: .97rem;
  list-style: none; display: flex; justify-content: space-between; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--text-faint); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .prose { padding-bottom: 15px; color: var(--text-soft); font-size: .93rem; }

.related-section { margin-top: 44px; }

/* ==========================================================================
   Ads
   ========================================================================== */
.ad-slot { margin: 26px 0; text-align: center; }
.ad-label {
  display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-faint); margin-bottom: 5px;
}
.ad-placeholder {
  display: grid; place-content: center; min-height: 92px; padding: 20px;
  background: repeating-linear-gradient(45deg, var(--bg-sunken), var(--bg-sunken) 10px, var(--bg-alt) 10px, var(--bg-alt) 20px);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-faint); font-size: .8rem;
}
.ad-tool_sidebar .ad-placeholder { min-height: 600px; }
.ad-anchor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; margin: 0;
  background: var(--surface); border-top: 1px solid var(--border); padding: 4px 0;
}

/* ==========================================================================
   Value props / footer
   ========================================================================== */
.value-props { background: var(--bg-alt); border-top: 1px solid var(--border); margin-top: 50px; padding: 44px 0; }
.vp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 26px; }
.vp span { font-size: 1.7rem; display: block; margin-bottom: 8px; }
.vp h3 { font-size: 1rem; margin-bottom: 6px; }
.vp p { color: var(--text-soft); font-size: .89rem; margin: 0; }

.site-footer { background: var(--bg-sunken); border-top: 1px solid var(--border); padding: 40px 0 26px; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 26px; margin-bottom: 28px; }
.footer-col { display: flex; flex-direction: column; }
.footer-col a { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--text-soft); font-size: .88rem; }
.footer-col a:hover { color: var(--brand); }
.footer-col em { margin-left: auto; font-style: normal; font-size: .74rem; color: var(--text-faint); }
.footer-bar { border-top: 1px solid var(--border); padding-top: 20px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.footer-brand { margin: 0; font-size: .88rem; color: var(--text-soft); }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; margin-left: auto; }
.footer-links a { font-size: .86rem; color: var(--text-soft); }
.footer-copy { width: 100%; margin: 0; font-size: .78rem; color: var(--text-faint); }

/* ==========================================================================
   Search overlay
   ========================================================================== */
.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,12,20,.5); backdrop-filter: blur(3px);
  padding: 8vh 16px 16px;
}
.search-panel {
  max-width: 620px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.search-input-row .search-icon { color: var(--text-faint); flex-shrink: 0; }
.search-input-row input { border: none; background: transparent; font-size: 1.05rem; padding: 0; }
.search-input-row input:focus { box-shadow: none; }
.search-results { max-height: min(58vh, 460px); overflow-y: auto; }
.search-group-label {
  padding: 12px 16px 5px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint);
}
.search-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--text); }
.search-item:hover, .search-item.is-active { background: var(--brand-soft); text-decoration: none; }
.search-item-icon { width: 30px; height: 30px; display: grid; place-items: center; background: var(--bg-sunken); border-radius: 7px; flex-shrink: 0; }
.search-item-name { font-weight: 600; font-size: .92rem; }
.search-item-cat { margin-left: auto; font-size: .74rem; color: var(--text-faint); white-space: nowrap; }
.search-empty { padding: 34px 16px; text-align: center; color: var(--text-faint); font-size: .9rem; }
.search-hint { padding: 9px 16px; border-top: 1px solid var(--border); font-size: .74rem; color: var(--text-faint); }
.search-hint kbd {
  font-family: var(--mono); font-size: .68rem; padding: 1px 5px;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 4px; margin-right: 2px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 999px; font-size: .88rem; font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease-out;
}
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Misc pages
   ========================================================================== */
.error-page { text-align: center; padding: 60px 16px 80px; }
.error-code { font-size: 4.5rem; font-weight: 800; color: var(--border-strong); line-height: 1; margin: 0; }
.error-sub { color: var(--text-soft); margin-bottom: 26px; }
.error-page .tool-grid, .error-page .cat-chip-row { text-align: left; margin-top: 16px; }
.cat-chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.results-count { color: var(--text-soft); font-size: .9rem; }
.browse-categories { margin-top: 44px; text-align: center; }
.static-page { padding: 10px 0 60px; }
.updated-note { margin-top: 2.5em; font-size: .82rem; color: var(--text-faint); }

/* ==========================================================================
   Your tools — the localStorage launcher (assets/js/recent.js)
   ========================================================================== */
.launcher { padding: 26px 0 2px; }
.launcher-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.launcher-head h2 { margin: 0; font-size: 1.15rem; }
.launcher-note { margin: 0; font-size: .8rem; color: var(--text-faint); }

.launch-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

/* The card is the link; the pin sits on top of it rather than inside, so the
   whole card stays one tap target and the star stays its own. */
.launch-item { position: relative; display: flex; }
.launch-link {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 38px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s;
  min-width: 0;
}
.launch-link:hover { border-color: var(--brand); transform: translateY(-1px); }
.launch-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.launch-icon { font-size: 1.25rem; line-height: 1; flex: none; }
.launch-name {
  font-weight: 600; font-size: .92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.launch-pin {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--text-faint); font-size: .95rem; line-height: 1;
  cursor: pointer;
}
.launch-pin:hover { color: var(--brand); background: var(--brand-soft); }
.launch-pin.is-pinned { color: var(--brand); }
.launch-pin:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Pin control on a tool page's own header. */
.tool-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.tool-head-top h1 { margin-bottom: .3em; }
.btn-pin {
  flex: none; margin-top: 4px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font: inherit; font-size: .82rem; font-weight: 600;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-pin:hover { border-color: var(--brand-dark); color: var(--text); }
.btn-pin:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-pin-star { color: var(--border-strong); font-size: .9rem; line-height: 1; }
.btn-pin.is-pinned { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.btn-pin.is-pinned .btn-pin-star { color: var(--brand); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-aside { display: none; }   /* 300x600 is desktop-only by design */
}

@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-grid; }
}

@media (max-width: 767px) {
  body { font-size: 15.5px; }
  .tool-inner { padding: 15px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .hero { padding-top: 30px; }
  .hero-search { padding-left: 12px; }
  .hero-search .btn { padding: 0 14px; }
  .footer-links { margin-left: 0; }
  .tool-actions .btn { flex: 1 1 100%; }   /* full-width tap targets */
  .dropzone { min-height: 170px; }

  /* Keep the sticky anchor ad from covering page content. */
  body { padding-bottom: 62px; }
}

@media (max-width: 480px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .mobile-nav .wrap { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .launch-grid { grid-template-columns: 1fr 1fr; }

  /* The h1 needs the full width on a phone; the pin drops below it. */
  .tool-head-top { flex-direction: column; gap: 0; }
  .btn-pin { margin-top: 0; margin-bottom: 10px; order: 2; }
  .tool-head-top h1 { order: 1; }
}

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

@media print {
  .site-header, .site-footer, .ad-slot, .tool-aside, .related-section, .toast-host { display: none !important; }
}
