/* Reflexa v2.7 — temas claro y oscuro (copia local, no publicada).
   Claro  = portada v2.4 (crema #F5F2EC, óvalo violeta) + reflexas con el papel de la variante A
            (#E8DFD0) y la tarjeta/botón violeta de v2.4.
   Oscuro = variante B (ciruela, Cormorant, óvalo de trazo fino) con el morado de marca
            #6B2BC0 en botones y lavanda #C4B5FD/#A78BFA en acentos (sin terracota).
   El tema lo decide html.dark: preferencia guardada en localStorage('reflexa-theme')
   o, si no hay, prefers-color-scheme. Solo CSS: no toca puntajes, Supabase ni login. */

/* ===== PARTE 1 · MODO CLARO base (v2.4) =====
   Reflexa v2.4 — ajuste local de diseño.
   Objetivo: bajar la estética “hecho con IA” (blobs, degradés, CTA apagado)
   y corregir contraste, sin tocar lógica ni Supabase. */

/* v2.8: fuentes autoalojadas (subconjunto latino/español, woff2, font-display: swap).
   Antes: @import a Google Fonts (2 dominios más y una cadena bloqueante). */
@font-face{font-family:"Source Sans 3";font-style:normal;font-weight:300 700;font-display:swap;src:url(/assets/fonts/source-sans-3.woff2) format("woff2")}
@font-face{font-family:"Source Sans 3";font-style:italic;font-weight:400 700;font-display:swap;src:url(/assets/fonts/source-sans-3-italic.woff2) format("woff2")}
@font-face{font-family:"Newsreader";font-style:normal;font-weight:500 700;font-display:swap;src:url(/assets/fonts/newsreader-500-700.woff2) format("woff2")}
@font-face{font-family:"Cormorant Garamond";font-style:normal;font-weight:500 700;font-display:swap;src:url(/assets/fonts/cormorant-garamond-500-700.woff2) format("woff2")}
@font-face{font-family:"Cormorant Garamond";font-style:italic;font-weight:500;font-display:swap;src:url(/assets/fonts/cormorant-garamond-italic-500.woff2) format("woff2")}

:root {
  --bg: #f5f2ec;
  --surface: #fbf8f3;
  --text: #16122a;
  --text-muted: #5e5872;
  --primary: #6b2bc0;
  --primary-deep: #4a1f88;
  --font-family-body: "Source Sans 3", "Source Sans Pro", ui-sans-serif, sans-serif;
  --font-family-heading: "Newsreader", "Iowan Old Style", Georgia, serif;
}

html:not(.dark),
html:not(.dark) body {
  background-color: var(--bg) !important;
  background-image: none !important;
  color: var(--text);
}

html,
body,
button,
input,
textarea,
select,
[style*="Poppins"],
[style*="Montserrat"] {
  font-family: var(--font-family-body) !important;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-family-heading) !important;
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* 1. Quitar el “glow” violeta/rosa/cian y el lavado de fondo en modo claro */
html:not(.dark) .blur-3xl.animate-pulse,
html:not(.dark) [style*="rgba(107,43,192,0.4)"],
html:not(.dark) [style*="rgba(95,228,222,0.4)"],
html:not(.dark) [style*="rgba(255,76,198,0.3)"],
html:not(.dark) .w-2.h-2.rounded-full.animate-pulse,
html:not(.dark) .w-3.h-3.rounded-full.animate-pulse {
  display: none !important;
}

html:not(.dark) [class*="via-[#F8F7FF]"],
html:not(.dark) [class*="to-[#F0EDFF]"],
html:not(.dark) [class*="via-[#F8F6FF]"],
html:not(.dark) [style*="#F8F6FF"],
html:not(.dark) [style*="#FFF5FA"],
html:not(.dark) [style*="#F8F7FF"] {
  background-image: none !important;
  background-color: var(--bg) !important;
}

/* Titulares sin degradé ni shimmer: el color de marca va sólido */
html:not(.dark) h1.bg-clip-text,
html:not(.dark) h1.text-transparent {
  background-image: none !important;
  -webkit-text-fill-color: #6b2bc0;
  color: #6b2bc0 !important;
  animation: none !important;
  filter: none !important;
}

html:not(.dark) p.bg-clip-text,
html:not(.dark) p.text-transparent.bg-clip-text {
  background-image: none !important;
  -webkit-text-fill-color: #16122a;
  color: #16122a !important;
}

/* 2. CTA principal: el JS del age-gate reescribe el style a rgb(),
   así que no se puede apuntar al hex. Usamos los IDs. */
html:not(.dark) #continue-btn,
html:not(.dark) #continue-btn-footer {
  background: #f5f2ec !important;
  background-image: none !important;
  color: #16122a !important;
  border: 2px solid #6b2bc0 !important;
  opacity: 1 !important;
  box-shadow: none !important;
}

html:not(.dark) #continue-btn span,
html:not(.dark) #continue-btn-footer span,
html:not(.dark) #continue-btn i,
html:not(.dark) #continue-btn-footer i {
  color: #16122a !important;
}

html:not(.dark) #continue-btn[aria-disabled="false"],
html:not(.dark) #continue-btn-footer[aria-disabled="false"] {
  background: #6b2bc0 !important;
  background-image: none !important;
  color: #ffffff !important;
  border-color: #6b2bc0 !important;
}

html:not(.dark) #continue-btn[aria-disabled="false"] span,
html:not(.dark) #continue-btn-footer[aria-disabled="false"] span,
html:not(.dark) #continue-btn[aria-disabled="false"] i,
html:not(.dark) #continue-btn-footer[aria-disabled="false"] i {
  color: #ffffff !important;
}

/* Wordmark del header: degradé violeta→turquesa, ilegible sobre claro */
html:not(.dark) header a.bg-clip-text,
html:not(.dark) a[href="/r?to=explorar-scans"].bg-clip-text {
  background-image: none !important;
  -webkit-text-fill-color: #6b2bc0;
  color: #6b2bc0 !important;
  font-family: var(--font-family-heading) !important;
}

/* Puntos decorativos (siguen en el flujo aunque se oculten los blobs) */
html:not(.dark) [class*="bg-[#FF4CC6]"].rounded-full,
html:not(.dark) [class*="bg-[#5FE4DE]"].rounded-full.animate-pulse,
html:not(.dark) [class*="bg-[#6B2BC0]"].rounded-full.animate-pulse.w-2 {
  display: none !important;
}

/* Cuando el consentimiento está marcado, el botón activo queda sólido (sin degradé animado) */
html:not(.dark) a[style*="#6B2BC0"],
html:not(.dark) button.bg-\[\#6B2BC0\],
html:not(.dark) a.bg-\[\#6B2BC0\] {
  background-image: none !important;
  background-color: #6b2bc0 !important;
}

html:not(.dark) [class*="from-[#6B2BC0]"][class*="via-[#8B5CF6]"],
html:not(.dark) [class*="from-[#6B2BC0]"].group-hover\:opacity-100 {
  background-image: none !important;
}

/* 3. Contraste en modo claro: el turquesa #5FE4DE sobre fondo claro no llega a 4,5:1 (1,54:1) */
html:not(.dark) a.text-\[\#5FE4DE\],
html:not(.dark) button.text-\[\#5FE4DE\],
html:not(.dark) header .text-\[\#5FE4DE\],
html:not(.dark) nav .text-\[\#5FE4DE\],
html:not(.dark) #footer-login-link,
html:not(.dark) #pre-footer-links a[class*="text-[#5FE4DE]"],
html:not(.dark) .text-\[\#5FE4DE\]:not([class*="bg-\[\#6B"]):not([class*="from-\[\#6B"]) {
  color: #4a1f88 !important;
}

/* Wordmark “Reflexa” del header: de turquesa claro a violeta de marca */
html:not(.dark) header a,
html:not(.dark) header span {
  /* no forzar todo el header; solo el turquesa */
}

html:not(.dark) .text-\[\#999999\] {
  color: #5e5872 !important;
}

html:not(.dark) .text-\[\#666666\] {
  color: #5e5872 !important;
}

/* Etiquetas naranja de Contraste: #F97316 / #EA580C sobre blanco no llegan a AA */
html:not(.dark) .text-\[\#f97316\],
html:not(.dark) .text-\[\#F97316\],
html:not(.dark) .text-\[\#ea580c\],
html:not(.dark) .text-\[\#EA580C\] {
  color: #c2410c !important;
}

html:not(.dark) .bg-\[\#f97316\],
html:not(.dark) .bg-\[\#F97316\] {
  background-color: #c2410c !important;
}

/* Texto chico de contenido y el checkbox de 18+ */
html:not(.dark) .text-\[10px\] {
  font-size: 0.875rem !important; /* 14px */
  line-height: 1.4;
}

label:has(#age-consent) {
  min-height: 44px;
}

label:has(#age-consent) .text-xs,
label:has(#age-consent) span[class*="text-xs"] {
  font-size: 1rem !important;
  line-height: 1.5 !important;
  opacity: 1 !important;
}
html:not(.dark) label:has(#age-consent) .text-xs,
html:not(.dark) label:has(#age-consent) span[class*="text-xs"] {
  color: #16122a !important;
}

/* El pre-footer fijo tapaba tarjetas y campos en móvil */
body:has(#pre-footer-links) {
  padding-bottom: 96px;
}

/* Focus visible y movimiento contenido */
:focus-visible {
  outline: 2px solid var(--focus-ring, #6b2bc0) !important;
  outline-offset: 3px;
}

.hover\:scale-105:hover,
.hover\:scale-110:hover,
.group:hover .group-hover\:scale-110,
.group:hover .group-hover\:scale-105 {
  transform: none;
}

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

/* ===== PARTE 2 · MODO CLARO en las reflexas =====
   Papel de la variante A (#E8DFD0) con la tarjeta y el botón violeta de v2.4.
   Sin el óvalo a sangre de A (se superponía al titular en móvil): la estructura queda centrada. */
html.tema-reflexa:not(.dark) {
  --bg: #e8dfd0;
  --surface: #f3ece0;
  --text-muted: #5e5872; /* 5,10:1 sobre #E8DFD0 */
}
html.tema-reflexa:not(.dark),
html.tema-reflexa:not(.dark) body,
html.tema-reflexa:not(.dark) main,
html.tema-reflexa:not(.dark) #welcome-screen,
html.tema-reflexa:not(.dark) .bg-elevare-adaptive {
  background-color: var(--bg) !important;
  background-image: none !important;
}
html.tema-reflexa:not(.dark) header#global-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent) !important;
  border-bottom-color: #c9bba8 !important;
}
html.tema-reflexa:not(.dark) #global-hamburger-btn,
html.tema-reflexa:not(.dark) #tema-toggle {
  background: var(--surface) !important;
}
html.tema-reflexa:not(.dark) #pre-footer-links {
  background: color-mix(in srgb, var(--bg) 92%, transparent) !important;
  border-top-color: #c9bba8 !important;
}
/* Tarjetas de v2.4: superficie clara sobre el papel */
html.tema-reflexa:not(.dark) .glass-card,
html.tema-reflexa:not(.dark) .bg-white:not(.code-section),
html.tema-reflexa:not(.dark) [class*="bg-white/"]:not(.code-section):not(.rounded-full) {
  background-color: var(--surface) !important;
}
html.tema-reflexa:not(.dark) .text-gray-400,
html.tema-reflexa:not(.dark) .text-gray-500 {
  color: var(--text-muted) !important;
}
/* Botón de la reflexa: violeta de marca, sólido */
html.tema-reflexa:not(.dark) #start-btn {
  background: #6b2bc0 !important;
  background-image: none !important;
  color: #ffffff !important;
  border-color: #6b2bc0 !important; /* en Contraste traía borde naranja de 4px */
}
html.tema-reflexa:not(.dark) #start-btn:hover {
  background: #4a1f88 !important;
}
html.tema-reflexa:not(.dark) #welcome-screen h1,
html.tema-reflexa:not(.dark) #welcome-screen h1 span {
  background-image: none !important;
  -webkit-text-fill-color: #16122a;
  color: #16122a !important;
  text-shadow: none !important;
}
html.tema-reflexa:not(.dark) #welcome-screen p {
  color: #3d3650 !important;
}
html.tema-reflexa:not(.dark) .scan-dot.bg-\[\#DADADA\] {
  background: #857763 !important;
}

/* ===== PARTE 3 · MODO OSCURO (variante B, con el morado de marca) ===== */
html.dark {
  --bg: #1b1024;
  --bg-deep: #140b1c;
  --surface: #261830;
  --ink: #f3ede3;        /* 15,7:1 sobre el fondo */
  --ink-soft: #d4c4b0;   /* 10,7:1 */
  --accent: #c4b5fd;     /* lavanda para texto/enlaces: 9,9:1 */
  --oval-stroke: #a78bfa;/* 6,7:1 */
  --action: #6b2bc0;     /* morado de marca, texto blanco 7,7:1 */
  --action-hover: #7c3aed;
  --action-edge: #a78bfa;/* borde del botón: el relleno solo da 2,4:1 contra el fondo */
  --on-action: #ffffff;
  --hairline: rgba(243, 237, 227, 0.18);
  --focus-ring: #c4b5fd;
  --text: var(--ink);
  --text-muted: var(--ink-soft);
  --primary: #6b2bc0;
  --link: var(--accent);
  --font-family-heading: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: dark;
}

html.dark,
html.dark body,
html.dark main,
html.dark #welcome-screen,
html.dark #szr0k2,
html.dark .bg-elevare-adaptive {
  background-color: var(--bg) !important;
  background-image: none !important;
  color: var(--ink);
}

html.dark h1,
html.dark h2,
html.dark h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* Señales IA fuera también en oscuro */
html.dark .blur-3xl,
html.dark [style*="rgba(107,43,192,0.4)"],
html.dark [style*="rgba(95,228,222,0.4)"],
html.dark [style*="rgba(255,76,198,0.3)"],
html.dark .animate-pulse.rounded-full,
html.dark .animate-shine {
  display: none !important;
}

/* Texto sólido, sin degradé ni shimmer */
html.dark h1.bg-clip-text,
html.dark h1.text-transparent,
html.dark h2.bg-clip-text,
html.dark h2.text-transparent,
html.dark h1 span.bg-clip-text,
html.dark h1 span.text-transparent,
html.dark p.bg-clip-text,
html.dark p.text-transparent.bg-clip-text {
  background-image: none !important;
  -webkit-text-fill-color: var(--ink);
  color: var(--ink) !important;
  animation: none !important;
  filter: none !important;
  text-shadow: none !important;
}

/* Header */
html.dark header#global-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent) !important;
  border-bottom-color: var(--hairline) !important;
}
html.dark header a.bg-clip-text,
html.dark a[href="/r?to=explorar-scans"].bg-clip-text {
  background-image: none !important;
  -webkit-text-fill-color: var(--ink);
  color: var(--ink) !important;
  font-family: var(--font-family-heading) !important;
  font-weight: 600 !important;
  font-size: 1.35rem !important;
  letter-spacing: 0.01em;
}
html.dark #global-hamburger-btn,
html.dark #tema-toggle {
  background: transparent !important;
  border: 1px solid var(--hairline) !important;
}
html.dark #global-hamburger-btn i,
html.dark #tema-toggle {
  color: var(--ink) !important;
}
html.dark header ellipse[stroke="currentColor"] {
  color: var(--oval-stroke);
  opacity: 0.6;
}

/* Portada: óvalo fino, titular en serifa, mucho aire */
html.dark #hero-content {
  position: relative !important;
  overflow: hidden !important;
  background: transparent !important;
}
html.dark #hero-content .glass-card,
html.dark #hero-content .shadow-2xl,
html.dark #hero-content .backdrop-blur-2xl {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 0 !important;
}
html.dark #hero-content .logo-shine {
  background: transparent !important;
  border: 1.5px solid var(--oval-stroke) !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  overflow: hidden !important;
  transform: none !important;
}
html.dark #hero-content .logo-shine img,
html.dark #hero-content .logo-shine .animate-shine,
html.dark #hero-content .absolute.inset-0.bg-gradient-to-br {
  display: none !important;
}
html.dark #hero-content h1 {
  font-size: clamp(3.75rem, 14vw, 8rem) !important;
  font-weight: 600 !important;
  line-height: 0.95 !important;
  letter-spacing: -0.03em !important;
  color: var(--ink) !important;
}
html.dark #hero-content p.bg-clip-text,
html.dark #hero-content .hero-initial-content p.text-xl,
html.dark #hero-content .hero-initial-content p.text-2xl,
html.dark #hero-content .hero-initial-content p.text-3xl {
  font-family: var(--font-family-heading) !important;
  font-style: italic;
  font-weight: 500 !important;
  font-size: clamp(1.45rem, 3.2vw, 2.15rem) !important;
  line-height: 1.2 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
}
html.dark #hero-content .glass-card p {
  font-size: 1.125rem !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  color: var(--ink) !important;
}
html.dark #hero-content .font-light,
html.dark #hero-content p.text-sm,
html.dark #hero-content p.opacity-60 {
  font-size: 0.95rem !important;
  color: var(--ink-soft) !important;
  opacity: 1 !important;
}

/* Portada, segunda pantalla: mismo fondo, consentimiento legible, CTA morado */
html.dark #hero-content + div {
  background: var(--bg) !important;
  background-image: none !important;
  color: var(--ink) !important;
}
html.dark #hero-content + div p,
html.dark #hero-content + div span,
html.dark #hero-content + div label {
  color: var(--ink) !important;
  opacity: 1 !important;
}
html.dark #hero-content + div p.text-xl,
html.dark #hero-content + div p.font-bold {
  font-family: var(--font-family-heading) !important;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem) !important;
  line-height: 1.15 !important;
}
html.dark #hero-content + div p.text-xs,
html.dark #hero-content + div p.text-sm,
html.dark #hero-content + div .opacity-70,
html.dark #hero-content + div #home-anon-note {
  color: var(--ink-soft) !important;
  font-size: 1rem !important;
}
html.dark label:has(#age-consent) .text-xs,
html.dark label:has(#age-consent) span[class*="text-xs"] {
  color: var(--ink) !important;
}
html.dark label:has(#age-consent) a,
html.dark label:has(#age-consent) button {
  color: var(--accent) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
html.dark #hero-content + div a:not(#continue-btn):not(#continue-btn-footer),
html.dark #hero-content + div button:not(#continue-btn):not(#continue-btn-footer),
html.dark #footer-login-link,
html.dark a.text-\[\#5FE4DE\],
html.dark button.text-\[\#5FE4DE\] {
  color: var(--accent) !important;
}

html.dark #continue-btn,
html.dark #continue-btn-footer {
  font-weight: 700 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  background-image: none !important;
}
html.dark #continue-btn[aria-disabled="true"],
html.dark #continue-btn-footer[aria-disabled="true"] {
  background: transparent !important;
  color: var(--ink) !important;
  border: 2px solid var(--action-edge) !important;
}
html.dark #continue-btn[aria-disabled="true"] span,
html.dark #continue-btn-footer[aria-disabled="true"] span,
html.dark #continue-btn[aria-disabled="true"] i,
html.dark #continue-btn-footer[aria-disabled="true"] i {
  color: var(--ink) !important;
}
html.dark #continue-btn[aria-disabled="false"],
html.dark #continue-btn-footer[aria-disabled="false"] {
  background: var(--action) !important;
  color: var(--on-action) !important;
  border: 1px solid var(--action-edge) !important;
}
html.dark #continue-btn[aria-disabled="false"] span,
html.dark #continue-btn-footer[aria-disabled="false"] span,
html.dark #continue-btn[aria-disabled="false"] i,
html.dark #continue-btn-footer[aria-disabled="false"] i {
  color: var(--on-action) !important;
}
html.dark #continue-btn[aria-disabled="false"]:hover,
html.dark #continue-btn-footer[aria-disabled="false"]:hover {
  background: var(--action-hover) !important;
}

/* Reflexas (Freno y demás): óvalo fino centrado sobre el titular, botón morado */
html.dark #welcome-screen {
  overflow: hidden;
}
html.dark #welcome-screen {
  --ov-h: min(18rem, 60vw, 24vh);
  --ov-w: calc(var(--ov-h) * 0.72);
  /* el óvalo suma alto: menos aire arriba para que el botón quede sobre el pre-footer */
  padding-top: 88px !important;
  padding-bottom: 104px !important;
}
@media (min-width: 1024px) {
  html.dark #welcome-screen h1,
  html.dark #welcome-screen h1 span {
    font-size: clamp(2.8rem, 5vw, 4rem) !important;
  }
  html.dark #welcome-screen > div > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1.5rem !important;
  }
}
/* El óvalo vive dentro del bloque de texto y reserva su propio alto:
   no puede superponerse al titular en ningún tamaño de pantalla */
html.dark #welcome-screen > div {
  position: relative;
  z-index: 1;
  padding-top: calc(var(--ov-h) + 1.5rem);
}
html.dark #welcome-screen > div::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: var(--ov-w);
  height: var(--ov-h);
  border: 1.5px solid var(--oval-stroke);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.85;
}
html.dark #welcome-screen h1,
html.dark #welcome-screen h1 span {
  font-size: clamp(2.8rem, 10vw, 4.75rem) !important;
  line-height: 0.95 !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
  background: none !important;
  text-shadow: none !important;
}
html.dark #welcome-screen #start-btn {
  background: var(--action) !important;
  background-image: none !important;
  color: var(--on-action) !important;
  border: 1px solid var(--action-edge) !important;
  box-shadow: none !important;
  transform: none !important;
}
html.dark #welcome-screen #start-btn:hover {
  background: var(--action-hover) !important;
}
html.dark #welcome-screen p,
html.dark #welcome-screen a {
  color: var(--ink-soft) !important;
}
html.dark .scan-dot.bg-\[\#6B2BC0\] {
  background: var(--accent) !important;
}
html.dark .scan-dot.bg-\[\#DADADA\] {
  background: #7d6e8c !important; /* 3,9:1 sobre ciruela */
}

/* Resto de pantallas de la reflexa: tarjetas en superficie ciruela, no lila */
html.dark .glass-card:not(#hero-content .glass-card) {
  background: var(--surface) !important;
  border-color: var(--hairline) !important;
  box-shadow: none !important;
}
html.dark .text-\[\#999999\],
html.dark .text-\[\#666666\],
html.dark .text-\[\#555555\] {
  color: var(--ink-soft) !important;
}
html.dark .text-\[\#6B2BC0\],
html.dark .text-\[\#6b2bc0\] {
  color: var(--accent) !important;
}

/* Pre-footer: en B quedaba violeta sobre ciruela (2,4:1). Ahora lavanda/marfil */
html.dark #pre-footer-links {
  background: color-mix(in srgb, var(--bg-deep) 92%, transparent) !important;
  border-top: 1px solid var(--hairline) !important;
  color: var(--ink-soft) !important;
}
html.dark #pre-footer-links a {
  color: var(--accent) !important;
}
html.dark #pre-footer-links span,
html.dark #pre-footer-links p {
  color: var(--ink-soft) !important;
}

/* ===== PARTE 4 · Botón de tema ===== */
#tema-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: #ece6dc;
  color: #4a1f88;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease;
}
#tema-toggle:hover {
  background: #e2d9cb;
}
#tema-toggle svg {
  width: 18px;
  height: 18px;
}
#tema-toggle .tema-icono-sol { display: none; }
html.dark #tema-toggle .tema-icono-sol { display: block; }
html.dark #tema-toggle .tema-icono-luna { display: none; }
.tema-acciones {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Botón de tema flotante (páginas sin header visible, como la portada) */
#tema-toggle.tema-toggle-flotante {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  border-color: rgba(107, 43, 192, 0.25);
}
html.dark #tema-toggle.tema-toggle-flotante {
  background: color-mix(in srgb, var(--bg) 85%, transparent) !important;
}

/* ===== PARTE 5 · Oscuro: secciones de la portada sin degradés lila ===== */
html.dark .code-section[class*="bg-gradient"],
html.dark section[class*="dark:from-"],
html.dark .absolute.inset-0[class*="dark:from-"] {
  background-image: none !important;
  background-color: var(--bg) !important;
}
html.dark [class*="dark:from-white"],
html.dark [class*="dark:bg-white/"]:not(.rounded-full):not(.code-section) {
  background-image: none !important;
  background-color: var(--surface) !important;
  border-color: var(--hairline) !important;
  box-shadow: none !important;
}
/* Etiqueta naranja de Contraste: #C2410C sobre el papel daba 3,9:1 */
html.tema-reflexa:not(.dark) .text-\[\#f97316\],
html.tema-reflexa:not(.dark) .text-\[\#F97316\],
html.tema-reflexa:not(.dark) .text-\[\#ea580c\],
html.tema-reflexa:not(.dark) .text-\[\#EA580C\] {
  color: #9a3412 !important;
}
/* Botones naranja de la serie Contraste: blanco sobre #F97316 da 2,8:1. Mismo naranja, más profundo */
html.dark .bg-\[\#F97316\],
html.dark .bg-\[\#f97316\],
html.dark .dark\:bg-\[\#F97316\] {
  background-color: #c2410c !important;
}
html.dark .hover\:bg-\[\#EA580C\]:hover,
html.dark .dark\:hover\:bg-\[\#EA580C\]:hover {
  background-color: #9a3412 !important;
}
html:not(.dark) .hover\:bg-\[\#EA580C\]:hover {
  background-color: #9a3412 !important;
}

/* Contenedores de pantalla de las reflexas: el violeta #6B2CC0 del oscuro original pasa a ciruela */
html.dark .dark\:bg-\[\#6B2CC0\],
html.dark .dark\:bg-\[\#1B1B1B\] {
  background-color: var(--bg) !important;
}
html.dark .dark\:bg-\[\#6B2CC0\]\/90,
html.dark .dark\:bg-\[\#2D1B4E\]\/90 {
  background-color: color-mix(in srgb, var(--surface) 94%, transparent) !important;
}
/* Puntos de avance inactivos: visibles (3:1) sobre ciruela */
html.dark .rounded-full.dark\:bg-white\/30,
html.dark .rounded-full.dark\:bg-white\/20 {
  background-color: #7d6e8c !important;
}
html.tema-reflexa:not(.dark) .code-section.bg-white {
  background-color: var(--bg) !important;
}
html.tema-reflexa:not(.dark) .rounded-full.bg-\[\#DADADA\],
html.tema-reflexa:not(.dark) .rounded-full.bg-\[\#E5E7EB\] {
  background-color: #857763 !important;
}

/* ===== PARTE 6 · Botones de acción de la serie Contraste en morado de marca =====
   Iggy: el morado es el color de los botones en ambos modos. El naranja queda como
   identidad de la serie (etiqueta, puntos de avance, marcadores), no en los botones. */
html:not(.dark) button.bg-\[\#F97316\],
html:not(.dark) a.bg-\[\#F97316\],
html.dark button.bg-\[\#F97316\],
html.dark a.bg-\[\#F97316\] {
  background-color: #6b2bc0 !important;
  background-image: none !important;
  border-color: #6b2bc0 !important;
  color: #ffffff !important;
}
html:not(.dark) button.bg-\[\#F97316\]:hover,
html:not(.dark) a.bg-\[\#F97316\]:hover {
  background-color: #4a1f88 !important;
  border-color: #4a1f88 !important;
}
html.dark button.bg-\[\#F97316\],
html.dark a.bg-\[\#F97316\] {
  border: 1px solid var(--action-edge) !important;
}
html.dark button.bg-\[\#F97316\]:hover,
html.dark a.bg-\[\#F97316\]:hover {
  background-color: var(--action-hover) !important;
}

/* ===== PARTE 7 · Oscuro: modales de Términos y Privacidad (no traían variante oscura) ===== */
html.dark [id^="modal-"] .bg-white {
  background-color: var(--surface) !important;
  border-color: var(--hairline) !important;
}
html.dark [id^="modal-"] .text-\[\#1A1A1A\],
html.dark [id^="modal-"] .text-\[\#0B0B0F\],
html.dark [id^="modal-"] strong {
  color: var(--ink) !important;
}
html.dark [id^="modal-"] .text-\[\#666666\],
html.dark [id^="modal-"] .text-gray-600 {
  color: var(--ink-soft) !important;
}
html.dark [id^="modal-"] [class*="bg-yellow-50"],
html.dark [id^="modal-"] [class*="bg-green-50"] {
  background-color: var(--bg) !important;
}
html.dark [id^="modal-"] .text-yellow-900,
html.dark [id^="modal-"] .text-yellow-800 {
  color: #fcd9a0 !important;
}
html.dark [id^="modal-"] .text-green-900,
html.dark [id^="modal-"] .text-green-800 {
  color: #b7ecc8 !important;
}

/* Oscuro: casilla de 18+ (el turquesa original pasa a morado de marca) */
html.dark #age-consent + span {
  background: transparent !important;
  border-color: var(--oval-stroke) !important;
}
html.dark #age-consent:checked + span {
  background: var(--action) !important;
  border-color: var(--oval-stroke) !important;
}
html.dark #age-consent:checked + span i {
  color: #ffffff !important;
  opacity: 1 !important;
}

/* ===== v2.8 · ajustes de contraste en oscuro =====
   Botones blancos con texto de marca: el texto pasa a morado profundo (antes lavanda sobre blanco, 1.85:1).
   Botón "Compartir" de las reflexas de contraste: naranja sobre blanco (2.8:1) → contorno claro. */
html.dark a.bg-white.text-\[\#6B2BC0\],
html.dark button.bg-white.text-\[\#6B2BC0\] {
  color: #4b16b8 !important;
}
html.dark .share-scan-btn.bg-white {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

/* ===== v2.8.1 · ejes y cuadrantes de los gráficos de Contraste =====
   Las líneas del gráfico traen "dark:bg-white/30" y caían en la regla de tarjetas ([class*="bg-white/"]),
   así que se pintaban del mismo color que el fondo y desaparecían los ejes y los cuadrantes. */
html.tema-reflexa :is(#results-graph, #self-perception-graph, #graph-area, #graph-container) :is([class*="h-[2px]"], [class*="w-[2px]"]) {
  background-color: #a8987f !important;
}
html.tema-reflexa :is(#results-graph, #self-perception-graph, #graph-area, #graph-container) :is([class*="h-[1px]"], [class*="w-[1px]"]) {
  background-color: #d6c8b2 !important;
}
html.dark :is(#results-graph, #self-perception-graph, #graph-area, #graph-container) :is([class*="h-[2px]"], [class*="w-[2px]"]) {
  background-color: rgba(255, 255, 255, 0.4) !important;
}
html.dark :is(#results-graph, #self-perception-graph, #graph-area, #graph-container) :is([class*="h-[1px]"], [class*="w-[1px]"]) {
  background-color: rgba(255, 255, 255, 0.14) !important;
}
