/* =========================================================
   PDFGuru.fun — Global Stylesheet
   Premium SaaS Glassmorphism • 100% Client-Side • Dark Mode
   ========================================================= */

/* ---------- Design Tokens (light) ---------- */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg-app: #f6f8fc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f5f9ff;
  --bg-glass: rgba(255,255,255,0.78);
  --bg-glass-strong: rgba(255,255,255,0.92);

  /* Borders */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --text-900: #0f172a;
  --text-700: #334155;
  --text-500: #64748b;
  --text-400: #94a3b8;

  /* Brand gradient */
  --brand-1: #6366f1;
  --brand-2: #8b5cf6;
  --brand-3: #ec4899;
  --brand-4: #06b6d4;
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --brand-grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #fdf2f8 100%);

  /* Per-tool accents */
  --accent-merge:   linear-gradient(135deg, #6366f1, #3b82f6);
  --accent-split:   linear-gradient(135deg, #8b5cf6, #6366f1);
  --accent-compress:linear-gradient(135deg, #06b6d4, #3b82f6);
  --accent-photo:   linear-gradient(135deg, #ec4899, #f43f5e);
  --accent-pdf2img: linear-gradient(135deg, #f59e0b, #f43f5e);
  --accent-remove:  linear-gradient(135deg, #ef4444, #f43f5e);
  --accent-protect: linear-gradient(135deg, #10b981, #06b6d4);
  --accent-unlock:  linear-gradient(135deg, #22c55e, #84cc16);
  --accent-watermark: linear-gradient(135deg, #8b5cf6, #d946ef);
  --accent-page:    linear-gradient(135deg, #6366f1, #06b6d4);
  --accent-rotate:  linear-gradient(135deg, #f59e0b, #d97706);
  --accent-meta:    linear-gradient(135deg, #14b8a6, #06b6d4);
  --accent-extract: linear-gradient(135deg, #6366f1, #ec4899);
  --accent-delete:  linear-gradient(135deg, #ef4444, #8b5cf6);
  --accent-reorder: linear-gradient(135deg, #06b6d4, #8b5cf6);
  --accent-htmlpdf: linear-gradient(135deg, #ec4899, #f59e0b);

  /* Status */
  --success: #16a34a;
  --success-bg: #e7f7ee;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eef4ff;
  --warning: #d97706;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.12), 0 4px 12px rgba(15,23,42,0.06);
  --shadow-glow: 0 8px 30px rgba(99,102,241,0.25);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* Type */
  --font: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Layout bounds */
  --container-w: 1180px;     /* base content max width on desktop */
  --sidebar-w: 160px;        /* sidebar banner width */
  --sidebar-gap: 24px;       /* space between sidebar and content */
}

/* ---------- Dark theme tokens ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg-app: #0b0f1a;
  --bg-card: #131826;
  --bg-subtle: #1a2030;
  --bg-hover: #1b2238;
  --bg-glass: rgba(11,15,26,0.78);
  --bg-glass-strong: rgba(19,24,38,0.92);

  --border: #27314a;
  --border-strong: #3a4663;

  --text-900: #f1f5fb;
  --text-700: #c3cdde;
  --text-500: #8593ad;
  --text-400: #5d6b88;

  --brand-grad-soft: linear-gradient(135deg, #1a1f3a 0%, #1f1a3a 50%, #2a1730 100%);

  --success-bg: rgba(22,163,74,0.12);
  --error-bg: rgba(220,38,38,0.12);
  --info-bg: rgba(37,99,235,0.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-glow: 0 8px 30px rgba(99,102,241,0.4);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text-900);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 0;
  transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul { list-style: none; }
svg { display: block; }

/* ---------- Ambient Background Orbs ---------- */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  mix-blend-mode: multiply;
  will-change: transform;
}
[data-theme="dark"] .orb { opacity: 0.30; mix-blend-mode: screen; }
.orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #818cf8, transparent 70%);
  top: -160px; left: -120px;
  animation: drift1 22s ease-in-out infinite alternate;
}
.orb-2 {
  width: 460px; height: 460px;
  background: radial-gradient(circle, #f9a8d4, transparent 70%);
  bottom: -180px; right: -100px;
  animation: drift2 26s ease-in-out infinite alternate;
}
.orb-3 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #67e8f9, transparent 70%);
  top: 40%; left: 55%;
  animation: drift3 30s ease-in-out infinite alternate;
}
@keyframes drift1 { 0%{transform:translate(0,0) scale(1);} 100%{transform:translate(140px,120px) scale(1.15);} }
@keyframes drift2 { 0%{transform:translate(0,0) scale(1);} 100%{transform:translate(-120px,-90px) scale(1.2);} }
@keyframes drift3 { 0%{transform:translate(0,0) scale(1);} 100%{transform:translate(-160px,80px) scale(0.85);} }

/* ---------- Layout ---------- */
.container {
  width: min(var(--container-w), 92vw);
  margin: 0 auto;
}

/* Desktop layout: shrink container to leave room for fixed side banners */
@media (min-width: 1241px) {
  :root { --container-w: 1180px; }
  .container { width: min(1180px, calc(100vw - 380px)); }
}

.main-wrap {
  width: 100%;
  margin: 0 auto;
  padding: 28px 0 48px;
}
.content-col { flex: 1; min-width: 0; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  flex: none;
}
.logo-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.logo-mark svg { width: 22px; height: 22px; }
.logo-text span {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-text .dot { color: var(--brand-3); -webkit-text-fill-color: var(--brand-3); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Privacy pill */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--success-bg) 0%, rgba(34,197,94,0.08) 100%);
  color: var(--success);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px 6px 10px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(22,163,74,0.25);
  letter-spacing: -0.01em;
}
[data-theme="dark"] .privacy-badge { border-color: rgba(22,163,74,0.35); }
.privacy-badge .pulse {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(22,163,74,0.6);
  animation: ring 2s infinite;
}
@keyframes ring {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* Icon button (theme toggle, menu, etc.) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-700);
  transition: background .18s, color .18s, transform .12s, border-color .18s;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--brand-1);
  border-color: var(--brand-1);
  transform: translateY(-1px);
}
.icon-btn svg { width: 18px; height: 18px; }

/* Compact "All Tools" button — gradient pill, professional */
.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--brand-grad);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: 10px;
  letter-spacing: -0.01em;
  transition: transform .18s, box-shadow .18s, filter .18s;
  box-shadow: 0 4px 12px rgba(99,102,241,0.32);
  white-space: nowrap;
}
.btn-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(99,102,241,0.42);
  filter: brightness(1.08);
}
.btn-nav svg { width: 16px; height: 16px; }

/* Subtle text link */
.nav-link {
  color: var(--text-700);
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--brand-1); background: rgba(99,102,241,0.10); }

/* ---------- Hero (landing) ---------- */
.hero {
  text-align: center;
  padding: 56px 0 28px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-grad-soft);
  border: 1px solid var(--border);
  color: var(--brand-1);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin-bottom: 18px;
}
.hero h1 .grad {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-500);
  font-size: 1.08rem;
  max-width: 640px;
  margin: 0 auto 14px;
}
.hero-usp {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  justify-content: center;
  margin-top: 22px;
}
.hero-usp li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-700);
  font-size: 0.95rem;
}
.hero-usp svg { width: 20px; height: 20px; color: var(--brand-1); }

/* ---------- Section title ---------- */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 22px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.section-title .count {
  font-weight: 600;
  color: var(--text-400);
  font-size: 0.9rem;
}

/* ---------- Tool grid ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.tool-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s, border-color .25s;
  overflow: hidden;
  isolation: isolate;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--card-grad, var(--brand-grad-soft));
  opacity: 0;
  z-index: -1;
  transition: opacity .3s;
}
.tool-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.tool-card:hover::before { opacity: 0.55; }
.tool-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--tool-grad, var(--brand-grad));
  box-shadow: 0 6px 18px rgba(99,102,241,0.28);
  margin-bottom: 14px;
}
.tool-icon svg { width: 24px; height: 24px; }
.tool-card h3 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.tool-card p {
  color: var(--text-500);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.tool-card .tool-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--brand-1);
  transition: gap .2s;
}
.tool-card:hover .tool-link { gap: 10px; }

/* ---------- Trust strip ---------- */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 32px;
  padding: 26px 0 0;
  color: var(--text-500);
  font-size: 0.9rem;
}
.trust-strip strong { color: var(--text-700); font-weight: 700; }

/* ---------- Card / Panel ---------- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 16px; }

/* Tool page header */
.tool-header {
  text-align: center;
  padding: 48px 0 24px;
}
.tool-header .tool-icon-lg {
  width: 70px; height: 70px;
  margin: 0 auto 16px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--tool-grad, var(--brand-grad));
  box-shadow: 0 10px 28px rgba(99,102,241,0.3);
}
.tool-header .tool-icon-lg svg { width: 34px; height: 34px; }
.tool-header h1 {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
}
.tool-header p {
  color: var(--text-500);
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.02rem;
}

/* ---------- Dropzone ---------- */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  padding: 44px 22px;
  text-align: center;
  transition: border-color .25s, background .25s, box-shadow .25s;
  cursor: pointer;
}
.dropzone:hover {
  border-color: var(--brand-2);
  background: var(--bg-hover);
}
.dropzone.dragover {
  border-color: var(--brand-1);
  background: rgba(99,102,241,0.08);
  animation: dzglow 1.2s ease-in-out infinite;
}
[data-theme="dark"] .dropzone.dragover { background: rgba(99,102,241,0.16); }
@keyframes dzglow {
  0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
  50% { box-shadow: 0 0 0 10px rgba(99,102,241,0.20); }
}
.dz-icon {
  width: 62px; height: 62px;
  border-radius: 18px;
  margin: 0 auto 14px;
  background: var(--brand-grad-soft);
  display: grid;
  place-items: center;
  color: var(--brand-1);
}
.dz-icon svg { width: 28px; height: 28px; }
.dz-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.dz-hint { color: var(--text-400); font-size: 0.88rem; }
.dz-hint strong { color: var(--brand-1); }
.dz-formats {
  margin-top: 12px;
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.fmt-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-500);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

.file-input { display: none; }

/* ---------- File list ---------- */
.file-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  transition: border-color .2s, box-shadow .2s;
  animation: popIn .3s ease-out;
}
.file-row:hover { border-color: var(--brand-2); box-shadow: var(--shadow-sm); }
.file-row .thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--bg-subtle);
  display: grid;
  place-items: center;
  color: var(--brand-1);
  flex: none;
  overflow: hidden;
}
.file-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-row .meta { flex: 1; min-width: 0; }
.file-row .fname {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row .finfo { color: var(--text-400); font-size: 0.82rem; }
.file-row .handle { color: var(--text-400); cursor: grab; padding: 4px; }
.file-row .handle:active { cursor: grabbing; }
.file-row .remove-btn {
  color: var(--text-400);
  padding: 6px;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.file-row .remove-btn:hover { color: var(--error); background: var(--error-bg); }
.sortable-ghost { opacity: 0.4; }
.sortable-drag { opacity: 0.95; box-shadow: var(--shadow-lg); }

/* ---------- Page thumbnail grid (drag/delete UI) ---------- */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.page-tile {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color .2s, transform .18s, box-shadow .2s;
  cursor: grab;
  user-select: none;
}
.page-tile:hover { border-color: var(--brand-2); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.page-tile img { width: 100%; height: 150px; object-fit: cover; background: #fff; display: block; }
.page-tile.is-deleted { opacity: 0.35; border-style: dashed; }
.page-tile.is-deleted img { filter: grayscale(1); }
.page-tile .page-number {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(15,23,42,0.78);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.page-tile .tile-actions {
  position: absolute;
  top: 6px; right: 6px;
  display: flex;
  gap: 4px;
}
.tile-btn {
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(15,23,42,0.78);
  color: #fff;
  transition: background .18s;
}
.tile-btn:hover { background: rgba(220,38,38,0.92); }
.tile-btn svg { width: 13px; height: 13px; }
.tile-btn.undo { background: rgba(22,163,74,0.85); }
.tile-btn.undo:hover { background: rgba(22,163,74,1); }
.tile-rotate { background: rgba(99,102,241,0.85); }
.tile-rotate:hover { background: rgba(99,102,241,1); }
.sortable-ghost.tile-ghost { opacity: 0.5; }

/* Native HTML5 DnD states (Reorder / Remove tools — no extra library) */
.page-tile.dragging { opacity: 0.45; transform: scale(0.97); }
.page-tile.drag-over { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(139,92,246,0.35); }
.page-tile.selectable { cursor: pointer; }
.page-tile.selectable:hover .tile-delete-hint { opacity: 1; }
.page-tile .tile-delete-hint {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  background: rgba(239,68,68,0.92); color: #fff;
  font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: var(--r-pill); opacity: 0; transition: opacity .15s;
  pointer-events: none; white-space: nowrap;
}
.page-tile.is-deleted .tile-delete-hint { opacity: 1; background: rgba(22,163,74,0.92); }
.page-tile .tile-grip {
  position: absolute; bottom: 6px; right: 6px;
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 5px; background: rgba(15,23,42,0.55); color: #fff;
  opacity: 0; transition: opacity .15s;
}
.page-tile:hover .tile-grip { opacity: 1; }

/* Summary chip shown above a thumbnail grid (e.g. "8 of 10 pages kept") */
.grid-summary {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.86rem; font-weight: 700; color: var(--text-700);
  background: var(--bg-subtle); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: var(--r-pill); margin-top: 16px;
}
.grid-summary .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); }
.grid-summary .count-num { color: var(--brand-1); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 12px 24px;
  border-radius: var(--r-md);
  transition: transform .18s, box-shadow .18s, background .18s, color .18s, border-color .18s, filter .18s;
  letter-spacing: -0.01em;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: #fff;
  color: var(--brand-1);
  border: 2px solid var(--brand-1);
  box-shadow: 0 4px 0 0 rgba(99,102,241,0.18);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(99,102,241,0.32);
  background: var(--brand-1);
  color: #fff;
}
[data-theme="dark"] .btn-primary {
  background: rgba(255,255,255,0.04);
  box-shadow: 0 4px 0 0 rgba(99,102,241,0.30);
}
[data-theme="dark"] .btn-primary:hover { background: var(--brand-1); color: #fff; }

.btn-solid {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-solid:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(99,102,241,0.42);
  filter: brightness(1.08);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-700);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--brand-2); }

.btn-danger {
  background: var(--bg-card);
  color: var(--error);
  border: 2px solid var(--error);
}
.btn-danger:hover { background: var(--error); color: #fff; }

.btn:disabled {
  opacity: 0.5; cursor: not-allowed;
  transform: none !important; box-shadow: none !important; filter: none !important;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; align-items: center; }
.btn-row.center { justify-content: center; }

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-700);
}
.field .hint { font-size: 0.78rem; color: var(--text-400); }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-card);
  transition: border-color .18s, box-shadow .18s, background .18s;
  font-size: 0.97rem;
  color: var(--text-900);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.18);
}
.textarea { min-height: 180px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }

/* Segmented control */
.segmented {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 4px;
}
.segmented button {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-500);
  transition: color .2s, background .2s, box-shadow .2s;
  white-space: nowrap;
}
.segmented button:hover { color: var(--text-700); }
.segmented button.active {
  background: var(--bg-card);
  color: var(--brand-1);
  box-shadow: var(--shadow-sm);
}

/* Color input */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] {
  width: 46px; height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 4px;
  background: var(--bg-card);
  cursor: pointer;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--brand-grad);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border: none; border-radius: 50%;
  background: var(--brand-1); cursor: pointer;
}

/* ---------- Options row ---------- */
.options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 16px 0 4px;
}
.option { display: flex; flex-direction: column; gap: 8px; }
.option > span { font-size: 0.82rem; font-weight: 700; color: var(--text-700); }

/* ---------- Result download box ---------- */
.result-box {
  display: none;
  margin-top: 22px;
  padding: 24px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--success-bg) 0%, var(--info-bg) 100%);
  border: 1px solid var(--success);
  text-align: center;
  animation: popIn .35s ease-out;
}
.result-box.show { display: block; }
.result-box .ricon {
  width: 56px; height: 56px;
  border-radius: 16px;
  margin: 0 auto 12px;
  background: var(--success);
  color: #fff;
  display: grid;
  place-items: center;
}
.result-box .ricon svg { width: 28px; height: 28px; }
.result-box h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }
.result-box p { color: var(--text-700); margin-bottom: 16px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 40px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-400);
  border-radius: var(--r-md);
  padding: 14px 18px;
  width: 340px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.2,.7,.3,1);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--error); }
.toast.info    { border-left-color: var(--info); }
.toast.success .ticon { color: var(--success); }
.toast.error .ticon   { color: var(--error); }
.toast.info .ticon    { color: var(--info); }
.toast .ticon { flex: none; }
.toast .ticon svg { width: 22px; height: 22px; }
.toast .tbody { flex: 1; min-width: 0; }
.toast .ttitle { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.toast .tmsg { font-size: 0.85rem; color: var(--text-500); }
.toast.hide { animation: toastOut .3s forwards; }
@keyframes toastIn { from{opacity:0;transform:translateX(40px);} to{opacity:1;transform:translateX(0);} }
@keyframes toastOut { to{opacity:0;transform:translateX(40px);} }

/* ---------- Loading Overlay ---------- */
.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 22px;
  background: rgba(15,23,42,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.loader-overlay.show { display: flex; }
.spinner {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 5px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { color: #fff; font-weight: 700; font-size: 1.05rem; text-align: center; max-width: 320px; }
.loader-sub { color: rgba(255,255,255,0.8); font-size: 0.9rem; text-align: center; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  padding: 36px 0;
  margin-top: 30px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}
.footer .logo { font-size: 1.1rem; }
.footer p { color: var(--text-500); font-size: 0.88rem; max-width: 380px; margin-top: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.footer-links a {
  color: var(--text-700);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color .18s;
}
.footer-links a:hover { color: var(--brand-1); }

/* =========================================================
   Ad Slots — Adsterra-ready
   Each slot has a small visible label so you can identify
   which size goes where before pasting real <script> tags.
   ========================================================= */

/* Inline placeholder as authored in the HTML. Same look as a live .ad-slot but
   shown BEFORE the ad library has filled it, so the layout never collapses and
   the slot is always a clean, labelled box (never an awkward empty gap). */
.ad-placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, var(--bg-subtle), var(--bg-subtle) 14px, rgba(99,102,241,0.06) 14px, rgba(99,102,241,0.06) 28px);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-400);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 22px auto;
  min-height: 90px;
  overflow: hidden;
  text-align: center;
  width: 100%;
  max-width: 100%;
  transition: opacity .25s ease;
}
.ad-placeholder[data-ad="300x250"] { max-width: 300px; min-height: 250px; }
.ad-placeholder[data-ad="728x90"]  { max-width: 728px;  min-height: 90px; }
.ad-placeholder[data-ad="468x60"]  { max-width: 468px;  min-height: 60px; }
.ad-placeholder[data-ad="320x50"]  { max-width: 320px;  min-height: 50px; }
.ad-placeholder[data-ad="160x600"] { max-width: 160px;  min-height: 600px; }
.ad-placeholder[data-ad="160x300"] { max-width: 160px;  min-height: 300px; }
/* In-flow leaderboard / midfeed / rectangle convenience aliases used by pages */
.ad-placeholder.ad-leaderboard { max-width: 728px; min-height: 90px; }
.ad-placeholder.ad-rectangle  { max-width: 300px; min-height: 250px; }
.ad-placeholder.ad-midfeed     { max-width: 728px; min-height: 90px; }
/* Once the real ad is injected the element gains .ad-slot and the banner fills
   the box; hide the placeholder text label cleanly. */
.ad-placeholder:empty { opacity: 0; min-height: 0; height: 0; margin: 0; }

.ad-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, var(--bg-subtle), var(--bg-subtle) 14px, rgba(99,102,241,0.06) 14px, rgba(99,102,241,0.06) 28px);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-400);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 22px 0;
  min-height: 90px;
  overflow: hidden;
  text-align: center;
  width: 100%;
  max-width: 100%;
}
.ad-slot::before {
  content: attr(data-label);
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--text-400);
  background: var(--bg-glass-strong);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  z-index: 1;
}
.ad-slot iframe { border: 0; max-width: 100%; }
/* Real ad container — empty until script loads */
.ad-provider { width: 100%; height: 100%; min-height: inherit; display: flex; align-items: center; justify-content: center; }

/* Sizes — max-width prevents any overflow */
.ad-728x90          { width: 100%; max-width: 728px; min-height: 90px; margin-left: auto; margin-right: auto; }
.ad-468x60          { width: 100%; max-width: 468px; min-height: 60px; margin-left: auto; margin-right: auto; }
.ad-300x250         { width: 100%; max-width: 300px; min-height: 250px; margin-left: auto; margin-right: auto; }
.ad-320x50          { width: 100%; max-width: 320px; min-height: 50px;  margin-left: auto; margin-right: auto; }
.ad-160x600         { width: 160px; min-height: 600px; }
.ad-160x300         { width: 160px; min-height: 300px; }

/* Sidebar banners — fixed outside content flow, never overlap. */
.ad-sidebar-left, .ad-sidebar-right {
  position: fixed;
  top: 92px;
  display: none;
  z-index: 40;
  margin: 0;
}
.ad-sidebar-left  { left:  calc((100vw - 1180px) / 2 - 184px); }
.ad-sidebar-right { right: calc((100vw - 1180px) / 2 - 184px); }
/* Only show sidebars when viewport is wide enough for content + 2 sidebars + gaps */
@media (min-width: 1281px) {
  .ad-sidebar-left, .ad-sidebar-right { display: flex; }
}

/* Desktop floating anchor (320×50 sticky bottom-left) */
.ad-anchor-floating {
  position: fixed;
  bottom: 10px;
  left: 10px;
  width: 320px;
  height: 50px;
  z-index: 9990;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-anchor-floating .ad-inner {
  width: 320px; height: 50px;
  display: flex; align-items: center; justify-content: center;
}
@media (min-width: 1240px) {
  .ad-anchor-floating { display: flex; }
}

/* Mobile sticky anchor (320×50 footer ad with close button) */
.mobile-anchor-ad {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 56px;
  z-index: 9990;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15,23,42,0.08);
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-right: 28px;
}
.mobile-anchor-ad .close-btn {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  line-height: 1;
  font-size: 18px;
  color: var(--text-400);
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
.mobile-anchor-ad .close-btn:hover { color: var(--error); }
.mobile-anchor-ad .ad-inner {
  width: 320px; height: 50px;
  display: flex; align-items: center; justify-content: center;
}

/* Popunder marker — invisible, only used by Adsterra */
.ad-popunder { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Native banner slot — full-width, contained by the container */
.ad-native-banner {
  min-height: 120px;
  border-radius: var(--r-lg);
  padding: 6px;
  border: 1px dashed var(--border-strong);
  background: repeating-linear-gradient(45deg, var(--bg-subtle), var(--bg-subtle) 14px, rgba(99,102,241,0.06) 14px, rgba(99,102,241,0.06) 28px);
  position: relative;
  margin: 22px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Social bar slot — fixed bottom-right above floating anchor */
.ad-social-bar {
  position: fixed;
  bottom: 70px;
  right: 12px;
  width: 320px;
  height: 60px;
  z-index: 9991;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
@media (min-width: 1281px) {
  .ad-social-bar { display: flex; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .ad-sidebar-left, .ad-sidebar-right { display: none !important; }
}
@media (max-width: 1240px) {
  .ad-anchor-floating { display: none !important; }
}

/* Tablets */
@media (max-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .ad-social-bar { display: none !important; }
}

/* Mobile */
@media (max-width: 768px) {
  body { padding-bottom: 70px; }
  .mobile-anchor-ad { display: flex; }
  .nav-actions .privacy-badge { display: none; }
  .nav-actions .btn-nav .label-text { display: none; }
  .nav-actions .btn-nav { padding: 10px; }
  .toast { width: calc(100vw - 32px); }
  .toast-wrap { right: 0; left: 0; bottom: 70px; align-items: center; }
  .hero { padding: 36px 0 22px; }
  .hero p { font-size: 1rem; }
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .tool-card { padding: 16px 14px; }
  .tool-card p { font-size: 0.82rem; }
  .tool-icon { width: 44px; height: 44px; }
  .tool-icon svg { width: 22px; height: 22px; }
  .panel { padding: 18px; }
  .page-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .page-tile img { height: 130px; }
  .tool-header { padding: 36px 0 18px; }
  .btn { padding: 11px 18px; font-size: 0.92rem; }
}

@media (max-width: 380px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* ---------- Animations utilities ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  { 0% { opacity: 0; transform: scale(.96) translateY(8px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.animate-in { animation: fadeIn .5s ease-out both; }
.stagger > * { opacity: 0; animation: popIn .5s ease-out forwards; }
.stagger > *:nth-child(1)  { animation-delay: .04s; }
.stagger > *:nth-child(2)  { animation-delay: .08s; }
.stagger > *:nth-child(3)  { animation-delay: .12s; }
.stagger > *:nth-child(4)  { animation-delay: .16s; }
.stagger > *:nth-child(5)  { animation-delay: .20s; }
.stagger > *:nth-child(6)  { animation-delay: .24s; }
.stagger > *:nth-child(7)  { animation-delay: .28s; }
.stagger > *:nth-child(8)  { animation-delay: .32s; }
.stagger > *:nth-child(9)  { animation-delay: .36s; }
.stagger > *:nth-child(10) { animation-delay: .40s; }
.stagger > *:nth-child(11) { animation-delay: .44s; }
.stagger > *:nth-child(12) { animation-delay: .48s; }
.stagger > *:nth-child(13) { animation-delay: .52s; }
.stagger > *:nth-child(14) { animation-delay: .56s; }
.stagger > *:nth-child(15) { animation-delay: .60s; }
.stagger > *:nth-child(16) { animation-delay: .64s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .orb { display: none; }
}

/* ---------- SEO content area ---------- */
.seo-content {
  max-width: 760px;
  margin: 50px auto 0;
  color: var(--text-700);
  line-height: 1.75;
}
.seo-content h2 {
  color: var(--text-900);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 28px 0 12px;
}
.seo-content p { margin-bottom: 14px; }
.seo-content strong { color: var(--text-900); }

/* FAQ */
.faq-section { max-width: 760px; margin: 40px auto 0; }
.faq-section h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  background: var(--bg-card);
  overflow: hidden;
}
.faq-q {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-900);
}
.faq-q .chev { transition: transform .25s; color: var(--brand-1); flex: none; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; color: var(--text-500); }
.faq-a-inner { padding: 0 20px 16px; }
.faq-item.open .faq-a { max-height: 500px; }

/* Theme toggle button on navbar */
.theme-toggle svg .sun { display: block; }
.theme-toggle svg .moon { display: none; }
[data-theme="dark"] .theme-toggle svg .sun { display: none; }
[data-theme="dark"] .theme-toggle svg .moon { display: block; }
