.chat-window {
    max-width: 600px !important;
    margin: 10px auto;
}

.chat-window .window-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#chatbox {
    font-family: "Pixelated MS Sans Serif", monospace;
    font-size: 12px;
    height: 380px;
    overflow-y: auto;
    padding: 8px;
    background: #000;
    color: #d5d5d5;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

#chatbox .empty-state {
    color: #555;
    text-align: center;
    padding-top: 160px;
    font-style: italic;
}

.message {
    max-width: 80%;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 0;
}

.message-self {
    align-self: flex-end;
    text-align: right;
    border-right: 2px solid rgba(0, 255, 0, 0.3);
    margin-left: auto;
}

.message-other {
    align-self: flex-start;
    text-align: left;
    border-left: 2px solid rgba(255, 255, 255, 0.12);
    margin-right: auto;
}

.message-user {
    font-weight: 700;
}

.message-body {
    color: #d5d5d5;
    word-break: break-word;
}

.message-time {
    font-size: 10px;
    color: #666;
    margin-top: 2px;
}

.message-admin .message-body {
    color: #e8d44d;
}

.delete-btn {
    display: none;
    float: right;
    color: #cc0000;
    cursor: pointer;
    font-size: 10px;
    padding: 0 4px;
    margin-left: 6px;
    background: none;
    border: none;
    min-width: auto;
    min-height: auto;
    box-shadow: none;
}

.delete-btn:hover {
    color: #ff0000;
    background: rgba(255, 0, 0, 0.15);
}

.delete-btn.show {
    display: inline;
}

.admin-gear {
    cursor: pointer;
    text-align: center;
    color: #999;
    user-select: none;
    min-width: 24px !important;
    flex-grow: 0 !important;
}

.admin-gear:hover {
    color: #ccc;
}

.admin-gear.unlocked {
    color: #ffcc00;
}

#adminPanel {
    margin-top: 4px;
}

#adminUnlock {
    min-width: 64px;
}

#clearAll {
    margin-top: 6px;
    min-width: auto;
    padding: 4px 10px;
    font-size: 11px;
}

#messageInput {
    flex: 1;
}

#sendBtn {
    min-width: 56px;
}

@media (max-width: 650px) {
    .chat-window {
        max-width: 100% !important;
        margin: 0;
    }

    #chatbox {
        height: 300px;
        font-size: 13px;
    }

    #messageInput {
        font-size: 16px;
    }

    .delete-btn.show {
        font-size: 14px;
        padding: 2px 8px;
    }
}

body.embedded {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #ece9d8;
    overflow: hidden;
    color: #000;
    font-family: "Pixelated MS Sans Serif", sans-serif;
}

body.embedded .chat-window {
    box-shadow: none;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    max-width: 100% !important;
    height: 100%;
    color: #000;
}

body.embedded .chat-window .title-bar {
    display: none;
}

body.embedded .chat-window .window-body {
    margin: 6px;
    height: calc(100% - 12px);
    box-sizing: border-box;
    background: #ece9d8;
    color: #000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.embedded label {
    color: #000;
    font-weight: bold;
}

body.embedded input[type="text"],
body.embedded input[type="password"] {
    background-color: #fff;
    color: #000;
}

body.embedded button {
    min-width: auto;
}

body.embedded .status-bar-field {
    font-size: 11px;
}

body.embedded #chatbox {
    flex: none;
    height: 220px;
    overflow-y: auto;
    background: #fff;
    color: #000;
    font-family: "Pixelated MS Sans Serif", sans-serif;
    border: none;
}

body.embedded .message-body {
    color: #000;
}

body.embedded .message-time {
    color: #777;
}

body.embedded .message-admin .message-body {
    color: #0055aa;
}

body.embedded .message-self {
    border-right: 2px solid #c8e6c9;
}

body.embedded .message-other {
    border-left: 2px solid #e0e0e0;
}
