:root {
    --bg-dark: #0f172a;
    --primary: #8b5cf6;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* reused background animations */
.background-globes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: floatGlobe 20s infinite alternate ease-in-out;
}

.globe-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -10%;
    left: -10%;
}

.globe-2 {
    width: 400px;
    height: 400px;
    background: var(--secondary);
    bottom: -10%;
    right: -5%;
    animation-delay: -5s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 40%;
    left: 40%;
    opacity: 0.4;
    animation-delay: -10s;
}

@keyframes floatGlobe {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

.main-container {
    display: flex;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    gap: 40px;
    align-items: center;
    justify-content: space-between;
}

/* Character Section (Reused) */
.character-section {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
}

.character-container {
    width: 100%;
    max-width: 500px;
    height: 90%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.character-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    transform-origin: bottom center;
    /* Pivot from feet/base */
}

.floating-anim {
    animation: breathing 4s ease-in-out infinite;
}

@keyframes breathing {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Character Behavior Animation */
.animated-behavior {
    animation: lookAround 12s ease-in-out infinite;
}

@keyframes lookAround {

    0%,
    100% {
        transform: rotateY(0deg) scale(1);
        /* Front Smile */
    }

    20% {
        transform: rotateY(0deg) scale(1.03);
        /* Subtle bounce/smile emphasis */
    }

    35% {
        transform: rotateY(-12deg) scale(1);
        /* Look Left */
    }

    50% {
        transform: rotateY(0deg) scale(1);
        /* Center */
    }

    65% {
        transform: rotateY(12deg) scale(1);
        /* Look Right */
    }

    80% {
        transform: rotateY(0deg) scale(1.03);
        /* Front Smile Emphasis */
    }
}

/* Form Interface */
.form-interface {
    flex: 1;
    max-width: 600px;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 40px;
    position: relative;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.form-header h1 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.settings-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    /* For anchor tags */
}

.settings-btn:hover {
    color: var(--text-main);
}

/* Conversation Flow */
.conversation-flow {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    gap: 20px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 10px;
}

/* History Items */
.history-item {
    opacity: 0.5;
    transition: opacity 0.5s;
    border-left: 2px solid var(--primary);
    padding-left: 15px;
    margin-bottom: 10px;
}

.history-q {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.history-a {
    display: block;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* Current Question */
.current-step h2 {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1.3;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Typewriter Effect */
.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    margin: 0;
    width: 0;
    animation: typing 2s steps(11, end) forwards;
    /* 11 chars in "I'm Cherry." */
    -webkit-text-fill-color: var(--text-main);
    /* Override gradient for typing text if needed, or keep gradient */
}

@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 11ch
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Area */
.input-area {
    margin-top: auto;
    padding-bottom: 50px;
    /* Lift up further */
    /* Add padding to lift it up visually */
}

.input-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
    transition: border-color 0.3s;
}

.nav-actions {
    display: flex;
    justify-content: center;
    /* Align buttons to the center */
    gap: 15px;
    /* Space between buttons */
    margin-top: 15px;
    /* Space from the input line */
}

.input-wrapper:focus-within {
    border-bottom-color: var(--primary);
}

#user-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 1.5rem;
    color: white;
    font-family: inherit;
    font-weight: 300;
}

#user-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.nav-btn,
#send-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-btn:hover,
#send-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.nav-btn.hidden {
    display: none;
    /* Properly hide it */
}

#back-btn:hover {
    transform: translateX(-5px);
}



/* Mobile */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        /* Allow scrolling/layout from top */
    }

    .main-container {
        flex-direction: column;
        width: 100%;
        height: 100dvh;
        /* Use dynamic viewport height for mobile */
        max-height: none;
        gap: 0;
        padding: 0;
    }

    .character-section {
        display: flex !important;
        /* Force show */
        height: 35vh;
        min-height: 200px;
        align-items: flex-end;
        justify-content: center;
        padding-bottom: 0;
        z-index: 1;
        /* Bring it up slightly */
        position: relative;
    }

    .character-container {
        width: 100%;
        max-width: 300px;
        /* Allow slightly wider */
        height: 100%;
        /* Fill the section height */
        display: flex;
        justify-content: center;
        align-items: flex-end;
    }

    .character-img {
        width: auto;
        height: 100%;
        /* Ensure it fits vertically without cropping */
        max-width: 100%;
        object-fit: contain;
        transform-origin: bottom center;
    }

    .form-interface {
        width: 100%;
        max-width: none;
        flex: 1;
        /* Take remaining height */
        height: auto;
        border-radius: 30px 30px 0 0;
        /* Sheet styling */
        border: 1px solid var(--glass-border);
        border-bottom: none;
        padding: 20px;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(20px);
        z-index: 10;
        /* Sit on top of character */
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
        /* Slightly darker/more opaque on mobile */
    }

    .current-step h2 {
        font-size: 1.5rem;
        /* Readable prompt size */
    }

    #user-input {
        font-size: 1.2rem;
        /* Prevent auto-zoom on iOS (needs >= 16px, this is safe) */
    }

    .form-header {
        margin-top: 10px;
    }

    .input-wrapper {
        gap: 10px;
    }

    /* Ensure buttons are touch-friendly */
    .nav-btn,
    #send-btn,
    .settings-btn {
        padding: 10px;
    }
}