/* CloudAlls Tools - app stylesheet */
:root {
  --bg: #f3f5fa;
  --panel: #ffffff;
  --panel-2: #eef1f8;
  --line: #d9deeb;
  --text: #17203a;
  --muted: #56617e;
  --brand: #2f55d4;
  --brand-ink: #ffffff;
  --brand-soft: #e4eaff;
  --ok: #12805c;
  --ok-soft: #dcf5ec;
  --bad: #b3261e;
  --bad-soft: #fde6e4;
  --warn-soft: #fff1cc;
  --add: #d6f5df;
  --del: #fcdcd9;
  --side: #0f1729;
  --side-text: #c9d2ea;
  --side-muted: #7f8bab;
  --side-line: #222d4a;
  --side-hover: #1a2542;
  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side-w: 272px;
  --top-h: 54px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1222;
  --panel: #131c33;
  --panel-2: #1a2542;
  --line: #28345a;
  --text: #e6ebf7;
  --muted: #9ba7c7;
  --brand: #7d9bff;
  --brand-ink: #0b1222;
  --brand-soft: #1f2d5c;
  --ok: #4cd6a3;
  --ok-soft: #12362b;
  --bad: #ff8a80;
  --bad-soft: #3d1a19;
  --warn-soft: #3a3010;
  --add: #153a25;
  --del: #43201f;
  --side: #0a101f;
  --side-line: #1c2644;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--sans);
}
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--side); color: #fff; border-bottom: 1px solid var(--side-line);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 650; letter-spacing: .1px; margin-right: auto; }
.brand .brand-mark rect { fill: #2f55d4; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  background: transparent; color: #dfe6fa; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { background: var(--side-hover); }
.menu-btn { display: none; }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }

/* ---------- Shell / sidebar ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); min-height: calc(100dvh - var(--top-h)); }
.sidebar {
  position: sticky; top: var(--top-h); align-self: start;
  height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--side); color: var(--side-text); padding: 12px 10px 24px;
}
.search input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px;
  background: var(--side-hover); border: 1px solid var(--side-line); color: #fff; font: inherit;
}
.search input::placeholder { color: var(--side-muted); }
.nav { margin-top: 10px; }
.nav-group { margin: 2px 0; }
.nav-group summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; color: #fff;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before {
  content: ""; width: 6px; height: 6px; margin-right: 8px; flex: none;
  border-right: 2px solid var(--side-muted); border-bottom: 2px solid var(--side-muted); transform: rotate(-45deg); transition: transform .12s;
}
.nav-group[open] summary::before { transform: rotate(45deg); }
.nav-group summary { gap: 0; }
.nav-group summary .count { margin-left: auto; color: var(--side-muted); font-weight: 500; font-size: 12px; }
.nav-group summary:hover { background: var(--side-hover); }
.nav ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 14px; border-left: 1px solid var(--side-line); margin-left: 13px; }
.nav li a {
  display: block; padding: 6px 10px; border-radius: 6px; color: var(--side-text); text-decoration: none; font-size: 14px;
}
.nav li a:hover { background: var(--side-hover); color: #fff; }
.nav li a[aria-current="page"] { background: #2f55d4; color: #fff; font-weight: 600; }
.nav-empty { color: var(--muted); padding: 10px; }
.sidebar .nav-empty { color: var(--side-muted); }
.scrim { position: fixed; inset: var(--top-h) 0 0 0; background: rgba(5, 9, 20, .55); z-index: 19; }

/* ---------- Main ---------- */
.main { padding: 22px clamp(14px, 3vw, 36px) 40px; min-width: 0; max-width: 1240px; width: 100%; outline: none; }
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.tool-title { margin: 0 0 4px; font-size: clamp(24px, 3vw, 32px); line-height: 1.15; letter-spacing: -.01em; }
.tool-desc { margin: 0 0 18px; color: var(--muted); font-size: 16px; max-width: 70ch; }
.about, .related { margin-top: 28px; max-width: 78ch; }
.about h2, .related h2 { font-size: 17px; margin: 0 0 6px; }
.about p { margin: 0; color: var(--muted); }
.related ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 8px 0 0; padding: 0; }
.related a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--panel); color: var(--text); font-size: 14px; }
.related a:hover { border-color: var(--brand); color: var(--brand); }
.footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; max-width: 78ch; }
.notfound { padding: 40px 0; }

/* ---------- Home ---------- */
.home-hero { padding: 18px 0 8px; max-width: 760px; }
.home-hero h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: 1.08; margin: 0 0 10px; letter-spacing: -.02em; }
.home-hero p { color: var(--muted); font-size: 17px; margin: 0 0 18px; }
.hero-search input { width: 100%; max-width: 520px; height: 46px; padding: 0 16px; font: inherit; font-size: 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.cat { margin-top: 28px; }
.cat-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cat-head h2 { margin: 0; font-size: 19px; }
.cat-head p { margin: 0; color: var(--muted); font-size: 14px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--text);
}
.tile strong { font-size: 15px; }
.tile span { color: var(--muted); font-size: 13.5px; }
.tile:hover { border-color: var(--brand); }

/* ---------- Tool widgets ---------- */
.tool { display: grid; gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel > h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }

input[type=text], input[type=number], input[type=search], input[type=url], input[type=email], input[type=password], input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 38px;
}
input[type=color] { width: 54px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--brand); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
textarea { resize: vertical; min-height: 160px; line-height: 1.45; }
textarea.code, input.code, .mono, pre.mono { font-family: var(--mono); font-size: 13.5px; tab-size: 2; }
textarea[readonly] { background: var(--panel-2); }
textarea.tall { min-height: 320px; }
textarea.short { min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.inline.sm { width: auto; }
.inline input[type=number], .inline select { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; font: inherit; font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--brand-ink); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.copied { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--panel-2); border-radius: 8px; }
.tabs button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13.5px; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.status { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; background: var(--panel-2); color: var(--muted); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.err { background: var(--bad-soft); color: var(--bad); }
.status.warn { background: var(--warn-soft); }
.status:empty { display: none; }

.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: 6px 12px; align-items: center; }
.kv > .k { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.kv > .v { font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.kv > .a { justify-self: end; }
.kv.two { grid-template-columns: minmax(120px, 190px) 1fr; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-size: 13px; font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
table.data td.mono { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.scroll { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: var(--radius-sm); }

.dropzone {
  display: grid; place-items: center; gap: 4px; text-align: center; padding: 28px 16px;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); background: var(--panel); cursor: pointer;
}
.dropzone.over, .dropzone:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.dropzone input { display: none; }
.preview { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background:
  conic-gradient(#0000 25%, rgba(128,128,128,.14) 0 50%, #0000 0 75%, rgba(128,128,128,.14) 0) 0 0/16px 16px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

mark.m { background: #ffe58a; color: #1c1c1c; border-radius: 2px; padding: 0 1px; }
mark.m.alt { background: #a9e8c4; }
[data-theme="dark"] mark.m { background: #8a6d00; color: #fff; }
[data-theme="dark"] mark.m.alt { background: #1c6b46; color: #fff; }
.hl { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13.5px; background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px; min-height: 120px; max-height: 420px; overflow: auto; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  background: #0f1729; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

/* Diff */
.diff { display: grid; grid-template-columns: 1fr 1fr; font-family: var(--mono); font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: auto; max-height: 560px; }
.diff .ln { display: contents; }
.diff .c { padding: 1px 8px; white-space: pre-wrap; overflow-wrap: anywhere; border-bottom: 1px solid transparent; min-height: 1.5em; }
.diff .c.add { background: var(--add); }
.diff .c.del { background: var(--del); }
.diff .c.pad { background: var(--panel-2); }
.diff .c .w-add { background: rgba(18,128,92,.35); border-radius: 2px; }
.diff .c .w-del { background: rgba(179,38,30,.35); border-radius: 2px; }

/* Markdown preview */
.md-out { line-height: 1.6; overflow-wrap: anywhere; }
.md-out h1, .md-out h2, .md-out h3 { margin: 1em 0 .4em; line-height: 1.2; }
.md-out pre { background: var(--panel-2); padding: 12px; border-radius: 8px; overflow: auto; }
.md-out code { font-family: var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.md-out pre code { background: none; padding: 0; }
.md-out blockquote { margin: .8em 0; padding: 2px 14px; border-left: 4px solid var(--line); color: var(--muted); }
.md-out table { border-collapse: collapse; }
.md-out th, .md-out td { border: 1px solid var(--line); padding: 5px 10px; }
.md-out img { max-width: 100%; }

/* Color tool */
.swatch { height: 90px; border-radius: var(--radius); border: 1px solid var(--line); }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { width: 84px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); cursor: pointer; padding: 0; font: inherit; color: var(--text); text-align: left; }
.chip i { display: block; height: 44px; }
.chip span { display: block; padding: 4px 6px; font-family: var(--mono); font-size: 11.5px; }

.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); min-height: 220px; }
.qr-box canvas, .qr-box svg { max-width: 100%; height: auto; }

.crop-wrap { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; }
.crop-wrap img { display: block; max-width: 100%; height: auto; }
.crop-box { position: absolute; border: 2px solid var(--brand); background: rgba(47,85,212,.18); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }

.loading { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .menu-btn { display: inline-grid; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 20; top: var(--top-h); left: 0; bottom: 0; width: min(86vw, 320px); height: auto;
    transform: translateX(-102%); transition: transform .18s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .cols, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 1fr; }
  .kv > .a { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ---------- CloudAlls visual refresh ---------- */
:root {
  --top-h: 62px;
  --side-w: 288px;
  --bg: #f5f6fb;
  --panel: #ffffff;
  --panel-2: #eef1fa;
  --line: #dfe3f0;
  --text: #111936;
  --muted: #66708d;
  --brand: #4868f5;
  --brand-soft: #e9edff;
  --side: #101831;
  --side-hover: #1b2749;
  --side-line: #273456;
  --radius: 14px;
  --radius-sm: 9px;
}
[data-theme="dark"] {
  --bg: #090f21;
  --panel: #121b36;
  --panel-2: #182342;
  --line: #29365d;
  --text: #eef2ff;
  --muted: #a1accb;
  --brand: #89a0ff;
  --brand-soft: #202e61;
  --side: #080d1d;
  --side-hover: #151f3b;
  --side-line: #202d51;
}
body { background: radial-gradient(circle at 72% -8%, rgba(72,104,245,.08), transparent 32rem), var(--bg); }
.topbar { height: var(--top-h); padding: 0 clamp(16px, 3vw, 34px); box-shadow: 0 1px 0 rgba(255,255,255,.03); }
.brand { font-size: 16px; letter-spacing: -.01em; }
.brand-mark { filter: drop-shadow(0 5px 12px rgba(72,104,245,.34)); }
.topbar-note { color: #8794b9; font-size: 12px; letter-spacing: .02em; }
.sidebar { padding: 18px 12px 28px; }
.search input { height: 42px; border-radius: 10px; background: rgba(255,255,255,.07); }
.nav { margin-top: 16px; }
.nav-group { margin: 4px 0; }
.nav-group summary { padding: 10px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #aeb9d7; }
.nav li a { padding: 7px 11px; border-radius: 8px; }
.main { padding: clamp(28px, 4vw, 56px) clamp(18px, 4vw, 64px) 48px; max-width: 1400px; }
.home-hero { position: relative; max-width: 900px; padding: 18px 0 24px; }
.home-hero::after { content: ""; position: absolute; width: 260px; height: 260px; right: 5%; top: 0; background: radial-gradient(circle, rgba(72,104,245,.18), transparent 70%); pointer-events: none; z-index: -1; }
.eyebrow, .section-kicker { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.eyebrow-dot { width: 7px; height: 7px; background: var(--brand); border-radius: 50%; box-shadow: 0 0 0 5px var(--brand-soft); }
.home-hero h1 { max-width: 780px; font-size: clamp(38px, 6vw, 68px); letter-spacing: -.055em; }
.home-hero p { max-width: 670px; margin-bottom: 26px; font-size: 18px; line-height: 1.65; }
.hero-search { position: relative; max-width: 640px; }
.hero-search input { max-width: none; height: 56px; padding-left: 48px; border-radius: 14px; box-shadow: 0 12px 28px rgba(18,27,54,.08); }
.search-mark { position: absolute; left: 18px; top: 10px; z-index: 1; color: var(--brand); font-size: 28px; line-height: 36px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 4px; }
.hero-meta b { color: var(--text); font-weight: 750; }
.trust-strip { display: flex; align-items: center; gap: 13px; max-width: 900px; margin: 12px 0 42px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(90deg, var(--brand-soft), var(--panel)); }
.trust-strip p { margin: 0; color: var(--muted); font-size: 13px; }
.trust-strip strong { color: var(--text); }
.trust-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 9px; background: var(--brand); color: #fff; }
.cat { margin-top: 42px; scroll-margin-top: 80px; }
.cat-head { align-items: end; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.cat-head h2 { margin-top: 3px; font-size: 22px; letter-spacing: -.02em; }
.cat-head p { margin-right: auto; }
.cat-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.grid { gap: 12px; }
.tile { position: relative; min-height: 104px; padding: 17px 18px; overflow: hidden; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand); opacity: 0; transition: opacity .16s ease; }
.tile-arrow { position: absolute; top: 13px; right: 15px; color: var(--brand); font-size: 18px; opacity: 0; transform: translate(-3px, 3px); transition: opacity .16s ease, transform .16s ease; }
.tile strong { padding-right: 20px; font-size: 15px; }
.tile span:not(.tile-arrow) { line-height: 1.45; }
.tile:hover { border-color: rgba(72,104,245,.55); box-shadow: 0 10px 26px rgba(23,34,78,.09); transform: translateY(-2px); }
.tile:hover::before, .tile:hover .tile-arrow { opacity: 1; }
.tile:hover .tile-arrow { transform: none; }
.tool-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.tool-title { margin-top: 5px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.045em; }
.tool-desc { margin-bottom: 0; }
.privacy-pill { flex: none; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--ok); background: var(--ok-soft); font-size: 12px; font-weight: 700; }
.crumbs { margin-bottom: 20px; }
.crumbs a { text-decoration: none; }
.about, .related { margin-top: 38px; padding-top: 22px; border-top: 1px solid var(--line); }
.about h2, .related h2 { margin-top: 4px; font-size: 20px; }
.related a { padding: 9px 13px; transition: border-color .16s ease, transform .16s ease; }
.related a span { margin-left: 8px; color: var(--brand); }
.related a:hover { transform: translateY(-1px); }
.footer { max-width: none; margin-top: 64px; }
.footer p { margin: 5px 0; }
.footer-links { display: flex; gap: 9px; }
.panel, .tile { box-shadow: 0 2px 0 rgba(19,29,64,.02); }
.btn.primary { box-shadow: 0 6px 14px rgba(72,104,245,.22); }
@media (max-width: 700px) {
  .topbar-note { display: none; }
  .main { padding-top: 26px; }
  .home-hero h1 { font-size: clamp(36px, 12vw, 54px); }
  .home-hero p { font-size: 16px; }
  .trust-strip { align-items: flex-start; margin-bottom: 30px; }
  .cat-head { align-items: flex-start; }
  .cat-head p { flex-basis: 100%; order: 3; }
  .cat-count { margin-left: auto; }
  .tool-heading { display: block; }
  .privacy-pill { display: inline-block; margin-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .tile-arrow, .tile::before, .related a { transition: none; }
}

/* ======================================================================
   Landing page, import/export toolbars, command palette, accessibility
   ====================================================================== */
kbd { font: 600 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn.lg kbd { margin-left: 8px; }
.btn:focus-visible, .pill:focus-visible, .ft-item:focus-visible, summary:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.noscript { margin: 0; padding: 12px 18px; background: #fff1cc; color: #3a2d00; text-align: center; font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.linkish:hover { color: var(--brand); text-decoration: underline; }

/* Topbar nav + search button */
.topbar-nav { display: flex; gap: 4px; margin-right: 8px; }
.topbar-nav a { color: #c3cdea; text-decoration: none; font-size: 14px; font-weight: 550; padding: 8px 12px; border-radius: 8px; }
.topbar-nav a:hover { background: var(--side-hover); color: #fff; }
.top-search { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border: 1px solid var(--side-line); border-radius: 10px; background: rgba(255,255,255,.06); color: #c3cdea; font: inherit; font-size: 14px; cursor: pointer; }
.top-search:hover { background: var(--side-hover); color: #fff; }
.top-search kbd { background: rgba(255,255,255,.08); border-color: var(--side-line); color: #aeb9d7; }
.nav-site { display: none; gap: 6px; flex-wrap: wrap; padding: 0 4px 12px; }
.nav-site a { color: var(--side-text); text-decoration: none; font-size: 13px; padding: 6px 10px; border: 1px solid var(--side-line); border-radius: 999px; }
.nav-personal { padding: 4px 4px 10px; border-bottom: 1px solid var(--side-line); margin-bottom: 8px; }
.nav-personal-h { margin: 8px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); font-weight: 700; }
.nav-personal-list { list-style: none; margin: 0; padding: 0; }
.nav-personal-list a { display: block; padding: 7px 12px; color: var(--side-text); text-decoration: none; border-radius: 8px; font-size: 14px; }
.nav-personal-list a:hover { background: var(--side-hover); color: #fff; }
@media (max-width: 960px) {
  .topbar-nav { display: none; }
  .top-search span, .top-search kbd { display: none; }
  .top-search { width: 38px; padding: 0; justify-content: center; }
  .nav-site { display: flex; }
}

/* Landing layout: full-width, no sidebar */
@media (min-width: 961px) {
  body.is-landing .sidebar, body.is-landing .menu-btn, body.is-landing .scrim { display: none; }
  body.is-landing .shell { grid-template-columns: minmax(0, 1fr); }
}
body.is-landing .main { max-width: 1180px; margin: 0 auto; }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 82px; }

.lp-hero { position: relative; padding: 28px 0 8px; max-width: 920px; }
.lp-hero::before { content: ""; position: absolute; inset: -80px -10% auto auto; width: 520px; height: 420px; background: radial-gradient(closest-side, rgba(72,104,245,.20), transparent 72%); z-index: -1; pointer-events: none; }
.lp-hero h1 { margin: 0 0 16px; font-size: clamp(38px, 6.4vw, 72px); line-height: 1.04; letter-spacing: -.05em; max-width: 14ch; }
.lp-lead { max-width: 640px; margin: 0 0 26px; font-size: clamp(16px, 2vw, 19px); line-height: 1.65; color: var(--muted); }
.lp-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.lp-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 14px 34px; margin: 30px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); }
.lp-stats li { display: grid; gap: 2px; }
.lp-stats b { font-size: 26px; letter-spacing: -.03em; }
.lp-stats span { color: var(--muted); font-size: 13px; }

.lp-popular { margin: 34px 0 6px; }
.lp-small-h { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 750; }
.pills, .filters { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.pill { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.pill:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.pill[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.lp-section { margin-top: clamp(56px, 8vw, 96px); }
.lp-head { max-width: 680px; margin-bottom: 26px; }
.lp-head h2 { margin: 6px 0 8px; font-size: clamp(26px, 3.6vw, 40px); letter-spacing: -.035em; line-height: 1.12; }
.lp-head p { margin: 0; color: var(--muted); font-size: 16.5px; line-height: 1.6; }
.lp-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lp-card { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 2px 0 rgba(19,29,64,.02); }
.lp-card h3 { margin: 14px 0 6px; font-size: 17px; letter-spacing: -.01em; }
.lp-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.lp-ico, .cat-ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.cat-ico { width: 36px; height: 36px; border-radius: 10px; align-self: center; }
.lp-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.lp-split .lp-card h3 { margin-top: 0; }
.lp-more { margin: 16px 0 0; }
.lp-more a { color: var(--brand); font-weight: 650; }
.lp-count { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: s; }
.lp-steps li { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.lp-steps h3 { margin: 12px 0 6px; font-size: 17px; }
.lp-steps p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.lp-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.ws-links { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.ws-links a { color: var(--text); text-decoration: none; display: block; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 14.5px; }
.ws-links a:hover { background: var(--brand-soft); color: var(--brand); }
.ws-empty { margin: 0; }
.lp-faq { display: grid; gap: 10px; max-width: 820px; }
.lp-faq details { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.lp-faq summary { cursor: pointer; padding: 16px 18px; font-weight: 650; font-size: 16px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary::after { content: "+"; color: var(--brand); font-size: 22px; line-height: 1; }
.lp-faq details[open] summary::after { content: "–"; }
.lp-faq p { margin: 0; padding: 0 18px 18px; color: var(--muted); line-height: 1.65; }
.lp-final { margin-top: clamp(56px, 8vw, 96px); padding: clamp(32px, 5vw, 56px); border-radius: 22px; text-align: center; color: #fff; background: radial-gradient(circle at 80% 0%, #4868f5, transparent 60%), #0f1a3d; }
.lp-final h2 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.035em; }
.lp-final p { margin: 0; color: #c8d2f5; font-size: 17px; }
.lp-final .lp-cta { justify-content: center; }
.lp-final .btn:not(.primary) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.28); color: #fff; }
.lp-final .btn.primary { background: #fff; border-color: #fff; color: #1d2f86; box-shadow: none; }
.lp-final kbd { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
body.is-landing .cat { margin-top: 30px; }
body.is-landing .cat-head h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
body.is-landing .cat-head { align-items: center; }
@media (max-width: 960px) { .lp-cards, .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .lp-cards, .lp-steps, .lp-split { grid-template-columns: minmax(0, 1fr); } .lp-cta .btn { flex: 1 1 100%; } }

/* Doc pages (privacy) */
.doc { max-width: 760px; }
.doc h2 { margin: 32px 0 8px; font-size: 22px; letter-spacing: -.02em; }
.doc p, .doc li { line-height: 1.7; color: var(--muted); font-size: 16px; }
.doc li { margin: 6px 0; }
.doc strong { color: var(--text); }
.doc a { color: var(--brand); }

/* Footer */
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-brand { color: var(--text); font-size: 16px; }
.footer-h { margin: 5px 0 8px !important; color: var(--text); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.footer-legal { margin-top: 28px !important; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Import / export toolbars */
.ft-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.ft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.ft-meter { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
textarea.ft-drop { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.btn[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.ft-menu { position: relative; }
.ft-menu > summary { list-style: none; display: inline-flex; align-items: center; cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-weight: 600; min-height: 30px; padding: 0 10px; font-size: 13px; }
.ft-menu > summary::-webkit-details-marker { display: none; }
.ft-menu > summary:hover, .ft-menu[open] > summary { border-color: var(--brand); color: var(--brand); }
.ft-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 230px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 18px 40px rgba(10,20,60,.22); display: grid; }
.ft-item { text-align: left; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.ft-item:hover { background: var(--brand-soft); color: var(--brand); }
body.focus-mode .sidebar, body.focus-mode .menu-btn { display: none; }
body.focus-mode .shell { grid-template-columns: minmax(0, 1fr); }
body.focus-mode .main { max-width: 1100px; margin: 0 auto; }

/* Command palette */
.pal { position: fixed; inset: 0; z-index: 200; display: grid; align-items: start; justify-items: center; padding: 12vh 16px 16px; background: rgba(6,10,28,.55); backdrop-filter: blur(3px); }
.pal[hidden] { display: none; }
.pal-box { width: min(620px, 100%); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.4); overflow: hidden; }
.pal-input { width: 100%; height: 56px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 17px; }
.pal-input:focus { outline: none; border-color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
.pal-list { list-style: none; margin: 0; padding: 8px; max-height: min(52vh, 420px); overflow: auto; }
.pal-item { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.pal-item[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }
.pal-name { font-weight: 650; }
.pal-cat { color: var(--muted); font-size: 13px; }
.pal-empty { padding: 18px; color: var(--muted); text-align: center; }
.pal-hint { margin: 0; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; background: var(--panel-2); }
body.pal-open { overflow: hidden; }

/* Print: show only the tool content */
@media print {
  .topbar, .sidebar, .ft-tools, .ft-bar, .footer, .pal, .toast, .skip, .related, .scrim { display: none !important; }
  .shell { display: block !important; }
  .main { max-width: none !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .panel, .tool { box-shadow: none !important; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .pill, .tile { transition: none; } }
@media (forced-colors: active) { .pill[aria-pressed="true"], .pal-item[aria-selected="true"] { outline: 2px solid Highlight; } }
body.is-landing .main, body.is-landing .shell { overflow-x: clip; }
.lp-hero::before { inset: -80px -4% auto auto; max-width: 100%; }
.pill { white-space: nowrap; flex: none; }
.pills li { display: block; }
a.btn, a.pill { text-decoration: none; }
a.btn { display: inline-flex; align-items: center; justify-content: center; }
.lp-hero h1 { max-width: 18ch; }

/* ---------- QR Studio ---------- */
.qs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 16px; align-items: start; }
.qs-main { min-width: 0; }
.qs-side { position: sticky; top: calc(var(--top-h) + 14px); min-width: 0; }
.qs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.qs-head h3 { margin: 0; }
.qs .panel > h3 { margin: 0; }
.qs .lbl { display: block; }
.qs output { font-weight: 500; color: var(--text); margin-left: 4px; }
.qs .tabs { max-width: 100%; }

.qs-preview .qr-box { padding: 18px; min-height: 280px; }
.qs-preview .qr-box svg { display: block; width: 100%; max-width: 360px; height: auto; }
.qr-box.checker { background-color: #fff; background-image: conic-gradient(#e3e6ee 25%, #fff 0 50%, #e3e6ee 0 75%, #fff 0); background-size: 18px 18px; }
.qs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qs-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--panel-2); color: var(--muted); line-height: 1.4; }
.qs-chip.ok { background: var(--ok-soft); color: var(--ok); }
.qs-chip.warn { background: var(--warn-soft); color: var(--text); }
.qs-chip.bad { background: var(--bad-soft); color: var(--bad); }

.shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; }
.shape { position: relative; display: grid; justify-items: center; gap: 4px; cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; }
.shape input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.shape-ico { display: grid; place-items: center; width: 100%; aspect-ratio: 1.25; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); transition: border-color .12s, background .12s; }
.shape:hover .shape-ico { border-color: var(--brand); }
.shape input:checked + .shape-ico { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.shape input:checked ~ .shape-name { color: var(--text); }
.shape input:focus-visible + .shape-ico { outline: 3px solid var(--brand); outline-offset: 2px; }

.qs-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.qs-preset { display: grid; gap: 4px; justify-items: center; padding: 6px 4px 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.qs-preset:hover { border-color: var(--brand); color: var(--text); transform: translateY(-1px); }
.qs-thumb { display: block; width: 100%; max-width: 64px; background: #fff; border-radius: 6px; overflow: hidden; }
.qs-thumb svg { display: block; width: 100%; height: auto; }

.qs-swatches, .qs-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.qs-sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.qs-sw:hover { box-shadow: 0 0 0 2px var(--brand); }
.qs-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; padding: 0; }
.qs-icon:hover { border-color: var(--brand); color: var(--brand); }
.qs-icon[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
label.btn { cursor: pointer; }

@media (max-width: 1100px) {
  .qs { grid-template-columns: minmax(0, 1fr); }
  .qs-side { position: static; order: -1; }
}

/* ======================================================================
   Responsive hardening
   Layout rules that adapt to the space the content actually has (container
   queries, with the viewport media queries above as the fallback), touch
   ergonomics, safe areas, and overflow guards.
   ====================================================================== */

/* ---------- Overflow guards ---------- */
.tool, .stack { grid-template-columns: minmax(0, 1fr); }
.panel, .field, .row > *, .cols > *, .cols-3 > * { min-width: 0; }
img, svg, canvas, video { max-width: 100%; }
.tool-desc, .about p, .status, .hint, .doc p, .doc li { overflow-wrap: anywhere; }
.crumbs { flex-wrap: wrap; align-items: center; }
.crumbs span[aria-current] { min-width: 0; overflow-wrap: anywhere; }
.brand { min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { padding-left: max(clamp(16px, 3vw, 34px), env(safe-area-inset-left)); padding-right: max(clamp(16px, 3vw, 34px), env(safe-area-inset-right)); }
.main { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(22px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }
.ft-tools { position: relative; }

/* ---------- Tool layouts follow the content width, not the window ---------- */
.main { container-type: inline-size; container-name: main; }
@container main (max-width: 720px) {
  .cols, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > .a { justify-self: start; }
  .tool-heading { display: block; }
  .privacy-pill { display: inline-block; margin-top: 14px; }
}
@container main (max-width: 960px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container main (max-width: 820px) {
  .qs { grid-template-columns: minmax(0, 1fr); }
  .qs-side { position: static; order: -1; }
  .qs-preview .qr-box { min-height: 0; padding: 14px; }
  .qs-preview .qr-box svg { max-width: 300px; margin-inline: auto; }
}
@container main (max-width: 520px) {
  .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 12px; }
  .row.end { justify-content: flex-start; }
  .shapes { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }
  .qs-presets { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
}

/* ---------- Drawer navigation (<= 960px) ---------- */
@media (max-width: 960px) {
  .sidebar {
    top: var(--top-h); bottom: 0; height: auto; align-self: stretch; width: min(88vw, 340px);
    padding-left: max(12px, env(safe-area-inset-left));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s;
  }
  body.nav-open .sidebar { visibility: visible; transition-delay: 0s; box-shadow: 18px 0 40px rgba(0, 0, 0, .35); }
  body.nav-open { overflow: hidden; }
  .nav-site { margin-top: 12px; }
  .scrim { inset: var(--top-h) 0 0 0; }
  .main { max-width: none; }
  body.is-landing .main { margin: 0 auto; }
}

/* Popovers must never run off the edge of a narrow screen */
@media (max-width: 640px) {
  .ft-menu { position: static; }
  .ft-pop { left: 0; right: 0; min-width: 0; }
  .ft-tools { padding: 8px; gap: 6px; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .pal { padding: max(8vh, env(safe-area-inset-top)) 12px 12px; }
  .pal-list { max-height: min(60vh, 420px); max-height: min(60dvh, 420px); }
  .doc h2 { font-size: 20px; }
}

/* ---------- Small phones ---------- */
@media (max-width: 700px) {
  :root { --top-h: 56px; }
  .topbar { gap: 6px; }
  .main { padding-top: 20px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .crumbs { font-size: 13px; margin-bottom: 14px; }
  .tool-title { font-size: clamp(26px, 8vw, 34px); }
  .tool-desc { font-size: 15px; }
  .hero-search input { height: 52px; }
  .lp-hero { padding-top: 12px; }
  .lp-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .lp-stats b { font-size: 24px; }
  .lp-section { margin-top: 52px; }
  .lp-card, .lp-steps li { padding: 18px; }
  /* category filter becomes a single swipeable row instead of five wrapped rows */
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 10px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filters::-webkit-scrollbar { display: none; }
  .filters .pill { scroll-snap-align: start; }
  /* shorter tiles so the directory is not a mile long */
  .tile { min-height: 0; padding: 14px 16px; }
  .grid { gap: 8px; }
  .cat { margin-top: 26px; }
  .lp-final { border-radius: 18px; }
  .lp-final .lp-cta .btn { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  .topbar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .brand { font-size: 15px; gap: 8px; }
  .lp-hero h1 { font-size: 34px; }
  .lp-stats span { font-size: 12.5px; }
}

/* ---------- Touch devices: comfortable targets, no iOS focus-zoom ---------- */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.sm, .ft-menu > summary { min-height: 40px; padding-inline: 13px; }
  .icon-btn { width: 44px; height: 44px; }
  .top-search { height: 44px; }
  .top-search:not(:has(span)) { width: 44px; }
  .brand { min-height: 44px; }
  .pill { min-height: 44px; }
  .tabs button { min-height: 40px; padding-inline: 14px; }
  .nav-group summary { padding-block: 13px; }
  .nav li a, .nav-personal-list a { padding-block: 11px; }
  .nav-site a { padding: 10px 14px; }
  .crumbs a, .footer a, .linkish { display: inline-flex; align-items: center; min-height: 32px; }
  .footer ul { gap: 2px; }
  .related a { min-height: 44px; display: inline-flex; align-items: center; }
  .inline { min-height: 36px; }
  .lp-faq summary { min-height: 52px; align-items: center; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  input[type=text], input[type=number], input[type=search], input[type=url], input[type=email], input[type=password],
  input[type=datetime-local], input[type=date], select { min-height: 46px; font-size: 16px; }
  textarea, textarea.code, input.code, .pal-input, .search input, .hero-search input { font-size: 16px; }
  .qs-sw { width: 40px; height: 40px; }
  .qs-icon { width: 44px; height: 44px; }
  .pal-item { padding-block: 14px; }
}
@media (hover: none) {
  .btn.lg kbd, .top-search kbd, .footer kbd, .lp-final kbd, .pal-hint { display: none; }
  .tile:hover, .pill:hover, .related a:hover, .qs-preset:hover { transform: none; }
}

/* ---------- Large screens ---------- */
@media (min-width: 1700px) {
  body { font-size: 16px; }
  .main { max-width: 1480px; }
}

/* ---------- Short landscape phones ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --top-h: 50px; }
  .lp-hero h1 { font-size: 34px; }
  .pal { padding-top: 12px; }
}

/* Selects and inline controls may not be wider than the screen */
select { max-width: 100%; text-overflow: ellipsis; }
.inline { max-width: 100%; min-width: 0; }
.inline select, .inline input[type=text], .inline input[type=number] { min-width: 0; max-width: 100%; flex: 0 1 auto; }
@container main (max-width: 520px) {
  .inline select { max-width: 100%; }
  label.inline:has(> select) { flex-wrap: wrap; }
}
@media (max-width: 700px) { .btn.lg kbd, .top-search kbd { display: none; } }

/* ---------- Tool page SEO content ---------- */
.howto-sec h3 { margin: 22px 0 8px; font-size: 16px; }
.howto { margin: 12px 0 0; padding-left: 1.25em; display: grid; gap: 8px; }
.howto li::marker { color: var(--brand); font-weight: 700; }
.uses { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.faq-sec .lp-faq { margin-top: 14px; }

/* ---------- New tools ---------- */
.grad-preview { height: 220px; border-radius: 14px; border: 1px solid var(--line); }
.stop-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stop-row input[type=color] { width: 46px; height: 40px; padding: 2px; }
.stop-row { gap: 8px; } .stop-row input[type=number] { width: 68px; } .stop-row .btn { padding-inline: 10px; }
.lead-text { margin: 0; font-size: 18px; font-weight: 600; }
.contrast-sample { border-radius: 14px; padding: 22px; border: 1px solid var(--line); display: grid; gap: 6px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-ok, .badge-no { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge-ok { background: rgba(16, 185, 129, .16); color: #047857; }
.badge-no { background: rgba(239, 68, 68, .14); color: #b91c1c; }
[data-theme="dark"] .badge-ok { color: #6ee7b7; } [data-theme="dark"] .badge-no { color: #fca5a5; }
.big-ratio { font-size: clamp(34px, 6vw, 52px); font-weight: 800; line-height: 1; }
.shadow-stage { display: grid; place-items: center; min-height: 260px; border-radius: 14px; border: 1px solid var(--line); padding: 30px; }
.shadow-box { width: min(200px, 70%); aspect-ratio: 4 / 3; border-radius: 16px; background: #fff; color: #334; display: grid; place-items: center; font-weight: 700; }
.panel input[type=range] { width: min(240px, 52vw); vertical-align: middle; }
output { font-variant-numeric: tabular-nums; min-width: 2.5em; display: inline-block; }
