/* ── Telefonica Sans ──────────────────────────────────────────── */
@font-face { font-family: 'Telefonica Sans'; font-weight: 100; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Hairline.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 100; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Hairline_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 200; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_ExtraLight.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 200; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_ExtraLight_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 300; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Light.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 300; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Light_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 350; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Thin.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 350; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Thin_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 400; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Regular.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 400; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 500; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Medium.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 500; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Medium_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 600; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_DemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 600; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_DemiBold_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 700; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Bold.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 700; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Bold_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 800; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_ExtraBold.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 800; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_ExtraBold_Italic.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 900; font-style: normal;
  src: url('/assets/fonts/Telefonica_Sans_Black.woff2') format('woff2'); }
@font-face { font-family: 'Telefonica Sans'; font-weight: 900; font-style: italic;
  src: url('/assets/fonts/Telefonica_Sans_Black_Italic.woff2') format('woff2'); }

@font-face { font-family: 'Playfair Display'; font-weight: 400 700; font-style: normal;
  src: url('/assets/fonts/PlayfairDisplay.woff2') format('woff2'); }

/* ─────────────────────────────────────────────────────────────
   Fundación IA — estilos
   Paleta Telefónica + tipografía Telefonica Sans + Playfair Display.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg:           radial-gradient(circle, rgb(20 29 50) 0%, rgb(20 29 50) 35%, rgb(0 0 0) 100%);
  --bg-elev:      #131920;
  --ink:          #f0f4f8;
  --ink-dim:      rgba(240, 244, 248, 0.65);
  --ink-faint:    rgba(240, 244, 248, 0.35);
  --accent:       #0066ff;
  --accent-glow:  rgba(1, 157, 244, 0.45);
  --rule:         rgba(240, 244, 248, 0.1);
  --shadow:       0 14px 48px rgba(0, 0, 0, 0.55);

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'Telefonica Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(.2, .7, .2, 1);

  --answer-size: clamp(18px, 2.1vw, 24px);
}
body[data-text-size="s"] { --answer-size: clamp(15px, 1.6vw, 19px); }
body[data-text-size="m"] { --answer-size: clamp(18px, 2.1vw, 24px); }
body[data-text-size="l"] { --answer-size: clamp(22px, 2.6vw, 30px); }

/* Temas */
body[data-theme="oscuro"] {
  --bg:           #0a0a0a;
  --bg-elev:      #171717;
}
body[data-theme="claro"] {
  --bg:           #ffffff;
  --bg-elev:      #ffffff;
  --ink:          #1a1514;
  --ink-dim:      rgba(26, 21, 20, 0.7);
  --ink-faint:    rgba(26, 21, 20, 0.4);
  --rule:         rgba(26, 21, 20, 0.1);
  --shadow:       0 10px 40px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 1px solid var(--accent-glow);
  outline-offset: 2px;
}

/*a.header-logo {
    position: absolute;
    top: 0;
    left: 0;
}*/

a.header-logo img {
    height: 40px;
}
/* ──────────────────────── Escenario 3D / 2D ──────────────────────── */

#stage {
  position: fixed; inset: 0;
  z-index: 0;
  /*mix-blend-mode: screen;*/
}
#stage-canvas {
  display: block; width: 100%; height: 100%;
}
#stage-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%),
    radial-gradient(ellipse at center, transparent 70%, var(--accent-glow) 140%);
  mix-blend-mode: screen;
  opacity: 1;
}
body[data-theme="claro"] #stage-vignette {
  background: radial-gradient(ellipse at center, transparent 65%, rgba(0,0,0,0.08) 100%);
  mix-blend-mode: multiply;
  opacity: 1;
}

/* ──────────────────────── Overlay / layout ──────────────────────── */

#overlay {
  position: relative;
  z-index: 1;
  width: 100%; height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  grid-template-columns: 1fr;
  padding: clamp(18px, 3vw, 36px)!important;
  gap: 16px;
  pointer-events: none;
  padding-top: 0 !important;
    padding-left: 0 !important;
}
#overlay > * { pointer-events: auto; }

/* Marca */
#brand {
  display: inline-flex; align-items: center; gap: 10px;
  justify-self: start;
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding:30px;
}
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}
.brand-title { color: var(--ink); font-weight: 500;}
.brand-sub::before { content: "·"; margin: 0 8px; color: var(--ink-faint); }
.brand-sub, .brand-title{display: none;}

/* Acciones superiores */
#top-actions {
  position: absolute;
  top: clamp(18px, 3vw, 36px);
  right: clamp(18px, 3vw, 36px);
  display: flex; gap: 6px;
}
#top-actions button {
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--ink-dim);
  transition: color .2s var(--ease), background .2s var(--ease);
}
#top-actions button:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
#top-actions svg { width: 18px; height: 18px; }

/* Botón música: alterna icono según estado (.muted = sin música) */
#btn-music .icon-music-off { display: none; }
#btn-music.muted .icon-music-on { display: none; }
#btn-music.muted .icon-music-off { display: inline-block; }
#btn-music.muted { color: var(--ink-faint); }

/* Centro */
#stage-text {
  grid-row: 2;
  align-self: center;
  justify-self: center;
  width: min(780px, 90%);
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  overflow: visible;
}

.hint-initial {
  transition: opacity .8s var(--ease);
}
.hint-initial .hint-line {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 32px);
  color: var(--ink-dim);
  font-weight: 400;
}
.hint-initial .hint-sub {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.hint-hidden { opacity: 0; pointer-events: none; display: none;}

/* Respuesta */
.answer {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--answer-size);
  line-height: 1.45;
  color: var(--ink);
  letter-spacing: 0.005em;
  max-width: 100%;
  opacity: 0;
  transition: opacity .45s var(--ease);
  text-shadow: 0 1px 30px rgba(0,0,0,0.6);
}
.answer.visible { opacity: 1; }
.answer p + p { margin-top: 0.6em; }

/* Modo "sync" */
.answer.sync {
  display: -webkit-box;
  -webkit-line-clamp: var(--text-lines, 4);
  line-clamp: var(--text-lines, 4);
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: min(760px, 92vw);
  transition: opacity .35s var(--ease);
}
.answer.sync p { margin: 0; }

.answer.faded {
  opacity: 0;
  filter: blur(14px);
  transform: translateY(-50px);
  transition: opacity 8s var(--ease), filter 8s var(--ease), transform 8s var(--ease);
  pointer-events: none;
}

/* Modo "off" */
.answer.hidden { display: none !important; }
.answer em { font-style: italic; color: var(--ink-dim); }
.answer strong { color: var(--ink); font-weight: 500; }
.answer h1, .answer h2, .answer h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 0.82em;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.6em;
  margin-bottom: 0.3em;
}
.answer ul, .answer ol {
  list-style: none;
  padding: 0;
  text-align: left;
  display: inline-block;
  margin: 0.3em auto;
}
.answer ul li::before { content: "·"; color: var(--accent); margin-right: 10px; }
.answer ol { counter-reset: i; }
.answer ol li { counter-increment: i; }
.answer ol li::before { content: counter(i) "  "; color: var(--accent); }

/* Cursor de streaming */
.caret {
  display: inline-block;
  width: 0.5ch;
  margin-left: 0.1ch;
  border-right: 2px solid var(--accent);
  animation: blink 1s steps(2) infinite;
  vertical-align: middle;
  height: 0.9em;
}
@keyframes blink { 50% { border-color: transparent; } }

/* Indicador de tool en curso */
.tool-indicator {
  margin-top: 18px;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  min-height: 14px;
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.tool-indicator.visible { opacity: 1; }
.tool-indicator::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 10px;
  vertical-align: middle;
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.4); }
}

/* ──────────────────────── Archivos losas ──────────────────────── */

#archivos-layer {
  position: absolute;
  left: 50%;
  bottom: 180px;
  transform: translateX(-50%);
  display: flex; gap: 14px;
  max-width: 90%;
  overflow-x: auto;
  padding: 10px 4px;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}
#archivos-layer::-webkit-scrollbar { height: 6px; }
#archivos-layer::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 3px; }

.losa {
  flex: 0 0 auto;
  width: 160px; height: 110px;
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow), 0 0 0 1px var(--rule);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: losa-in .8s var(--ease) forwards;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.losa:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-glow);
}
@keyframes losa-in {
  to { opacity: 1; transform: translateY(0); }
}
.losa img, .losa .losa-icon {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
  transition: filter .4s var(--ease);
}
.losa:hover img { filter: saturate(1.1); }
.losa .losa-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-dim);
}
.losa .losa-icon svg { width: 36px; height: 36px; }
.losa .losa-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ──────────────────────── Input ──────────────────────── */

#input-form {
  grid-row: 3;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  position: relative;
  width: min(1024px, 92%);
  padding: 10px 14px 8px;
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}
#input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
}
body[data-theme="claro"] #input-form {
  background: rgba(255, 253, 249, 0.9);
}
#input-form:focus-within {
  border-color: rgba(1, 157, 244, 0.4);
  box-shadow: var(--shadow), 0 0 0 4px rgba(1, 157, 244, 0.08);
}
#input-form.listening {
  border-color: rgba(1, 157, 244, 0.7);
  box-shadow: var(--shadow), 0 0 0 5px rgba(1, 157, 244, 0.15);
}
#input-field {
  flex: 1;
  background: transparent;
  border: 0;
  resize: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  max-height: 160px;
  padding: 8px 0;
  overflow: hidden;
}
#input-field::placeholder { color: var(--ink-faint); }
#input-field:focus { outline: none; }

#btn-mic, #btn-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--ink-dim);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
#btn-mic:hover, #btn-send:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
#btn-mic.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(1, 157, 244, 0.18);
}
#btn-mic svg, #btn-send svg { width: 18px; height: 18px; }
#btn-send:disabled { opacity: 0.4; cursor: not-allowed; }
#btn-send.sending .icon-send { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toggle enviar ↔ stop */
#btn-send .icon-stop { display: none; }
#btn-send.speaking {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(1, 157, 244, 0.18);
  opacity: 1;
  cursor: pointer;
}
#btn-send.speaking .icon-send { display: none; }
#btn-send.speaking .icon-stop { display: inline-block; animation: none; }
#btn-send.speaking:disabled { opacity: 1; cursor: pointer; }

#input-hint {
  grid-row: 4;
  justify-self: center;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 4px;
  transition: color .25s ease;
}
#input-hint.hint-error {
  color: #d66;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 12px;
}

/* ── Tabs de categorías ── */
#cat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px 0 2px;
  border-top: 1px solid var(--rule);
  margin-top: 6px;
}
#cat-tabs::-webkit-scrollbar { display: none; }
#cat-tabs:empty { display: none; border-top: none; margin-top: 0; }

.cat-tab {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-dim);
  font-size: 12px;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.cat-tab:hover { color: var(--ink); border-color: rgba(1,157,244,0.5); }
.cat-tab.active {
  color: var(--ink);
  border-color: rgba(1,157,244,0.6);
  background: rgba(1,157,244,0.08);
}

/* ── Dropdown de subcategorías ── */
#cat-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(1,157,244,0.25);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  z-index: 10;
}
#cat-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
body[data-theme="claro"] #cat-dropdown {
  background: rgba(255,253,249,0.95);
}
.cat-dropdown-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 2px;
}
.cat-dropdown-item {
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  font-size: 13px;
  font-family: var(--font-sans);
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.cat-dropdown-item:hover {
  color: var(--ink);
  border-color: rgba(1,157,244,0.5);
  background: rgba(1,157,244,0.06);
}

/* ──────────────────────── Drawers ──────────────────────── */

#history-drawer, #docs-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: var(--bg-elev);
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  transition: transform .35s var(--ease);
  z-index: 40;
  display: flex; flex-direction: column;
}
#history-drawer.open, #docs-drawer.open { transform: translateX(0); }
#history-backdrop, #docs-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
  z-index: 39;
}
#history-backdrop.open, #docs-backdrop.open {
  opacity: 1; pointer-events: auto;
}

.drawer-head {
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}
.drawer-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.01em;
}
.drawer-head button {
  width: 32px; height: 32px; border-radius: 50%;
  color: var(--ink-dim);
}
.drawer-head button:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.drawer-head svg { width: 16px; height: 16px; }

.drawer-body {
  flex: 1;
  padding: 20px 24px 40px;
  overflow-y: auto;
}

/* Historial */
.hist-msg {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.hist-msg:last-child { border-bottom: 0; }
.hist-msg .role {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.hist-msg.user .role { color: var(--accent); }
.hist-msg .body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.hist-msg.user .body {
  font-family: var(--font-sans);
}
.hist-msg.assistant .body {
  font-family: var(--font-serif);
  font-weight: 400;
}
.hist-empty {
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
  padding: 40px 20px;
  font-style: italic;
}

/* ──────────────────────── Lightbox ──────────────────────── */

#lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
#lightbox.open { display: flex; }
#lb-content {
  max-width: 92vw; max-height: 85vh;
  display: flex; align-items: center; justify-content: center;
}
#lb-content img, #lb-content iframe {
  max-width: 92vw; max-height: 85vh;
  background: #fff;
  box-shadow: 0 10px 60px rgba(0,0,0,0.6);
}
#lb-content iframe { width: 85vw; height: 85vh; }
#lb-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease);
}
#lb-close:hover { background: rgba(255,255,255,0.16); }
#lb-close svg { width: 20px; height: 20px; }
#lb-info {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--ink-dim);
  background: rgba(0,0,0,0.6);
  padding: 6px 14px;
  border-radius: 999px;
  max-width: 80vw;
  text-align: center;
}

/* ──────────────────────── Responsive ──────────────────────── */

@media (max-width: 640px) {
  #stage-text { min-height: 30vh; }
  .answer { font-size: 20px; }
  #suggestions { bottom: 160px; max-width: 92%; }
  #archivos-layer { bottom: 210px; gap: 10px; }
  .losa { width: 130px; height: 88px; }
  #brand .brand-sub { display: none; }
  a.header-logo img {
      height: 30px;
  }
  #input-form {
      width: 100%;
      max-width: 350px;
  }
  #input-hint{display:none;}
  #btn-docs {
      bottom: 33px;
      right: 9px;
      z-index: 30;
      width: 34px;
      height: 34px;
  }
}

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

/* ──────────────────────── Onboarding ──────────────────────── */

body[data-onboarding="1"] #overlay,
body[data-onboarding="1"] #stage {
  opacity: 0;
  pointer-events: none;
}

body:not([data-boot="reveal"]) #overlay,
body:not([data-boot="reveal"]) #stage {
  opacity: 0;
}

#onboarding {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 32px;
  animation: onb-in .8s var(--ease);
}
#onboarding .step {
  width: 100%;
  max-width: 620px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  animation: onb-step .7s var(--ease) forwards;
}
#onboarding h1 {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 32px);
  color: var(--ink-dim);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
#onboarding p.sub {
  color: var(--ink-dim);
  font-size: 15px;
  margin-bottom: 28px;
}
#onboarding .onb-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 14px 4px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 22px;
  text-align: center;
  transition: border-color .3s var(--ease);
  margin-bottom: 22px;
}
#onboarding .onb-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
#onboarding .onb-primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 12px 28px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .25s var(--ease), transform .2s var(--ease);
}
#onboarding .onb-primary:hover:not(:disabled) { transform: translateY(-1px); }
#onboarding .onb-primary:disabled { opacity: 0.35; cursor: not-allowed; }
#onboarding .opts {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
#onboarding .opt {
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--ink-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s var(--ease);
  background: transparent;
}
#onboarding .opt:hover {
  color: var(--ink);
  border-color: rgba(1, 157, 244, 0.5);
}
#onboarding .opt.big {
  padding: 18px 22px;
  font-size: 17px;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
}
#onboarding .loader-dots {
  margin-top: 24px;
  display: inline-flex;
  gap: 10px;
  justify-content: center;
}
#onboarding .loader-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.1s ease-in-out infinite;
}
#onboarding .loader-dots span:nth-child(2) { animation-delay: .15s; }
#onboarding .loader-dots span:nth-child(3) { animation-delay: .30s; }

@keyframes onb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes onb-step {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

body[data-boot="reveal"] #stage        { animation: reveal-stage 1.4s var(--ease) 0s both; }
body[data-boot="reveal"] #brand        { animation: reveal .9s var(--ease) .00s both; }
body[data-boot="reveal"] #top-actions  { animation: reveal .9s var(--ease) .15s both; }
body[data-boot="reveal"] #stage-text   { animation: reveal .9s var(--ease) .30s both; }
body[data-boot="reveal"] #input-form   { animation: reveal .9s var(--ease) .55s both; }
body[data-boot="reveal"] #input-hint   { animation: reveal .9s var(--ease) .70s both; }
body[data-boot="reveal"] #suggestions  { animation: reveal .9s var(--ease) .85s both; }

@keyframes reveal-stage {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ──────────────────────── PIN screen ──────────────────────── */

.pin-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 20px;
}
.pin-digit {
  width: 44px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-sans, sans-serif);
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.pin-digit::-webkit-inner-spin-button,
.pin-digit::-webkit-outer-spin-button { -webkit-appearance: none; }
.pin-digit:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-dim, rgba(0,102,255,.15)); }
.pin-error {
  color: #ff4d4d;
  font-size: 13px;
  min-height: 20px;
  text-align: center;
  margin-top: 6px;
}
.shake { animation: pin-shake .35s ease; }
@keyframes pin-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-7px); }
  60%      { transform: translateX(7px); }
}

/* ──────────────────────── Docs floating button ──────────────────────── */

#btn-docs {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card, rgba(19,25,32,.98));
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#btn-docs svg { width: 18px; height: 18px; }
#btn-docs:hover { color: var(--ink); border-color: var(--accent, #0066ff); transform: scale(1.08); }

/* ──────────────────────── Interface switcher ──────────────────────── */

#btn-switch-interface {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--ink-dim);
  text-decoration: none;
  transition: color .2s, background .2s;
}
#btn-switch-interface svg { width: 18px; height: 18px; }
#btn-switch-interface:hover { color: var(--ink); background: rgba(255,255,255,0.07); }

/* ──────────────────────── Docs list items ──────────────────────── */

.docs-loading { color: var(--ink-faint); font-size: 13px; padding: 12px 0; }
.docs-empty   { color: var(--ink-faint); font-size: 13px; padding: 12px 0; }

.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  text-decoration: none;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover .doc-title { color: var(--accent, #0066ff); }
.doc-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.doc-info { flex: 1; min-width: 0; }
.doc-title {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  transition: color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }

@media (max-width: 640px) {
  #btn-docs {
      bottom: 33px;
      right: 9px;
      z-index: 30;
      width: 34px;
      height: 34px;
  }
}

/* ─── Driver.js tour ─────────────────────────────────────── */
/* El overlay queda en opacity:0 (configurado en JS); solo estilizamos el popover */
.ada-tour-popover.driver-popover {
  background: rgba(8, 8, 18, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-width: 280px;
}
.ada-tour-popover .driver-popover-title {
  font-family: var(--font-brand, inherit);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}
.ada-tour-popover .driver-popover-description {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}
.ada-tour-popover .driver-popover-progress-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}
.ada-tour-popover .driver-popover-footer button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ada-tour-popover .driver-popover-footer button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.ada-tour-popover .driver-popover-arrow-side-top.driver-popover-arrow    { border-top-color:    rgba(255,255,255,0.1); }
.ada-tour-popover .driver-popover-arrow-side-bottom.driver-popover-arrow { border-bottom-color: rgba(255,255,255,0.1); }
.ada-tour-popover .driver-popover-arrow-side-left.driver-popover-arrow   { border-left-color:   rgba(255,255,255,0.1); }
.ada-tour-popover .driver-popover-arrow-side-right.driver-popover-arrow  { border-right-color:  rgba(255,255,255,0.1); }

/* ─── Legal links ────────────────────────────────────────── */
.pin-legal {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; margin-top: 20px;
}
#legal-links {
  position: fixed; bottom: 18px; left: 24px;
  z-index: 30; display: flex; align-items: center; gap: 8px;
}
.legal-link {
  background: none; border: none; padding: 0;
  font-family: var(--font-sans); font-size: 11px;
  color: var(--ink-faint); cursor: pointer;
  text-underline-offset: 2px;
  transition: color .2s var(--ease);
}
.legal-link:hover { color: var(--ink-dim); }
.legal-sep { font-size: 11px; color: var(--ink-faint); opacity: .5; user-select: none; }

#legal-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center;
  z-index: 10100;
}
#legal-modal.open { display: flex; }
#legal-modal-box {
  background: var(--bg-card, rgba(19,25,32,.98));
  border: 1px solid var(--rule); border-radius: 12px;
  width: min(720px, 92vw); max-height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 80px rgba(0,0,0,.7);
}
#legal-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; border-bottom: 1px solid var(--rule); flex-shrink: 0;
}
#legal-modal-title {
  font-family: var(--font-sans); font-size: 14px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink);
}
#legal-modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.06); border: none; color: var(--ink-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s var(--ease); flex-shrink: 0;
}
#legal-modal-close:hover { background: rgba(255,255,255,.14); }
#legal-modal-close svg { width: 16px; height: 16px; }
#legal-modal-body { overflow-y: auto; padding: 24px; flex: 1; }
#legal-modal-body::-webkit-scrollbar { width: 4px; }
#legal-modal-body::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }
#legal-modal-body .legal-content h1 {
  font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 18px;
  letter-spacing: .06em; text-transform: uppercase;
}
#legal-modal-body .legal-content h2 {
  font-size: 12px; font-weight: 600; color: var(--ink); margin: 18px 0 8px;
  letter-spacing: .08em; text-transform: uppercase;
}
#legal-modal-body .legal-content p {
  font-size: 13px; line-height: 1.7; color: var(--ink-dim); margin-bottom: 10px;
}
#legal-modal-body .legal-content strong { color: var(--ink); }
#legal-modal-body .legal-content .legal-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin: 12px 0 16px;
}
#legal-modal-body .legal-content .legal-table th,
#legal-modal-body .legal-content .legal-table td {
  padding: 8px 10px; text-align: left; border: 1px solid var(--rule);
  color: var(--ink-dim); vertical-align: top; line-height: 1.5;
}
#legal-modal-body .legal-content .legal-table th {
  background: rgba(255,255,255,.06); color: var(--ink); font-weight: 600;
}
#legal-backdrop { position: fixed; inset: 0; z-index: 10099; display: none; }
#legal-backdrop.open { display: block; }

@media (max-width: 640px) {
  #legal-links { bottom: 10px; left: 12px; gap: 6px; }
  .legal-link { font-size: 10px; }
  #legal-modal { align-items: flex-end; }
  #legal-modal-box {
    width: 100vw; max-height: 90vh;
    border-radius: 12px 12px 0 0;
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0;
  }
}
