html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    background-color: #f4f4f4;
}

#chatbox {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #ffffff;
}

.bubble {
    margin: 10px;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 70%;
    clear: both;
    word-wrap: break-word;
    line-height: 1.4em;
}

.left {
    background: #e9ecef;
    float: left;
}

.right {
    background: #cce5ff;
    float: right;
}

#inputArea {
    display: flex;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
}

#messageInput {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

#sendBtn {
    margin-left: 10px;
    padding: 10px 20px;
    font-size: 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#sendBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#statusMsg {
    color: red;
    font-size: 14px;
    margin-top: 5px;
}

.typing {
    background: #e9ecef;
    float: left;
    font-style: italic;
    color: #666;
}

.typing::after {
    content: '...';
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

#characterSelectArea {
    margin-bottom: 15px;
}
#characterSelect {
    padding: 4px 8px;
    font-size: 1em;
}