:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --header-bg: rgba(255, 255, 255, 0.94);
  --hero-bg: linear-gradient(135deg, #eef2ff 0%, #f8fafc 55%, #ecfdf5 100%);
  --pill-bg: #ffffff;
  --pill-border: #c7d2fe;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --ink: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #059669;
  --success-hover: #047857;
  --success-bg: #f0fdf4;
  --success-border: #a7f3d0;
  --success-ink: #065f46;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --checker-a: #ffffff;
  --checker-b: #e2e8f0;
  --badge-img-bg: #e0e7ff;
  --badge-img-ink: #3730a3;
  --badge-vid-bg: #d1fae5;
  --badge-vid-ink: #065f46;
  --badge-util-bg: #fef3c7;
  --badge-util-ink: #92400e;
  --footer-bg: #0f172a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --header-bg: rgba(17, 24, 39, 0.92);
  --hero-bg: linear-gradient(135deg, #1e1b4b 0%, #0b1120 55%, #064e3b 100%);
  --pill-bg: #1e293b;
  --pill-border: #4338ca;
  --input-bg: #0f172a;
  --input-border: #334155;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --border: #1e293b;
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-soft: rgba(99, 102, 241, 0.16);
  --success: #10b981;
  --success-hover: #059669;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);
  --success-ink: #6ee7b7;
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(248, 113, 113, 0.4);
  --checker-a: #1e293b;
  --checker-b: #0f172a;
  --badge-img-bg: rgba(129, 140, 248, 0.18);
  --badge-img-ink: #c7d2fe;
  --badge-vid-bg: rgba(16, 185, 129, 0.18);
  --badge-vid-ink: #6ee7b7;
  --badge-util-bg: rgba(245, 158, 11, 0.18);
  --badge-util-ink: #fcd34d;
  --footer-bg: #060a14;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
}

[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #05050a;
  --surface: #0c0d18;
  --surface-alt: #15172b;
  --header-bg: rgba(12, 13, 24, 0.92);
  --hero-bg: linear-gradient(135deg, #2e1065 0%, #05050a 55%, #0f172a 100%);
  --pill-bg: #15172b;
  --pill-border: #6d28d9;
  --input-bg: #090a14;
  --input-border: #272945;
  --ink: #f8fafc;
  --muted: #a1a1aa;
  --border: #1e1f36;
  --primary: #a78bfa;
  --primary-hover: #8b5cf6;
  --primary-soft: rgba(167, 139, 250, 0.16);
  --success: #14b8a6;
  --success-hover: #0d9488;
  --success-bg: rgba(20, 184, 166, 0.12);
  --success-border: rgba(20, 184, 166, 0.35);
  --success-ink: #5eead4;
  --danger: #fb7185;
  --danger-bg: rgba(244, 63, 94, 0.14);
  --danger-border: rgba(251, 113, 133, 0.4);
  --checker-a: #15172b;
  --checker-b: #090a14;
  --badge-img-bg: rgba(167, 139, 250, 0.18);
  --badge-img-ink: #ddd6fe;
  --badge-vid-bg: rgba(20, 184, 166, 0.18);
  --badge-vid-ink: #5eead4;
  --badge-util-bg: rgba(251, 191, 36, 0.18);
  --badge-util-ink: #fde68a;
  --footer-bg: #030307;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.58);
}

[data-theme="sepia"] {
  color-scheme: light;
  --bg: #f6f1e7;
  --surface: #fdfaf3;
  --surface-alt: #ede4d3;
  --header-bg: rgba(253, 250, 243, 0.94);
  --hero-bg: linear-gradient(135deg, #fef3c7 0%, #f6f1e7 55%, #ecfccb 100%);
  --pill-bg: #fdfaf3;
  --pill-border: #d97706;
  --input-bg: #fdfaf3;
  --input-border: #d6cbb5;
  --ink: #292118;
  --muted: #6b5d4d;
  --border: #e2d8c3;
  --primary: #b45309;
  --primary-hover: #92400e;
  --primary-soft: #fef3c7;
  --success: #15803d;
  --success-hover: #166534;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --success-ink: #166534;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --checker-a: #fdfaf3;
  --checker-b: #e2d8c3;
  --badge-img-bg: #fef3c7;
  --badge-img-ink: #92400e;
  --badge-vid-bg: #dcfce7;
  --badge-vid-ink: #166534;
  --badge-util-bg: #e0f2fe;
  --badge-util-ink: #075985;
  --footer-bg: #292118;
  --shadow: 0 10px 28px rgba(41, 33, 24, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-dropdown {
  position: relative;
}

.nav-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.91rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-drop-btn:hover,
.nav-dropdown.open .nav-drop-btn {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-chevron {
  transition: transform 0.18s ease;
}

.nav-dropdown.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 238px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  z-index: 90;
  flex-direction: column;
  gap: 2px;
}

.nav-drop-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.nav-dropdown.open .nav-drop-menu {
  display: flex;
}

@media (min-width: 901px) {
  .nav-dropdown:last-of-type .nav-drop-menu {
    inset-inline-start: auto;
    inset-inline-end: 0;
  }
}

@media (hover: hover) and (min-width: 901px) {
  .nav-dropdown:hover .nav-drop-menu {
    display: flex;
  }

  .nav-dropdown:hover .nav-drop-btn {
    background: var(--primary-soft);
    color: var(--primary);
  }

  .nav-dropdown:hover .nav-chevron {
    transform: rotate(180deg);
  }

  .site-header:has(.nav-controls:focus-within) .nav-dropdown:not(.open):hover .nav-drop-menu {
    display: none;
  }

  .site-header:has(.nav-controls:focus-within) .nav-dropdown:not(.open):hover .nav-drop-btn {
    background: transparent;
    color: var(--ink);
  }

  .site-header:has(.nav-controls:focus-within) .nav-dropdown:not(.open):hover .nav-chevron {
    transform: none;
  }
}

.nav-drop-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.89rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-drop-menu a svg {
  color: var(--primary);
  flex-shrink: 0;
}

.nav-drop-menu a:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.nav-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: 6px;
}

.control-select {
  appearance: auto;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.control-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
}

/* Hero */
.hero {
  background: var(--hero-bg);
  border-bottom: 1px solid var(--border);
  padding: 56px 0 48px;
  text-align: center;
}

.hero-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 auto 14px;
  max-width: 780px;
  font-size: clamp(1.9rem, 3.6vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hero-sub {
  margin: 0 auto 28px;
  max-width: 700px;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons & Cards */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-lg {
  padding: 13px 26px;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: var(--success-hover);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.section-block {
  padding: 36px 20px;
}

.section-head {
  text-align: center;
  margin-bottom: 28px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 1.65rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-image {
  background: var(--badge-img-bg);
  color: var(--badge-img-ink);
}

.badge-video {
  background: var(--badge-vid-bg);
  color: var(--badge-vid-ink);
}

.badge-utility {
  background: var(--badge-util-bg);
  color: var(--badge-util-ink);
}

.cat-filter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -6px 0 26px;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.76rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.tool-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.tool-icon-image {
  background: var(--badge-img-bg);
  color: var(--badge-img-ink);
}

.tool-icon-video {
  background: var(--badge-vid-bg);
  color: var(--badge-vid-ink);
}

.tool-icon-utility {
  background: var(--badge-util-bg);
  color: var(--badge-util-ink);
}

.tool-card h3 {
  margin: 4px 0 0;
  font-size: 1.1rem;
  line-height: 1.35;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  flex: 1;
}

.card-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.trust-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.trust-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.trust-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Tool Page */
.tool-page {
  padding-top: 32px;
  padding-bottom: 48px;
}

.tool-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 24px;
}

.tool-header h1 {
  margin: 10px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.25;
}

.tool-subtitle {
  margin: 0;
  color: var(--muted);
}

.tool-workspace {
  max-width: 840px;
  margin: 0 auto 28px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.drag-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--success-ink);
}

.dz-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.dz-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.dz-hint {
  font-size: 0.88rem;
  color: var(--muted);
}

.preview-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  text-align: center;
}

.preview-box img,
.preview-box video,
.result-preview img,
.result-preview video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.preview-box img.eyedropper-active {
  cursor: crosshair;
  outline: 2px dashed var(--primary);
  outline-offset: 2px;
}

.checkerboard-bg {
  display: inline-block;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--checker-a);
  background-image:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-b) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.options-subpanel {
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.multi-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.multi-thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.multi-thumb-item img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
}

.multi-thumb-item span {
  width: 100%;
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-preview-frame {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.live-preview-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  color: var(--muted);
}

.live-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.live-resize-canvas {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.qr-cam-row {
  display: flex;
  justify-content: center;
}

#qrCamVideo {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
}

.qr-decoded-box {
  margin: 0 auto 12px;
  padding: 14px 16px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
}

.qr-wifi-parsed {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--ink);
}

.qr-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 20px;
  align-items: start;
}

.qr-studio-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.qr-subcard {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qr-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.qr-palettes {
  display: flex;
  align-items: center;
  gap: 7px;
}

.qr-palette-chip {
  width: 24px;
  height: 24px;
  padding: 3px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.qr-palette-chip span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: block;
}

.qr-palette-chip:hover,
.qr-palette-chip.active {
  border-color: var(--primary);
  transform: scale(1.08);
}

.field .color-pill-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 6px 9px;
  border: 1px solid var(--input-border);
  border-radius: 9px;
  background: var(--input-bg);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--ink);
}

.field .color-pill-box span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field .color-pill-box input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.field .color-pill-box input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.field .color-pill-box input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 6px;
}

.qr-seg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.qr-seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.qr-seg-btn:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.qr-seg-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.14);
}

.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qr-logo-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-file-drop {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px dashed var(--input-border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.qr-file-drop:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.qr-file-drop span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-logo-thumb {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #ffffff;
  object-fit: contain;
  padding: 3px;
  flex-shrink: 0;
}

.qr-logo-clear-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.qr-logo-clear-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.qr-studio-preview {
  position: sticky;
  top: 86px;
}

.qr-preview-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qr-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.qr-stage {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
}

#qrLiveImg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

.qr-dl-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.qr-scan-tip {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .qr-studio {
    grid-template-columns: 1fr;
  }

  .qr-studio-preview {
    position: static;
  }
}

.options-panel {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mode-tabs {
  display: inline-flex;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  align-self: flex-start;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.field input[type="number"],
.field input[type="text"],
.field input[type="email"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--ink);
}

.field input[type="color"] {
  width: 64px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 8px;
  cursor: pointer;
}

.field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.field input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.28);
  border: 1px solid var(--input-border);
}

.field input[type="range"]::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.28);
  border: 1px solid var(--input-border);
}

.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  cursor: pointer;
}

.field input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  cursor: pointer;
}

.checkbox-field {
  justify-content: center;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.preset-btn span {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
}

.preset-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.submit-row {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.progress-wrap {
  margin-top: 18px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.15s ease;
}

.progress-text {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
}

.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 500;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-ink);
  border: 1px solid var(--success-border);
}

.result-box {
  margin-top: 24px;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--success-border);
  background: var(--success-bg);
}

.result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.result-badge {
  font-weight: 700;
  color: var(--success-ink);
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--ink);
}

.result-preview {
  text-align: center;
  margin-bottom: 16px;
}

.result-preview audio {
  width: 100%;
  max-width: 460px;
}

.result-actions {
  text-align: center;
}

/* AdSense Safe Container: collapsed cleanly when unfilled/pending, revealed when filled or previewed */
.ad-container {
  margin: 0 auto;
  padding: 0;
  max-width: 840px;
  min-height: 0;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 10px;
}

.ad-label {
  display: none;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.ad-container.ad-filled,
.ad-container:has(ins[data-ad-status="filled"]),
.ad-container.ad-preview {
  margin: 24px auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
}

.ad-container.ad-preview {
  min-height: 106px;
  border-style: dashed;
}

.ad-container.ad-filled .ad-label,
.ad-container:has(ins[data-ad-status="filled"]) .ad-label,
.ad-container.ad-preview .ad-label {
  display: block;
}

.ad-preview-note {
  font-size: 0.84rem;
  color: var(--muted);
}

.ad-preview-note code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--primary);
  font-size: 0.8rem;
}

/* Desktop Wide Side Rails (Left & Right Sticky Ads >= 1320px) */
.rail-center {
  width: 100%;
  min-width: 0;
}

.side-rail {
  display: none;
}

@media (min-width: 1320px) {
  .page-rails {
    display: grid;
    grid-template-columns: 180px minmax(0, 960px) 180px;
    justify-content: center;
    align-items: stretch;
    gap: 24px;
    max-width: 1408px;
    margin: 0 auto;
    padding: 0 20px;
  }

  .side-rail {
    display: block;
    width: 180px;
    align-self: stretch;
  }

  .side-rail-sticky {
    position: sticky;
    top: 88px;
  }

  .ad-side-unit {
    margin: 0;
    width: 180px;
    max-width: 180px;
    min-height: 0;
    justify-content: flex-start;
  }

  .ad-side-unit.ad-filled,
  .ad-side-unit:has(ins[data-ad-status="filled"]),
  .ad-side-unit.ad-preview {
    margin: 24px 0;
  }

  .ad-side-unit.ad-preview {
    min-height: 500px;
  }

  .page-rails .rail-center > .container {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (min-width: 1540px) {
  .page-rails {
    grid-template-columns: 260px minmax(0, 1020px) 260px;
    max-width: 1628px;
  }

  .side-rail,
  .ad-side-unit {
    width: 260px;
    max-width: 260px;
  }

  .ad-side-unit.ad-preview {
    min-height: 520px;
  }
}

/* Polite AdBlock Detection Notice (neutral class names to avoid cosmetic hiding) */
.ak-notice-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 28px));
  z-index: 120;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.28);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ak-notice-copy {
  flex: 1 1 280px;
}

.ak-notice-copy strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 3px;
  color: var(--ink);
}

.ak-notice-copy p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

.ak-notice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Guide & FAQ */
.seo-content {
  max-width: 920px;
  margin: 28px auto 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.guide-card h2,
.faq-card h2,
.related-section h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.step-list,
.benefit-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.step-list li,
.benefit-list li {
  margin-bottom: 10px;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.faq-item:last-child {
  padding-bottom: 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
}

.feedback-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feedback-head h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.feedback-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.feedback-actions .alert {
  margin: 0;
  padding: 8px 14px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
}

.related-card:hover {
  text-decoration: none;
  border-color: var(--primary);
}

.related-card span {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Legal / Prose pages */
.legal-page {
  padding: 36px 20px 56px;
}

.prose-card {
  max-width: 820px;
  margin: 0 auto;
}

.prose-card h1 {
  margin-top: 0;
  font-size: 1.9rem;
}

.prose-card h2 {
  margin-top: 26px;
  font-size: 1.25rem;
}

.prose-card p,
.prose-card li {
  color: var(--muted);
}

.contact-email-box {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--primary-soft);
  margin: 16px 0 22px;
  font-weight: 600;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.not-found {
  text-align: center;
  padding: 48px 24px;
}

/* Footer */
.site-footer {
  background: var(--footer-bg);
  color: #cbd5e1;
  padding: 48px 0 24px;
  margin-top: 40px;
}

.site-footer .brand {
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 28px;
}

.footer-brand p {
  font-size: 0.9rem;
  color: #94a3b8;
}

.site-footer h4 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 0.95rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 8px;
}

.site-footer a {
  color: #cbd5e1;
  font-size: 0.9rem;
}

.site-footer a:hover {
  color: #fff;
}

.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.84rem;
  color: #94a3b8;
}

/* Responsive */
@media (max-width: 900px) {

  .tool-grid,
  .trust-grid,
  .guide-grid,
  .related-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-row,
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    flex-direction: column;
    align-items: stretch;
    padding: 14px 20px 18px;
    gap: 8px;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-drop-btn {
    width: 100%;
    justify-content: space-between;
    padding: 9px 12px;
    background: var(--surface-alt);
  }

  .nav-drop-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 6px 4px 4px 10px;
    background: transparent;
  }

  .nav-controls {
    margin-inline-start: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
}

/* Text Counter & Base Converter Utilities */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.stat-val {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-lbl {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
}

.tc-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
}

.field textarea.mono-textarea,
.mono-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.94rem;
  line-height: 1.55;
  resize: vertical;
}

.field textarea.mono-textarea:focus,
.mono-textarea:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.text-actions,
.preset-row,
.bc-out-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.bc-out-actions {
  margin-top: 0;
}

.bc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.bc-toolbar .preset-row {
  margin-top: 0;
}

.base-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.base-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.base-row label {
  font-size: 0.88rem;
  font-weight: 600;
}

.base-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.base-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.base-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.98rem;
  font-weight: 600;
}

.base-input:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.copy-mini-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .stat-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 14px;
  }

  .brand {
    font-size: 1.02rem;
    gap: 8px;
  }

  .control-select {
    max-width: 132px;
    font-size: 0.78rem;
    padding: 5px 8px;
  }

  .hero {
    padding: 36px 0 32px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .card {
    padding: 18px 16px;
    border-radius: 14px;
  }

  .tool-page {
    padding-top: 20px;
    padding-bottom: 34px;
  }

  .dropzone {
    padding: 26px 14px;
  }

  .mode-tabs {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
  }

  .tab-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .ad-container.ad-filled,
  .ad-container:has(ins[data-ad-status="filled"]),
  .ad-container.ad-preview {
    margin: 16px auto;
    padding: 10px;
  }

  .ad-container.ad-preview {
    min-height: 68px;
  }

  .stat-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .base-tag {
    min-width: 68px;
    font-size: 0.74rem;
  }
}

/* Story-style Visual Cropper & Video Trimmer */
.story-editor {
  margin-top: 14px;
  background: #0b0f19;
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 14px;
  color: #f8fafc;
}

.story-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.story-ratio-row,
.story-quick-btns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-aspect {
  border: 1px solid #334155;
  background: #151c2e;
  color: #cbd5e1;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-aspect:hover {
  border-color: var(--primary);
  color: #fff;
}

.chip-aspect.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.story-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05070e;
  border-radius: 10px;
  min-height: 240px;
  overflow: hidden;
  padding: 10px;
}

#cropCanvas {
  display: block;
  max-width: 100%;
  touch-action: none;
  user-select: none;
  border-radius: 4px;
}

.story-hint {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.story-editor .story-hint {
  color: #94a3b8;
}

.story-trim-wrap {
  margin: 14px 0 6px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.trim-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trim-time-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 8px;
}

.trim-timeline-bar {
  position: relative;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #334155;
  user-select: none;
  touch-action: none;
  direction: ltr;
  cursor: pointer;
}

.trim-thumbs-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trim-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.72);
  pointer-events: none;
  z-index: 2;
}

.trim-mask-left {
  left: 0;
}

.trim-mask-right {
  right: 0;
}

.trim-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  border-top: 3px solid #22c55e;
  border-bottom: 3px solid #22c55e;
  box-sizing: border-box;
  z-index: 3;
  cursor: grab;
}

.trim-selection:active {
  cursor: grabbing;
}

.trim-handle {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 16px;
  background: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 5;
}

.trim-handle span {
  width: 3px;
  height: 22px;
  border-radius: 99px;
  background: #ffffff;
}

.trim-handle-start {
  left: -2px;
  border-radius: 6px 0 0 6px;
}

.trim-handle-end {
  right: -2px;
  border-radius: 0 6px 6px 0;
}

.trim-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.85);
  z-index: 6;
  pointer-events: none;
}

.trim-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.trim-actions-row .story-hint {
  margin-top: 0;
  text-align: start;
}

/* RTL Support (Arabic) */
[dir="rtl"] .step-list,
[dir="rtl"] .benefit-list {
  padding-left: 0;
  padding-right: 20px;
}

[dir="rtl"] .preset-btn {
  align-items: flex-end;
}

[dir="rtl"] .mode-tabs {
  align-self: flex-end;
}

/* Watermark, Password, JSON & Color Tools */
.wm-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

#wmPreviewCanvas {
  max-width: 100%;
  max-height: 440px;
  border-radius: 6px;
}

.pw-hero-box {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pw-output-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pw-main-input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.pw-meter-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pw-meter-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.pw-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.2s ease, background 0.2s ease;
}

.pw-checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
}

.pw-chk-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.pw-chk-card input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.pw-batch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pw-batch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.pw-batch-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
}

.json-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.json-opts-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.json-opts-right select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 0.86rem;
}

.cp-pick-row {
  display: grid;
  grid-template-columns: minmax(118px, 140px) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.cp-actions {
  display: flex;
}

.cp-formats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cp-fmt-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.cp-fmt-row span {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--muted);
}

.cp-fmt-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cp-preview-stage {
  padding: 22px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: background 0.15s ease, color 0.15s ease;
}

.cp-preview-stage h3 {
  margin: 0 0 8px;
  font-size: 1.24rem;
}

.cp-preview-stage p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
}

.cp-wcag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cp-wcag-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
}

.cp-wcag-tile span {
  color: var(--muted);
}

.cp-wcag-tile strong.wcag-pass {
  color: var(--success-ink);
}

.cp-wcag-tile strong.wcag-fail {
  color: var(--danger);
}

/* Merge PDF, Unit Converter, Percentage & Age Calculators */
.pdf-merge-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdf-merge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdf-merge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.pdf-merge-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.pdf-merge-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-merge-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.uc-tabs {
  flex-wrap: wrap;
}

.uc-io-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.uc-swap-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
}

.uc-all-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.uc-all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}

.uc-ref-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.uc-ref-card span {
  font-size: 0.78rem;
  color: var(--muted);
}

.uc-ref-card strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.96rem;
  color: var(--ink);
  word-break: break-word;
}

.pc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pc-grid h3 {
  margin: 0;
  font-size: 0.96rem;
  color: var(--ink);
}

.pc-result-pill {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .uc-io-grid,
  .pc-grid {
    grid-template-columns: 1fr;
  }

  .uc-swap-col {
    padding-bottom: 0;
  }
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}

.about-stat-card {
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-stat-card strong {
  font-size: 1.4rem;
  line-height: 1.15;
  color: var(--primary);
}

.about-stat-card span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.about-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

@media (max-width: 680px) {
  .about-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.btn.is-copied {
  background: var(--success, #16a34a) !important;
  border-color: var(--success, #16a34a) !important;
  color: #ffffff !important;
}

.ak-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 9999;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  background: #15803d;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.ak-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ak-toast.is-error {
  background: #b91c1c;
}

.pdf-preview-shell {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.pdf-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.pdf-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
}

.pdf-page-badge {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.pdf-canvas-list {
  max-height: 460px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.25);
}

.pdf-page-wrap {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pdf-page-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.pdf-page-num {
  font-size: 0.74rem;
  color: var(--muted);
}

.pdf-preview-note {
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.fx-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.fx-hero-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fx-hero-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fx-hero-main span {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--primary);
  word-break: break-word;
}

.fx-rate-unit {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.fx-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.fx-popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.fx-curr-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.fx-curr-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.fx-curr-card span {
  font-size: 0.78rem;
  color: var(--muted);
}

.fx-curr-card strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.98rem;
  color: var(--ink);
  word-break: break-word;
}

.fx-curr-card.is-target {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.docx-preview-card {
  margin-top: 14px;
}

.docx-stage {
  margin-top: 8px;
  max-height: 460px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #e2e8f0;
  padding: 12px;
}

.docx-stage .docx-wrapper {
  background: transparent !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.docx-stage .docx-wrapper > section.docx {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16) !important;
  margin: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

@media print {
  body.ak-printing-docx > *:not(.ak-print-root) {
    display: none !important;
  }
  body.ak-printing-docx .ak-print-root {
    display: block !important;
    width: 100%;
  }
  body.ak-printing-docx .ak-print-root .docx-wrapper {
    background: #ffffff !important;
    padding: 0 !important;
  }
  body.ak-printing-docx .ak-print-root section.docx {
    box-shadow: none !important;
    margin: 0 auto !important;
    page-break-after: always;
  }
}

.code-editor-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.code-editor-wrap:focus-within {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.line-gutter {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 12px 8px 28px 10px;
  background: rgba(128, 138, 160, 0.08);
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.94rem;
  line-height: 1.55;
  text-align: right;
  user-select: none;
  overflow: hidden;
}

.line-gutter .line-num {
  padding: 0 2px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.line-gutter .line-num.is-err {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  font-weight: 700;
}

.field .code-editor-wrap textarea.mono-textarea {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.field .code-editor-wrap textarea.mono-textarea:focus {
  outline: none;
  border-color: transparent;
}

.field-hint {
  margin-top: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.json-upload-btn {
  cursor: pointer;
}

.code-editor-wrap.is-readonly {
  background: rgba(128, 138, 160, 0.07);
  border-style: dashed;
}

.code-editor-wrap.is-readonly textarea.mono-textarea {
  cursor: default;
}

.code-editor-wrap.is-dragover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

/* Breadcrumbs & Internal Linking Recommendations */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legal-page .breadcrumb {
  justify-content: flex-start;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb .bc-sep {
  opacity: 0.65;
}

.breadcrumb .bc-current {
  color: var(--ink);
  font-weight: 600;
}

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

.quick-rec-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.quick-rec-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.quick-rec-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  text-decoration: none;
}

.rec-section {
  padding: 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.rec-subtitle {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--muted);
}

.rec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.related-card.is-recommended {
  background: var(--bg);
  border-color: var(--border);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.related-card.is-recommended:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.rec-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.related-card.is-recommended .rec-cta {
  margin-top: auto;
  padding-top: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--primary);
}

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

/* Hash Generator */
.hash-opts-row {
  align-items: flex-end;
  margin-top: 12px;
}

.hash-toggles {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.hash-file-badge {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 0.9rem;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.hash-results-grid {
  margin-top: 16px;
}

.hash-tag {
  min-width: 112px;
}

.hash-algo-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.hash-out-input {
  font-size: 0.88rem;
}

.hash-out-input.is-match {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.hash-verify-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.meta-pill.is-match {
  background: rgba(22, 163, 74, 0.16);
  color: #22c55e;
}

.meta-pill.is-mismatch {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}