/* === Global constellation background (no more black gaps) === */
.constellation {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}
/* Ensure all app content renders above the canvas */
.app, .screen { position: relative; z-index: 1; }

/* === Market Pulse floating widget === */
.pulse {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 320px;
  z-index: 30;
  padding: 12px 14px 12px;
  background: linear-gradient(180deg, oklch(0.20 0.008 260 / 0.94), oklch(0.13 0.005 260 / 0.94));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  box-shadow:
    0 30px 60px -20px oklch(0 0 0 / 0.7),
    0 0 24px var(--accent-soft),
    inset 0 0 0 1px oklch(1 0 0 / 0.04);
  font-family: var(--font-body);
  animation: pulse-in .35s cubic-bezier(.2,.7,.2,1);
  transition: width .25s cubic-bezier(.2,.7,.2,1), padding .25s;
}
.pulse.collapsed {
  width: auto; padding: 8px 12px;
}

.pulse-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 4px;
  padding-right: 26px;
}
.pulse-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 9px; letter-spacing: 0.16em; color: var(--accent);
  text-transform: uppercase;
}
.pulse-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 14px; letter-spacing: -0.01em;
  margin-top: 2px;
}
.pulse-clock {
  font-size: 9.5px; letter-spacing: 0.14em;
  color: var(--ink-3); text-transform: uppercase;
}
.pulse-tvwrap {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: oklch(0.16 0.005 260 / 0.6);
  overflow: hidden;
  margin-bottom: 8px;
  min-height: 92px;
}
.pulse-symbols {
  display: flex; gap: 2px;
  border-top: 1px dashed var(--line-soft);
  padding-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pulse-symbols::-webkit-scrollbar { display: none; }
.pulse-sym-btn {
  appearance: none; border: 1px solid var(--line-soft);
  background: transparent; color: var(--ink-3);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.pulse-sym-btn:hover { color: var(--ink); }
.pulse-sym-btn[data-on="true"] {
  background: var(--accent); color: oklch(0.18 0.02 80);
  border-color: var(--accent); font-weight: 700;
}
@keyframes pulse-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.pulse-toggle {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  border: 0; background: var(--bg-2);
  border-radius: 6px;
  color: var(--ink-3);
  cursor: pointer;
  display: grid; place-items: center;
  font-family: var(--font-mono);
}
.pulse-toggle:hover { color: var(--ink); }

/* ── 22 PX SON DEMASIADO POCO PARA UN DEDO ────────────────────────────────
   Este botón mide 22×22 y vive en una esquina. Con ratón se acierta; con el
   pulgar, no: la guía de Apple pide 44 px de zona táctil y aquí hay la mitad.

   Se amplía la zona con un pseudo-elemento invisible en vez de agrandar el
   botón: así la zona pasa a 44 px y el aspecto no cambia ni un píxel. Un
   botón más grande en esa esquina se comería el título de al lado.

   OJO — este arreglo se apagaba solo. La regla `.pulse.collapsed
   .pulse-toggle` de abajo ponía `position: static`, y un ::after absoluto
   deja de anclarse a un padre estático: se iba al ancestro posicionado más
   cercano. Resultado: la zona ampliada funcionaba con el panel abierto y
   fallaba PLEGADO… que es como sale en la portada, y justo cuando el botón
   es más pequeño (medido: 55×15 px). Ahora es `relative` —idéntico en
   maquetación, pero vuelve a ser el ancla— y el ::after se centra con un
   mínimo de 44 px, así sirve para los dos estados sin depender del tamaño. */
@media (max-width: 640px) {
  .pulse-toggle::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    min-width: 44px; min-height: 44px;
  }
}
.pulse.collapsed .pulse-toggle {
  position: relative;   /* NO cambiar a static: desancla el ::after de arriba */
  background: transparent; color: var(--ink);
  width: auto; height: auto;
  padding: 0;
}
.pulse-heart {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse-beat 1.4s ease-in-out infinite;
}
@keyframes pulse-beat {
  0%, 100% { transform: scale(1); box-shadow: 0 0 8px var(--accent); }
  20% { transform: scale(1.35); box-shadow: 0 0 16px var(--accent); }
  40% { transform: scale(1); }
  60% { transform: scale(1.15); box-shadow: 0 0 14px var(--accent); }
  80% { transform: scale(1); }
}

.pulse-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 6px;
}
.pulse-eyebrow {
  font-size: 9px; letter-spacing: 0.18em; color: var(--ink-3);
  text-transform: uppercase;
}
.pulse-value {
  font-family: var(--font-display); font-weight: 600;
  font-size: 22px; letter-spacing: -0.02em;
  margin-top: 2px;
}
.pulse-right { text-align: right; }
.pulse-pct {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
}
.pulse-pct.up { color: var(--up); }
.pulse-pct.down { color: var(--down); }
.pulse-sub {
  font-size: 10px; color: var(--ink-3); margin-top: 2px;
  letter-spacing: 0.06em;
}
.pulse-ecg {
  display: block;
  border-radius: 6px;
  margin: 4px 0 8px;
}
.pulse-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px dashed var(--line-soft);
  padding-top: 8px;
}
.pulse-regime {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.14em;
  padding: 3px 8px; border: 1px solid currentColor;
  border-radius: 99px;
  font-weight: 600;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.pulse-clock {
  font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-3);
}

@media (max-width: 700px) {
  .pulse { right: 12px; bottom: 12px; width: 240px; }
}

/* ── Móvil: el widget no puede tapar el contenido ─────────────────────────
   pulse.js ya lo arranca PLEGADO en <768px (matchMedia); aquí se garantiza
   que plegado sea una franja de UNA línea, y que el panel desplegado nunca
   invada la esquina inferior izquierda, donde vive el botón flotante IA
   (.ai-fab, posicionado inline en assistant.js: left 20 / bottom 20). */
@media (max-width: 767px) {
  .pulse { max-width: calc(100vw - 92px); }
  .pulse.collapsed { max-height: 48px; overflow: hidden; }
}
