: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: 600px;
    /* Limit width since it's just the form now */
    height: 90vh;
    align-items: center;
    justify-content: center;
    /* Center the single form item */
    margin: 0 auto;
}

/* Character Section (Deprecated/Removed from HTML flow, styles repurposed) */
.character-section {
    display: none;
}

/* Chat Layout Wrapper */
.chat-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    /* Align to top */
    gap: 15px;
    margin-bottom: 20px;
    flex: 1;
    overflow: hidden;
    /* Prevent overflow */
}

.character-container {
    width: 60px;
    /* Small icon size */
    height: 60px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    /* Subtle glowing backdrop */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.character-img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    border-radius: 50%;
    /* Circle avatar */
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
    transform-origin: center;
}

.floating-anim {
    animation: none;
    /* Disable float for avatar style */
}

/* Conversation Flow */
.conversation-flow {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
}

/* 3D Bubble Style for Current Step */
.current-step {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px 20px 20px 20px;
    /* Top-left sharp for tail effect */
    padding: 20px;
    position: relative;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    /* 3D layer */
    backdrop-filter: blur(10px);
    margin-top: 10px;
    /* Ensure space for tail visibility if needed */
}

/* Typing Effect in Bubble */
.current-step h2 {
    font-size: 1.2rem;
    /* Smaller text for bubble */
    font-weight: 400;
    line-height: 1.5;
    background: none;
    -webkit-text-fill-color: var(--text-main);
    color: var(--text-main);
    animation: none;
    /* remove slide up */
}

@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;
    z-index: 20;
    /* Ensure it stays above character section */
}

.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 */
    position: relative;
    z-index: 30;
}

.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 */
}

/* Mobile Optimization */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        height: 100dvh;
        /* Dynamic viewport height */
        overflow: hidden;
        /* Prevent body scroll, handle in chat */
    }

    .background-globes {
        opacity: 0.4;
        /* Dim background slightly */
    }

    .main-container {
        width: 100%;
        height: 100dvh;
        max-width: none;
        margin: 0;
        border-radius: 0;
    }

    .form-interface {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        /* Full screen */
        border: none;
        padding: 20px;
        justify-content: flex-start;
        /* Stack from top */
    }

    .form-header {
        margin-bottom: 15px;
    }

    /* Adjust Chat Layout for Mobile */
    .chat-layout {
        flex: 0 1 auto;
        /* Don't force grow, just fit content */
        gap: 10px;
        margin-bottom: 0px;
        min-height: 0;
        overflow-y: auto;
    }

    .character-container {
        width: 45px;
        height: 45px;
        border-width: 1px;
    }

    .conversation-flow {
        padding-right: 0;
        gap: 15px;
    }

    .current-step {
        padding: 15px;
        border-radius: 4px 15px 15px 15px;
    }

    .current-step h2 {
        font-size: 1.1rem;
    }

    /* Input Area Optimization */
    .input-area {
        padding-bottom: 15px;
        margin-top: 15px;
        flex-shrink: 0;
    }

    #user-input {
        font-size: 1rem;
    }

    .nav-actions {
        margin-top: 10px;
    }

    .nav-btn,
    #send-btn {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .brand-footer {
        margin-top: auto;
        /* Push to bottom */
        margin-bottom: 0;
        padding-bottom: 5px;
    }
}

/* Brand Footer */
.brand-footer {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: -10px;
    /* Pull it up a bit */
}

.brand-link {
    font-size: 0.75rem;
    /* Small text */
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.5;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.brand-link:hover {
    opacity: 1;
    color: var(--text-main);
    letter-spacing: 2px;
    /* Subtle expansion hover effect */
}

/* Loading Dots Animation */
.loading-dots::after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60% {
        content: '...';
    }

    80%,
    100% {
        content: '';
    }
}