* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    font-family: Arial, Helvetica, sans-serif;
    color: #f1f5f9;
    background: #0f172a;
}

body {
    min-height: 100vh;
    background: #0f172a;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top, #1e3a5f, #0f172a 55%);
}

.login-card {
    width: min(420px, 100%);
    padding: 36px;
    border: 1px solid #334155;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 18px;
    background: #2563eb;
    font-size: 30px;
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
}

.subtitle {
    margin: 8px 0 30px;
    color: #94a3b8;
    text-align: center;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#login-form label {
    margin-top: 8px;
    color: #cbd5e1;
    font-size: 14px;
}

input {
    width: 100%;
    border: 1px solid #334155;
    border-radius: 10px;
    outline: none;
    padding: 13px 14px;
    color: #f8fafc;
    background: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#login-form button {
    margin-top: 15px;
    border: 0;
    border-radius: 10px;
    padding: 13px;
    color: white;
    background: #2563eb;
    font-weight: bold;
    transition: background 0.2s;
}

#login-form button:hover {
    background: #1d4ed8;
}

.error {
    min-height: 20px;
    margin-top: 12px;
    color: #f87171;
    text-align: center;
    font-size: 14px;
}

#chat-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 12px 20px;
    border-bottom: 1px solid #334155;
    background: #111827;
}

.chat-header h1 {
    font-size: 19px;
}

#current-user {
    display: block;
    margin-top: 3px;
    color: #60a5fa;
    font-size: 13px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-actions button {
    width: 42px;
    height: 42px;
    border: 1px solid #334155;
    border-radius: 10px;
    color: #e2e8f0;
    background: #1e293b;
}

.header-actions button:hover {
    background: #334155;
}

.header-actions .danger-button:hover {
    border-color: #ef4444;
    color: #fca5a5;
}

.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 25px;
}

.message {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 10px;
    margin-bottom: 8px;
}

.message strong {
    white-space: nowrap;
}

.message span {
    min-width: 0;
    color: #f1f5f9;
    overflow-wrap: anywhere;
}

.message small {
    white-space: nowrap;
    color: #64748b;
    font-size: 12px;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
}

.empty-chat div {
    margin-bottom: 12px;
    font-size: 42px;
}

.empty-chat h2 {
    margin-bottom: 6px;
    color: #e2e8f0;
}

.message-form {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 0 0;
    border-top: 1px solid #334155;
    background: #111827;
}

#message-input {
    flex: 1;
}

.message-form button {
    width: 48px;
    border: 0;
    border-radius: 10px;
    color: white;
    background: #2563eb;
    font-size: 20px;
}

.message-form button:hover {
    background: #1d4ed8;
}

@media (max-width: 600px) {
    .login-card {
        padding: 28px 22px;
    }

    .chat-header {
        padding: 10px 14px;
    }

    .messages {
        padding: 15px;
    }

    .message-form {
        gap: 8px;
        margin-top: 15px;
    }

    .message small {
        font-size: 11px;
    }

    .message {
        column-gap: 7px;
    }
}