/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* 主容器 */
.live-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 视频播放区域 */
.video-container {
    position: relative;
    flex: 1;
    background: #000;
    overflow: hidden;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* 视频叠加层 */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* 观看人数 */
.viewer-count {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: auto;
}

.viewer-icon {
    font-size: 14px;
}

/* 主播信息 */
.anchor-info {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.anchor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
}

.anchor-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.anchor-name {
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
}

/* 聊天区域 */
.chat-container {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    height: 300px;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

/* 聊天消息列表 */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-messages::-webkit-scrollbar {
    display: none;
}

/* 消息样式 */
.message {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 280px;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease-out;
    pointer-events: auto;
}

.system-message {
    background: rgba(255, 193, 7, 0.8);
    color: #333;
    text-align: center;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    align-self: center;
    pointer-events: auto;
}

.user-message {
    align-self: flex-end;
    background: rgba(64, 158, 255, 0.8);
}

.other-message {
    align-self: flex-start;
}

.username {
    color: #FFD700;
    font-weight: 500;
    margin-right: 6px;
}

/* 消息动画 */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 消息输入区域 */
.chat-input-container {
    padding: 15px;
    pointer-events: auto;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 8px 15px;
    backdrop-filter: blur(10px);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    outline: none;
    padding: 6px 0;
}

#messageInput::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.send-btn {
    background: #409EFF;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #337ab7;
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

/* 底部工具栏 */
.toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 20px;
}

.tool-btn {
    background: none;
    border: none;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 5px;
}

.tool-btn:hover {
    transform: scale(1.1);
}

.tool-btn .icon {
    font-size: 20px;
}

.tool-btn .text {
    font-size: 10px;
    opacity: 0.8;
}

/* 连接状态指示器 */
.connection-status .icon {
    animation: pulse 2s infinite;
}

.connection-status.connected .icon {
    color: #27ae60;
    animation: none;
}

.connection-status.disconnected .icon {
    color: #e74c3c;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 飘心动画 */
.floating-hearts {
    position: absolute;
    bottom: 60px;
    right: 15px;
    width: 50px;
    height: 200px;
    pointer-events: none;
    z-index: 10;
}

.heart {
    position: absolute;
    bottom: 0;
    font-size: 20px;
    animation: floatUp 3s ease-out forwards;
    opacity: 0;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateZ(0deg);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-100px) scale(1.2) rotateZ(180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.8) rotateZ(360deg);
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .anchor-info {
        top: 10px;
        left: 10px;
    }
    
    .viewer-count {
        top: 10px;
        right: 10px;
    }
    
    .chat-messages {
        padding: 10px;
    }
    
    .chat-input-container {
        padding: 10px;
    }
    
    .message {
        max-width: 250px;
        font-size: 13px;
    }
}

/* 横屏适配 */
@media (orientation: landscape) and (max-height: 480px) {
    .chat-container {
        height: 200px;
        bottom: 50px;
    }
    
    .toolbar {
        height: 50px;
    }
    
    .floating-hearts {
        bottom: 50px;
        height: 150px;
    }
}

/* iOS 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .toolbar {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        height: calc(60px + env(safe-area-inset-bottom));
    }
    
    .chat-container {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }
    
    .floating-hearts {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }
}