
:root {
  --bg: #030914;
  --panel: rgba(10, 23, 42, .88);
  --panel2: rgba(14, 34, 58, .92);
  --text: #eff8ff;
  --muted: #91a8bd;
  --accent: #21cfff;
  --accent-rgb: 33, 207, 255;
  --gold: #ffd49a;
  --line: rgba(65, 190, 255, .20);
  --glow: 0 0 25px rgba(33, 207, 255, .22);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 10%, rgba(0, 111, 180, .20), transparent 42%),
    radial-gradient(ellipse at 10% 85%, rgba(0, 70, 130, .13), transparent 40%),
    linear-gradient(145deg, #071426, #030914 60%, #02060d);
  -webkit-tap-highlight-color: transparent;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

button:active {
  transform: scale(.96);
}

.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100dvh;
  margin: auto;
  position: relative;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 19, 36, .42), rgba(3, 9, 20, .12));
}

/* CABECERA */

.topbar {
  height: 72px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 10, 22, .82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  position: sticky;
  top: 0;
  z-index: 15;
}

.icon-btn {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #102641, #071426);
  color: var(--text);
  border-radius: 14px;
  width: 42px;
  height: 42px;
  font-size: 18px;
  box-shadow: inset 0 1px rgba(255,255,255,.06);
}

.icon-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mini strong {
  display: block;
  font-size: 15px;
  letter-spacing: .07em;
}

.brand-mini small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.mini-orb {
  display: inline-block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #d9fbff 0, #39dfff 10%, #0876b6 32%, #061a35 68%, #020713 100%);
  box-shadow:
    0 0 12px var(--accent),
    0 0 28px rgba(var(--accent-rgb), .35),
    inset 0 0 9px #9af2ff;
  border: 1px solid rgba(99, 220, 255, .8);
}

main {
  padding: 0 18px;
}

.screen {
  display: none;
  animation: fadeIn .3s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PANTALLA PRINCIPAL */

.hero {
  min-height: calc(100dvh - 205px);
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
  padding-top: 25px;
}

.status-pill {
  border: 1px solid rgba(var(--accent-rgb), .28);
  border-radius: 30px;
  padding: 9px 15px;
  color: #d4f3ff;
  background: rgba(7, 27, 48, .78);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), .08);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #50f5b5;
  box-shadow: 0 0 10px #50f5b5;
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  50% { opacity: .45; box-shadow: 0 0 3px #50f5b5; }
}

/* ESCENARIO HOLOGRÁFICO */

.orb-stage {
  height: 300px;
  width: 300px;
  max-width: 90vw;
  position: relative;
  display: grid;
  place-items: center;
  margin: 12px auto 4px;
  isolation: isolate;
}

.orb-stage::before {
  content: "";
  position: absolute;
  width: 225px;
  height: 225px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 164, 255, .20), transparent 68%);
  filter: blur(18px);
  animation: hologramBreath 4s ease-in-out infinite;
}

.orb-stage::after {
  content: "";
  position: absolute;
  width: 205px;
  height: 205px;
  border-radius: 50%;
  border: 1px solid rgba(33, 207, 255, .14);
  box-shadow: 0 0 35px rgba(33, 207, 255, .10);
}

@keyframes hologramBreath {
  0%, 100% { transform: scale(.92); opacity: .65; }
  50% { transform: scale(1.08); opacity: 1; }
}

.orb-core {
  width: 142px;
  height: 142px;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  background:
    radial-gradient(circle at 34% 25%, #17476b 0, #0a2546 36%, #041329 72%, #020814 100%);
  border: 1px solid rgba(var(--accent-rgb), .9);
  box-shadow:
    0 0 18px rgba(var(--accent-rgb), .65),
    0 0 55px rgba(var(--accent-rgb), .30),
    inset 0 0 28px rgba(var(--accent-rgb), .25);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 27px;
  animation: coreFloat 4s ease-in-out infinite;
}

@keyframes coreFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.eye {
  width: 12px;
  height: 30px;
  border-radius: 50%;
  background: #76edff;
  box-shadow: 0 0 12px #21cfff, 0 0 25px #21cfff;
}

.orb-mouth {
  position: absolute;
  width: 25px;
  height: 9px;
  border-bottom: 2px solid #76edff;
  border-radius: 50%;
  bottom: 37px;
  opacity: .9;
}

.orbit {
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(var(--accent-rgb), .65);
  border-radius: 50%;
  filter: drop-shadow(0 0 8px var(--accent));
  transform: rotate(-25deg) scaleY(.57);
  animation: spin 9s linear infinite;
  z-index: 1;
}

.orbit-two {
  inset: 7px;
  border-color: rgba(92, 160, 255, .65);
  transform: rotate(38deg) scaleY(.7);
  animation-duration: 13s;
  animation-direction: reverse;
}

.orbit-three {
  inset: 42px;
  border-color: rgba(var(--accent-rgb), .35);
  transform: rotate(80deg) scaleY(.8);
  animation-duration: 16s;
}

.orb-glow {
  position: absolute;
  width: 190px;
  height: 190px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .19), transparent 68%);
  border-radius: 50%;
  filter: blur(12px);
  z-index: 0;
}

@keyframes spin {
  to { rotate: 360deg; }
}

/* ESTADOS DE DOMINIC */

.orb-stage.speaking .orb-core {
  box-shadow:
    0 0 25px rgba(var(--accent-rgb), .9),
    0 0 80px rgba(var(--accent-rgb), .5),
    inset 0 0 35px rgba(var(--accent-rgb), .4);
  animation: speakingPulse .55s ease-in-out infinite alternate;
}

@keyframes speakingPulse {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

.hero h1 {
  font-size: 38px;
  letter-spacing: .025em;
  margin: 0;
  font-weight: 750;
  text-shadow: 0 0 24px rgba(var(--accent-rgb), .24);
}

.hero-subtitle {
  color: #68dcff;
  font-size: 13px;
  letter-spacing: .12em;
  margin: 8px 0;
  text-transform: uppercase;
}

.hero-hint {
  color: var(--muted);
  font-size: 13px;
  max-width: 280px;
  line-height: 1.6;
  margin: 8px 0 17px;
}

.mic-button {
  height: 82px;
  width: 82px;
  border-radius: 50%;
  border: 1px solid #4adfff;
  background:
    radial-gradient(circle at 35% 25%, #1c5c82, #092747 65%, #041225);
  color: #8ceeff;
  font-size: 29px;
  box-shadow:
    0 0 0 7px rgba(var(--accent-rgb), .07),
    0 0 30px rgba(var(--accent-rgb), .35),
    inset 0 0 22px rgba(var(--accent-rgb), .22);
  cursor: pointer;
}

.mic-button:hover {
  box-shadow:
    0 0 0 9px rgba(var(--accent-rgb), .09),
    0 0 42px rgba(var(--accent-rgb), .55);
}

.mic-button.listening {
  animation: micPulse 1.1s ease-in-out infinite;
}

@keyframes micPulse {
  50% {
    box-shadow:
      0 0 0 15px rgba(var(--accent-rgb), .10),
      0 0 48px rgba(var(--accent-rgb), .7);
  }
}

.mic-caption {
  color: #c4efff;
  font-size: 12px;
  margin-top: 13px;
}

.voice-tools {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.subtle-btn {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(13, 30, 52, .8);
  color: #c8e8f7;
  padding: 10px 15px;
  font-size: 12px;
}

.subtle-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

/* ENTRADA DE MENSAJES */

.composer {
  width: 100%;
  display: flex;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(var(--accent-rgb), .24);
  border-radius: 20px;
  background: rgba(8, 23, 42, .94);
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  margin: 0 0 14px;
}

.composer:focus-within {
  border-color: rgba(var(--accent-rgb), .7);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08);
}

.composer input {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 15px;
  min-width: 0;
  flex: 1;
  padding: 5px;
}

.composer input::placeholder {
  color: #718ba6;
}

.send-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #76edff, #19b8ef);
  color: #032033;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 0 18px rgba(var(--accent-rgb), .25);
}

.quick-prompts {
  padding: 0 0 18px;
}

.quick-prompts > span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.chips {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 10px 0 5px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chips button {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(145deg, #102640, #08172a);
  color: #d1edff;
  padding: 10px 14px;
  font-size: 12px;
}

.chips button:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

/* NAVEGACIÓN INFERIOR */

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  display: flex;
  justify-content: space-around;
  padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(3, 11, 24, .94);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  color: #7894ad;
  font-size: 10px;
  min-width: 76px;
}

.nav-item span {
  font-size: 21px;
}

.nav-item.selected {
  color: #61e4ff;
  text-shadow: 0 0 12px rgba(var(--accent-rgb), .45);
}

/* CHAT */

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 16px;
}

.section-heading small {
  color: var(--accent);
  letter-spacing: .13em;
  font-size: 10px;
}

.section-heading h2 {
  font-size: 24px;
  margin: 5px 0 0;
}

.chat-messages {
  height: calc(100dvh - 270px);
  min-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 6px 2px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), .35) transparent;
}

.message {
  max-width: 89%;
  border: 1px solid rgba(105, 177, 220, .17);
  border-radius: 18px 18px 18px 5px;
  padding: 13px 15px;
  background: linear-gradient(145deg, rgba(17, 39, 65, .96), rgba(8, 23, 42, .96));
  align-self: flex-start;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.message.user {
  align-self: flex-end;
  border-color: rgba(var(--accent-rgb), .35);
  border-radius: 18px 18px 5px 18px;
  background: linear-gradient(145deg, #07506c, #07344e);
}

.message-author {
  font-size: 9px;
  color: #65dcff;
  letter-spacing: .13em;
  font-weight: 700;
}

.message p {
  font-size: 14px;
  line-height: 1.6;
  margin: 7px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.speak-line {
  border: 0;
  background: none;
  color: #62ddff;
  font-size: 11px;
  padding: 9px 0 0;
}

.speak-line:hover {
  color: white;
}

.pending {
  opacity: .72;
  animation: pendingPulse 1.2s infinite alternate;
}

@keyframes pendingPulse {
  to { opacity: .42; }
}

.chat-composer {
  margin-top: 4px;
}

/* CONFIGURACIÓN */

.settings-card {
  background: linear-gradient(145deg, rgba(14, 34, 58, .92), rgba(7, 19, 35, .94));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 12px 35px rgba(0,0,0,.16);
}

.settings-avatar {
  height: 110px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.mini-orb.large {
  width: 78px;
  height: 78px;
  box-shadow: 0 0 25px rgba(var(--accent-rgb), .4);
}

.field-label {
  display: block;
  font-size: 12px;
  color: #c2dbea;
  margin: 15px 0 7px;
}

.settings-input {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: #061426;
  border: 1px solid var(--line);
  color: var(--text);
  outline: none;
  font-size: 14px;
}

.settings-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08);
}

.file-input {
  font-size: 12px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.color-row input {
  width: 44px;
  height: 36px;
  background: none;
  border: 0;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  font-size: 13px;
}

.toggle-row small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.toggle-row input {
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
}

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(135deg, #72eaff, #1bb9ed);
  color: #032033;
  font-weight: 750;
  margin-top: 18px;
  box-shadow: 0 7px 22px rgba(var(--accent-rgb), .18);
}

.primary-btn:hover {
  box-shadow: 0 8px 30px rgba(var(--accent-rgb), .38);
}

.note {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 0;
}

.note code {
  color: #a9edff;
}

/* AVISOS Y MENÚ LATERAL */

.toast {
  position: fixed;
  left: 50%;
  bottom: 105px;
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  background: #d9f8ff;
  color: #032033;
  border-radius: 12px;
  padding: 12px 17px;
  font-size: 12px;
  z-index: 30;
  transition: .22s;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.list-panel {
  position: fixed;
  inset: 0 18% 0 0;
  z-index: 35;
  background: #07172b;
  border-right: 1px solid var(--line);
  padding: 30px 18px;
  box-shadow: 20px 0 80px #0009;
  display: none;
}

.list-panel.open {
  display: block;
}

.list-panel h3 {
  margin-top: 30px;
}

.list-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}

.list-panel button:hover {
  background: var(--panel2);
}

body.list-open:after {
  content: "";
  position: fixed;
  inset: 0;
  background: #0008;
  z-index: 30;
}

/* ADAPTACIÓN A PANTALLAS GRANDES */

@media (min-width: 540px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    min-height: calc(100dvh - 36px);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: 0 20px 80px rgba(0,0,0,.35);
  }

  .topbar {
    border-radius: 28px 28px 0 0;
  }

  .bottom-nav {
    bottom: 18px;
    border-radius: 0 0 28px 28px;
  }

  .hero {
    min-height: 560px;
  }

  .chat-messages {
    height: 470px;
  }
}

@media (max-width: 380px) {
  main {
    padding-left: 13px;
    padding-right: 13px;
  }

  .orb-stage {
    width: 270px;
    height: 270px;
  }

  .hero h1 {
    font-size: 33px;
  }

  .mic-button {
    width: 74px;
    height: 74px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* =====================================
   DOMINIC IA - IMAGEN HOLOGRÁFICA
===================================== */

.orb-stage.dominic-stage {
    width: 100%;
    max-width: 440px;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 12px auto 8px;
    position: relative;
    isolation: isolate;
}

.dominic-image-container {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dominicFloat 4s ease-in-out infinite;
}

.dominic-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 22px;
    filter:
        drop-shadow(0 0 12px rgba(33, 207, 255, .35))
        drop-shadow(0 0 28px rgba(33, 207, 255, .18));
}

.dominic-stage .orb-glow {
    z-index: 1;
    width: 85%;
    height: 85%;
    background: radial-gradient(
        circle,
        rgba(33, 207, 255, .25),
        transparent 70%
    );
}

.dominic-stage.speaking .dominic-image {
    filter:
        drop-shadow(0 0 18px rgba(33, 207, 255, .7))
        drop-shadow(0 0 38px rgba(33, 207, 255, .35));
}

.dominic-stage.speaking .dominic-image-container {
    animation: dominicSpeaking .55s ease-in-out infinite alternate;
}

@keyframes dominicFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

@keyframes dominicSpeaking {
    from { transform: scale(1); }
    to { transform: scale(1.025); }
}

/* Imagen en configuración */

.settings-dominic-image {
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 20px;
    border: 1px solid rgba(33, 207, 255, .55);
    box-shadow: 0 0 25px rgba(33, 207, 255, .3);
}

/* Adaptación móvil */

@media (max-width: 380px) {
    .orb-stage.dominic-stage {
        max-width: 310px;
    }
}

@media (min-width: 540px) {
    .orb-stage.dominic-stage {
        max-width: 440px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dominic-image-container {
        animation: none !important;
    }
}

/* DOMINIC IA - CORRECCIÓN DEFINITIVA RESPONSIVE */

.orb-stage.dominic-stage {
    width: min(100%, 360px) !important;
    height: 360px !important;
    aspect-ratio: 1 / 1;
    margin: 12px auto 8px;
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
}

.dominic-stage .dominic-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 3;
}

.dominic-stage .dominic-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    object-position: center;
}

/* Pantallas pequeñas */
@media (max-width: 480px) {
    .orb-stage.dominic-stage {
        width: min(100%, 340px) !important;
        height: 340px !important;
    }
}

/* Pantallas grandes */
@media (min-width: 768px) {
    .orb-stage.dominic-stage {
        width: 380px !important;
        height: 380px !important;
    }
}

/* CORRECCIÓN ESTRUCTURAL DEL CONTENEDOR DE DOMINIC */

.orb-stage.dominic-stage {
    position: relative !important;
    width: min(100%, 360px) !important;
    height: 360px !important;
    aspect-ratio: 1 / 1;
    overflow: hidden !important;
    display: block !important;
    isolation: isolate;
}

.dominic-stage .dominic-image-container {
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    z-index: 3;
}

.dominic-stage .dominic-image {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    flex: 0 1 auto !important;
}

@media (max-width: 480px) {
    .orb-stage.dominic-stage {
        width: min(100%, 340px) !important;
        height: 340px !important;
    }
}

@media (min-width: 768px) {
    .orb-stage.dominic-stage {
        width: 380px !important;
        height: 380px !important;
    }
}
