/* =========================================
           1. 全局定义 (Global Definitions)
           ========================================= */
        :root {
            /* 密度换算: 1px = 0.08547vw (基于 1170px 宽度) */
            --vw: 0.08547vw;
            
            /* 安全区适配 */
            --safe-top: env(safe-area-inset-top, 20px);
            --safe-bottom: env(safe-area-inset-bottom, 20px);
            
            /* 视觉材质 */
            --bg-mask: rgba(0, 0, 0, 0.35); /* 半透明黑底 */
            --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            --font-num: 'Oswald', sans-serif; /* 数字专用字体 */
            --c-primary: #fe2c55; /* 抖音红 */
            --c-combo-text: #fff;

            /* 控制台配色变量 */
            --console-bg: rgba(20, 20, 25, 0.95); /* 稍微加深不透明度，提升可读性 */
            --console-border: rgba(255, 255, 255, 0.15);
            --console-text: #eeeeee;
            --console-label: #aaaaaa;
        }

        * { 
            box-sizing: border-box; 
            margin: 0; 
            padding: 0; 
            -webkit-tap-highlight-color: transparent; 
            outline: none;
        }
        
        body, html {
            width: 100%; 
            height: 100%; 
            overflow: hidden;
            background: #000; 
            font-family: var(--font-main); 
            color: #fff;
            user-select: none; /* 禁止选中文本 */
            -webkit-user-select: none;
        }

        /* * 全局安全策略：
         * 禁止长按菜单和图片拖拽 
         */
        img { 
            -webkit-touch-callout: none; 
            -webkit-user-drag: none; 
            pointer-events: auto; /* 保持可点击用于编辑 */
            user-select: none;
        }

        /* 通用工具类 */
        .rounded-full { border-radius: 999px; }
        .flex-center { display: flex; justify-content: center; align-items: center; }
        .interactive { pointer-events: auto; cursor: pointer; } /* 允许点击 */

        /* =========================================
           2. 视图层级架构 (View Hierarchy)
           ========================================= */
        
        /* 层级容器包装器 */
        .layer-wrapper {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            pointer-events: none; /* 默认穿透点击 */
        }

        /* L0: 视频基座 */
        #layer-video {
            z-index: 0;
            pointer-events: auto; /* 接收滑动手势和点击 */
            background: linear-gradient(180deg, #2a2d3e 0%, #161823 100%);
            overflow: hidden;
        }

        /* L10 - L30: 各UI层 */
        #layer-osd { z-index: 10; transition: opacity 0.3s ease; }
        #layer-danmaku { z-index: 20; transition: opacity 0.3s ease; }
        
        /* L25: 进场提示层 (位于弹幕之上) */
        #layer-entry { z-index: 25; }

        #layer-controls { z-index: 30; transition: opacity 0.3s ease; }
        
        /* L46: 特效层 (礼物横幅) */
        #layer-effect { z-index: 46; }

        /* L45: WebGL 全屏特效层 */
        #layer-webgl { 
            z-index: 45; 
            pointer-events: none; 
        }

        /* L48: 悬浮连击层 */
        #layer-floating-combo {
            z-index: 48;
            pointer-events: none;
        }

        /* L49: 点击点赞特效层 */
        #layer-poke {
            z-index: 49;
            pointer-events: none;
            overflow: hidden;
        }

        /* L50: 模态层 (礼物面板) */
        #layer-modal { z-index: 50; }

        /* * L100: 高级控制台层 (NEW)
         * 位于最顶层，确保不被任何元素遮挡
         */
        #layer-console { 
            z-index: 100; 
            pointer-events: none; 
        }
        
        /* * L110: 上帝模式编辑UI层 (NEW)
         * 用于放置可视化选择器等临时浮层
         */
        #layer-god-ui { 
            z-index: 110; 
            pointer-events: none; 
        }

        /* 清屏模式状态 */
        body.pure-mode #layer-osd,
        body.pure-mode #layer-danmaku,
        body.pure-mode #layer-controls,
        body.pure-mode #layer-entry {
            opacity: 0; pointer-events: none;
        }

        /* WebGL Canvas 样式 */
        #fx-canvas {
            width: 100%;
            height: 100%;
            opacity: 0; /* 默认隐藏 */
            transition: opacity 0.3s ease-in; /* 淡入淡出 */
            display: block;
        }
        #fx-canvas.playing {
            opacity: 1;
        }

        /* =========================================
           3. 组件详细规格 (Detailed Specs)
           ========================================= */

        /* --- 3.1 顶部通栏容器 --- */
        .header-bar {
            position: absolute;
            top: calc(2.52% + var(--safe-top));
            left: 0;
            width: 100%;
            height: 9.23vw;
            pointer-events: none;
            display: flex;
            align-items: center;
        }

        /* A. 主播胶囊 */
        .host-capsule {
            position: absolute;
            left: 3.08%;
            width: 48.97vw; height: 110%;
            background: var(--bg-mask);
            border-radius: 999px;
            display: flex; align-items: center;
            overflow: hidden; /* 防止图片溢出 */
        }
        .host-avatar {
            position: absolute; left: 0.51vw;
            width: 8.21vw; height: 8.21vw;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.2);
            object-fit: cover;
        }
        .host-info {
            position: absolute; left: 9.83vw;
            display: flex; flex-direction: column; justify-content: center;
            width: 35vw;
            max-width: 15vw;
        }
        .host-name { 
            font-size: 2.82vw; 
            font-weight: 600; 
            white-space: nowrap; 
            overflow: hidden; 
            text-overflow: ellipsis; 
        }
        
        /* 修改点赞数字样式：更小，与文字高度一致 */
        .host-stats { 
            font-size: 1.8vw; /* 调整为更小字体 */
            opacity: 0.8; 
            font-family: var(--font-num); 
            line-height: 1.2;
            margin-top: 1vw;
        }

        /* B. 粉丝团勋章 (顶部 OSD 专用) */
        .fan-badge {
            position: absolute;
            left: 32.56%;
            top: 50%; transform: translateY(-50%);
            width: 18.46vw; height: 7.18vw;
            z-index: 2;
            object-fit: contain;
        }

        /* C. 右上角功能组 */
        .btn-close {
            position: absolute;
            right: 2.56%;
            top: 50%; transform: translateY(-50%);
            width: 6.67vw; height: 6.67vw;
            background: var(--bg-mask);
            border-radius: 50%;
        }
        .btn-close svg {
            width: 48%; height: 48%;
            stroke: white; stroke-width: 1.2;
            fill: white;
        }

        .viewer-capsule {
            position: absolute;
            right: 10.77vw;
            top: 50%; transform: translateY(-50%);
            height: 6.18vw; min-width: 9.23vw;
            background: var(--bg-mask);
            border-radius: 999px;
            padding: 0 2vw;
         font-family: var(--font-main);
            font-size: 2.8vw;
            white-space: nowrap;
        }

        .viewer-avatar {
            position: absolute;
            top: 50%; transform: translateY(-50%);
            width: 6.67vw; height: 6.67vw;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.5);
            background-size: cover;
            background-position: center;
        }
        .avatar-1 { right: 22.54vw; z-index: 11; }
        .avatar-2 { right: 27.15vw; z-index: 12; }
        .avatar-3 { right: 31.77vw; z-index: 13; }

        /* --- 3.2 侧边挂件 --- */
        .rank-capsule {
            position: absolute;
            top: calc(8.73% + var(--safe-top));
            left: 3.08%;
            width: 14.10vw; height: 5.64vw;
            background: var(--bg-mask);
            border-radius: 999px;
            font-size: 2.56vw; 
            color: #fff;
        }

        /* 福袋组 */
        .lucky-bag-group {
            position: absolute;
            top: calc(13% + var(--safe-top));
            left: 3.08%;
            width: 9.23vw; height: 12.3vw; 
            transition: transform 0.1s;
        }
        .lucky-bag-group:active {
            transform: scale(0.95);
        }
        .bag-bg {
            position: absolute; top: -0.5vw; left: 0;
            width: 9.23vw; height: 9.23vw;
            background: var(--bg-mask);
            border-radius: 1.7vw;
            display: flex; justify-content: center; align-items: center;
            z-index: 0; /* 最底层 */
        }
        
        .lucky-bag-img {
            position: absolute;
            top: -1vw; left: 1vw;
            width: 80%; height: 80%;
            object-fit: contain;
            transform: scale(0.9);
            z-index: 1; /* 图片在中间层 */
        }

        .bag-timer {
            position: absolute;
            bottom: 4vw;
            left: 50%; transform: translateX(-50%);
            width: 7.69vw; height: 2.56vw;
            background: rgba(0, 0, 0, 0.8);
            border-radius: 999px;
            font-family: var(--font-num); font-size: 1.8vw;
            z-index: 2; /* 倒计时在最上层 */
        }

        .live-square {
            position: absolute;
            top: calc(8.73% + var(--safe-top));
            right: 0;
            width: 21.28vw; height: 5.64vw;
            background: var(--bg-mask);
            border-radius: 999px 0 0 999px;
            display: flex; align-items: center; justify-content: center;
            font-size: 2.56vw;
            font-weight: 800;
        }

        .gift-exhibition {
            position: absolute;
            top: calc(13% + var(--safe-top) + 2vw);
            right: 0;
            width: 18vw; 
            height: 18vw; 
            object-fit: contain;
        }

        /* --- 3.3 底部控制栏 --- */
        .input-bar {
            position: absolute;
            bottom: calc(2.03% + var(--safe-bottom));
            left: 3.08%;
            width: 58.46vw; 
            height: 9.74vw;
            background: var(--bg-mask);
            border-radius: 999px;
            display: flex; align-items: center;
            padding-left: 3.5vw;
            color: rgba(255,255,255,0.6);
            font-size: 3.2vw;
        }
        .input-field {
            width: 85%;
            height: 100%;
            background: transparent;
            border: none;
            outline: none;
            color: white;
            font-size: 3.2vw;
            font-family: inherit;
        }
        .input-field::placeholder { color: rgba(255,255,255,0.6); }
        .input-bar .icon-smile {
            position: absolute; right: 2.05vw; top: 50%; transform: translateY(-50%);
            width: 5.64vw; height: 5.64vw;
            opacity: 0.8;
            pointer-events: none; 
        }

        .action-btn {
            position: absolute;
            bottom: calc(2.03% + var(--safe-bottom));
            width: 9.74vw; height: 9.74vw;
            background: var(--bg-mask);
            border-radius: 50%;
            display: flex; justify-content: center; align-items: center;
        }
        .action-btn svg { width: 50%; height: 50%; fill: #fff; }
        .action-btn img { width: 60%; height: 60%; object-fit: contain; }
        



        .btn-heart { right: 26.15%; }
        /* 点击态效果 */
        .btn-heart:active { transform: scale(0.9); transition: transform 0.1s; } 
        








        .btn-gift { right: 14.35%; }
        .btn-control { right: 2.56%; }

        /* --- 3.4 弹幕容器 --- */
        .danmaku-container {
            position: absolute;
            left: 3.08%;
            bottom: calc(8.30% + var(--safe-bottom));
            width: 81.28vw;
            max-height: 33%; 
            display: flex; flex-direction: column-reverse; 
            gap: 0.51vw;
            overflow: hidden;
            mask-image: linear-gradient(to bottom, transparent 0%, black 20%);
            -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%);
        }
        




   /* 修改后的弹幕单项：回归文本流布局，解决换行留白问题 */
/* --- 修改原有的 .dm-item --- */
.dm-item {
    align-self: flex-start;
    background: rgba(0,0,0,0.3); /* 保持半透明黑底 */
    
    /* 🔴 核心修改：从 999px 改为 2.6vw */
    /* 原理：2.6vw 大约是单行高度的一半。单行时是胶囊，多行时是圆角矩形 */
    border-radius: 2.6vw; 
    
    padding: 0.8vw 2.5vw;
    font-size: 3.5vw;
    max-width: 100%;
    animation: slideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    display: inline-block;
    line-height: 1.4;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: break-word;
}



/* ... 之前的 .dm-item.sticker-mode 代码 ... */
.dm-item.sticker-mode {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    pointer-events: none; /* 这里屏蔽了点击，导致无法修改等级 */
    margin-bottom: 0.5vw;
}

/* 👇👇👇 新增：强制恢复内部图标和文字的点击响应 👇👇👇 */
.dm-item.sticker-mode .dm-badge-icon,
.dm-item.sticker-mode .dm-name {
    pointer-events: auto !important; /* 恢复点击！ */
    cursor: pointer;
    position: relative; /* 确保层级正确 */
    z-index: 10;
}

/* 确保图片本身不挡住上面的图标点击（可选） */
.dm-item.sticker-mode img[src*="/img/emoji/"] {
    pointer-events: none; 
}






        /* 暂停动画的类，用于上帝模式 */
        .dm-item.paused { 
            animation-play-state: paused !important; 
        }

        /* 弹幕徽章图标通用样式 */
.dm-badge-icon {
    height: 3.9vw;
    width: auto;
    margin-right: 1vw;
    object-fit: contain;
    /* --- 新增：让图片和文字垂直居中对齐 --- */
    display: inline-block; 
    vertical-align: middle;
    margin-top: -0.5vw; /* 微调，防止图片把行高撑得太高 */
    pointer-events: auto;
}
        
        .dm-icon-level { border-radius: 2px; } /* 用户等级 */
        .dm-icon-fan { border-radius: 2px; }   /* 粉丝灯牌 */
        .dm-icon-member { }                    /* 年会员，不做圆角 */
        .dm-icon-admin { }                     /* 管理员 */

        .dm-name {
            color: #a1e4fb;
            margin-right: 1vw;
            white-space: nowrap;
            pointer-events: auto; /* 允许点击进行编辑 */
        }
        
        .dm-content {
            color: #fff;
            word-break: break-all;
            pointer-events: auto; /* 允许点击进行编辑 */
        }

/* 强制昵称和内容变成“文字流”，彻底消除块级隔阂 */
.dm-name, .dm-content {
    display: inline !important; 
    vertical-align: middle;
}

/* 稍微调整一下昵称的右边距，不要太大，不然还是容易被挤下去 */
.dm-name {
    margin-right: 0.5vw; 
}

        /* 可编辑时的高亮样式 */
        .editable-highlight { 
            border-bottom: 1px dashed rgba(255,255,255,0.5); 
            min-width: 20px; 
            display: inline-block;
        }

        .dm-highlight { color: #ffe699; }
        @keyframes slideIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* --- 3.5 礼物横幅样式 --- */
        .gift-banner-track {
            position: absolute;
            bottom: calc(48.5% + var(--safe-bottom)); 
            left: 0;
            width: 100%;
            display: flex;
            flex-direction: column-reverse; 
            gap: 2vw; 
            pointer-events: none;
        }

        .banner-card {
            position: relative;
            width: 43.55vw; 
            height: 11.39vw;
            margin-left: -65vw;
            flex-shrink: 0; 
            animation: slideInBanner 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
            transform: scale(0.9);
            transform-origin: left center;
        }

        @keyframes slideInBanner {
            to { margin-left: 2vw; } 
        }
        
        .banner-card.slide-out {
            animation: slideOutBanner 0.3s ease-in forwards;
        }
        @keyframes slideOutBanner {
            to { margin-left: -70vw; opacity: 0; }
        }

        .banner-bg {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: fill; z-index: 1;
        }
        .banner-content {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; display: flex; align-items: center; padding-left: 1.5vw;
        }
        .sender-avatar {
            width: 10vw; height: 10vw; border-radius: 50%; border: 1px solid rgba(255,255,255,0.8); margin-right: 1.5vw; object-fit: cover;
        }
        .text-info {
            display: flex; flex-direction: column; justify-content: center; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.3); margin-right: 1vw;
        }
        .user-name {
            font-size: 3.5vw; font-weight: 600; max-width: 18vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .gift-desc { font-size: 2.6vw; color: #d4cac8; margin-top: 1vw; }
        .banner-gift-icon {
            position: absolute; right: 2vw; bottom: 0.5vw; width: 10vw; height: 10vw; object-fit: contain;
        }

        /* 连击数字 */
        .combo-count {
            position: absolute;
            left: 100%; margin-left: 1vw; top: 1.8vw;
            font-family: var(--font-num); font-size: 6vw; color: #fff; font-weight: 800;
            font-style: italic; transform: skewX(-10deg) scale(0); transform-origin: left bottom;
            text-shadow: none; z-index: 3; display: flex; align-items: baseline; white-space: nowrap;
            padding-right: 2vw; will-change: transform; transition: transform 0.1s; 
        }
        .combo-x-mark { font-size: 0.6em; margin-right: 0.1em; font-family: var(--font-main); font-weight: 500; font-style: italic; }
        .combo-count.pop { animation: popComboUpdate 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
        @keyframes popComboUpdate {
            0% { transform: skewX(-10deg) scale(1.5); }
            100% { transform: skewX(-10deg) scale(1); opacity: 1; }
        }

        /* --- 3.6 模态面板 (Gift Panel) --- */
        .gift-panel {
            position: fixed; bottom: 0; left: 0; width: 100%; height: 47.87%;
            background: #161822; border-radius: 2.5vw 2.5vw 0 0;
            transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
            display: flex; flex-direction: column; pointer-events: auto; 
        }
        .gift-panel.active { transform: translateY(0); }
        
        .gift-header {
            width: 100%; height: 12vw; border-bottom: 1px solid rgba(255,255,255,0.05); position: relative; 
        }
        .header-rect {
            position: absolute; left: 66vw; top: 2vw; height: 8vw; width: 33vw; background: rgba(255, 255, 255, 0.03); border-radius: 5px; pointer-events: auto; 
        }
        /* 等级图标 - 可点击修改 */
        .level-icon { 
            position: absolute; top: 0vw; left: 3vw; width: 7vw; height: 7vw; object-fit: contain; cursor: pointer; 
        }
        .level-progress { position: absolute; top: 6vw; left: 2.3vw; width: 8.5vw; height: 0.8vw; background-color: #a74be3; border-radius: 999px; }
        .divider-line { position: absolute; left: 12.5vw; top: 0vw; height: 8vw; width: 0.26vw; background-color: #1e1f27; }
        .diamond-icon { position: absolute; left: 13vw; top: 1.2vw; width: 6vw; height: 6vw; object-fit: contain; }
        .header-rect .diamond-count {
            position: absolute; left: 18.5vw; top: 50%; transform: translateY(-50%);
            font-family: var(--font-main); font-size: 3vw; color: #fff; letter-spacing: 0.1vw; font-weight: 500;
        }

        .nav-tab {
            position: absolute; top: 4.7vw; font-size: 3.5vw; color: #a2a2a6; line-height: 1; font-weight: 500; z-index: 10; cursor: pointer; transition: color 0.2s ease; display: flex; align-items: center;
        }
        .nav-tab.active { color: #f2cf49; }
        .search-icon {
            position: absolute; top: 3.8vw; left: 3vw; width: 5vw; height: 5vw; fill: #a2a2a6; display: flex; align-items: center; justify-content: center; cursor: pointer;
        }
        .search-icon svg { width: 100%; height: 100%; }

        .sort-indicators {
            display: flex; flex-direction: column; justify-content: center; margin-left: 1vw; gap: 0.3vw; 
        }
        .sort-triangle { width: 0; height: 0; border-left: 0.8vw solid transparent; border-right: 0.8vw solid transparent; opacity: 1; transition: border-color 0.2s; }
        .sort-triangle.up { border-bottom: 1.1vw solid #a2a2a6; }
        .sort-triangle.down { border-top: 1.1vw solid #a2a2a6; }
        .sort-triangle.up.active { border-bottom-color: #f2cf49; }
        .sort-triangle.down.active { border-top-color: #f2cf49; }

        .gift-grid {
            flex: 1; display: grid; grid-template-columns: repeat(4, 14.36vw);
            column-gap: 9.83vw; row-gap: 12.65vw; padding: 5vw 6.58vw;
            overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior-y: contain; will-change: transform; 
        }
        
        .gift-item {
            width: 14.36vw; height: 14.36vw; background: transparent; border-radius: 0; position: relative; display: flex; flex-direction: column; align-items: center; transform: translateZ(0); 
        }
        .gift-item.combo-mode > *:not(.combo-btn-container) { display: none !important; }
        .gift-item.combo-mode .combo-btn-container { display: flex !important; }

        .gift-img { 
            width: 100%; height: 100%; margin-top: 0; object-fit: contain; will-change: transform; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 1;
            -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none;
        }
        .gift-name { position: absolute; bottom: -5vw; font-size: 2.5vw; white-space: nowrap; z-index: 1; user-select: none; -webkit-user-select: none; pointer-events: none;}
        .gift-price { position: absolute; bottom: -9vw; font-size: 2.2vw; color: rgba(255,255,255,0.5); z-index: 1; user-select: none; -webkit-user-select: none; pointer-events: none; }

        .gift-item.selected .gift-name,
        .gift-item.selected .gift-price { display: none; }
        .gift-item.selected .gift-img { transform: scale(1.15) translateY(-2vw); z-index: 10; }
        .gift-item .select-ui {
            display: none; position: absolute; width: 155%; height: 185%; top: 70%; left: 50%; transform: translate(-50%, -50%);
            background: rgba(255, 255, 255, 0.05); border-radius: 1.7vw; box-shadow: 0 4px 15px rgba(0,0,0,0.5); pointer-events: none; z-index: 5; 
        }
        .gift-item.selected .select-ui { display: block; }
        .select-bg-layer { display: none; }
        .send-btn {
            position: absolute; bottom: 0; left: 0; width: 100%; height: 6.5vw; background: #fe2c55; border-radius: 0 0 1.7vw 1.7vw; display: flex; justify-content: center; align-items: center; color: white; font-size: 2.8vw; font-weight: bold; z-index: 2; pointer-events: auto; cursor: pointer;
        }
        .send-btn:active { opacity: 0.8; }
        .select-price {
            position: absolute; bottom: 7vw; width: 100%; text-align: center; color: #fff; font-size: 2.5vw; font-weight: 500; z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
        }

        /* --- 3.7 连击按钮 (通用样式) --- */
        .combo-btn-container {
            position: absolute; top: 80%; left: 50%; transform: translate(-50%, -50%);
            width: 18vw; height: 18vw; z-index: 20; pointer-events: auto; display: flex; justify-content: center; align-items: center;
        }
        .progress-ring {
            position: absolute; width: 135%; height: 135%; transform-origin: center; transform: rotate(90deg) scaleX(-1); pointer-events: none; 
        }
        .progress-ring-texture-circle {
            fill: transparent; stroke: #fe2c55; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 6 4; mask: url(#eraser-mask);
        }
        .progress-ring-mask-circle {
            fill: none; stroke: white; stroke-width: 4; stroke-dasharray: 283; stroke-dashoffset: 0; animation: countdown 3s linear forwards; 
        }
        @keyframes countdown { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 283; } }
        
        .main-combo-btn {
            width: 100%; height: 100%; background: #fe2c55; border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 2px 8px rgba(254, 44, 85, 0.4); cursor: pointer; z-index: 2; position: relative; 
        }
        .main-combo-btn::after {
            content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 50%; border: 2px solid rgba(254, 44, 85, 0.6); opacity: 0; z-index: -1; pointer-events: none;
        }
        .main-combo-btn.ripple-active::after { animation: rippleEffect 0.4s ease-out; }
        @keyframes rippleEffect {
            0% { transform: scale(1); opacity: 0.8; border-width: 4px; }
            100% { transform: scale(1.6); opacity: 0; border-width: 0px; }
        }
        .main-combo-btn:active { transform: scale(0.95); }
        .combo-text { font-size: 5vw; font-weight: bold; line-height: 1.1; text-align: center; color: #fff; white-space: nowrap; }
        .combo-badge {
           display: none; position: absolute; top: -6vw; right: 4.5vw; background: #fe2c55; color: #fff; font-family: var(--font-num); font-size: 3vw; font-weight: bold; padding: 0 1.5vw; min-width: 8vw; text-align: center; height: 4.5vw; line-height: 4.5vw; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.3); z-index: 3;
        }

        /* --- 3.8 悬浮连击按钮 (右下角大额专用) --- */
        .floating-combo-btn {
            position: absolute;
            bottom: calc(18vw + var(--safe-bottom)); 
            right: 7vw;
            width: 18vw; height: 18vw; /* 略大一点 */
            pointer-events: auto;
            z-index: 48;
            display: none; /* 默认隐藏 */
            touch-action: none;
            
            /* 必须加入以下重置代码，覆盖通用样式 */
            top: auto !important;   
            left: auto !important;  
            transform: none !important; 
        }
        .floating-combo-btn.active { display: flex; }

        /* --- 3.9 进场提示条 --- */
        .entry-track {
            position: absolute;
            bottom: calc(41.5% + var(--safe-bottom)); /* 放在弹幕上方 */
            left: 0;
            width: 100%;
            height: 10vw;
            pointer-events: none;
        }

        .entry-banner {
            position: absolute;
            left: -80vw; /* 初始在左侧屏幕外 */
            height: 5.8vw; /* 依照要求定高 */
            width: auto; /* 保持比例 */
            object-fit: contain;
            animation: slideInEntry 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
        }

        .entry-banner.slide-out {
            animation: slideOutEntry 0.3s ease-in forwards;
        }

        @keyframes slideInEntry {
            to { left: 3.08%; }
        }

        @keyframes slideOutEntry {
            to { opacity: 0; transform: translateY(-5vw); }
        }

        /* --- 3.10 点赞飘动特效 (CSS新增) --- */
        /* 父容器控制垂直运动 (匀速或缓动) */
        .fly-emoji-wrapper {
            position: absolute;
            pointer-events: none;
            width: 10vw;
            height: 10vw;
            display: flex;
            justify-content: center;
            align-items: center;
            animation: flyUp 1.5s cubic-bezier(0.42, 0, 0.58, 1) forwards;
            opacity: 0;
        }

        /* 子元素控制水平摇摆 (正弦波模拟) */
        .fly-emoji-inner {
            font-size: 8vw;
            /* 使用 ease-in-out 让摇摆更自然 */
            animation: sway 1.5s ease-in-out infinite; 
            filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
            opacity: 0.7;  /* 数值范围 0.0 到 1.0，越小越透明 */
        }

        @keyframes flyUp {
            0% { transform: translateY(0) scale(0.6); opacity: 0; }
            10% { opacity: 1; transform: translateY(-20px) scale(1.1); } /* 弹起效果 */
            100% { transform: translateY(-60vh) scale(1); opacity: 0; } /* 飞出屏幕 */
        }

        @keyframes sway {
            0% { transform: translateX(0) rotate(0deg); }
            25% { transform: translateX(20px) rotate(10deg); }
            50% { transform: translateX(0) rotate(0deg); }
            75% { transform: translateX(-20px) rotate(-10deg); }
            100% { transform: translateX(0) rotate(0deg); }
        }

        /* =========================================
           4. 高级控制台样式 (NEW - 扩展功能)
           ========================================= */
        
        .console-panel {
            position: fixed; 
            bottom: 0; 
            left: 0; 
            width: 100%; 
            height: 75vh;
            background: var(--console-bg);
            backdrop-filter: blur(20px); 
            -webkit-backdrop-filter: blur(20px);
            border-radius: 20px 20px 0 0;
            box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
            transform: translateY(110%);
            transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
            display: flex; 
            flex-direction: column;
            pointer-events: auto;
            color: var(--console-text);
            z-index: 100; /* 内部确保层级 */
        }
        .console-panel.active { 
            transform: translateY(0); 
        }
        
        .console-header {
            padding: 20px; 
            font-size: 18px; 
            font-weight: 600; 
            text-align: center;
            border-bottom: 1px solid var(--console-border);
            position: relative;
            /* 新增 Flex 布局确保垂直居中 */
            display: flex;
            justify-content: center;
            align-items: center;

        }

/* --- [新增] 个人中心贵族样式 --- */
        .noble-btn {
            color: #FFD700;           /* 贵族金 */
            margin-left: 15px;        /* 保持间距 */
            cursor: pointer;          /* 手型光标 */
            font-weight: bold;        /* 加粗 */
            text-shadow: 0 0 8px rgba(255, 215, 0, 0.6); /* 辉光特效 */
            font-size: inherit;       /* 跟随父级字体大小 */
            transition: opacity 0.2s, transform 0.1s;
        }
        .noble-btn:hover {
            opacity: 0.9;
        }
        .noble-btn:active {
            opacity: 0.7;
            transform: scale(0.95);   /* 点击微缩反馈 */
        }



        .console-close { 
            position: absolute; 
            right: 20px; 
            top: 50%; 
            transform: translateY(-50%); 
            opacity: 0.6; 
            cursor: pointer; 
            padding: 10px; 
            font-size: 20px;
        }

        .console-content {
            flex: 1; 
            overflow-y: auto; 
            padding: 20px;
            display: flex; 
            flex-direction: column; 
            gap: 24px;
            -webkit-overflow-scrolling: touch;
        }

        .config-section { 
            display: flex; 
            flex-direction: column; 
            gap: 12px; 
        }
        
        .section-title { 
            font-size: 14px; 
            color: var(--console-label); 
            text-transform: uppercase; 
            letter-spacing: 1px; 
            margin-bottom: 4px; 
        }
        
        .form-row { 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            gap: 15px; 
        }
        .form-label { 
            font-size: 15px; 
            color: #ddd; 
            white-space: nowrap; 
        }
        
        /* 输入框样式 */
        .console-input {
            background: rgba(255,255,255,0.05); 
            border: 1px solid var(--console-border);
            border-radius: 8px; 
            color: #fff; 
            padding: 10px 12px; 
            font-size: 14px;
            width: 100%; 
            transition: border-color 0.2s;
        }
        .console-input:focus { 
            border-color: var(--c-primary); 
            background: rgba(255,255,255,0.08); 
        }

        /* 上传组件 */
        .upload-trigger {
            width: 60px; height: 60px; 
            border-radius: 50%; 
            background: rgba(255,255,255,0.1);
            border: 1px dashed rgba(255,255,255,0.3); 
            display: flex; 
            justify-content: center; 
            align-items: center;
            cursor: pointer; 
            position: relative; 
            overflow: hidden;
        }
        .upload-trigger.rect {
            border-radius: 8px;
            width: 100px; /* 宽一点适合视频预览 */
        }
        
        .upload-trigger img, .upload-trigger video { 
            width: 100%; 
            height: 100%; 
            object-fit: cover; 
        }
        .upload-icon { 
            font-size: 20px; 
            opacity: 0.5; 
            color: #fff;
        }
        .hidden-file-input { 
            display: none; 
        }

        /* 复选框组 */
   .checkbox-group { 
    display: flex; 
    flex-wrap: nowrap;         /* 禁止换行，强制在同一行 */
    gap: 6px;                  /* 四个开关之间的间距调小 */
    overflow-x: auto;          /* 万一屏幕太窄，允许横向微调 */
}
       .checkbox-item {
    display: flex; 
    align-items: center; 
    gap: 4px;                  /* 缩小框和文字之间的距离 */
    font-size: 12px;           /* 字体调小 */
    background: rgba(255,255,255,0.05); 
    padding: 4px 8px;          /* 显著缩小内边距 */
    border-radius: 4px; 
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
    white-space: nowrap;       /* 强制文字不换行 */
}
        .checkbox-item:hover {
            border-color: rgba(255,255,255,0.2);
        }
  .checkbox-item input { 
    accent-color: var(--c-primary); 
    width: 14px;               /* 勾选框变小 */
    height: 14px;              /* 勾选框变小 */
    margin: 0;                 /* 移除默认边距 */
}

        .console-btn {
            background: var(--c-primary);
            color: white;
            border: none;
            padding: 0 15px;
            height: 40px;
            border-radius: 8px;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
        }
        .console-btn:active {
            opacity: 0.8;
        }

        /* 上帝模式下拉框 (God UI) - 原始样式保留 */
        .god-dropdown {
            position: absolute; 
            background: #222; 
            border: 1px solid #444; 
            border-radius: 8px;
            max-height: 200px; 
            width: 80px; 
            overflow-y: auto; 
            box-shadow: 0 4px 12px rgba(0,0,0,0.5);
            z-index: 110; 
            pointer-events: auto; 
            padding: 5px;
        }
        .god-option { 
            padding: 8px; 
            text-align: center; 
            font-family: var(--font-num); 
            color: #ccc; 
            cursor: pointer; 
            border-radius: 4px;
        }
        .god-option:hover { 
            background: #333; 
            color: #fff; 
        }

        /* --- 可视化图标选择器 (Visual Icon Selector) --- */
        .visual-selector-popup {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 90vw;
            max-width: 320px;
            max-height: 60vh;
            background: #25252b;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 12px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.8);
            z-index: 200;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            animation: popIn 0.2s ease-out;
            
            /* 关键修复：允许点击和滑动，防止穿透 */
            pointer-events: auto;
        }
        
        @keyframes popIn {
            from { transform: translate(-50%, -45%); opacity: 0; }
            to { transform: translate(-50%, -50%); opacity: 1; }
        }

        .selector-header {
            padding: 12px 16px;
            background: rgba(0,0,0,0.2);
            border-bottom: 1px solid rgba(255,255,255,0.05);
            font-size: 14px;
            font-weight: 600;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .selector-grid {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 8px;
            -webkit-overflow-scrolling: touch;
        }

        .selector-item {
            aspect-ratio: 1;
            border-radius: 4px;
            background: rgba(255,255,255,0.05);
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            transition: background 0.1s;
        }
        .selector-item:hover {
            background: rgba(255,255,255,0.15);
        }
        .selector-item img {
            width: 80%;
            height: 80%;
            object-fit: contain;
        }

        /* 编辑状态高亮 */
        .being-edited { 
            outline: 2px solid var(--c-primary); 
            outline-offset: 2px; 
        }
        
        .hidden-feature-hint {
            text-align: center;
            font-size: 12px;
            color: #666;
            padding: 20px 0;
            margin-top: auto;
        }





/* --- 优化后的弹幕速度控制框 (高级丝滑版) --- */

:root {
  --primary-color: #fe2c55; /* 抖音红/品牌色 */
  --glass-bg: rgba(30, 30, 35, 0.85); /* 深色玻璃底 */
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-secondary: rgba(255, 255, 255, 0.65);
}

.speed-control-popup {
    position: absolute;
    /* 位置保持不变，适配原布局 */
    top: calc(13% + var(--safe-top)); 
    left: 15vw; 
    
    width: 50vw; 
    /* 背景升级：加入细微渐变，模拟顶光源，更有立体感 */
    background: linear-gradient(
        145deg, 
        rgba(40, 40, 45, 0.95) 0%, 
        rgba(20, 20, 25, 0.98) 100%
    );
    
    /* 极致毛玻璃 */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    /* 边框升级：更细腻的内描边 */
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.2); /* 顶部高光 */
    border-radius: 18px;
    padding: 20px 16px;
    
    z-index: 120; 
    pointer-events: auto;
    
    /* 阴影升级：多层阴影营造悬浮感 */
    box-shadow: 
        0 10px 30px -10px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(0, 0, 0, 0.2), /* 黑色外描边增加对比 */
        inset 0 1px 0 rgba(255, 255, 255, 0.1); /* 内部顶部高光 */
    
    /* 动画原点：保持在福袋方向 */
    transform-origin: -5% 20%; 
    
    /* 动画曲线优化：使用更平滑的弹簧物理曲线 */
    /* 这种曲线比原来的更顺滑，回弹更自然 */
    animation: smoothPopIn 0.45s cubic-bezier(0.25, 1, 0.3, 1) forwards;
    
    /* 初始状态防止闪烁 */
    opacity: 0;
    will-change: transform, opacity;
}

/* 丝滑弹出动画 */
@keyframes smoothPopIn {
    0% {
        opacity: 0;
        /* 从更小的比例开始，且带一点旋转，看起来像是“甩”出来的 */
        transform: scale(0.4) translate(-30px, -10px);
    }
    60% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }
}

.speed-title {
    font-size: 3.2vw; /* 稍微调小一点点显得更精致 */
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: 1.5px; /* 增加字间距，更有呼吸感 */
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    /* 禁止换行 */
    white-space: nowrap;
}

.speed-btn-group {
    display: flex;
    justify-content: space-between;
    gap: 10px; /* 间距拉开一点 */
    position: relative;
    z-index: 2;
}

.speed-btn {
    flex: 1; 
    position: relative;
    /* 默认背景：半透明白，很浅 */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent; /* 预留边框位置 */
    
    color: #e0e0e0;
    padding: 10px 0; 
    border-radius: 10px;
    
    font-size: 3.6vw;
    font-weight: 600;
    letter-spacing: 0.5px;
    
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden; /* 用于内部光效 */
}

/* 按钮悬停态 (如果是PC端调试能看到，移动端主要是点击) */
.speed-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.12);
}

/* 选中态：高级发光质感 */
.speed-btn.active {
    /* 渐变色背景 */
    background: linear-gradient(135deg, #fe2c55 0%, #d61e42 100%);
    color: #ffffff;
    
    /* 边框高光 */
    border-color: rgba(255, 255, 255, 0.3);
    
    /* 复合阴影：红色辉光 + 内部立体投影 */
    box-shadow: 
        0 4px 15px rgba(254, 44, 85, 0.35),
        inset 0 1px 1px rgba(255, 255, 255, 0.3),
        inset 0 -1px 2px rgba(0, 0, 0, 0.1);
        
    transform: translateY(-1px); /* 微微上浮 */
}

/* 点击反馈：Q弹收缩 */
.speed-btn:active {
    transform: scale(0.94) translateY(0);
    filter: brightness(0.9); /* 按压变暗 */
    transition-duration: 0.1s; /* 按下要快 */
}

/* 可选：为选中按钮添加一个微光扫过动画，增加活跃度 */
.speed-btn.active::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255,255,255,0.2), 
        transparent
    );
    transform: skewX(-20deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0%, 60% { left: -100%; }
    100% { left: 200%; }
}