/* ==========================================================================
   Copelito Face - estilos de la tablet (modo kiosco)
   ========================================================================== */
:root {
  --bg: #0b0f19;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #374151;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #3b82f6;
  --cyan: #22d3ee;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --crossfade: 220ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
}

/* ---------- Barra superior ---------- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(17, 24, 39, .92);
  border-bottom: 1px solid var(--line);
  font-size: clamp(13px, 1.4vw, 16px);
  color: var(--muted);
  z-index: 10;
}
.status-bar .group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status-bar .brand { font-weight: 600; color: var(--text); }
.status-bar .device { font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 640px) {
  .status-bar { padding: 8px 10px; gap: 6px; }
  .status-bar .group { gap: 5px; }
  .status-bar .net-text { font-size: 11px; white-space: nowrap; }
  .status-bar .hamburger-btn { width: 34px; height: 34px; font-size: 15px; padding: 0; flex-shrink: 0; }
}
.dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 10px var(--ok);
  transition: background .3s, box-shadow .3s;
  flex: none;
}
.dot[data-status="online"]     { background: var(--ok);     box-shadow: 0 0 10px var(--ok); }
.dot[data-status="connecting"] { background: var(--warn);   box-shadow: 0 0 10px var(--warn); animation: dot-pulse 1s infinite alternate; }
.dot[data-status="offline"]    { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
@keyframes dot-pulse { from { opacity: .4 } to { opacity: 1 } }

/* ---------- Escenario ---------- */
.robot-stage {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 40%, var(--user-bg, #1f2937) 0%, var(--bg) 70%);
  overflow: hidden;
}
/* Halo de fondo que cambia con el estado */
.robot-stage::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 45%, var(--user-aura, var(--halo, rgba(59,130,246,.18))) 0%, transparent 55%);
  transition: background 600ms;
  pointer-events: none;
}
body[data-state="happy"]    .robot-stage::before { --halo: rgba(16,185,129,.25); }
body[data-state="thinking"] .robot-stage::before { --halo: rgba(245,158,11,.22); }
body[data-state="speaking"]  .robot-stage::before { --halo: rgba(34,211,238,.25); }
body[data-state="listening"] .robot-stage::before,
body.followup               .robot-stage::before { --halo: rgba(34,211,238,.42); }
body[data-state="sad"]      .robot-stage::before { --halo: rgba(239,68,68,.22); }

.robot-character {
  position: relative;
  height: min(88%, 92vh);
  aspect-ratio: var(--base-ratio, 473 / 1024);
  max-width: 92vw;
  transform-origin: 50% 80%;
  animation: holo-float 4.2s ease-in-out infinite;
  opacity: 0;
  transition: opacity .35s ease;
}
.robot-character.ready { opacity: 1; }
.robot-character img.base {
  position: relative;
  z-index: 2;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 1.5%, rgba(0,0,0,.38) 7%, rgba(0,0,0,.82) 15%, #000 24%);
  mask-image: linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 1.5%, rgba(0,0,0,.38) 7%, rgba(0,0,0,.82) 15%, #000 24%);
  filter: drop-shadow(0 0 18px rgba(var(--user-aura-rgb, 34,211,238), .32));
}
.face-overlay { z-index: 3; }
@keyframes holo-float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }

/* Efecto holograma / genio tecnológico desde el centro de la elipse hacia arriba */
.holo-emitter {
  position: absolute;
  left: 50%;
  bottom: -4%;
  width: 150%;
  height: 82%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}
.holo-base-ring {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 74%;
  height: 12%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(var(--user-aura-rgb, 34,211,238), .72) 0%, rgba(var(--user-aura-rgb, 99,102,241), .32) 48%, transparent 76%);
  box-shadow: 0 0 28px rgba(var(--user-aura-rgb, 34,211,238), .62), 0 0 54px rgba(var(--user-aura-rgb, 99,102,241), .30);
  animation: holo-ring-pulse 2.6s ease-in-out infinite;
}
.holo-base-ring::after {
  content: '';
  position: absolute;
  inset: 18% 12%;
  border-radius: 50%;
  border: 2px solid rgba(var(--user-aura-rgb, 103,232,249), .82);
  box-shadow: inset 0 0 12px rgba(var(--user-aura-rgb, 34,211,238), .65);
}
.holo-beam {
  position: absolute;
  left: 50%;
  bottom: 3%;
  width: 100%;
  height: 95%;
  transform: translateX(-50%);
  clip-path: polygon(27% 100%, 73% 100%, 98% 0%, 2% 0%);
  -webkit-mask-image: linear-gradient(to top, transparent 0%, rgba(0,0,0,.65) 5%, #000 14%);
  mask-image: linear-gradient(to top, transparent 0%, rgba(0,0,0,.65) 5%, #000 14%);
  background:
    repeating-linear-gradient(to top, rgba(var(--user-aura-rgb, 34,211,238), .09) 0 2px, transparent 2px 9px),
    linear-gradient(to top, rgba(var(--user-aura-rgb, 34,211,238), .32) 0%, rgba(var(--user-aura-rgb, 99,102,241), .14) 38%, rgba(var(--user-aura-rgb, 34,211,238), .05) 70%, transparent 98%);
  filter: blur(1.5px);
  animation: holo-scan 5s linear infinite;
}
.holo-mist {
  position: absolute;
  inset: 0;
  overflow: visible;
}
.holo-mist span {
  position: absolute;
  bottom: 3%;
  left: 50%;
  width: 34%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.55) 0%, rgba(99,102,241,.22) 55%, transparent 75%);
  filter: blur(12px);
  opacity: 0;
  animation: holo-rise 3.6s ease-out infinite;
}
.holo-mist span:nth-child(1) { margin-left: -20%; animation-delay: 0s; }
.holo-mist span:nth-child(2) { margin-left: -4%;  animation-delay: .7s; width: 40%; }
.holo-mist span:nth-child(3) { margin-left: -32%; animation-delay: 1.4s; width: 28%; }
.holo-mist span:nth-child(4) { margin-left: 8%;   animation-delay: 2.1s; width: 30%; }
.holo-mist span:nth-child(5) { margin-left: -14%; animation-delay: 2.8s; width: 36%; }

@keyframes holo-ring-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: .88; }
  50%      { transform: translateX(-50%) scale(1.06); opacity: 1; }
}
@keyframes holo-scan {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 0 -66px, 0 0; }
}
@keyframes holo-rise {
  0%   { transform: translateY(0) scale(.75); opacity: 0; }
  18%  { opacity: .7; }
  75%  { opacity: .28; }
  100% { transform: translateY(-280%) scale(1.45); opacity: 0; }
}
/* Pequeñas animaciones de cuerpo por estado */
body[data-state="happy"]    .robot-character { animation: bounce 1.1s ease-in-out infinite; }
body[data-state="sad"]      .robot-character { animation: droop 2.4s ease-in-out infinite; }
body[data-state="thinking"] .robot-character { animation: sway 3s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes droop  { 0%,100% { transform: rotate(0deg) translateY(0) } 50% { transform: rotate(-1.5deg) translateY(4px) } }
@keyframes sway   { 0%,100% { transform: rotate(-.6deg) } 50% { transform: rotate(.6deg) } }

/* ---------- Visera: aquí se apilan los sprites ---------- */
.face-overlay {
  position: absolute;
  top: var(--fb-top, 20%);
  left: var(--fb-left, 20%);
  width: var(--fb-width, 60%);
  height: var(--fb-height, 31.7%);
  pointer-events: none;
  overflow: hidden;
}
.face-overlay.calibrate { outline: 2px dashed #f0f; outline-offset: -2px; background: rgba(255,0,255,.12); }

.face-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0;
  will-change: opacity;
}
.face-frame.active { opacity: 1; }
.face-frame.missing { visibility: hidden; }
/* Solo hacemos fundido en cambios de estado; parpadeo y boca son instantáneos */
.face-overlay.fade .face-frame { transition: opacity var(--crossfade) ease-in-out; }
.face-overlay.char-svg-mode .face-frame { opacity: 0 !important; transition: none !important; }
.face-overlay .char-svg-face { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.robot-character img.base { position: relative; z-index: 2; }
.char-back-layer { position: absolute; inset: -6% -26% -4% -26%; z-index: 1; pointer-events: none; }
.char-front-layer { position: absolute; inset: -14% -16% -4% -16%; z-index: 4; pointer-events: none; }
.char-back-layer svg, .char-front-layer svg { width: 100%; height: 100%; display: block; overflow: visible; }
@keyframes char-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.char-acc-float { animation: char-float 2.6s ease-in-out infinite; }

/* Pulso de "procesando" sobre la visera */
.face-overlay::after {
  content: '';
  position: absolute; inset: -10%;
  background: radial-gradient(circle, rgba(0,162,255,.35) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.face-overlay[data-state="thinking"]::after { opacity: 1; animation: pulse-glow 1.4s infinite alternate; }
@keyframes pulse-glow { from { transform: scale(.92); opacity: .35 } to { transform: scale(1.08); opacity: .9 } }

/* Puntos de carga bajo la visera en "pensando" */
.thinking-dots {
  position: absolute;
  left: 50%; top: calc(var(--fb-top, 20%) + var(--fb-height, 31.7%) + 1.5%);
  transform: translateX(-50%);
  display: flex; gap: 8px;
  opacity: 0; transition: opacity .3s;
}
body[data-state="thinking"] .thinking-dots { opacity: 1; }
.thinking-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: dots 1.2s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: .2s }
.thinking-dots span:nth-child(3) { animation-delay: .4s }
@keyframes dots { 0%,80%,100% { transform: scale(.5); opacity: .4 } 40% { transform: scale(1); opacity: 1 } }

/* ---------- Marquesina Holográfica HUD (Subtítulos hacia arriba, no tapan a Copelito) ---------- */
.hud-marquee-container,
.message-bubble {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  width: min(92vw, 640px);
  max-height: 72px;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(8, 14, 28, 0.42) 0%, rgba(15, 23, 42, 0.78) 100%);
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 16px rgba(34, 211, 238, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 18px;
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 86%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 86%, transparent 100%);
}
.hud-marquee-container.visible,
.message-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.hud-marquee-track {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hud-marquee-line {
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 600;
  color: #f8fafc;
  text-align: center;
  line-height: 1.35;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.55);
  animation: hudLineFadeIn .3s ease-out;
  word-break: break-word;
}
@keyframes hudLineFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Panel táctil de pruebas ---------- */
.control-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
}
body.hide-panel .control-panel { display: none; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #2563eb;          /* blanco sobre este azul: 5.2:1 (AA) */
  color: #fff;
  border: 0;
  padding: 12px 20px;
  min-height: 48px;           /* área táctil cómoda */
  font: inherit;
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,.25);
  transition: background .15s, transform .08s;
}
.btn:active { transform: scale(.95); }
.btn.active { background: var(--ok); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--muted); }
/* hover solo en dispositivos con ratón (evita hover "pegado" en táctil) */
@media (hover: hover) { .btn:hover { filter: brightness(1.12); } }

/* ---------- Legal: línea permanente y aviso inicial ---------- */
.legal-bar {
  position: fixed;
  right: 12px;
  bottom: 76px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(90vw, 440px);
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.legal-bar.open {
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, .94);
}
.legal-toggle {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.legal-text { display: none; }
.legal-bar.open .legal-text { display: inline; }
.legal-bar a { color: var(--cyan); text-decoration: none; }
.notice-modal {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(11, 15, 25, .92);
  z-index: 100;
  padding: 24px;
}
.notice-modal.open { display: flex; }
#shareModal { z-index: 120; }
#shareModal .notice-card { width: min(400px, 92vw); max-width: 92vw; padding: 18px; gap: 10px; }
#shareModal .btn { min-height: 44px; padding: 10px 14px; font-size: 14px; }
#shareModal input { box-sizing: border-box; max-width: 100%; }
#embedModal { z-index: 130; }
.notice-card {
  width: min(720px, 96vw);
  max-width: 96vw;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.notice-card > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.notice-card h2 { font-size: clamp(20px, 2.4vw, 26px); }
.notice-text { white-space: pre-line; color: var(--text); font-size: clamp(14px, 1.5vw, 17px); line-height: 1.5; max-height: 50vh; overflow: auto; }
.notice-card .btn { justify-self: center; min-height: 56px; padding: 14px 32px; font-size: 18px; }

/* ---------- Barra de acciones del asistente (micro, manos libres, QR) ---------- */
.action-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.btn-mic {
  min-height: 60px;
  padding: 14px 28px;
  font-size: clamp(16px, 1.8vw, 20px);
  border-radius: 999px;
  background: var(--cyan);
  color: #06202a;
  touch-action: none;           /* mantener pulsado sin scroll */
}
.btn-mic.active { background: var(--danger); color: #fff; animation: mic-pulse 1s infinite; }
@keyframes mic-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5) } 50% { box-shadow: 0 0 0 12px rgba(239,68,68,0) } }
.btn-sm { padding: 8px 14px; min-height: 40px; font-size: 14px; }
.voice-select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; max-width: 320px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-outline.active { border-color: var(--cyan); color: var(--cyan); }

/* Anillo de escucha alrededor de la visera (notorio y luminoso) */
.listen-ring {
  position: absolute;
  top: calc(var(--fb-top, 20%) - 3.5%);
  left: calc(var(--fb-left, 20%) - 3.5%);
  width: calc(var(--fb-width, 60%) + 7%);
  height: calc(var(--fb-height, 31.7%) + 7%);
  border-radius: 30%;
  border: 4px solid #22d3ee;
  box-shadow: 0 0 26px rgba(34,211,238,.9), inset 0 0 18px rgba(34,211,238,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
body[data-state="listening"] .listen-ring,
body.followup .listen-ring { opacity: 1; animation: ring 1.15s ease-in-out infinite alternate; }
body.followup:not([data-state="listening"]) .listen-ring { border-style: dashed; }
@keyframes ring { 0% { transform: scale(.98); opacity: .6; box-shadow: 0 0 16px rgba(34,211,238,.65), inset 0 0 10px rgba(34,211,238,.25); } 100% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 34px rgba(34,211,238,1), inset 0 0 22px rgba(34,211,238,.55); } }

/* Pill HUD de escucha activa con ecualizador */
.listen-hud {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(8, 22, 38, .9);
  border: 1.5px solid rgba(34, 211, 238, .85);
  box-shadow: 0 0 24px rgba(34, 211, 238, .4);
  color: #ecfeff;
  font-size: 14px;
  font-weight: 700;
  max-width: min(88vw, 480px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
body[data-state="listening"] .listen-hud,
body.followup .listen-hud { opacity: 1; transform: translateX(-50%) translateY(0); }
#listenHudText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listen-eq { display: inline-flex; align-items: center; gap: 3px; height: 18px; }
.listen-eq i { display: block; width: 3.5px; height: 6px; border-radius: 99px; background: #22d3ee; animation: eqbar .7s ease-in-out infinite alternate; }
.listen-eq i:nth-child(2) { animation-delay: .12s; }
.listen-eq i:nth-child(3) { animation-delay: .24s; }
.listen-eq i:nth-child(4) { animation-delay: .36s; }
.listen-eq i:nth-child(5) { animation-delay: .48s; }
@keyframes eqbar { from { height: 5px; opacity: .6; } to { height: 18px; opacity: 1; } }

/* Modo Ambiente / Reposo (Modo Sala 24/7) */
.ambient-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(4, 7, 14, .92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  cursor: pointer;
}
.ambient-overlay[hidden] { display: none; }
.ambient-clock { font-size: clamp(54px, 14vw, 118px); font-weight: 800; letter-spacing: 2px; color: #e2e8f0; line-height: 1; }
.ambient-date { margin-top: 10px; font-size: clamp(15px, 3vw, 22px); color: #94a3b8; text-transform: capitalize; }
.ambient-hint { margin-top: 22px; font-size: 13px; color: #38bdf8; opacity: .85; }

/* ---------- Visor QR ---------- */
.qr-view {
  position: absolute;
  right: 3%;
  bottom: 4%;
  width: min(38vw, 420px);
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 16px;
  border: 2px solid var(--line);
  overflow: hidden;
  display: none;
  transition: border-color .2s;
}
.qr-view.open { display: block; }
.qr-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.qr-frame {
  position: absolute; inset: 15% 20%;
  border: 3px solid rgba(34,211,238,.9);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.35);
}
.qr-view.hit .qr-frame { border-color: #fff; }
.qr-view[data-result="ok"]        { border-color: var(--ok); }
.qr-view[data-result="duplicate"] { border-color: var(--warn); }
.qr-view[data-result="invalid"],
.qr-view[data-result="error"]     { border-color: var(--danger); }
.qr-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 14px;
  background: rgba(17,24,39,.9);
  color: var(--text);
  font-size: 15px;
  text-align: center;
}
.qr-close { position: absolute; top: 8px; right: 8px; padding: 6px 12px; min-height: 36px; font-size: 13px; background: rgba(17,24,39,.8); }

.fatal { position: fixed; inset: auto 0 0 0; background: #7f1d1d; color: #fff; padding: 12px; font-size: 13px; white-space: pre-wrap; }

/* ---------- Pantalla de Carga (Loader) ---------- */
.app-loader {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, #172033 0%, #080c14 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s ease;
}
.app-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.loader-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loader-spinner::before,
.loader-spinner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 3px solid transparent;
}
.loader-spinner::before {
  inset: 0;
  border-top-color: var(--cyan);
  border-right-color: var(--cyan);
  animation: loader-spin 1s linear infinite;
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.35);
}
.loader-spinner::after {
  inset: 10px;
  border-bottom-color: var(--accent);
  border-left-color: var(--accent);
  animation: loader-spin-reverse 1.4s linear infinite;
}
.loader-icon {
  font-size: 30px;
  animation: loader-pulse-icon 1.8s ease-in-out infinite alternate;
  user-select: none;
}
.loader-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 50%;
  animation: loader-pulse-icon 1.8s ease-in-out infinite alternate;
  user-select: none;
}
.loader-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}
.loader-subtitle {
  font-size: 14px;
  color: var(--muted);
  max-width: 300px;
  min-height: 20px;
}
.loader-progress-bar {
  width: 240px;
  height: 6px;
  background: rgba(31, 41, 55, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
  position: relative;
}
.loader-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 999px;
  transition: width 0.25s ease-out;
  box-shadow: 0 0 10px var(--cyan);
}
.loader-status {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  color: var(--cyan);
  font-weight: 600;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-spin-reverse { to { transform: rotate(-360deg); } }
@keyframes loader-pulse-icon { from { transform: scale(0.92); opacity: 0.8; } to { transform: scale(1.08); opacity: 1; } }

/* ---------- Header Móvil y Menú Hamburguesa ---------- */
.hamburger-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  flex: none;
}
.hamburger-btn:hover { background: #374151; border-color: var(--cyan); }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .status-bar { padding: 10px 14px; }
  .net-text { font-size: 12px; }
  .notice-card { padding: 16px; gap: 12px; border-radius: 14px; }
  .action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 12px;
  }
  .action-bar .btn-mic {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    font-size: 16px;
    justify-content: center;
  }
  .action-bar .btn-outline {
    width: 100%;
    min-height: 44px;
    padding: 8px 6px;
    font-size: 13px;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Drawer lateral */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(3px);
  z-index: 900;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.side-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  height: 100%; height: 100dvh;
  width: min(320px, 86vw);
  background: linear-gradient(180deg, #f8fafc 0%, #eff6ff 100%);
  color: #0f172a;
  border-left: 1px solid #cbd5e1;
  z-index: 950;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(15, 23, 42, .32);
}
.side-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border-bottom: 1px solid rgba(255,255,255,.2);
  font-weight: 700; font-size: 16px; color: #fff;
}
.drawer-close {
  background: transparent; border: none; color: #64748b;
  font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.drawer-header .drawer-close { color: rgba(255,255,255,.9); }
.drawer-close:hover { color: #0f172a; }
.drawer-header .drawer-close:hover { color: #fff; }
.drawer-body {
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 20px;
  overflow-y: auto; flex: 1; min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.drawer-section { display: flex; flex-direction: column; gap: 10px; }
.drawer-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: #0369a1; font-weight: 800;
}
.drawer-info {
  background: #ffffff; border: 1px solid #dbeafe;
  border-radius: 12px; padding: 12px;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
  display: flex; flex-direction: column; gap: 7px; font-size: 13px;
}
.drawer-info div { display: flex; justify-content: space-between; gap: 8px; }
.drawer-info span { color: #64748b; }
.drawer-info strong { color: #0f172a; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.drawer-link, .drawer-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: #ffffff; border: 1px solid #cbd5e1; border-left: 4px solid #0ea5e9;
  color: #0f172a; text-decoration: none; font: inherit; font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(15,23,42,.06);
  cursor: pointer; text-align: left; transition: border-color .2s, background .2s, transform .15s;
}
.drawer-link:hover, .drawer-btn:hover { background: #e0f2fe; border-color: #0284c7; transform: translateX(-2px); }
.side-drawer .voice-select, .side-drawer .drawer-row input { background: #ffffff; color: #0f172a; border-color: #cbd5e1; }
.drawer-row { display: flex; gap: 8px; }
.drawer-row input {
  flex: 1; min-width: 0; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 14px;
}
.drawer-row .btn { padding: 8px 14px; min-height: 38px; font-size: 14px; }

/* Pantallas apaisadas pequeñas */
@media (max-height: 600px) {
  .status-bar { padding: 8px 14px; }
  .control-panel { padding: 8px; gap: 6px; }
  .btn { padding: 8px 14px; min-height: 40px; }
}

/* ---------- Panel de Chat Escrito & Referencias ---------- */
.chat-toggle-btn { position: relative; font-size: 16px; }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--cyan); color: #06202a;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}
.chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  height: 100%; height: 100dvh;
  width: min(400px, 94vw);
  background: var(--panel); border-left: 1px solid var(--line);
  z-index: 62; display: flex; flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  transform: translateX(100%); transition: transform .25s ease;
  box-shadow: -8px 0 32px rgba(0,0,0,.55);
}
.chat-panel.open { transform: translateX(0); }
.chat-messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto 10px; line-height: 1.5; }
.chat-msg-item {
  padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45;
  max-width: 92%; word-break: break-word;
}
.chat-msg-item.user { align-self: flex-end; background: rgba(34,211,238,.14); border: 1px solid rgba(34,211,238,.35); color: #e2e8f0; }
.chat-msg-item.bot  { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); color: var(--text); }
.chat-links { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.chat-link-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 8px; text-decoration: none;
  font-size: 12.5px; font-weight: 600;
  background: rgba(99,102,241,.14); border: 1px solid rgba(99,102,241,.4); color: #c7d2fe;
}
.chat-link-chip.youtube {
  background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.45); color: #fecaca;
}
.chat-link-chip.maps {
  background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.45); color: #a7f3d0;
}
.chat-link-chip:hover { filter: brightness(1.15); }
.chat-form {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--line); background: var(--panel);
}
.chat-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); font: inherit; font-size: 14px;
}

.chat-img-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--line);
  background: rgba(34,211,238,.08); font-size: 12.5px; color: var(--text);
}
.chat-img-preview[hidden] { display: none; }
.chat-img-preview img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.chat-img-preview span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-img-preview button { background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }
.chat-msg-img { max-width: 100%; max-height: 180px; border-radius: 8px; margin-bottom: 6px; display: block; object-fit: contain; }

/* ---------- Microinteracción de Carga IA / Canvas ---------- */
.chat-msg-item.chat-msg-loading {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(34, 211, 238, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 15px rgba(34, 211, 238, 0.15);
  border-radius: 14px;
  padding: 12px 14px;
  animation: loadingGlow 2s infinite ease-in-out;
}
@keyframes loadingGlow {
  0%, 100% { border-color: rgba(34, 211, 238, 0.35); box-shadow: 0 4px 18px rgba(0,0,0,.3), 0 0 10px rgba(34,211,238,.12); }
  50% { border-color: rgba(99, 102, 241, 0.6); box-shadow: 0 4px 22px rgba(0,0,0,.4), 0 0 18px rgba(99,102,241,.25); }
}
.chat-loading-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-loading-content.canvas-mode {
  align-items: flex-start;
}
.chat-loading-pulse-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(34,211,238,0.2), rgba(99,102,241,0.25));
  border: 1.5px solid rgba(34, 211, 238, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  animation: pulseSpin 1.8s infinite ease-in-out;
}
@keyframes pulseSpin {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.5); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(34, 211, 238, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}
.chat-loading-texts {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-loading-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.2px;
}
.chat-loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin: 3px 0 2px 0;
  position: relative;
}
.chat-loading-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #22d3ee, #6366f1, #ec4899);
  border-radius: 999px;
  animation: loadingShimmer 1.5s infinite ease-in-out;
}
@keyframes loadingShimmer {
  0% { left: -40%; width: 30%; }
  50% { width: 60%; }
  100% { left: 100%; width: 30%; }
}
.chat-loading-step {
  font-size: 11.5px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-loading-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 6px;
}
.chat-loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22d3ee;
  animation: chatDotBounce 1.2s infinite ease-in-out both;
}
.chat-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes chatDotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}
.chat-loading-sub {
  font-size: 12.5px;
  color: #94a3b8;
}

/* ---------- Temporizador Holográfico HUD Ring (Futurista & Compacto) ---------- */
.timer-hud-capsule,
.timer-widget {
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(10, 17, 36, 0.78);
  border: 1px solid rgba(34, 211, 238, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(34, 211, 238, 0.25);
  animation: hudCapsuleEnter .3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: calc(100vw - 28px);
}
@keyframes hudCapsuleEnter {
  from { opacity: 0; transform: translateY(-12px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.timer-hud-capsule[hidden],
.timer-widget[hidden] { display: none; }
.timer-hud-capsule.resting,
.timer-widget.resting {
  border-color: rgba(16, 185, 129, 0.7);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(16, 185, 129, 0.3);
}
.timer-hud-capsule.ringing,
.timer-widget.ringing {
  animation: timer-pulse 0.7s infinite alternate ease-in-out;
  border-color: #f59e0b;
}
@keyframes timer-pulse {
  from { box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); transform: scale(1); }
  to { box-shadow: 0 0 28px 6px rgba(245, 158, 11, 0.8); transform: scale(1.03); }
}
.timer-hud-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-shrink: 0;
}
.timer-hud-svg {
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}
.timer-hud-bg-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 4;
}
.timer-hud-progress-circle {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset .25s linear, stroke .3s;
}
.timer-hud-capsule.resting .timer-hud-progress-circle,
.timer-widget.resting .timer-hud-progress-circle { stroke: #34d399; }
.timer-hud-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-hud-icon {
  font-size: 18px;
  line-height: 1;
}
.timer-hud-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 72px;
}
.timer-hud-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-hud-clock {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}
.timer-hud-phase {
  font-size: 10px;
  color: var(--cyan);
  font-weight: 600;
}
.timer-hud-capsule.resting .timer-hud-phase,
.timer-widget.resting .timer-hud-phase { color: #34d399; }
.timer-hud-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
}
.timer-hud-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  cursor: pointer;
  transition: all .2s;
  padding: 0;
}
.timer-hud-btn:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: var(--cyan);
  transform: scale(1.08);
}
.timer-hud-btn.timer-hud-close:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

/* ---------- Biblioteca Familiar & Vista Previa Embebida ---------- */
.bm-list { display: grid; gap: 8px; margin-top: 8px; }
.bm-card {
  background: rgba(15, 23, 42, .85); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 10px; font-size: 12.5px;
}
.bm-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.bm-plat { font-size: 12px; font-weight: 700; color: var(--cyan); text-transform: uppercase; letter-spacing: .02em; }
.bm-cat  { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(99,102,241,.2); color: #c7d2fe; }
.bm-title { font-size: 14px; line-height: 1.35; font-weight: 600; color: #fff; margin-bottom: 9px; word-break: break-word; }
.bm-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.bm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 36px; padding: 6px 12px; border-radius: 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text);
  text-decoration: none; cursor: pointer;
  transition: filter .15s, transform .12s, border-color .15s;
}
.bm-btn:active { transform: scale(.97); }
.bm-btn.play { border-color: rgba(34,211,238,.55); color: var(--cyan); }
.bm-btn:hover { filter: brightness(1.08); }
.embed-card {
  width: min(760px, 95vw);
  max-width: none;
  text-align: left;
  border-radius: 20px;
  background: var(--surface, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 16px 18px;
}
.embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.embed-header h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.embed-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.embed-footer {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.embed-hint-box {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}
.embed-hint-icon {
  font-size: 13.5px;
  flex-shrink: 0;
}
.embed-actions-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.embed-btn-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 9px 12px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #e2e8f0 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}
.embed-btn-action:hover, .embed-btn-action:active {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}
.embed-btn-primary {
  grid-column: 1 / -1;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  padding: 10px 16px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
  transition: all 0.2s ease !important;
}
.embed-btn-primary:hover, .embed-btn-primary:active {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45) !important;
  transform: translateY(-1px);
  color: #ffffff !important;
  text-decoration: none !important;
}
@media (min-width: 580px) {
  .embed-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .embed-hint-box {
    flex: 1;
    margin-right: 12px;
  }
  .embed-actions-group {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .embed-btn-primary {
    grid-column: auto;
    padding: 9px 15px !important;
    font-size: 12.5px !important;
  }
}
.lib-card { width: min(560px, 96vw); max-width: 96vw; max-height: 90vh; overflow-y: auto; padding: 18px; overflow-x: hidden; text-align: left; }
#libModal .lib-card > div:first-child { position: sticky; top: -18px; z-index: 6; background: #ffffff; padding: 10px 0 8px; margin-top: -10px; }
#libModal .lib-card > div:first-child .btn.btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 36px; padding: 6px 11px; font-size: 12.5px; font-weight: 700;
  border-radius: 10px; white-space: nowrap;
}
#libList, #libList .bm-card, #libModal #libAddForm { min-width: 0; max-width: 100%; box-sizing: border-box; }
@media (max-width: 560px) {
  .notice-modal { padding: 8px; }
  .notice-card, .lib-card { width: 100%; max-width: 100%; padding: 14px; gap: 10px; border-radius: 14px; }
  #libModal .lib-card > div:first-child .btn.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  #libScopeTabs { flex-wrap: wrap; }
  #libScopeTabs .bm-btn { font-size: 12.5px; padding: 7px 10px; min-height: 38px; }
}
.lib-plat-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; }
.lib-pill {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  min-height: 34px; border: 1px solid var(--line); background: rgba(15,23,42,.7);
  color: var(--muted); border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.lib-pill.active { background: rgba(34,211,238,.18); border-color: var(--cyan); color: #ecfeff; }
.lib-collections-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lib-folder-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  padding: 12px; border-radius: 14px; min-height: 82px;
  background: linear-gradient(145deg, rgba(30,41,59,.88), rgba(15,23,42,.92));
  border: 1px solid rgba(255,255,255,.1); cursor: pointer; text-align: left;
  color: var(--text); transition: transform .15s, border-color .15s;
}
.lib-folder-card:hover { transform: translateY(-2px); border-color: var(--cyan); }
.lib-folder-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lib-folder-icon { font-size: 17px; line-height: 1; flex-shrink: 0; }
.lib-folder-name {
  flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize;
}
.lib-folder-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0;
}
.lib-folder-plats {
  display: inline-flex; align-items: center; gap: 4px; flex: 1; min-width: 0;
  overflow: hidden; white-space: nowrap; font-size: 14.5px; line-height: 1; letter-spacing: .5px;
}
.lib-folder-count {
  flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums;
  font-size: 12.5px; font-weight: 700; line-height: 1.1;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(34,211,238,.15); color: var(--cyan);
}

/* Tema claro y llamativo para todos los modales de Copelito */
.notice-modal .notice-card {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #0f172a;
  border: 1px solid #cbd5e1;
  box-shadow: 0 22px 50px rgba(15, 23, 42, .35);
}
.notice-modal .notice-card h2,
.notice-modal .notice-card h3 { color: #0f172a; }
.notice-modal .notice-card .notice-text { color: #334155; }
.notice-modal input, .notice-modal select, .notice-modal textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}
#libModal #libAddForm, #libModal #libCatForm, #libModal #libImportPanel {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #0f172a !important;
}
#pwaModal #pwaAndroidGuide, #pwaModal #pwaIosGuide {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}
#embedModal .embed-hint-box { color: #334155 !important; }
#embedModal .embed-btn-action { background: #f1f5f9 !important; color: #0f172a !important; border: 1px solid #cbd5e1 !important; }
#embedModal .embed-btn-action:hover, #embedModal .embed-btn-action:active { background: #e2e8f0 !important; color: #0f172a !important; border-color: #94a3b8 !important; }
#shareModal .share-targets label, #incomingShareModal .share-targets label {
  background: #ffffff; color: #0f172a; border: 1px solid #cbd5e1;
}
.notice-modal .bm-btn, #sideDrawer .bm-btn {
  background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; font-weight: 600;
}
.notice-modal .bm-btn.play, #sideDrawer .bm-btn.play {
  background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent;
}
.notice-modal .btn-outline, .notice-modal .btn-sec {
  background: #e2e8f0; color: #0f172a; border: 1px solid #cbd5e1;
}
.notice-modal code { background: #e2e8f0; color: #0f172a; padding: 1px 5px; border-radius: 4px; }
.notice-modal #inShareUrlText, .notice-modal #shareItemTitle { color: #0369a1 !important; }
#libModal #libFolderBar { background: #e0f2fe !important; border: 1px solid #7dd3fc !important; }
#libModal #libActiveFolderName { color: #0369a1 !important; }
#libModal .modal-back-btn, #shareModal .modal-back-btn, #scenesModal .modal-back-btn {
  background: #e0f2fe; color: #0369a1; border-color: #7dd3fc;
}
#libModal .modal-back-btn:hover, #shareModal .modal-back-btn:hover, #scenesModal .modal-back-btn:hover {
  background: #0ea5e9; color: #ffffff; border-color: #0284c7;
}
#libModal .bm-card, #scenesModal .bm-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .06);
}
#libModal .bm-title, #scenesModal .bm-title { color: #0f172a; font-weight: 700; }
#libModal .bm-plat, #scenesModal .bm-plat { color: #0284c7; }
#libModal .bm-cat, #scenesModal .bm-cat { background: #e0e7ff; color: #3730a3; font-weight: 700; }
.bm-fav-btn {
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  cursor: pointer; font-size: 17px; line-height: 1; min-width: 34px; min-height: 34px;
  display: inline-grid; place-items: center; padding: 2px;
  transition: transform .15s;
}
.bm-fav-btn:hover { transform: scale(1.18); }
#libModal .bm-card.is-fav {
  border-color: #fda4af;
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
  box-shadow: 0 4px 12px rgba(244, 63, 94, .1);
}
#libModal .bm-btn, #scenesModal .bm-btn {
  background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1;
}
#libModal .bm-btn.play, #scenesModal .bm-btn.play {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #ffffff; border-color: transparent;
}
#libModal .lib-pill { background: #ffffff; color: #475569; border-color: #cbd5e1; }
#libModal .lib-pill.active {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #ffffff; border-color: transparent;
}
#libModal .lib-folder-card {
  background: linear-gradient(145deg, #ffffff, #eff6ff);
  border: 1.5px solid #bfdbfe;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .08);
}
#libModal .lib-folder-card:hover { border-color: #0284c7; background: #e0f2fe; }
#libModal .lib-folder-card.is-dragging { opacity: .45; transform: scale(.96); }
#libModal .lib-folder-card.is-drop-target,
#libBackFoldersBtn.is-drop-target {
  border: 2px dashed #0ea5e9 !important;
  background: #bae6fd !important;
  transform: scale(1.03);
}
.lib-drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none;
  transform: translate(-50%, -115%);
  padding: 6px 12px; border-radius: 999px;
  background: #0284c7; color: #ffffff; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(2, 132, 199, .45);
}
.lib-folder-edit {
  background: rgba(255,255,255,.85); border: 1px solid #cbd5e1; border-radius: 999px;
  cursor: pointer; font-size: 13px; line-height: 1; min-width: 30px; min-height: 30px;
  display: inline-grid; place-items: center; padding: 0; flex-shrink: 0;
}
.lib-folder-edit:hover { background: #e0f2fe; border-color: #0284c7; }
#libModal .lib-folder-count { background: #0ea5e9; color: #ffffff; }
#libModal .bm-inline-box { background: #f8fafc; border-color: #cbd5e1; }
#shareModal #shareItemTitle, #incomingShareModal #inShareUrlText { color: #0369a1 !important; font-weight: 700; }
#shareModal span, #shareModal label, #incomingShareModal label, #incomingShareModal span { color: #334155; }
#shareModal #shareMembersList label, #incomingShareModal .share-target { background: #ffffff !important; color: #0f172a !important; border: 1px solid #cbd5e1 !important; }
#shareModal #shareMembersList label span, #incomingShareModal .share-target span { color: #0f172a !important; }
#shareModal .bm-btn, #incomingShareModal .bm-btn { background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; }
#shareModal .bm-btn.play, #incomingShareModal .bm-btn.play { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
#shareModal .btn-sec, #incomingShareModal .btn-outline { background: #e2e8f0; color: #0f172a; border: 1px solid #cbd5e1; }
#shareModal #shareSendBtn, #incomingShareModal #inShareConfirm { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border: 0; }
.modal-back-btn { border: 1px solid rgba(255,255,255,.16); background: rgba(30,41,59,.85); color: #e2e8f0; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.modal-back-btn:hover { border-color: var(--cyan); color: #fff; }
.bm-inline-box { margin-top: 8px; padding: 8px; border-radius: 10px; background: rgba(15,23,42,.88); border: 1px solid rgba(255,255,255,.12); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- Cápsula Flotante de Medios y Videos Recomendados ---------- */
.media-hud-capsule {
  position: absolute;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  width: min(92%, 460px);
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(34, 211, 238, 0.5);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.8), 0 0 24px rgba(34, 211, 238, 0.25);
  border-radius: 18px;
  padding: 12px 14px;
  z-index: 45;
  transition: opacity 300ms ease, transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  animation: media-slide-up 350ms cubic-bezier(0.16, 1, 0.3, 1);
}
.media-hud-capsule[hidden] {
  display: none !important;
}
@keyframes media-slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.media-hud-card {
  background: rgba(255, 255, 255, 0.97);
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
}
.media-hud-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.media-hud-icon {
  font-size: 22px;
}
.media-hud-heading {
  flex: 1;
}
.media-hud-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}
.media-hud-sub {
  font-size: 11px;
  color: #0284c7;
}
.media-hud-close {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms;
}
.media-hud-close:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.media-hud-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.media-hud-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 8px 12px;
  transition: background 150ms, border-color 150ms;
}
.media-hud-item:hover {
  background: #eff6ff;
  border-color: #38bdf8;
}
.media-hud-item-info {
  flex: 1;
  min-width: 0;
}
.media-hud-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-hud-item-type {
  font-size: 10.5px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.media-hud-btn-action {
  flex-shrink: 0;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  transition: transform 150ms, box-shadow 150ms;
}
.media-hud-btn-action.web {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.4);
}
.media-hud-btn-action.maps {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* ---------- Calendario por Usuario + Feriados Perú ---------- */
.cal-card {
  width: min(580px, 96vw); max-width: 96vw; padding: 18px;
  background: #ffffff; color: #0f172a; border: 1px solid #cbd5e1;
  text-align: left; max-height: 90vh; overflow-y: auto;
}
.cal-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-pe-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
.cal-cell {
  min-height: 46px; padding: 4px; border-radius: 10px; border: 1px solid #e2e8f0;
  background: #f8fafc; cursor: pointer; display: flex; flex-direction: column;
  justify-content: space-between; align-items: center; transition: transform .12s, border-color .12s;
}
.cal-cell:hover { border-color: #0284c7; transform: translateY(-1px); }
.cal-cell.is-empty { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.cal-cell.is-today { border: 2px solid #0ea5e9; background: #e0f2fe; }
.cal-cell.is-selected { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
.cal-cell.is-holiday { background: #fff1f2; border-color: #fda4af; }
.cal-cell.is-selected.is-holiday { background: linear-gradient(135deg, #e11d48, #be123c); color: #ffffff; }
.cal-num { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.cal-dots { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: #2563eb; }
.cal-dot.shared { background: #9333ea; }
.cal-dot.holiday { background: #e11d48; }
.cal-cell.is-selected .cal-dot { background: #ffffff; }
.cal-day-panel { padding: 10px 12px; border-radius: 12px; background: #f1f5f9; border: 1px solid #cbd5e1; }
.cal-day-details { display: grid; gap: 7px; max-height: 22vh; overflow-y: auto; }
.cal-item { padding: 8px 10px; border-radius: 10px; background: #ffffff; border: 1px solid #dbeafe; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: 12.5px; }
.cal-item.holiday { background: #fff1f2; border-color: #fecdd3; }
.cal-share-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: #ffffff; border: 1px solid #cbd5e1; font-size: 11.5px; cursor: pointer; }
#calModal .bm-btn { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; }
#calModal .bm-btn.play { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
#sideDrawer .bm-btn { background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; font-weight: 600; }
#sideDrawer .bm-btn.play { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
#sideDrawer label { color: #334155 !important; font-weight: 600; }

/* ---------- Formato rico + Matemáticas KaTeX en el Chat ---------- */
.chat-h { font-weight: 800; color: #67e8f9; margin: 8px 0 4px; letter-spacing: .01em; }
.chat-h1 { font-size: 15.5px; border-bottom: 1px solid rgba(103,232,249,.25); padding-bottom: 3px; }
.chat-h2 { font-size: 14.5px; }
.chat-h3 { font-size: 13.5px; color: #fde047; }
.chat-bold { color: #f8fafc; font-weight: 700; }
.chat-line { margin: 2px 0; line-height: 1.5; }
.chat-gap { height: 6px; }
.chat-hr { border: 0; border-top: 1px solid rgba(148,163,184,.25); margin: 8px 0; }
.chat-list { margin: 4px 0 6px; padding-left: 18px; display: grid; gap: 3px; line-height: 1.48; }
.chat-callout {
  margin: 6px 0; padding: 8px 10px; border-radius: 10px;
  background: rgba(14,165,233,.14); border-left: 3px solid #38bdf8;
  color: #e0f2fe; font-size: 13px; line-height: 1.48;
}
.chat-inline-code {
  background: rgba(15,23,42,.8); color: #7dd3fc;
  padding: 1px 6px; border-radius: 5px; font-size: 12px;
}
.chat-code-block {
  margin: 6px 0; padding: 9px 11px; border-radius: 10px;
  background: rgba(2,6,23,.85); border: 1px solid rgba(148,163,184,.25);
  overflow-x: auto; font-size: 12px; color: #e2e8f0;
}
.chat-math-block {
  margin: 7px 0; padding: 9px 12px; border-radius: 10px;
  background: rgba(15,23,42,.72); border: 1px solid rgba(56,189,248,.32);
  overflow-x: auto; text-align: center; color: #f8fafc;
}
.chat-math-inline .katex { font-size: 1.04em; color: #bae6fd; }
.chat-math-block .katex-display { margin: 0; }

/* ---------- Tema claro y legible para Panel de Chat (Copelito IA y Familia) ---------- */
#chatPanel {
  background: #f8fafc;
  color: #0f172a;
  border-left: 1px solid #cbd5e1;
}
#chatPanel .chat-empty { color: #475569; }
#chatPanel .bm-btn { background: #f1f5f9; color: #0f172a; border: 1px solid #cbd5e1; font-weight: 600; }
#chatPanel .bm-btn.play { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
#chatPanel .chat-msg-item.user {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0f172a;
}
#chatPanel .chat-msg-item.bot {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}
#chatPanel .chat-msg-item.user strong,
#chatPanel .chat-msg-item.bot strong,
#chatPanel .chat-bold { color: #0f172a; }
#chatPanel .chat-h1, #chatPanel .chat-h2 { color: #0369a1; border-bottom-color: #bae6fd; }
#chatPanel .chat-h3 { color: #b45309; }
#chatPanel .chat-callout { background: #eff6ff; border-left-color: #0ea5e9; color: #0f172a; }
#chatPanel .chat-inline-code { background: #e2e8f0; color: #0f172a; }
#chatPanel .chat-code-block { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }
#chatPanel .chat-math-block { background: #f8fafc; border-color: #7dd3fc; color: #0f172a; }
#chatPanel .chat-math-inline .katex { color: #0369a1; }
#chatPanel .chat-link-chip { background: #eff6ff; color: #0369a1; border: 1px solid #bfdbfe; }
#chatPanel .bm-card { background: #ffffff; border: 1px solid #cbd5e1; color: #0f172a; }
#chatPanel .bm-title { color: #0f172a; }
#chatPanel .bm-plat { color: #0284c7; }
#chatPanel .bm-cat { background: #e0e7ff; color: #3730a3; }
#chatPanel #chatForm, #chatPanel #famForm {
  background: #ffffff !important;
  border-top: 1px solid #cbd5e1 !important;
}
#chatPanel input, #chatPanel textarea, #chatPanel select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}
#chatPanel #famEmojiBar {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}
#chatPanel .btn-outline { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
#chatPanel .chat-msg-item > div:first-child { color: #0369a1 !important; }
#chatPanel .chat-msg-item > div:first-child span:last-child { color: #475569 !important; }
#chatPanel .chat-msg-item.chat-msg-loading {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%) !important;
  border: 1.5px solid #38bdf8 !important;
  box-shadow: 0 4px 16px rgba(14, 165, 233, .14) !important;
}
#chatPanel .chat-loading-title { color: #0f172a !important; }
#chatPanel .chat-loading-step {
  color: #334155 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.35;
}
#chatPanel .chat-loading-bar { background: #e2e8f0 !important; }
#chatPanel .chat-loading-pulse-ring {
  background: linear-gradient(135deg, #e0f2fe, #e0e7ff) !important;
  border-color: #0284c7 !important;
}
.media-hud-btn-action:hover {
  transform: scale(1.04);
}

/* ---------- Selección libre y copia de respuestas / prompts ---------- */
.chat-messages,
.chat-msg-item,
.chat-msg-item *,
.chat-code-block,
.chat-code-block *,
.speech-bubble,
.speech-bubble *,
.modal-card p,
.modal-card li,
.modal-card pre,
.modal-card code,
.drawer-info strong,
input,
textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
}
.chat-msg-item button,
.chat-msg-item .bm-btn,
.chat-code-copy {
  user-select: none !important;
  -webkit-user-select: none !important;
}
.chat-code-wrap {
  position: relative;
  margin: 8px 0;
}
.chat-code-wrap .chat-code-block {
  margin: 0;
  padding-top: 34px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px !important;
  padding: 3px 8px !important;
  z-index: 2;
}

/* ---------- Acordeón en menú hamburguesa + grillas de presets ---------- */
.drawer-body { gap: 10px; }
.drawer-acc {
  flex-shrink: 0;
  background: rgba(255, 255, 255, .82);
  border: 1px solid #dbeafe;
  border-radius: 14px;
  overflow: hidden;
  gap: 0;
}
.drawer-acc-sum {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #0369a1;
  background: #ffffff;
  user-select: none;
}
.drawer-acc-sum::-webkit-details-marker { display: none; }
.drawer-acc-sum::after {
  content: '▸';
  font-size: 14px;
  color: #0284c7;
  transition: transform .2s ease;
}
.drawer-acc[open] > .drawer-acc-sum { border-bottom: 1px solid #e2e8f0; }
.drawer-acc[open] > .drawer-acc-sum::after { transform: rotate(90deg); }
.drawer-acc-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Hologramas adicionales estructurados ---------- */
.holo-orbit { display: none; position: absolute; inset: 0; pointer-events: none; }
.holo-orbit span {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 96%;
  height: 28%;
  border-radius: 50%;
  border: 2px solid rgba(var(--user-aura-rgb, 34,211,238), .68);
  box-shadow: 0 0 18px rgba(var(--user-aura-rgb, 34,211,238), .45);
  transform: translate(-50%, -50%) rotate(-14deg);
  animation: holo-orbit-spin 6s ease-in-out infinite;
}
.holo-orbit span:nth-child(2) {
  width: 82%;
  height: 22%;
  border-style: dashed;
  border-color: rgba(var(--user-aura-rgb, 168,85,247), .62);
  transform: translate(-50%, -50%) rotate(16deg);
  animation-direction: reverse;
  animation-duration: 8s;
}
@keyframes holo-orbit-spin {
  0%, 100% { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: .7; }
  50%      { transform: translate(-50%, -50%) rotate(14deg) scale(1.06); opacity: 1; }
}

body[data-holo="orbit"] .holo-orbit { display: block; }
body[data-holo="orbit"] .holo-beam { opacity: .55; }

body[data-holo="matrix"] .holo-beam {
  clip-path: polygon(16% 100%, 84% 100%, 96% 0%, 4% 0%);
  background:
    repeating-linear-gradient(to top, rgba(var(--user-aura-rgb, 16,185,129), .22) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(to right, rgba(var(--user-aura-rgb, 16,185,129), .12) 0 1px, transparent 1px 14px),
    linear-gradient(to top, rgba(var(--user-aura-rgb, 16,185,129), .38) 0%, transparent 95%);
  filter: none;
}
body[data-holo="matrix"] .holo-base-ring::after { border-style: dotted; }

body[data-holo="aurora"] .holo-beam {
  clip-path: none;
  border-radius: 50%;
  width: 120%;
  background: radial-gradient(ellipse at 50% 65%,
    rgba(var(--user-aura-rgb, 56,189,248), .34) 0%,
    rgba(168, 85, 247, .22) 42%,
    rgba(16, 185, 129, .10) 68%,
    transparent 85%);
  filter: blur(18px);
}
body[data-holo="aurora"] .holo-mist span { width: 46%; height: 28%; filter: blur(18px); }

body[data-holo="prism"] .holo-beam {
  clip-path: polygon(38% 100%, 62% 100%, 88% 35%, 50% 0%, 12% 35%);
  background:
    linear-gradient(135deg, rgba(var(--user-aura-rgb, 56,189,248), .38) 0%, rgba(255,255,255,.14) 50%, rgba(var(--user-aura-rgb, 99,102,241), .28) 100%);
  filter: blur(1px);
}
body[data-holo="prism"] .holo-orbit { display: block; }
body[data-holo="prism"] .holo-orbit span {
  border-radius: 18%;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

body[data-holo="none"] .holo-emitter { display: none; }

/* ---------- Holograma Sayayin (Aura Ki dorada + chispas eléctricas) ---------- */
@keyframes saiyan-ki-flame {
  0%   { background-position: 0% 100%, 0% 0%; transform: translateX(-50%) scaleX(1) scaleY(1); opacity: .88; }
  50%  { background-position: 0% 50%, 0% -40px; transform: translateX(-50%) scaleX(1.06) scaleY(1.04); opacity: 1; }
  100% { background-position: 0% 0%, 0% -80px; transform: translateX(-50%) scaleX(1) scaleY(1); opacity: .88; }
}
@keyframes saiyan-aura-pulse {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(250, 204, 21, .72)) drop-shadow(0 0 32px rgba(245, 158, 11, .42)); }
  50%      { filter: drop-shadow(0 0 24px rgba(254, 240, 138, .95)) drop-shadow(0 0 48px rgba(245, 158, 11, .68)); }
}
body[data-holo="saiyan"] .holo-beam {
  width: 122%;
  clip-path: polygon(22% 100%, 78% 100%, 96% 24%, 82% 6%, 64% 16%, 50% 0%, 36% 16%, 18% 6%, 4% 24%);
  background:
    radial-gradient(ellipse at 50% 72%, rgba(254, 240, 138, .62) 0%, rgba(250, 204, 21, .42) 38%, rgba(245, 158, 11, .2) 68%, transparent 92%),
    repeating-linear-gradient(90deg, rgba(254, 249, 195, .28) 0 4px, transparent 4px 16px);
  background-size: 100% 140%, 100% 80px;
  filter: blur(4px);
  animation: saiyan-ki-flame 0.9s linear infinite;
}
body[data-holo="saiyan"] .holo-base-ring {
  border-color: rgba(250, 204, 21, .95);
  box-shadow: 0 0 32px rgba(250, 204, 21, .88), inset 0 0 20px rgba(245, 158, 11, .65);
  animation-duration: 1.1s;
}
body[data-holo="saiyan"] .holo-base-ring::after {
  border-color: rgba(254, 240, 138, .9);
  border-style: dashed;
}
body[data-holo="saiyan"] .holo-orbit { display: block; }
body[data-holo="saiyan"] .holo-orbit span {
  border-color: rgba(250, 204, 21, .88);
  box-shadow: 0 0 22px rgba(250, 204, 21, .8), 0 0 10px rgba(56, 189, 248, .65);
  animation-duration: 2.2s;
}
body[data-holo="saiyan"] .holo-orbit span:nth-child(2) {
  border-color: rgba(56, 189, 248, .85);
  box-shadow: 0 0 18px rgba(56, 189, 248, .75), 0 0 12px rgba(250, 204, 21, .65);
  animation-duration: 1.7s;
}
body[data-holo="saiyan"] .holo-mist span {
  background: radial-gradient(circle, rgba(254, 249, 195, .95) 0%, rgba(250, 204, 21, .6) 45%, transparent 72%);
  filter: blur(6px);
  animation-duration: 1.35s;
}
body[data-holo="saiyan"] .robot-character img.base {
  animation: saiyan-aura-pulse 1.2s ease-in-out infinite;
}

/* ---------- Resiliencia ante zoom del sistema / navegador (sin alterar vista normal) ---------- */
.chat-panel { max-width: 100vw; overflow-x: hidden; box-sizing: border-box; }
.chat-msg-item { overflow-wrap: anywhere; }
.speech-bubble { overflow-wrap: anywhere; }
.drawer-info div { flex-wrap: wrap; }
.drawer-info strong { overflow-wrap: anywhere; text-align: right; }
.status-bar { flex-wrap: wrap; }
#aiChatSessionBar, #chatModeTabs { flex-wrap: wrap; }
.chat-form { flex-wrap: wrap; align-items: flex-end; max-width: 100%; box-sizing: border-box; }
.chat-form button { flex-shrink: 0; }
#famForm > div { flex-wrap: wrap; max-width: 100%; box-sizing: border-box; }
#famTargetSel { min-width: 0 !important; flex: 1 1 130px !important; max-width: 100% !important; }
#famTtlSel { flex: 0 0 auto; max-width: 92px; }
#famInput, #chatInput { flex: 1 1 140px !important; min-width: 120px !important; max-width: 100% !important; box-sizing: border-box; }
#famSend, #chatSend { flex: 0 0 auto; margin-left: auto; }

/* ---------- Modo Lectura Fácil / Texto Grande (activado por usuario) ---------- */
body[data-text-scale="large"] .chat-panel,
body[data-text-scale="xlarge"] .chat-panel {
  width: min(520px, 100vw);
}
body[data-text-scale="large"] .chat-msg-item {
  font-size: 17px !important;
  line-height: 1.55 !important;
  padding: 12px 14px;
}
body[data-text-scale="large"] .chat-form input,
body[data-text-scale="large"] .chat-form textarea,
body[data-text-scale="large"] #famForm textarea,
body[data-text-scale="large"] .bm-btn,
body[data-text-scale="large"] .drawer-btn,
body[data-text-scale="large"] .drawer-info {
  font-size: 16px !important;
}
body[data-text-scale="large"] .speech-bubble { font-size: 18px !important; line-height: 1.45; }

body[data-text-scale="xlarge"] .chat-msg-item {
  font-size: 20px !important;
  line-height: 1.6 !important;
  padding: 14px 16px;
}
body[data-text-scale="xlarge"] .chat-form input,
body[data-text-scale="xlarge"] .chat-form textarea,
body[data-text-scale="xlarge"] #famForm textarea,
body[data-text-scale="xlarge"] .bm-btn,
body[data-text-scale="xlarge"] .drawer-btn,
body[data-text-scale="xlarge"] .drawer-info {
  font-size: 18px !important;
}
body[data-text-scale="xlarge"] .chat-msg-item .chat-link-chip { font-size: 16px !important; padding: 10px 12px; }
body[data-text-scale="xlarge"] .speech-bubble { font-size: 21px !important; line-height: 1.5; }

/* Ventanas (Calendario, Mi Asistente, Listas, Favoritos, Puente, Ayuda, avisos...):
   ampliación PROPORCIONAL del contenido. Texto, botones e iconos crecen juntos y el contenido se
   reacomoda dentro del ancho de la ventana (no se sale). Se aplica a cada hijo de la tarjeta para que la
   tarjeta conserve su ancho real (min(720px, 96vw)). Se excluye embedModal (Canvas/iframes: coordenadas táctiles).
   Navegadores sin `zoom` (Firefox < 126) simplemente muestran el tamaño normal. */
body[data-text-scale="large"] .notice-modal:not(#embedModal) .notice-card > * { zoom: 1.15; }
body[data-text-scale="xlarge"] .notice-modal:not(#embedModal) .notice-card > * { zoom: 1.3; }
/* Dentro de las ventanas ampliadas, los botones vuelven a su tamaño base (si no, se sumaría a la ampliación) */
body[data-text-scale="large"] .notice-modal:not(#embedModal) .notice-card .bm-btn,
body[data-text-scale="xlarge"] .notice-modal:not(#embedModal) .notice-card .bm-btn { font-size: 12px !important; }
/* Botones de cabecera: no partir "+ Recordatorio" en dos líneas */
body[data-text-scale] .notice-card .cal-header button { white-space: nowrap; }
body[data-text-scale] .notice-card .cal-header > div { flex-wrap: wrap; min-width: 0; }
/* El ✕ de cerrar siempre en la esquina superior derecha (al ampliar, la cabecera se reparte en varias líneas) */
body[data-text-scale] .notice-modal:not(#embedModal) .notice-card { position: relative; }
body[data-text-scale] .notice-modal:not(#embedModal) .notice-card > :first-child:has(> .drawer-close, > * > .drawer-close) { padding-right: 40px; }
body[data-text-scale] .notice-modal:not(#embedModal) .notice-card > :first-child .drawer-close { position: absolute; top: 8px; right: 8px; }

/* Menú lateral: títulos de cada sección (12px) */
body[data-text-scale="large"] .side-drawer .drawer-acc-sum { font-size: 14px; }
body[data-text-scale="xlarge"] .side-drawer .drawer-acc-sum { font-size: 16px; }

body[data-high-contrast="1"] #chatPanel .chat-msg-item.bot {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #0f172a !important;
}
body[data-high-contrast="1"] #chatPanel .chat-msg-item.user {
  background: #dbeafe !important;
  color: #000000 !important;
  border: 2px solid #1d4ed8 !important;
}
body[data-high-contrast="1"] #chatPanel .chat-empty,
body[data-high-contrast="1"] #chatPanel .drawer-info span {
  color: #0f172a !important;
  font-weight: 600;
}

/* ---------- Microinteracción de cámara / linterna activa (dentro del escenario de Copelito) ---------- */
.cam-live-pill {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(6, 78, 59, .78);
  border: 1px solid rgba(16, 185, 129, .65);
  color: #a7f3d0;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  animation: camPillGlow 2s ease-in-out infinite;
}
.cam-live-pill[hidden] { display: none; }
.cam-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, .75);
  animation: camDotPulse 1.4s ease-out infinite;
}
.cam-live-pill.torch {
  background: rgba(245, 158, 11, .2);
  border-color: rgba(251, 191, 36, .65);
  color: #fde68a;
}
.cam-live-pill.torch .cam-live-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 0 rgba(251, 191, 36, .75);
}
@keyframes camDotPulse {
  0%   { transform: scale(.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, .7); }
  70%  { transform: scale(1.1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes camPillGlow {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.18); }
}

/* ---------- Entorno Infantil Colorido y Amigable (edad <= 12 años) ---------- */
body[data-kids="1"] .status-bar {
  background: linear-gradient(90deg, rgba(56, 189, 248, .22), rgba(168, 85, 247, .22), rgba(236, 72, 153, .22)) !important;
  border-bottom-color: rgba(244, 114, 182, .35) !important;
}
body[data-kids="1"] .action-bar {
  background: linear-gradient(180deg, rgba(15, 23, 42, .85), rgba(30, 27, 75, .94)) !important;
  border-top-color: rgba(168, 85, 247, .35) !important;
}
body[data-kids="1"] .btn-mic {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 55%, #f472b6 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 20px rgba(168, 85, 247, .38) !important;
}
body[data-kids="1"] .action-bar .btn-outline {
  border-radius: 999px !important;
  border-color: rgba(125, 211, 252, .5) !important;
}
body[data-kids="1"] .speech-bubble {
  border-radius: 26px !important;
  border: 3px solid #f472b6 !important;
  background: linear-gradient(135deg, #fffbeb 0%, #fdf2f8 55%, #eff6ff 100%) !important;
  color: #1e293b !important;
  box-shadow: 0 10px 28px rgba(236, 72, 153, .22), 0 0 0 3px rgba(56, 189, 248, .18) !important;
}
body[data-kids="1"] #sideDrawer {
  background: linear-gradient(180deg, #fffbeb 0%, #fdf2f8 50%, #f0f9ff 100%) !important;
  color: #1e293b !important;
}
body[data-kids="1"] #sideDrawer .drawer-header {
  background: linear-gradient(135deg, #38bdf8 0%, #a855f7 55%, #ec4899 100%) !important;
}
body[data-kids="1"] #sideDrawer .drawer-btn,
body[data-kids="1"] #sideDrawer .drawer-link {
  border-radius: 16px !important;
  border: 2px solid #fbcfe8 !important;
  background: #ffffff !important;
  color: #1e293b !important;
  font-weight: 700 !important;
}
body[data-kids="1"] #sideDrawer .drawer-acc-sum {
  color: #7e22ce !important;
  font-weight: 800 !important;
}
body[data-kids="1"] #chatPanel {
  background: linear-gradient(180deg, #fffbeb 0%, #fdf2f8 48%, #f0f9ff 100%) !important;
}
body[data-kids="1"] #chatPanel .drawer-header {
  background: linear-gradient(135deg, #38bdf8 0%, #a855f7 52%, #ec4899 100%) !important;
}
body[data-kids="1"] #chatPanel #chatModeTabs,
body[data-kids="1"] #chatPanel #aiChatSessionBar {
  background: rgba(255, 255, 255, .86) !important;
  border-bottom-color: #fbcfe8 !important;
}
body[data-kids="1"] #chatPanel .chat-msg-item.bot {
  border-radius: 22px 22px 22px 6px !important;
  border: 2.5px solid #f472b6 !important;
  background: linear-gradient(135deg, #ffffff 0%, #fdf2f8 100%) !important;
  box-shadow: 0 4px 14px rgba(244, 114, 182, .16) !important;
}
body[data-kids="1"] #chatPanel .chat-msg-item.user {
  border-radius: 22px 22px 6px 22px !important;
  border: 2.5px solid #38bdf8 !important;
  background: linear-gradient(135deg, #e0f2fe 0%, #ede9fe 100%) !important;
  box-shadow: 0 4px 14px rgba(56, 189, 248, .16) !important;
}
body[data-kids="1"] #chatPanel .chat-link-chip {
  border-radius: 999px !important;
  border-width: 2px !important;
  background: #fef9c3 !important;
  border-color: #facc15 !important;
  color: #854d0e !important;
}
body[data-kids="1"] #chatPanel .chat-link-chip.youtube {
  background: #ffe4e6 !important;
  border-color: #fb7185 !important;
  color: #9f1239 !important;
}
body[data-kids="1"] #chatPanel .bm-btn,
body[data-kids="1"] #libModal .bm-btn,
body[data-kids="1"] #scenesModal .bm-btn,
body[data-kids="1"] #listsModal .bm-btn,
body[data-kids="1"] #calModal .bm-btn,
body[data-kids="1"] #asstModal .bm-btn,
body[data-kids="1"] #libModal .cat-pill {
  border-radius: 999px !important;
}
body[data-kids="1"] #libModal .lib-card,
body[data-kids="1"] #scenesModal .lib-card,
body[data-kids="1"] #listsModal .lib-card,
body[data-kids="1"] #calModal .cal-card,
body[data-kids="1"] #asstModal .asst-card {
  border-radius: 26px !important;
  border: 3px solid #7dd3fc !important;
  background: linear-gradient(180deg, #fffbeb 0%, #fdf2f8 50%, #f0f9ff 100%) !important;
}
body[data-kids="1"] #libModal .bm-card,
body[data-kids="1"] #scenesModal .bm-card,
body[data-kids="1"] #listsModal .list-item,
body[data-kids="1"] #calModal .cal-item,
body[data-kids="1"] #asstModal .asst-item {
  border-radius: 20px !important;
  border: 2px solid #ddd6fe !important;
  border-left: 6px solid #f472b6 !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(168, 85, 247, .10) !important;
}
body[data-kids="1"] #libModal .bm-card:nth-child(3n+2),
body[data-kids="1"] #scenesModal .bm-card:nth-child(3n+2),
body[data-kids="1"] #calModal .cal-item:nth-child(3n+2) { border-left-color: #38bdf8 !important; }
body[data-kids="1"] #libModal .bm-card:nth-child(3n+3),
body[data-kids="1"] #scenesModal .bm-card:nth-child(3n+3),
body[data-kids="1"] #calModal .cal-item:nth-child(3n+3) { border-left-color: #34d399 !important; }
body[data-kids="1"] #libModal .bm-cat,
body[data-kids="1"] #scenesModal .bm-cat {
  border-radius: 999px !important;
  background: #fef08a !important;
  color: #854d0e !important;
}

/* ---------- Asistente personal (🧠): agenda, salud, gastos, memoria, familia ---------- */
.cal-mini-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #334155; font-weight: 600; min-width: 0; }
.cal-item.is-done { opacity: .62; }
.cal-item.is-done .cal-ev-title { text-decoration: line-through; }
.cal-item .cal-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cal-src-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #e0f2fe; color: #0369a1; margin-left: 4px; }
.asst-card { width: min(640px, 96vw); }
.asst-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: thin; }
.asst-tab { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; border: 1px solid #cbd5e1; background: #f1f5f9; color: #0f172a; font-size: 12.5px; font-weight: 600; cursor: pointer; min-height: 36px; }
.asst-tab.is-active { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
.asst-tab:focus-visible, .rem-toast button:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.asst-pane { display: none; gap: 10px; }
.asst-pane.is-active { display: grid; }
.asst-body { max-height: 64vh; overflow-y: auto; padding-right: 2px; }
.asst-h { margin: 6px 0 0; font-size: 14px; color: #0f172a; }
.asst-box { padding: 10px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid #cbd5e1; font-size: 13px; line-height: 1.5; color: #0f172a; }
.asst-box ul { margin: 6px 0 0; padding-left: 18px; }
.asst-hint { font-size: 12px; color: #475569; background: #fefce8; border: 1px solid #fde047; border-radius: 10px; padding: 7px 10px; }
.asst-list { display: grid; gap: 6px; }
.asst-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #ffffff; border: 1px solid #dbeafe; font-size: 12.5px; color: #0f172a; }
.asst-item .asst-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.asst-item .asst-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.asst-empty { font-size: 12px; color: #64748b; padding: 4px 2px; }
.asst-form { display: flex; gap: 6px; flex-wrap: wrap; }
.asst-form input, .asst-form select, .asst-settings input, .asst-settings select {
  flex: 1 1 120px; min-width: 0; padding: 7px 9px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 12.5px; background: #ffffff; color: #0f172a;
}
.asst-form input[type="number"] { flex: 0 1 110px; }
.asst-settings { display: grid; gap: 8px; font-size: 12.5px; color: #334155; }
.asst-settings label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.asst-settings input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; }
.asst-settings input[type="time"] { flex: 0 1 110px; }
.asst-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: #334155; }
.asst-slot { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; border: 1px solid #cbd5e1; background: #f8fafc; font-size: 11.5px; cursor: pointer; color: #0f172a; min-height: 28px; }
.asst-slot.taken { background: #dcfce7; border-color: #86efac; color: #166534; }
.asst-week { display: flex; gap: 3px; margin-top: 4px; }
.asst-week span { width: 14px; height: 14px; border-radius: 4px; background: #e2e8f0; }
.asst-week span.hit { background: #22c55e; }
.asst-week span.part { background: #86efac; }
.asst-bar { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin-top: 6px; }
.asst-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #0ea5e9); }
.asst-bar.over > i { background: linear-gradient(90deg, #f59e0b, #dc2626); }
#asstModal .bm-btn, #listsModal .bm-btn { background: #f1f5f9; color: #1e293b; border: 1px solid #cbd5e1; }
#asstModal .bm-btn.play { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
#asstModal .bm-btn.danger, #scenesModal .bm-btn.danger, .bm-btn.danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
#scenesModal .bm-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
#asstModal .btn.btn-sm { min-height: 36px; padding: 7px 14px; font-size: 13px; justify-self: auto; }
.drawer-btn.sos-btn { border-left-color: #dc2626; background: #fef2f2; color: #991b1b; font-weight: 700; }

/* Aviso emergente de recordatorio */
.rem-toast-wrap { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.rem-toast { pointer-events: auto; background: #ffffff; color: #0f172a; border: 1px solid #cbd5e1; border-left: 5px solid #0ea5e9; border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .28); padding: 12px 14px; display: grid; gap: 6px; animation: remIn .25s ease-out; }
.rem-toast.kind-med { border-left-color: #22c55e; }
.rem-toast.kind-alert { border-left-color: #dc2626; background: #fef2f2; }
.rem-toast.kind-points { border-left-color: #f59e0b; background: #fffbeb; }
.rem-toast strong { font-size: 14px; }
.rem-toast p { margin: 0; font-size: 13px; line-height: 1.45; color: #334155; overflow-wrap: anywhere; }
.rem-toast .rem-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rem-toast button, .rem-toast a { min-height: 36px; padding: 6px 12px; border-radius: 10px; border: 1px solid #cbd5e1; background: #f1f5f9; color: #0f172a; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.rem-toast button.primary { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
@keyframes remIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rem-toast { animation: none; } }
.asst-only[hidden], .asst-family-only[hidden], #asstBtn[hidden], #asstWaRow[hidden], #asstLocClear[hidden], #calCancelEditBtn[hidden], #listsAssignRow[hidden] { display: none !important; }

/* ---------- Listas inteligentes ---------- */
.list-row { align-items: flex-start; }
.list-row.is-done .list-text { text-decoration: line-through; color: #94a3b8; }
.list-text { font-size: 13px; color: #0f172a; font-weight: 600; overflow-wrap: anywhere; }
.list-meta { font-size: 11px; color: #64748b; margin-top: 2px; overflow-wrap: anywhere; }
.list-subs { display: grid; gap: 2px; margin: 4px 0 0 24px; }
.list-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #334155; }
.list-sub-del { border: 0; background: transparent; color: #94a3b8; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; }
.list-task-tools, .list-task-extras { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.list-task-extras { margin: 0 0 8px; }
.list-task-tools select, .list-task-tools input, .list-task-extras select, .list-task-extras input { padding: 5px 7px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 12px; background: #ffffff; color: #0f172a; min-width: 0; }
.list-aisle { font-size: 12px; font-weight: 700; color: #334155; margin-top: 6px; padding-bottom: 2px; border-bottom: 1px dashed #cbd5e1; }
.list-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: #854d0e; background: #fefce8; border: 1px solid #fde047; border-radius: 10px; padding: 6px 8px; }
.list-suggest .cal-share-chip { background: #ffffff; color: #0f172a; min-height: 30px; }

/* ---------- Vistas del calendario ---------- */
.cal-views { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-view { padding: 6px 11px; border-radius: 999px; border: 1px solid #cbd5e1; background: #f1f5f9; color: #0f172a; font-size: 12.5px; font-weight: 600; cursor: pointer; min-height: 34px; }
.cal-view.is-active { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
.cal-range { display: grid; gap: 8px; max-height: 58vh; overflow-y: auto; }
.cal-range-day { padding: 8px 10px; border-radius: 12px; background: #f8fafc; border: 1px solid #e2e8f0; display: grid; gap: 6px; }
.cal-range-day.is-today { border-color: #0ea5e9; background: #f0f9ff; }
.cal-range-day h4 { margin: 0; font-size: 13px; color: #0f172a; text-transform: capitalize; }
.cal-range-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; background: #ffffff; border: 1px solid #e2e8f0; border-left: 5px solid #2563eb; font-size: 12.5px; color: #0f172a; }
.cal-range-item.is-done { opacity: .6; }
.cal-range-item.is-done strong { text-decoration: line-through; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #334155; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---------- Estudio, notas, familia ---------- */
.asst-details summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: #0369a1; padding: 4px 0; }
.asst-details .asst-form { margin-top: 6px; }
.asst-review { display: grid; gap: 8px; }
.asst-card-front { font-size: 17px; font-weight: 700; color: #0f172a; line-height: 1.4; }
.asst-card-back { font-size: 15px; color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 8px 10px; line-height: 1.45; }
.asst-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.asst-grades .bm-btn { min-height: 40px; justify-content: center; }
.asst-focus-bars { display: flex; align-items: flex-end; gap: 6px; height: 70px; margin: 8px 0 4px; }
.asst-focus-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.asst-focus-col i { display: block; width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #38bdf8, #2563eb); }
.asst-focus-col span { font-size: 10.5px; color: #64748b; text-transform: uppercase; }
.asst-file-btn { cursor: pointer; display: inline-flex; align-items: center; min-height: 36px; }
.asst-split { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.asst-note { display: block; }
.asst-note > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.asst-note-body { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: #0f172a; }
.asst-code { display: block; margin: 4px 0; padding: 6px 8px; border-radius: 8px; background: #0f172a; color: #e2e8f0; font-size: 11.5px; overflow-wrap: anywhere; }
.asst-args { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.asst-kid .asst-form label { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.asst-kid .asst-form input[type="time"] { flex: 0 1 96px; }
.asst-kid .asst-form input[type="number"] { flex: 0 1 90px; }
.asst-loc-only[hidden], .asst-kids-only[hidden], #listsTabCasa[hidden], #listsTaskExtras[hidden], #calRangeView[hidden],
#asstReview[hidden], #asstKidReport[hidden], #asstVoiceLive[hidden], .list-task-tools[hidden], #asstExpSplit[hidden], #asstLedger[hidden] { display: none !important; }

/* ---------- Modo sin conexión (disimulado, solo aparece tras fallo real) ---------- */
.offline-banner { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); z-index: 210; background: rgba(15, 23, 42, 0.92); color: #fde68a; border: 1px solid rgba(251, 191, 36, 0.45); border-radius: 999px; font-size: 12px; font-weight: 600; text-align: center; padding: 6px 14px; backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.offline-banner[hidden] { display: none; }

/* Ajustes visuales: pestaña activa en Listas, textos junto a su casilla y botones sin estirarse */
#listsModal .bm-btn.play { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #ffffff; border-color: transparent; }
#listsModal .btn.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; justify-self: auto; }
.asst-label-text { flex: 1 1 180px; min-width: 0; }
.asst-form { align-items: center; }

/* ---------- Blindaje del Header (#statusBar): nunca envolver ni desordenar iconos ---------- */
.status-bar {
  flex-wrap: nowrap !important;
  max-width: 100vw;
  overflow: hidden;
  min-height: 48px;
}
.status-bar .group {
  flex-wrap: nowrap !important;
  min-width: 0;
}
.status-bar .group:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.status-bar .group:last-child {
  flex: 0 0 auto;
}
#statusText {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: block;
}
@media (max-width: 680px) {
  .status-bar { padding: 7px 10px !important; gap: 6px !important; }
  .status-bar .group { gap: 4px !important; }
  .status-bar .net-text { display: none !important; }
  .status-bar .hamburger-btn { width: 32px !important; height: 32px !important; font-size: 14px !important; padding: 0 !important; flex-shrink: 0 !important; }
}

/* ---------- Widget animado de Clima en la parte superior de Copelito ---------- */
.weather-hud-pill {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .74);
  border: 1px solid rgba(56, 189, 248, .48);
  color: #f8fafc;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35), 0 0 14px rgba(56, 189, 248, .18);
  font: inherit;
  cursor: pointer;
  transition: transform .2s ease, border-color .25s ease, box-shadow .25s ease;
}
.weather-hud-pill:hover {
  transform: translateY(-1px) scale(1.03);
  border-color: rgba(56, 189, 248, .85);
}
/* Evitar superposiciones de HUDs en pantalla */
body.timer-active #weatherHudBadge,
.robot-stage:has(#timerWidget:not([hidden])) #weatherHudBadge {
  display: none !important;
}
body[data-state="listening"] #messageBubble,
body.followup #messageBubble {
  opacity: 0;
  pointer-events: none;
}
.weather-hud-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.weather-hud-info strong {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}
.weather-hud-info small {
  font-size: 10.5px;
  color: #bae6fd;
  text-transform: capitalize;
  max-width: 115px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.weather-hud-anim {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}
.weather-hud-pill[data-kind="sun"] {
  border-color: rgba(251, 191, 36, .65);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35), 0 0 16px rgba(251, 191, 36, .24);
}
.weather-hud-pill[data-kind="sun"] .w-main {
  display: inline-block;
  animation: weatherSunSpin 9s linear infinite;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, .75));
}
.weather-hud-pill[data-kind="partly"] .w-main,
.weather-hud-pill[data-kind="cloud"] .w-main {
  display: inline-block;
  animation: weatherCloudFloat 3.2s ease-in-out infinite;
}
.weather-hud-pill[data-kind="rain"] {
  border-color: rgba(56, 189, 248, .75);
}
.weather-hud-pill[data-kind="rain"] .w-main {
  display: inline-block;
  animation: weatherRainBob 1.8s ease-in-out infinite;
}
.weather-hud-pill[data-kind="rain"] .w-sub::after {
  content: '💧';
  position: absolute;
  bottom: -4px;
  right: -2px;
  font-size: 9px;
  animation: weatherDropFall 1.1s linear infinite;
}
.weather-hud-pill[data-kind="storm"] {
  border-color: rgba(168, 85, 247, .75);
  animation: weatherStormFlash 3.5s ease-in-out infinite;
}
.weather-hud-pill[data-kind="night"] {
  border-color: rgba(129, 140, 248, .65);
}
.weather-hud-pill[data-kind="night"] .w-main {
  display: inline-block;
  animation: weatherMoonPulse 3s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(165, 180, 252, .8));
}
@keyframes weatherSunSpin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes weatherCloudFloat {
  0%, 100% { transform: translateX(-1.5px) translateY(0); }
  50%      { transform: translateX(2px) translateY(-2px); }
}
@keyframes weatherRainBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
@keyframes weatherDropFall {
  0%   { transform: translateY(-4px); opacity: .95; }
  100% { transform: translateY(5px); opacity: 0; }
}
@keyframes weatherStormFlash {
  0%, 92%, 100% { box-shadow: 0 4px 18px rgba(0,0,0,.35); }
  95%           { box-shadow: 0 0 24px rgba(250, 204, 21, .75); }
}
@keyframes weatherMoonPulse {
  0%, 100% { transform: scale(1) rotate(-4deg); }
  50%      { transform: scale(1.1) rotate(6deg); }
}
