/* 基础变量 + 暗黑模式 */
:root {
    --wp-vp-bg-main: #ffffff;
    --wp-vp-bg-secondary: #f8f9fa;
    --wp-vp-bg-card: #ffffff;
    --wp-vp-text-main: #333333;
    --wp-vp-text-secondary: #999999; /* 提示文字浅灰色 */
    --wp-vp-border-color: #e0e0e0;
    --wp-vp-primary: #007bff;
    --wp-vp-primary-hover: #0056b3;
    --wp-vp-active: #ff0000; /* 播放中红色 */
    --wp-vp-active-text: #ffffff;
    --wp-vp-scroll-thumb: #ccc;
    --wp-vp-scroll-track: #f5f5f5;
    --wp-vp-player-bg: #000000;
    transition: all 0.3s ease;
}
:root.wp-vp-dark {
    --wp-vp-bg-main: #121212;
    --wp-vp-bg-secondary: #1e1e1e;
    --wp-vp-bg-card: #2d2d2d;
    --wp-vp-text-main: #e0e0e0;
    --wp-vp-text-secondary: #777777; /* 暗黑模式提示文字色 */
    --wp-vp-border-color: #3d3d3d;
    --wp-vp-primary: #2196f3;
    --wp-vp-primary-hover: #1976d2;
    --wp-vp-active: #ff0000; /* 暗黑模式仍为红色 */
    --wp-vp-active-text: #ffffff;
    --wp-vp-scroll-thumb: #4d4d4d;
    --wp-vp-scroll-track: #2d2d2d;
    --wp-vp-player-bg: #000000;
}
/* 播放器容器 */
.wp-video-player-container {
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 10px;
    font-family: "Microsoft Yahei", sans-serif;
}
/* 左右布局核心 */
.player-playlist-wrap {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
    min-height: 500px;
}
/* 左侧播放器区 */
.player-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 500px;
}
.video-wrap {
    position: relative;
    aspect-ratio: 16/9;
    background-color: var(--wp-vp-player-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--wp-vp-border-color);
}
#wp-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 20;
}
/* 播放器控制按钮组 - 居中显示 + 卡顿提示文字 */
.player-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 20px;
    background-color: var(--wp-vp-bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--wp-vp-border-color);
    align-items: center;
    justify-content: center; /* 控制栏整体居中 */
    position: relative;
}
/* 线路提示文字 - 独立显示，不遮挡 */
.player-controls::before {
    content: "若播放卡顿，请切换其他线路尝试";
    display: inline-block;
    font-size: 12px;
    color: var(--wp-vp-text-secondary);
    margin-right: 10px; /* 文字和线路框间距 */
    white-space: nowrap;
}
/* 线路选择框 - 适配提示文字 */
#wp-video-line-select {
    padding: 8px 16px;
    background-color: var(--wp-vp-bg-card);
    color: var(--wp-vp-text-main);
    border: 1px solid var(--wp-vp-border-color);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
    position: static;
    padding-left: 16px;
}
/* 控制按钮样式 */
.control-btn {
    padding: 8px 16px;
    background-color: var(--wp-vp-bg-card);
    color: var(--wp-vp-text-main);
    border: 1px solid var(--wp-vp-border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.control-btn:hover {
    background-color: var(--wp-vp-primary);
    color: var(--wp-vp-active-text);
    border-color: var(--wp-vp-primary);
}
.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--wp-vp-bg-secondary);
    color: var(--wp-vp-text-secondary);
    border-color: var(--wp-vp-border-color);
}
#wp-video-line-select option {
    background-color: var(--wp-vp-bg-card);
    color: var(--wp-vp-text-main);
}
.control-sep {
    width: 1px;
    height: 20px;
    background-color: var(--wp-vp-border-color);
    margin: 0 4px;
}
/* 右侧播放列表 - 宽度320px，保留原有样式 */
.playlist-side {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--wp-vp-bg-secondary);
    border: 1px solid var(--wp-vp-border-color);
    border-radius: 8px;
    padding: 16px;
    height: fit-content;
}
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wp-vp-border-color);
}
.playlist-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--wp-vp-text-main);
}
.playlist-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    max-height: 700px;
}
/* 播放列表3列布局 - 【高度绝对统一核心】写死grid样式，强制所有单元格/子项高度一致 */
.playlist-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 48px; /* 【关键】固定行高，所有行高度一致 */
    gap: 8px;
    margin: 0;
    padding: 0;
    align-items: stretch; /* 强制子项拉伸填满单元格 */
    justify-items: stretch; /* 强制子项宽度填满单元格 */
}
/* 播放列表项 - 【高度绝对统一】固定高度+单行+文字居中，彻底消除高度差异 */
.playlist-item {
    height: 100%; /* 填满grid单元格高度 */
    padding: 0 9px; /* 上下无内边距，靠flex居中，避免高度偏差 */
    background-color: var(--wp-vp-bg-card);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap; /* 强制单行 */
    overflow: hidden; /* 超出隐藏 */
    text-overflow: ellipsis; /* 超出显示省略号 */
    border: 1px solid var(--wp-vp-border-color);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center; /* 文字垂直居中 */
    justify-content: flex-start; /* 文字左对齐 */
    line-height: 1.4; /* 固定行高，避免文字行高差异 */
}
/* 播放中样式 - 红色背景+白色加粗文字，醒目 */
.playlist-item.active {
    background-color: #ff0000;
    color: #ffffff;
    font-weight: 700; /* 加粗 */
    border-color: #ff0000;
}
/* 未播放项hover效果 */
.playlist-item:hover:not(.active) {
    border-color: var(--wp-vp-primary);
    color: var(--wp-vp-primary);
}
/* 集数角标 - 不遮挡名称，绝对定位 */
.playlist-item::before {
    content: attr(data-ep);
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 11px;
    opacity: 0.8;
    font-weight: normal;
    color: inherit; /* 继承文字颜色，暗黑/红色模式都适配 */
}
/* 滚动条美化（适配暗黑） */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-thumb {
    background: var(--wp-vp-scroll-thumb);
    border-radius: 4px;
    cursor: pointer;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--wp-vp-primary);
}
::-webkit-scrollbar-track {
    background: var(--wp-vp-scroll-track);
    border-radius: 4px;
}

/* 响应式适配 - 保留所有优化，平板/手机端隐藏提示文字+适配列表高度 */
@media (max-width: 992px) {
    .player-playlist-wrap { flex-direction: column; }
    .player-side { min-width: 100%; }
    .playlist-side { width: 100%; }
    .playlist-list { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 48px; }
    .player-controls::before { display: none; } /* 平板端隐藏提示文字 */
}
@media (max-width: 768px) {
    .player-controls { gap: 8px; padding: 10px 15px; }
    .control-btn { padding: 6px 12px; font-size: 13px; }
    #wp-video-line-select { min-width: 100px; padding: 6px 12px; font-size: 13px; }
    .playlist-list { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 44px; } /* 手机端微调行高 */
    .playlist-item { padding: 0 7px; font-size: 12px; }
    .video-wrap { border-radius: 4px; }
    .player-controls { border-radius: 4px; }
    .playlist-side { padding: 12px; }
}
@media (max-width: 480px) {
    .playlist-list { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 40px; } /* 小屏手机再微调行高 */
    .control-btn { padding: 5px 10px; font-size: 12px; }
    .player-controls { gap: 6px; }
    .playlist-item { font-size: 11px; }
}