/**
 * 星徽系统，功能丰富、可自由拓展的原创多功能建站系统
 * 作者：浪晓回
 * QQ：3153472479
 * 倡导支持正版程序，拒绝盗版、破解源码，规避后门、加密脚本、程序锁带来的服务器故障与安全风险。
 * 本套代码全部独立编写，不抄袭其他主题源码。
 */

/* ============================================================
   自研 CSS 组件系统（星徽 UI）· 播放器组件
   - 前缀 xp-*：DOM 由 player.js 生成，本文件只负责样式
   - 设计令牌沿用 base.css 的 --c-* 体系；暗色用 [data-theme="dark"] 覆盖
   - 状态修饰符统一：.is-on（选中/激活）、.is-open（展开）
   - 组件：xp 容器 / 控制条 / 倍速菜单 / 画中画 / 右键菜单 / 结束层
   ============================================================ */
/* =========================================================
   全新自定义播放器（player.js 生成，xp- 前缀）
   视频：直角画面 + 实底深色控制条 + 品牌蓝纯色进度（正常播放器样式）
   音频：横向卡片式控制条
   ========================================================= */
.xp{position:relative;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation;}
.xp button{-webkit-tap-highlight-color:transparent;touch-action:manipulation;font-family:inherit;}
.xp video{display:block;width:100%;height:100%;object-fit:contain;background:#000;border-radius:0;}
/* 修复：article.css 的 .article-content video{margin:20px auto}（优先级 0,1,1，且在本文件之后加载）
   会把 video 在固定高度 .xp-video 容器内下推 20px——顶部露出 20px 黑底、底部画面被 overflow:hidden 裁掉。
   注意 .xp-video>video 同为 (0,1,1)，会因加载顺序落败；必须用 .xp.xp-video>video（0,2,1）才能稳赢，与加载顺序无关。 */
.xp.xp-video>video{width:100%;height:100%;margin:0;object-fit:contain;}
/* 视频容器：直角无阴影、限宽居中、16:9 恒定（正常播放器样式） */
.xp-video{position:relative;aspect-ratio:16/9;width:100%;max-width:860px;margin:18px auto;background:#000;overflow:hidden;}
.xp.hide-cursor{cursor:none;}

/* 首次播放按钮：朴素深色圆（无毛玻璃、无放大动画） */
.xp-big{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:2;transition:opacity .2s ease,visibility .2s ease;}
.xp-big.hide{opacity:0;visibility:hidden;pointer-events:none;}
.xp-big-btn{width:58px;height:58px;border-radius:50%;background:rgba(0,0,0,.6);border:none;display:flex;align-items:center;justify-content:center;color:#fff;box-shadow:0 4px 14px rgba(0,0,0,.3);transition:background .15s ease;}
.xp-big-btn svg{width:30px;height:30px;margin-left:3px;}
.xp-big:hover .xp-big-btn{background:rgba(0,0,0,.78);}

/* 控制条：实底深色条（正常播放器做法，无渐变） */
.xp-bar{position:absolute;left:0;right:0;bottom:0;z-index:3;display:flex;align-items:center;gap:4px;opacity:0;visibility:hidden;transform:translateY(6px);transition:opacity .18s ease,transform .18s ease,visibility .18s ease;}
.xp-bar.show{opacity:1;visibility:visible;transform:none;}
.xp-video .xp-bar{background:rgba(10,10,12,.82);padding:7px 10px;}
.xp-play{width:34px;height:34px;border:none;background:transparent;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:4px;flex-shrink:0;transition:background .12s ease;}
.xp-play:hover{background:rgba(255,255,255,.12);}
.xp-play svg{width:20px;height:20px;}
.xp-time{font-size:12.5px;color:#fff;font-variant-numeric:tabular-nums;flex-shrink:0;white-space:nowrap;letter-spacing:.2px;}
.xp-track{flex:1;height:3px;margin:0 10px;background:rgba(255,255,255,.25);border-radius:2px;position:relative;cursor:pointer;transition:height .12s ease;touch-action:none;}
/* 扩大触控/点击热区（视觉不变，手机易拖） */
.xp-track::before{content:"";position:absolute;left:-10px;right:-10px;top:-13px;bottom:-13px;}
.xp-track:hover{height:6px;}
.xp-buf{position:absolute;left:0;top:0;bottom:0;width:0;background:rgba(255,255,255,.3);border-radius:2px;}
.xp-prog{position:absolute;left:0;top:0;bottom:0;width:0;background:var(--c-primary,#2563eb);border-radius:2px;}
/* 进度圆点：直接用原图放大（contain 完整显示，无底色无描边） */
.xp-dot{position:absolute;right:-16px;top:50%;transform:translateY(-50%);width:32px;height:32px;background:url('/images/progress-thumb.png') center/contain no-repeat;filter:drop-shadow(0 1px 3px rgba(0,0,0,.5));opacity:1;transition:transform .12s ease;}
.xp-track:hover .xp-dot,.xp-track:active .xp-dot{transform:translateY(-50%) scale(1.15);}
.xp-vol{width:30px;height:30px;border:none;background:transparent;color:rgba(255,255,255,.9);display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:4px;flex-shrink:0;transition:background .12s ease;}
.xp-vol:hover{background:rgba(255,255,255,.12);}
.xp-vol svg{width:18px;height:18px;}
.xp-vol-range{width:70px;accent-color:var(--c-primary,#2563eb);cursor:pointer;height:3px;}
.xp-speed{height:28px;min-width:40px;padding:0 6px;border:none;background:transparent;color:rgba(255,255,255,.9);font-size:11.5px;font-weight:600;font-family:inherit;cursor:pointer;border-radius:4px;flex-shrink:0;font-variant-numeric:tabular-nums;transition:background .12s ease;}
.xp-speed:hover{background:rgba(255,255,255,.12);}
.xp-speed.cur{color:#8ab4ff;}
/* B站式倍速悬浮菜单 */
.xp-speed-wrap{position:relative;flex-shrink:0;}
.xp-speed-menu{position:absolute;bottom:calc(100% + 8px);right:50%;transform:translate(50%,6px);min-width:78px;background:rgba(15,23,42,.94);border:1px solid rgba(255,255,255,.08);border-radius:8px;padding:5px;display:flex;flex-direction:column;box-shadow:0 8px 24px rgba(0,0,0,.4);opacity:0;visibility:hidden;transition:opacity .15s ease,transform .15s ease,visibility .15s ease;z-index:6;}
.xp-speed-wrap:hover .xp-speed-menu,.xp-speed-wrap.is-open .xp-speed-menu{opacity:1;visibility:visible;transform:translate(50%,0);}
.xp-speed-menu button{border:none;background:none;color:rgba(255,255,255,.88);font-size:12.5px;font-weight:600;font-family:inherit;padding:8px 16px;border-radius:6px;cursor:pointer;text-align:center;white-space:nowrap;font-variant-numeric:tabular-nums;transition:background .12s ease,color .12s ease;}
.xp-speed-menu button:hover{background:rgba(255,255,255,.12);color:#fff;}
.xp-speed-menu button.is-on{color:#8ab4ff;font-weight:700;}
/* 倍速切换顶部提示（B站式，淡入淡出） */
.xp-ratetip{position:absolute;top:14px;left:50%;transform:translate(-50%,-6px);background:rgba(10,10,12,.85);color:#fff;font-size:13px;font-weight:600;line-height:1;padding:8px 15px;border-radius:999px;opacity:0;pointer-events:none;transition:opacity .18s ease,transform .18s ease;z-index:7;font-variant-numeric:tabular-nums;}
.xp-ratetip.show{opacity:1;transform:translate(-50%,0);}
.xp-fs,.xp-pip{width:32px;height:32px;border:none;background:transparent;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;border-radius:4px;flex-shrink:0;transition:background .12s ease;}
.xp-fs:hover,.xp-pip:hover{background:rgba(255,255,255,.12);}
.xp-fs svg,.xp-pip svg{width:18px;height:18px;}

/* 直播流 / 加载失败 */
.xp-live .xp-track,.xp-live .xp-dot{cursor:default;opacity:.45;}
.xp-live .xp-buf{display:none;}
.xp-error .xp-track{opacity:.4;}

/* 音频：横向卡片式控制条 */
.xp-audio{background:var(--c-card);border:1px solid var(--c-border);border-radius:12px;padding:13px 18px;margin:18px 0;box-shadow:var(--shadow-sm);}
.xp-audio audio{display:none;}
.xp-audio .xp-bar{position:static;opacity:1;visibility:visible;transform:none;background:none;padding:0;gap:12px;}
.xp-audio .xp-play{width:46px;height:46px;background:var(--c-primary,#2563eb);color:#fff;box-shadow:none;}
.xp-audio .xp-play:hover{background:var(--c-primary,#2563eb);opacity:.88;}
.xp-audio .xp-play svg{width:20px;height:20px;margin-left:2px;}
.xp-audio .xp-time{color:var(--c-text-3);text-shadow:none;font-size:12px;}
.xp-audio .xp-track{height:5px;margin:0;background:var(--c-border);}
.xp-audio .xp-track:hover{height:6px;}
.xp-audio .xp-buf{background:var(--c-primary-soft);}
.xp-audio .xp-vol{color:var(--c-text-3);}
.xp-audio .xp-vol:hover,.xp-audio .xp-speed:hover{background:var(--c-primary-soft);}
.xp-audio .xp-speed{color:var(--c-text-3);}

/* 全屏适配 */
.xp.xp-fs-on{display:flex;align-items:center;justify-content:center;background:#000;border-radius:0;box-shadow:none;}
.xp.xp-fs-on video{max-width:100%;max-height:100vh;}

/* 缓冲 spinner */
.xp-spin{position:absolute;inset:0;display:none;align-items:center;justify-content:center;z-index:4;pointer-events:none;}
.xp-spin.show{display:flex;}
.xp-spin span{width:46px;height:46px;border-radius:50%;border:3px solid rgba(255,255,255,.22);border-top-color:#fff;animation:xp-rot .8s linear infinite;}
@keyframes xp-rot{to{transform:rotate(360deg);}}

/* 中央播放/暂停闪现反馈（纯图标淡入，无圆底） */
.xp-flash{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:58px;height:58px;color:#fff;display:flex;align-items:center;justify-content:center;z-index:5;pointer-events:none;filter:drop-shadow(0 2px 8px rgba(0,0,0,.6));animation:xp-flash-fade .64s ease forwards;}
.xp-flash svg{width:26px;height:26px;}
@keyframes xp-flash-fade{0%{opacity:0;transform:translate(-50%,-50%) scale(.72);}22%{opacity:1;transform:translate(-50%,-50%) scale(1);}72%{opacity:1;}100%{opacity:0;transform:translate(-50%,-50%) scale(1.1);}}

/* 进度条 hover 时间气泡 */
.xp-tip{position:absolute;bottom:14px;left:0;transform:translateX(-50%);background:rgba(10,10,12,.9);color:#fff;font-size:11px;line-height:1;padding:5px 8px;border-radius:4px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .12s ease;z-index:4;font-variant-numeric:tabular-nums;}
.xp-track:hover .xp-tip{opacity:1;}
.xp-audio .xp-tip{bottom:auto;top:-30px;background:var(--c-primary);}

/* 统计信息面板（桌面右键菜单开启，实时刷新） */
.xp-stats{position:absolute;top:10px;left:10px;z-index:8;min-width:220px;max-width:calc(100% - 20px);background:rgba(8,10,14,.88);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:10px 12px;color:#dbe4f0;font-size:12px;line-height:1.6;box-shadow:0 8px 24px rgba(0,0,0,.35);display:none;}
.xp-stats.show{display:block;}
.xp-stats-h{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:5px;}
.xp-stats-h span{font-weight:700;color:#fff;font-size:12.5px;letter-spacing:.3px;}
.xp-stats-x{border:none;background:none;color:rgba(255,255,255,.55);cursor:pointer;width:22px;height:22px;display:flex;align-items:center;justify-content:center;padding:0;border-radius:4px;flex-shrink:0;}
.xp-stats-x:hover{background:rgba(255,255,255,.14);color:#fff;}
.xp-stats-x svg{width:13px;height:13px;}
.xp-stats-r{display:flex;justify-content:space-between;align-items:baseline;gap:16px;font-variant-numeric:tabular-nums;}
.xp-stats-r span{color:rgba(255,255,255,.5);flex-shrink:0;letter-spacing:.4px;}
.xp-stats-r b{color:#fff;font-weight:600;text-align:right;}

/* 窄屏 / 手机 */
@media (max-width:640px){
    .xp-vol,.xp-vol-range{display:none;}
    .xp-pip{display:none!important;}
    .xp-time{font-size:11px;}
    .xp-big-btn{width:60px;height:60px;}
    .xp-big-btn svg{width:28px;height:28px;margin-left:2px;}
    .xp-video{max-width:100%;margin:14px 0;}
    .xp-video .xp-bar{padding:7px 8px;gap:3px;}
    .xp-play{width:38px;height:38px;}
    .xp-play svg{width:20px;height:20px;}
    .xp-speed{height:32px;min-width:40px;font-size:12px;padding:0 6px;}
    /* 倍速菜单：横向单行、铺播放器宽居中（菜单锚定控制条），避免纵向超高/横向越界被 overflow 裁剪 */
    .xp-speed-wrap{position:static;}
    .xp-speed-menu{left:8px;right:8px;bottom:calc(100% + 6px);transform:translateY(6px);min-width:0;flex-direction:row;justify-content:center;gap:2px;padding:4px;}
    .xp-speed-wrap:hover .xp-speed-menu,.xp-speed-wrap.is-open .xp-speed-menu{transform:translateY(0);}
    .xp-speed-menu button{padding:7px 9px;font-size:12px;}
    .xp-fs{width:38px;height:38px;}
    .xp-fs svg{width:17px;height:17px;}
    .xp-track{height:5px;margin:0 8px;}
    .xp-dot{width:24px;height:24px;right:-12px;}
    .xp-end-btn{width:64px;height:64px;}
    .xp-end-btn svg{width:30px;height:30px;}
    .xp-seekflash.back{left:7%;}
    .xp-seekflash.fwd{right:7%;}
}

/* 超窄屏：控制条不挤压换行 */
@media (max-width:380px){
    .xp-time{font-size:10px;letter-spacing:0;}
    .xp-speed{min-width:36px;padding:0 4px;font-size:11.5px;}
    .xp-speed-menu button{padding:6px 6px;font-size:11.5px;}
    .xp-video .xp-bar{gap:2px;padding:6px 6px;}
}

/* 触屏设备：加大点击热区与拖点 */
@media (pointer:coarse){
    .xp-play,.xp-fs{width:40px;height:40px;}
    .xp-track{height:6px;}
    .xp-dot{width:28px;height:28px;right:-14px;}
}

/* =========================================================
   v117 播放器增强：结束重播层 / 双击快进指示 / 桌面右键菜单
   ========================================================= */

/* 播放结束：中央重播层（半透明压暗 + 精致圆钮，不拦截控制条点击） */
.xp-end{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;background:rgba(6,9,16,.52);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .25s ease,visibility .25s ease;}
.xp-end.show{opacity:1;visibility:visible;}
.xp-end-btn{pointer-events:auto;cursor:pointer;width:76px;height:76px;border-radius:50%;background:rgba(15,23,42,.68);border:1px solid rgba(255,255,255,.16);display:flex;align-items:center;justify-content:center;color:#fff;box-shadow:0 12px 36px rgba(0,0,0,.42),inset 0 1px 0 rgba(255,255,255,.14);transition:transform .18s ease,background .18s ease,border-color .18s ease;}
.xp-end-btn svg{width:34px;height:34px;}
.xp-end-btn:hover{background:var(--c-primary,#2563eb);border-color:transparent;transform:scale(1.07);}
.xp-end-btn:active{transform:scale(.97);}
.xp-end-tip{pointer-events:auto;color:rgba(255,255,255,.92);font-size:13px;font-weight:600;letter-spacing:.5px;text-shadow:0 1px 4px rgba(0,0,0,.55);}

/* 双击快退/快进：两侧浮现「旋转箭头 + 10s」指示 */
.xp-seekflash{position:absolute;top:50%;transform:translateY(-50%);z-index:5;display:flex;flex-direction:column;align-items:center;gap:4px;color:#fff;pointer-events:none;animation:xp-seekfade .6s ease forwards;}
.xp-seekflash.back{left:11%;}
.xp-seekflash.fwd{right:11%;}
.xp-seekflash svg{width:34px;height:34px;filter:drop-shadow(0 2px 6px rgba(0,0,0,.6));}
.xp-seekflash i{font-style:normal;font-size:12px;font-weight:700;font-variant-numeric:tabular-nums;text-shadow:0 1px 4px rgba(0,0,0,.6);}
@keyframes xp-seekfade{0%{opacity:0;transform:translateY(-50%) scale(.8);}25%{opacity:1;transform:translateY(-50%) scale(1);}70%{opacity:1;}100%{opacity:0;transform:translateY(-50%) scale(1.06);}}

/* 画中画按钮激活态 */
.xp-pip.is-on{color:#8ab4ff;}

/* 桌面右键菜单：深色玻璃面板 + 图标条目 + 倍速子菜单 */
.xp-ctx{position:fixed;left:0;top:0;z-index:99999;min-width:198px;background:rgba(17,22,34,.96);border:1px solid rgba(255,255,255,.09);border-radius:12px;padding:6px;box-shadow:0 18px 48px rgba(0,0,0,.45);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);display:none;animation:xp-ctx-in .14s ease;}
.xp-ctx.show{display:block;}
@keyframes xp-ctx-in{from{opacity:0;transform:scale(.96) translateY(4px);}to{opacity:1;transform:none;}}
.xp-ctx-it{display:flex;align-items:center;gap:10px;width:100%;height:34px;padding:0 10px;border:none;background:none;border-radius:8px;color:rgba(255,255,255,.92);font-size:13px;font-family:inherit;cursor:pointer;text-align:left;white-space:nowrap;transition:background .12s ease,color .12s ease;}
.xp-ctx-it:hover{background:rgba(255,255,255,.09);color:#fff;}
.xp-ctx-it .ic{width:17px;height:17px;display:inline-flex;flex-shrink:0;color:rgba(255,255,255,.78);}
.xp-ctx-it:hover .ic{color:#fff;}
.xp-ctx-it .ic svg{width:17px;height:17px;}
.xp-ctx-it .lb{display:inline-flex;align-items:center;}
.xp-ctx-it .ck{margin-left:auto;width:15px;height:15px;display:inline-flex;flex-shrink:0;color:transparent;transition:color .12s ease;}
.xp-ctx-it .ck svg{width:15px;height:15px;}
.xp-ctx-it.is-on .ck{color:#8ab4ff;}
.xp-ctx-it[disabled]{opacity:.38;cursor:default;}
.xp-ctx-it[disabled]:hover{background:none;color:rgba(255,255,255,.92);}
.xp-ctx-sep{height:1px;margin:5px 8px;background:rgba(255,255,255,.08);}

/* 右键菜单 · 倍速子菜单（默认向右弹出，靠近右缘时 .flip 向左） */
.xp-ctx-has{position:relative;}
.xp-ctx-has>.xp-ctx-it .cur{color:#8ab4ff;font-weight:700;font-variant-numeric:tabular-nums;}
.xp-ctx-has>.xp-ctx-it .ar{width:13px;height:13px;margin-left:10px;display:inline-flex;opacity:.6;flex-shrink:0;}
.xp-ctx-has>.xp-ctx-it .ar svg{width:13px;height:13px;}
.xp-ctx-sub{position:absolute;left:calc(100% + 6px);top:-6px;min-width:88px;background:rgba(17,22,34,.96);border:1px solid rgba(255,255,255,.09);border-radius:10px;padding:5px;box-shadow:0 14px 40px rgba(0,0,0,.45);opacity:0;visibility:hidden;transform:translateX(-4px);transition:opacity .14s ease,transform .14s ease,visibility .14s ease;}
.xp-ctx-has:hover .xp-ctx-sub,.xp-ctx-has.is-open .xp-ctx-sub{opacity:1;visibility:visible;transform:none;}
.xp-ctx.flip .xp-ctx-sub{left:auto;right:calc(100% + 6px);transform:translateX(4px);}
.xp-ctx.flip .xp-ctx-has:hover .xp-ctx-sub,.xp-ctx.flip .xp-ctx-has.is-open .xp-ctx-sub{transform:none;}
.xp-ctx-sub button{display:block;width:100%;border:none;background:none;color:rgba(255,255,255,.9);font-size:12.5px;font-weight:600;font-family:inherit;padding:7px 14px;border-radius:7px;cursor:pointer;text-align:center;white-space:nowrap;font-variant-numeric:tabular-nums;transition:background .12s ease,color .12s ease;}
.xp-ctx-sub button:hover{background:rgba(255,255,255,.1);color:#fff;}
.xp-ctx-sub button.is-on{color:#8ab4ff;}

