:root { --bg:#0b0c10; --card:#111318; --ink:#e6e7eb; --muted:#a3a7b3; --pri:#7aa2f7; }
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.6 system-ui,Segoe UI,Roboto,Ubuntu}

.container{width:min(100%,1000px);margin-inline:auto;padding:24px}
.nav{display:flex;gap:18px;justify-content:flex-end}
.nav a{color:var(--muted);text-decoration:none}
.card{background:var(--card);border:1px solid #1b1e26;border-radius:16px;box-shadow:0 8px 30px rgba(0,0,0,.25)}

.intro{display:grid;grid-template-columns:160px 1fr;gap:24px;align-items:center}
#foto{width:160px;height:160px;border-radius:16px;object-fit:cover;border:1px solid #242733}
.subtitle{color:var(--muted);margin-top:-6px}
.btn{display:inline-block;background:var(--pri);color:#0b0c10;padding:10px 14px;border-radius:10px;text-decoration:none;font-weight:600}
.btn.ghost{background:transparent;border:1px solid #2a2e3a;color:var(--ink)}
.cta-row{display:flex;gap:12px;margin-top:12px}

/* Proyectos */
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px}
.card-proy{background:var(--card);border:1px solid #1b1e26;border-radius:14px;overflow:hidden;display:flex;flex-direction:column}
.card-proy img{width:100%;height:150px;object-fit:cover}
.card-proy .p{padding:14px}
.card-proy h3{margin:0 0 6px}
.card-proy a{color:var(--pri)}

/* ===== Proyectos (nuevo layout tipo sección + carrusel) ===== */
/* ===== Carrusel de proyectos (similar al template) ===== */
.carousel-wrapper {
  position: relative;
  max-width: 900px;
  margin: 24px auto 0;
  
  /* IMPORTANTE: Oculta los items que se "salen"
     del contenedor. */
  overflow: hidden; 
}

/* Carrusel horizontal */
.carousel {
  width: 100%;
  list-style: none;
  padding-block: 3rem;
  /* El padding-inline ya no es necesario aquí */
  padding-inline: 0; 

  /* CAMBIO CLAVE: de 'grid' a 'flex' 
     Esto nos permite mover el contenedor entero 
     con 'transform'. */
  display: flex;
  
  /* Los items ahora tendrán un ancho fijo, 
     así que esto ya no es necesario:
  grid-auto-flow: column;
  grid-auto-columns: 260px;
  */
  
  gap: 2.5rem;
  
  /* AÑADIDO: Esta es la animación de movimiento */
  transition: transform 400ms ease-in-out;

  /* --- ELIMINADO --- */
  /* Ya no es un contenedor de scroll */
  /* overflow-x: auto; */
  /* scroll-snap-type: x mandatory; */
  /* scroll-padding-inline: 3rem;  */
  /* scroll-behavior: smooth; */
  /* scrollbar-width: none; */
}


/* Tarjeta base: más pequeña, opaca, como los lados del template */
.carousel-item {
  position: relative;
  
  /* AÑADIDO: Damos el ancho fijo aquí y 
     evitamos que se encoja */
  width: 260px;
  flex-shrink: 0; 
  
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  
  transform: scale(0.75);
  opacity: 0.35;
  filter: blur(2px);
  transition:
    transform 250ms ease-out,
    opacity 250ms ease-out,
    filter 250ms ease-out;

  /* --- ELIMINADO --- */
  /* scroll-snap-align: center; */
  /* scroll-snap-stop: always; */
}

/* Tarjeta activa (la del centro) → grande y nítida */
.carousel-item.is-active {
  transform: scale(1);
  opacity: 1;
  filter: none;
}

/* Imagen, arriba */
.carousel-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  margin-bottom: 1rem;
}
.carousel-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  display: block;
}

/* Título y subtítulo debajo de la imagen */
.carousel-title {
  margin: 0;
  font-size: 1.1rem;
}
.carousel-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Botones prev / next */
.carousel-nav {
  position: absolute;
  top: 60%;
  transform: translateY(-50%);
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  background: #0f172b;
  color: #fff;
  display: grid;
  place-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0.85;
}
.carousel-nav:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.08);
}

.nav-prev { left: 0; }
.nav-next { right: 0; }

@media (max-width: 600px) {
  .carousel {
    /* Ajustamos también el scroll-padding para mobile */
    padding-inline: 2rem;
    scroll-padding-inline: 2rem;
    gap: 1.5rem;
  }
}


.carousel-nav:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  transform: translateY(-50%) scale(1); /* No hacer hover */
}




/* #clear-btn,
#retry-btn {
  margin-top: 0.75rem;
  background: #334155;
  color: #f8fafc;
  border: 1px solid #475569
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}
#clear-btn:hover,
#retry-btn:hover {
  background: #475569;
}
.hidden { display: none; }

.status {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  min-height: 1.5rem;
}
.guess {
  font-size: 1.4rem;
  font-weight: 600;
  color: #38bdf8;
  min-height: 2rem;
  margin-top: 0.5rem;
}
.hint {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.75rem;
  text-align: center;
  line-height: 1.4;
}

.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.7rem;
  color: #475569;
} */


.chat-icon {
    position: fixed;
    z-index: 1000;
    
    /* --- Posición --- */
    bottom: 100px; 
    right: 80px;  

    /* --- Tamaño --- */
    width: 150px;  
    height: 150px; 

    /* --- Estilo --- */
    background-color: transparent; /* El color de fondo vendrá de ojos.png */
    border-radius: 0%; /* Esto lo hace ver redondo */
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0,0,0,.25); 
    display: flex; /* Para centrar el contenido (ojos y pupilas) */
    justify-content: center;
    align-items: center;
    /* transition: all 0.3s ease; */

    /* --- SOLUCIÓN: Esto hace que el "hitbox" sea redondo --- */
    /* clip-path: circle(50%); */
    overflow: hidden; /* Asegura que las pupilas no se salgan del contorno de la burbuja */
}


/* --- LÓGICA DE CAPAS --- */

/* Estilo base para todas las imágenes de fondo (Idle y Hover) */
.chat-icon .idle-frame,
.chat-icon .hover-state {
    position: absolute;
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    filter: none;
    z-index: 1; /* Detrás de las pupilas */
    
    /* Ocultas por defecto, transición suave */
    opacity: 0;
    transition: opacity 0.01s ease;
}

/* El JS usará esta clase para mostrar el frame de animación activo */
.chat-icon .idle-frame.active {
    opacity: 1;
}

/* El CSS usará esta clase para mostrar el fondo de hover */
.chat-icon:hover .hover-state {
    opacity: 1;
    z-index: 2; /* Se pone encima de la animación idle */
}

/* Al hacer hover, oculta la animación idle activa */
.chat-icon:hover .idle-frame.active {
    opacity: 0;
}


/* --- LÓGICA DE PUPILAS (para L y R) --- */

.chat-icon .L-pupil,
.chat-icon .R-pupil {
    position: absolute;
    width: 80%; /* Tu valor */
    height: 80%; /* Tu valor */
    object-fit: contain;
    transition: transform 0.05s linear; /* Transición suave del mouse */
    filter: none; 
    z-index: 3; /* Siempre encima de todo */
}

.chat-icon .L-pupil {
    top: 47%;
    left: 45%;
    transform: translate(-50%, -50%); 
}

.chat-icon .R-pupil {
    top: 47%;
    left: 40%;
    transform: translate(-50%, -50%); 
}


/* --- LÓGICA DE HOVER (Solo escala el contenedor) --- */

.chat-icon:hover {
    transform: scale(1.2) translateY(0px);
}

/* Ventana del Chat (Widget) */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    max-height: 600px;
    /* CAMBIO: Estilos de tu .card */
    background-color: var(--card);
    border: 1px solid #1b1e26;
    border-radius: 16px; 
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1001;
}
/* ... (existing .chat-widget.open and .chat-icon.hidden) ... */
.chat-widget.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
}

.chat-icon.hidden {
    opacity: 0;
    transform: scale(0.8);
    visibility: hidden;
}


/* Cabecera del Chat */
.chat-header {
    /* CAMBIO: Fondo más oscuro, como tu --bg */
    background-color: var(--bg);
    color: var(--ink);
    padding: 15px;
    font-weight: 600; /* Coincide con tu .btn */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1b1e26; /* Borde de tu .card */
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
/* ... (existing .minimize-button and :hover) ... */
.minimize-button {
    background: none;
    border: none;
    color: var(--muted); /* Color muteado para el botón */
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.minimize-button:hover {
    color: var(--ink);
}


/* Área de Mensajes */
.chat-messages {
    /* CAMBIO: Se eliminó 'flex-grow: 1' */
    padding: 15px;
    overflow-y: auto;
    height: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* CAMBIO: Fondo principal de tu página */
    background-color: var(--bg);
}

/* NUEVO: Fila de mensaje (para alinear) */
.message-row {
    display: flex;
    width: 100%;
}
.message-row.bot-row {
    justify-content: flex-start; /* Alinea bot a la izquierda */
    align-items: flex-end; /* Alinea avatar con la base de la burbuja */
    gap: 8px;
}
.message-row.user-row {
    justify-content: flex-end; /* Alinea usuario a la derecha */
}

/* MODIFICADO: Avatar */
.chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    /* Ajuste para alinear con la burbuja */
    margin-bottom: 4px; 
}

/* MODIFICADO: Burbuja de Mensaje */
.chat-message {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 85%; /* 85% del contenedor .message-row */
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message.bot {
    /* CAMBIO: Estilo de tu .msg.bot */
    background: #1a1d26;
    border: 1px solid #232735;
    color: var(--ink);
    border-bottom-left-radius: 4px; /* Pequeño detalle de "burbuja" */
}

/* NUEVO: Efecto de "escribiendo..." con cursor */
.chat-message.bot.typing {
    /* Asegura que la burbuja no se colapse */
    min-height: 1.5em; 
    /* Hace que la esquina sea simétrica mientras escribe */
    border-bottom-right-radius: 18px; 
    /* Animación del cursor */
    animation: typing-cursor 0.5s step-end infinite; /* <-- MÁS RÁPIDO (era 0.7s) */
    /* Color del cursor (basado en tu --pri) */
    border-right: 2px solid transparent; 
}

@keyframes typing-cursor {
    0%, 100% {
        border-right-color: var(--pri);
    }
    50% {
        border-right-color: transparent;
    }
}


.chat-message.user {
    /* CAMBIO: Estilo de tu .msg.user */
    background: #2a2e3a;
    color: var(--ink);
    border-bottom-right-radius: 4px;
}

/* Área de Opciones (Botones) */
.chat-options {
    padding: 15px;
    /* CAMBIO: Fondo de tarjeta y borde superior */
    background-color: var(--card);
    border-top: 1px solid #1b1e26;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* CAMBIO: Añadido min-height para evitar el salto */
    min-height: 60px; 
    /* Transición para suavizar la aparición de botones */
    transition: min-height 0.2s ease;
}
/* ... (existing .chat-options button and :hover) ... */
.chat-options button {
    width: 100%;
    padding: 10px 14px;
    /* CAMBIO: Estilo oscuro, similar a tus inputs o .btn.ghost */
    background: #1a1d26;
    border: 1px solid #232735;
    color: var(--muted);
    border-radius: 10px; /* Coincide con tu .btn */
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.chat-options button:hover {
    background: #2a2e3a; /* Un poco más claro al pasar el mouse */
    color: var(--ink);
}


/* Responsivo para móviles */
@media (max-width: 768px) {
    .chat-widget {
        width: 90%;
        max-height: 70vh;
        bottom: 20px;
        right: 20px;
    }
    .chat-icon {
        bottom: 20px;
        right: 20px;
    }
}
/* =================== CHATBOT STYLES END =================== */