/* Respaldo para equipos sin Segoe UI (celulares, Mac, Linux). Open Sans, licencia OFL. */
@font-face {
  font-family: "Lucy Respaldo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/static/fuentes/open-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lucy Respaldo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/static/fuentes/open-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Lucy Respaldo";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url(/static/fuentes/open-sans-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lucy Respaldo";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url(/static/fuentes/open-sans-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Segoe UI Variable no trae cursiva; la clásica sí. font-synthesis: style la inclina si ninguna la tiene. */
  --fuente-cursiva: "Segoe UI", "Lucy Respaldo", Roboto, system-ui, sans-serif;
}

/* Noche estilo Zyricon: negro + blanco/gris; violeta solo en gota/acciones */
:root,
html.tema-noche {
  --fondo: #000000;
  --fondo-2: #0a0a0a;
  --acento: #8f54ff;
  --acento-suave: #e858ff;
  --acento-azul: #4e9fff;
  --soft-lavanda: #e5cdff;
  --soft-cielo: #b6e5ff;
  --texto: #f2f2f2;
  --texto-fuerte: #ffffff;
  --muted: #8a8a8a;
  --vidrio: rgba(18, 18, 18, 0.92);
  --vidrio-fuerte: rgba(14, 14, 14, 0.96);
  --panel: #000000;
  --panel-btn: #1a1a1a;
  --panel-btn-hover: #242424;
  --panel-muted: #6b6b6b;
  --panel-texto: #f2f2f2;
  --borde: rgba(255, 255, 255, 0.08);
  --borde-fuerte: rgba(255, 255, 255, 0.14);
  --hover: rgba(255, 255, 255, 0.06);
  --hover-suave: rgba(255, 255, 255, 0.04);
  --msg-user: #7c3aed;
  --msg-user-borde: #5b21b6;
  --msg-asst: rgba(255, 255, 255, 0.92);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --chip-texto: #d0d0d0;
  --icono-bg: rgba(255, 255, 255, 0.05);
  --icono-color: #c8c8c8;
  --menu-bg: #121212;
  --menu-texto: #f2f2f2;
  --placeholder: #6a6a6a;
  --scroll: rgba(255, 255, 255, 0.18);
  --sombra: rgba(0, 0, 0, 0.65);
  --velo: rgba(0, 0, 0, 0.55);
  --grad-1: rgba(255, 255, 255, 0.02);
  --grad-2: rgba(255, 255, 255, 0.015);
  --grad-3: rgba(143, 84, 255, 0.06);
  --caja-anillo: linear-gradient(90deg, #333, #8f54ff, #555, #333);
  --theme-color: #000000;
  --orbe-glow-a: rgba(78, 159, 255, 0.35);
  --orbe-glow-b: rgba(232, 88, 255, 0.28);
  --orbe-glow-activo-a: rgba(78, 159, 255, 0.85);
  --orbe-glow-activo-b: rgba(232, 88, 255, 0.72);
}

html.tema-dia {
  --fondo: #f3eaff;
  --fondo-2: #e8f6ff;
  --acento: #8f54ff;
  --acento-suave: #e858ff;
  --acento-azul: #4e9fff;
  --soft-lavanda: #e5cdff;
  --soft-cielo: #b6e5ff;
  --texto: #2e1a47;
  --texto-fuerte: #1a0f2e;
  --muted: #6b5b8c;
  --vidrio: rgba(255, 255, 255, 0.62);
  --vidrio-fuerte: rgba(255, 255, 255, 0.88);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-btn: rgba(143, 84, 255, 0.1);
  --panel-btn-hover: rgba(143, 84, 255, 0.18);
  --panel-muted: #6b5b8c;
  --panel-texto: #2e1a47;
  --borde: rgba(143, 84, 255, 0.16);
  --borde-fuerte: rgba(143, 84, 255, 0.32);
  --hover: rgba(143, 84, 255, 0.12);
  --hover-suave: rgba(143, 84, 255, 0.08);
  --msg-user: #8f54ff;
  --msg-user-borde: #7c3aed;
  --msg-asst: #2e1a47;
  --chip-bg: rgba(255, 255, 255, 0.7);
  --chip-texto: #4a3a6b;
  --icono-bg: rgba(255, 255, 255, 0.75);
  --icono-color: #8f54ff;
  --menu-bg: #ffffff;
  --menu-texto: #2e1a47;
  --placeholder: #9a8bb8;
  --scroll: rgba(143, 84, 255, 0.4);
  --sombra: rgba(80, 40, 140, 0.14);
  --velo: rgba(120, 90, 180, 0.25);
  --grad-1: rgba(229, 205, 255, 0.95);
  --grad-2: rgba(182, 229, 255, 0.85);
  --grad-3: rgba(232, 88, 255, 0.22);
  --caja-anillo: linear-gradient(90deg, #4e9fff, #8f54ff, #e858ff, #4e9fff);
  --theme-color: #f3eaff;
  --orbe-glow-a: rgba(78, 159, 255, 0.45);
  --orbe-glow-b: rgba(232, 88, 255, 0.38);
  --orbe-glow-activo-a: rgba(78, 159, 255, 0.7);
  --orbe-glow-activo-b: rgba(232, 88, 255, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; height: 100dvh; margin: 0; }
html {
  background: var(--fondo);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.tema-dia { color-scheme: light; }

body {
  display: flex;
  color: var(--texto);
  font: 400 15px/1.5 "Segoe UI Variable", "Segoe UI", "Lucy Respaldo", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  background:
    radial-gradient(900px 560px at 88% 0%, var(--grad-3), transparent 58%),
    radial-gradient(800px 480px at 0% 100%, var(--grad-2), transparent 52%),
    radial-gradient(700px 420px at 100% 80%, var(--grad-1), transparent 50%),
    var(--fondo);
  overflow: hidden;
  transition: background 0.35s ease, color 0.25s ease;
}

.marca-lucy {
  display: block;
  border-radius: 22.5%;
  object-fit: cover;
  flex-shrink: 0;
}

aside {
  width: 64px;
  flex-shrink: 0;
  background: var(--panel);
  backdrop-filter: none;
  border-right: 1px solid var(--borde);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 10px 12px;
  gap: 10px;
  z-index: 5;
  overflow: hidden;
  transition: width 0.22s ease, background 0.3s ease, border-color 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}
body.panel-abierto aside {
  width: 272px;
  padding: 14px 12px 12px;
}
.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border-radius: 14px;
  color: var(--panel-texto);
  transition: background 0.15s;
  flex-shrink: 0;
}
body.panel-abierto .panel-toggle {
  justify-content: flex-start;
}
.panel-toggle:hover {
  background: var(--hover);
}
.panel-nombre {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--panel-texto);
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.15s;
}
body.panel-abierto .panel-nombre {
  opacity: 1;
  width: auto;
}
.panel-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.btn-nueva {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--borde);
  background: var(--panel-btn);
  color: var(--panel-texto);
  font-size: 13px;
  font-weight: 550;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.btn-nueva:hover {
  background: var(--panel-btn-hover);
  border-color: var(--borde-fuerte);
}
.panel-bloque {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}
.panel-bloque.chats {
  flex: 1;
  min-height: 0;
}
.panel-bloque.espacios {
  margin-top: auto;
  flex-shrink: 0;
}
.panel-sec {
  margin: 0;
  padding: 4px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--panel-muted);
}
.panel-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.panel-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.panel-link svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.panel-link:hover:not(:disabled) {
  background: var(--hover);
  color: var(--panel-texto);
}
.panel-link:disabled {
  cursor: default;
  opacity: 0.72;
}
.panel-link.panel-config {
  opacity: 1;
  color: var(--panel-texto);
  margin-top: 4px;
  border-top: 1px solid var(--borde);
  border-radius: 0 0 10px 10px;
  padding-top: 12px;
}
.panel-link.panel-config:hover {
  background: var(--hover);
  color: #e9e0ff;
}
html.tema-dia .panel-link.panel-config:hover {
  color: #5b21b6;
}
.panel-link .panel-tag {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--panel-muted);
  background: var(--panel-btn);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* Barra colapsada (desktop): iconos a la vista */
@media (min-width: 821px) {
  body:not(.panel-abierto) .panel-nombre,
  body:not(.panel-abierto) .btn-nueva-txt,
  body:not(.panel-abierto) .panel-sec,
  body:not(.panel-abierto) .panel-link > span,
  body:not(.panel-abierto) .panel-bloque.chats,
  body:not(.panel-abierto) #registro {
    display: none;
  }
  body:not(.panel-abierto) .btn-nueva {
    justify-content: center;
    padding: 11px 0;
    width: 44px;
    margin: 0 auto;
  }
  body:not(.panel-abierto) .panel-link {
    justify-content: center;
    padding: 11px 0;
    width: 44px;
    margin: 0 auto;
  }
  body:not(.panel-abierto) .panel-cuerpo {
    align-items: center;
    gap: 8px;
  }
  body:not(.panel-abierto) .panel-bloque.espacios {
    width: 100%;
    margin-top: auto;
  }
  body:not(.panel-abierto) .panel-nav {
    align-items: center;
    gap: 4px;
  }
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  background: transparent;
  border: none;
}
#lista {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}
.buscar-chats {
  position: relative;
  display: block;
  margin: 0 0 4px;
  flex-shrink: 0;
}
.buscar-chats svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--panel-muted);
  pointer-events: none;
}
.buscar-chats input {
  width: 100%;
  padding: 8px 12px 8px 33px;
  border-radius: 12px;
  border: 1px solid var(--borde);
  background: var(--hover-suave);
  color: var(--texto);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.buscar-chats input::placeholder {
  color: var(--placeholder);
}
.buscar-chats input:focus {
  border-color: var(--acento);
  background: transparent;
  box-shadow: 0 0 0 3px rgba(143, 84, 255, 0.18);
}
.chat-zona {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 12px;
  transition: background 0.15s;
}
body.arrastrando-chat .chat-zona {
  min-height: 40px;
}
.chat-zona.sobre {
  background: rgba(143, 84, 255, 0.12);
}
.chat-zona.sobre .lista-sep {
  color: var(--acento);
}
.chat-soltar {
  display: none;
  margin: 4px 2px;
  padding: 11px;
  border: 1.5px dashed rgba(143, 84, 255, 0.55);
  border-radius: 12px;
  color: var(--acento);
  font-size: 12.5px;
  text-align: center;
}
body.arrastrando-chat .chat-soltar {
  display: block;
  animation: chat-aparece 0.18s ease-out;
}
.chat-zona.sobre .chat-soltar {
  background: rgba(143, 84, 255, 0.16);
}
.chat-vacio {
  margin: 10px 12px;
  color: var(--panel-muted);
  font-size: 13px;
}
.chat-indicador {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--acento-azul), var(--acento), var(--acento-suave));
  box-shadow: 0 0 10px rgba(143, 84, 255, 0.7);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: top 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
}
.chat-indicador.ver {
  opacity: 1;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 12px;
  min-width: 0;
  position: relative;
  flex-shrink: 0;
}
.chat-item[draggable="true"] {
  -webkit-user-drag: element;
}
.chat-item.arrastrando {
  opacity: 0.35;
}
.chat-item .chat-abrir {
  flex: 1;
  min-width: 0;
  text-align: left;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 10px 10px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13.5px;
  line-height: 1.35;
}
.chat-item:hover {
  background: var(--hover-suave);
}
.chat-item.activa {
  background: rgba(255, 255, 255, 0.08);
}
html.tema-dia .chat-item.activa {
  background: rgba(143, 84, 255, 0.14);
}
.chat-abrir mark {
  background: rgba(143, 84, 255, 0.4);
  color: var(--texto-fuerte);
  border-radius: 3px;
  padding: 0 1px;
}
.chat-abrir .chat-tit,
.chat-abrir .chat-frag {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-abrir .chat-frag {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--panel-muted);
  margin-top: 1px;
}
.chat-renombrar {
  flex: 1;
  min-width: 0;
  margin: 4px 4px 4px 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--acento);
  background: var(--fondo-2);
  color: var(--texto);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(143, 84, 255, 0.22);
}
.chat-item.activa .chat-abrir {
  color: var(--texto);
  font-weight: 550;
}
.chat-item.fijada .chat-abrir {
  padding-left: 4px;
}
.chat-pin-marca {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  opacity: 0.85;
  margin-left: 6px;
}
.chat-pin-marca svg {
  width: 13px;
  height: 13px;
}
.chat-accs {
  position: absolute;
  top: 0;
  right: 4px;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.chat-item:hover .chat-accs,
.chat-item:focus-within .chat-accs {
  opacity: 1;
  pointer-events: auto;
}
.chat-item:hover .chat-abrir,
.chat-item:focus-within .chat-abrir {
  padding-right: 96px;
}
.chat-item.editando .chat-accs {
  display: none;
}
@media (hover: none) {
  .chat-item.activa .chat-accs {
    opacity: 1;
    pointer-events: auto;
  }
  .chat-item.activa .chat-abrir {
    padding-right: 96px;
  }
}
.chat-acc {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.chat-acc svg {
  width: 15px;
  height: 15px;
}
.chat-acc:hover {
  color: var(--texto);
  background: var(--hover);
}
.chat-acc.peligro:hover {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.14);
}
html.tema-dia .chat-acc.peligro:hover {
  color: #e11d48;
}
.aviso-chat {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--menu-bg);
  color: var(--menu-texto);
  border: 1px solid var(--borde-fuerte);
  box-shadow: 0 14px 36px var(--sombra);
  font-size: 13.5px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.aviso-chat.ver {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.aviso-chat button {
  color: var(--acento);
  font-weight: 650;
  padding: 5px 12px;
  border-radius: 999px;
  transition: background 0.15s;
}
html.tema-noche .aviso-chat button,
:root:not(.tema-dia) .aviso-chat button {
  color: #c9b3ff;
}
.aviso-chat button:hover {
  background: rgba(143, 84, 255, 0.18);
}
.aviso-chat-barra {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--acento);
  transform-origin: left;
}
.aviso-chat.ver .aviso-chat-barra {
  animation: aviso-chat-vaciar 5s linear forwards;
}
@keyframes aviso-chat-vaciar {
  to { transform: scaleX(0); }
}
.chat-preview {
  position: fixed;
  z-index: 70;
  width: 250px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--menu-bg);
  color: var(--menu-texto);
  border: 1px solid var(--borde-fuerte);
  box-shadow: 0 14px 34px var(--sombra);
  font-size: 12.5px;
  line-height: 1.45;
  pointer-events: none;
}
.chat-preview.ver {
  animation: chat-aparece 0.16s ease-out;
}
.chat-preview p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-preview small {
  display: block;
  margin-top: 6px;
  color: var(--panel-muted);
  font-size: 11.5px;
}
@keyframes chat-aparece {
  from { opacity: 0; transform: scale(0.96); }
}
.lista-sep {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--panel-muted);
  padding: 10px 12px 4px;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}
.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px 0;
  min-height: 36px;
}
.marca-movil { display: none; }
.aura-saludo { display: none; }
.orbe-caja-btn .ic-vivo { display: none; }
.avatar-movil { display: none; }
.barra-der { display: none; }
.ident {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.btn-dormir {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cerebro-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  margin-left: auto;
  max-width: min(220px, 42vw);
  padding: 2px 4px 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(143, 84, 255, 0.35);
  background: rgba(143, 84, 255, 0.14);
  color: #e9e0ff;
  cursor: pointer;
}
.cerebro-pill.es-local {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(37, 99, 235, 0.16);
  color: #bfdbfe;
}
.cerebro-pill.es-gemini {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(22, 163, 74, 0.18);
  color: #bbf7d0;
}
.cerebro-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.cerebro-pill select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 5px 22px 5px 0;
  max-width: 100%;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}
.cerebro-pill select:focus {
  outline: none;
}
.cerebro-pill select option {
  color: #111;
  background: #fff;
}
html.tema-dia .cerebro-pill {
  color: #5b21b6;
}
html.tema-dia .cerebro-pill.es-local {
  color: #1d4ed8;
}
html.tema-dia .cerebro-pill.es-gemini {
  color: #166534;
  background: rgba(22, 163, 74, 0.12);
}
html.tema-dia .cerebro-pill select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b21b6' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.btn-dormir:hover {
  background: rgba(185, 28, 28, 0.45);
  border-color: rgba(252, 165, 165, 0.55);
  color: #fff;
}
.btn-config {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-config:hover {
  background: rgba(143, 84, 255, 0.18);
  border-color: rgba(143, 84, 255, 0.35);
  color: #e9e0ff;
}
html.tema-dia .btn-config {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.03);
}
html.tema-dia .btn-config:hover {
  background: rgba(143, 84, 255, 0.12);
  color: #5b21b6;
}

.config-velo {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.config-velo[hidden],
.config-panel[hidden] {
  display: none !important;
}
.config-panel {
  position: fixed;
  z-index: 90;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 28px));
  max-height: min(86vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #121214;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.config-toast {
  margin: 12px 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-align: center;
  animation: config-toast-in 0.28s ease-out;
}
.config-toast[hidden] {
  display: none !important;
}
.config-toast.ok {
  color: #ecfdf5;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.42), rgba(5, 150, 105, 0.28));
  border: 1px solid rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15), 0 8px 24px rgba(16, 185, 129, 0.18);
}
.config-toast.err {
  color: #fff1f2;
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.45), rgba(190, 18, 60, 0.3));
  border: 1px solid rgba(251, 113, 133, 0.55);
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.15), 0 8px 24px rgba(244, 63, 94, 0.18);
}
@keyframes config-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
html.tema-dia .config-toast.ok {
  color: #065f46;
  background: linear-gradient(145deg, rgba(167, 243, 208, 0.95), rgba(110, 231, 183, 0.75));
  border-color: rgba(16, 185, 129, 0.55);
}
html.tema-dia .config-toast.err {
  color: #9f1239;
  background: linear-gradient(145deg, rgba(254, 205, 211, 0.95), rgba(253, 164, 175, 0.8));
  border-color: rgba(244, 63, 94, 0.45);
}
.config-nota {
  margin: 12px 0 0;
  min-height: 1.2em;
  font-size: 12px;
  color: var(--muted);
}
.config-nota.ok {
  color: #34d399;
  font-weight: 600;
}
.config-nota.err {
  color: #fb7185;
  font-weight: 600;
}
html.tema-dia .config-nota.ok { color: #059669; }
html.tema-dia .config-nota.err { color: #e11d48; }
html.tema-dia .config-panel {
  background: #f7f5fb;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 50px rgba(40, 20, 80, 0.18);
}
.config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
}
.config-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.config-cerrar {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.config-cerrar:hover { background: rgba(255, 255, 255, 0.06); color: inherit; }
.config-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.config-tab {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}
.config-tab.activo {
  background: rgba(143, 84, 255, 0.18);
  color: #e9e0ff;
}
html.tema-dia .config-tab.activo {
  background: rgba(143, 84, 255, 0.14);
  color: #5b21b6;
}
.config-body {
  padding: 14px 18px 20px;
  overflow: auto;
}
.config-sec { display: none; }
.config-sec.activo { display: block; }
.config-hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.config-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
}
.config-select,
.config-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 13px;
}
html.tema-dia .config-select,
html.tema-dia .config-input {
  border-color: rgba(0, 0, 0, 0.1);
  background: #fff;
}
.config-btn,
.config-btn-sec {
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 550;
  border: 1px solid transparent;
}
.config-btn {
  background: rgba(143, 84, 255, 0.85);
  color: #fff;
}
.config-btn:hover { filter: brightness(1.08); }
.config-btn-sec {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--muted);
}
.config-btn-sec:hover { color: inherit; border-color: rgba(255, 255, 255, 0.22); }
.config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.config-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.config-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.api-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
.api-badge.ok {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(22, 163, 74, 0.22);
  color: #bbf7d0;
}
.api-badge.warn {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(180, 83, 9, 0.22);
  color: #fde68a;
}
.config-card.gemini-activa {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(22, 163, 74, 0.1);
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.12);
}
html.tema-dia .config-card.gemini-activa {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.35);
}
html.tema-dia .api-badge.ok {
  color: #166534;
  background: rgba(22, 163, 74, 0.12);
}
html.tema-dia .config-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.06);
}
.config-card-tit {
  font-size: 14px;
  font-weight: 600;
}
.config-card-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.config-cerebros {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-cerebro {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
}
.config-cerebro:hover { border-color: rgba(143, 84, 255, 0.35); }
.config-cerebro.activo {
  border-color: rgba(143, 84, 255, 0.55);
  background: rgba(143, 84, 255, 0.12);
}
.config-cerebro:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.config-cerebro strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.config-cerebro span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.config-windows {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(143, 84, 255, 0.25);
  background: rgba(143, 84, 255, 0.08);
  font-size: 12.5px;
  line-height: 1.45;
  color: #ddd6fe;
}
html.tema-dia .config-windows {
  color: #4c1d95;
  background: rgba(143, 84, 255, 0.08);
}
.config-sistema {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-sys-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  line-height: 1.4;
}
html.tema-dia .config-sys-row {
  border-color: rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.65);
}
.config-sys-row strong {
  color: var(--muted);
  font-weight: 550;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.config-sys-row span {
  word-break: break-word;
}
.config-sys-ok { color: #86efac; }
.config-sys-bad { color: #fca5a5; }
html.tema-dia .config-sys-ok { color: #15803d; }
html.tema-dia .config-sys-bad { color: #b91c1c; }
#estado {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  opacity: 0.35;
  transition: opacity 0.2s, color 0.2s;
}
body.cargando #estado,
body.escuchando #estado,
body.hablando #estado.aviso {
  opacity: 1;
}
body.cargando #estado { color: #fcd34d; }
html.tema-dia body.cargando #estado { color: #d97706; }
body.hablando #estado.aviso { color: var(--acento); }
body.hablando #estado:not(.aviso) { opacity: 0; }
body.escuchando #estado { color: var(--acento-azul); }
body.oido-evento #estado {
  opacity: 1;
  color: var(--acento-suave);
}
body.cargando #estado.pulso { display: inline-block; animation: estado-pulso 0.9s ease-out; }
@keyframes estado-pulso {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.18); }
}
body.cargando .orbe-caja-btn { opacity: 0.55; cursor: wait; }
body.cargando #dictar { opacity: 0.55; cursor: wait; }
.icono {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--icono-bg);
  color: var(--icono-color);
  flex-shrink: 0;
  border: 1px solid var(--borde);
}
.icono.mas {
  font-size: 22px;
  line-height: 1;
  color: var(--texto-fuerte);
}
.icono[aria-pressed="true"] { background: rgba(143, 84, 255, 0.28); color: var(--texto-fuerte); }

/* Switch día / noche */
.btn-tema {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--borde-fuerte);
  background: var(--vidrio);
  position: relative;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s;
}
.btn-tema:hover {
  background: var(--hover);
}
.btn-tema-pista {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  pointer-events: none;
  color: var(--muted);
}
.btn-tema-pista svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}
.btn-tema-knob {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--acento-azul), var(--acento), var(--acento-suave));
  box-shadow: 0 2px 8px rgba(143, 84, 255, 0.45);
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
html.tema-dia .btn-tema-knob {
  transform: translateX(22px);
}
.solo-movil { display: none; }

/* ── Escenario voz en vivo (estilo Ello) ───────────────────────── */
.escenario {
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  padding: 12px 28px calc(18px + env(safe-area-inset-bottom));
  min-height: 0;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
  background:
    radial-gradient(ellipse 80% 55% at 50% 28%, var(--soft-lavanda), transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 100%, var(--soft-cielo), transparent 65%),
    var(--fondo);
}
html.tema-noche .escenario,
html:not(.tema-dia) .escenario {
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(143, 84, 255, 0.14), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 90%, rgba(78, 159, 255, 0.08), transparent 65%),
    #000;
}
body.voz .escenario { display: flex; }
body.voz .escenario[hidden] { display: flex !important; }
body.voz:not(.en-inicio) #inicio { display: none !important; }
body.voz #chips-chat,
body.voz #caja,
body.voz #mensajes,
body.voz .barra .btn-dormir,
body.voz .barra .btn-tema,
body.voz .barra .mas { display: none !important; }
body.voz .barra {
  background: transparent;
  border: none;
  box-shadow: none;
}
/* En chat de voz solo cuenta #voz-alerta (bajo el orbe). Evita «escuchando» + «te oigo». */
body.voz #estado {
  display: none !important;
}

.voz-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 0;
  padding: 8px 4px 8px;
  box-sizing: border-box;
}

/* En vivo: sin orbe (canvas queda oculto para el motor). */
body.voz .orbe-wrap-vivo,
body.voz .orbe-wrap {
  display: none !important;
}

.voz-chat {
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  max-width: none !important;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px max(4px, calc((100% - var(--columna)) / 2)) 16px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
  box-sizing: border-box;
}
.voz-chat::-webkit-scrollbar {
  width: 8px;
}
.voz-chat::-webkit-scrollbar-track {
  background: transparent;
}
.voz-chat::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.voz-chat::-webkit-scrollbar-thumb:hover {
  background: var(--acento);
  background-clip: padding-box;
}
.voz-linea {
  margin: 0;
  max-width: 100%;
  line-height: 1.5;
  letter-spacing: -0.01em;
  word-wrap: break-word;
  box-sizing: border-box;
}
.voz-linea.tu {
  align-self: flex-end;
  text-align: right;
  max-width: min(640px, 88%);
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  font-family: var(--fuente-cursiva);
  font-synthesis: style;
  color: rgba(255, 255, 255, 0.88);
  padding: 10px 14px;
  border-radius: 16px 16px 6px 16px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.voz-linea.tu.borrador {
  opacity: 0.65;
}
.voz-linea.historial {
  opacity: 0.45;
  font-size: 0.92rem;
}
.voz-linea.lucy {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  text-align: left;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  /* 600 y no 500: Firefox/Zen no tienen peso medio de Segoe UI y lo pintan fino; Edge ya pinta 500 como 600. */
  font-weight: 600;
  color: var(--texto-fuerte);
  padding: 6px 4px;
  box-sizing: border-box;
}
.voz-linea.lucy .voz-pal {
  display: inline;
  white-space: pre-wrap;
  transition: opacity 0.38s ease, filter 0.38s ease, transform 0.38s ease;
}
.voz-linea.lucy .voz-pal-off {
  opacity: 0;
  filter: blur(3px);
  transform: translateY(4px);
}
.voz-linea.lucy .voz-pal-on {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}
.voz-linea.lucy .voz-pal-oculta,
.voz-linea.lucy .voz-bloque-oculto {
  display: none !important;
}
.voz-linea.voz-md p {
  margin: 0 0 0.55em;
}
.voz-linea.voz-md p:last-child {
  margin-bottom: 0;
}
.voz-linea.voz-md ul {
  margin: 0.25em 0 0.6em;
  padding-left: 1.2em;
}
.voz-linea.voz-md li {
  margin: 0.22em 0;
}
.voz-linea.voz-md strong {
  font-weight: 700;
}
.voz-linea.voz-md strong.md-h {
  display: block;
  margin: 0.45em 0 0.2em;
}
.voz-linea.voz-md .md-sub {
  margin: 0.8em 0 0.3em;
}
.voz-linea.voz-md .md-paso {
  margin: 0.3em 0;
}
.voz-linea.voz-md .md-num {
  opacity: 0.7;
  margin-right: 0.25em;
}
.voz-linea.sistema {
  align-self: center;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  font-family: var(--fuente-cursiva);
  font-synthesis: style;
}
html.tema-dia .voz-linea.tu {
  color: rgba(30, 20, 50, 0.8);
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.06);
}

.voz-estado {
  align-self: center;
  margin: 0;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 1em;
  transition: color 0.25s ease;
}
/* Misma paleta que el anillo/onda de la boca. */
.voz-estado[data-alerta="escuchando"],
body.escuchando .voz-estado { color: #5eead4; }
.voz-estado[data-alerta="pensando"],
body.pensando:not(.lucy-sonando):not(.escuchando) .voz-estado { color: #fbbf24; }
.voz-estado[data-alerta="hablando"],
body.lucy-sonando .voz-estado,
body.hablando:not(.escuchando) .voz-estado { color: #5ec8ff; }
.voz-estado[data-alerta="pausa"] { color: #94a3b8; }
.voz-estado[data-alerta="idle"] { color: var(--muted); }
.voz-estado[data-alerta="error"] { color: #fb7185; }

.voz-dock {
  align-self: center;
}

.orbe-wrap {
  position: relative;
  width: min(58vh, 380px);
  height: min(58vh, 380px);
  flex-shrink: 0;
  filter: drop-shadow(0 28px 40px rgba(100, 40, 180, 0.22));
}
.orbe-wrap::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 32% 72%, var(--orbe-glow-a), transparent 58%),
    radial-gradient(circle at 72% 28%, var(--orbe-glow-b), transparent 55%);
  filter: blur(30px);
  opacity: 0.22;
  transform: scale(1);
  transition: opacity 0.7s ease, filter 0.7s ease, transform 0.7s ease;
  animation: aura-flota 6.5s ease-in-out infinite;
}
@keyframes aura-flota {
  0%, 100% { transform: translate(-2%, 1.5%) scale(1); opacity: 0.5; }
  50% { transform: translate(2.5%, -2%) scale(1.035); opacity: 0.68; }
}
body.escuchando .orbe-wrap::before {
  opacity: 0.72;
  animation-duration: 4.2s;
  filter: blur(28px);
}
body.hablando .orbe-wrap::before {
  opacity: 0.78;
  animation: aura-habla 1.1s ease-in-out infinite;
  filter: blur(26px);
  background:
    radial-gradient(circle at 34% 68%, var(--orbe-glow-activo-a), transparent 58%),
    radial-gradient(circle at 68% 30%, var(--orbe-glow-activo-b), transparent 56%),
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.1), transparent 55%);
}
@keyframes aura-habla {
  0%, 100% { transform: scale(1) translate(0, 1%); opacity: 0.55; }
  25% { transform: scale(1.05) translate(2%, -2%); opacity: 0.82; }
  50% { transform: scale(1.02) translate(-1.5%, 1%); opacity: 0.7; }
  75% { transform: scale(1.07) translate(1%, -1.5%); opacity: 0.9; }
}
body.escuchando .orbe-wrap {
  transform: scale(calc(1 + var(--mic-nivel, 0.08) * 0.045));
  transition: transform 0.1s linear;
}
body.hablando .orbe-wrap.aura-pulso::before {
  opacity: 1;
  transform: scale(1.12) translate(0, -2%);
  filter: blur(22px);
  transition: opacity 0.12s ease, transform 0.18s ease, filter 0.18s ease;
}
body.hablando .orbe-wrap {
  transition: transform 0.18s ease;
}
body.hablando .orbe-wrap.aura-pulso {
  transform: scale(1.03);
}
#orbe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  z-index: 1;
  pointer-events: none;
}

/* dock inferior estilo Gemini Live */
.voz-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.voz-dock-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #7c3aed;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(80, 40, 140, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
}
.voz-dock-btn > svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
}
/* Un solo icono a la vez (como play/pause de música) */
#voz-mute .ic-mic-off,
#voz-pausa .ic-play { display: none; }
#voz-mute[aria-pressed="true"] .ic-mic-on,
#voz-pausa[aria-pressed="true"] .ic-pausa { display: none; }
#voz-mute[aria-pressed="true"] .ic-mic-off,
#voz-pausa[aria-pressed="true"] .ic-play { display: block; }
#voz-mute[aria-pressed="true"] .ic-mic-off {
  animation: mic-mute-in 0.28s ease;
}
@keyframes mic-mute-in {
  0% { transform: scale(0.7); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}
.voz-dock-btn:hover { transform: scale(1.04); }
.voz-dock-btn:active { transform: scale(0.96); }
.voz-dock-btn[aria-pressed="true"] {
  background: #7c3aed;
  color: #fff;
}
html.tema-noche .voz-dock-btn,
html:not(.tema-dia) .voz-dock-btn {
  background: #1a1a1a;
  color: #c4b5fd;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
html.tema-noche .voz-dock-btn[aria-pressed="true"],
html:not(.tema-dia) .voz-dock-btn[aria-pressed="true"] {
  background: #8f54ff;
  color: #fff;
  border-color: transparent;
}

/* Chip «Volver a voz»: SOLO con sesión de voz + teclado (body.voz-fondo).
   !important: si no, .chip { display:inline-flex } lo deja permanente. */
.chip-voz-volver,
#voz-volver {
  display: none !important;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(143, 84, 255, 0.22), rgba(78, 159, 255, 0.18));
  border: 1px solid rgba(143, 84, 255, 0.35);
  color: var(--texto-fuerte);
  font-weight: 600;
}
body.voz-fondo #voz-volver.chip-voz-volver {
  display: inline-flex !important;
}
body.voz-fondo #chip-nueva {
  display: none !important;
}
body.voz-fondo #chips-chat {
  display: flex;
}
.voz-volver-punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4e9fff;
  box-shadow: 0 0 0 0 rgba(78, 159, 255, 0.45);
  animation: voz-volver-pulso 1.6s ease-out infinite;
}
@keyframes voz-volver-pulso {
  0% { box-shadow: 0 0 0 0 rgba(78, 159, 255, 0.45); }
  100% { box-shadow: 0 0 0 8px rgba(78, 159, 255, 0); }
}
body.voz-fondo #orbe-caja-btn {
  outline: 2px solid rgba(143, 84, 255, 0.55);
  outline-offset: 2px;
}
.voz-dock-centro {
  width: 168px;
  height: 64px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 22px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(145deg, #2a2438 0%, #1a1624 55%, #121018 100%);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, box-shadow 0.2s ease, width 0.28s ease, height 0.28s ease, background 0.25s ease;
}
/* Anillo luminoso en el borde: conic que gira (color por estado). */
.voz-borde-giro {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  padding: 2px;
  overflow: hidden;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  box-shadow:
    0 0 8px rgba(100, 116, 139, 0.3),
    0 0 18px rgba(100, 116, 139, 0.18);
  transition: opacity 0.25s ease, box-shadow 0.35s ease;
  filter: saturate(1.08);
}
.voz-borde-giro::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160%;
  aspect-ratio: 1;
  background: conic-gradient(
    from 0deg,
    #64748b 0deg,
    #94a3b8 120deg,
    #475569 240deg,
    #64748b 360deg
  );
  animation: boca-anillo-gira 2.2s linear infinite;
  transition: background 0.35s ease;
}
.voz-boca-glow {
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(120, 200, 255, 0.4), transparent 62%);
  opacity: 0;
  filter: blur(14px);
  transition: opacity 0.25s ease;
  z-index: 0;
}
.voz-dock-centro > .voz-boca-wave {
  position: relative;
  z-index: 1;
  width: 96%;
  height: 72%;
  max-width: none;
  display: block;
  pointer-events: none;
}
/* legado barras (por si queda en caché) */
.voz-dock-centro > .voz-dock-ondas {
  position: relative;
  z-index: 1;
  display: none;
}
.voz-dock-centro:hover { transform: scale(1.03); }
.voz-dock-centro:active { transform: scale(0.97); }
body.escuchando .voz-dock-centro {
  width: 220px;
  height: 74px;
  background: linear-gradient(145deg, #12141c 0%, #0e1018 55%, #0a0c12 100%);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
/* Escuchando: anillo menta (misma familia que la onda). */
body.escuchando .voz-borde-giro {
  opacity: 1;
  animation: boca-anillo-respira 2.4s ease-in-out infinite;
  box-shadow:
    0 0 8px rgba(94, 234, 212, 0.4),
    0 0 18px rgba(45, 212, 191, 0.28),
    0 0 28px rgba(52, 211, 153, 0.16);
}
body.escuchando .voz-borde-giro::before {
  animation-duration: 2.8s;
  background: conic-gradient(
    from 0deg,
    #5eead4 0deg,
    #2dd4bf 100deg,
    #34d399 200deg,
    #99f6e4 280deg,
    #5eead4 360deg
  );
}
body.escuchando .voz-boca-glow {
  opacity: 0;
}
body.escuchando .voz-boca-wave {
  width: 96%;
  height: 72%;
  opacity: 1;
}
.voz-dock-ondas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 40px;
  width: 100%;
}
.voz-dock-ondas i {
  display: block;
  width: 2.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  height: 5px;
  opacity: 0.35;
  transform-origin: center center;
  transition: height 0.08s linear, opacity 0.12s ease, background 0.2s ease;
}
body.escuchando .voz-dock-ondas i {
  opacity: 0.95;
  background: linear-gradient(to top, #7dd3fc, #a78bfa);
}
/* Al escuchar: altura ligada al mic */
body.escuchando .voz-dock-ondas i:nth-child(1),
body.escuchando .voz-dock-ondas i:nth-child(24) {
  height: calc(4px + var(--mic-nivel, 0.08) * 6px);
  opacity: 0.45;
}
body.escuchando .voz-dock-ondas i:nth-child(2),
body.escuchando .voz-dock-ondas i:nth-child(23) {
  height: calc(5px + var(--mic-nivel, 0.08) * 9px);
  opacity: 0.55;
}
body.escuchando .voz-dock-ondas i:nth-child(3),
body.escuchando .voz-dock-ondas i:nth-child(22) {
  height: calc(5px + var(--mic-nivel, 0.08) * 12px);
}
body.escuchando .voz-dock-ondas i:nth-child(4),
body.escuchando .voz-dock-ondas i:nth-child(21) {
  height: calc(6px + var(--mic-nivel, 0.08) * 14px);
}
body.escuchando .voz-dock-ondas i:nth-child(5),
body.escuchando .voz-dock-ondas i:nth-child(20) {
  height: calc(7px + var(--mic-nivel, 0.08) * 16px);
}
body.escuchando .voz-dock-ondas i:nth-child(6),
body.escuchando .voz-dock-ondas i:nth-child(19) {
  height: calc(8px + var(--mic-nivel, 0.08) * 18px);
}
body.escuchando .voz-dock-ondas i:nth-child(7),
body.escuchando .voz-dock-ondas i:nth-child(18) {
  height: calc(9px + var(--mic-nivel, 0.08) * 20px);
}
body.escuchando .voz-dock-ondas i:nth-child(8),
body.escuchando .voz-dock-ondas i:nth-child(17) {
  height: calc(10px + var(--mic-nivel, 0.08) * 22px);
}
body.escuchando .voz-dock-ondas i:nth-child(9),
body.escuchando .voz-dock-ondas i:nth-child(16) {
  height: calc(11px + var(--mic-nivel, 0.08) * 24px);
}
body.escuchando .voz-dock-ondas i:nth-child(10),
body.escuchando .voz-dock-ondas i:nth-child(15) {
  height: calc(12px + var(--mic-nivel, 0.08) * 26px);
}
body.escuchando .voz-dock-ondas i:nth-child(11),
body.escuchando .voz-dock-ondas i:nth-child(14) {
  height: calc(13px + var(--mic-nivel, 0.08) * 28px);
}
body.escuchando .voz-dock-ondas i:nth-child(12),
body.escuchando .voz-dock-ondas i:nth-child(13) {
  height: calc(14px + var(--mic-nivel, 0.08) * 30px);
}

/* Pensando: pastilla quieta + anillo luminoso en el borde. */
body.pensando:not(.lucy-sonando):not(.escuchando) .voz-dock-centro {
  width: 188px;
  height: 68px;
  background: #0c0c10;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: none;
  filter: none;
}
body.pensando:not(.lucy-sonando):not(.escuchando) .voz-borde-giro {
  opacity: 1;
  animation: boca-anillo-respira 1.8s ease-in-out infinite;
  box-shadow:
    0 0 8px rgba(251, 191, 36, 0.4),
    0 0 18px rgba(245, 158, 11, 0.28),
    0 0 28px rgba(252, 211, 77, 0.16);
}
body.pensando:not(.lucy-sonando):not(.escuchando) .voz-borde-giro::before {
  animation-duration: 1.6s;
  background: conic-gradient(
    from 0deg,
    #fbbf24 0deg,
    #f59e0b 110deg,
    #fcd34d 220deg,
    #fde68a 300deg,
    #fbbf24 360deg
  );
}
body.pensando:not(.lucy-sonando):not(.escuchando) .voz-boca-glow {
  opacity: 0;
  animation: none;
}
body.pensando:not(.lucy-sonando):not(.escuchando) .voz-boca-wave {
  opacity: 0.55;
}

/* Lucy habla: misma pastilla + onda + anillo; latido (--boca-latido) sigue su voz. */
body.lucy-sonando:not(.escuchando) .voz-dock-centro {
  width: 220px;
  height: 74px;
  background: linear-gradient(145deg, #12141c 0%, #0e1018 55%, #0a0c12 100%);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: none;
  filter: none;
  transform: scale(calc(1 + var(--boca-latido, 0) * 0.085));
  transition: transform 0.05s ease-out, box-shadow 0.2s ease, width 0.28s ease, height 0.28s ease, background 0.25s ease;
}
body.lucy-sonando:not(.escuchando) .voz-dock-centro:hover {
  transform: scale(calc(1.02 + var(--boca-latido, 0) * 0.085));
}
body.lucy-sonando:not(.escuchando) .voz-borde-giro {
  opacity: 1;
  animation: boca-anillo-respira 2s ease-in-out infinite;
  box-shadow:
    0 0 8px rgba(94, 200, 255, 0.42),
    0 0 18px rgba(78, 159, 255, 0.3),
    0 0 28px rgba(143, 84, 255, 0.18);
}
body.lucy-sonando:not(.escuchando) .voz-borde-giro::before {
  animation-duration: 1.8s;
  background: conic-gradient(
    from 0deg,
    #5ec8ff 0deg,
    #4e9fff 90deg,
    #8f54ff 180deg,
    #67e8f9 270deg,
    #5ec8ff 360deg
  );
}
body.lucy-sonando:not(.escuchando) .voz-boca-glow {
  opacity: 0;
  animation: none;
}
body.lucy-sonando:not(.escuchando) .voz-boca-wave {
  width: 96%;
  height: 72%;
  opacity: 1;
}
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(1)  { animation-delay: 0s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(2)  { animation-delay: -0.06s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(3)  { animation-delay: -0.12s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(4)  { animation-delay: -0.18s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(5)  { animation-delay: -0.24s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(6)  { animation-delay: -0.3s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(7)  { animation-delay: -0.36s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(8)  { animation-delay: -0.42s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(9)  { animation-delay: -0.48s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(10) { animation-delay: -0.54s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(11) { animation-delay: -0.6s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(12) { animation-delay: -0.66s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(13) { animation-delay: -0.72s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(14) { animation-delay: -0.78s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(15) { animation-delay: -0.84s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(16) { animation-delay: -0.9s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(17) { animation-delay: -0.96s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(18) { animation-delay: -1.02s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(19) { animation-delay: -1.08s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(20) { animation-delay: -1.14s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(21) { animation-delay: -1.2s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(22) { animation-delay: -1.26s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(23) { animation-delay: -0.08s; }
body.lucy-sonando:not(.escuchando) .voz-dock-ondas i:nth-child(24) { animation-delay: -0.14s; }

@keyframes ola-viaje {
  0%   { transform: scaleY(0.28); }
  18%  { transform: scaleY(0.95); }
  36%  { transform: scaleY(0.42); }
  55%  { transform: scaleY(1.18); }
  72%  { transform: scaleY(0.55); }
  88%  { transform: scaleY(0.88); }
  100% { transform: scaleY(0.28); }
}
/* El conic gira; la máscara deja solo el borde de la pastilla. */
@keyframes boca-anillo-gira {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes boca-anillo-respira {
  0%, 100% {
    opacity: 0.72;
    filter: saturate(1) brightness(1);
    box-shadow:
      0 0 8px rgba(78, 159, 255, 0.2),
      0 0 18px rgba(143, 84, 255, 0.16);
  }
  50% {
    opacity: 1;
    filter: saturate(1.12) brightness(1.1);
    box-shadow:
      0 0 12px rgba(78, 159, 255, 0.35),
      0 0 26px rgba(232, 88, 255, 0.22);
  }
}
@keyframes borde-giro {
  to { transform: rotate(360deg); }
}

/* Legacy: body.hablando ya no late ni anima ondas (usa .pensando / .lucy-sonando). */
body.hablando:not(.lucy-sonando):not(.pensando):not(.escuchando) .voz-dock-centro {
  animation: none;
}
body:not(.escuchando):not(.lucy-sonando) .voz-dock-ondas i {
  height: 5px;
  opacity: 0.28;
  animation: none;
}
body.hablando:not(.escuchando) .voz-dock,
body.pensando .voz-dock,
body.lucy-sonando .voz-dock {
  opacity: 1;
}
body.escuchando .voz-dock {
  opacity: 1;
}

/* legado: orbe-btn ya no se usa en vivo; se mantiene tamaño por si vuelve */
.orbe-btn { display: none; }
#eco { display: none; }

.rejilla { display: none; }

/* ── Orbe pequeño en el cajón ─────────────────────────────────── */
.orbe-caja-btn {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--borde);
  background:
    radial-gradient(circle at 50% 50%, rgba(124, 92, 255, 0.22), transparent 70%),
    var(--icono-bg);
  padding: 0;
  overflow: visible;
  cursor: pointer;
  outline: none;
  border-radius: 50%;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.2s;
}
.orbe-caja-btn:hover {
  border-color: rgba(94, 200, 255, 0.45);
  box-shadow: 0 0 14px rgba(94, 200, 255, 0.22);
}
.orbe-caja-btn::before {
  content: "";
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 70%, var(--orbe-glow-a), transparent 55%),
    radial-gradient(circle at 70% 30%, var(--orbe-glow-b), transparent 52%);
  filter: blur(8px);
  opacity: 0.5;
  animation: aura-flota 5.5s ease-in-out infinite;
}
.caja-barras {
  display: flex;
  align-items: center;
  gap: 3.5px;
  height: 20px;
  pointer-events: none;
}
.caja-barras i {
  display: block;
  width: 4px;
  height: var(--h);
  border-radius: 99px;
  background: linear-gradient(180deg, #7de6ff, #5ec8ff 50%, #967cfa);
  box-shadow: 0 0 6px rgba(94, 200, 255, 0.55);
}
.caja-barras i:nth-child(1) { --h: 10px; }
.caja-barras i:nth-child(2) { --h: 19px; }
.caja-barras i:nth-child(3) { --h: 12px; }
body.escuchando .orbe-caja-btn::before,
body.hablando .orbe-caja-btn::before {
  animation-duration: 2s;
  filter: blur(11px);
  opacity: 1;
  background:
    radial-gradient(circle at 30% 70%, var(--orbe-glow-activo-a), transparent 55%),
    radial-gradient(circle at 70% 30%, var(--orbe-glow-activo-b), transparent 52%);
}
.orbe-caja-btn.activo::before {
  opacity: 1;
  animation-duration: 1.6s;
  filter: blur(14px);
}

/* ── Home / bienvenida ───────────────────────────────────────── */
#inicio.inicio {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 28px 8px;
  min-height: 0;
  overflow: auto;
  text-align: center;
}
body.en-inicio:not(.voz) #inicio.inicio {
  display: flex;
}
body.en-inicio:not(.voz) #mensajes,
body.en-inicio:not(.voz) #chips-chat {
  display: none;
}
body.en-inicio:not(.voz) .escenario {
  display: none !important;
}
#inicio-saludo {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--texto-fuerte);
  line-height: 1.25;
}
#inicio-sub {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 36ch;
}
.inicio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.inicio-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(860px, 100%);
  margin-top: 18px;
}
.inicio-card {
  text-align: left;
  padding: 14px 14px 12px;
  border-radius: 16px;
  background: var(--vidrio);
  border: 1px solid var(--borde);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 118px;
}
.inicio-card-ico {
  font-size: 14px;
  color: var(--acento);
  opacity: 0.9;
}
.inicio-card h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--texto-fuerte);
}
.inicio-card p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  flex: 1;
}
.inicio-card-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--acento);
  background: rgba(143, 84, 255, 0.12);
  border: 1px solid rgba(143, 84, 255, 0.22);
  border-radius: 999px;
  padding: 3px 8px;
}
html.tema-dia .inicio-card-badge {
  background: rgba(143, 84, 255, 0.1);
}

/* Columna de lectura centrada (como ChatGPT/Gemini): mensajes y caja comparten el ancho. */
:root { --columna: 780px; }
#mensajes {
  flex: 1;
  overflow: auto;
  padding: 8px max(28px, calc((100% - var(--columna)) / 2));
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}
#mensajes::-webkit-scrollbar,
#lista::-webkit-scrollbar,
aside::-webkit-scrollbar {
  width: 8px;
}
#mensajes::-webkit-scrollbar-track,
#lista::-webkit-scrollbar-track,
aside::-webkit-scrollbar-track {
  background: transparent;
}
#mensajes::-webkit-scrollbar-thumb,
#lista::-webkit-scrollbar-thumb,
aside::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
#mensajes::-webkit-scrollbar-thumb:hover,
#lista::-webkit-scrollbar-thumb:hover,
aside::-webkit-scrollbar-thumb:hover {
  background: var(--acento);
  background-clip: padding-box;
}
.msg { max-width: 100%; display: flex; gap: 8px; align-items: flex-end; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }
.msg.assistant { align-self: flex-start; align-items: flex-start; }
.msg-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}
.msg-acciones {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 0 2px 6px;
  opacity: 0.85;
  position: relative;
}
.msg-copiado {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--texto);
  background: var(--menu-bg);
  border: 1px solid var(--borde-fuerte);
  box-shadow: 0 4px 16px var(--sombra);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.18s, transform 0.18s;
  white-space: nowrap;
}
.msg-copiado.visible {
  opacity: 1;
  transform: translateY(0);
}
.msg-acciones.oculto { display: none; }
.msg-acciones.leyendo .msg-btn-voz {
  color: var(--acento-suave);
  background: rgba(232, 121, 249, 0.12);
}
.msg-btn-pausa.oculto { display: none; }
.msg-acciones.leyendo .msg-btn-pausa {
  color: var(--acento);
}
.msg-acciones.pausada .msg-btn-pausa {
  color: #fde047;
  background: rgba(253, 224, 71, 0.12);
}
html.tema-dia .msg-acciones.pausada .msg-btn-pausa {
  color: #ca8a04;
  background: rgba(253, 224, 71, 0.18);
}
.msg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 7px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.msg-btn:hover {
  color: var(--texto);
  background: var(--hover-suave);
}
.msg-btn.activo {
  color: var(--acento);
  background: rgba(143, 84, 255, 0.12);
}
.msg .cuerpo {
  font-weight: 400;
  color: var(--texto-fuerte);
}
.msg.user .cuerpo {
  padding: 11px 16px;
  border-radius: 22px;
  border-bottom-right-radius: 8px;
  background: var(--msg-user);
  border: 1px solid var(--msg-user-borde);
  color: #fff;
}
.msg.user {
  position: relative;
}
.msg.user .msg-editar {
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translate(-100%, -50%);
  margin-right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.msg.user:hover .msg-editar,
.msg.user .msg-editar:focus-visible {
  opacity: 1;
}
.msg.user .msg-editar:hover {
  color: var(--texto);
  background: rgba(255, 255, 255, 0.08);
}
.msg.assistant .cuerpo {
  padding: 2px 4px 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  color: var(--msg-asst);
  line-height: 1.55;
  max-width: 100%;
}
.msg.assistant .cuerpo p {
  margin: 0 0 0.7em;
}
.msg.assistant .cuerpo .lucy-img {
  display: block;
  max-width: min(100%, 420px);
  margin: 8px 0 4px;
  border-radius: 16px;
}
.msg.assistant .cuerpo p:last-child {
  margin-bottom: 0;
}
.msg.assistant .cuerpo ul {
  margin: 0.35em 0 0.85em;
  padding-left: 1.25em;
}
.msg.assistant .cuerpo li {
  margin: 0.28em 0;
}
.msg.assistant .cuerpo strong.md-h {
  display: block;
  margin: 0.55em 0 0.25em;
  font-weight: 650;
}
.msg.assistant .cuerpo .md-sub {
  margin: 1em 0 0.35em;
}
.msg.assistant .cuerpo .md-sub:first-child {
  margin-top: 0.25em;
}
.msg.assistant .cuerpo .md-sub strong {
  font-weight: 650;
}
.msg.assistant .cuerpo .md-paso {
  margin: 0.35em 0;
}
.msg.assistant .cuerpo .md-num {
  opacity: 0.7;
  margin-right: 0.25em;
}

.chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 4px 20px 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chip-bg);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--chip-texto);
}

#caja {
  padding: 0 max(22px, calc((100% - var(--columna)) / 2)) calc(16px + env(safe-area-inset-bottom));
}
.caja-iris {
  padding: 1px;
  border-radius: 28px;
  background: var(--caja-anillo);
  box-shadow: 0 16px 40px rgba(143, 84, 255, 0.18);
}
.caja-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "texto texto"
    "mas acciones";
  align-items: center;
  background: var(--vidrio-fuerte);
  border-radius: 27px;
  padding: 10px 12px 8px;
  gap: 4px;
  backdrop-filter: blur(18px);
}
#adjuntar { grid-area: mas; justify-self: start; }
#caja textarea,
#mic-status { grid-area: texto; }
textarea {
  width: 100%;
  resize: none;
  border: none;
  background: transparent;
  color: var(--texto);
  font: inherit;
  min-height: 40px;
  max-height: 120px;
  padding: 6px 6px 8px;
  font-size: 16px;
}
textarea:focus { outline: none; }
textarea::placeholder { color: var(--placeholder); }
.caja-acciones {
  grid-area: acciones;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 2px;
  min-width: 0;
}

/* botón adjuntar (+) */
#adjuntar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--icono-color);
  border: 1.5px solid var(--borde);
  background: var(--icono-bg);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
#adjuntar:hover { background: var(--hover); border-color: var(--borde-fuerte); }

/* espacio flexible entre orbe y botones derechos */
.caja-espacio { flex: 1; }
#mic-status {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  color: #8ff4ff;
  border: 1px solid rgba(103, 232, 249, 0.22);
}
body.escuchando #mic-status {
  display: inline-flex;
}
#mic-status .punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #67e8f9;
  box-shadow: 0 0 0 0 rgba(103, 232, 249, 0.6);
  animation: pulso-mic 1.05s ease-out infinite;
  flex-shrink: 0;
}
#mic-status .texto {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#mic-status .barras {
  display: inline-flex;
  align-items: end;
  gap: 3px;
  margin-left: 2px;
  flex-shrink: 0;
}
#mic-status .barras i {
  width: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.95;
}
#mic-status .barras i:nth-child(1) { height: calc(8px + var(--mic-nivel, 0.08) * 14px); }
#mic-status .barras i:nth-child(2) { height: calc(10px + var(--mic-nivel, 0.08) * 20px); }
#mic-status .barras i:nth-child(3) { height: calc(7px + var(--mic-nivel, 0.08) * 12px); }
@keyframes pulso-mic {
  0% { box-shadow: 0 0 0 0 rgba(103, 232, 249, 0.5); }
  100% { box-shadow: 0 0 0 10px rgba(103, 232, 249, 0); }
}
#dictar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--icono-color);
  border: 1.5px solid var(--borde);
  background: var(--icono-bg);
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
#dictar .lbl-dictar { display: none; }
#dictar .ic-stop { display: none; }
#dictar.activo .ic-mic,
body.escuchando #dictar .ic-mic { display: none; }
#dictar.activo .ic-stop,
body.escuchando #dictar .ic-stop { display: block; }
#dictar.activo,
body.escuchando #dictar {
  background: rgba(34, 211, 238, 0.15);
  color: #67e8f9;
  border-color: rgba(103, 232, 249, 0.45);
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.28), inset 0 0 8px rgba(103, 232, 249, 0.08);
  animation: mic-pulso 1.4s ease-in-out infinite;
}
@keyframes mic-pulso {
  0%, 100% { box-shadow: 0 0 10px rgba(103, 232, 249, 0.25), inset 0 0 6px rgba(103, 232, 249, 0.06); }
  50% { box-shadow: 0 0 20px rgba(103, 232, 249, 0.55), inset 0 0 12px rgba(103, 232, 249, 0.14); }
}
#enviar {
  width: auto;
  min-width: 44px;
  height: 40px;
  border-radius: 999px;
  padding: 0 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--acento-suave), var(--acento));
  color: #fff;
  box-shadow: 0 8px 18px rgba(143, 84, 255, 0.4);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}
#enviar .ic-stop-gen { display: none; }
body.generando #enviar {
  background: linear-gradient(180deg, #5a5a68, #3a3a46);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
body.generando #enviar .ic-send { display: none; }
body.generando #enviar .ic-stop-gen { display: block; }

/* Tras «Parar»: segundo paso opcional, como en Cursor. */
#caja { position: relative; }
.revertir-chip {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  z-index: 5; display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 5px 6px 5px 14px; border-radius: 999px;
  font-size: 13px; color: var(--muted, #94a3b8);
  background: rgba(20, 22, 30, 0.94); border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  animation: chip-entra 0.18s ease-out;
}
.revertir-chip[hidden] { display: none; }
.revertir-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 600; color: #fff; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(143, 84, 255, 0.55);
  background: linear-gradient(180deg, var(--acento-suave), var(--acento));
}
.revertir-btn:hover { filter: brightness(1.08); }
.revertir-cerrar {
  width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--muted, #94a3b8); background: transparent;
}
.revertir-cerrar:hover { background: rgba(148, 163, 184, 0.15); color: #e2e8f0; }
html.tema-dia .revertir-chip { background: rgba(255, 255, 255, 0.96); color: #475569; border-color: #cbd5e1; }
@keyframes chip-entra { from { opacity: 0; transform: translate(-50%, 6px); } }
html.tema-dia body.generando #enviar {
  background: linear-gradient(180deg, #6b6b78, #4a4a56);
}

#registro {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
}
#velo {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--velo);
  z-index: 4;
}
body.menu #velo { display: block; }

body.escuchando #eco { color: var(--acento-azul); }


@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* El aro de la caja trae su propio brillo: fuera la mancha borrosa de atrás. */
.orbe-caja-btn::before { display: none !important; }

/* Selector de modo: misma pastilla que el cerebro. */
#modo-pill-wrap { margin-left: auto; }
#cerebro-pill-wrap { margin-left: 8px; }
.cerebro-pill.es-voz { border-color: rgba(45, 212, 191, 0.4); background: rgba(13, 148, 136, 0.16); color: #99f6e4; }
.cerebro-pill.es-texto { border-color: rgba(148, 163, 184, 0.4); background: rgba(71, 85, 105, 0.22); color: #e2e8f0; }
@keyframes modo-parpadeo { 50% { opacity: 0.25; } }
html.tema-dia .cerebro-pill.es-voz { color: #0f766e; }
html.tema-dia .cerebro-pill.es-texto { color: #334155; }

/* Punto de salud: verde funciona, rojo falla, gris sin cuota, ámbar encendiendo. */
.cerebro-pill[data-salud] .cerebro-pill-dot { transition: background 0.3s, box-shadow 0.3s; }
.cerebro-pill[data-salud="ok"] .cerebro-pill-dot {
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18), 0 0 8px rgba(34, 197, 94, 0.7);
}
.cerebro-pill[data-salud="error"] .cerebro-pill-dot {
  background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2), 0 0 8px rgba(239, 68, 68, 0.75);
}
.cerebro-pill[data-salud="sin_cuota"] .cerebro-pill-dot {
  background: #64748b; box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.18);
}
.cerebro-pill[data-salud="cargando"] .cerebro-pill-dot {
  background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
  animation: modo-parpadeo 0.9s ease-in-out infinite;
}

/* Menú propio de las pastillas (el nativo de Windows sale blanco). */
.cerebro-pill select { pointer-events: none; }
.cerebro-pill.abierta { border-color: rgba(167, 139, 250, 0.7); }
.pill-menu {
  position: fixed; z-index: 10000;
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px; border-radius: 16px;
  background: rgba(16, 17, 26, 0.96);
  border: 1px solid rgba(143, 84, 255, 0.32);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) inset, 0 0 24px rgba(143, 84, 255, 0.12);
  backdrop-filter: blur(12px);
  animation: pill-menu-entra 0.14s ease-out;
}
@keyframes pill-menu-entra { from { opacity: 0; transform: translateY(-4px); } }
.pill-menu-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 12px 8px 8px; border: 0; border-radius: 11px;
  background: transparent; color: #e2e8f0; font: inherit; font-size: 13px; cursor: pointer;
}
.pill-menu-item:hover, .pill-menu-item:focus-visible {
  outline: none; background: rgba(143, 84, 255, 0.16);
}
.pill-menu-item.actual { background: rgba(143, 84, 255, 0.22); color: #fff; }
.pill-menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.pill-menu-check { width: 16px; display: grid; place-items: center; color: #c4b5fd; visibility: hidden; }
.pill-menu-item.actual .pill-menu-check { visibility: visible; }
.pill-menu-textos { display: flex; flex-direction: column; gap: 2px; }
.pill-menu-titulo { font-weight: 600; }
.pill-menu-desc { font-size: 11.5px; color: #94a3b8; }
html.tema-dia .pill-menu { background: rgba(255, 255, 255, 0.97); border-color: rgba(124, 58, 237, 0.25); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18); }
html.tema-dia .pill-menu-item { color: #1e293b; }
html.tema-dia .pill-menu-item:hover, html.tema-dia .pill-menu-item:focus-visible { background: rgba(124, 58, 237, 0.08); }
html.tema-dia .pill-menu-item.actual { background: rgba(124, 58, 237, 0.12); color: #1e1b4b; }
html.tema-dia .pill-menu-desc { color: #64748b; }

/* Solo texto: el modo en vivo queda bloqueado; dictar sigue funcionando. */
body.modo-texto :is(#orbe-caja-btn, #pill-hablar, #voz-volver) {
  opacity: 0.35; cursor: not-allowed; filter: grayscale(0.8);
}
.lucy-aviso {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 9999;
  font: 13px "Segoe UI", "Lucy Respaldo", system-ui, sans-serif; color: #e2e8f0;
  background: rgba(15, 17, 24, 0.92); border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px; padding: 8px 16px; pointer-events: none;
}

#menu-perfiles {
  position: fixed; z-index: 80; width: min(320px, calc(100vw - 16px));
  padding: 8px; border-radius: 16px;
  background: rgba(15, 17, 24, 0.96); border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
#menu-perfiles[hidden] { display: none; }
#menu-perfiles button {
  display: block; width: 100%; text-align: left; border: 0; border-radius: 12px;
  background: transparent; color: #e2e8f0; font: inherit; padding: 10px 12px; cursor: pointer;
}
#menu-perfiles button span {
  display: block; margin-top: 2px; font-size: 12px; color: #94a3b8; font-weight: 400;
}
#menu-perfiles button.actual { background: rgba(11, 138, 122, 0.22); }
#menu-perfiles button:hover { background: rgba(148, 163, 184, 0.12); }
#menu-perfiles-app {
  margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(148, 163, 184, 0.2);
}
#menu-perfiles-app p { margin: 0 8px 8px; font-size: 12.5px; line-height: 1.4; color: #cbd5e1; }
#menu-perfiles .menu-enlace { display: block; margin: 0 4px 8px; }
#menu-perfiles .menu-enlace span { display: block; margin: 0 4px 4px; font-size: 12px; color: #94a3b8; }
#menu-perfiles .menu-enlace input {
  width: 100%; box-sizing: border-box; margin: 0 0 4px; padding: 8px;
  border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0b0d12; color: #e2e8f0; font: 13px/1.3 ui-monospace, Consolas, monospace;
}
html.tema-dia #menu-perfiles { background: #fff; border-color: rgba(15, 23, 42, 0.12); }
html.tema-dia #menu-perfiles button { color: #1e293b; }
html.tema-dia #menu-perfiles-app p { color: #475569; }

#puerta-app {
  position: fixed; inset: 0; z-index: 10000;
  display: grid; place-items: center; padding: 24px;
  background: #0f1118; color: #e2e8f0;
  font: 18px/1.45 "Segoe UI", "Lucy Respaldo", system-ui, sans-serif;
}
.puerta-caja { width: min(360px, 100%); text-align: center; }
.puerta-hola { font-size: 28px; margin: 0 0 8px; }
.puerta-caja input {
  width: 100%; box-sizing: border-box; margin: 16px 0 12px;
  font-size: 28px; letter-spacing: 0.3em; text-align: center;
  padding: 12px; border-radius: 14px; border: 1px solid rgba(148, 163, 184, 0.4);
  background: #1a1d27; color: #fff;
}
.puerta-caja button {
  width: 100%; font: inherit; font-size: 18px; padding: 12px;
  border: 0; border-radius: 14px; background: #0b8a7a; color: #fff; cursor: pointer;
}
#puerta-error { color: #fca5a5; }
