* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

#container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
}

/* Phases - only one visible at a time */
#intro, #dialogue, #intervention, #return, #reflection {
    display: none;
}

#intro {
    display: block;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: normal;
    letter-spacing: 0.1em;
    color: #9ecfff;
}

#intro-text {
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

#intro-text p {
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

#intro-text p:nth-child(1) { animation-delay: 0.2s; }
#intro-text p:nth-child(2) { animation-delay: 0.8s; }
#intro-text p:nth-child(3) { animation-delay: 1.4s; }
#intro-text p:nth-child(4) { animation-delay: 2.0s; }

button {
    background: transparent;
    border: 1px solid #4a90a4;
    color: #9ecfff;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    animation-delay: 2.5s;
}

button:hover {
    background: rgba(74, 144, 164, 0.2);
    border-color: #9ecfff;
}

/* Dialogue phase */
#dialogue {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#visual-container {
    position: relative;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#attractor-canvas {
    width: 300px;
    height: 200px;
}

#attractor-label {
    position: absolute;
    bottom: 10px;
    font-size: 0.8rem;
    color: #6a9ab0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#conversation {
    background: rgba(20, 25, 35, 0.6);
    border: 1px solid rgba(74, 144, 164, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 350px;
    overflow-y: auto;
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    max-width: 85%;
    opacity: 0;
    animation: messageIn 0.5s ease forwards;
    line-height: 1.6;
}

.message.agent-a {
    background: rgba(74, 144, 164, 0.15);
    border-left: 2px solid #4a90a4;
    align-self: flex-start;
}

.message.agent-b {
    background: rgba(164, 114, 74, 0.15);
    border-right: 2px solid #a4724a;
    align-self: flex-end;
}

.message .speaker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.3rem;
    opacity: 0.6;
}

.message.agent-a .speaker { color: #4a90a4; }
.message.agent-b .speaker { color: #a4724a; }

#topic-indicator {
    text-align: center;
    font-size: 0.9rem;
    color: #6a9ab0;
}

#topic-indicator .label {
    opacity: 0.6;
}

#topic-text {
    color: #9ecfff;
    margin-left: 0.5rem;
    transition: all 0.3s ease;
}

#topic-text.shifting {
    color: #e0a060;
}

#topic-text.attractor {
    color: #f0c080;
    text-shadow: 0 0 10px rgba(240, 192, 128, 0.5);
}

/* Intervention phase */
#intervention {
    text-align: center;
}

#intervention-prompt {
    margin-bottom: 2rem;
    line-height: 1.8;
}

#intervention-prompt p {
    margin-bottom: 0.8rem;
}

#topic-choices {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.topic-choice {
    background: rgba(20, 25, 35, 0.6);
    border: 1px solid rgba(74, 144, 164, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
    color: #9ecfff;
}

.topic-choice:hover {
    background: rgba(74, 144, 164, 0.2);
    border-color: #9ecfff;
    transform: translateY(-2px);
}

/* Return phase */
#return {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#return-conversation {
    background: rgba(20, 25, 35, 0.6);
    border: 1px solid rgba(74, 144, 164, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

#return-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#return-visual {
    display: flex;
    justify-content: center;
}

#return-canvas {
    width: 300px;
    height: 150px;
}

#continue-btn {
    align-self: center;
    opacity: 0;
    animation: none;
}

#continue-btn.visible {
    animation: fadeIn 0.8s ease forwards;
}

/* Reflection phase */
#reflection {
    text-align: center;
}

#reflection-text {
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

#reflection-text p {
    margin-bottom: 1.2rem;
    opacity: 0;
}

#reflection-text p.emphasis {
    color: #f0c080;
    font-style: italic;
}

#reflection-text p.quote {
    color: #9ecfff;
    border-left: 2px solid #4a90a4;
    padding-left: 1rem;
    margin: 1.5rem auto;
    max-width: 450px;
    text-align: left;
}

#reflection-text p.stat {
    font-size: 1.3rem;
    color: #e0a060;
    margin: 1.5rem 0;
}

#restart-btn {
    opacity: 0;
    animation: none;
}

#restart-btn.visible {
    animation: fadeIn 0.8s ease forwards;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes messageIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.message.agent-b {
    animation-name: messageInRight;
}

@keyframes messageInRight {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 25, 35, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 164, 0.4);
    border-radius: 3px;
}

/* Mobile */
@media (max-width: 600px) {
    #container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .message {
        max-width: 95%;
    }

    #visual-container {
        height: 150px;
    }

    #attractor-canvas, #return-canvas {
        width: 250px;
        height: 150px;
    }
}
