* {
    font-family: Georgia, 'Times New Roman', serif;
    box-sizing: border-box;
}

body {
    padding-top: 50px;
    background: #e8e8e8;
    margin: 0;
}

/* ---- Chat wrapper ---- */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    position: relative;
}

/* ---- Username overlay ---- */
.username-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 17, 25, 0.85);
    border-radius: 6px;
    max-width: 700px;
    margin: 20px auto;
    min-height: 660px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.username-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.username-form {
    text-align: center;
    color: #fff;
    padding: 32px;
}

.username-form h2 {
    margin: 0 0 4px;
    font-size: 26px;
    color: #fff;
}

.form-subtitle {
    color: #999;
    margin: 0 0 20px;
    font-size: 14px;
}

.username-input {
    display: block;
    width: 260px;
    margin: 0 auto 14px;
    padding: 10px 14px;
    font-size: 16px;
    font-family: Georgia, serif;
    border: 2px solid #555;
    border-radius: 4px;
    background: #2a2a2e;
    color: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}

.username-input:focus {
    border-color: #0069d9;
}

.username-input::placeholder {
    color: #777;
}

/* ---- Chat container ---- */
.webchatcontainer {
    display: flex;
    flex-direction: column;
    border: 2px solid #b8b8b8;
    box-shadow: 0 0 10px 8px rgba(11, 11, 11, 0.69);
    background-color: rgba(20, 17, 25, 0.9);
    width: 100%;
    max-width: 700px;
    padding: 12px;
    border-radius: 6px 6px 0 0;
    min-height: 600px;
    max-height: 600px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 0 4px;
}

.chat-header h1 {
    color: #fff;
    margin: 0;
    font-size: 24px;
}

.channel-label {
    color: #888;
    font-size: 14px;
    font-style: italic;
}

/* ---- Chat log ---- */
#log {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

#chat-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

#chat-list > li {
    padding: 6px 10px;
    font-size: 15px;
    word-wrap: break-word;
    color: #ddd;
    background: #242424;
    line-height: 1.5;
}

#chat-list > li:nth-child(odd) {
    background: #2c2c2c;
}

/* ---- Message parts ---- */
.timestamp {
    color: #666;
    font-size: 12px;
    margin-right: 4px;
    font-family: 'Courier New', monospace;
}

.domain {
    color: #7eb8da;
    font-weight: bold;
    font-size: 14px;
}

.nick {
    color: #c5c5c5;
    font-weight: bold;
}

.text {
    color: #e0e0e0;
}

/* Self messages - subtle highlight */
.self-msg {
    border-left: 3px solid #0069d9;
}

.self-msg .nick {
    color: #8ab4f8;
}

/* System messages */
.system-msg {
    background: transparent !important;
    padding: 3px 10px !important;
}

.system-text {
    color: #777;
    font-style: italic;
    font-size: 13px;
}

/* ---- Chatbox input ---- */
.chatbox-wrapper {
    display: flex;
    width: 100%;
    max-width: 700px;
    border: 2px solid #b8b8b8;
    border-top: 1px solid #444;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(11, 11, 11, 0.5);
}

.chatbox {
    flex: 1;
    padding: 12px 14px;
    font-size: 15px;
    font-family: Georgia, serif;
    border: none;
    outline: none;
    background: #333;
    color: #fff;
    min-height: 46px;
}

.chatbox::placeholder {
    color: #777;
}

.chatbox:focus {
    background: #3a3a3e;
}

.send-btn {
    padding: 12px 20px;
    background: #0069d9;
    color: #fff;
    border: none;
    font-family: Georgia, serif;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}

.send-btn:hover {
    background: #0053aa;
}

.send-btn:disabled {
    background: #555;
    cursor: default;
}

/* ---- Divider ---- */
.divider {
    border-radius: 1px;
    border: 1px solid #444;
    margin: 8px 0;
}

/* ---- Footer ---- */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 13px;
}

footer a {
    color: #0069d9;
}