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

body {
    font-family: Arial, sans-serif;
    background: #f2f5f9;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat {
    width: 650px;
    height: 750px;
    max-width: 95vw;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    padding: 18px 20px;
    background: #3f6ff5;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 22px;
}

#connection-status {
    font-size: 13px;
}

/* Messages */
#messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.message {
    background: #f1f4f9;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.message strong {
    display: block;
    margin-bottom: 5px;
}

.message p {
    margin-top: 5px;
    color: #333;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Reply reference */
.reply-reference {
    background: #dfe7f7;
    border-left: 4px solid #3f6ff5;
    padding: 7px 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #555;
}

/* Reactions */
.reactions {
    display: flex;
    gap: 7px;
    margin-top: 10px;
}

.reactions button {
    border: none;
    background: white;
    border: 1px solid #ddd;
    padding: 6px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: 0.2s;
}

.reactions button:hover {
    background: #eaf0ff;
    border-color: #3f6ff5;
}

/* Reply preview */
.reply-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #e9efff;
    border-top: 1px solid #d5def5;
    font-size: 13px;
    color: #444;
}

.reply-preview button {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
}

.hidden {
    display: none;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid #ddd;
    background: #fafafa;
}

.toolbar button {
    width: 34px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

.toolbar button:hover {
    background: #eaf0ff;
}

.toolbar button.active {
    background: #3f6ff5;
    color: white;
    border-color: #3f6ff5;
}

.toolbar label {
    font-size: 18px;
    cursor: pointer;
}

#colour {
    width: 34px;
    height: 30px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

#schedule {
    padding: 7px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
}

/* Form */
#message-form {
    display: flex;
    gap: 8px;
    padding: 15px;
    border-top: 1px solid #ddd;
}

#message-form input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

#message-form input:focus {
    border-color: #3f6ff5;
}

#username {
    width: 120px;
}

#message-input {
    flex: 1;
}

#message-form button {
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    background: #3f6ff5;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

#message-form button:hover {
    background: #315bd0;
}

/* Mobile */
@media (max-width: 600px) {
    .chat {
        width: 100%;
        height: 100vh;
        max-width: none;
        border-radius: 0;
    }

    #message-form {
        flex-wrap: wrap;
    }

    #username {
        width: 100%;
    }

    #message-input {
        min-width: 0;
    }

    .toolbar {
        flex-wrap: wrap;
    }
}