:root {
  --bg-deep: #03070c;
  --bg-panel: rgba(6, 18, 30, 0.72);
  --bg-panel-strong: rgba(7, 22, 38, 0.88);
  --cyan: #3ddbff;
  --cyan-bright: #8ceeff;
  --cyan-dim: rgba(61, 219, 255, 0.28);
  --cyan-faint: rgba(61, 219, 255, 0.1);
  --white: #ffffff;
  --text-main: #e9faff;
  --text-muted: #7ab8cc;
  --danger: #ff4d6a;
  --success: #00f5a0;
  --warning: #ffc857;
  --font-hud: 'Orbitron', 'Rajdhani', sans-serif;
  --font-tech: 'Rajdhani', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --audio-scale: 1;
  --audio-glow: 0.35;
}

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

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Capas de fondo con rejilla sutil y viñeteado */
.bg-layer {
  position: fixed;
  inset: -6%;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.bg-grid {
  background-image:
    linear-gradient(to right, rgba(61, 219, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(61, 219, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(61, 219, 255, 0.018) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(61, 219, 255, 0.018) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: center center;
}

.bg-polar {
  background:
    radial-gradient(circle at 50% 50%, rgba(61, 219, 255, 0.11) 0%, transparent 55%),
    repeating-radial-gradient(
      circle at 50% 50%,
      transparent 0,
      transparent 110px,
      rgba(61, 219, 255, 0.025) 111px,
      transparent 112px
    );
}

.bg-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 38%,
    rgba(2, 6, 11, 0.65) 78%,
    rgba(1, 3, 6, 0.95) 100%
  );
}

/* Marcas de esquina del HUD */
.hud-corner {
  position: fixed;
  width: 28px;
  height: 28px;
  border-color: rgba(61, 219, 255, 0.42);
  border-style: solid;
  pointer-events: none;
  z-index: 3;
}
.hud-corner-tl {
  top: 12px;
  left: 12px;
  border-width: 2px 0 0 2px;
}
.hud-corner-tr {
  top: 12px;
  right: 12px;
  border-width: 2px 2px 0 0;
}
.hud-corner-bl {
  bottom: 12px;
  left: 12px;
  border-width: 0 0 2px 2px;
}
.hud-corner-br {
  bottom: 12px;
  right: 12px;
  border-width: 0 2px 2px 0;
}

.hidden {
  display: none !important;
}

/* Paneles translúcidos con borde fino estilo Stark */
.hud-panel {
  background: var(--bg-panel);
  border: 1px solid var(--cyan-dim);
  box-shadow:
    0 0 24px rgba(61, 219, 255, 0.08),
    inset 0 0 20px rgba(61, 219, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  border-radius: 4px;
}

.hud-panel::before,
.hud-panel::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--cyan);
  border-style: solid;
  pointer-events: none;
}

.hud-panel::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.hud-panel::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

/* PANTALLA DE LOGIN */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 36px 32px;
  text-align: center;
}

.login-emblem {
  width: 92px;
  height: 92px;
  margin: 0 auto 16px;
}

.mini-reactor {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mini-reactor .ring-dashed-slow {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-dasharray: 18 8 4 8;
  transform-origin: 60px 60px;
  animation: spinCW 18s linear infinite;
}

.mini-reactor .ring-dashed-reverse {
  fill: none;
  stroke: var(--white);
  stroke-width: 1.5;
  stroke-dasharray: 12 10;
  opacity: 0.8;
  transform-origin: 60px 60px;
  animation: spinCCW 12s linear infinite;
}

.mini-reactor .ring-core {
  fill: rgba(61, 219, 255, 0.25);
  stroke: var(--cyan);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px var(--cyan));
}

.hud-subtitle {
  font-family: var(--font-tech);
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.jarvis-logo {
  font-family: var(--font-hud);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--white);
  text-shadow: 0 0 16px rgba(61, 219, 255, 0.75);
  margin-bottom: 4px;
}

.login-desc {
  font-family: var(--font-tech);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  opacity: 0.85;
  margin-bottom: 26px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.hud-label {
  font-family: var(--font-tech);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--cyan);
}

.input-hud-wrap {
  position: relative;
}

.input-hud-wrap input,
.command-input-wrap input {
  width: 100%;
  background: rgba(3, 12, 22, 0.85);
  border: 1px solid var(--cyan-dim);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: 3px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-hud-wrap input:focus,
.command-input-wrap input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(61, 219, 255, 0.35);
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-hud);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 12px 18px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.hud-btn-primary {
  background: linear-gradient(135deg, rgba(61, 219, 255, 0.24), rgba(61, 219, 255, 0.08));
  border: 1px solid var(--cyan);
  color: var(--white);
  box-shadow: 0 0 15px rgba(61, 219, 255, 0.25);
}

.hud-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(61, 219, 255, 0.4), rgba(61, 219, 255, 0.18));
  box-shadow: 0 0 22px rgba(61, 219, 255, 0.55);
  transform: translateY(-1px);
}

.hud-btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--cyan-dim);
  color: var(--cyan-bright);
}

.hud-btn-secondary:hover:not(:disabled) {
  border-color: var(--cyan);
  background: rgba(61, 219, 255, 0.12);
  color: var(--white);
}

.hud-btn-ghost {
  background: transparent;
  border: 1px solid rgba(61, 219, 255, 0.25);
  color: var(--cyan);
}

.hud-btn-ghost:hover {
  border-color: var(--cyan);
  background: rgba(61, 219, 255, 0.12);
  color: var(--white);
}

.hud-btn-sm {
  padding: 9px 12px;
  font-size: 0.72rem;
  width: 100%;
}

.hud-btn-xs {
  padding: 5px 10px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  color: var(--text-muted);
  font-family: var(--font-tech);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(61, 219, 255, 0.2);
}

.alert-banner {
  background: rgba(255, 77, 106, 0.14);
  border: 1px solid var(--danger);
  color: #ffd5dc;
  padding: 10px 12px;
  font-size: 0.85rem;
  border-radius: 3px;
}

/* LAYOUT DEL PANEL PRINCIPAL */
.app-shell {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: 100vw;
  height: 100vh;
  padding: 18px 24px;
  gap: 14px;
}

/* BARRA SUPERIOR */
.hud-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 18px;
  background: rgba(5, 15, 26, 0.75);
  border: 1px solid var(--cyan-dim);
  border-radius: 4px;
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-tag {
  font-family: var(--font-tech);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid rgba(61, 219, 255, 0.25);
  border-radius: 999px;
  background: rgba(61, 219, 255, 0.06);
  font-family: var(--font-tech);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

.topbar-center {
  text-align: center;
}

.topbar-title {
  font-family: var(--font-hud);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--white);
  text-shadow:
    0 0 12px rgba(61, 219, 255, 0.8),
    0 0 28px rgba(61, 219, 255, 0.35);
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.clock-block {
  text-align: right;
}

.hud-clock {
  font-family: var(--font-hud);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(61, 219, 255, 0.5);
}

.hud-date {
  font-family: var(--font-tech);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hud-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(61, 219, 255, 0.07);
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-icon-btn:hover {
  border-color: var(--cyan);
  color: var(--white);
  background: rgba(61, 219, 255, 0.18);
  box-shadow: 0 0 12px rgba(61, 219, 255, 0.35);
}

.hud-icon-btn.muted {
  border-color: rgba(255, 77, 106, 0.5);
  color: var(--danger);
  background: rgba(255, 77, 106, 0.1);
}

/* PESTAÑAS MÓVILES */
.mobile-tabs {
  display: none;
  gap: 8px;
}

.mobile-tab {
  flex: 1;
  padding: 9px 10px;
  background: rgba(6, 18, 30, 0.7);
  border: 1px solid var(--cyan-dim);
  color: var(--text-muted);
  font-family: var(--font-hud);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  border-radius: 3px;
  cursor: pointer;
}

.mobile-tab.active {
  background: rgba(61, 219, 255, 0.18);
  border-color: var(--cyan);
  color: var(--white);
  box-shadow: 0 0 12px rgba(61, 219, 255, 0.25);
}

/* ALERTA GLOBAL */
.global-alert {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(36, 8, 16, 0.92);
  border: 1px solid var(--danger);
  box-shadow: 0 0 24px rgba(255, 77, 106, 0.45);
  color: #ffe3e8;
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 0.88rem;
  max-width: 90vw;
}

.alert-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

/* CUERPO PRINCIPAL DE 3 COLUMNAS */
.hud-main {
  display: grid;
  grid-template-columns: 310px 1fr 390px;
  gap: 20px;
  min-height: 0;
  align-items: stretch;
}

.panel-left,
.panel-right {
  display: flex;
  flex-direction: column;
  padding: 18px;
  min-height: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(61, 219, 255, 0.2);
}

.panel-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-corner-mark {
  width: 6px;
  height: 14px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  display: inline-block;
}

.panel-title {
  font-family: var(--font-hud);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--cyan);
}

.panel-code {
  font-family: var(--font-tech);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.14em;
}

/* TELEMETRÍA (PANEL IZQUIERDO) */
.telemetry-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.telemetry-item {
  background: rgba(3, 12, 22, 0.55);
  border-left: 2px solid var(--cyan);
  padding: 9px 12px;
  border-radius: 0 3px 3px 0;
}

.telemetry-label {
  display: block;
  font-family: var(--font-tech);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.telemetry-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.telemetry-value {
  font-family: var(--font-tech);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--white);
}

.accent-cyan {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(61, 219, 255, 0.45);
}

.panel-divider {
  height: 1px;
  background: rgba(61, 219, 255, 0.18);
  margin: 16px 0;
}

.security-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subpanel-title {
  font-family: var(--font-hud);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--cyan);
}

.security-hint {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.panel-footer-decor {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed rgba(61, 219, 255, 0.18);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-tech);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

/* CENTRO: REACTOR J.A.R.V.I.S. */
.reactor-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.reactor-Wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

.hud-readout {
  display: flex;
  gap: 28px;
  font-family: var(--font-tech);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.reactor-parallax-box {
  width: min(440px, 52vh, 78vw);
  height: min(440px, 52vh, 78vw);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jarvis-reactor-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: filter 0.35s ease;
}

.reactor-ring {
  transform-origin: 250px 250px;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

/* Estilos de los anillos SVG */
.ring-stroke-faint {
  fill: none;
  stroke: rgba(61, 219, 255, 0.22);
  stroke-width: 1;
}

.ring-ticks-fine {
  fill: none;
  stroke: rgba(61, 219, 255, 0.45);
  stroke-width: 6;
  stroke-dasharray: 2 9.52;
}

.ring-cardinal {
  stroke: var(--white);
  stroke-width: 2.5;
  opacity: 0.75;
}

.ring-segmented-primary {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 4;
  stroke-dasharray: 95 28 35 28 140 35;
  stroke-linecap: round;
}

.ring-dashed-thin {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 8 14;
}

.ring-arc-heavy {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 7;
  stroke-dasharray: 120 80 60 90 150 70;
  opacity: 0.85;
}

.ring-ticks-medium {
  fill: none;
  stroke: var(--white);
  stroke-width: 4;
  stroke-dasharray: 3 16;
  opacity: 0.5;
}

.ring-gyro {
  fill: none;
  stroke: var(--cyan-bright);
  stroke-width: 2;
  stroke-dasharray: 45 22 12 22;
}

.ring-pointer {
  fill: var(--white);
}

.ring-audio-pulse {
  fill: none;
  stroke: var(--white);
  stroke-width: 3.5;
  stroke-dasharray: 26 10 8 10;
  transform-origin: 250px 250px;
  transform: scale(var(--audio-scale));
  transition: stroke 0.2s ease;
}

.ring-harmonic {
  fill: rgba(61, 219, 255, 0.05);
  stroke: var(--cyan);
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  transform-origin: 250px 250px;
  transform: scale(calc(0.92 + (var(--audio-scale) - 1) * 0.7));
}

.reactor-core-group {
  transform-origin: 250px 250px;
  animation: pulseCore 4s ease-in-out infinite;
}

.core-inner-ring {
  fill: rgba(61, 219, 255, 0.14);
  stroke: var(--white);
  stroke-width: 2.5;
}

.core-center-dot {
  fill: var(--white);
  filter: drop-shadow(0 0 14px var(--cyan)) drop-shadow(0 0 28px var(--white));
}

/* Rotaciones en estado REPOSO (idle) */
.ring-outer-ticks {
  animation: spinCCW 90s linear infinite;
}
.ring-cw-slow {
  animation: spinCW 32s linear infinite;
}
.ring-ccw-medium {
  animation: spinCCW 24s linear infinite;
}
.ring-cw-fast {
  animation: spinCW 16s linear infinite;
}
.ring-ccw-fast {
  animation: spinCCW 12s linear infinite;
}

/* ESTADO 2: ESCUCHANDO (los anillos se encogen y brillan) */
.reactor-Wrapper[data-state='listening'] .jarvis-reactor-svg {
  filter: drop-shadow(0 0 26px rgba(61, 219, 255, 0.85))
    drop-shadow(0 0 48px rgba(255, 255, 255, 0.45));
}

.reactor-Wrapper[data-state='listening'] .ring-cw-slow {
  animation: shrinkRingCW 4s ease-in-out infinite alternate;
}

.reactor-Wrapper[data-state='listening'] .ring-ccw-medium {
  animation: shrinkRingCCW 3.5s ease-in-out infinite alternate;
}

.reactor-Wrapper[data-state='listening'] .ring-cw-fast {
  animation: shrinkRingInner 2.5s ease-in-out infinite alternate;
}

.reactor-Wrapper[data-state='listening'] .core-center-dot {
  r: 26;
  fill: #ffffff;
}

/* ESTADO 3: PENSANDO (giro rápido) */
.reactor-Wrapper[data-state='thinking'] .ring-cw-slow {
  animation: spinCW 4.2s linear infinite;
}
.reactor-Wrapper[data-state='thinking'] .ring-ccw-medium {
  animation: spinCCW 3.1s linear infinite;
}
.reactor-Wrapper[data-state='thinking'] .ring-cw-fast {
  animation: spinCW 1.9s linear infinite;
}
.reactor-Wrapper[data-state='thinking'] .ring-ccw-fast {
  animation: spinCCW 1.4s linear infinite;
}
.reactor-Wrapper[data-state='thinking'] .reactor-core-group {
  animation: pulseThinking 0.75s ease-in-out infinite;
}

/* ESTADO 4: HABLANDO (los anillos laten al ritmo del audio del AnalyserNode) */
.reactor-Wrapper[data-state='speaking'] .jarvis-reactor-svg {
  filter: drop-shadow(
    0 0 calc(16px + 34px * var(--audio-glow)) rgba(61, 219, 255, 0.9)
  );
}

.reactor-Wrapper[data-state='speaking'] .reactor-core-group {
  animation: none;
  transform: scale(var(--audio-scale));
}

.reactor-caption {
  margin-top: 14px;
  font-family: var(--font-hud);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--cyan-bright);
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.caption-bracket {
  color: var(--white);
  font-weight: 700;
}

/* PANEL DERECHO: HISTORIAL DE CONVERSACIÓN */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 6px;
  user-select: text;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
  background: rgba(3, 12, 22, 0.4);
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(61, 219, 255, 0.35);
  border-radius: 3px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-tech);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 24px;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  max-width: 88%;
  background: rgba(61, 219, 255, 0.14);
  border: 1px solid rgba(61, 219, 255, 0.45);
  color: var(--white);
}

.chat-bubble.assistant {
  align-self: flex-start;
  max-width: 92%;
  background: rgba(4, 15, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 3px solid var(--cyan);
  color: var(--text-main);
}

.bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-tech);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
}

.chat-bubble.user .bubble-meta {
  color: var(--cyan-bright);
}

.bubble-content {
  white-space: pre-wrap;
}

.streaming-cursor::after {
  content: '▋';
  display: inline-block;
  margin-left: 3px;
  color: var(--cyan);
  animation: blinkCursor 0.8s steps(2, start) infinite;
}

/* BARRA INFERIOR */
.hud-bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.command-bar {
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-panel-strong);
  border: 1px solid var(--cyan-dim);
  border-radius: 6px;
  box-shadow: 0 0 24px rgba(61, 219, 255, 0.12);
}

.command-input-wrap {
  flex: 1;
}

/* Botón de micrófono grande y redondo */
.mic-orb-btn {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(61, 219, 255, 0.35),
    rgba(6, 22, 38, 0.95)
  );
  border: 2px solid var(--cyan);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow:
    0 0 18px rgba(61, 219, 255, 0.45),
    inset 0 0 12px rgba(61, 219, 255, 0.35);
  transition: all 0.25s ease;
}

.mic-orb-btn:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow:
    0 0 26px rgba(61, 219, 255, 0.8),
    inset 0 0 16px rgba(255, 255, 255, 0.45);
}

.mic-orb-btn.listening {
  border-color: var(--white);
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.55),
    rgba(61, 219, 255, 0.85)
  );
  box-shadow:
    0 0 32px var(--cyan),
    0 0 54px rgba(255, 255, 255, 0.6);
  animation: micPulse 1.1s ease-in-out infinite;
}

.mic-orb-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--text-muted);
  box-shadow: none;
}

.mic-orb-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px dashed var(--cyan);
  pointer-events: none;
  animation: spinCW 14s linear infinite;
}

/* ANIMACIONES KEYFRAMES */
@keyframes spinCW {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes spinCCW {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@keyframes pulseCore {
  0%,
  100% {
    transform: scale(0.97);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes pulseThinking {
  0%,
  100% {
    transform: scale(0.92);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes shrinkRingCW {
  0% {
    transform: scale(0.86) rotate(0deg);
  }
  100% {
    transform: scale(0.82) rotate(180deg);
  }
}

@keyframes shrinkRingCCW {
  0% {
    transform: scale(0.84) rotate(360deg);
  }
  100% {
    transform: scale(0.79) rotate(180deg);
  }
}

@keyframes shrinkRingInner {
  0% {
    transform: scale(0.82) rotate(0deg);
  }
  100% {
    transform: scale(0.75) rotate(220deg);
  }
}

@keyframes micPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes blinkCursor {
  to {
    visibility: hidden;
  }
}

/* DISEÑO RESPONSIVO (MÓVIL Y TABLET) */
@media (max-width: 1024px) {
  .app-shell {
    padding: 10px 12px;
    gap: 10px;
  }

  .hud-topbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .topbar-center {
    display: none;
  }

  .mobile-tabs {
    display: flex;
  }

  .hud-main {
    grid-template-columns: 1fr;
    position: relative;
  }

  .panel-left,
  .panel-right,
  .reactor-stage {
    display: none;
    height: 100%;
  }

  .panel-left.active-mobile-view,
  .panel-right.active-mobile-view {
    display: flex;
  }

  .reactor-stage.active-mobile-view {
    display: flex;
  }

  .reactor-parallax-box {
    width: min(320px, 46vh, 82vw);
    height: min(320px, 46vh, 82vw);
  }

  .send-btn span {
    display: none;
  }
}

/* RESPETO A PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
