body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e; /* Dark blueish background */
    color: #e0e0e0; /* Light grey text */
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top for scrolling */
    min-height: 100vh;
    line-height: 1.6;
}

#app-container {
    background-color: #162447; /* Slightly lighter dark blue */
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 600px;
    margin: 20px;
    box-sizing: border-box;
}

header, footer {
    text-align: center;
    margin-bottom: 20px;
    color: #1f4068; /* A contrasting blue */
}
header h1 {
    color: #e43f5a; /* A vibrant accent color */
    margin-bottom: 5px;
}

footer {
    margin-top: 30px;
    font-size: 0.9em;
    color: #888;
}


#character-selection-section h2, #dream-interface-section h2 {
    color: #e43f5a; /* Accent color for headings */
    text-align: center;
    margin-bottom: 15px;
}

#character-selection-section p {
    text-align: center;
    margin-bottom: 15px;
}

input[type="text"] {
    width: calc(100% - 22px); /* Full width minus padding and border */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #30475e; /* Darker border */
    border-radius: 5px;
    background-color: #1b1b3a; /* Dark input background */
    color: #e0e0e0;
    box-sizing: border-box;
}

input[type="text"]::placeholder {
    color: #888;
}

button {
    background-color: #e43f5a; /* Accent color */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    margin-right: 5px; /* Spacing for multiple buttons */
}

button:hover {
    background-color: #c93049; /* Darker shade on hover */
}

#startDreamButton {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}

#newDreamButton {
    width: 100%; /* Make it prominent when visible */
    background-color: #28a745; /* A different color, e.g., green for new start */
}

#newDreamButton:hover {
    background-color: #218838; /* Darker green on hover */
}

#dreamLogContainer {
    height: 300px; /* Fixed height, scrollable */
    overflow-y: auto;
    border: 1px solid #30475e;
    padding: 10px;
    margin-bottom: 15px;
    background-color: #101020; /* Even darker for the log */
    border-radius: 5px;
}

.message {
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 15px;
    max-width: 85%;
    word-wrap: break-word;
}

.user-message {
    background-color: #1f4068; /* User prompt blue */
    color: #e0e0e0;
    margin-left: auto;
    border-bottom-right-radius: 3px;
    text-align: right;
}

.dream-message { 
    background-color: #3d2c5a; /* Narration purple */
    color: #f0f0f0;
    margin-right: auto;
    border-bottom-left-radius: 3px;
}

.character-reflection-message {
    background-color: #5a3d2c; /* Character reflection, brownish */
    color: #f5f5f5;
    margin-right: auto;
    border-bottom-left-radius: 3px;
    font-style: italic;
    border: 1px dashed #e43f5a;
}

.system-notification {
    text-align: center;
    font-style: italic;
    color: #aaa;
    font-size: 0.9em;
    margin-bottom: 10px;
}

#dreamControls {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    gap: 10px; /* Space between input and buttons */
}

#dreamControls input[type="text"] {
    flex-grow: 1; /* Input takes available space */
    margin-bottom: 0; /* Remove default margin */
}

#dreamControls button {
    flex-shrink: 0; /* Prevent buttons from shrinking too much */
}

.hidden {
    display: none !important;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    #app-container {
        margin: 10px;
        padding: 15px;
    }

    #dreamControls {
        flex-direction: column;
    }

    #dreamControls input[type="text"],
    #dreamControls button {
        width: 100%;
        margin-bottom: 10px; /* Add margin back for stacked items */
    }
    #dreamControls button:last-child {
        margin-bottom: 0;
    }
}