/* ==========================================================================
   NUV1A THERMAL — estilos
   Oscuro por defecto (estilo x.ai / SpaceX), con modo claro.
   Marca: azul #1E40AF, cian #06B6D4, grafito #1F2328. Lexend Exa (títulos),
   Inter (texto), JetBrains Mono (etiquetas).
   ========================================================================== */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lexend Exa"; font-weight: 600; font-display: swap; src: url("/fonts/lexend-exa-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url("/fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-2: #0A0C0F;
  --surface: #0F1216;
  --surface-2: #151A20;
  --text: #F4F6F8;
  --muted: #A3ACB9;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #22D3EE;
  --btn-bg: #FFFFFF;
  --btn-text: #000000;
  --header-bg: rgba(0, 0, 0, 0.62);
  --chip-bg: rgba(255, 255, 255, 0.06);
  --focus: #22D3EE;
  --tex-opacity: 0.10;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --bg-2: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #EEF4FB;
  --text: #0B0D10;
  --muted: #4B5563;
  --line: rgba(11, 13, 16, 0.10);
  --line-strong: rgba(11, 13, 16, 0.24);
  --accent: #0E7490;
  --btn-bg: #0B0D10;
  --btn-text: #FFFFFF;
  --header-bg: rgba(255, 255, 255, 0.72);
  --chip-bg: rgba(11, 13, 16, 0.05);
  --focus: #1E40AF;
  --tex-opacity: 0.9;
}

:root {
  --f-display: "Lexend Exa", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --container: 1200px;
  --pad: clamp(20px, 4vw, 40px);
  --radius: 18px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
ul, ol { margin: 0; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 10px 16px; background: var(--btn-bg); color: var(--btn-text); border-radius: 999px; }
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--pad); }
.container--narrow { max-width: 820px; }

/* ---------- tipografía ---------- */
.label {
  margin: 0 0 14px;
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.label::before { content: "// "; color: var(--accent); }
.display {
  font-family: var(--f-display);
  font-size: clamp(2rem, 1rem + 4.4vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}
.display--sm { font-size: clamp(1.9rem, 1.1rem + 3vw, 3.4rem); }
.title {
  font-family: var(--f-display);
  font-size: clamp(1.55rem, 1rem + 2.2vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
}
.title--page { font-size: clamp(1.9rem, 1.1rem + 3vw, 3.2rem); margin-bottom: 18px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px;
  border-radius: 999px; border: 1px solid transparent;
  font: 600 0.95rem/1 var(--f-body); letter-spacing: 0.01em;
  text-decoration: none; cursor: pointer;
  transition: transform .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn--primary { background: var(--btn-bg); color: var(--btn-text); }
.btn--primary:hover { color: var(--btn-text); transform: translateY(-1px); opacity: .9; }
.btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--text); color: var(--text); }
.btn--on-media { border-color: rgba(255,255,255,.4); color: #fff; }
.btn--on-media:hover { border-color: #fff; color: #fff; }
.btn--sm { min-height: 40px; padding: 0 18px; font-size: 0.875rem; }
.btn--lg { min-height: 54px; padding: 0 28px; font-size: 1rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-row--center { justify-content: center; }

/* ---------- encabezado ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  transition: background-color .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled, .nav-open .site-header {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--line);
}
.site-header__inner { height: 100%; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; margin-right: auto; min-height: 44px; }
.brand__logo { height: 28px; width: auto; }
.brand__logo--light { display: none; }
:root[data-theme="light"] .brand__logo--light { display: block; }
:root[data-theme="light"] .brand__logo--dark { display: none; }
/* sobre el hero (antes de bajar) el encabezado siempre va en versión oscura */
:root[data-theme="light"] .site-header:not(.is-scrolled) .brand__logo--light { display: none; }
:root[data-theme="light"] .site-header:not(.is-scrolled) .brand__logo--dark { display: block; }
:root[data-theme="light"] body.no-hero .site-header .brand__logo--light { display: block; }
:root[data-theme="light"] body.no-hero .site-header .brand__logo--dark { display: none; }

.site-nav { display: flex; gap: 28px; }
.site-nav a {
  font-size: 0.9rem; font-weight: 500; text-decoration: none; color: var(--muted);
  min-height: 44px; display: inline-flex; align-items: center;
}
.site-nav a:hover { color: var(--text); }
.site-header:not(.is-scrolled) .site-nav a { color: rgba(255,255,255,.78); }
.site-header:not(.is-scrolled) .site-nav a:hover { color: #fff; }
.site-header__actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle, .nav-toggle {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); cursor: pointer;
}
.site-header:not(.is-scrolled) .theme-toggle, .site-header:not(.is-scrolled) .nav-toggle { color: #fff; border-color: rgba(255,255,255,.35); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle__moon { display: none; }
:root[data-theme="light"] .theme-toggle__sun { display: none; }
:root[data-theme="light"] .theme-toggle__moon { display: block; }

.nav-toggle { display: none; order: 3; }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 18px; height: 1.6px; background: currentColor; border-radius: 2px; position: relative; transition: transform .25s var(--ease), opacity .2s;
}
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-open .nav-toggle__bars { background: transparent; }
.nav-open .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 959px) {
  .site-header__inner { gap: 10px; }
  .nav-toggle { display: inline-grid; }
  .site-header__actions .btn { display: none; }
  /* sin JS el menú queda visible como fila; con JS se vuelve panel */
  .site-nav { position: absolute; top: var(--header-h); left: 0; right: 0; flex-wrap: wrap; gap: 0 18px; padding: 0 var(--pad) 10px; background: var(--header-bg); }
  .js .site-nav {
    display: none; flex-direction: column; gap: 0; padding: 8px var(--pad) 24px;
    background: var(--bg); border-bottom: 1px solid var(--line); height: calc(100svh - var(--header-h)); overflow-y: auto;
  }
  .js.nav-open .site-nav { display: flex; }
  .js .site-nav a, .nav-open .site-header .site-nav a { color: var(--text); font-family: var(--f-display); font-size: 1.35rem; min-height: 64px; border-bottom: 1px solid var(--line); }
  .nav-open .site-header .theme-toggle, .nav-open .site-header .nav-toggle { color: var(--text); border-color: var(--line-strong); }
  .nav-open .brand__logo--light { display: none; }
  :root[data-theme="light"].nav-open .site-header .brand__logo--light { display: block; }
  :root[data-theme="light"].nav-open .site-header .brand__logo--dark { display: none; }
}
@media (min-width: 960px) { .brand__logo { height: 32px; } }

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: flex; align-items: flex-end;
  color: #fff; background: #000; overflow: hidden; isolation: isolate;
}
.hero__media { position: absolute; inset: 0; z-index: -1; }
.media-cover, .media-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero__media .media-cover { position: absolute; inset: 0; }
.hero__shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, #000 0%, rgba(0,0,0,.72) 28%, rgba(0,0,0,.25) 62%, rgba(0,0,0,.55) 100%),
    radial-gradient(120% 80% at 80% 20%, rgba(6,182,212,.18), transparent 60%);
}
.hero__content { padding-top: calc(var(--header-h) + 40px); padding-bottom: clamp(56px, 10vh, 112px); }
.hero .display { max-width: 15ch; margin-bottom: 22px; }
.hero__lead { max-width: 52ch; font-size: clamp(1.02rem, .95rem + .4vw, 1.2rem); color: rgba(255,255,255,.82); margin-bottom: 30px; }
.label--on-media { color: rgba(255,255,255,.75); }
.label--on-media::before { color: #22D3EE; }
.hero .btn--primary { background: #fff; color: #000; }
.hero__scroll {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: 44px; height: 44px; display: grid; place-items: center; color: rgba(255,255,255,.7);
}
.hero__scroll span { width: 1.5px; height: 26px; background: currentColor; position: relative; overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .hero__scroll span::after { content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: #fff; animation: drip 2.2s var(--ease) infinite; }
}
@keyframes drip { to { top: 100%; } }

/* ---------- cifras ---------- */
.stats { border-bottom: 1px solid var(--line); }
.stats__grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.stat { padding: 34px 0; border-top: 1px solid var(--line); }
.stat:nth-child(odd) { padding-right: 16px; }
.stat__value { font-family: var(--f-display); font-size: clamp(1.7rem, 1.1rem + 2vw, 2.6rem); line-height: 1; margin-bottom: 10px; }
.stat__label { color: var(--muted); font-size: 0.9rem; margin: 0; max-width: 24ch; }
@media (min-width: 900px) {
  .stats__grid { grid-template-columns: repeat(4, 1fr); }
  .stat { border-top: 0; padding: 48px 24px 48px 0; }
  .stat + .stat { border-left: 1px solid var(--line); padding-left: 24px; }
}

/* ---------- secciones ---------- */
.section { padding: clamp(72px, 10vw, 140px) 0; }
.section--tight { padding: 0 0 clamp(72px, 9vw, 120px); }
.section--band { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section__head { margin-bottom: clamp(36px, 5vw, 64px); max-width: 760px; }
.section__head--row { display: flex; flex-wrap: wrap; gap: 12px 40px; align-items: flex-end; justify-content: space-between; max-width: none; }

/* servicios */
.services { display: grid; gap: 20px; }
@media (min-width: 960px) { .services { grid-template-columns: repeat(3, 1fr); } }
.service {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.service:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.service__media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.service__media img { transition: transform .8s var(--ease); }
.service:hover .service__media img { transform: scale(1.04); }
.service__body { padding: 26px 24px 28px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.service__num { font-family: var(--f-mono); font-weight: 600; font-size: 0.8rem; color: var(--accent); margin: 0; }
.service__title { font-family: var(--f-display); font-size: 1.25rem; line-height: 1.2; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.chips li { font-size: 0.8rem; padding: 6px 12px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--line); color: var(--muted); }

/* proceso */
.steps { list-style: none; display: grid; gap: 0; counter-reset: s; }
.step { padding: 28px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.step__num { font-family: var(--f-mono); font-weight: 600; font-size: 0.8rem; color: var(--accent); }
.step__title { font-family: var(--f-display); font-size: 1.15rem; }
@media (min-width: 900px) {
  .steps { grid-template-columns: repeat(4, 1fr); }
  .step { padding: 32px 28px 8px 0; }
  .step + .step { padding-left: 28px; border-left: 1px solid var(--line); }
}

/* sectores */
.sectors { display: grid; gap: 16px; }
@media (min-width: 700px) { .sectors { grid-template-columns: repeat(2, 1fr); } }
.sector {
  padding: 30px 28px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface-2), var(--surface) 60%);
  min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  transition: border-color .3s var(--ease);
}
.sector:hover { border-color: var(--line-strong); }
.sector__title { font-family: var(--f-display); font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); }

/* medición (dividido) */
.split { display: grid; gap: clamp(32px, 5vw, 72px); align-items: center; }
@media (min-width: 960px) { .split { grid-template-columns: 1.05fr 1fr; } .split--map { grid-template-columns: 1fr 1.1fr; } }
.split__media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: var(--surface-2); }
.split__body .title { margin-bottom: 18px; }
.spec-list { list-style: none; margin: 26px 0; border-top: 1px solid var(--line); }
.spec-list li { display: grid; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 600px) { .spec-list li { grid-template-columns: 220px 1fr; gap: 16px; } }
.spec-list__name { font-weight: 600; }

/* señales */
.signals { display: grid; gap: 16px; }
@media (min-width: 700px) { .signals { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .signals { grid-template-columns: repeat(3, 1fr); } }
.signal { padding: 26px 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: grid; gap: 10px; align-content: start; }
.signal__num { font-family: var(--f-mono); font-weight: 600; font-size: 0.8rem; color: var(--accent); }
.signal__title { font-family: var(--f-display); font-size: 1.1rem; line-height: 1.25; }

/* galería horizontal */
.gallery {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: var(--pad);
  padding: 4px var(--pad) 18px; margin: 0 auto; max-width: calc(var(--container) + 2 * var(--pad));
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
/* Todas las fotos a la misma altura; las verticales (tableros) se muestran completas en 3:4. */
.gallery { --gh: min(60vw, 315px); align-items: flex-start; }
.gallery__item { flex: 0 0 auto; width: calc(var(--gh) * 4 / 3); margin: 0; scroll-snap-align: start; }
.gallery__item--tall { width: calc(var(--gh) * 3 / 4); }
.gallery__item picture { display: block; height: var(--gh); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.gallery__item figcaption { margin-top: 12px; font-size: 0.9rem; color: var(--muted); }

/* cobertura */
.facts { margin: 28px 0 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--f-mono); font-weight: 600; font-size: 0.75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.facts dd { margin: 0; }
.map-wrap { display: grid; gap: 12px; }
.map { height: clamp(320px, 42vw, 460px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.map__fallback { padding: 24px; color: var(--muted); }
:root[data-theme="dark"] .map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.map .leaflet-container, .leaflet-container { font-family: var(--f-body); background: var(--surface-2); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(0,0,0,.7) !important; color: #c9d1db; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #22D3EE; }
:root[data-theme="dark"] .leaflet-bar a { background: #0F1216; color: #F4F6F8; border-bottom-color: rgba(255,255,255,.12); }

/* cierre */
.cta { position: relative; padding: clamp(96px, 14vw, 180px) 0; text-align: center; overflow: hidden; isolation: isolate; }
.cta__bg {
  position: absolute; inset: 0; z-index: -1; opacity: var(--tex-opacity);
  background: url("/img/textura-thermal-2400.webp") right bottom / cover no-repeat;
}
:root[data-theme="dark"] .cta__bg { filter: invert(1) hue-rotate(180deg); }
.cta__inner { display: grid; justify-items: center; gap: 4px; }
.cta .label { justify-self: center; }
.cta .display { margin-bottom: 16px; }
.cta__lead { max-width: 54ch; margin: 0 auto 28px; }
.cta .btn-row { margin-bottom: 18px; }

/* páginas legales */
body.no-hero main { padding-top: var(--header-h); }
.legal-hero { padding-bottom: 40px; }
.legal-hero--404 { min-height: 60vh; }
.legal-hero .btn-row { margin-top: 26px; }
.legal { max-width: 72ch; }
.legal h2 { font-family: var(--f-display); font-size: 1.2rem; margin: 44px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.legal h2:first-child { margin-top: 0; }
.legal h3 { font-size: 1rem; margin: 26px 0 10px; }
.legal p, .legal li { color: var(--muted); }
.legal strong { color: var(--text); font-weight: 600; }
.legal ul { padding-left: 1.2em; margin: 0 0 1rem; display: grid; gap: 8px; }
.legal a { color: var(--accent); }
.legal code { font-family: var(--f-mono); font-size: .85em; padding: 1px 6px; border-radius: 6px; background: var(--chip-bg); }

/* pie */
.site-footer { border-top: 1px solid var(--line); padding: 64px 0 28px; }
.site-footer__grid { display: grid; gap: 36px; }
@media (min-width: 900px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.site-footer__brand .brand__logo { height: 28px; margin-bottom: 16px; }
.site-footer__brand p { margin-bottom: 8px; }
.plain-list { list-style: none; display: grid; gap: 2px; margin-bottom: 12px; }
.plain-list a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; color: var(--muted); }
.plain-list a:hover, .plain-list a[aria-current="page"] { color: var(--text); }
.site-footer__bottom { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.site-footer__bottom a { color: inherit; }

/* ---------- aparición suave (solo con JS y sin reducción de movimiento) ---------- */
.reveal-ready [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal-ready [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- botón por servicio ---------- */
.service__cta { align-self: flex-start; margin-top: 8px; }
.service__cta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- cuestionario ---------- */
.quiz {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--text); overflow: auto;
}
.quiz::backdrop { background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
html.quiz-open { overflow: hidden; }
.quiz__form { padding: 28px 24px 24px; display: grid; gap: 22px; }
.quiz__head { position: relative; padding-right: 44px; }
.quiz__head .label { margin-bottom: 8px; }
.quiz__title { font-family: var(--f-display); font-size: clamp(1.3rem, 1rem + 1.4vw, 1.7rem); line-height: 1.15; margin-bottom: 8px; }
.quiz__close {
  position: absolute; top: -6px; right: -6px; width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.q { border: 0; margin: 0; padding: 0; min-width: 0; }
.q legend, .field { font-weight: 600; font-size: .98rem; margin-bottom: 10px; padding: 0; }
.q-group { display: grid; gap: 22px; }
.q-group[hidden] { display: none; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--chip-bg); font-size: .92rem; font-weight: 500; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.opt input:checked + span { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.field { display: grid; gap: 8px; }
.field input, .field textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; min-height: 46px; width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.is-missing legend, .field.is-missing { color: #F87171; }
:root[data-theme="light"] .is-missing legend, :root[data-theme="light"] .field.is-missing { color: #B91C1C; }
.field.is-missing input { border-color: currentColor; }
.quiz__error { color: #F87171; font-weight: 600; margin: -8px 0 0; }
:root[data-theme="light"] .quiz__error { color: #B91C1C; }
.quiz__hint { margin: -6px 0 0; }
.quiz__actions { position: sticky; bottom: -24px; margin: 0 -24px -24px; padding: 16px 24px 24px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.quiz__actions .btn { width: 100%; }
@media (max-width: 600px) {
  .quiz { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; border: 0; }
  .quiz__form { padding: 20px 16px 16px; }
  .quiz__actions { margin: 0 -16px -16px; padding: 14px 16px 18px; }
}

/* --- Mika Lite: encabezado y vista previa del mensaje --- */
.mika-lite { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mika-lite__avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; background: #000; box-shadow: 0 0 0 2px var(--accent); }
.mika-lite .label { margin: 0 0 4px; }
.mika-lite .quiz__title { margin: 0; }
.quiz__preview { padding: 28px 24px 24px; display: grid; gap: 18px; }
.quiz__preview[hidden], .quiz__form[hidden] { display: none; }
.quiz__msg {
  width: 100%;
  min-height: 260px;
  padding: 14px;
  font: 15px/1.55 var(--f-body, inherit);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  resize: vertical;
}
.quiz__msg:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.quiz__copied { color: var(--accent); font-weight: 600; margin: -6px 0 0; }
.quiz__actions--stack { display: grid; gap: 10px; }
.quiz__actions--stack .btn { width: 100%; justify-content: center; }
@media (max-width: 600px) { .quiz__preview { padding: 20px 16px 16px; } }
