/* ═══════════════════════════════════════════════════════════════
   MiniDevTools — Global Styles
   Inspirado en imagecolorpicker.com: mesh gradient bg,
   cards limpias, tipografia moderna.
   ═══════════════════════════════════════════════════════════════ */

/* ─── RESET & BASE ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Force consistent layout: always reserve space for scrollbar */
  overflow-y: scroll;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════════
   THEME VARIABLES
   ═══════════════════════════════════════════════════════════════ */

/* ─── SHARED VARIABLES (both themes) ─── */
:root {
  --sidebar-width: 260px;
  --header-height: 0px; /* No separate header — sidebar is full-height */

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── LIGHT THEME ─── */
[data-theme="light"] {
  --bg-base: #ffffff;
  --bg-base-secondary: #f8f9fb;
  --bg-card: #ffffff;
  --bg-sidebar: rgba(255, 255, 255, 0.82);
  --bg-input: #f1f5f9;
  --bg-hover: rgba(0, 0, 0, 0.04);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.1);
  --accent-glow: rgba(99, 102, 241, 0.25);

  --border: #e2e8f0;
  --border-hover: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.18);

  /* Mesh gradient colors (warm left, cool right) */
  --orb-1: rgba(255, 107, 0, 0.55);
  --orb-2: rgba(255, 20, 147, 0.45);
  --orb-3: rgba(0, 212, 255, 0.55);
  --orb-4: rgba(0, 255, 136, 0.45);

  /* Tooltip */
  --tooltip-bg: #0f172a;
  --tooltip-text: #f1f5f9;
}

/* ─── DARK THEME ─── */
[data-theme="dark"] {
  --bg-base: #0a0d12;
  --bg-base-secondary: #111827;
  --bg-card: #1e293b;
  --bg-sidebar: rgba(15, 23, 42, 0.88);
  --bg-input: #111827;
  --bg-hover: rgba(255, 255, 255, 0.06);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: rgba(129, 140, 248, 0.12);
  --accent-glow: rgba(129, 140, 248, 0.2);

  --border: #2d3748;
  --border-hover: #4a5568;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);

  --orb-1: rgba(243, 135, 68, 0.40);
  --orb-2: rgba(238, 70, 188, 0.35);
  --orb-3: rgba(34, 204, 238, 0.40);
  --orb-4: rgba(71, 205, 137, 0.35);

  /* Tooltip */
  --tooltip-bg: #334155;
  --tooltip-text: #e2e8f0;
}


/* ═══════════════════════════════════════════════════════════════
   BACKGROUND — CSS Gradient Mesh + Vertical Bars
   Inspirado en imagecolorpicker.com:
   - 4 orbs radiales (calidos izq, frios der) con sizes grandes
   - Barras verticales sutiles con mask: visibles solo en bordes,
     invisibles en centro (evita barra negra)
   - Fade hacia abajo (no llega al fondo)
   ═══════════════════════════════════════════════════════════════ */

/* ─── Layer 1: Color gradient mesh ─── */
.bg-gradient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    /* Orb superior izquierdo (naranja) — grande, sale del viewport */
    radial-gradient(ellipse 75vw 90vh at -15% 0%, var(--orb-1), transparent 75%),
    /* Orb inferior izquierdo (rosa/magenta) */
    radial-gradient(ellipse 70vw 80vh at -10% 60%, var(--orb-2), transparent 75%),
    /* Orb superior derecho (cyan) */
    radial-gradient(ellipse 75vw 90vh at 115% 0%, var(--orb-3), transparent 75%),
    /* Orb inferior derecho (verde) */
    radial-gradient(ellipse 70vw 80vh at 110% 60%, var(--orb-4), transparent 75%),
    /* Puente central: calido→frio para suavizar transicion */
    linear-gradient(90deg,
      rgba(255, 107, 0, 0.05) 0%,
      transparent 20%,
      transparent 80%,
      rgba(0, 212, 255, 0.05) 100%
    ),
    /* Base */
    var(--bg-base);
  transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Layer 2: Subtle vertical bars (edge-only) ─── */
.bg-bars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  /* Light mode: lineas blancas */
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 79px,
    rgba(255, 255, 255, 0.06) 79px,
    rgba(255, 255, 255, 0.06) 80px
  );
  /* Mask: invisible en centro, visible en bordes, fade abajo */
  -webkit-mask-image:
    linear-gradient(to bottom, rgb(0,0,0), rgb(0,0,0) 70%, transparent),
    linear-gradient(90deg,
      rgba(0,0,0,0.35) 0%,
      rgba(0,0,0,0.25) 10%,
      rgba(0,0,0,0.12) 20%,
      transparent 38%,
      transparent 62%,
      rgba(0,0,0,0.12) 80%,
      rgba(0,0,0,0.25) 90%,
      rgba(0,0,0,0.35) 100%
    );
  mask-image:
    linear-gradient(to bottom, rgb(0,0,0), rgb(0,0,0) 70%, transparent),
    linear-gradient(90deg,
      rgba(0,0,0,0.35) 0%,
      rgba(0,0,0,0.25) 10%,
      rgba(0,0,0,0.12) 20%,
      transparent 38%,
      transparent 62%,
      rgba(0,0,0,0.12) 80%,
      rgba(0,0,0,0.25) 90%,
      rgba(0,0,0,0.35) 100%
    );
}

/* Dark mode: lineas NEGRAS */
[data-theme="dark"] .bg-bars {
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 79px,
    rgba(0, 0, 0, 0.12) 79px,
    rgba(0, 0, 0, 0.12) 80px
  );
}

/* Responsive */
@media (max-width: 768px) {
  .bg-bars {
    display: none;
  }
  .bg-gradient {
    background:
      radial-gradient(ellipse 80vw 55vh at -15% 0%, var(--orb-1), transparent 70%),
      radial-gradient(ellipse 75vw 50vh at -10% 50%, var(--orb-2), transparent 70%),
      radial-gradient(ellipse 80vw 55vh at 115% 0%, var(--orb-3), transparent 70%),
      radial-gradient(ellipse 75vw 50vh at 110% 50%, var(--orb-4), transparent 70%),
      var(--bg-base);
  }
}


/* ═══════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.app {
  position: relative;
  display: flex;
  min-height: 100vh;
  z-index: 1;
}


/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-base), background var(--transition-slow), border-color var(--transition-slow);
  overflow: visible;
}

/* Sidebar Header (brand + theme toggle) */
.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Sidebar Search */
.sidebar__search {
  position: relative;
  padding: 12px 14px 8px;
  flex-shrink: 0;
}

.sidebar__search-icon {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  margin-top: 2px;
}

.sidebar__search-input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar__search-input::placeholder {
  color: var(--text-muted);
}

.sidebar__search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.sidebar__search .sidebar__search-clear {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  visibility: hidden; /* hidden by default */
  opacity: 0;
  transition: color var(--transition-fast), opacity var(--transition-fast), visibility var(--transition-fast);
  line-height: 1;
}

.sidebar__search .sidebar__search-clear:hover {
  color: var(--text-primary);
}

.sidebar__search-input:not(:placeholder-shown) ~ .sidebar__search-clear {
  visibility: visible;
  opacity: 1;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.sidebar__brand:hover {
  opacity: 0.8;
}

.sidebar__logo {
  font-size: 24px;
  line-height: 1;
}

.sidebar__logo i {
  font-size: 22px;
}

.sidebar__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* Theme Toggle */
.sidebar__theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  transition: background var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}

.sidebar__theme-toggle:hover {
  background: var(--accent-light);
  transform: scale(1.08);
}

/* Theme icons: show/hide based on current theme */
[data-theme="light"] .theme-icon--moon,
[data-theme="dark"] .theme-icon--sun {
  display: none;
}

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

/* Sidebar Navigation */
.sidebar__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 10px;
  -webkit-overflow-scrolling: touch;
}

/* Nav category label */
.nav-category {
  padding: 16px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  user-select: none;
  transition: opacity var(--transition-fast);
}

.nav-category:first-child {
  padding-top: 4px;
}

.nav-category.hidden-by-search {
  display: none;
}

/* Nav item (tool link) */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.hidden-by-search {
  display: none;
}

.nav-item__icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.nav-item__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar backdrop (mobile overlay) */
.sidebar__backdrop {
  display: none;
}


/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
  transition: margin-left var(--transition-base);
  position: relative;
}


/* ═══════════════════════════════════════════════════════════════
   TOOL CARD — Contenedor principal de cada herramienta
   ═══════════════════════════════════════════════════════════════ */

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  padding: 32px;
  max-width: 960px;
  margin: 0 auto;
  transition: background var(--transition-slow), border-color var(--transition-slow), box-shadow var(--transition-slow);
  animation: toolCardFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toolCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-card__header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tool-card__title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.tool-card__description {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tool-card__body {
  /* Container for tool-specific content */
}


/* ═══════════════════════════════════════════════════════════════
   COMMON UI COMPONENTS (reutilizables entre herramientas)
   ═══════════════════════════════════════════════════════════════ */

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-full);
  min-height: 42px;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #ffffff;
}
.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px var(--accent-glow);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn--sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Input styles */
.input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  min-height: 42px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder {
  color: var(--text-muted);
}

textarea.input {
  resize: vertical;
  min-height: 100px;
}

/* Code output / display */
.code-output {
  background: var(--bg-base-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: auto;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-output__copy {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* Copy toast notification */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Label */
.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Form group */
.form-group {
  margin-bottom: 16px;
}

/* Grid layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════════ */

.loading-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-state.visible {
  display: flex;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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


/* ═══════════════════════════════════════════════════════════════
   HERO / HOME PAGE
   ═══════════════════════════════════════════════════════════════ */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100vh - 64px);
  padding: 40px 20px;
  animation: toolCardFadeIn 0.5s ease;
}

.hero__icon {
  font-size: 56px;
  margin-bottom: 20px;
  animation: heroFloat 3s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero__title {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1.5px;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero__subtitle {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 36px;
}

.hero__tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  max-width: 720px;
  width: 100%;
  margin-bottom: 32px;
}

.hero__tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.hero__tool-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-light);
  transform: translateY(-2px);
}

.hero__tool-card__icon {
  font-size: 22px;
  flex-shrink: 0;
}

.hero__tool-card__name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.hero__tool-card__cat {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.hero__footer-text {
  font-size: 13px;
  color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transition: var(--transition-fast);
}

.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-2xl);
  }

  .sidebar__backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
  }

  .sidebar.open .sidebar__backdrop {
    opacity: 1;
    pointer-events: all;
  }

  .main {
    margin-left: 0;
    padding: 72px 16px 32px;
  }

  .hero__title {
    font-size: 32px;
    letter-spacing: -1px;
  }

  .hero__subtitle {
    font-size: 15px;
  }

  .hero__tools-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tool-card {
    padding: 20px;
    border-radius: var(--radius-lg);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero__title {
    font-size: 28px;
  }

  .tool-card {
    padding: 16px;
  }

  .tool-card__title {
    font-size: 18px;
  }
}

/* ─── FORM CONTROLS — Custom appearance ─── */

/* Hide native number spinners (cleaner in both themes) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Custom checkbox — themed via CSS vars, no white flash in dark mode */
input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-hover);
  border-radius: 4px;
  background: var(--bg-card);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

input[type="checkbox"]:hover {
  border-color: var(--accent);
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Focus visible for keyboard nav */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   CUSTOM TOOLTIPS — Themed via CSS variables
   Usage: add data-tooltip="Text" to any element.
   Tooltips appear above by default; add data-tooltip-bottom
   (empty attr) to show below instead.
   ═══════════════════════════════════════════════════════════════ */

[data-tooltip],
[data-tooltip-bottom] {
  position: relative;
}

/* Tooltip bubble (above by default) */
[data-tooltip]::after,
[data-tooltip-bottom]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--tooltip-text);
  background: var(--tooltip-bg);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 9999;
}

/* Tooltip arrow (above by default) */
[data-tooltip]::before,
[data-tooltip-bottom]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-bg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 9999;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip-bottom]:hover::after,
[data-tooltip-bottom]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Bottom variant overrides ─── */
[data-tooltip-bottom]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-bottom]::before {
  bottom: auto;
  top: calc(100% + 4px);
  transform: translateX(-50%) translateY(-4px);
  border-top-color: transparent;
  border-bottom-color: var(--tooltip-bg);
}

[data-tooltip-bottom]:hover::after,
[data-tooltip-bottom]:hover::before {
  transform: translateX(-50%) translateY(0);
}


/* ═══════════════════════════════════════════════════════════════
   FLOATING PILL — External links (bottom-right)
   ═══════════════════════════════════════════════════════════════ */

.floating-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 28px;
  padding: 4px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  opacity: 0.45;
  transition: opacity var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base),
              background var(--transition-slow), border-color var(--transition-slow);
}

.floating-pill:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.pill-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.pill-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.08);
}

.pill-btn:active {
  transform: scale(0.95);
}

/* Override global tooltips for pill buttons: show to the LEFT */
.pill-btn[data-tooltip]::after {
  bottom: auto;
  top: 50%;
  left: auto;
  right: calc(100% + 10px);
  transform: translateY(-50%) translateX(6px);
}

.pill-btn[data-tooltip]::before {
  bottom: auto;
  top: 50%;
  left: auto;
  right: calc(100% + 6px);
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-top-color: transparent;
  border-right-color: var(--tooltip-bg);
  border-left-color: transparent;
}

.pill-btn[data-tooltip]:hover::after,
.pill-btn[data-tooltip]:hover::before {
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 768px) {
  .floating-pill {
    bottom: 16px;
    right: 16px;
  }
  .pill-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  /* Hide tooltips on mobile */
  .pill-btn[data-tooltip]::after,
  .pill-btn[data-tooltip]::before {
    display: none;
  }
}
