/* ==================================================
   全局重置与基础变量 (Global Reset & Basic Variables)
   ================================================== */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --bg-dark: #0f0f11;
    --glass-bg: rgba(25, 25, 30, 0.65);
    /* 毛玻璃底色，增强质感 */
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --radius-sm: 3px;
    --radius-md: 8px;
    --radius-pill: 50px;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    /* 防止页面出现滚动条，保持全屏沉浸感 */
    -webkit-tap-highlight-color: transparent;
    /* 去除手机点击高亮，提升触控体验 */
}

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

/* ==================================================
   SVG 图标通用样式 (SVG Icon Styles)
   ================================================== */
.ui-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
    filter: invert(1);
    /* 反转成白色，适配深色背景 */
}

.icon-btn .ui-icon {
    margin-right: 0;
    width: 22px;
    height: 22px;
}

/* ==================================================
   登录页 (Login Page Styles)
   ================================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a24 0%, #000000 100%);
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 400px;
    box-sizing: border-box;
}

.login-box h2 {
    margin-top: 0;
    font-weight: 600;
}

.login-box input {
    width: 100%;
    padding: 14px;
    margin: 20px 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-box button {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--radius-pill);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.login-box button:hover {
    background: var(--primary-hover);
}

.login-box button:active {
    transform: scale(0.98);
}

.error-msg {
    color: #ff4d4f;
    font-size: 14px;
    margin-top: 15px;
    min-height: 20px;
}

/* ==================================================
   全局轻提示 (Toast Notification)
   ================================================== */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 167, 69, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    z-index: 9999;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ==================================================
   沉浸式播放器核心 (Player Wrapper & Interaction)
   ================================================== */
.player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.interaction-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#joinPlayBtn {
    font-size: 20px;
    font-weight: bold;
    padding: 20px 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.4);
    transition: background 0.3s, transform 0.2s;
}

#joinPlayBtn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ==================================================
   顶部与底部悬浮控制栏 (电脑端默认样式)
   ================================================== */
.overlay-top-panel,
.modern-controls {
    position: absolute;
    left: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    box-sizing: border-box;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.overlay-top-panel {
    top: 20px;
    transform: translateY(-10px);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.modern-controls {
    bottom: 20px;
    transform: translateY(10px);
}

.overlay-top-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.modern-controls.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ==================================================
   按钮与控件细节 (Buttons & Badges)
   ================================================== */
button.ctrl-btn,
button.claim-btn,
.upload-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    transition: background 0.2s, border 0.2s;
}

button.ctrl-btn:hover:not(:disabled),
button.claim-btn:hover,
.upload-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

button.ctrl-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button.icon-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

button.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tag {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
}

.tag-gray {
    background: rgba(255, 255, 255, 0.1);
}

.tag-green {
    background: rgba(40, 167, 69, 0.8);
}

.tag-blue {
    background: rgba(0, 123, 255, 0.8);
}

.tag-dark {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

/* ==================================================
   进度条定制 (Custom Progress Slider)
   ================================================== */
.oneline {
    display: flex;
    align-items: center;
    /* 垂直居中 */
    justify-content: center;

    width: 98%;
    /* 宽度撑满父容器 */
    gap: 10px;
    /* 进度条和时间之间的间距 */
}

.progress-bar {

    display: inline-block;
    height: 6px;
    cursor: pointer;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-pill);
    margin-bottom: 20px;
    outline: none;
    flex: 1;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.8);
    transition: transform 0.1s;
}

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-controls,
.center-controls,
.right-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#timeDisplay {
    flex-shrink: 0;
    /* 防止在空间不足时被压缩 */
    white-space: nowrap;
    /* 确保时间不会换行 */
    align-self: center;
    font-size: 14px;
    color: var(--text-muted);
}

.right-controls label {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
}

.right-controls input[type="range"] {
    width: 70px;
    margin-left: 8px;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-pill);
}

.right-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
}

/* ==================================================
   📱 专属移动端重构排版 (双重条件：设备为手机 + 屏幕宽度 < 500px)
   核心逻辑：竖屏时解除绝对定位，采用文档流“积木堆叠”排版。
   如果手机横屏 (>500px)，则自动恢复上面写好的电脑端悬浮全屏体验！
   ================================================== */
@media (max-width: 500px) {
    .device-mobile {
        overflow-y: auto;
    }

    .device-mobile .player-wrapper {
        display: flex;
        /* 这里修复了你之前的 block，改为弹性的 column */
        flex-direction: column;
        justify-content: flex-start;
        height: auto;
        min-height: 100dvh;
        padding: 10px 0;
        background: #2a2a2a;
        /* 背景稍微亮一点，贴合 App 观感 */
    }

    /* 1. 顶部面板：解除悬浮，百分比均分 */
    .device-mobile .overlay-top-panel {
        position: static;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none;
        background: transparent;
        border: none;
        box-shadow: none;
        width: 95%;
        margin: 0 auto;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 12px 2%;
    }

    .device-mobile .upload-btn,
    .device-mobile .claim-btn {
        flex: 0 0 49%;
        padding: 14px 0;
        font-size: 14px;
        justify-content: center;
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.1);
    }

    .device-mobile .tag {
        flex: 1 1 30%;
        padding: 8px 0;
        font-size: 12px;
        justify-content: center;
    }

    /* 2. 视频区域：独立一块，限制高度防撑爆 */
    .device-mobile video {
        position: relative;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 35vh;
        margin: 20px 0;
        background: #000;
    }

    .device-mobile .interaction-overlay {
        position: absolute;
        top: 50%;
        left: 0;
        height: 35vh;
        transform: translateY(-50%);
    }

    /* 3. 底部面板：解除悬浮 */
    .device-mobile .modern-controls {
        position: static;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none;
        background: transparent;
        border: none;
        box-shadow: none;
        width: 95%;
        margin: 0 auto;
        padding: 0;
    }

    .device-mobile .progress-bar {
        height: 12px;
        margin-bottom: 25px;
    }

    .device-mobile .progress-bar::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    /* =======================================
       核心修改：底部控制区分为两排
       ======================================= */
    .device-mobile .controls-row {
        display: flex;
        flex-direction: row;
        /* 恢复成横排 */
        flex-wrap: wrap;
        /* 允许折行 */
        align-items: center;
        gap: 15px 0;
        /* 第一排和第二排之间的垂直间距 */
    }

    /* (第一排)：左侧播放按钮与时间 */
    .device-mobile .left-controls {
        width: 38%;
        /* 给左边多留点空间 */
        justify-content: flex-start;
        gap: 10px;
    }

    .device-mobile #playPauseBtn {
        padding: 12px 16px;
        border-radius: var(--radius-md);
    }

    .device-mobile #timeDisplay {
        flex-shrink: 0;
        /* 防止在空间不足时被压缩 */
        white-space: nowrap;
        /* 确保时间不会换行 */
        align-self: center;
        font-size: 12px;
        display: inline-block;
    }

    /* (第一排)：右侧四个快进控制按键 */
    .device-mobile .center-controls {
        width: 60%;
        justify-content: space-between;
        gap: 2%;
    }

    .device-mobile .center-controls button.ctrl-btn {
        flex: 1;
        padding: 12px 0;
        font-size: 13px;
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.08);
    }

    /* (第二排)：麦克风、音量条、全屏，100% 强行换到下一排 */
    .device-mobile .right-controls {
        width: 100%;
        flex-wrap: nowrap;
        /* 第二排内部不再折行 */
        gap: 2%;
        margin-top: 10px;
        /* 进一步拉开与第一排的距离 */
    }

    .device-mobile .right-controls label {
        flex: 2;
        /* 音量条占比较宽 */
        padding: 12px 10px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-md);
        box-sizing: border-box;
        justify-content: center;
    }

    .device-mobile .right-controls input[type="range"] {
        width: 60%;
    }

    .device-mobile #micBtn,
    .device-mobile #fullscreenBtn {
        flex: 1;
        /* 麦克风和全屏各占一份 */
        padding: 12px 0;
        justify-content: center;
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.08);
    }
}