:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #1e3a8a;          /* all UI borders: dark blue */
  --border-strong: #172554;
  --cat-selected-bg: #dbeafe;  /* light blue: selected category on the blue top bar */
  --cat-selected-text: #1e3a8a;
  --accent: #2563eb;
  --bar: #2563eb;              /* action bar: same in light + dark, matches <meta name="theme-color"> */
  --accent-text: #ffffff;
  --accent-soft: #e8f0fe;
  --accent-soft-hover: #d4e3fd;
  --accent-border: #bfd4fb;
  --accent-strong: #1d4ed8;
  --selected-bg: #ffffff;
  --selected-border: #cbd5e1;
  --chip: #eef2f7;
  --ad: #f1f3f6;
  --danger: #b91c1c;
  --radius: 10px;
  --side-ad: 160px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #3b5bdb;          /* dark blue, light enough to see on the dark background */
    --border-strong: #748ffc;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, .16);
    --accent-soft-hover: rgba(59, 130, 246, .26);
    --accent-border: rgba(59, 130, 246, .40);
    --accent-strong: #2563eb;
    --selected-bg: #2a2f3a;
    --selected-border: #4b5563;
    --chip: #222733;
    --ad: #1b1f27;
    --danger: #f87171;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: var(--side-ad) minmax(0, 1fr) var(--side-ad);
  grid-template-areas:
    "top    top    top"
    "adl    main   adr"
    "foot   foot   foot";
}
.top-bars    { grid-area: top; }
.ad-left     { grid-area: adl; }
.tool-area   { grid-area: main; }
.ad-right    { grid-area: adr; }
.site-footer { grid-area: foot; }


/* ---------- Pinned top bars: [logo + title + categories] then [tools] ---------- */
.top-bars {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 20;
  margin: 0 -16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}
/* Blue action bar (theme colour) */
.site-header {
  display: flex; align-items: center; gap: 16px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;   /* notch-safe when opened full screen */
  background: var(--bar); color: #fff;
}
.tools-menu { padding: 8px 16px; }
.brand {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--accent-text); text-decoration: none;
  font-weight: 700; font-size: 1.2rem; white-space: nowrap;
}
.brand-logo { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; background: #fff; }
.categories { flex: 1 1 auto; min-width: 0; }
/* Category chips on the blue bar: translucent white; selected = light blue so it stands out */
.site-header .cat { background: rgba(255, 255, 255, .14); color: var(--accent-text); }
.site-header .cat:hover { background: rgba(255, 255, 255, .24); }
.site-header .cat[aria-selected="true"] { background: var(--cat-selected-bg); color: var(--cat-selected-text); }

/* ---------- Categories (horizontal scroll) ---------- */
.scroller {
  display: flex; gap: 8px;
  overflow-x: auto; padding: 4px 0;
  scroll-snap-type: x proximity;
  scrollbar-width: none;            /* no scroll bar: the ‹ › arrows scroll the row */
}
.scroller::-webkit-scrollbar { display: none; }
/* Categories and tools share one look: chip colour + border, solid accent when selected. */
.cat, .tool-card {
  flex: 0 0 auto; scroll-snap-align: start;
  border: 1px solid var(--border); background: var(--chip); color: var(--text);
  font: inherit; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.cat:hover, .tool-card:hover { border-color: var(--border-strong); }
.cat[aria-selected="true"], .tool-card[aria-current="page"] {
  background: var(--accent); color: var(--accent-text); border-color: var(--border);
}

/* Category chip: icon then name */
.cat {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 6px 14px 6px 10px; white-space: nowrap;
}
.cat-icon { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }

/* Tool tile: icon on top, name below; one sideways-scrolling row */
.tool-list { gap: 8px; }
.tool-card {
  width: 92px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 6px; border-radius: var(--radius); text-align: center;
}
.tool-card img { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; background: var(--surface); }
.tool-name {
  font-size: 12px; line-height: 1.25; width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.5em;   /* two lines, so every tile has the same height */
}
.empty { color: var(--muted); padding: 8px 0; }

/* ---------- Ads ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: var(--radius);
}
.ad-provider:empty { display: none; }
.ad-house { display: block; width: 100%; line-height: 0; color: inherit; text-decoration: none; }
.house-tall { display: block; max-width: 100%; height: auto; border-radius: var(--radius); }
/* Side banners shrink to fit between the pinned top bars and the floating bottom bar */
.ad-left .house-tall, .ad-right .house-tall { width: auto; max-height: calc(100vh - 156px - 116px); margin: 0 auto; }

/* Wide house banner: plain HTML so it fills any width (same width as the page content) */
.house-wide {
  display: flex; align-items: center; gap: 14px;
  width: 100%; height: 90px; padding: 0 20px; box-sizing: border-box;
  border-radius: var(--radius); line-height: 1.3; color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
}
.hw-logo { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; background: #fff; }
.hw-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.hw-text b { font-size: 18px; }
.hw-text span { font-size: 14px; color: #e0e7ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-cta { flex: 0 0 auto; padding: 8px 18px; border-radius: 999px; background: #fff; color: #1d4ed8; font-weight: 700; }

/* Desktop: side slots use the tall image; phones swap the left slot to the wide banner */
.ad-left .house-wide, .ad-right .house-wide { display: none; }
.ad-left .ad-slot, .ad-right .ad-slot {
  position: -webkit-sticky; position: sticky; top: 156px;   /* below the pinned top bars */
  align-items: flex-start; justify-content: center;
}

/* Floating bottom ad: fixed to the bottom of the screen */
.ad-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; align-items: center;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
}
.ad-bottom .ad-slot { position: relative; width: 100%; max-width: calc(1400px - 32px); height: 90px; }   /* same width as the page content */
/* Leave room at the end of the page so the copyright is never hidden behind the bar */
body.has-ad-bar { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }

.no-support {
  padding: 12px 16px; text-align: center; background: #fef3c7; color: #78350f; font-weight: 600;
}

/* ---------- Shared tool UI kit (tf-*) ----------
   Tools use these classes so every tool has the same buttons and theme colours.
   <div class="tf-toolbar"> <button class="tf-btn tf-btn-primary"><svg…/> Count</button> … </div>
*/
.tf-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
/* Input | output side by side; stacks automatically when the tool area is narrow (phones) */
.tf-split {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.tf-pane { min-width: 0; display: flex; flex-direction: column; }
.tf-toolbar .tf-spacer { flex: 1 1 auto; }
.tf-field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; }
.tf-label { font-weight: 600; font-size: 14px; }
.tf-hint { color: var(--muted); font-size: 13px; }
.tf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 16px; border-radius: 999px;
  /* default: solid theme blue */
  border: 1px solid var(--border); background: var(--accent); color: var(--accent-text);
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, color .15s;
}
.tf-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.tf-btn:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--border-strong); }
.tf-btn:active:not(:disabled) { transform: translateY(1px); }
.tf-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tf-btn:disabled { opacity: .5; cursor: default; }
.tf-btn-primary { background: var(--accent); border-color: var(--border); color: var(--accent-text); }
.tf-btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--border-strong); }
/* selected option in a group = white / grey */
.tf-btn[aria-pressed="true"] {
  background: var(--selected-bg); border-color: var(--border); color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08);
}
.tf-btn[aria-pressed="true"]:hover:not(:disabled) { background: var(--selected-bg); border-color: var(--border-strong); }
.tf-btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.tf-btn-sm svg { width: 16px; height: 16px; }
/* Text "icon" for buttons whose meaning is a letter style (e.g. Aa, AB) */
.tf-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 4px; border-radius: 6px;
  background: rgba(255, 255, 255, .25); color: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0;
}
.tf-btn[aria-pressed="true"] .tf-glyph { background: var(--chip); color: var(--text); }

/* ---------- Tool area ---------- */
.tool-area {
  position: relative;
  min-height: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.tool-intro h1 { margin: 0 0 4px; font-size: 1.5rem; }
.tool-intro p { margin: 0 0 16px; color: var(--muted); }

/* ---------- Loader ---------- */
/* Loading popup: fixed to the screen (visible whatever the scroll position), above the bars and ads */
.loader {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100;   /* not "inset" (Safari < 14.1) */
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: loader-fade .15s ease-out;
}
.loader-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  width: min(380px, 100%); padding: 28px 24px 20px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .35);
  animation: loader-pop .2s ease-out;
}
@keyframes loader-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes loader-pop { from { transform: translateY(8px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .loader, .loader-card { animation: none; } }
.loader-icon { width: 72px; height: 72px; border-radius: 16px; }
.loader-name { font-weight: 700; font-size: 1.2rem; }
.loader-msg { color: var(--muted); min-height: 1.5em; }
.loader.error .loader-msg { color: var(--danger); }
.bar {
  width: 100%; height: 8px; border-radius: 999px;
  background: var(--chip); overflow: hidden;
}
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .15s; }
.bar.indeterminate .bar-fill { width: 35%; animation: slide 1.1s ease-in-out infinite; }
.loader.error .bar { display: none; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.retry {
  font: inherit; font-weight: 600; padding: 8px 24px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; background: var(--accent); color: var(--accent-text);
}
.retry:hover { background: var(--accent-strong); }
.powered { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 0 20px; }

/* Phone: hide right ad, move left ad between tools menu and tool area */
@media (max-width: 768px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "adl" "main" "foot";
  }
  .ad-right { display: none; }
  .ad-left .ad-slot { min-height: 0; position: static; }
  .ad-left .house-tall { display: none; }
  .ad-left .house-wide { display: flex; }
  .house-wide { height: 64px; padding: 0 12px; gap: 10px; }
  .hw-logo { width: 36px; height: 36px; }
  .hw-text b { font-size: 15px; }
  .hw-text span { font-size: 12px; }
  .hw-cta { display: none; }
  .ad-bottom .ad-slot { height: 56px; }
  .ad-bottom .house-wide { height: 56px; }
  body.has-ad-bar { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}

/* Shown only in the Tool Factory's local preview */
.preview-banner {
  position: sticky; top: 0; z-index: 50;
  padding: 6px 16px; text-align: center;
  background: #f59e0b; color: #111827; font-size: 13px; font-weight: 600;
}

/* Phone: keep logo + categories in one bar; shorten the brand */
@media (max-width: 480px) {
  .site-header { gap: 10px; }
  .brand { font-size: 1rem; gap: 6px; }
  .brand-logo { width: 32px; height: 32px; }
}


/* ---------- ‹ › arrows for sideways-scrolling rows ---------- */
.arrow-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.arrow-wrap > .scroller, .arrow-wrap > .card-row { flex: 1 1 auto; min-width: 0; }
.arrow-btn {
  display: none; flex: 0 0 auto; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid var(--border); background: var(--accent); color: var(--accent-text);
  -webkit-tap-highlight-color: transparent; transition: opacity .15s, background-color .15s;
}
.arrow-btn svg { width: 18px; height: 18px; }
.arrow-btn:hover { background: var(--accent-strong); }
.arrow-wrap.has-overflow .arrow-btn { display: inline-flex; }
.arrow-btn.is-off { opacity: .3; pointer-events: none; }
/* On the blue action bar: white arrows */
.arrows-bar .arrow-btn { background: rgba(255, 255, 255, .18); color: #fff; }
.arrows-bar .arrow-btn:hover { background: rgba(255, 255, 255, .3); }
.arrows-cards .arrow-btn { width: 36px; height: 36px; }

/* ---------- Home screen ---------- */
/* On the home screen: no side ads, no tools row under the action bar; only the bottom ad. */
body.is-home .ad-left, body.is-home .ad-right, body.is-home .tools-menu { display: none; }
body.is-home .page { grid-template-areas: "top top top" "main main main" "foot foot foot"; }
@media (max-width: 768px) {
  body.is-home .page { grid-template-areas: "top" "main" "foot"; }
}

.home { display: flex; flex-direction: column; gap: 24px; }
.home h3 { margin: 0 0 12px; font-size: 1.1rem; }

/* 1. About + search, with the logo */
.home-hero {
  /* logo | search area | empty column as wide as the logo -> search area is centred in the box */
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 150px; align-items: center; gap: 28px;
  padding: 24px; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
}
.home-logo { width: 150px; height: 150px; flex: 0 0 auto; border-radius: 50%; background: #fff; }
@media (max-width: 768px) {
  .home-hero { grid-template-columns: 1fr; justify-items: center; gap: 16px; }   /* small screens: logo centred above */
  .home-hero-text { width: 100%; }
  .home-logo { width: 110px; height: 110px; }
}
.home-hero-text { text-align: center; min-width: 0; }
.home-title { margin: 0 0 6px; font-size: clamp(1.35rem, 3vw, 1.9rem); line-height: 1.25; }
.home-sub { margin: 0 0 16px; color: var(--muted); }
.home-search { position: relative; max-width: 640px; margin: 0 auto; }
.home-search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--muted); pointer-events: none;
}
.home-search input {
  width: 100%; font: inherit; font-size: 16px;            /* 16px: no zoom-on-focus on iPhone */
  padding: 12px 16px 12px 44px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.home-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.home-empty { color: var(--muted); margin: 0; }

/* Containers for New / Popular / Recently used / Search results */
.home-box {
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.home-recent { background: var(--accent-soft); }

/* One row of cards: 5 visible on desktop, 3 on phones; ‹ › arrows scroll the rest */
.card-row {
  --per-view: 5; --gap: 12px;
  display: grid; grid-auto-flow: column; gap: var(--gap);
  grid-auto-columns: calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px;
  scrollbar-width: none;
}
.card-row::-webkit-scrollbar { display: none; }
@media (max-width: 768px) { .card-row { --per-view: 3; --gap: 8px; } }

/* Card: icon, then name, then description */
.tool-tile {
  position: relative; scroll-snap-align: start; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 14px 10px; border-radius: var(--radius); text-decoration: none; color: var(--text);
  border: 1px solid var(--border); background: var(--chip);
  transition: border-color .15s, transform .15s, background-color .15s;
}
.tool-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); background: var(--surface); }
.tool-tile img { width: 48px; height: 48px; border-radius: 12px; }
.tool-tile b { font-size: 14px; line-height: 1.25; }
.tool-tile span:not(.tile-badge) {
  font-size: 12px; line-height: 1.35; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* Recently used: the last used tool is highlighted */
.tool-tile.is-last { background: var(--surface); border-width: 2px; border-color: var(--accent); box-shadow: 0 4px 14px rgba(37, 99, 235, .18); }
.tile-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text);
}
@media (max-width: 768px) {
  .tool-tile { padding: 10px 6px; }
  .tool-tile img { width: 40px; height: 40px; }
  .tool-tile b { font-size: 13px; }
  .tile-badge { position: static; margin-bottom: -2px; }
}

/* 2. Why LMPB Tools: blue band with five feature cards (each with its own icon colour) */
.home-why {
  position: relative; overflow: hidden;
  padding: 28px 24px; border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 60%, #312e81 100%);
  color: #fff;
}
/* soft decorative circles */
.home-why::before, .home-why::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .08);
}
.home-why::before { width: 260px; height: 260px; right: -80px; top: -110px; }
.home-why::after { width: 180px; height: 180px; left: -60px; bottom: -90px; }
.why-head { position: relative; text-align: center; margin-bottom: 22px; }
.why-head h2 { margin: 0 0 6px; font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
.why-head p { margin: 0; color: rgba(255, 255, 255, .85); }
.why-grid {
  position: relative; list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.why-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 20px 14px 18px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .18);
  transition: transform .2s, box-shadow .2s;
}
.why-card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(15, 23, 42, .26); }
.why-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 16px; margin-bottom: 4px;
  color: var(--why); background: color-mix(in srgb, var(--why) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--why) 30%, transparent);
}
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .why-icon { background: var(--chip); }                        /* older browsers */
}
.why-icon svg { width: 28px; height: 28px; }
.why-card b { font-size: 1rem; }
.why-card > span:last-child { font-size: 13px; line-height: 1.45; color: var(--muted); }
@media (max-width: 1100px) { .why-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) {
  .home-why { padding: 22px 14px; }
  .why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .why-card { padding: 14px 10px; }
  .why-icon { width: 46px; height: 46px; border-radius: 13px; }
  .why-icon svg { width: 24px; height: 24px; }
  /* 5 cards in 2 columns: centre the last one */
  .why-card:last-child { grid-column: 1 / -1; max-width: 50%; justify-self: center; }
}

/* 5. FAQ */
.home-faq { display: flex; flex-direction: column; gap: 8px; }
.home-faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 0 14px; }
.home-faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.home-faq p { margin: 0 0 12px; color: var(--muted); }

/* 7. All tools: grouped by category, icon + name */
.home-all { columns: 3 220px; column-gap: 24px; }
.all-group { break-inside: avoid; margin-bottom: 16px; }
.all-group h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.all-group ul { list-style: none; margin: 0; padding: 0; }
.all-group a {
  display: flex; align-items: center; gap: 8px; padding: 4px 0;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.all-group a:hover span { color: var(--accent); text-decoration: underline; }
.all-group img { width: 24px; height: 24px; border-radius: 6px; flex: 0 0 auto; }

/* Loading popup buttons (Retry / Close on errors) */
.loader-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.retry-secondary { background: var(--surface); color: var(--text); }
.retry-secondary:hover { background: var(--chip); }
/* Recently used, before anything was opened: one line spanning the row */
.card-row.is-empty { display: block; }
.card-row .recent-empty { padding: 6px 2px; }

/* Phones: action bar shows only the logo (no site name) to leave room for the categories */
@media (max-width: 768px) {
  .brand-name { display: none; }
  .brand-logo { width: 36px; height: 36px; }
  .site-header { gap: 10px; }
}

/* Phones: half the side padding everywhere (page edge, bars, tool area, section boxes) */
@media (max-width: 768px) {
  .page { padding-left: 8px; padding-right: 8px; gap: 8px; }
  .top-bars { margin-left: -8px; margin-right: -8px; }
  .site-header { padding-left: 8px; padding-right: 8px; }
  .tools-menu { padding-left: 8px; padding-right: 8px; }
  .tool-area { padding: 14px 10px; }
  .ad-bottom { padding-left: 8px; padding-right: 8px; }
  .home { gap: 16px; }
  .home-hero { padding: 16px 12px; }
  .home-box { padding: 12px 8px; }
  .home-why { padding: 18px 8px; }
  .why-grid { gap: 8px; }
}

/* Phones: the bottom ad is a normal in-content ad just above the footer (not floating) */
@media (max-width: 768px) {
  .page { grid-template-areas: "top" "adl" "main" "adb" "foot"; }
  body.is-home .page { grid-template-areas: "top" "main" "adb" "foot"; }
  .ad-bottom {
    grid-area: adb; position: static;
    padding: 0; background: none; border: 0; box-shadow: none;
  }
  .ad-bottom .ad-slot { height: auto; }
  .ad-bottom .house-wide { height: 64px; }
  body.has-ad-bar { padding-bottom: 0; }        /* nothing floats over the page any more */
}

/* ---------- Footer links + policy pages (About / Privacy / Terms / Contact) ---------- */
/* Footer menu strip: About / Contact / policies (generated by the site builder on every page) */
.legal-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px;
  margin: 0 0 10px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.legal-links a {
  color: var(--text); text-decoration: none; font-weight: 500;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.legal-links a:hover { background: var(--accent-soft); color: var(--accent); }
.legal-links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.legal-page .legal-links { width: 100%; max-width: 820px; box-sizing: border-box; }
@media (max-width: 768px) {
  .legal-links { gap: 2px 4px; padding: 6px; }
  .legal-links a { padding: 5px 9px; }
}
.legal-page { padding: 0 16px; }
.legal-page .site-footer { display: flex; flex-direction: column; align-items: center; }
.legal-header { margin: 0 -16px; justify-content: space-between; }
.legal-back { color: #fff; text-decoration: none; font-weight: 600; }
.legal-back:hover { text-decoration: underline; }
.legal {
  max-width: 820px; margin: 24px auto; padding: 24px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  line-height: 1.65;
}
.legal h1 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.legal h2 { margin: 24px 0 8px; font-size: 1.1rem; }
.legal a { color: var(--accent); }
.legal-updated { color: var(--muted); font-size: 13px; margin-top: 0; }
.legal-contact { font-size: 1.1rem; font-weight: 600; }
@media (max-width: 768px) {
  .legal-page { padding: 0 8px; }
  .legal-header { margin: 0 -8px; }
  .legal { margin: 12px auto; padding: 16px 14px; }
}

/* Google's anchor ad (Auto ads) is showing at the bottom: hide our bar so there are never two */
body.has-anchor .ad-bottom { display: none; }
body.has-anchor.has-ad-bar { padding-bottom: 0; }

/* Phones: the bottom ad is a normal in-content ad just above the footer (not floating) */
@media (max-width: 768px) {
  .page { grid-template-areas: "top" "adl" "main" "adb" "foot"; }
  body.is-home .page { grid-template-areas: "top" "main" "adb" "foot"; }
  .ad-bottom {
    grid-area: adb; position: static;
    padding: 0; background: none; border: 0; box-shadow: none;
  }
  .ad-bottom .ad-slot { height: auto; }
  .ad-bottom .house-wide { height: 64px; }
  body.has-ad-bar { padding-bottom: 0; }        /* nothing floats over the page any more */
}
