/* ====== 重置与基础样式 ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    height: 100%;
    font-size: 16px;
    background: #000;
}

body {
    min-height: 100vh;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #000;
    color: #fff;
    line-height: 1.5;
    overflow: hidden;
    position: fixed;
    user-select: none;
    touch-action: manipulation;
}

/* ====== 主容器布局 ====== */
.main-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #000;
    z-index: 1;
    overflow: hidden;
}

/* ====== 交互引导层 ====== */
.interaction-guide {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.interaction-guide.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.guide-content {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 280px;
    width: 85%;
    animation: guideFloat 3s ease-in-out infinite;
}

@keyframes guideFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.guide-icon {
    margin-bottom: 1.5rem;
}

.guide-icon i {
    font-size: 4rem;
    color: #ff2e63;
    background: linear-gradient(45deg, #ff2e63, #ff6b93);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.guide-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #fff, #ffdde1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.guide-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.3rem;
}

.guide-tip {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1.5rem !important;
}

.guide-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.guide-btn {
    padding: 0.9rem 1.2rem;
    border: none;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.guide-btn.primary {
    background: linear-gradient(45deg, #ff2e63, #ff6b93);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 46, 99, 0.3);
}

.guide-btn.primary:active {
    transform: scale(0.97);
    box-shadow: 0 3px 10px rgba(255, 46, 99, 0.4);
}

/* ====== 视频容器 ====== */
.video-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.video-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.video-item.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    z-index: 2;
}

.video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ====== 视频信息 ====== */
.video-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9) 60%);
    z-index: 10;
    pointer-events: none;
}

.video-info-content {
    max-width: 100%;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    line-height: 1.3;
}

.video-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.8rem;
    line-height: 1.4;
    opacity: 0.95;
    max-height: 2.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.episode-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.75rem;
}

.episode-num {
    background: rgba(255, 46, 99, 0.9);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 0.6rem;
    font-weight: 600;
}

.duration {
    color: rgba(255, 255, 255, 0.7);
}

/* ====== 视频覆盖层 ====== */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    z-index: 20;
    pointer-events: none;
}

.play-overlay-btn {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: rgba(255, 46, 99, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
}

.play-overlay-btn:active {
    transform: scale(0.95);
    background: rgba(255, 46, 99, 1);
}

.swipe-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    animation: swipeHint 2s ease-in-out infinite;
    pointer-events: none;
    text-align: center;
}

@keyframes swipeHint {
    0%, 100% { opacity: 0.7; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

.swipe-hint i {
    font-size: 0.9rem;
    margin: 0.1rem 0;
}

.swipe-hint span {
    display: block;
    margin: 0.2rem 0;
}

/* ====== 播放控制栏 ====== */
.player-controls {
    position: absolute;
    bottom: 5rem;
    left: 0;
    width: 100%;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    pointer-events: none;
}

.player-controls > * {
    pointer-events: auto;
}

.control-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.control-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.control-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.time-display {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.4);
    padding: 0.3rem 0.6rem;
    border-radius: 0.8rem;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.time-separator {
    color: rgba(255, 255, 255, 0.6);
}

/* ====== 进度条 ====== */
.progress-container {
    position: absolute;
    bottom: 4rem;
    left: 0;
    width: 100%;
    padding: 0 1rem;
    z-index: 50;
    pointer-events: none;
}

.progress-container > * {
    pointer-events: auto;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1.5px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s ease;
}

.progress-bar:active {
    height: 5px;
}

.progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff2e63, #ff6b93);
    border-radius: 1.5px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-bar:hover .progress-thumb,
.progress-bar:active .progress-thumb {
    opacity: 1;
}

/* ====== 音量控制 ====== */
.volume-control {
    position: absolute;
    bottom: 9rem;
    right: 1rem;
    width: 40px;
    height: 120px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 15px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 60;
}

.volume-control.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.volume-slider-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-slider-track {
    width: 4px;
    height: 90px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-slider-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(to top, #ff2e63, #ff6b93);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.volume-slider-thumb {
    position: absolute;
    left: 50%;
    bottom: 70%;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, 50%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: grab;
}

.volume-slider-thumb:active {
    cursor: grabbing;
}

/* ====== 底部导航 ====== */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4.5rem;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.4rem 0.6rem;
    border-radius: 0.6rem;
    min-width: 3.5rem;
    gap: 0.3rem;
    flex: 1;
    max-width: 4rem;
}

.nav-btn i {
    font-size: 1.1rem;
}

.nav-btn.active {
    color: #ff2e63;
    background: rgba(255, 46, 99, 0.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

/* ====== 剧集列表模态框 ====== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 100%;
    max-height: 70vh;
    background: #1a1a1a;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:active {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 0.8rem 0;
    max-height: calc(70vh - 3.5rem);
    overflow-y: auto;
}

.episodes-list {
    display: flex;
    flex-direction: column;
}

.episode-list-item {
    padding: 0.9rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.3s ease;
}

.episode-list-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.episode-list-item.active {
    background: rgba(255, 46, 99, 0.1);
    color: #ff2e63;
}

.episode-list-item.active .episode-status {
    color: #ff2e63;
}

.episode-title {
    font-weight: 500;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.episode-meta {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.episode-status {
    color: rgba(255, 255, 255, 0.4);
}

/* ====== 加载指示器 ====== */
.loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(20px);
}

.loader.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    position: relative;
}

.spinner-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff2e63;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

/* ====== 提示信息 ====== */
.toast {
    position: fixed;
    bottom: 10rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 46, 99, 0.9);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 1.2rem;
    font-size: 0.8rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(255, 46, 99, 0.3);
    max-width: 80%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* ====== 声音提示 ====== */
.sound-toast {
    position: fixed;
    top: 2rem;
    right: 1rem;
    background: rgba(255, 46, 99, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(255, 46, 99, 0.3);
}

.sound-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* ====== 安全区域适配 ====== */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ====== 响应式调整 ====== */
@media (max-width: 360px) {
    html {
        font-size: 14px;
    }
    
    .video-title {
        font-size: 1rem;
    }
    
    .video-desc {
        font-size: 0.8rem;
    }
    
    .nav-btn {
        min-width: 3rem;
        font-size: 0.65rem;
    }
    
    .nav-btn i {
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    html {
        font-size: 18px;
    }
    
    .main-container {
        max-width: 768px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ====== 防止iOS橡皮筋效果和强制竖屏 ====== */
body, html {
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 强制竖屏播放 */
video {
    object-fit: contain !important;
    max-height: 100vh !important;
}

/* 隐藏滚动条 */
.episodes-list::-webkit-scrollbar {
    width: 3px;
}

.episodes-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.episodes-list::-webkit-scrollbar-thumb {
    background: rgba(255, 46, 99, 0.5);
    border-radius: 1.5px;
}