/* --- main.css : 核心骨架 + 交互逻辑 + 系统UI (紧凑版 + 三色扫光无呼吸按钮) --- */

/* ================== 1. 全局重置 ================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
    margin: 0; padding: 0; 
    
    /* ★★★ 核心修复：防闪烁设置 ★★★ */
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    
    overflow: hidden; 
    background: #000; 
    
    /* 3. 强制开启 GPU 硬件加速 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 核心容器 */
.screen { 
    display: none !important; 
    width: 100%; height: 100%; 
    transform: translate3d(0,0,0); 
}
.screen.active-screen { display: flex !important; }
.hidden { display: none !important; }

/* ================== 2. 交互层级 ================== */
#gameFooter {
    flex-shrink: 0; 
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 2000 !important; 
    position: relative;
    pointer-events: auto !important;
}
#actionBtnContainer { position: relative; z-index: 2001 !important; pointer-events: auto !important; }
.interaction-bar { position: relative; z-index: 2002 !important; pointer-events: auto !important; }
.emoji-btn { 
    position: relative; z-index: 2003 !important; 
    pointer-events: auto !important; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
}
#cardArea { flex: 1; z-index: 10; position: relative; pointer-events: none !important; }
.card-box { pointer-events: auto !important; } 
#gameHeader {
    flex-shrink: 0; padding-top: max(0px, env(safe-area-inset-top));
    overflow: visible !important; z-index: 500;
}

/* ================== 3. 游戏内组件 (修正版) ================== */
#topAvatarBar { 
    display: flex; 
    gap: 15px; 
    align-items: center;
    min-height: 90px;
    height: auto;
    
    /* ★★★ 核心修复：去掉了负边距 ★★★ */
    width: 100%;            /* 强制宽度等于屏幕宽度 */
    box-sizing: border-box; /* 确保 padding 包含在宽度内，不撑大 */
    margin: 3px -10px 0 -10px;      /* 【重点】改成 0，不要负数！这样就不会往左偏了 */
    padding: 30px 5px 0 5px; /* 首尾留 15px 的空隙，美观 */
    
    /* --- 保持滑动的流畅性 --- */
    overflow-x: auto; 
    overflow-y: hidden; 
    touch-action: pan-x; 
    -webkit-overflow-scrolling: touch; 
    overscroll-behavior-x: contain; 

    scrollbar-width: none; 
    flex-shrink: 0; 
    z-index: 50; 
    position: relative;
    
    /* 遮罩层：让左右两边稍微淡出，显得比较高级（可选） */
    mask-image: linear-gradient(to right, transparent, black 3%, black 97%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 3%, black 97%, transparent);
}
#topAvatarBar::-webkit-scrollbar { display: none; }
.player-avatar { position: relative; display: inline-block; z-index: 10; overflow: hidden; }
.player-avatar video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; background: #000; }
.player-avatar img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.player-name { position: absolute; width: 100%; text-align: center; z-index: 20; }
.host-tag { position: absolute; z-index: 20; }
#videoGrid { display: none !important; }
#rf-timer-overlay { z-index: 9999 !important; }
.kick-btn { position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 10px; font-weight: bold; cursor: pointer; z-index: 50; }

/* 游戏内下拉框 */
#gameModeSelectWrapper, #skinSelectWrapper { position: relative; z-index: 100; margin: 0 5px; }
#gameModeSelectWrapper .custom-select-trigger, 
#skinSelectWrapper .custom-select-trigger {
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; user-select: none;
}
#gameModeSelectWrapper .custom-options, 
#skinSelectWrapper .custom-options {
    display: none; position: absolute; overflow: hidden; z-index: 10002;
}
#gameModeSelectWrapper.open .custom-options,
#skinSelectWrapper.open .custom-options { display: block; animation: fadeIn 0.2s; }
.custom-select-wrapper.open { z-index: 10001 !important; }
.custom-option { cursor: pointer; }

/* ================== 4. 登录页 UI (紧凑布局) ================== */
#loginScreen {
    flex-direction: column; background: #050507; 
    font-family: 'Segoe UI', Roboto, sans-serif; color: #fff;
    position: fixed; inset: 0; z-index: 10000;
    transform: translateZ(0); 
    justify-content: center; align-items: center; padding: 20px; overflow-y: auto;
}

#loginScreen::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(circle at 20% 30%, #ff2975 0%, transparent 20%),
                      radial-gradient(circle at 80% 70%, #00fff5 0%, transparent 20%);
    filter: blur(60px); opacity: 0.4;
    transform: translateZ(0);
}

/* 玻璃面板 (紧凑) */
#loginScreen .glass-panel { 
    width: 100%; max-width: 360px; 
    padding: 25px 20px; /* 紧凑内边距 */
    margin: 0 auto; background: rgba(20, 20, 25, 0.7); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 30px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
}

/* 强制覆盖 HTML 内联间距 (紧凑核心) */
#loginScreen h1 { text-align: center; margin: 0 0 10px 0 !important; font-size: 36px; font-weight: 900; color: #fff; text-shadow: 0 0 20px #ff2975; font-style: italic; }
#welcomeSlogan { margin-bottom: 15px !important; }
#loginScreen .glass-panel > div:nth-of-type(1) { margin-bottom: 10px !important; }
#loginScreen .glass-panel > div:nth-of-type(3) { margin-top: 15px !important; padding-top: 15px !important; }

#loginScreen input { 
    width: 100%; padding: 12px; border-radius: 12px; margin-bottom: 0; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: #fff; font-size: 16px; text-align: center; font-weight: 600; outline: none; 
}
#loginScreen input:focus { border-color: #00fff5; box-shadow: 0 0 15px rgba(0, 255, 245, 0.3); }

/* ================== 5. 等待大厅 UI (独立背景) ================== */
#lobbyScreen {
    flex-direction: column; 
    font-family: 'Segoe UI', Roboto, sans-serif; color: #fff;
    position: fixed; inset: 0; z-index: 9000;
    transform: translateZ(0); 
    
    /* 独立背景图 + 黑色遮罩 */
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), 
        url('/images/your-lobby-background.jpg'); /* 请替换图片路径 */
        
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #1a1a1a;
}
#lobbyScreen::before { display: none !important; }

/* 登录/大厅下拉框 */
#loginModeSelectWrapper, #lobbyModeSelectWrapper { margin: 15px 0; width: 100%; position: relative; z-index: 100; }
#lobbyModeSelectWrapper { margin-top: 20px; width: 80%; margin-left: auto; margin-right: auto; }
#loginModeSelectWrapper .custom-select-trigger, #lobbyModeSelectWrapper .custom-select-trigger { background: rgba(0,0,0,0.4); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 12px; color: #fff; padding: 14px; display: flex; justify-content: center; cursor: pointer; font-size: 14px; font-weight: bold; }

/* 下拉框紧凑样式 */
.custom-select-trigger.login-style {
    padding: 10px 14px !important;
    font-size: 15px !important;
}

#loginModeSelectWrapper .custom-options, #lobbyModeSelectWrapper .custom-options { display: none; position: absolute; top: 110%; left: 0; right: 0; background: #111; border: 1px solid #333; border-radius: 12px; overflow: hidden; z-index: 2000; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
#loginModeSelectWrapper .custom-option, #lobbyModeSelectWrapper .custom-option { padding: 12px; text-align: center; border-bottom: 1px solid #222; color: #aaa; transition: 0.2s; }
#loginModeSelectWrapper .custom-option.selected, #lobbyModeSelectWrapper .custom-option.selected { color: #fff; background: rgba(255,255,255,0.1); }
#loginModeSelectWrapper.open .custom-options, #lobbyModeSelectWrapper.open .custom-options { display: block; animation: fadeIn 0.2s; }

/* ================== ★★★ 按钮样式修改区 (三色渐变 + 扫光 + 无呼吸 + 无光晕) ★★★ ================== */

/* 登录页的 立即开局 按钮 */
#loginScreen .btn-dynamic-breathe {
    /* 1. 颜色与背景 (三色渐变) */
    background: linear-gradient(-45deg, #ff2975, #ffd300, #00fff5, #ff2975);
    background-size: 400% 400%; /* 拉大背景以支持流动 */
    
    /* 2. 紧凑布局 */
    padding: 15px;
    margin-top: 5px !important;
    width: 100%;
    border-radius: 16px;
    border: none;
    
    /* 3. 字体 */
    color: #1a103c; /* 深色字 */
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    
    /* 4. 特效 (移除 box-shadow 光晕) */
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    box-shadow: none; /* ★ 无光晕 ★ */
    
    /* 5. 动画：只保留背景流动 */
    animation: gradientBG 3s ease infinite; /* ★ 无呼吸缩放 ★ */
    
    cursor: pointer;
    position: relative;
    z-index: 1;
    overflow: hidden; /* 限制扫光 */
}

/* 6. 扫光层 (白光划过 - 强烈锐利版) */
/*#loginScreen .btn-dynamic-breathe::after {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 100%;
    
    /* ★★★ 核心修改处 ★★★ */
    /* 1. 提高不透明度到 0.95 (更亮) */
    /* 2. 缩窄渐变范围 (42%到58%)，使光束更锐利，不模糊 */
   /* background: linear-gradient(
        90deg,
        transparent 20%,
        rgba(255, 255, 255, 0.95) 50%, 
        transparent 68%
    );
    
    /* 初始状态 */
   /* transform: skewX(-20deg) translateX(-150%);
    pointer-events: none;
    
    /* 执行扫光动画 (稍微加快了一点节奏感) */
   /* animation: lightSweep 2.5s cubic-bezier(0.2, 0.0, 0.2, 1) infinite;
    
    /* 可选：添加混合模式让光感更通透 (如果觉得太白了可以加上这一行) */
    /* mix-blend-mode: overlay; */ 
/*}

/* 按压反馈 */
#loginScreen .btn-dynamic-breathe:active {
    transform: scale(0.98); /* 仅轻微按压缩小 */
}

/* 动画：背景流动 */
@keyframes gradientBG { 
    0% { background-position: 0% 50%; } 
    50% { background-position: 100% 50%; } 
    100% { background-position: 0% 50%; } 
}

/* 动画：扫光 */
@keyframes lightSweep {
    0% { transform: skewX(-20deg) translateX(-150%); opacity: 0; }
    10% { opacity: 1; }
    50% { opacity: 0; transform: skewX(-20deg) translateX(150%); } 
    100% { opacity: 0; transform: skewX(-20deg) translateX(150%); } 
}

/* ================== 其他按钮 ================== */
.btn-outline { 
    background: rgba(0,0,0,0.3); 
    border: 1px solid rgba(255,255,255,0.3); 
    color: #fff; 
    padding: 10px 20px; 
    border-radius: 20px; 
    font-size: 16px; 
    font-weight: 800; 
    cursor: pointer; 
}

.btn-green { background: #00fff5; color: #000; width: 100%; padding: 16px; border-radius: 16px; font-size: 18px; font-weight: 900; border: none; margin-bottom: 10px; cursor: pointer; }
.btn-exit { background: rgba(255, 82, 82, 0.1); border: 1px solid rgba(255, 82, 82, 0.4); color: #ff5252; padding: 12px; width: 100%; border-radius: 12px; font-weight: bold; cursor: pointer; }

/* 大厅列表 */
.lobby-header { flex-shrink: 0; text-align: center; padding: 40px 20px 10px 20px; background: linear-gradient(to bottom, #050507, transparent); }
#lobbyCode { font-size: 56px !important; font-family: monospace; font-weight: 900; letter-spacing: 6px; color: #00fff5; text-shadow: 0 0 20px rgba(0, 255, 245, 0.6); margin: 10px 0; display: inline-block; }
#lobbyPlayerList { flex: 0 1 auto; height: auto; max-height: 55vh; overflow-y: auto; padding: 5px 20px; display: grid; grid-template-columns: repeat(2, 1fr); align-content: start; gap: 10px; }
#lobbyPlayerList .player-item, #lobbyPlayerList .player-card { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 50px; position: relative; overflow: hidden; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; border-left: 4px solid #f2ff00; color: #fff; font-size: 14px; font-weight: bold; min-width: 0; }
#lobbyPlayerList .player-item img, #lobbyPlayerList .player-card img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.2); flex-shrink: 0; }
#lobbyPlayerList .info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
#lobbyPlayerList .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; margin-bottom: 2px; }
#lobbyPlayerList .role { font-size: 11px; color: #aaa; display: flex; gap: 5px; align-items: center; }
#lobbyPlayerList .role-badge { padding: 1px 4px; border-radius: 3px; color:#000; font-weight:800; font-size:10px; }
#lobbyPlayerList .role-badge.host { background: #ffbd29; }
#lobbyPlayerList .role-badge.spectator { background: #00e5ff; }
#lobbyPlayerList .kick-btn { background: #ff5252; border: 2px solid #050507; width: 20px; height: 20px; top: 5px; right: 5px; font-size: 14px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); position: absolute; display: flex; justify-content: center; align-items: center; cursor: pointer; }
#hostControls, #guestControls { flex-shrink: 0; margin-top: auto; width: 100%; z-index: 50; padding: 10px 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(to top, #000 70%, transparent); }

/* 系统弹窗 */
#generalModal, #pauseOverlay, #approvalModal { display: none; position: fixed; inset: 0; z-index: 20000; align-items: center; justify-content: center; flex-direction: column; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); font-family: 'Segoe UI', sans-serif; }
.modal-content, #approvalModal .glass-panel { background: rgba(20, 20, 25, 0.85); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 20px; padding: 30px 25px; width: 85%; max-width: 320px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.8); }
.modal-title { font-size: 18px; font-weight: 800; color: #00fff5; margin-bottom: 10px; }
.modal-message { font-size: 15px; color: #ddd; margin-bottom: 25px; line-height: 1.5; }
.modal-buttons { display: flex; gap: 10px; justify-content: center; width: 100%; }
.modal-buttons .btn { flex: 1; padding: 10px 20px; border-radius: 10px; cursor: pointer; border: none; }

/* ★★★ 修改处：添加 white-space: nowrap 强制不换行 ★★★ */
.toast { 
    position: fixed; 
    top: 12%; 
    left: 50%; 
    transform: translateX(-50%); 
    background: rgba(25, 25, 25, 0.9); 
    color: #fff; 
    padding: 12px 24px; 
    border-radius: 30px; 
    font-size: 14px; 
    font-weight: 600; 
    backdrop-filter: blur(12px); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); 
    z-index: 30000; 
    pointer-events: none; 
    animation: toastIn 0.4s;
    white-space: nowrap; 
    max-width: 90vw; 
    text-overflow: ellipsis; 
    overflow: hidden;
}

.big-emoji-fly { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 25000; pointer-events: none; animation: floatUp 2s ease-out forwards; }
@keyframes floatUp { 0% { transform: translate(-50%, 0) scale(0.5) rotate(0deg); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -40px) scale(1.1) rotate(10deg); } 80% { opacity: 1; } 100% { transform: translate(-50%, -300px) scale(0.8) rotate(0deg); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -20px) scale(0.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* ================== 5. PC/平板端适配 (关键新增) ================== */
@media (min-width: 500px) {
    #loginScreen, #lobbyScreen {
        inset: auto;
        width: 100%;
        max-width: 480px;
        height: 95vh;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%) translateZ(0) !important;
        border-radius: 30px;
        border: 4px solid #333;
        box-shadow: 0 0 50px rgba(0,0,0,0.8);
        overflow: hidden;
    }
    #loginScreen::before, #lobbyScreen::before {
        border-radius: 26px;
    }
}
/* ================== 🛠️ 强制修复：彻底隔离等待大厅背景 ================== */

#lobbyScreen {
    /* 1. 设置您的独立背景图 */
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), /* 黑色遮罩 */
        url('/images/your-lobby-background.jpg') !important; /* <--- 替换图片路径 */
        
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;

    /* 2. 【核心】强制底色为纯黑且不透明，这一步是为了“挡住”body上的皮肤背景 */
    background-color: #000000 !important;
    
    /* 3. 【核心】移除磨砂玻璃效果，防止穿透看到底层 */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    
    /* 4. 重置混合模式，防止皮肤的 blend-mode 影响图片颜色 */
    background-blend-mode: normal !important;
}

/* 5. 【关键】强制隐藏皮肤文件(cyber.css)加在 screen 上的网格线、光晕等伪元素 */
#lobbyScreen::before,
#lobbyScreen::after {
    content: none !important;
    display: none !important;
    background: none !important;
    width: 0 !important;
    height: 0 !important;
}
/* --- 踢人弹窗按钮样式 --- */

/* 按钮组容器 */
.kick-btn-group {
    display: flex;
    gap: 15px; /* 按钮之间的间距 */
    margin-bottom: 10px;
    width: 100%;
}

/* 通用弹窗按钮 */
.modal-btn {
    flex: 1; /* 两个按钮平分宽度 */
    padding: 12px 0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.modal-btn:active { transform: scale(0.95); }

/* 1. 拉黑按钮 (红色) */
.btn-ban {
    background: #ff2975; /* 霓虹红 */
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 41, 117, 0.4);
}

/* 2. 移出按钮 (青色) */
.btn-kick-only {
    background: #00f3ff; /* 赛博青 */
    color: #000;         /* 黑色文字对比度高 */
    box-shadow: 0 4px 15px rgba(0, 243, 255, 0.4);
}

/* 3. 取消按钮 (灰色边框) */
.btn-cancel-wide {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 0;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
}
.btn-cancel-wide:hover {
    border-color: #fff;
    color: #fff;
}