@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500;600;700&family=Fredoka:wght@400;600&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', 'Fredoka', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #1e1e24; /* Fondo oscuro exterior de exhibición */
    padding: 10px;
}

/* Marco simulador de smartphone */
.phone-frame {
    width: 375px;
    height: 812px;
    background-color: #fff;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 12px #2d2d34;
    border-radius: 46px;
    overflow: hidden;
}

/* Pantallas genéricas */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 40px 24px;
    text-align: center;
}

/* --- Pantalla 1: Bienvenida --- */
.p1-bg {
    background: 
        radial-gradient(circle, rgba(255, 255, 255, 0.55) 12%, transparent 13%),
        radial-gradient(circle, rgba(254, 215, 226, 0.45) 12%, transparent 13%),
        linear-gradient(180deg, #fef4b8 0%, #fed7e2 50%, #fef3c7 100%);
    background-size: 26px 26px, 26px 26px, 100% 100%;
    background-position: 0 0, 13px 13px, 0 0;
    justify-content: space-around;
    position: relative;
    overflow: hidden;
}

/* Capa de Stickers y Objetos Tiernos Aesthetic */
.aesthetic-stickers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.sticker {
    position: absolute;
    user-select: none;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.12));
    display: inline-block;
}

.s-top-left-1 { top: 20px; left: 18px; font-size: 1.8rem; animation: sticker-float 3.8s ease-in-out infinite; }
.s-top-left-2 { top: 78px; left: 12px; font-size: 1.3rem; animation: sticker-twinkle 2.2s infinite ease-in-out; }
.s-top-center { top: 10px; left: 50%; transform: translateX(-50%); font-size: 1.9rem; animation: sticker-pulse 3s infinite; }
.s-top-right-1 { top: 22px; right: 20px; font-size: 1.8rem; animation: sticker-float 4.2s ease-in-out infinite 0.5s; }
.s-top-right-2 { top: 76px; right: 14px; font-size: 1.4rem; animation: sticker-twinkle 2.6s infinite ease-in-out 0.4s; }

.s-mid-left-1 { top: 32%; left: 10px; font-size: 1.9rem; animation: sticker-float 4.5s ease-in-out infinite 1s; }
.s-mid-left-2 { top: 44%; left: 22px; font-size: 1.5rem; animation: sticker-pulse 2.8s infinite 0.7s; }

.s-mid-right-1 { top: 33%; right: 12px; font-size: 1.8rem; animation: sticker-float 3.6s ease-in-out infinite 0.8s; }
.s-mid-right-2 { top: 43%; right: 20px; font-size: 1.6rem; animation: sticker-float 4s ease-in-out infinite 1.2s; }
.s-mid-right-3 { top: 52%; right: 10px; font-size: 1.3rem; animation: sticker-twinkle 2s infinite ease-in-out 1s; }

.s-bottom-left-1 { bottom: 105px; left: 18px; font-size: 1.7rem; animation: sticker-float 3.9s ease-in-out infinite 0.3s; }
.s-bottom-left-2 { bottom: 62px; left: 24px; font-size: 1.4rem; animation: sticker-twinkle 2.5s infinite ease-in-out 0.6s; }

.s-bottom-right-1 { bottom: 100px; right: 18px; font-size: 1.8rem; animation: sticker-float 4.1s ease-in-out infinite 0.6s; }
.s-bottom-right-2 { bottom: 58px; right: 24px; font-size: 1.5rem; animation: sticker-pulse 3.2s infinite 0.4s; }
.s-floating-star { top: 62%; left: 14px; font-size: 1.3rem; animation: sticker-twinkle 3s infinite ease-in-out 1.5s; }

/* Animaciones específicas de stickers */
@keyframes sticker-float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(6deg);
    }
}

@keyframes sticker-twinkle {
    0%, 100% {
        transform: scale(0.9) rotate(0deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.18) rotate(12deg);
        opacity: 1;
    }
}

@keyframes sticker-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.cute-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    color: #e11d48;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 8px;
    box-shadow: 0 3px 10px rgba(225, 29, 72, 0.12);
    border: 1.5px solid #ffffff;
    animation: gentle-bob 3s ease-in-out infinite alternate;
}

.hero-header-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 3;
}

.title {
    color: #ffffff;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.5px;
    text-shadow: 
        -2px -2px 0 #cf8d5e,  
         2px -2px 0 #cf8d5e,
        -2px  2px 0 #cf8d5e,
         2px  2px 0 #cf8d5e,
         3px  4px 0 #b37346;
    animation: title-pulse 4s ease-in-out infinite;
}

.character-display {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-hero-img {
    width: 220px;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: block;
    animation: float 3.5s ease-in-out infinite;
    filter: drop-shadow(0 8px 14px rgba(180, 140, 90, 0.2));
    transition: transform 0.3s ease;
}

.btn-pill {
    background: linear-gradient(180deg, #e3f2d3 0%, #d2e7be 100%);
    color: #556b3e;
    border: 3px solid #ffffff;
    border-radius: 35px;
    padding: 14px 45px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(85, 107, 62, 0.18);
    transition: all 0.2s ease;
    position: relative;
    z-index: 15;
}

.btn-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(85, 107, 62, 0.25);
}

.btn-pill:active {
    transform: scale(0.96);
}

/* --- Pantalla 2: Pregunta / Validación --- */
.p2-bg {
    background: linear-gradient(145deg, #fce1d9 0%, #e6f2cf 45%, #fef3b9 100%);
    justify-content: flex-start;
    padding-top: 50px;
    gap: 15px;
}

.swatches-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding-left: 10px;
}

.color-palette {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.color-box {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #ffffff;
}

.sub-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #cf8d5e;
    margin-top: 4px;
    margin-left: 4px;
}

.question-box {
    position: relative;
    width: 100%;
    margin-top: 10px;
}

.question-title {
    color: #5d483a;
    font-size: 2.3rem;
    line-height: 1.1;
    font-weight: 700;
}

.doodle {
    position: absolute;
    font-size: 1.5rem;
    animation: gentle-bob 2.5s ease-in-out infinite alternate;
}

.rainbow-left {
    top: -15px;
    right: 15px;
    animation-delay: 0.2s;
}

.palm-right {
    bottom: -10px;
    right: 25px;
    animation-delay: 0.7s;
}

.character-preview {
    margin: 15px 0;
}

.character-img {
    width: 140px;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: block;
    animation: float 3s ease-in-out infinite 0.4s;
    filter: drop-shadow(0 6px 12px rgba(180, 140, 90, 0.18));
}

.input-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.input-field {
    width: 90%;
    padding: 14px 20px;
    border: 2px solid #ffffff;
    border-radius: 25px;
    font-size: 1.05rem;
    text-align: center;
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    color: #5d483a;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.input-field:focus {
    border-color: #86efac;
    background: #ffffff;
}

.error-hidden {
    display: none;
    color: #dc2626;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 14px;
    border-radius: 12px;
}

/* --- Pantalla 3: Chat --- */
#pantalla-3 {
    background-color: #fef4b8;
}

.chat-header {
    background-color: #fef4b8;
    padding: 42px 20px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px dashed #eedc94;
}

.avatar-wrapper {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: none;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.25s ease;
}

.avatar-wrapper:hover {
    transform: scale(1.12);
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    background: transparent;
    filter: drop-shadow(0 3px 6px rgba(180, 140, 90, 0.25));
}

.header-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #634b35;
    letter-spacing: 0.5px;
}

.header-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: #65a30d;
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.header-action-btn:hover {
    transform: scale(1.12) rotate(15deg);
    background: #ffffff;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.chat-row.user-row {
    justify-content: flex-end;
}

.msg-bubble-container {
    max-width: 78%;
    display: flex;
    flex-direction: column;
}

.author-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #8c735e;
    margin-bottom: 4px;
    margin-left: 8px;
}

.msg-bubble {
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 600;
    color: #544336;
    word-break: break-word;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.04);
}

.msg-ai {
    background-color: #fcd9d9;
    border-bottom-left-radius: 6px;
}

.msg-user {
    background-color: #d1e8c5;
    border-bottom-right-radius: 6px;
    color: #405831;
}

.mini-avatar {
    width: 34px;
    height: 34px;
    border-radius: 0;
    border: none;
    object-fit: contain;
    background: transparent;
    box-shadow: none;
    margin-top: 6px;
    filter: drop-shadow(0 2px 4px rgba(180, 140, 90, 0.25));
    animation: gentle-bob 3s ease-in-out infinite alternate;
}

/* Área de Input */
.chat-input-area {
    padding: 14px 16px 26px;
    background-color: #fef4b8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 26px;
    background-color: #ffffff;
    outline: none;
    font-size: 1rem;
    font-weight: 600;
    color: #544336;
    box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}

.send-btn {
    background: linear-gradient(180deg, #fad67a 0%, #f5c44f 100%);
    color: #ffffff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(245, 196, 79, 0.4);
    transition: all 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* --- Animaciones Generales --- */
@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(1.2deg);
    }
    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes title-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

@keyframes gentle-bob {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Modal de Personalización con Código Especial --- */
.modal-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 35, 25, 0.45);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

.modal-card {
    background: #ffffff;
    border-radius: 28px;
    padding: 24px 20px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-title {
    color: #5d483a;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-hint {
    color: #8c735e;
    font-size: 0.85rem;
    line-height: 1.35;
}

.modal-input {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid #fed7aa;
    border-radius: 20px;
    font-size: 0.95rem;
    outline: none;
    text-align: center;
    font-weight: 600;
    color: #5d483a;
}

.modal-input:focus {
    border-color: #f97316;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
}

.btn-modal-ok {
    background: linear-gradient(180deg, #86efac 0%, #4ade80 100%);
    color: #166534;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(74, 222, 128, 0.3);
    transition: transform 0.15s;
}

.btn-modal-close {
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    border-radius: 20px;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-modal-ok:hover, .btn-modal-close:hover {
    transform: scale(1.05);
}

.modal-feedback {
    font-size: 0.82rem;
    font-weight: 700;
    min-height: 18px;
    display: block;
}
