/* YTScript tool-site tokens v1. Change --brand (or data-brand) in one place. */
:root {
  /* Neutrals — light */
  --bg: #f5f6f8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f2f4;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --overlay: rgba(24, 24, 27, 0.48);

  /* Semantic */
  --success: #15803d;
  --success-soft: #ecfdf3;
  --success-ink: #14532d;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --warning-ink: #7c2d12;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --error-ink: #991b1b;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --info-ink: #1e3a8a;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-body: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-h2: 22px;
  --fs-h1: 32px;
  --lh-tight: 1.25;
  --lh-body: 1.55;
  --lh-relaxed: 1.7;

  /* Space (4px scale) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 64px;

  /* Shape */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.04), 0 8px 24px rgba(24, 24, 27, 0.06);
  --shadow-lg: 0 2px 8px rgba(24, 24, 27, 0.06), 0 16px 40px rgba(24, 24, 27, 0.08);

  /* Layout */
  --max: 1120px;
  --header-h: 56px;
  --control-sm: 32px;
  --control-md: 40px;
  --control-lg: 48px;
  --ad-gap: 32px;
  --focus: 0 0 0 3px var(--brand-soft);

  /* Motion */
  --ease: 160ms ease;
  --ease-out: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Brand default: indigo. Overridden by [data-brand] or a one-line :root rule. */
  --brand: #4f46e5;
  --brand-hover: #443cc5;
  --brand-soft: #edecfc;
  --brand-contrast: #ffffff;
}

/* 12 presets. All button fills meet WCAG AA against --brand-contrast. */
[data-brand="ink"]     { --brand:#18181b; --brand-hover:#0a0a0b; --brand-soft:#e8e8e8; --brand-contrast:#fff; }
[data-brand="slate"]   { --brand:#334155; --brand-hover:#2c3849; --brand-soft:#ebecee; --brand-contrast:#fff; }
[data-brand="coral"]   { --brand:#c53620; --brand-hover:#a92e1c; --brand-soft:#f9ebe9; --brand-contrast:#fff; }
[data-brand="indigo"]  { --brand:#4f46e5; --brand-hover:#443cc5; --brand-soft:#edecfc; --brand-contrast:#fff; }
[data-brand="blue"]    { --brand:#1d4ed8; --brand-hover:#1943ba; --brand-soft:#e8edfb; --brand-contrast:#fff; }
[data-brand="sky"]     { --brand:#0369a1; --brand-hover:#035a8a; --brand-soft:#e6f0f6; --brand-contrast:#fff; }
[data-brand="teal"]    { --brand:#0f766e; --brand-hover:#0d655f; --brand-soft:#e7f1f0; --brand-contrast:#fff; }
[data-brand="emerald"] { --brand:#047857; --brand-hover:#03674b; --brand-soft:#e6f2ee; --brand-contrast:#fff; }
[data-brand="violet"]  { --brand:#6d28d9; --brand-hover:#5e22bb; --brand-soft:#f0eafb; --brand-contrast:#fff; }
[data-brand="rose"]    { --brand:#be123c; --brand-hover:#a30f34; --brand-soft:#f8e7ec; --brand-contrast:#fff; }
[data-brand="amber"]   { --brand:#b45309; --brand-hover:#9b4708; --brand-soft:#f8eee6; --brand-contrast:#fff; }
[data-brand="orange"]  { --brand:#c2410c; --brand-hover:#a7380a; --brand-soft:#f9ece7; --brand-contrast:#fff; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg: #0e0e11;
    --bg-elevated: #161618;
    --surface: #161618;
    --surface-2: #1c1c20;
    --ink: #f4f4f5;
    --ink-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #27272a;
    --line-strong: #3f3f46;
    --overlay: rgba(0, 0, 0, 0.64);
    --success: #4ade80;
    --success-soft: #052e16;
    --success-ink: #bbf7d0;
    --warning: #fdba74;
    --warning-soft: #431407;
    --warning-ink: #ffedd5;
    --error: #f87171;
    --error-soft: #450a0a;
    --error-ink: #fecaca;
    --info: #93c5fd;
    --info-soft: #172554;
    --info-ink: #dbeafe;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
    --brand-soft: rgba(79, 70, 229, 0.22);
  }
  :root:not([data-theme="light"])[data-brand="ink"]     { --brand-soft: #27272a; }
  :root:not([data-theme="light"])[data-brand="slate"]   { --brand-soft: #1e2229; }
  :root:not([data-theme="light"])[data-brand="coral"]   { --brand-soft: #471f1a; }
  :root:not([data-theme="light"])[data-brand="indigo"]  { --brand-soft: #262351; }
  :root:not([data-theme="light"])[data-brand="blue"]    { --brand-soft: #18264e; }
  :root:not([data-theme="light"])[data-brand="sky"]     { --brand-soft: #112d3e; }
  :root:not([data-theme="light"])[data-brand="teal"]    { --brand-soft: #143130; }
  :root:not([data-theme="light"])[data-brand="emerald"] { --brand-soft: #11312a; }
  :root:not([data-theme="light"])[data-brand="violet"]  { --brand-soft: #2e1b4e; }
  :root:not([data-theme="light"])[data-brand="rose"]    { --brand-soft: #451522; }
  :root:not([data-theme="light"])[data-brand="amber"]   { --brand-soft: #422714; }
  :root:not([data-theme="light"])[data-brand="orange"]  { --brand-soft: #462215; }
}

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] {
  --bg: #0e0e11;
  --bg-elevated: #161618;
  --surface: #161618;
  --surface-2: #1c1c20;
  --ink: #f4f4f5;
  --ink-2: #d4d4d8;
  --muted: #a1a1aa;
  --line: #27272a;
  --line-strong: #3f3f46;
  --overlay: rgba(0, 0, 0, 0.64);
  --success: #4ade80;
  --success-soft: #052e16;
  --success-ink: #bbf7d0;
  --warning: #fdba74;
  --warning-soft: #431407;
  --warning-ink: #ffedd5;
  --error: #f87171;
  --error-soft: #450a0a;
  --error-ink: #fecaca;
  --info: #93c5fd;
  --info-soft: #172554;
  --info-ink: #dbeafe;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
  --brand-soft: rgba(79, 70, 229, 0.22);
}
html[data-theme="dark"][data-brand="ink"]     { --brand-soft: #27272a; }
html[data-theme="dark"][data-brand="slate"]   { --brand-soft: #1e2229; }
html[data-theme="dark"][data-brand="coral"]   { --brand-soft: #471f1a; }
html[data-theme="dark"][data-brand="indigo"]  { --brand-soft: #262351; }
html[data-theme="dark"][data-brand="blue"]    { --brand-soft: #18264e; }
html[data-theme="dark"][data-brand="sky"]     { --brand-soft: #112d3e; }
html[data-theme="dark"][data-brand="teal"]    { --brand-soft: #143130; }
html[data-theme="dark"][data-brand="emerald"] { --brand-soft: #11312a; }
html[data-theme="dark"][data-brand="violet"]  { --brand-soft: #2e1b4e; }
html[data-theme="dark"][data-brand="rose"]    { --brand-soft: #451522; }
html[data-theme="dark"][data-brand="amber"]   { --brand-soft: #422714; }
html[data-theme="dark"][data-brand="orange"]  { --brand-soft: #462215; }

/* YTScript tool-site base + components v1. No framework. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-body)/var(--lh-body) var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { margin: 0 0 var(--s-3); letter-spacing: -0.02em; line-height: var(--lh-tight); font-weight: 650; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s-4); color: var(--ink-2); }
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden], .empty[hidden] { display: none !important; }


/* Hero wash + optional patterns (CSS only) */
.page-bg { position: relative; }
.page-bg::before {
  content: "";
  position: absolute; inset: 0 0 auto; height: 420px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, var(--brand-soft), transparent 70%),
    linear-gradient(180deg, var(--bg-elevated), var(--bg) 80%);
}
[data-pattern="dots"] .page-bg::before {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, var(--brand-soft), transparent 70%),
    radial-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg-elevated), var(--bg) 85%);
  background-size: auto, 18px 18px, auto;
}
[data-pattern="grid"] .page-bg::before {
  background-image:
    radial-gradient(ellipse 70% 50% at 50% -8%, var(--brand-soft), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg-elevated), var(--bg) 85%);
  background-size: auto, 28px 28px, 28px 28px, auto;
}
[data-pattern="aurora"] .page-bg::before {
  background-image:
    radial-gradient(ellipse 50% 40% at 15% 0%, var(--brand-soft), transparent 60%),
    radial-gradient(ellipse 40% 35% at 85% 10%, var(--brand-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-elevated), var(--bg) 85%);
}
[data-pattern="hatch"] .page-bg::before {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--brand-soft), transparent 70%),
    repeating-linear-gradient(-18deg, transparent, transparent 10px, var(--line) 10px, var(--line) 11px),
    linear-gradient(180deg, var(--bg-elevated), var(--bg) 85%);
}
[data-pattern="none"] .page-bg::before { background: var(--bg); height: 0; }
.wrap { width: min(var(--max), calc(100% - 32px)); margin-inline: auto; }
.page-bg > * { position: relative; z-index: 1; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: var(--s-5);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.02em;
  flex: none;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--brand); color: var(--brand-contrast);
  display: grid; place-items: center; flex: none;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-size: var(--fs-md); }
.brand-net {
  display: block; font-size: 10px; font-weight: 550; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); line-height: 1.2;
}
.tool-nav {
  display: flex; align-items: center; gap: var(--s-1); margin-left: auto;
  overflow-x: auto; scrollbar-width: none; min-width: 0;
}
.tool-nav::-webkit-scrollbar { display: none; }
.tool-nav a {
  flex: none; color: var(--ink-2); text-decoration: none;
  font-size: var(--fs-sm); padding: 6px 10px; border-radius: var(--r-sm);
}
.tool-nav a:hover { color: var(--brand); background: var(--brand-soft); }
.tool-nav a[aria-current="page"] { color: var(--brand); font-weight: 600; background: var(--brand-soft); }

/* Hero + tool */
.hero { padding: var(--s-8) 0 var(--s-5); }
.hero .lede { font-size: var(--fs-md); max-width: 46rem; margin: 0; }
.tool-stage { padding-bottom: var(--s-7); }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: var(--s-5);
}
.tool-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.tool-toolbar .spacer { flex: 1; }
.tool-hint { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 var(--s-4); }

/* Layout variants */
.panes { display: grid; gap: var(--s-4); }
[data-layout="split"] .panes { grid-template-columns: 1fr 1fr; }
[data-layout="stack"] .panes { grid-template-columns: 1fr; }
[data-layout="form"] .panes { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
@media (max-width: 860px) {
  [data-layout="split"] .panes,
  [data-layout="form"] .panes { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
  .hero { padding-top: var(--s-6); }
}

/* Fields */
.pane { min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 32px;
}
.pane-head label, .field-label {
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2);
}
.drop {
  position: relative;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.drop.is-over { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--focus); }
.drop textarea {
  width: 100%; min-height: 280px; resize: vertical;
  border: 0; background: transparent; padding: var(--s-4);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
  outline: none; color: var(--ink);
}
.drop-hint { margin: 0; padding: 0 var(--s-4) var(--s-3); font-size: var(--fs-xs); color: var(--muted); }
.result-box {
  min-height: 280px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2); display: flex; flex-direction: column;
}
.result-box textarea {
  flex: 1; width: 100%; min-height: 280px; resize: vertical;
  border: 0; background: transparent; padding: var(--s-4);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55; outline: none;
}
.empty {
  flex: 1; min-height: 280px; display: grid; place-items: center; text-align: center; padding: var(--s-7);
  color: var(--muted); font-size: var(--fs-sm);
}
.empty strong { display: block; color: var(--ink-2); font-weight: 600; margin: var(--s-2) 0 var(--s-1); }
.empty svg { width: 36px; height: 36px; margin: 0 auto; opacity: 0.7; }

.input, select.input, .field-row {
  height: var(--control-md);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 0 var(--s-3);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input:focus, select.input:focus, .field-row:focus-within {
  outline: none; border-color: var(--brand); box-shadow: var(--focus);
}
.field { display: grid; gap: 6px; }
.field-help { margin: 0; font-size: var(--fs-xs); color: var(--muted); }
.field-row { display: flex; align-items: stretch; padding: 0; overflow: hidden; height: var(--control-lg); }
.field-row input {
  border: 0; outline: 0; background: transparent; width: 100%; min-width: 0;
  padding: 0 var(--s-3); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right;
}
.field-unit {
  display: flex; align-items: center; padding: 0 var(--s-3) 0 0;
  color: var(--brand); font-weight: 650; font-size: var(--fs-sm);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-md); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid transparent; font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer; background: var(--surface-2); color: var(--ink);
  text-decoration: none; white-space: nowrap; transition: background var(--ease), border-color var(--ease), opacity var(--ease);
}
.btn:hover { color: var(--ink); background: var(--line); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: var(--control-sm); padding: 0 10px; font-size: var(--fs-xs); }
.btn-lg { height: var(--control-lg); padding: 0 18px; font-size: var(--fs-md); }
.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-contrast); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-2); background: var(--surface-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--error-soft); color: var(--error-ink); }
.btn-danger:hover { background: var(--error); color: #fff; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* Switch, tabs, alert */
.switch {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i {
  width: 36px; height: 20px; border-radius: var(--r-full);
  background: var(--line-strong); position: relative; flex: none; transition: background var(--ease);
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm); transition: transform var(--ease);
}
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--r-md); }
.tabs button {
  border: 0; background: transparent; color: var(--ink-2); height: 28px; padding: 0 10px;
  border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.alert {
  display: none; margin: 0 0 var(--s-4); padding: 10px 12px; border-radius: var(--r-md);
  font-size: var(--fs-sm); line-height: 1.45;
}
.alert.is-on { display: block; }
.alert-error { background: var(--error-soft); color: var(--error-ink); border: 1px solid color-mix(in srgb, var(--error) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success-ink); }

/* Ads — reserved height, labelled, never inside .tool-card */
.ad-slot {
  margin: var(--ad-gap) auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; max-width: 728px;
  border: 1px dashed #b4b4b8;
  background: repeating-linear-gradient(-45deg, #f0f0f2, #f0f0f2 8px, #f6f6f8 8px, #f6f6f8 16px);
  color: #71717a; font-size: 12px; letter-spacing: 0.04em;
  border-radius: var(--r-md);
}
.ad-slot span { text-transform: none; }
.ad-slot::before { content: "Advertisement"; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #8a8a91; }
.ad-728 { min-height: 110px; max-width: 728px; }
.ad-300 { min-height: 270px; max-width: 300px; }
.ad-320 { min-height: 120px; max-width: 320px; }
.ad-desktop { display: flex; }
.ad-mobile { display: none; }
@media (max-width: 720px) {
  .ad-desktop { display: none; }
  .ad-mobile { display: flex; }
  .drop textarea, .result-box, .result-box textarea, .empty { min-height: 200px; }
}

/* Content sections */
.section { padding: var(--s-9) 0 0; }
.section h2 { margin-bottom: var(--s-5); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); grid-template-columns: repeat(3, 1fr); }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); }
.steps .n {
  width: 28px; height: 28px; border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); margin-bottom: var(--s-3);
}
.steps p { margin: 0; }
.prose { max-width: 46rem; }
.prose p { margin: 0 0 var(--s-4); }
.formula {
  background: var(--brand-soft); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s-5); margin: var(--s-5) 0;
}
.formula code {
  display: block; background: var(--surface); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); font-size: var(--fs-sm); overflow-x: auto; white-space: nowrap;
}
.faq details { border-top: 1px solid var(--line); padding: 2px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--muted); font-weight: 500; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--ink-2); }

.related { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.related a {
  display: block; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-lg); padding: 14px 16px; transition: border-color var(--ease), box-shadow var(--ease);
}
.related a:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); color: var(--ink); }
.related strong { display: block; font-size: var(--fs-sm); margin-bottom: 4px; }
.related span { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }

/* Footer, toast, results (calc) */
.site-footer { margin-top: var(--s-10); border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { padding: var(--s-8) 0 var(--s-6); display: flex; flex-wrap: wrap; gap: var(--s-6); justify-content: space-between; }
.footer-brand { max-width: 22rem; }
.footer-brand p { font-size: var(--fs-sm); margin: var(--s-3) 0 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); align-items: flex-start; }
.footer-nav a { color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); }
.footer-nav a:hover { color: var(--brand); }
.footer-copy { border-top: 1px solid var(--line); padding: var(--s-4) 0 var(--s-6); font-size: var(--fs-xs); color: var(--muted); }

.toast {
  position: fixed; bottom: var(--s-6); left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity var(--ease-out), transform var(--ease-out); z-index: 80;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

.stat-headline { font-size: 34px; font-weight: 750; letter-spacing: -0.03em; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.15; margin: 4px 0 12px; }
.stats { display: grid; gap: var(--s-3); }
.stats p { margin: 0; font-size: var(--fs-sm); }
.stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.form-grid { display: grid; gap: var(--s-5); }

@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; }
  .tool-nav { display: none; }
  .header-inner { justify-content: space-between; }
  .stat-headline { font-size: 28px; }
  [data-layout="form"] .panes { display: flex; flex-direction: column; }
  [data-layout="form"] .panes .pane:last-child { order: -1; }
  .demo-bar .note { display: none; }
  .hero { padding: 20px 0 12px; }
  .tool-hint { margin-bottom: 12px; }
  .field-help { display: none; }
}
@media (min-width: 861px) { .nav-toggle { display: none; } }
.nav-toggle { margin-left: auto; }

/* Demo-only toolbar */
.demo-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 16px; background: #111113; color: #e4e4e7; font-size: 12px;
  z-index: 50;
}
.demo-bar label { display: inline-flex; align-items: center; gap: 6px; }
.demo-bar select, .demo-bar button {
  height: 28px; border-radius: 6px; border: 1px solid #3f3f46; background: #27272a; color: #f4f4f5;
  padding: 0 8px; font-size: 12px;
}
.demo-bar button { cursor: pointer; }
.demo-bar .note { color: #a1a1aa; margin-left: auto; }

@media print {
  .demo-bar, .site-header, .site-footer, .ad-slot, .toast { display: none !important; }
}

/* Reference page type */
.search {
  display: flex; align-items: center; gap: 8px;
  height: var(--control-lg); padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  background: var(--surface); min-width: 0;
}
.search:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; background: transparent; }
.search svg { flex: none; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 32px; padding: 0 12px; border-radius: var(--r-full);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-contrast); border-color: var(--brand); }
.ref-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.ref-toolbar .search { flex: 1 1 240px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); padding: 10px 14px; font-weight: 700;
}
table.data td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
table.data tbody tr:hover { background: var(--brand-soft); }
.mono-key { font-family: var(--font-mono); font-weight: 700; color: var(--brand); font-size: 14px; }
.badge { display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand); }
.lookup {
  display: grid; gap: var(--s-3);
  padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface-2); margin-bottom: var(--s-4);
}
.lookup-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: end; }
.lookup .field { flex: 0 0 200px; }
.lookup .field-row input { text-align: left; }
.lookup-out { min-height: 24px; margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.mobile-nav {
  display: none; position: absolute; right: 16px; top: calc(var(--header-h) + 8px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 8px; min-width: 200px; z-index: 45;
}
.mobile-nav a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); }
.mobile-nav a:hover, .mobile-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 860px) {
  .mobile-nav.is-open { display: block; }
  .site-header { position: relative; }
}

/* resize.ytscript.app tool-card extensions. Tokens come from template-v1. Do not ship .demo-bar. */

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  margin: 0 0 var(--s-4);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
}
.privacy-chip svg { width: 14px; height: 14px; flex: none; }

.drop-hero {
  display: grid;
  place-items: center;
  min-height: 216px;
  padding: var(--s-6) var(--s-5);
  cursor: pointer;
  text-align: center;
}
.drop-hero .drop-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--s-3);
  color: var(--brand);
}
.drop-hero .drop-title {
  margin: 0 0 var(--s-1);
  font-weight: 650;
  font-size: var(--fs-md);
  color: var(--ink);
}
.drop-hero .drop-hint {
  padding: 0;
  margin: 0 0 var(--s-4);
  font-size: var(--fs-sm);
}
.drop-hero.is-compact {
  min-height: 0;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  text-align: left;
  padding: 12px 14px;
}
.drop-hero .drop-lead {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.drop-hero.is-compact .drop-lead {
  flex-direction: row;
  align-items: center;
  gap: var(--s-3);
  flex: 1;
}
.drop-hero.is-compact .choose-btn { flex: none; margin-left: auto; }
.drop-hero.is-compact .drop-copy { min-width: 0; }
.drop-hero.is-compact .drop-icon {
  width: 28px;
  height: 28px;
  margin: 0;
}
.drop-hero.is-compact .drop-title { font-size: var(--fs-sm); margin: 0; }
.drop-hero.is-compact .drop-hint { margin: 2px 0 0; font-size: var(--fs-xs); }

.options-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-4) var(--s-5);
  margin: var(--s-5) 0 0;
  padding: var(--s-4) 0 0;
  border-top: 1px solid var(--line);
}
.options-cluster {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.options-cluster--grow { flex: 1 1 240px; }
.options-cluster .field-label { display: block; }
.options-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}
.options-row .tabs { flex: none; }
.quality-panel { flex: 1 1 200px; max-width: 320px; }
.quality-slider {
  flex: 1 1 160px;
  min-width: 120px;
  height: 4px;
  accent-color: var(--brand);
  cursor: pointer;
}
.quality-val {
  flex: none;
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: var(--fs-sm);
  color: var(--ink);
}
.target-input {
  width: 88px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.target-unit { width: 76px; }
.format-select { width: 168px; }
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.presets .chip { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.options-note {
  flex: 1 1 100%;
  margin: -4px 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.options-note.is-warn { color: var(--warning-ink); }

.advanced {
  flex: 1 1 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 0;
}
.advanced > summary {
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  padding: 10px 12px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-weight: 500;
}
.advanced[open] > summary::after { content: "–"; }
.advanced-body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  padding: 0 12px 12px;
  align-items: end;
}
.advanced-body .field { flex: 1 1 200px; }
.px-input { width: 120px; }

.alert-warning {
  background: var(--warning-soft);
  color: var(--warning-ink);
  border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
}

.queue-block { margin-top: var(--s-5); padding-bottom: 24px; }
/* Only a stuck bar needs its own height of room under the list. */
.queue-block:has(~ .queue-footer.is-sticky) { padding-bottom: 72px; }
.queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.queue-head h2 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0;
}
.queue-sum {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.queue-sum b { color: var(--success-ink); font-weight: 650; }

.batch-progress {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--line);
  overflow: hidden;
  margin: 0 0 var(--s-3);
}
.batch-progress > i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
}
.batch-progress-label {
  margin: 0 0 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.queue-empty.empty {
  min-height: 140px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.file-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.file-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 10.5rem 4.75rem 15rem 6.5rem;
  gap: var(--s-3);
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  position: relative;
}
.file-row .size-delta { justify-self: start; }
.file-row .save-pct { justify-self: end; }
.file-row .status-tag { justify-self: start; }
.file-row:first-child { border-top: 0; }
.file-row:hover { background: var(--surface-2); }
.thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background:
    linear-gradient(45deg, #d4d4d8 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, #d4d4d8 25%, transparent 25%) 0 4px / 8px 8px,
    linear-gradient(45deg, transparent 75%, #d4d4d8 75%) 4px -4px / 8px 8px,
    linear-gradient(-45deg, transparent 75%, #d4d4d8 75%) -4px 0 / 8px 8px,
    #f4f4f5;
}
.file-name { min-width: 0; }
.file-name strong {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-name span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.size-delta {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.size-delta s { color: var(--muted); text-decoration: none; }
.save-pct {
  font-size: var(--fs-sm);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--success-ink);
}
.save-pct.is-zero, .save-pct.is-up { color: var(--muted); font-weight: 600; }
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
}
.status-tag.is-done { color: var(--success-ink); }
.status-tag.is-busy { color: var(--brand); }
.status-tag.is-warn { color: var(--warning-ink); }
.status-tag.is-kept { color: var(--muted); }
.status-tag.is-fail { color: var(--error-ink); }
.file-row .btn { justify-self: end; }
.row-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--line);
}
.row-progress > i {
  display: block;
  height: 100%;
  background: var(--brand);
}

.queue-footer {
  position: static;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  margin: 0 -20px -20px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  z-index: 2;
}

@media (max-width: 860px) {
  .drop-hero { min-height: 132px; }
  .drop-hero.is-compact { align-items: center; }
  .file-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb name  action"
      "thumb meta  action";
    row-gap: 4px;
  }
  .file-row .thumb { grid-area: thumb; }
  .file-row .file-name { grid-area: name; }
  .file-row .size-delta { grid-area: meta; }
  .file-row .save-pct { display: inline; margin-left: 8px; }
  .file-row .status-tag { display: none; }
  .file-row .btn { grid-area: action; height: var(--control-md); }
  .format-select { width: 100%; }
  .options-cluster--format { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  html, body { overflow-x: hidden; }
  .wrap, .tool-card, .tool-stage, .hero, .hero .lede, .options-strip, .drop-hero, .queue-block, .queue-footer {
    min-width: 0;
    max-width: 100%;
  }
  .hero .lede { overflow-wrap: anywhere; }

  .drop-hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    place-items: unset;
  }
  .drop-hero .drop-lead { width: 100%; }
  .drop-hero .choose-btn,
  .drop-hero.is-compact .choose-btn {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    align-self: stretch;
    margin-left: 0;
    box-sizing: border-box;
    justify-content: center;
    height: 44px;
    min-height: 44px;
  }
  .drop-hero.is-compact {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
  }
  .drop-hero.is-compact .drop-lead { width: 100%; }

  .options-strip {
    flex-direction: column;
    align-items: stretch;
  }
  .options-cluster,
  .options-cluster--grow,
  .options-cluster--format {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
  .options-cluster--grow > .options-row {
    flex-direction: column;
    align-items: stretch;
  }
  .quality-panel,
  [data-role="panel-quality"],
  [data-role="panel-target"] {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .quality-slider { min-width: 0; }
  .format-select { width: 100%; min-width: 0; max-width: 100%; }
}

/* Production extras (not in Mia demo) */
.lang-switch { display: inline-flex; gap: 8px; margin-left: auto; align-items: center; }
.lang-switch a {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.lang-switch a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-soft);
}
.ad-wrap { margin: var(--s-7) auto; }
.quality-panel.is-disabled { opacity: 0.45; pointer-events: none; }
.header-inner { display: flex; align-items: center; gap: var(--s-4); }

/* Selected Quality / Target size: solid fill, not a faint raised pill. */
.tool-card .tabs { background: var(--line); }
.tool-card .tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
}

/* Ad labels live in the HTML (i18n). Don't force the English ::before. */
.ad-slot::before { content: none; }
.ad-slot .ad-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a8a91;
}

/* Sticky only when the list is taller than the screen (toggled in tool.js). */
.queue-footer.is-sticky { position: sticky; }


/* Size controls (pixels / percent / presets) */
.size-controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-5);
  min-width: 0;
}
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}
.mode-tabs button { flex: 1 1 0; min-width: 0; }
.wh-row {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  min-width: 0;
}
.wh-row .field { flex: 1 1 0; min-width: 0; }
.wh-row .input { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.lock-btn {
  flex: none;
  width: 40px;
  height: 40px;
  margin-bottom: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lock-btn svg { width: 18px; height: 18px; }
.lock-btn.is-locked {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}
.lock-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.percent-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.percent-row .chip { height: 36px; padding: 0 12px; }
.percent-row .chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.custom-pct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.custom-pct .input { width: 96px; }
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
}
@media (min-width: 700px) {
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.preset-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 10px 12px;
  cursor: pointer;
  min-width: 0;
  color: inherit;
  font: inherit;
}
.preset-card strong {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.preset-card[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.fit-row, .pad-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
}
.choice { font-size: var(--fs-sm); display: inline-flex; gap: 6px; align-items: flex-start; }
.color-input { width: 48px; height: 40px; padding: 2px; }
.compress-note {
  margin: var(--s-4) 0 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.compress-note a { color: var(--ink-2); text-underline-offset: 2px; }
.other-sizes { margin-top: var(--s-6); }
.other-sizes h2 { font-size: var(--fs-lg); margin: 0 0 var(--s-3); }
.other-sizes ul { margin: 0; padding-left: 1.2em; }
.other-sizes li { margin: 0.25em 0; }
.queue-footer { justify-content: flex-end; }
.size-delta .dims { display: block; color: var(--muted); font-size: var(--fs-xs); }

@media (max-width: 480px) {
  .size-controls, .wh-row, .percent-row, .preset-grid, .mode-tabs, .compress-note {
    min-width: 0;
    max-width: 100%;
  }
  .mode-tabs { flex-direction: row; }
  .mode-tabs button {
    width: auto;
    flex: 1 1 0;
    font-size: var(--fs-xs);
    padding: 0 8px;
    height: 36px;
  }
  .wh-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    align-items: end;
    gap: 8px;
  }
  .wh-row .field { min-width: 0; }
  .lock-btn {
    order: 0;
    width: 40px;
    height: 40px;
    margin: 0 0 2px;
    justify-self: center;
  }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-pct { width: 100%; }
  .custom-pct .input { width: 100%; }
  .drop-hero { min-height: 128px; padding: 12px 14px; }
}

/* First-screen budget: keep choose + size + disabled download/ZIP in view. */
.drop-hero { min-height: 148px; padding: 16px 20px; }
.queue-empty.empty { padding: 12px 16px; }
.queue-empty.empty p { margin: 4px 0 0; }
.queue-block { margin-top: var(--s-4); }

.related[data-count] {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .related[data-count] { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .related[data-count] { grid-template-columns: repeat(3, 1fr); }
  .related[data-count="4"] { grid-template-columns: repeat(4, 1fr); }
}

a.related-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-width: 0;
  margin: 0;
  padding: var(--s-4);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: none;
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease), transform var(--ease);
}
a.related-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
a.related-card:focus { outline: none; }
a.related-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  box-shadow: var(--focus);
}
a.related-card:active {
  background: var(--surface-2);
  transform: translateY(1px);
}

.related-card .related-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex: none;
  font-size: 0;
}
.related-card .related-icon svg { width: 20px; height: 20px; }
.related-card .related-copy { min-width: 0; flex: 1; }
.related-card .related-name {
  display: block;
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--s-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.related-card .related-purpose {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: var(--fs-xs);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--muted);
}
@media (min-width: 600px) {
  .related-card .related-purpose { -webkit-line-clamp: 1; line-clamp: 1; }
}

.related-card[data-brand="ink"]     { --related-soft-dark: #27272a; }
.related-card[data-brand="slate"]   { --related-soft-dark: #1e2229; }
.related-card[data-brand="coral"]   { --related-soft-dark: #471f1a; }
.related-card[data-brand="indigo"]  { --related-soft-dark: #262351; }
.related-card[data-brand="blue"]    { --related-soft-dark: #18264e; }
.related-card[data-brand="sky"]     { --related-soft-dark: #112d3e; }
.related-card[data-brand="teal"]    { --related-soft-dark: #143130; }
.related-card[data-brand="emerald"] { --related-soft-dark: #11312a; }
.related-card[data-brand="violet"]  { --related-soft-dark: #2e1b4e; }
.related-card[data-brand="rose"]    { --related-soft-dark: #451522; }
.related-card[data-brand="amber"]   { --related-soft-dark: #422714; }
.related-card[data-brand="orange"]  { --related-soft-dark: #462215; }

html[data-theme="dark"] .related-card { --brand-soft: var(--related-soft-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .related-card { --brand-soft: var(--related-soft-dark); }
}
