:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --cta: #e11d48;
  --cta-hover: #be123c;
  --cta-ink: #ffffff;
  --ok: #10b981;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --warn-border: #fde68a;
  --err-bg: #fef2f2;
  --err-ink: #b91c1c;
  --err-border: #fecaca;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: #1e293b;
  --border-strong: #334155;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --subtle: #94a3b8;
  --cta: #f43f5e;
  --cta-hover: #e11d48;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --warn-ink: #fcd34d;
  --warn-border: rgba(245, 158, 11, 0.35);
  --err-bg: rgba(239, 68, 68, 0.14);
  --err-ink: #fca5a5;
  --err-border: rgba(239, 68, 68, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px -6px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 48px -12px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cta), #fb7185);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active {
  color: var(--cta);
  background: color-mix(in srgb, var(--cta) 10%, transparent);
}

.mega-wrap { position: relative; }
.mega-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  z-index: 60;
}
.mega-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.mega-heading {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtle);
  margin-bottom: 8px;
}
.mega-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
}
.mega-item:hover { background: var(--surface-2); }
.mega-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon, .btn-icon-text {
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-icon { width: 38px; }
.btn-icon-text { padding: 0 11px; font-size: 0.82rem; font-weight: 700; }
.btn-icon:hover, .btn-icon-text:hover { background: var(--surface-2); border-color: var(--border-strong); }

html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }

.lang-switch { position: relative; }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 148px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 50;
}
.lang-opt {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 500;
}
.lang-opt:hover { background: var(--surface-2); }
.lang-opt.active { color: var(--cta); font-weight: 700; background: color-mix(in srgb, var(--cta) 10%, transparent); }

.btn-bot {
  background: #0ea5e9;
  color: #fff;
  border: 0;
}
.btn-bot:hover { background: #0284c7; }
.mobile-menu-btn { display: none; }

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--surface);
  padding: 18px 20px 32px;
  overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-langs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.drawer-langs .lang-opt { border: 1px solid var(--border); padding: 6px 12px; }
.drawer-links { display: grid; gap: 6px; }
.drawer-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-sm { padding: 7px 12px; font-size: 0.84rem; border-radius: 8px; }
.btn-lg { padding: 13px 26px; font-size: 1rem; border-radius: 12px; }
.btn-cta, .btn-primary {
  background: var(--cta);
  color: var(--cta-ink);
  box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--cta) 45%, transparent);
}
.btn-cta:hover:not(:disabled), .btn-primary:hover:not(:disabled) { background: var(--cta-hover); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger-ghost {
  background: transparent;
  color: var(--err-ink);
  border-color: var(--err-border);
}
.btn-danger-ghost:hover:not(:disabled) { background: var(--err-bg); }

/* 3-Column Ad-Rail Shell */
.page-shell { max-width: 1580px; margin: 0 auto; padding: 0 16px; }
.page-shell--with-rails {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.ad-rail { display: none; }
.page-center { min-width: 0; max-width: 1180px; width: 100%; margin: 0 auto; }

@media (min-width: 1440px) {
  .page-shell--with-rails {
    grid-template-columns: 164px minmax(0, 1180px) 164px;
    justify-content: center;
    gap: 20px;
  }
  .ad-rail { display: block; padding-top: 24px; }
  .ad-rail .ad-slot { position: sticky; top: 82px; }
}

/* Zero-CLS Policy-Compliant Ad Slots */
.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
}
.ad-slot--preview {
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--surface-2) 70%, transparent),
    color-mix(in srgb, var(--surface-2) 70%, transparent) 10px,
    transparent 10px,
    transparent 20px
  );
  border: 1px dashed var(--border-strong);
  color: var(--subtle);
}
.ad-badge {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
}
.ad-hint { font-size: 0.78rem; font-weight: 600; color: var(--subtle); }
.ad-slot--top, .ad-slot--bottom {
  width: 100%;
  max-width: 728px;
  min-height: 96px;
  margin: 18px auto 22px;
}
.ad-slot--left, .ad-slot--right {
  width: 160px;
  min-height: 600px;
}
.ad-slot--result {
  width: 100%;
  max-width: 344px;
  min-height: 280px;
  margin: 0 auto;
}
.result-ad-buffer {
  margin-top: 32px;
  padding-top: 8px;
}

/* Homepage Hero */
.main-content { padding: 24px 0 40px; }
.hero { text-align: center; padding: 18px 0 10px; max-width: 820px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cta) 10%, transparent);
  color: var(--cta);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero-title {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.3vw, 2.55rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.hero-subtitle {
  margin: 0 auto 20px;
  max-width: 650px;
  color: var(--muted);
  font-size: 1.02rem;
}
.hero-search-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto 18px;
}
.search-ico {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtle);
  pointer-events: none;
}
.hero-search {
  width: 100%;
  height: 48px;
  padding: 0 74px 0 44px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.96rem;
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hero-search:focus {
  border-color: var(--cta);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cta) 16%, transparent);
}
.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--subtle);
}

.cat-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.cat-pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-pill:hover { border-color: var(--border-strong); color: var(--ink); }
.cat-pill.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.recent-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.recent-label { font-size: 0.82rem; font-weight: 700; color: var(--subtle); }
.recent-list { display: flex; gap: 8px; flex-wrap: wrap; }
.recent-chip {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}

/* 4x4 Tool Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  position: relative;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--card-accent, var(--cta)) 45%, var(--border));
}
.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--card-accent, var(--cta));
  background: color-mix(in srgb, var(--card-accent, var(--cta)) 12%, transparent);
}
.tool-icon svg { width: 22px; height: 22px; }
.tool-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-accent, var(--cta)) 12%, transparent);
  color: var(--card-accent, var(--cta));
}
.tool-card-title { margin: 0 0 6px; font-size: 1.04rem; font-weight: 700; }
.tool-card-desc { margin: 0; font-size: 0.86rem; color: var(--muted); line-height: 1.45; }
.search-empty {
  text-align: center;
  padding: 36px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 600;
}

/* Pillars, How, FAQ */
.pillars-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.pillar-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.pillar-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cta);
  margin-bottom: 6px;
}
.pillar-card h3 { margin: 0 0 6px; font-size: 0.98rem; }
.pillar-card p { margin: 0; font-size: 0.86rem; color: var(--muted); }

.section-heading {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  text-align: center;
}
.how-section, .faq-section, .related-section { margin-top: 38px; }
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.how-step {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.how-step h3 { margin: 0 0 6px; font-size: 1rem; }
.how-step p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.faq-list { max-width: 820px; margin: 0 auto; display: grid; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.96rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--subtle); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }

/* Tool Page & Workspace */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--subtle);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }

.tool-hero { text-align: center; max-width: 720px; margin: 0 auto 14px; }
.tool-hero-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--tool-accent, var(--cta));
  background: color-mix(in srgb, var(--tool-accent, var(--cta)) 13%, transparent);
}
.tool-hero-icon svg { width: 26px; height: 26px; }
.tool-h1 { margin: 0 0 8px; font-size: clamp(1.55rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.025em; }
.tool-sub { margin: 0; color: var(--muted); font-size: 1rem; }

.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 24px;
}
.ws-alert {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--err-bg);
  color: var(--err-ink);
  border: 1px solid var(--err-border);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 16px;
}

.dropzone {
  border: 2px dashed color-mix(in srgb, var(--tool-accent, var(--cta)) 45%, var(--border-strong));
  border-radius: 14px;
  background: color-mix(in srgb, var(--tool-accent, var(--cta)) 3%, var(--surface-2));
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--tool-accent, var(--cta));
  background: color-mix(in srgb, var(--tool-accent, var(--cta)) 8%, var(--surface-2));
}
.dropzone-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--tool-accent, var(--cta));
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dropzone-icon svg { width: 28px; height: 28px; }
.dropzone-title { margin: 0 0 4px; font-size: 1.2rem; font-weight: 800; }
.dropzone-sub { margin: 0 0 18px; color: var(--muted); font-size: 0.92rem; }
.dropzone-limit { margin: 14px 0 0; font-size: 0.8rem; color: var(--subtle); }

.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.drag-overlay[hidden] { display: none; }
.drag-overlay-box {
  padding: 28px 42px;
  border-radius: 18px;
  background: var(--surface);
  border: 2px dashed var(--cta);
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: var(--shadow-lg);
}

/* Stage 2: Full-Viewport Split-Pane Studio */
.canvas-ad-wrap { display: none; }

@media (min-width: 960px) {
  body.editor-active .breadcrumb,
  body.editor-active .tool-hero,
  body.editor-active .outer-top-ad,
  body.editor-active .ad-rail,
  body.editor-active .tool-seo-grid,
  body.editor-active .faq-section,
  body.editor-active .related-section,
  body.editor-active .tool-main > .ad-slot--bottom,
  body.editor-active .site-footer {
    display: none;
  }
  body.editor-active .page-shell {
    max-width: none;
    padding: 0;
  }
  body.editor-active .page-shell--with-rails {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  body.editor-active .page-center {
    max-width: none;
  }
  body.editor-active .main-content.tool-main {
    padding: 0;
  }
  body.editor-active .workspace {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
  }
  body.editor-active .canvas-ad-wrap {
    display: block;
    width: 100%;
    margin-bottom: 10px;
  }
  body.editor-active .canvas-ad-wrap .ad-slot--top {
    margin: 0 auto 14px;
  }
}

.studio-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 368px;
  min-height: calc(100vh - 64px);
}

.studio-canvas {
  position: relative;
  background:
    radial-gradient(color-mix(in srgb, var(--border-strong) 45%, transparent) 1px, transparent 1px),
    var(--surface-2);
  background-size: 20px 20px;
  padding: 22px 84px 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.doc-cards-canvas {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  padding: 8px 0;
}

.doc-card {
  width: 196px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 11px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
}
.doc-card[draggable="true"] { cursor: grab; }
.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.doc-card.dragging { opacity: 0.42; }
.doc-card.drag-over {
  border-color: var(--cta);
  border-style: dashed;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cta) 22%, transparent);
}

.doc-card-thumb {
  position: relative;
  height: 230px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 6px;
}
.doc-card-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  transition: transform 0.18s ease;
}
.doc-card-fallback {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--tool-accent, var(--cta));
  letter-spacing: 0.04em;
}
.doc-card-pages {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}
.doc-card-actions {
  position: absolute;
  top: 7px;
  right: 7px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.doc-card:hover .doc-card-actions,
.doc-card:focus-within .doc-card-actions { opacity: 1; }
.card-act-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
}
.card-act-btn:hover { background: var(--cta); color: #fff; border-color: var(--cta); }

.doc-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}
.doc-card-sub {
  font-size: 0.73rem;
  color: var(--subtle);
  text-align: center;
  margin-top: -4px;
}

/* Split Visual Range Group Cards */
.split-ranges-canvas {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 12px 0;
}
.range-group-card {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.range-group-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}
.range-group-pages {
  display: flex;
  align-items: center;
  gap: 10px;
}
.range-ellipsis {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--subtle);
  letter-spacing: 2px;
}
.range-thumb-frame {
  width: 124px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}
.range-thumb-box {
  width: 100%;
  height: 152px;
  border-radius: 6px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.range-thumb-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.range-thumb-num { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.range-zoom-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  opacity: 0;
  transition: opacity 0.14s;
}
.range-thumb-frame:hover .range-zoom-btn,
.range-thumb-frame:focus-within .range-zoom-btn { opacity: 1; }
.range-zoom-btn:hover { background: var(--cta); color: #fff; border-color: var(--cta); }

.split-size-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
}
.split-size-callout {
  max-width: 440px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}
.split-size-callout h3 { margin: 0 0 6px; font-size: 1.05rem; }
.split-size-callout p { margin: 0; font-size: 0.88rem; color: var(--muted); }

/* Floating Canvas FAB Rail */
.canvas-fab-rail {
  position: sticky;
  bottom: 24px;
  align-self: flex-end;
  margin-right: -58px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
}
.fab-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.14s, background 0.15s;
}
.fab-circle:hover { transform: scale(1.06); }
.fab-circle--add {
  width: 50px;
  height: 50px;
  background: var(--cta);
  color: #fff;
  border: 0;
}
.fab-circle--add:hover { background: var(--cta-hover); }
.fab-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  border: 2px solid var(--surface);
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.fab-az { font-size: 0.72rem; font-weight: 800; letter-spacing: -0.03em; }

/* Right Sticky Inspector Sidebar */
.studio-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-title { margin: 0; font-size: 1.15rem; font-weight: 800; }
.configure-summary { font-size: 0.8rem; color: var(--subtle); font-weight: 600; margin-top: 2px; }
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sidebar-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: color-mix(in srgb, #3b82f6 11%, var(--surface));
  border: 1px solid color-mix(in srgb, #3b82f6 25%, var(--border));
  font-size: 0.83rem;
  line-height: 1.42;
  color: var(--ink);
}
.tip-ico { color: #2563eb; flex-shrink: 0; margin-top: 1px; }
.sidebar-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.sidebar-foot .btn-cta {
  width: 100%;
  height: 52px;
  font-size: 1.04rem;
  justify-content: center;
  gap: 12px;
}
.cta-arrow-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.8px solid rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
}

/* Split PDF Sidebar Tabs & Rows */
.split-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}
.split-tab {
  position: relative;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  padding: 12px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.split-tab:last-child { border-right: 0; }
.split-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 -2.5px 0 var(--cta);
}
.split-tab-check {
  display: none;
  position: absolute;
  top: 5px;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
  place-items: center;
}
.split-tab.active .split-tab-check { display: grid; }
.split-free-pill {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
  font-size: 0.58rem;
  font-weight: 800;
}

.seg-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.seg-pill {
  height: 38px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.seg-pill.active {
  border-color: var(--cta);
  color: var(--cta);
  background: color-mix(in srgb, var(--cta) 8%, var(--surface));
}

.range-rows-list { display: grid; gap: 8px; margin-bottom: 10px; }
.range-row {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: grid;
  gap: 7px;
}
.range-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.range-row-del {
  border: 0;
  background: transparent;
  color: var(--err-ink);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}
.range-row-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.range-inp-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 8px;
  height: 36px;
}
.range-inp-box span { font-size: 0.75rem; color: var(--subtle); font-weight: 600; }
.range-inp-box input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 0;
}
.btn-outline-accent {
  width: 100%;
  background: transparent;
  color: var(--cta);
  border: 1.5px solid var(--cta);
}
.btn-outline-accent:hover { background: color-mix(in srgb, var(--cta) 8%, transparent); }
.size-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.size-chips .btn-chip.active { border-color: var(--cta); color: var(--cta); }
.size-estimate-pill {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
  font-size: 0.83rem;
  font-weight: 700;
}

/* Zoom Lightbox Modal */
.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(9, 14, 26, 0.82);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.zoom-modal[hidden] { display: none; }
.zoom-dialog {
  width: min(920px, 95vw);
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}
.zoom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.zoom-title { font-weight: 700; font-size: 0.92rem; }
.zoom-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  max-height: 78vh;
  background: var(--surface-2);
  border-radius: 10px;
  overflow: hidden;
  padding: 10px 44px;
}
.zoom-stage img {
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}
.zoom-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.3rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.zoom-nav--prev { left: 8px; }
.zoom-nav--next { right: 8px; }
.zoom-nav:disabled { opacity: 0.3; cursor: not-allowed; }

/* Studio Grid */
.studio-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.studio-chips, .studio-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-chip {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-chip:hover:not(:disabled) { border-color: var(--cta); }
.btn-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.studio-sel-count { font-size: 0.8rem; font-weight: 700; color: var(--cta); margin-left: 4px; }

.studio-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 12px;
  padding: 6px 0;
}
.page-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 11px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s, transform 0.12s;
}
.page-tile:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.page-tile.selected { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 22%, transparent); }
.page-tile-check {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  place-items: center;
  z-index: 2;
}
.page-tile.selected .page-tile-check { display: grid; }
.page-thumb-box {
  height: 175px;
  border-radius: 7px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.page-thumb-box img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.15s; }
.page-tile-foot { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; font-weight: 700; }
.page-tile-ops { display: flex; gap: 4px; }
.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  width: 24px;
  height: 22px;
  font-size: 0.72rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mini-btn:hover { background: var(--border); }

/* Options Panel inside Sidebar */
.options-panel {
  display: grid;
  gap: 14px;
}
.studio-sidebar .opt-row {
  grid-template-columns: minmax(0, 1fr);
}
.opt-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.opt-stack { display: grid; gap: 12px; }
.opt-group { display: grid; gap: 6px; }
.opt-label { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.opt-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.9rem;
}
.opt-color { padding: 4px; cursor: pointer; }
.opt-checks { display: flex; gap: 14px; flex-wrap: wrap; }
.check-item { display: inline-flex; align-items: center; gap: 8px; font-size: 0.87rem; font-weight: 600; cursor: pointer; }

.radio-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.radio-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 600;
}
.radio-card.active {
  border-color: var(--tool-accent, var(--cta));
  background: color-mix(in srgb, var(--tool-accent, var(--cta)) 10%, var(--surface));
}

.pw-wrap { position: relative; }
.pw-wrap .opt-input { padding-right: 40px; }
.pw-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
}
.pw-meter { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width 0.2s, background 0.2s; }

/* Watermark Live Preview */
.wm-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr); gap: 16px; align-items: center; }
.wm-controls { display: grid; gap: 12px; }
.wm-live-box { display: grid; place-items: center; }
.wm-mock-page {
  width: 170px;
  height: 224px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  padding: 18px 14px;
}
.wm-mock-lines { display: grid; gap: 12px; opacity: 0.22; }
.wm-mock-lines span { height: 7px; background: #94a3b8; border-radius: 4px; display: block; }
.wm-mock-lines span:nth-child(2) { width: 82%; }
.wm-mock-lines span:nth-child(4) { width: 68%; }
.wm-mock-stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: #64748b;
  opacity: 0.22;
  transform: rotate(-45deg);
  pointer-events: none;
  text-align: center;
  word-break: break-word;
  padding: 8px;
}

/* 6-point Page Number Grid */
.pos-grid {
  width: 150px;
  height: 190px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  align-content: space-between;
}
.pos-cell {
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.pos-cell[data-pos^="bottom"] { align-self: end; }
.pos-cell span { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); }
.pos-cell.active { border-color: var(--tool-accent, var(--cta)); background: color-mix(in srgb, var(--tool-accent, var(--cta)) 15%, var(--surface)); }
.pos-cell.active span { background: var(--tool-accent, var(--cta)); }

.configure-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* Stage 3: Processing */
.stage-processing { text-align: center; padding: 40px 16px; }
.proc-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3.5px solid var(--border);
  border-top-color: var(--tool-accent, var(--cta));
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track {
  max-width: 460px;
  height: 10px;
  margin: 14px auto 10px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tool-accent, var(--cta)), #fb7185);
  transition: width 0.25s ease;
}
.proc-meta { font-size: 0.9rem; color: var(--muted); font-weight: 600; margin-bottom: 16px; }

/* Stage 4: Results Card */
.result-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  background: var(--surface-2);
}
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.result-badge-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
  font-weight: 800;
  font-size: 0.86rem;
}
.result-ttl { font-size: 0.82rem; font-weight: 600; color: var(--subtle); }
.result-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.result-filename { font-weight: 800; font-size: 1.05rem; word-break: break-all; }
.result-stats { font-size: 0.86rem; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.saved-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
  font-weight: 800;
  font-size: 0.78rem;
}
.result-warnings {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid var(--warn-border);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Before/After Slider */
.ba-wrap { margin-top: 18px; }
.ba-wrap h3 { margin: 0 0 10px; font-size: 0.96rem; }
.ba-stage {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  user-select: none;
}
.ba-stage img { display: block; width: 100%; height: auto; }
.ba-before-clip {
  position: absolute;
  inset: 0;
  clip-path: inset(0 50% 0 0);
}
.ba-tag {
  position: absolute;
  top: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
}
.ba-tag--left { left: 10px; }
.ba-tag--right { right: 10px; }
.ba-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
}

/* OCR & Gallery */
.ocr-result-wrap { margin-top: 16px; }
.ocr-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ocr-result-head h3 { margin: 0; font-size: 0.96rem; }
.ocr-result-btns { display: flex; gap: 8px; }
.ocr-textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.88rem;
  resize: vertical;
}
.gallery-wrap { margin-top: 16px; }
.gallery-wrap h3 { margin: 0 0 10px; font-size: 0.96rem; }
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.gallery-card img { width: 100%; height: 150px; object-fit: contain; border-radius: 6px; background: var(--surface-2); }

.result-secondary-row {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chain-wrap {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.chain-title { font-size: 0.84rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.chain-list { display: flex; gap: 8px; flex-wrap: wrap; }
.chain-btn {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  border-left: 3.5px solid var(--card-accent, var(--cta));
}
.chain-btn:hover { background: var(--surface-2); border-color: var(--card-accent, var(--cta)); }

.result-bot-promo {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, #0ea5e9 10%, var(--surface));
  font-size: 0.84rem;
}
.result-bot-promo a { color: #0284c7; font-weight: 700; }

/* Tool SEO Sections */
.tool-seo-grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.seo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.seo-card h2 { margin: 0 0 10px; font-size: 1.1rem; }
.seo-list { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 8px; font-size: 0.92rem; }
.seo-list--check { list-style: "✓  "; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tool-card--compact {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px;
}
.tool-card--compact h3 { margin: 0 0 3px; font-size: 0.94rem; }
.tool-card--compact p { margin: 0; font-size: 0.78rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Policy pages */
.policy-main { max-width: 820px; margin: 0 auto; }
.policy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}
.policy-card h1 { margin: 0 0 8px; font-size: 1.9rem; }
.policy-lead { color: var(--muted); font-size: 1.04rem; margin: 0 0 24px; }
.policy-block { margin-bottom: 20px; }
.policy-block h2 { margin: 0 0 6px; font-size: 1.12rem; }
.policy-block p { margin: 0; color: var(--muted); }
.policy-block a { color: var(--cta); font-weight: 700; text-decoration: underline; }

/* Footer & Cookie Banner */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 32px;
  padding: 36px 20px 24px;
}
.footer-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 24px;
}
.footer-desc { color: var(--muted); font-size: 0.88rem; margin: 10px 0 14px; }
.footer-langs { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-langs a {
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
}
.footer-langs a.active { border-color: var(--cta); color: var(--cta); }
.footer-grid h4 { margin: 0 0 10px; font-size: 0.9rem; font-weight: 800; }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 0.86rem; color: var(--muted); }
.footer-list a:hover { color: var(--ink); text-decoration: underline; }
.footer-bottom {
  max-width: 1180px;
  margin: 24px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--subtle);
}

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 70;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 0.84rem; color: var(--muted); }
.cookie-banner a { color: var(--cta); text-decoration: underline; }

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pillars-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .studio-shell { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .studio-canvas { padding: 16px 12px 24px; }
  .canvas-fab-rail {
    position: static;
    margin-right: 0;
    margin-top: 14px;
    flex-direction: row;
    align-self: center;
  }
  .studio-sidebar {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .doc-card { width: min(180px, calc(50% - 8px)); }
  .doc-card-thumb { height: 190px; }
  .doc-card-actions { opacity: 1; }
  .range-zoom-btn { opacity: 1; }
}
@media (max-width: 860px) {
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how-grid, .tool-seo-grid, .opt-row, .wm-layout { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .tools-grid { grid-template-columns: minmax(0, 1fr); }
  .pillars-grid, .related-grid, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace { padding: 16px; }
  .btn-bot span { display: none; }
  .search-kbd { display: none; }
  .hero-search { padding-right: 16px; }
  .cookie-banner { flex-direction: column; align-items: flex-start; }
}
