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

.bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.7);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
}

.container {
    background: white;
    opacity: 0.5;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    width: 95vw;
    height: 90vh;
    max-width: none;
    max-height: none;
    margin: 0 auto;
    box-sizing: border-box;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 0.5s ease-out;
    position: relative;
}

.container:hover {
    opacity: 0.75;
    transform: translateY(-3px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.login-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 40px;
}

.login-screen.hidden {
    display: none;
}

.login-title {
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

.login-form {
    width: 100%;
    max-width: 400px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.join-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.join-btn:hover {
    transform: translateY(-2px);
}

.join-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-screen {
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-screen.active {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.chat-title {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.online-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.connection-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
}

.connection-status.connected {
    background: rgba(76, 175, 80, 0.8);
}

.connection-status.disconnected {
    background: rgba(244, 67, 54, 0.8);
}

.disconnect-btn {
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.disconnect-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: scale(1.05);
}

.toggle-userlist-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-userlist-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.message {
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

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

.message.system {
    text-align: center;
    color: #999;
    font-size: 14px;
    font-style: italic;
}

.message.user .message-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.message-nickname {
    font-weight: 600;
    color: #667eea;
    margin-right: 10px;
}

.message-time {
    color: #999;
    font-size: 12px;
}

.message-content {
    background: white;
    padding: 12px 15px;
    border-radius: 10px;
    display: inline-block;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    border-radius: 0 0 10px 10px;
}

.message-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.message-input:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== 用户列表面板 ========== */
.user-list-panel {
    position: absolute;
    top: 125px;
    right: 20px;
    width: 320px;
    max-height: 70vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(350px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.user-list-panel.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.user-list-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-list-content {
    max-height: calc(70vh - 60px);
    overflow-y: auto;
    padding: 15px;
}

.user-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}

.user-item:hover {
    background: #e9ecef;
    transform: translateX(-3px);
    box-shadow: 3px 0 10px rgba(102, 126, 234, 0.2);
}

.user-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.user-nickname {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.user-id {
    font-size: 12px;
    color: #999;
    background: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}

.user-info {
    font-size: 13px;
    color: #666;
}

.user-ip, .user-time {
    margin-top: 4px;
}

.no-users {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

.messages-container::-webkit-scrollbar,
.user-list-content::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track,
.user-list-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb,
.user-list-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.user-list-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

@media (max-width: 768px) {
    .user-list-panel {
        width: 280px;
        right: 10px;
    }
    
    .header-right {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .chat-header {
        padding: 15px;
    }
}