/* Quick Case Convert — premium dark UI */
:root {
  --bg-deep: #060708;
  --bg: #0a0c10;
  --surface: #11141c;
  --surface-elevated: #161a24;
  --surface-2: #1c2130;
  --surface-glow: rgba(124, 58, 237, 0.06);
  --border: rgba(148, 163, 184, 0.1);
  --border-strong: rgba(167, 139, 250, 0.18);
  --text: #f8fafc;
  --text-secondary: #e2e8f0;
  --muted: #8b95a8;
  --accent: #c4b5fd;
  --accent-bright: #ddd6fe;
  --accent-dim: #7c3aed;
  --accent-deep: #5b21b6;
  --teal: #5eead4;
  --teal-dim: #14b8a6;
  --accent-soft: rgba(167, 139, 250, 0.14);
  --accent-soft-2: rgba(167, 139, 250, 0.22);
  --teal-soft: rgba(94, 234, 212, 0.12);
  --success: #4ade80;
  --warning: #fcd34d;
  --danger: #fb7185;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Consolas", ui-monospace, monospace;
  --shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 80px -20px rgba(124, 58, 237, 0.45);
  --max: 1180px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* Tool workspace: one padding + gap system for panels and image drop zones */
  --tool-workspace-pad-inline: 1.5rem;
  --tool-workspace-pad-block-start: 1.5rem;
  --tool-workspace-pad-block-end: 1.55rem;
  --tool-workspace-padding: var(--tool-workspace-pad-block-start) var(--tool-workspace-pad-inline)
    var(--tool-workspace-pad-block-end);
  --tool-stack-gap: 2rem;
}

/* Light theme — toggled via html[data-theme="light"] + theme.js */
html[data-theme="light"] {
  --bg-deep: #eceff3;
  --bg: #e4e9f0;
  --surface: #ffffff;
  --surface-elevated: #f7f8fa;
  --surface-2: #e9edf3;
  --surface-glow: rgba(91, 33, 182, 0.04);
  --border: rgba(30, 41, 59, 0.09);
  --border-strong: rgba(91, 33, 182, 0.11);
  --text: #1a2332;
  --text-secondary: #334155;
  --muted: #5c6b82;
  --accent: #553c9a;
  --accent-bright: #6b46c1;
  --accent-dim: #6d28d9;
  --accent-deep: #4c1d95;
  --teal: #0f766e;
  --teal-dim: #115e59;
  --accent-soft: rgba(107, 70, 193, 0.09);
  --accent-soft-2: rgba(107, 70, 193, 0.14);
  --teal-soft: rgba(15, 118, 110, 0.09);
  --success: #166534;
  --warning: #9a3412;
  --danger: #9f1239;
  --shadow: 0 10px 36px rgba(30, 41, 59, 0.07);
  --shadow-soft: 0 3px 14px rgba(30, 41, 59, 0.05);
  --shadow-glow: 0 0 48px -12px rgba(107, 70, 193, 0.14);
}

html[data-theme="light"] body {
  background-color: var(--bg-deep);
  background-image: linear-gradient(180deg, #f8fafc 0%, var(--bg-deep) 42%, #e8ecf2 100%),
    radial-gradient(ellipse 120% 70% at 50% -20%, rgba(107, 70, 193, 0.035), transparent 55%);
  background-attachment: fixed;
}

html[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1px 0 rgba(30, 41, 59, 0.06), 0 8px 28px -18px rgba(30, 41, 59, 0.08);
}

html[data-theme="light"] .site-footer--mega {
  background: linear-gradient(180deg, transparent 0%, rgba(248, 250, 252, 0.98) 8%, var(--surface) 100%);
}

html[data-theme="light"] .ad-slot {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .output-preview,
html[data-theme="light"] textarea.input-area,
html[data-theme="light"] input[type="text"].input-area,
html[data-theme="light"] input[type="number"].input-area,
html[data-theme="light"] input[type="url"].input-area {
  background: var(--surface-elevated);
}

html[data-theme="light"] input[type="file"].input-area {
  background: var(--surface-elevated);
}

html[data-theme="light"] select.select-input {
  background-color: var(--surface-elevated);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
  background-color: var(--bg-deep);
  background-image: radial-gradient(ellipse 90% 70% at 0% -25%, rgba(124, 58, 237, 0.28), transparent 52%),
    radial-gradient(ellipse 70% 50% at 100% -10%, rgba(20, 184, 166, 0.14), transparent 48%),
    radial-gradient(ellipse 55% 45% at 50% 110%, rgba(91, 33, 182, 0.12), transparent 55%);
  background-attachment: fixed;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--ease-out);
}

a:hover {
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--accent-dim), var(--teal-dim));
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* No backdrop-filter here: it creates a containing block so `position: fixed` on
   #site-nav (mobile drawer) is tied to the header box instead of the viewport,
   which makes the drawer render behind page content. Use a slightly stronger tint. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 12, 16, 0.92);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 40px -24px rgba(0, 0, 0, 0.35);
}

html.nav-drawer-open {
  overflow: hidden;
}

html.nav-drawer-open body {
  overflow: hidden;
}

html.nav-drawer-open .site-header {
  z-index: 2000;
}

html.site-search-open,
html.site-search-open body {
  overflow: hidden;
}

.header-ribbon {
  height: 3px;
  background: linear-gradient(90deg, var(--teal-dim) 0%, var(--accent-dim) 35%, var(--accent-bright) 50%, var(--accent-dim) 65%, var(--teal) 100%);
  opacity: 0.95;
}

.site-header__main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.55rem 1.25rem 0.75rem;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem 1rem;
  min-width: 0;
}

.nav-drawer-backdrop {
  display: none;
}

.nav-drawer-top {
  display: none;
}

.nav-drawer-top__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.nav-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s, color 0.2s, transform 0.15s var(--ease-out);
}

.nav-drawer-close:hover {
  background: var(--accent-soft);
  border-color: rgba(196, 181, 253, 0.35);
  color: var(--accent-bright);
}

.nav-drawer-close:active {
  transform: scale(0.96);
}

.nav-drawer-close:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.nav-drawer-close__icon {
  position: relative;
  display: block;
  width: 1.05rem;
  height: 1.05rem;
}

.nav-drawer-close__icon::before,
.nav-drawer-close__icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.15rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.nav-drawer-close__icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Search, theme, tip, menu — after primary nav (#site-nav) */
.header-nav-cluster {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.6rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.header-actions__tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  flex: 0 0 auto;
  min-width: 0;
}

.header-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid rgba(20, 184, 166, 0.22);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  line-height: 1.2;
}

.site-tip {
  text-decoration: none;
  transition: background 0.2s var(--ease-out), border-color 0.2s, transform 0.15s var(--ease-out), color 0.2s;
}

.site-tip--header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 1.12rem;
  line-height: 1;
  flex-shrink: 0;
}

.site-tip--header:hover {
  background: var(--surface-2);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fbbf24;
}

.site-tip--header:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.site-tip--header:active {
  transform: scale(0.96);
}

.site-tip--footer {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.86rem;
  color: #fbbf24;
  border-radius: 8px;
  padding: 0.15rem 0.1rem;
}

.site-tip--footer:hover {
  color: #fcd34d;
  text-decoration: none;
}

.site-tip--footer:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.site-tip--tool {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.875rem;
  color: #0f172a;
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 45%, #f59e0b 100%);
  border: 1px solid rgba(180, 83, 9, 0.4);
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.22);
  flex-shrink: 0;
}

.site-tip--tool:hover {
  filter: brightness(1.06);
  color: #0f172a;
  text-decoration: none;
}

.site-tip--tool:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.tool-tip-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
  margin: 0.35rem 0 1.85rem;
  padding: 0.75rem 1.05rem;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(251, 191, 36, 0.32);
  background: rgba(251, 191, 36, 0.05);
}

.tool-tip-rail__hint {
  font-size: 0.8125rem;
  color: var(--muted);
  flex: 1 1 14rem;
  min-width: 0;
  line-height: 1.45;
}

html[data-theme="light"] .tool-tip-rail {
  background: rgba(251, 191, 36, 0.09);
  border-color: rgba(245, 158, 11, 0.28);
}

html[data-theme="light"] .site-tip--header {
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background 0.2s var(--ease-out), border-color 0.2s, transform 0.15s var(--ease-out);
}

.theme-toggle:hover {
  background: var(--surface-2);
  border-color: rgba(196, 181, 253, 0.35);
}

.theme-toggle:active {
  transform: scale(0.96);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.theme-toggle__icons {
  display: grid;
  place-items: center;
  position: relative;
  width: 1.35rem;
  height: 1.35rem;
}

.theme-toggle__sun,
.theme-toggle__moon {
  grid-area: 1 / 1;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.theme-toggle__sun {
  opacity: 1;
  transform: scale(1);
}

.theme-toggle__moon {
  opacity: 0.3;
  transform: scale(0.88);
}

html[data-theme="light"] .theme-toggle__sun {
  opacity: 0.32;
  transform: scale(0.88);
}

html[data-theme="light"] .theme-toggle__moon {
  opacity: 1;
  transform: scale(1);
}

.header-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--ease-out), border-color 0.2s, color 0.2s, transform 0.15s var(--ease-out), box-shadow 0.2s;
}

.header-search-btn:hover {
  background: var(--surface-2);
  border-color: rgba(196, 181, 253, 0.4);
  color: var(--accent-bright);
}

.header-search-btn:active {
  transform: scale(0.96);
}

.header-search-btn:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.header-search-btn__icon {
  display: block;
  pointer-events: none;
}

/* Icon-only control (hide label if present in older builds) */
.header-search-btn__label {
  display: none;
}

html[data-theme="light"] .header-search-btn {
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.logo span,
.logo__accent {
  background: linear-gradient(120deg, var(--accent-bright) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo__brand {
  font-weight: 800;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-height: 2.65rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  transition: background 0.2s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
}

.nav-toggle:hover {
  background: var(--surface-2);
  border-color: var(--accent-soft-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-toggle__icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 1.25rem;
  height: 1rem;
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

html[data-theme="light"] .nav-toggle {
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.nav-mega {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.nav-mega__root {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem 0.25rem;
}

/* Space after “Case converter” in primary nav */
.nav-mega__root > .nav-mega__item:first-child {
  margin-right: 0.5rem;
  padding-right: 0.65rem;
  border-right: 1px solid var(--border);
}

.nav-mega__item {
  position: relative;
  list-style: none;
}

.nav-mega__link {
  display: inline-block;
  padding: 0.45rem 0.6rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
}

.nav-mega__link:hover,
.nav-mega__link:focus-visible {
  color: var(--accent-bright);
  text-decoration: none;
  background: var(--accent-soft);
}

.nav-mega__link--home {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
}

.nav-mega__link--home:hover {
  border-color: var(--border-strong);
}

.nav-mega__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.nav-mega__btn:hover,
.nav-mega__btn:focus-visible {
  color: var(--accent-bright);
  background: var(--accent-soft);
  outline: none;
}

.nav-mega__chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  margin-left: 0.1rem;
  color: var(--muted);
  transition: transform 0.2s var(--ease-out), color 0.15s ease;
}

.nav-mega__chev-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.nav-mega__has-panel:hover .nav-mega__chev,
.nav-mega__has-panel:focus-within .nav-mega__chev,
.nav-mega__has-panel.is-open .nav-mega__chev {
  color: var(--accent);
}

.nav-mega__panel {
  display: none;
}

.nav-mega__links {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.nav-mega__links a {
  display: block;
  padding: 0.35rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
}

.nav-mega__links a:hover {
  background: linear-gradient(90deg, var(--accent-soft), var(--teal-soft));
  color: var(--accent-bright);
  text-decoration: none;
}

@media (min-width: 901px) {
  .nav-toggle {
    display: none;
  }

  .nav-drawer-backdrop {
    display: none !important;
  }

  .nav-drawer-top {
    display: none !important;
  }

  .nav-mega {
    display: flex !important;
  }

  .nav-mega__btn {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.42rem 0.88rem;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: var(--muted);
  }

  .nav-mega__btn:hover,
  .nav-mega__btn:focus-visible {
    border-color: rgba(196, 181, 253, 0.35);
    background: var(--accent-soft);
    color: var(--accent-bright);
  }

  html[data-theme="light"] .nav-mega__btn {
    background: #fff;
    border-color: rgba(15, 23, 42, 0.1);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  html[data-theme="light"] .nav-mega__btn:hover,
  html[data-theme="light"] .nav-mega__btn:focus-visible {
    border-color: rgba(124, 58, 237, 0.35);
    color: var(--accent-dim);
  }

  .nav-mega__has-panel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.75rem;
    z-index: 99;
  }

  .nav-mega__has-panel:hover .nav-mega__chev,
  .nav-mega__has-panel:focus-within .nav-mega__chev,
  .nav-mega__has-panel.is-open .nav-mega__chev {
    transform: rotate(180deg);
  }

  .nav-mega__has-panel:hover .nav-mega__panel,
  .nav-mega__has-panel:focus-within .nav-mega__panel {
    display: block;
    animation: mega-panel-in 0.22s var(--ease-out);
  }

  @keyframes mega-panel-in {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-mega__panel {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    left: auto;
    min-width: min(100vw - 2rem, 560px);
    max-width: min(100vw - 2rem, 720px);
    max-height: min(72vh, 560px);
    overflow: hidden auto;
    overscroll-behavior: contain;
    z-index: 100;
    padding: 0.65rem 0.35rem 0.85rem;
    background: rgba(20, 24, 34, 0.97);
    backdrop-filter: blur(20px) saturate(1.35);
    -webkit-backdrop-filter: blur(20px) saturate(1.35);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    box-shadow: 0 28px 90px -20px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.04) inset,
      0 0 60px -24px rgba(124, 58, 237, 0.35);
  }

  .nav-mega__links {
    columns: 2;
    column-gap: 1.5rem;
    column-rule: 1px solid rgba(148, 163, 184, 0.1);
    padding: 0.35rem 0.65rem 0.5rem;
  }

  .nav-mega__links li {
    break-inside: avoid;
  }

  .nav-mega__links a {
    padding: 0.42rem 0.65rem;
    margin: 0.06rem 0;
    font-size: 0.875rem;
  }

  html[data-theme="light"] .nav-mega__panel {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 24px 70px -18px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
    padding: 0.7rem 0.4rem 0.9rem;
  }
}

@media (max-width: 900px) {
  .site-header__main {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 0.65rem;
    padding: 0.55rem 1rem 0.75rem;
  }

  .header-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-nav-cluster {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  /* Drawer is fixed; collapse in-flow box so the top row is brand | tools only */
  .site-header__main > #site-nav.nav-mega {
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    overflow: visible;
    margin: 0;
    padding: 0;
    border: none;
  }

  .header-actions__tools {
    flex-shrink: 0;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-toggle__text {
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 140;
    background: rgba(2, 6, 23, 0.52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s var(--ease-out), visibility 0.28s;
  }

  html.nav-drawer-open .nav-drawer-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-drawer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-shrink: 0;
    min-height: calc(3.35rem + env(safe-area-inset-top, 0px));
    padding: max(0.65rem, env(safe-area-inset-top, 0px)) 1rem 0.7rem;
    border-bottom: 1px solid var(--border-strong);
    background: var(--surface-elevated);
    box-shadow: 0 10px 28px -16px rgba(0, 0, 0, 0.55);
    z-index: 2;
  }

  .nav-drawer-top__title {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0.25rem;
  }

  html[data-theme="light"] .nav-drawer-top {
    background: #ffffff;
    box-shadow: 0 6px 20px -12px rgba(15, 23, 42, 0.14);
    border-bottom-color: rgba(15, 23, 42, 0.1);
  }

  html[data-theme="light"] .nav-drawer-close {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.1);
  }

  .nav-mega,
  #site-nav.nav-mega {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    width: min(20.75rem, 91vw);
    max-width: none;
    flex: none;
    display: flex !important;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: none;
    border-left: 1px solid var(--border-strong);
    border-radius: 0;
    max-height: none;
    overflow: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
    box-shadow: -16px 0 56px rgba(0, 0, 0, 0.5);
    z-index: 145;
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.32s;
  }

  .nav-mega.is-open,
  #site-nav.nav-mega.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    width: calc(100% - 20px);
max-width: 360px;
  }
.nav-mega.is-open .nav-mega__root > .nav-mega__item:first-child{
    padding-left: 10px;
}
  .nav-mega__root {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
    padding: 0.35rem 0 1rem;
  }

  .nav-mega__root > .nav-mega__item:first-child {
    margin-right: 0;
    padding-right: 0;
    border-right: none;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-mega__item {
    border-bottom: 1px solid var(--border);
  }

  .nav-mega__item:last-child {
    border-bottom: none;
  }

  .nav-mega__link {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .nav-mega__btn {
    width: 100%;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-radius: 0;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-secondary);
  }

  .nav-mega__btn:hover,
  .nav-mega__btn:focus-visible {
    background: var(--accent-soft);
    color: var(--accent-bright);
  }

  .nav-mega__panel {
    position: static;
    box-shadow: none;
    border: none;
    background: var(--bg-deep);
    border-radius: 0 0 10px 10px;
    max-height: none;
    margin: 0 0.35rem 0.35rem;
    overflow: hidden;
    border: 1px solid var(--border);
  }

  html[data-theme="light"] .nav-mega__panel {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.08);
  }

  .nav-mega__has-panel.is-open .nav-mega__panel {
    display: block;
  }

  .nav-mega__has-panel.is-open .nav-mega__chev {
    transform: rotate(180deg);
    color: var(--accent-bright);
  }

  .nav-mega__links {
    columns: 1;
    padding: 0.35rem 0.25rem 0.65rem;
    column-rule: none;
  }

  .nav-mega__links a {
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
  }
}

.ad-slot {
width: calc(100% - 40px);
    max-width: calc(var(--max) - 40px);
  margin: 1.25rem auto;
  padding: 0 1.25rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(22, 26, 36, 0.9), rgba(17, 20, 28, 0.95));
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ad-slot ins {
  display: block;
  min-width: 300px;
  min-height: 90px;
}

.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.25rem 1.25rem 4.5rem;
}

/* Privacy policy & terms — readable single column */
.layout--legal {
  max-width: 44rem;
  padding-top: 1.75rem;
  padding-bottom: 4rem;
}

.legal-page__header {
  margin-bottom: 1.75rem;
}

.legal-page__h1 {
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.legal-page__meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.legal-page__body {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.legal-page__body p {
  margin: 0 0 1rem;
}

.legal-page__body p:last-child {
  margin-bottom: 0;
}

.legal-page__h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 2rem 0 0.65rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.legal-page__body .legal-page__h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.legal-page__body a {
  font-weight: 600;
}

.legal-page__body code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

html[data-theme="light"] .legal-page__body code {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
}

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}

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

.category-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.category-card {
  background: linear-gradient(165deg, var(--surface-elevated) 0%, var(--surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.category-card:hover {
  border-color: rgba(196, 181, 253, 0.38);
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(196, 181, 253, 0.12), 0 20px 50px -24px rgba(124, 58, 237, 0.35);
  transform: translateY(-2px);
}

.category-card h2 {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool-list li {
  margin: 0.35rem 0;
}

.tool-list a {
  color: var(--text-secondary);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.tool-list a:hover {
  color: var(--accent-bright);
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.breadcrumb__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
}

.breadcrumb__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.breadcrumb__item:not(:last-child)::after {
  content: "›";
  color: var(--muted);
  opacity: 0.75;
  font-weight: 500;
  margin-left: 0.15rem;
}

.breadcrumb__item--current {
  color: var(--text-secondary);
  font-weight: 600;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.layout.tool-page {
  padding: 1.65rem 1.35rem 3.75rem;
}

@media (min-width: 640px) {
  .layout.tool-page {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
}

.tool-page__header {
  margin-bottom: 1.5rem;
}

.tool-page__primary {
  margin-bottom: 0.75rem;
}

.tool-page__workspace {
  margin-top: 0.35rem;
  margin-bottom: 0.5rem;
}

.tool-page h1,
.tool-page .tool-page__h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
  text-shadow: 0 0 48px rgba(124, 58, 237, 0.2);
}

.tool-intro {
  color: var(--muted);
  margin: 0 0 0.65rem;
  max-width: 720px;
}

.tool-lead {
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 0 0 1.5rem;
  max-width: 46rem;
}

/* Tool stack: consistent vertical rhythm between panels, actions, hints */
#tool-root {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--tool-stack-gap);
}

/* Multi-style Unicode font picker (WhatsApp-style rows) */
.font-style-board__input {
  min-height: 6.25rem;
}

.font-style-board__list {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  margin-top: 0.35rem;
}

.font-style-board__row {
  padding: 1rem 1.15rem 1.05rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.font-style-board__row-meta {
  margin-bottom: 0.45rem;
}

.font-style-board__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.font-style-board__preview {
  font-size: 1.06rem;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--text);
  margin: 0 0 0.7rem;
  min-height: 1.55em;
}

.font-style-board__row-actions {
  display: flex;
  justify-content: flex-end;
}

.font-style-board__row-actions .btn {
  font-size: 0.86rem;
  padding: 0.45rem 1rem;
}

html[data-theme="light"] .font-style-board__row {
  background: #ffffff;
  border-color: rgba(30, 41, 59, 0.09);
  box-shadow: 0 2px 12px rgba(30, 41, 59, 0.045);
}

html[data-theme="light"] .font-style-board__preview {
  color: var(--text);
}

#tool-root .tool-panel {
  margin-bottom: 0;
}

#tool-root > .btn-row {
  margin-top: 0;
  margin-bottom: 0;
}

#tool-root > .row-2 {
  margin: 0;
  gap: var(--tool-stack-gap);
}

.tool-panel {
  position: relative;
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--tool-workspace-padding);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tool-panel::before {
  content: "";
  position: absolute;
  left: var(--tool-workspace-pad-inline);
  right: var(--tool-workspace-pad-inline);
  top: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.35), rgba(20, 184, 166, 0.25), transparent);
  opacity: 0.55;
  pointer-events: none;
}

.tool-panel label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.55rem;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

html[data-theme="light"] .tool-panel {
  background: #ffffff;
  border-color: rgba(30, 41, 59, 0.09);
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.04), 0 12px 36px -24px rgba(30, 41, 59, 0.07);
}

html[data-theme="light"] .tool-panel::before {
  opacity: 0.45;
}

textarea.input-area,
input[type="text"].input-area,
input[type="number"].input-area,
input[type="url"].input-area {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-deep);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 0.875rem;
  min-height: 160px;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="file"].input-area {
  width: 100%;
  padding: 0.5rem 0.65rem 0.5rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--bg-deep) 100%);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  min-height: auto;
  resize: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type="file"].input-area:hover {
  border-color: rgba(196, 181, 253, 0.4);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  color: var(--text-secondary);
}

input[type="file"].input-area::file-selector-button {
  margin-right: 1rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, #6d28d9 0%, var(--accent-dim) 50%, var(--teal-dim) 160%);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
  transition: filter 0.2s, transform 0.15s;
}

input[type="file"].input-area::file-selector-button:hover {
  filter: brightness(1.08);
}

input[type="file"].input-area::file-selector-button:active {
  transform: scale(0.98);
}

input[type="file"].input-area::-webkit-file-upload-button {
  margin-right: 1rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, #6d28d9 0%, var(--accent-dim) 50%, var(--teal-dim) 160%);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

input[type="text"].input-area,
input[type="number"].input-area,
input[type="url"].input-area {
  min-height: auto;
  font-family: var(--font);
}

textarea.input-area:focus,
input.input-area:focus {
  outline: none;
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 28px -8px rgba(124, 58, 237, 0.35);
}

input[type="file"].input-area:focus {
  border-style: solid;
}

input[type="color"].input-color {
  display: block;
  width: 100%;
  max-width: 10rem;
  min-height: 2.75rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="color"].input-color:hover {
  border-color: rgba(196, 181, 253, 0.35);
}

input[type="color"].input-color:focus {
  outline: none;
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 28px -8px rgba(124, 58, 237, 0.35);
}

.tool-matte-opt {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.tool-matte-opt label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Native selects — match input-area polish (custom chevron, no OS chrome) */
select.select-input {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.65rem 2.75rem 0.65rem 1rem;
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-deep);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1.15rem;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

select.select-input:hover:not(:disabled) {
  border-color: rgba(196, 181, 253, 0.35);
}

select.select-input:focus {
  outline: none;
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 28px -8px rgba(124, 58, 237, 0.35);
}

select.select-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Range slider — track, fill, thumb (matches primary gradient language) */
.input-range-field {
  margin-top: 0.15rem;
}

.input-range-field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.tool-panel .input-range-field__head label {
  display: inline-block;
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
  padding-right: 0.25rem;
}

.input-range__value {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--accent-bright);
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--bg-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#tool-root input[type="range"].input-range,
.tool-panel input[type="range"].input-range {
  --range-fill: 84%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 100%;
  height: 2.5rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#tool-root input[type="range"].input-range:focus,
.tool-panel input[type="range"].input-range:focus {
  outline: none;
}

#tool-root input[type="range"].input-range:disabled,
.tool-panel input[type="range"].input-range:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* WebKit — track */
#tool-root input[type="range"].input-range::-webkit-slider-runnable-track,
.tool-panel input[type="range"].input-range::-webkit-slider-runnable-track {
  height: 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(
    90deg,
    rgba(124, 58, 237, 0.55) 0%,
    rgba(20, 184, 166, 0.45) var(--range-fill, 50%),
    var(--bg-deep) var(--range-fill, 50%),
    var(--surface-2) 100%
  );
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* WebKit — thumb */
#tool-root input[type="range"].input-range::-webkit-slider-thumb,
.tool-panel input[type="range"].input-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: calc((0.55rem - 1.35rem) / 2);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(145deg, #ddd6fe 0%, #7c3aed 42%, #14b8a6 130%);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2) inset,
    0 1px 0 rgba(255, 255, 255, 0.25) inset;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s, filter 0.2s;
}

#tool-root input[type="range"].input-range:hover::-webkit-slider-thumb,
.tool-panel input[type="range"].input-range:hover::-webkit-slider-thumb {
  filter: brightness(1.08);
  transform: scale(1.06);
  box-shadow: 0 3px 16px rgba(124, 58, 237, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2) inset,
    0 1px 0 rgba(255, 255, 255, 0.28) inset;
}

#tool-root input[type="range"].input-range:active::-webkit-slider-thumb,
.tool-panel input[type="range"].input-range:active::-webkit-slider-thumb {
  transform: scale(1.02);
}

#tool-root input[type="range"].input-range:focus-visible::-webkit-slider-thumb,
.tool-panel input[type="range"].input-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft), 0 3px 18px rgba(124, 58, 237, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.2) inset;
}

/* Firefox — track + progress */
#tool-root input[type="range"].input-range::-moz-range-track,
.tool-panel input[type="range"].input-range::-moz-range-track {
  height: 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
}

#tool-root input[type="range"].input-range::-moz-range-progress,
.tool-panel input[type="range"].input-range::-moz-range-progress {
  height: 0.55rem;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.75), rgba(20, 184, 166, 0.65));
  border: 1px solid transparent;
  border-right: none;
}

#tool-root input[type="range"].input-range::-moz-range-thumb,
.tool-panel input[type="range"].input-range::-moz-range-thumb {
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: linear-gradient(145deg, #ddd6fe 0%, #7c3aed 42%, #14b8a6 130%);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), filter 0.2s;
}

#tool-root input[type="range"].input-range:hover::-moz-range-thumb,
.tool-panel input[type="range"].input-range:hover::-moz-range-thumb {
  filter: brightness(1.08);
  transform: scale(1.06);
}

#tool-root input[type="range"].input-range:focus-visible::-moz-range-thumb,
.tool-panel input[type="range"].input-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft), 0 3px 18px rgba(124, 58, 237, 0.5);
}

html[data-theme="light"] .input-range__value {
  color: var(--accent-dim);
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] #tool-root input[type="range"].input-range::-webkit-slider-runnable-track,
html[data-theme="light"] .tool-panel input[type="range"].input-range::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    rgba(107, 70, 193, 0.35) 0%,
    rgba(15, 118, 110, 0.28) var(--range-fill, 50%),
    #e2e8f0 var(--range-fill, 50%),
    #f1f5f9 100%
  );
  box-shadow: inset 0 1px 3px rgba(30, 41, 59, 0.08);
}

html[data-theme="light"] #tool-root input[type="range"].input-range::-moz-range-track,
html[data-theme="light"] .tool-panel input[type="range"].input-range::-moz-range-track {
  background: #e2e8f0;
}

html[data-theme="light"] #tool-root input[type="range"].input-range::-moz-range-progress,
html[data-theme="light"] .tool-panel input[type="range"].input-range::-moz-range-progress {
  background: linear-gradient(90deg, rgba(91, 33, 182, 0.55), rgba(15, 118, 110, 0.45));
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 0.95rem;
  margin-top: 0.85rem;
  padding: 0.2rem 0;
}

#tool-root > .btn-row {
  padding: 0.4rem 0.1rem;
}

button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.015em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s var(--ease-out), border-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
}

html[data-theme="light"] button.btn:not(.btn-primary),
html[data-theme="light"] a.btn:not(.btn-primary) {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

button.btn:hover,
a.btn:hover {
  background: var(--surface-elevated);
  border-color: rgba(196, 181, 253, 0.35);
  color: var(--text);
  text-decoration: none;
}

button.btn:active,
a.btn:active {
  transform: scale(0.98);
}

button.btn-primary,
a.btn-primary {
  background: linear-gradient(135deg, #6d28d9 0%, var(--accent-dim) 45%, var(--teal-dim) 160%);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

button.btn-primary:hover,
a.btn-primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hint {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 0.35rem;
  margin-bottom: 0;
}

#tool-root > .hint {
  margin-top: 0.15rem;
}

.seo-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.seo-section h2 {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.seo-section p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.site-footer {
  border-top: 1px solid var(--border-strong);
  padding: 2rem 1.25rem;
  margin-top: auto;
  background: var(--surface);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
}

.row-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.output-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.55;
  background: var(--bg-deep);
  padding: 1.05rem 1.15rem;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  max-height: 400px;
  overflow: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data-table th,
table.data-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

table.data-table th {
  background: linear-gradient(180deg, var(--surface-2), var(--surface-elevated));
  color: var(--accent-bright);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.error-msg {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.success-msg {
  color: var(--success);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

img.preview-img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.font-preview-box {
  font-size: 1.25rem;
  padding: 1.1rem 1.15rem;
  background: var(--bg-deep);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  min-height: 4rem;
  word-break: break-word;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

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

/* Homepage: featured case converter (pillar content) */
.layout--home {
  padding-top: 1.5rem;
}

.featured-tool {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, var(--surface-elevated) 0%, var(--surface) 42%, rgba(22, 26, 36, 0.98) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem 2.25rem;
  margin-bottom: 2.25rem;
  box-shadow: var(--shadow-soft), 0 0 80px -30px rgba(124, 58, 237, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.featured-tool__intro {
  position: relative;
  z-index: 1;
  margin: 0;
}

.featured-tool::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 55%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(167, 139, 250, 0.12), transparent 70%);
  pointer-events: none;
}

/* Light: clean card — no muddy dark gradient corner */
html[data-theme="light"] .featured-tool {
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 48%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.09);
  box-shadow: 0 4px 24px -6px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

html[data-theme="light"] .featured-tool::after {
  top: -35%;
  right: -15%;
  width: 50%;
  height: 75%;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.07), transparent 72%);
}

html[data-theme="light"] .featured-tool .featured-tool__panel.tool-panel {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .featured-tool .home-eyebrow {
  color: var(--accent-dim);
}

.home-eyebrow {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--teal);
  margin: 0 0 0.65rem;
}

.featured-tool__h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(1.6rem, 4.2vw, 2.35rem);
  font-weight: 800;
  margin: 0 0 0.85rem;
  letter-spacing: -0.045em;
  line-height: 1.15;
  background: linear-gradient(105deg, #fff 0%, var(--accent-bright) 42%, var(--teal) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Light theme: hero title gradient reads on pale card (no bright white band) */
html[data-theme="light"] .featured-tool__h1 {
  background: linear-gradient(105deg, #0f172a 0%, #5b21b6 38%, #0f7669 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.featured-tool__lead {
  position: relative;
  z-index: 1;
  color: var(--muted);
  margin: 0 0 1.35rem;
  max-width: 52rem;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.65;
}

.featured-tool__panel {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}

.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.65rem;
  margin-top: 0.85rem;
}

.case-actions .btn {
  font-size: 0.8rem;
  padding: 0.45rem 0.65rem;
}

.featured-tool__more {
  margin-bottom: 0;
}

.home-secondary {
  margin-bottom: 1.75rem;
}

.home-h2 {
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.home-secondary__p {
  margin: 0;
  color: var(--muted);
  max-width: 48rem;
}

/* Homepage: semantic editorial + FAQ (SEO body content) */
.home-editorial {
  margin-bottom: 2.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.home-editorial__lead {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 52rem;
}

.home-editorial__columns {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .home-editorial__columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .home-editorial__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.35rem 1.5rem;
  }
}

.home-editorial__card {
  margin: 0;
  padding: 1.25rem 1.3rem 1.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.home-editorial__card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-editorial__card p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted);
}

.home-editorial__card ul {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.home-editorial__card li {
  margin: 0.35rem 0;
}

.home-editorial__card a {
  font-weight: 600;
  color: var(--accent-bright);
}

.home-editorial__card a:hover {
  color: var(--teal);
}

html[data-theme="light"] .home-editorial__card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.09);
  box-shadow: 0 2px 12px rgba(30, 41, 59, 0.045);
}

.home-trust {
  margin-bottom: 2.25rem;
  padding: 1.35rem 1.25rem 1.45rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
}

.home-trust__p {
  margin: 0;
  max-width: 50rem;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.home-trust__p a {
  font-weight: 600;
  color: var(--accent-bright);
}

html[data-theme="light"] .home-trust {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

/* Homepage: catalog search — card + embedded field (dark / light) */
.home-tool-search {
  margin: 0 0 2.5rem;
  max-width: 42rem;
}

.home-tool-search__shell {
  padding: 1.25rem 1.35rem 1.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, var(--surface-elevated) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .home-tool-search__shell {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 12px 40px -28px rgba(15, 23, 42, 0.12);
}

.home-tool-search__title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text);
}

.home-tool-search__lead {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: none;
}

.home-tool-search__field {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.2rem 0.55rem 0.2rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.home-tool-search__field:focus-within {
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

html[data-theme="light"] .home-tool-search__field {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .home-tool-search__field:focus-within {
  border-color: rgba(91, 33, 182, 0.35);
  box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.12);
}

.home-tool-search__field-icon {
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.9;
}

.home-tool-search__field:focus-within .home-tool-search__field-icon {
  color: var(--accent-bright);
  opacity: 1;
}

.home-tool-search__input {
  flex: 1;
  min-width: 0;
  min-height: 2.65rem;
  padding: 0.5rem 0.35rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: none;
}

.home-tool-search__input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.home-tool-search__input:focus {
  outline: none;
}

.home-tool-search__clear {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.home-tool-search__status {
  margin: 0.65rem 0 0;
  min-height: 1.35em;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

@media (max-width: 520px) {
  .home-tool-search__field {
    flex-wrap: wrap;
  }

  .home-tool-search__clear {
    width: 100%;
  }
}

.home-faq {
  margin-bottom: 2.75rem;
}

.home-faq__intro {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 42rem;
}

.home-faq__list {
  margin: 0;
  max-width: 52rem;
}

.home-faq__list dt {
  margin: 1.35rem 0 0.4rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.home-faq__list dt:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.home-faq__list dd {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* Footer: full sitemap columns */
.footer-wave {
  height: 48px;
  margin-top: -1px;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.07) 0%, transparent 100%);
  clip-path: polygon(0 100%, 0 35%, 8% 55%, 18% 28%, 28% 48%, 40% 22%, 52% 42%, 64% 18%, 76% 38%, 88% 15%, 100% 40%, 100% 100%);
  pointer-events: none;
}

.footer-spotlight {
  background: radial-gradient(ellipse 120% 100% at 50% 0%, var(--accent-soft-2) 0%, transparent 55%),
    linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}

.footer-spotlight__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 1.5rem;
  text-align: center;
}

.footer-spotlight__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.footer-spotlight__text {
  margin: 0 auto 1rem;
  max-width: 36rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

.footer-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.footer-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--accent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.site-footer--mega {
  margin-top: 3rem;
  padding-top: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(17, 20, 28, 0.97) 8%, var(--surface) 100%);
  border-top: 1px solid var(--border-strong);
}

.footer-mega__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.25rem 1.5rem;
  display: grid;
  gap: 2rem;
}

@media (min-width: 900px) {
  .footer-mega__inner {
    grid-template-columns: minmax(200px, 260px) 1fr;
    align-items: start;
  }
}

.footer-mega__brand {
  padding-right: 0.5rem;
}

.footer-mega__logo {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.04em;
  transition: color 0.2s var(--ease-out);
}

.footer-mega__logo:hover {
  color: var(--accent-bright);
  text-decoration: none;
}

.footer-mega__tag {
  margin: 0.6rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

.footer-mega__site {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
}

.footer-mega__site a {
  color: var(--accent);
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.footer-mega__grid {
  display: grid;
  gap: 1.25rem 1rem;
  grid-template-columns: 1fr;
  min-width: 0;
}

@media (min-width: 520px) {
  .footer-mega__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .footer-mega__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .footer-mega__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.footer-mega__grid > div {
  min-width: 0;
}

.footer-mega__h {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal);
}

.footer-mega__list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.footer-mega__list li {
  margin: 0.28rem 0;
  min-width: 0;
}

.footer-mega__list a {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.footer-mega__list a:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-mega__bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.1rem 1.25rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  color: var(--muted);
  min-width: 0;
}

.footer-mega__bar > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.footer-mega__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.footer-mega__meta a {
  color: var(--muted);
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.footer-mega__meta a:hover {
  color: var(--accent);
}

/* Long-form SEO article (tool pages) */
.tool-article {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-strong);
}

.tool-article__title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  color: var(--text);
}

.tool-article__section {
  margin-bottom: 1.75rem;
}

.tool-article__section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
  color: var(--accent-bright);
}

.tool-article__section p {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.75;
  margin: 0 0 0.85rem;
}

.tool-article__steps {
  margin: 0 0 1rem 1.1rem;
  padding: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tool-article__steps li {
  margin: 0.4rem 0;
}

.tool-article__bullets {
  margin: 0 0 0.5rem 1.1rem;
  padding: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tool-article__bullets li {
  margin: 0.45rem 0;
}

.tool-faq {
  margin: 2rem 0 1.5rem;
  padding: 1.35rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, var(--surface-elevated) 0%, var(--surface) 100%);
}

.tool-faq__list {
  margin: 0;
}

.tool-faq__item {
  margin-bottom: 1.1rem;
}

.tool-faq__item dt {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.tool-faq__item dd {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.65;
}

.tool-related {
  margin-top: 2rem;
}

.tool-related p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0 0 0.85rem;
}

.tool-related__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool-related__list li {
  margin: 0.5rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  font-size: 0.92rem;
  line-height: 1.5;
}

.tool-related__list a {
  font-weight: 700;
  color: var(--accent-bright);
}

.tool-related__list a:hover {
  color: var(--teal);
}

/* Image tool workspace — same inset + vertical rhythm as #tool-root */
.tool-image-workspace {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--tool-stack-gap);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  padding: var(--tool-workspace-padding);
  margin-bottom: 0;
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.06), transparent 40%, rgba(20, 184, 166, 0.05));
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-image-workspace--drag {
  border-color: rgba(196, 181, 253, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tool-image-workspace__panel {
  margin-bottom: 0;
}

#tool-root .tool-image-workspace > .btn-row {
  margin-top: 0;
  margin-bottom: 0;
}

#tool-root .tool-image-workspace > .row-2 {
  margin: 0;
  gap: var(--tool-stack-gap);
}

#tool-root .tool-image-workspace > .hint {
  margin-top: 0;
}

.tool-image-workspace__hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  line-height: 1.45;
}

.tool-image-workspace__preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
}

.tool-image-workspace__video {
  display: block;
  width: 100%;
  max-height: 220px;
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #000;
  object-fit: contain;
}

.image-resizer__presets {
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
}

.image-resizer__presets .btn {
  font-size: 0.78rem;
  padding: 0.38rem 0.6rem;
  min-height: 2rem;
}

.video-hub-h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.video-hub-grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
}

.video-hub-grid__item {
  margin: 0;
}

.video-hub-grid__link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0.65rem 0.85rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  transition: border-color 0.2s, color 0.2s, transform 0.15s var(--ease-out);
}

.video-hub-grid__link:hover {
  color: var(--accent-bright);
  border-color: rgba(124, 58, 237, 0.45);
  text-decoration: none;
  transform: translateY(-1px);
}

html[data-theme="light"] .video-hub-grid__link {
  background: #fff;
}

/* Global command-palette search */
.site-search {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(8vh, 3.5rem) 1rem 2rem;
  box-sizing: border-box;
}

.site-search[hidden] {
  display: none !important;
}

.site-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  cursor: pointer;
  border: 0;
  animation: site-search-fade-in 0.22s var(--ease-out) both;
}

html[data-theme="light"] .site-search__backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.site-search__panel {
  position: relative;
  width: min(100%, 34rem);
  max-height: min(78vh, 32rem);
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, var(--surface-elevated) 0%, var(--surface) 48%, rgba(15, 23, 42, 0.5) 100%);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12), 0 24px 64px -12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.22s var(--ease-out), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] .site-search__panel {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12), 0 1px 0 rgba(255, 255, 255, 0.95) inset;
}

.site-search--visible .site-search__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes site-search-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.site-search__chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.site-search__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-search__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.site-search__close:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.site-search__close:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.site-search__close-icon {
  position: relative;
  display: block;
  width: 1rem;
  height: 1rem;
}

.site-search__close-icon::before,
.site-search__close-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.site-search__close-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.site-search__field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.65rem 1rem 0.35rem;
  padding: 0.45rem 0.75rem 0.45rem 0.65rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-deep);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.site-search__field:focus-within {
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 28px -8px rgba(124, 58, 237, 0.35);
}

html[data-theme="light"] .site-search__field {
  background: #f1f5f9;
}

.site-search__field-icon {
  flex-shrink: 0;
  opacity: 0.55;
  color: var(--muted);
}

.site-search__field:focus-within .site-search__field-icon {
  opacity: 0.85;
  color: var(--accent-bright);
}

.site-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
}

.site-search__input::placeholder {
  color: var(--muted);
}

.site-search__kbd-hint {
  flex-shrink: 0;
  opacity: 0.65;
}

.site-search__kbd {
  display: inline-block;
  padding: 0.12rem 0.38rem;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-2);
}

.site-search__status {
  margin: 0.15rem 1rem 0;
  min-height: 1.25em;
  font-size: 0.8rem;
  color: var(--muted);
}

.site-search__results {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0 0.35rem 0.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.site-search__item {
  margin: 0;
  padding: 0;
  border-radius: 10px;
}

.site-search__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s var(--ease-out);
}

.site-search__link:hover {
  text-decoration: none;
  background: var(--accent-soft);
}

.site-search__item--active .site-search__link {
  background: linear-gradient(105deg, rgba(124, 58, 237, 0.2), rgba(20, 184, 166, 0.12));
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.35);
}

html[data-theme="light"] .site-search__item--active .site-search__link {
  background: rgba(99, 102, 241, 0.12);
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.site-search__cat {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

.site-search__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.02em;
}

.site-search__footer-hint {
  margin: 0;
  padding: 0.45rem 1rem 0.65rem;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .site-search__panel,
  .site-search__backdrop {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Toasts */
.cc-toast-host {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  pointer-events: none;
  max-width: min(100vw - 2rem, 360px);
}

.cc-toast {
  pointer-events: none;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: var(--shadow-soft), 0 8px 32px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-strong);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.cc-toast--in {
  opacity: 1;
  transform: translateY(0);
}

.cc-toast--out {
  opacity: 0;
  transform: translateY(6px);
}

.cc-toast--info {
  background: var(--surface-elevated);
  color: var(--text-secondary);
}

.cc-toast--success {
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.95), rgba(16, 185, 129, 0.92));
  color: #ecfdf5;
  border-color: rgba(255, 255, 255, 0.12);
}

.cc-toast--warn {
  background: linear-gradient(135deg, #92400e, #b45309);
  color: #fffbeb;
}

.cc-toast--error {
  background: linear-gradient(135deg, #9f1239, #be123c);
  color: #fff1f2;
}

html[data-theme="light"] .cc-toast--info {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

/* Button busy (inline loader, not full-page) */
button.btn.btn--busy {
  position: relative;
  padding-left: 2.35rem;
}

button.btn.btn--busy::before {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 0.95rem;
  height: 0.95rem;
  margin-top: -0.475rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: cc-spin 0.7s linear infinite;
}

button.btn.btn-primary.btn--busy::before {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}

html[data-theme="light"] button.btn:not(.btn-primary).btn--busy::before {
  border-color: rgba(15, 23, 42, 0.12);
  border-top-color: var(--accent-dim);
}

@keyframes cc-spin {
  to {
    transform: rotate(360deg);
  }
}
