/* ============================================================
   SmartTools - Modern responsive stylesheet with dark mode
   Mobile-first, light and dark themes, glass cards, gradients.
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: rgba(79,70,229,.10);
  --accent: #f59e0b;
  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --bg-soft: #f4f5f8;
  --border: #e6e8ef;
  --border-strong: #d3d7e2;
  --text: #101828;
  --text-soft: #4b5565;
  --text-mute: #8a93a5;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 2px 6px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 28px -10px rgba(16,24,40,.18);
  --radius: 12px;
  --radius-lg: 16px;
  --grad: linear-gradient(135deg,#4f46e5 0%,#7c3aed 100%);
  --cat: var(--primary);
  /* Overridden by Admin → Site Settings → Typography. */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-head: var(--font-body);
}
html.dark {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-soft: rgba(129,140,248,.14);
  --bg: #0c1016;
  --bg-elev: #141a23;
  --bg-soft: #1b222d;
  --border: #242c39;
  --border-strong: #333d4d;
  --text: #eef2f7;
  --text-soft: #b6c0cf;
  --text-mute: #7c8798;
  --shadow: 0 2px 8px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 34px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, .logo { font-family: var(--font-head); }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }
::selection { background: var(--primary); color: #fff; }

/* ============================================================
   Layout
   ============================================================ */
.container { max-width: 880px; margin: 0 auto; padding: 22px 18px; }
.container-wide { max-width: 1220px; margin: 0 auto; padding: 22px 18px; }

/* Content column plus an optional right rail. The rail only appears when
   there is genuinely room for it, so on a laptop or a phone the tool keeps
   the full width. */
.shell {
  max-width: 1220px; margin: 0 auto; padding: 22px 18px;
  display: grid; gap: 30px;
  grid-template-columns: minmax(0, 1fr);
}
.shell > .rail { display: none; }
@media (min-width: 1180px) {
  .shell { grid-template-columns: minmax(0, 1fr) 300px; }
  .shell > .rail { display: block; }
}
.rail-sticky { position: sticky; top: 78px; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1220px; margin: 0 auto;
  padding: 0 18px; height: 60px;
  display: flex; align-items: center; gap: 14px;
}
.logo {
  font-size: 19px; font-weight: 800;
  color: var(--text); letter-spacing: -.4px;
  display: flex; align-items: center; gap: 9px; flex: none;
}
.logo:hover { color: var(--text); text-decoration: none; }
.logo .accent { color: var(--primary); }
.logo-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.logo-mark::before,
.logo-mark::after { content: ""; position: absolute; background: #fff; border-radius: 2px; }
/* A slash with a dot above it — reads as a tool mark rather than an arrow. */
.logo-mark::before {
  width: 3px; height: 14px; left: 50%; top: 50%;
  transform: translate(-50%,-50%) rotate(24deg);
}
.logo-mark::after { width: 3px; height: 3px; border-radius: 50%; left: 6px; top: 6px; }

/* Search lives in the header on every page — the fastest route to any tool. */
.hsearch { position: relative; flex: 1; max-width: 380px; }
.hsearch input {
  width: 100%; height: 38px; padding: 0 14px 0 36px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text);
  font-size: 14px;
}
.hsearch input:focus { background: var(--bg-elev); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hsearch > .ic { position: absolute; left: 11px; top: 9px; color: var(--text-mute); pointer-events: none; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; list-style: none; }
.nav-links a {
  color: var(--text-soft); font-weight: 550; font-size: 14.5px;
  padding: 8px 11px; border-radius: 8px;
}
.nav-links a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.mobile-toggle, .search-toggle {
  display: none; background: var(--bg-soft); border: none; cursor: pointer;
  color: var(--text); padding: 8px; border-radius: 9px; line-height: 0;
}

/* On a phone the header search would be a 90px-wide box, so it collapses to
   an icon and drops down full width when tapped. */
@media (max-width: 760px) {
  .search-toggle { display: inline-flex; margin-left: auto; }
  .hsearch { display: none; }
  .hsearch.open-mobile {
    display: block; position: absolute; left: 0; right: 0; top: 60px;
    max-width: none; padding: 10px 14px;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .hsearch.open-mobile > .ic { left: 25px; top: 19px; }
  .hsearch.open-mobile .search-panel { left: 14px; right: 14px; top: calc(100% - 4px); }
  .site-header { position: sticky; }
  .header-inner { position: relative; }
}
@media (max-width: 640px) {
  /* Four chips is enough on a phone; the rest are one tap away in search. */
  .quick-row .chip:nth-of-type(n+5) { display: none; }
}
.theme-toggle {
  background: var(--bg-soft); border: none; cursor: pointer;
  color: var(--text-soft); padding: 8px 9px; border-radius: 9px;
  display: inline-flex; align-items: center; flex: none;
}
.theme-toggle:hover { background: var(--border); color: var(--text); }
.ic-sun, .ic-moon { display: none; }
html:not(.dark) .ic-moon { display: block; }
html.dark .ic-sun { display: block; }

/* Search results panel, shared by the header and the homepage box. */
.search-panel {
  position: absolute; z-index: 200; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  max-height: 60vh; overflow-y: auto; display: none;
}
.search-panel.open { display: block; }
.search-panel a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; color: var(--text); border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.search-panel a:last-child { border-bottom: none; }
.search-panel a:hover, .search-panel a.on { background: var(--bg-soft); text-decoration: none; }
.search-panel .ic { color: var(--cat, var(--primary)); flex: none; }
.search-panel .sp-name { font-weight: 600; }
.search-panel .sp-cat { margin-left: auto; font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.search-empty { padding: 14px; font-size: 13.5px; color: var(--text-mute); }

/* ============================================================
   Homepage masthead — small on purpose. The tools are the point.
   ============================================================ */
.masthead {
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 12% 0%, var(--primary-soft) 0, transparent 42%),
    var(--bg-elev);
}
.masthead-inner { max-width: 1220px; margin: 0 auto; padding: 44px 18px 34px; }
.masthead h1 {
  font-size: 40px; font-weight: 800; letter-spacing: -1.4px;
  line-height: 1.1; max-width: 15ch; margin-bottom: 12px;
}
.masthead h1 em { font-style: normal; color: var(--primary); }
.masthead .lede { font-size: 17px; color: var(--text-soft); max-width: 52ch; line-height: 1.6; }
.bigsearch { position: relative; margin-top: 24px; max-width: 560px; }
.bigsearch input {
  width: 100%; height: 54px; padding: 0 18px 0 48px;
  font-size: 16px; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.bigsearch input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.bigsearch > .ic { position: absolute; left: 17px; top: 16px; color: var(--text-mute); pointer-events: none; }
.quick-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 16px; font-size: 13.5px;
}
.quick-row .label { color: var(--text-mute); font-weight: 600; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-soft); font-weight: 550; font-size: 13px;
}
.chip:hover { border-color: var(--cat, var(--primary)); color: var(--text); text-decoration: none; }
.chip .ic { color: var(--cat, var(--primary)); }
.trust-strip {
  display: flex; flex-wrap: wrap; gap: 18px 28px;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-soft);
}
.trust-item { display: inline-flex; align-items: center; gap: 8px; }
.trust-item .ic { color: var(--primary); }
.trust-item b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============================================================
   Homepage body — category rail beside the tool list
   ============================================================ */
.home-grid {
  max-width: 1220px; margin: 0 auto; padding: 26px 18px 10px;
  display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1000px) { .home-grid { grid-template-columns: 194px minmax(0, 1fr); } }
.cat-rail { position: sticky; top: 76px; align-self: start; }
.cat-rail .rail-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-mute); margin-bottom: 10px;
}
.cat-rail a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px; margin-bottom: 2px;
  color: var(--text-soft); font-size: 14px; font-weight: 550;
  border-left: 2px solid transparent;
}
.cat-rail a .ic { color: var(--cat); }
.cat-rail a .n { margin-left: auto; font-size: 11.5px; color: var(--text-mute); }
.cat-rail a:hover, .cat-rail a.active {
  background: var(--bg-soft); color: var(--text);
  border-left-color: var(--cat); text-decoration: none;
}
@media (max-width: 999px) {
  .cat-rail { position: static; }
  .cat-rail nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .cat-rail a { border: 1px solid var(--border); border-left-width: 2px; white-space: nowrap; margin: 0; }
  .cat-rail a .n { margin-left: 4px; }
}

.cat-block { scroll-margin-top: 80px; }
.cat-head {
  display: flex; align-items: center; gap: 11px;
  padding-bottom: 10px; margin: 30px 0 14px;
  border-bottom: 2px solid var(--cat);
}
.cat-block:first-child .cat-head { margin-top: 0; }
.cat-head .ic { color: var(--cat); }
.cat-head h2 { font-size: 19px; font-weight: 750; letter-spacing: -.3px; }
.cat-head .count {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-mute);
}
.cat-head .desc { display: none; }

/* ============================================================
   Tool page header
   ============================================================ */
.tool-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 26px 0 22px;
}
.tool-header .container, .tool-header .container-wide { padding-top: 0; padding-bottom: 0; }
.tool-header h1 {
  font-size: 31px; font-weight: 800; color: var(--text);
  margin-bottom: 7px; letter-spacing: -.8px; line-height: 1.15;
}
.tool-header .subtitle { color: var(--text-soft); font-size: 15.5px; max-width: 62ch; }
.breadcrumb { font-size: 13px; color: var(--text-mute); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-mute); }
.breadcrumb a:hover { color: var(--primary); }

/* ============================================================
   Cards / sections
   ============================================================ */
.tool-card, .content-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.tool-card h2, .content-section h2 {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; letter-spacing: -.3px;
}
.content-section h3 {
  font-size: 18px; font-weight: 700; color: var(--text);
  margin: 20px 0 10px;
}
.content-section p { margin-bottom: 12px; color: var(--text-soft); }
.content-section ul, .content-section ol {
  margin: 12px 0 12px 22px; color: var(--text-soft);
}
.content-section li { margin-bottom: 6px; }
.content-section table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.content-section th, .content-section td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.content-section th { background: var(--bg-soft); font-weight: 700; color: var(--text); }

/* ============================================================
   Forms
   ============================================================ */
label {
  display: block;
  font-weight: 600; color: var(--text);
  margin-bottom: 8px; font-size: 14px;
}
textarea, input[type=text], input[type=number], input[type=email],
input[type=password], input[type=url], select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  border-radius: 10px;
  font-size: 15px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .1s, background .15s, box-shadow .15s;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(99,102,241,.3);
}
.btn:hover { background: var(--primary-dark); color: #fff; text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-soft); color: var(--text); box-shadow: none; }
.btn-secondary:hover { background: var(--border); color: var(--text); box-shadow: none; }
.btn-success { background: linear-gradient(135deg,#16a34a,#22c55e); box-shadow: 0 2px 6px rgba(22,163,74,.3); }
.btn-success:hover { background: linear-gradient(135deg,#15803d,#16a34a); }
.btn-danger { background: linear-gradient(135deg,#dc2626,#ef4444); box-shadow: 0 2px 6px rgba(220,38,38,.3); }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-gradient { background: var(--grad); box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.btn-gradient:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,.5); }

/* ============================================================
   Ads

   Every unit is framed and labelled, sits outside the tool itself, and is
   sized so it can never push the tool below the fold.
   ============================================================ */
.ad-pos {
  margin: 26px 0; padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center; overflow: hidden;
}
.ad-pos .ad-label {
  display: block; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.1px;
  color: var(--text-mute); margin-bottom: 8px;
}
.ad-pos ins { display: block; }
.ad-pos-top { margin-top: 20px; }
.ad-pos-sidebar { margin: 0 0 20px; min-height: 250px; }

/* Build-time preview: shows where each position sits without any ad code. */
.ad-preview {
  background: repeating-linear-gradient(45deg, transparent, transparent 9px,
              var(--primary-soft) 9px, var(--primary-soft) 18px);
  border: 1.5px dashed var(--border-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 20px; min-height: 96px;
}
.ad-pos-top.ad-preview, .ad-pos-bottom.ad-preview { min-height: 116px; }
.ad-pos-sidebar.ad-preview { min-height: 500px; }
.ad-slot-tag {
  font-size: 11.5px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .09em;
}
.ad-slot-note { font-size: 12px; color: var(--text-mute); max-width: 34ch; line-height: 1.5; }

/* Sticky mobile bar. Dismissible, and never shown on desktop. */
.ad-anchor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  background: var(--bg-elev); border-top: 1px solid var(--border);
  padding: 6px 10px; box-shadow: 0 -4px 16px rgba(16,24,40,.12);
}
.ad-anchor .ad-pos { margin: 0; padding: 6px; border: none; background: none; }
.ad-anchor-close {
  position: absolute; right: 6px; top: -13px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-soft); font-size: 16px; line-height: 1; cursor: pointer;
}
@media (min-width: 900px) { .ad-anchor { display: none; } }
body.has-anchor-ad { padding-bottom: 78px; }

/* ============================================================
   Tool tiles
   ============================================================ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 10px; margin: 14px 0 6px;
}
.tool-tile {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cat);
  border-radius: 11px;
  padding: 13px 14px;
  color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tool-tile:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong); border-left-color: var(--cat);
  transform: translateY(-1px); text-decoration: none;
}
.tile-icon {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 10%, transparent);
}
/* color-mix is recent; older browsers just get the plain tint. */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .tile-icon { background: var(--bg-soft); }
}
.tile-body { min-width: 0; flex: 1; }
.tile-name {
  display: block; font-size: 14.5px; font-weight: 700;
  color: var(--text); letter-spacing: -.2px;
}
.tile-desc {
  display: block; font-size: 12.5px; color: var(--text-soft);
  line-height: 1.5; margin-top: 2px;
}
.tile-go { flex: none; color: var(--text-mute); transition: transform .15s, color .15s; }
.tool-tile:hover .tile-go { color: var(--cat); transform: translateX(3px); }

/* Legacy category header, still used by the blog listing. */
.category-head { display: flex; align-items: baseline; gap: 13px; margin: 38px 0 2px; }
.category-head .rule { flex: 1; height: 1px; background: var(--border); }
.category-title {
  font-size: 21px; font-weight: 750; color: var(--text);
  margin: 26px 0 4px; letter-spacing: -.4px;
  display: flex; align-items: center; gap: 9px;
}
.category-head .category-title { margin: 0; }
.category-count {
  font-size: 12px; font-weight: 600; color: var(--text-mute);
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.category-desc { color: var(--text-soft); margin-bottom: 6px; font-size: 14px; }

/* ============================================================
   FAQ
   ============================================================ */
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-question {
  font-weight: 700; color: var(--text); cursor: pointer;
  font-size: 16px; padding-right: 30px; position: relative;
  list-style: none;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
  content: "+"; position: absolute; right: 0; top: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-soft); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 400; transition: background .15s, transform .2s;
}
.faq-item[open] .faq-question::after { content: "−"; background: var(--primary); color: #fff; }
.faq-answer { margin-top: 12px; color: var(--text-soft); line-height: 1.7; }

/* ============================================================
   Fancy list output
   ============================================================ */
.fancy-list { display: grid; gap: 10px; margin-top: 16px; }
.fancy-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s;
}
.fancy-item:hover { border-color: var(--primary); }
.fancy-text { font-size: 18px; color: var(--text); word-break: break-word; flex: 1; }
.copy-btn {
  background: var(--primary); color: #fff; border: none;
  padding: 7px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: background .15s;
}
.copy-btn:hover { background: var(--primary-dark); }
.copy-btn.copied { background: #16a34a; }

/* Tag chips (YouTube) */
.tag-output {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 16px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 10px;
  min-height: 60px; margin-top: 12px;
}
.tag-chip {
  background: var(--bg-elev); color: var(--primary);
  padding: 6px 12px; border-radius: 16px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
}

/* Result box */
.result-box {
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(139,92,246,.08));
  border: 1.5px solid rgba(99,102,241,.2);
  border-radius: 12px; padding: 24px;
  margin-top: 16px; text-align: center;
}
.result-box .result-value {
  font-size: 40px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -.5px;
}
.result-box .result-label { color: var(--text-soft); font-size: 14px; margin-top: 4px; }
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-top: 16px;
}
.result-grid .stat {
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 16px; border-radius: 10px; text-align: center;
}
.result-grid .stat-value { font-size: 24px; font-weight: 800; color: var(--primary); }
.result-grid .stat-label { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

/* Options row */
.options-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin: 14px 0;
}

/* ============================================================
   Blog
   ============================================================ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin: 24px 0;
}
.post-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none; color: inherit; display: block;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.post-card .date { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .5px; }
.post-card h3 { font-size: 20px; font-weight: 700; margin: 8px 0; color: var(--text); }
.post-card p { color: var(--text-soft); font-size: 14px; }
.post-content { line-height: 1.8; color: var(--text-soft); font-size: 16px; }
.post-content h2 { font-size: 26px; margin: 28px 0 12px; color: var(--text); }
.post-content h3 { font-size: 20px; margin: 22px 0 10px; color: var(--text); }
.post-content p { margin-bottom: 14px; }
.post-content img { border-radius: 10px; margin: 16px 0; }
.post-content ul, .post-content ol { margin: 12px 0 12px 24px; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
  border-left: 4px solid var(--primary);
  background: var(--bg-soft); padding: 14px 20px;
  margin: 18px 0; border-radius: 0 10px 10px 0;
  font-style: italic; color: var(--text-soft);
}

/* ============================================================
   Flash message
   ============================================================ */
.flash {
  max-width: 1200px; margin: 12px auto 0; padding: 12px 20px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
}
.flash-success { background: rgba(22,163,74,.1); color: #16a34a; border: 1px solid rgba(22,163,74,.2); }
.flash-error   { background: rgba(220,38,38,.1); color: #dc2626; border: 1px solid rgba(220,38,38,.2); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { background: #0b1120; color: #cbd5e1; padding: 60px 20px 24px; margin-top: 60px; }
html.dark .site-footer { background: #0a0f1e; }
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
}
.footer-brand {
  font-size: 22px; font-weight: 800; color: #fff;
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.footer-brand .accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.footer-about { font-size: 14px; line-height: 1.7; color: #94a3b8; margin-bottom: 16px; max-width: 340px; }
.social { display: flex; gap: 10px; }
.social a {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.08); color: #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.social a:hover { background: var(--primary); color: #fff; }
.footer-col h4 {
  color: #fff; font-size: 14px; font-weight: 700;
  margin-bottom: 14px; text-transform: uppercase; letter-spacing: .5px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: #cbd5e1; font-size: 14px; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  max-width: 1200px; margin: 40px auto 0; padding-top: 24px;
  border-top: 1px solid #1e293b; text-align: center;
  color: #64748b; font-size: 13px;
}

/* ============================================================
   Overflow guards

   Anything that can exceed its container gets handled here rather than
   per-page, so a long URL or a wide table can never make the whole document
   scroll sideways on a phone.
   ============================================================ */

/* Tables are wrapped by main.js; the wrapper scrolls, the table keeps its
   real layout. .table-scroll also applies to admin tables. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  /* A soft right edge hints that there is more to scroll. */
  background:
    linear-gradient(to right, var(--bg-elev) 30%, rgba(255,255,255,0)),
    linear-gradient(to right, rgba(255,255,255,0), var(--bg-elev) 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(15,23,42,.14), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(15,23,42,.14), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
  background-color: var(--bg-elev);
}
.table-scroll > table {
  margin: 0;
  border: none;
  border-radius: 0;
  min-width: 100%;
  width: auto;
}
.table-scroll > table th,
.table-scroll > table td { white-space: nowrap; }
/* The first column usually holds the label, which may wrap. */
.table-scroll > table td:first-child { white-space: normal; min-width: 120px; }

/* Long unbroken strings — URLs, code samples, generated passwords. */
code, kbd, samp { overflow-wrap: anywhere; word-break: break-word; }
.content-section p code,
.faq-answer code,
.post-content code { white-space: normal; }

/* Anything the visitor pastes in can be arbitrarily long. */
.fancy-text, .pw-value, .tag-chip, .breadcrumb { overflow-wrap: anywhere; }
textarea, input, select { max-width: 100%; }

/* Prose links can be long bare URLs. */
.content-section a, .post-content a, .faq-answer a { overflow-wrap: anywhere; }

/* ============================================================
   Tap targets

   Everything interactive clears 44px on touch devices. Checked with the
   audit script rather than assumed.
   ============================================================ */
.faq-question {
  min-height: 44px;
  display: flex; align-items: center;
  padding-right: 40px;
}
.faq-question::after { top: 50%; transform: translateY(-50%); right: 2px; }
.faq-item[open] .faq-question::after { transform: translateY(-50%); }

.copy-btn { min-height: 40px; padding: 9px 16px; }
.btn { min-height: 44px; }
.btn-sm { min-height: 40px; padding: 9px 14px; }

/* Breadcrumb links sit on every tool page and are the smallest targets on the
   site, so they get real padding at every width rather than only on touch. */
.breadcrumb { line-height: 2; }
.breadcrumb a { display: inline-block; padding: 8px 2px; margin: -8px 0; }

/* Nothing below 12px anywhere. */
.tag-inline, .badge, .ad-pos .ad-label,
.post-card .date, .result-grid .stat-label { font-size: 12px; }

/* ============================================================
   Mobile — public site
   ============================================================ */
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px; }
  .container { max-width: 100%; }
}

@media (max-width: 768px) {
  /* The masthead stays short so the first tool is visible without scrolling. */
  .masthead-inner { padding: 26px 16px 22px; }
  .masthead h1 { font-size: clamp(25px, 7.4vw, 32px); letter-spacing: -1px; max-width: none; }
  .masthead .lede { font-size: 14.5px; }
  .bigsearch { margin-top: 16px; }
  .bigsearch input { height: 48px; font-size: 15px; padding-left: 44px; }
  .bigsearch > .ic { top: 13px; left: 15px; }
  .trust-strip { gap: 10px 20px; margin-top: 18px; padding-top: 14px; font-size: 12.5px; }
  .quick-row { gap: 7px; margin-top: 13px; }
  .home-grid { padding: 18px 16px 6px; gap: 20px; }

  .tool-header { padding: 20px 16px 18px; }
  .tool-header h1 { font-size: clamp(22px, 6.2vw, 28px); letter-spacing: -.5px; }
  .tool-header .subtitle { font-size: 14.5px; }
  .breadcrumb { font-size: 12.5px; margin-bottom: 10px; }

  .content-section, .tool-card { padding: 18px 16px; border-radius: 12px; }
  .content-section h2, .tool-card h2 { font-size: 18.5px; }
  .content-section h3 { font-size: 16.5px; }
  .content-section p, .content-section li { font-size: 14.5px; }

  /* Header becomes a slide-down sheet rather than a cramped dropdown. */
  .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; }
  .header-inner { padding: 11px 16px; }
  .logo { font-size: 19px; }
  .logo-mark { width: 27px; height: 27px; }
  .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-elev);
    flex-direction: column; align-items: stretch;
    padding: 8px 16px 14px; gap: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px -8px rgba(15,23,42,.18);
    max-height: calc(100vh - 62px); overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 13px 8px; border-radius: 8px; font-size: 15.5px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links a:last-of-type { border-bottom: none; }
  .theme-toggle {
    margin: 10px 0 0; align-self: flex-start;
    width: auto; padding: 10px 16px; gap: 8px;
    border-radius: 8px; font-size: 14px; font-weight: 600;
  }
  .theme-toggle::after { content: "Theme"; }

  /* One column on a phone: the row layout already packs two lines of text
     into 60px, so a second column would only shrink the tap target. */
  .tool-grid { grid-template-columns: 1fr; gap: 8px; }
  .tool-tile { padding: 12px; }
  .tool-tile:hover { transform: none; }
  .tile-name { font-size: 14px; }
  .tile-desc { font-size: 12.5px; }
  .cat-head { margin: 24px 0 12px; }
  .cat-head h2 { font-size: 17.5px; }

  .category-head { margin: 30px 0 2px; gap: 10px; flex-wrap: wrap; }
  .category-title { font-size: 20px; }
  .category-count { font-size: 11.5px; padding: 2px 9px; }

  .options-row { grid-template-columns: 1fr; gap: 12px; }
  .result-box { padding: 18px 14px; }
  .result-box .result-value { font-size: 29px; }
  .result-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .result-grid .stat { padding: 13px 10px; }
  .result-grid .stat-value { font-size: 19px; }

  .btn-group { gap: 8px; }
  .btn { padding: 12px 18px; font-size: 14.5px; flex: 1 1 auto; justify-content: center; }

  .fancy-item { padding: 12px 13px; gap: 10px; }
  .fancy-text { font-size: 16px; }

  .post-grid { grid-template-columns: 1fr; gap: 14px; }
  .post-card { padding: 18px 16px; }
  .post-card h3 { font-size: 18px; }
  .post-content { font-size: 15.5px; }
  .post-content h2 { font-size: 22px; margin: 24px 0 10px; }
  .post-content h3 { font-size: 18px; }

  .footer-inner { grid-template-columns: 1fr; gap: 26px; }
  .site-footer { padding: 40px 18px 20px; margin-top: 44px; }
  .footer-about { max-width: none; }

  .ad-pos { margin: 18px 0; }
  .ad-preview { min-height: 88px; padding: 16px; }
}

@media (max-width: 480px) {
  .container, .container-wide, .shell { padding: 16px 14px; }
  .masthead h1 { font-size: 24px; }
  .content-section, .tool-card { padding: 16px 14px; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .pw-value { font-size: 16px; }
  .pw-checks { grid-template-columns: 1fr; }
  .qr-stage { padding: 16px 12px; }
  .btn { width: 100%; }
  .btn-group { flex-direction: column; }
  .fancy-item { flex-direction: row; align-items: center; }
}

/* Very narrow phones — the layout still has to hold at 320px. */
@media (max-width: 360px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-tile { padding: 14px; }
  .tool-tile h3 { font-size: 15px; }
  .logo { font-size: 17px; }
  .tool-header h1 { font-size: 21px; }
}

/* Landscape phones: reclaim vertical space. */
@media (max-height: 480px) and (orientation: landscape) {
  .site-header { position: static; }
}

/* Accessibility */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Tool components
   ============================================================ */
.field-row { margin-bottom: 14px; }

/* QR generator */
.qr-stage {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin: 22px 0; padding: 22px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
}
/* The canvas is sized in JS; these keep it inside the column on a phone. */
.qr-stage canvas {
  border-radius: 8px;
  max-width: 100% !important;
  height: auto !important;
}
.qr-meta { font-size: 12.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; text-align: center; }

/* Password generator */
.pw-display {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.pw-value {
  flex: 1 1 200px; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px; font-weight: 600; color: var(--text);
  word-break: break-all; line-height: 1.45;
}
.pw-meter { margin-top: 14px; }
.pw-meter-bar { height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.pw-meter-bar > div { height: 100%; width: 0; border-radius: 3px; transition: width .25s, background .25s; }
.pw-meter-text {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; margin-top: 6px; color: var(--text-mute);
}
.pw-meter-text span:first-child { font-weight: 700; }
.pw-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.pw-check {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 9px;
  font-weight: 400; font-size: 13.5px; cursor: pointer; margin-bottom: 0;
  min-height: 44px; transition: border-color .15s;
}
.pw-check:hover { border-color: var(--primary); }
.pw-check input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.pw-check code {
  font-family: ui-monospace, monospace; font-size: 12px;
  color: var(--text-mute); background: var(--bg-elev);
  padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border);
}

/* Range sliders — the thumb needs to be big enough to grab on a phone. */
input[type=range] {
  width: 100%; height: 44px; padding: 0; margin: 6px 0 0;
  -webkit-appearance: none; appearance: none;
  background: transparent; border: none; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: var(--bg-soft); border: 1px solid var(--border);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%; margin-top: -10px;
  background: var(--primary); cursor: pointer; border: 3px solid var(--bg-elev);
  box-shadow: 0 1px 5px rgba(99,102,241,.5);
}
input[type=range]::-moz-range-track {
  height: 6px; border-radius: 3px; background: var(--bg-soft); border: 1px solid var(--border);
}
input[type=range]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); cursor: pointer; border: 3px solid var(--bg-elev);
}
input[type=color] { padding: 3px; cursor: pointer; min-height: 44px; }
input[type=date], input[type=number], input[type=text] { min-height: 44px; }
select { min-height: 44px; }
input[type=checkbox] { min-width: 18px; min-height: 18px; }

/* Inline code in prose */
.content-section code, .faq-answer code, .post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; background: var(--bg-soft);
  padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border);
}

/* ============================================================
   Final tap-target and legibility pass

   Applied by width rather than by pointer type: the pointer media query does
   not match every touch device, and a larger target harms nobody on desktop.
   ============================================================ */
@media (max-width: 768px) {
  .footer-col a { display: inline-block; padding: 9px 0; min-height: 40px; line-height: 22px; }
  .footer-col li { margin-bottom: 2px; }
  .logo { padding: 7px 0; }
  .social a { width: 42px; height: 42px; }
}

/* ============================================================
   Mobile polish
   ============================================================ */
@media (max-width: 768px) {
  /* Colour pickers are narrow controls; stacking them wastes a whole row. */
  .options-row > div:has(input[type=color]) { display: inline-block; width: calc(50% - 6px); }
  input[type=color] { width: 100%; height: 46px; }

  /* The badge strip scrolls; fade the trailing edge so the cut is deliberate. */

  /* Tool cards use the whole tile as the link, so keep the press state obvious. */
  .tool-tile:active { transform: scale(.985); }
  .btn:active { transform: scale(.985); }
}

/* Fallback for browsers without :has() — the pickers simply stack, which is fine. */
@supports not (selector(:has(*))) {
  @media (max-width: 768px) { input[type=color] { width: 100%; } }
}

/* Optional CMS intro paragraph above a tool widget. */
.tool-intro {
  max-width: 70ch;
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: 15.5px;
  line-height: 1.75;
}
.tool-intro p { margin-bottom: 10px; }
.tool-intro a { color: var(--primary); font-weight: 600; }

/* ============================================================
   Side rail cards
   ============================================================ */
.rail-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}
.rail-card-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-mute);
  margin-bottom: 9px;
}
.rail-card a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; margin: 0 -8px; border-radius: 8px;
  color: var(--text-soft); font-size: 13.5px; font-weight: 550;
}
.rail-card a .ic { color: var(--cat); flex: none; }
.rail-card a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.rail-all {
  margin-top: 6px !important; font-size: 12.5px !important;
  color: var(--cat) !important; font-weight: 650 !important;
}

/* The category colour carries through to the tool's own readout, so a
   calculator and a text tool never look like the same page twice. */
.tool-header { border-top: 3px solid var(--cat); }
.result-box .result-value, .result-grid .stat-value { color: var(--cat); }
.tool-card h2 { border-left: 3px solid var(--cat); padding-left: 10px; margin-left: -13px; }

/* Homepage masthead: copy and search on the left, a quick-access card on
   the right instead of empty space. */
@media (min-width: 900px) {
  .masthead-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) 296px;
    gap: 40px; align-items: start;
  }
  .masthead-side { padding-top: 4px; }
}
.masthead-foot { padding-top: 0; padding-bottom: 20px; display: block !important; }
.masthead-foot .trust-strip { margin-top: 0; }
.masthead-side { display: none; }
@media (min-width: 900px) { .masthead-side { display: block; } }
.recent-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 14px; padding: 15px; box-shadow: var(--shadow);
}
.recent-card h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-mute); margin-bottom: 10px;
}
.recent-card a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; margin: 0 -8px; border-radius: 9px;
  color: var(--text); font-size: 13.5px; font-weight: 600;
}
.recent-card a .ic { color: var(--cat, var(--primary)); flex: none; }
.recent-card a:hover { background: var(--bg-soft); text-decoration: none; }
.recent-card a .when { margin-left: auto; font-size: 11.5px; color: var(--text-mute); font-weight: 500; }

/* Blog pagination */
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap; margin: 26px 0 6px;
}
.pager-count { font-size: 13.5px; color: var(--text-mute); }
