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

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;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 450px;
    width: 100%;
    height: 90vh;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

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

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.online-count {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 100px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.status-badge {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-badge.open {
    background: #10b981;
    color: white;
}

.status-badge.closed {
    background: #ef4444;
    color: white;
}

/* 倒计时条 */
.countdown-bar {
    background: #ffffff;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.countdown-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.countdown-label {
    color: #64748b;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.countdown-time {
    font-family: 'Inter', 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 100px;
    letter-spacing: 0.02em;
}

.countdown-progress {
    height: 4px;
    background: #f1f5f9;
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 100px;
    transition: width 0.3s ease;
}

/* 用户名输入部分 */
.username-section {
    padding: 24px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group button {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.input-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -8px rgba(102, 126, 234, 0.4);
}

.input-group button:active {
    transform: translateY(0);
}

/* 聊天区域 */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* 聊天消息区域 - 背景图在这里 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    position: relative;
}

/* 确保消息在背景上层 */
.chat-messages > * {
    position: relative;
    z-index: 2;
}

/* 消息气泡 */
.message {
    max-width: 80%;
    animation: messageSlide 0.3s ease;
    width: fit-content;
}

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

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

.message-header {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}

.message-username {
    font-weight: 600;
    color: #667eea;
}

.message-time {
    color: #94a3b8;
    font-size: 11px;
}

.message-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 18px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    border: 1px solid rgba(226, 232, 240, 0.5);
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 15px;
    width: fit-content;
    max-width: 100%;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.own-message .message-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    color: white;
    border: none;
    border-top-left-radius: 18px;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

/* 系统消息 */
.system-message {
    text-align: center;
    color: #64748b;
    font-size: 12px;
    margin: 8px 0;
    padding: 6px 16px;
    background: rgba(241, 245, 249, 0.9);
    border-radius: 100px;
    align-self: center;
    max-width: 90%;
    width: fit-content;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

/* 输入区域 */
.chat-input-area {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
    justify-content: center;
}

.chat-input-area textarea {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    font-size: 15px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #f8fafc;
    align-self: center;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-area button {
    padding: 12px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: fit-content;
    align-self: center;
    white-space: nowrap;
}

.chat-input-area button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -8px rgba(102, 126, 234, 0.4);
}

.chat-input-area button:active {
    transform: translateY(0);
}

.chat-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 关闭状态容器 */
.closed-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    min-height: 400px;
    width: 100%;
    overflow: hidden;
    background: transparent !important;
}

/* 移除所有可能干扰的伪元素 */
.closed-container::before,
.closed-container::after {
    display: none !important;
    content: none !important;
}

/* 背景层 - 显示聊天室背景图 */
.closed-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    z-index: 1;
    display: block;
    opacity: 1;
    visibility: visible;
}

/* 半透明遮罩层 */
.closed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(0.3px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
    display: block;
    /* 确保不显示背景图 */
    background-image: none !important;
}

/* 内容卡片容器 */
.closed-content {
    position: relative;
    z-index: 3;
    max-width: 320px;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.5s ease;
    background: transparent !important;
}

/* 内容卡片的内层 */
.closed-content-inner {
    position: relative;
    padding: 40px 32px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 24px;
    /* 确保不显示背景图 */
    background-image: none !important;
}

/* 图标容器 */
.closed-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 20px -5px rgba(102, 126, 234, 0.3);
}

.closed-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
    stroke-width: 2;
}

.closed-content-inner h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.closed-message-text {
    font-size: 16px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 24px;
}

.next-time-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.next-time-label {
    display: block;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.next-time-value {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
    font-family: 'Inter', 'Courier New', monospace;
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: toastFade 2s ease forwards;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.3);
}

@keyframes toastFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    85% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 100px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

/* 手机端优化 */
@media (max-width: 480px) {
    body {
        padding: 0;
        background: white;
    }
    
    .container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .closed-container {
        padding: 16px;
    }
    
    .closed-content-inner {
        padding: 32px 24px;
    }
    
    .closed-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 20px;
    }
    
    .closed-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .closed-content-inner h3 {
        font-size: 22px;
    }
    
    .closed-message-text {
        font-size: 14px;
    }
    
    .next-time-value {
        font-size: 18px;
    }
    
    .countdown-bar {
        padding: 14px 20px;
    }
    
    .countdown-time {
        font-size: 18px;
    }
    
    .username-section {
        padding: 20px;
    }
    
    .input-group input,
    .input-group button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .chat-messages {
        padding: 20px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .message-content {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .chat-input-area {
        padding: 16px 20px;
    }
    
    .chat-input-area textarea {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .chat-input-area button {
        padding: 10px 24px;
        font-size: 14px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .closed-content-inner {
        padding: 24px 20px;
    }
    
    .closed-content-inner h3 {
        font-size: 20px;
    }
    
    .closed-message-text {
        font-size: 13px;
    }
    
    .next-time-value {
        font-size: 16px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group button {
        width: 100%;
    }
    
    .message {
        max-width: 90%;
    }
}