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

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --bg-light: #f7f8fc;
    --bg-white: #ffffff;
    --text-dark: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --message-other: #ffffff;
    --message-own: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success: #48bb78;
    --warning: #ed8936;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
}

.screen {
    display: none;
}

.screen.active {
    display: flex;
}

#pseudo-screen {
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.pseudo-container {
    background: var(--bg-white);
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 420px;
    width: 100%;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    margin: 0 auto 1.5rem;
    width: 60px;
    height: 60px;
}

.pseudo-container h1 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 700;
}

.pseudo-container p {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

#pseudo-form input {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
    outline: none;
}

#pseudo-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#pseudo-form button {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#pseudo-form button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#pseudo-form button:active {
    transform: translateY(0);
}

#chat-screen {
    min-height: 100vh;
    padding: 20px;
    justify-content: center;
    align-items: center;
}

.chat-container {
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 1200px;
    width: 100%;
    height: 90vh;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 250px 1fr;
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

.chat-header {
    grid-column: 1 / -1;
    background: var(--bg-white);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-small {
    width: 32px;
    height: 32px;
}

.header-info h2 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.user-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

.current-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.chat-sidebar {
    background: var(--bg-light);
    padding: 1.5rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.chat-sidebar h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-item {
    padding: 0.625rem 0.875rem;
    background: var(--bg-white);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-item::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #cbd5e0;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    align-self: flex-end;
}

.message.other {
    align-self: flex-start;
}

.message-author {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding: 0 0.75rem;
}

.message.own .message-author {
    color: var(--primary);
    text-align: right;
}

.message.other .message-author {
    color: var(--text-light);
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.own .message-bubble {
    background: var(--message-own);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.other .message-bubble {
    background: var(--message-other);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    padding: 0 0.75rem;
}

.message.own .message-time {
    text-align: right;
}

.system-message {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: var(--bg-light);
    border-radius: 12px;
    animation: fadeIn 0.3s ease-out;
}

.system-message.join {
    color: var(--success);
}

.system-message.leave {
    color: var(--warning);
}

.typing-indicator {
    padding: 0 1.5rem 0.5rem;
    min-height: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

.message-form {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    background: var(--bg-white);
}

.message-form input {
    flex: 1;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.message-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.send-btn:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
        height: 100vh;
        border-radius: 0;
    }

    .chat-sidebar {
        display: none;
    }

    .message {
        max-width: 85%;
    }

    #chat-screen {
        padding: 0;
    }

    .pseudo-container {
        padding: 2rem 1.5rem;
    }
}
