/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #080810;
    --bg-card: rgba(18,18,32,0.72);
    --bg-card-hover: rgba(24,24,44,0.82);
    --bg-modal: rgba(255,255,255,0.06);
    --text: #f0eef8;
    --text-secondary: #a09eb8;
    --accent: #7c6ff0;
    --accent-hover: #9486ff;
    --accent-glow: rgba(124,111,240,0.28);
    --gold: #e8b840;
    --tag-bg: rgba(28,28,48,0.55);
    --border: rgba(255,255,255,0.07);
    --input-bg: rgba(22,22,42,0.65);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    background:
        /* 放映厅暗场 */
        linear-gradient(180deg, #0a0a12 0%, #0c0c1a 15%, #0e0e20 40%, #0a0a16 100%),
        /* 银幕冷光 - 顶部中央 */
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(180,180,220,0.06) 0%, transparent 60%),
        /* 暖色壁灯 - 右侧 */
        radial-gradient(ellipse 30% 60% at 95% 40%, rgba(232,184,64,0.07) 0%, transparent 70%),
        /* 暖色壁灯 - 左侧 */
        radial-gradient(ellipse 30% 60% at 5% 40%, rgba(232,184,64,0.05) 0%, transparent 70%),
        /* 座椅灯带 - 底部暖光 */
        radial-gradient(ellipse 100% 20% at 50% 100%, rgba(232,184,64,0.04) 0%, transparent 60%);
}

/* 暗角效果 - 模拟影院暗场 */
body::before {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
}

/* 玻璃纹理 + 座椅光栅感 */
body::after {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(255,255,255,0.006) 3px,
            rgba(255,255,255,0.006) 6px
        );
    pointer-events: none; z-index: 0;
}

/* 影院灯光点缀 */
.bg-particles {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
    background:
        /* 银幕上映光 */
        radial-gradient(ellipse 60% 30% at 50% 5%, rgba(200,200,240,0.05) 0%, transparent 60%),
        /* 地面反射光斑 */
        radial-gradient(circle at 25% 85%, rgba(124,111,240,0.04) 0%, transparent 25%),
        radial-gradient(circle at 65% 88%, rgba(232,184,64,0.03) 0%, transparent 25%),
        radial-gradient(circle at 85% 80%, rgba(148,134,255,0.03) 0%, transparent 25%);
}

/* 缓慢呼吸灯效 */
.bg-particles::after {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse 50% 15% at 50% 0%, rgba(232,184,64,0.06) 0%, transparent 70%);
    animation: cinemaGlow 6s ease-in-out infinite;
}
@keyframes cinemaGlow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* 漂浮光晕粒子 */
.particle {
    position: fixed; border-radius: 50%; pointer-events: none;
    filter: blur(3px); opacity: 0;
}
.particle::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); border-radius: 50%;
}

/* 金色暖光粒子 */
.p1 { width: 6px; height: 6px; background: rgba(232,184,64,0.9); box-shadow: 0 0 18px 4px rgba(232,184,64,0.5), 0 0 40px 8px rgba(232,184,64,0.2); animation: floatA 14s ease-in-out infinite; }
.p2 { width: 4px; height: 4px; background: rgba(232,184,64,0.7); box-shadow: 0 0 12px 3px rgba(232,184,64,0.4), 0 0 28px 6px rgba(232,184,64,0.15); animation: floatB 18s ease-in-out infinite 2s; }
.p3 { width: 3px; height: 3px; background: rgba(232,184,64,0.6); box-shadow: 0 0 10px 2px rgba(232,184,64,0.35); animation: floatC 16s ease-in-out infinite 4s; }
.p4 { width: 5px; height: 5px; background: rgba(232,184,64,0.65); box-shadow: 0 0 14px 3px rgba(232,184,64,0.4); animation: floatD 20s ease-in-out infinite 1s; }

/* 紫色光粒子 */
.p5 { width: 5px; height: 5px; background: rgba(148,134,255,0.8); box-shadow: 0 0 16px 3px rgba(148,134,255,0.45), 0 0 35px 7px rgba(148,134,255,0.18); animation: floatE 15s ease-in-out infinite 3s; }
.p6 { width: 3px; height: 3px; background: rgba(148,134,255,0.65); box-shadow: 0 0 10px 2px rgba(148,134,255,0.35); animation: floatF 17s ease-in-out infinite 5s; }
.p7 { width: 4px; height: 4px; background: rgba(124,111,240,0.7); box-shadow: 0 0 12px 3px rgba(124,111,240,0.4); animation: floatA 19s ease-in-out infinite 7s; }
.p8 { width: 6px; height: 6px; background: rgba(148,134,255,0.55); box-shadow: 0 0 18px 4px rgba(148,134,255,0.3); animation: floatB 13s ease-in-out infinite 6s; }

/* 青白微光粒子 */
.p9 { width: 3px; height: 3px; background: rgba(200,200,240,0.7); box-shadow: 0 0 8px 2px rgba(200,200,240,0.35); animation: floatC 21s ease-in-out infinite 8s; }
.p10{ width: 4px; height: 4px; background: rgba(180,200,230,0.6); box-shadow: 0 0 14px 3px rgba(180,200,230,0.3); animation: floatD 15s ease-in-out infinite 9s; }
.p11{ width: 2px; height: 2px; background: rgba(200,210,240,0.75); box-shadow: 0 0 8px 2px rgba(200,210,240,0.3); animation: floatE 22s ease-in-out infinite 10s; }
.p12{ width: 5px; height: 5px; background: rgba(190,200,235,0.55); box-shadow: 0 0 16px 3px rgba(190,200,235,0.25); animation: floatF 16s ease-in-out infinite 11s; }

/* 随机飘动路径 */
@keyframes floatA {
    0%   { top: 15%; left: 10%; opacity: 0; }
    15%  { opacity: 0.7; }
    25%  { top: 25%; left: 30%; }
    40%  { top: 10%; left: 55%; }
    55%  { top: 35%; left: 70%; }
    70%  { top: 20%; left: 85%; }
    85%  { opacity: 0.5; }
    100% { top: 15%; left: 10%; opacity: 0; }
}
@keyframes floatB {
    0%   { top: 75%; left: 85%; opacity: 0; }
    15%  { opacity: 0.6; }
    30%  { top: 55%; left: 65%; }
    45%  { top: 70%; left: 40%; }
    60%  { top: 50%; left: 20%; }
    75%  { top: 80%; left: 10%; }
    90%  { opacity: 0.4; }
    100% { top: 75%; left: 85%; opacity: 0; }
}
@keyframes floatC {
    0%   { top: 40%; left: 50%; opacity: 0; }
    10%  { opacity: 0.65; }
    25%  { top: 20%; left: 70%; }
    40%  { top: 50%; left: 80%; }
    55%  { top: 30%; left: 60%; }
    70%  { top: 60%; left: 30%; }
    85%  { top: 40%; left: 15%; opacity: 0.5; }
    100% { top: 40%; left: 50%; opacity: 0; }
}
@keyframes floatD {
    0%   { top: 60%; left: 20%; opacity: 0; }
    12%  { opacity: 0.55; }
    28%  { top: 80%; left: 40%; }
    44%  { top: 65%; left: 60%; }
    60%  { top: 85%; left: 75%; }
    76%  { top: 70%; left: 50%; opacity: 0.45; }
    100% { top: 60%; left: 20%; opacity: 0; }
}
@keyframes floatE {
    0%   { top: 30%; left: 60%; opacity: 0; }
    10%  { opacity: 0.6; }
    22%  { top: 15%; left: 45%; }
    34%  { top: 40%; left: 30%; }
    46%  { top: 25%; left: 15%; }
    58%  { top: 50%; left: 35%; }
    70%  { top: 35%; left: 55%; opacity: 0.5; }
    100% { top: 30%; left: 60%; opacity: 0; }
}
@keyframes floatF {
    0%   { top: 85%; left: 50%; opacity: 0; }
    10%  { opacity: 0.55; }
    25%  { top: 70%; left: 30%; }
    40%  { top: 60%; left: 55%; }
    55%  { top: 80%; left: 75%; }
    70%  { top: 65%; left: 90%; }
    85%  { top: 75%; left: 60%; opacity: 0.4; }
    100% { top: 85%; left: 50%; opacity: 0; }
}

/* ========== Header ========== */
.header {
            position: sticky; top: 0; z-index: 100;
            background: rgba(10,10,15,0.7); backdrop-filter: blur(20px);
            border-bottom: 1px solid var(--border);
            padding: 0 24px; height: 60px;
            display: flex; align-items: center; justify-content: space-between;
        }
.header .logo {
    font-size: 22px; font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}
.header .logo span { font-weight: 400; font-size: 14px; -webkit-text-fill-color: var(--text-secondary); margin-left: 6px; }

/* ========== Hero Search ========== */
.hero {
    position: relative; z-index: 1;
    text-align: center; padding: 80px 20px 50px;
}
.hero h1 {
    font-size: 42px; font-weight: 800; letter-spacing: -1px;
    margin-bottom: 8px;
}
.hero h1 .gradient {
    background: linear-gradient(135deg, var(--accent), #e879f9, var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-size: 200% 200%; animation: gradientShift 3s ease infinite;
}
@keyframes gradientShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero .subtitle {
    color: var(--text-secondary); font-size: 16px; margin-bottom: 36px;
}
.search-box {
            display: flex; max-width: 640px; margin: 0 auto;
            background: var(--bg-card); backdrop-filter: blur(16px);
            border: 1px solid var(--border);
            border-radius: 50px; overflow: hidden;
            transition: all var(--transition);
            box-shadow: 0 4px 24px rgba(0,0,0,0.3);
        }
.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 4px 32px var(--accent-glow);
}
.search-box input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 16px; padding: 16px 24px;
}
.search-box input::placeholder { color: #555; }
.search-box button {
    background: var(--accent); border: none; color: #fff;
    padding: 16px 32px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background var(--transition);
}
.search-box button:hover { background: var(--accent-hover); }

/* ========== Source Selector ========== */
.source-selector {
    display: flex; justify-content: center; gap: 8px;
    margin-top: 20px; flex-wrap: wrap;
}
.source-btn {
            padding: 8px 18px; border-radius: 50px;
            border: 1px solid var(--border); background: var(--bg-card); backdrop-filter: blur(10px);
            color: var(--text-secondary); cursor: pointer;
            font-size: 13px; transition: all var(--transition);
        }
.source-btn:hover { border-color: var(--accent); color: var(--text); }
.source-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* ========== Content Area ========== */
.content { position: relative; z-index: 1; max-width: 1400px; margin: 0 auto; padding: 0 24px 60px; }

/* Stats bar */
.stats-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0; color: var(--text-secondary); font-size: 14px;
    border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.stats-bar .highlight { color: var(--accent); font-weight: 600; }

/* Loading */
.loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px 20px; color: var(--text-secondary);
}
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty */
.empty { text-align: center; padding: 80px 20px; color: var(--text-secondary); }
.empty .icon { font-size: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty h3 { font-size: 20px; margin-bottom: 8px; color: var(--text); }

/* Error */
.error-msg {
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
    color: #f87171; padding: 14px 20px; border-radius: var(--radius-sm);
    text-align: center; margin: 20px 0;
}

/* ========== Movie Grid ========== */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.movie-card {
            background: var(--bg-card); backdrop-filter: blur(12px);
            border: 1px solid var(--border);
            border-radius: var(--radius); overflow: hidden;
            cursor: pointer; transition: all var(--transition);
            position: relative;
        }
.movie-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(108,92,231,0.2);
}
.movie-card .poster {
    width: 100%; aspect-ratio: 2/3;
    object-fit: cover; display: block;
    background: var(--border);
}
.movie-card .poster-placeholder {
    width: 100%; aspect-ratio: 2/3;
    background: linear-gradient(135deg, var(--bg-card-hover), var(--bg-card));
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; color: var(--border);
}
.movie-card .card-info { padding: 14px; }
.movie-card .card-name {
    font-size: 15px; font-weight: 600; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.4;
}
.movie-card .card-meta {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-secondary);
}
.movie-card .card-badge {
    position: absolute; top: 10px; right: 10px;
    background: var(--accent); color: #fff;
    padding: 3px 10px; border-radius: 50px;
    font-size: 11px; font-weight: 600;
}
.movie-card .card-score {
    color: var(--gold); font-weight: 700; font-size: 13px;
    display: flex; align-items: center; gap: 3px;
}
.movie-card .card-episodes {
    background: var(--tag-bg); border: 1px solid var(--border);
    padding: 2px 8px; border-radius: 50px; font-size: 11px;
}

/* ========== Pagination ========== */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 6px; margin-top: 32px; flex-wrap: wrap;
}
.pagination button {
            padding: 8px 14px; border-radius: var(--radius-sm);
            border: 1px solid var(--border); background: var(--bg-card); backdrop-filter: blur(10px);
            color: var(--text); cursor: pointer; font-size: 13px;
            transition: all var(--transition);
        }
.pagination button:hover:not(:disabled) { border-color: var(--accent); }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination button.active {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.pagination .page-info { color: var(--text-secondary); font-size: 13px; padding: 0 8px; }

/* ========== Detail Modal ========== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
    z-index: 200; display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
            background: var(--bg-modal); backdrop-filter: blur(20px) saturate(1.1);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 16px; width: 90%; max-width: 1000px; max-height: 90vh;
            overflow-y: auto; position: relative;
            animation: slideUp 0.3s ease;
            box-shadow: 0 8px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
        }
        @keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
        .modal::-webkit-scrollbar { width: 6px; }
        .modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.modal-close {
    position: absolute; top: 16px; right: 16px; z-index: 10;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.5); border: 1px solid var(--border);
    color: var(--text); font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover { background: rgba(239,68,68,0.3); border-color: #ef4444; }

.detail-container { display: flex; gap: 28px; padding: 28px; }
@media (max-width: 768px) { .detail-container { flex-direction: column; } }

.detail-poster {
    flex-shrink: 0; width: 260px;
    border-radius: var(--radius); overflow: hidden;
}
.detail-poster img {
    width: 100%; display: block; border-radius: var(--radius);
}
.detail-info { flex: 1; min-width: 0; }
.detail-info h2 { font-size: 24px; margin-bottom: 4px; }
.detail-info .subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }
.detail-info .meta-tags {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.detail-info .meta-tags span {
    background: var(--tag-bg); border: 1px solid var(--border);
    padding: 4px 12px; border-radius: 50px; font-size: 12px;
    color: var(--text-secondary);
}
.detail-info .meta-tags .score-tag {
    color: var(--gold); font-weight: 700; border-color: rgba(240,192,64,0.3);
    background: rgba(240,192,64,0.08);
}
.detail-info .intro {
    color: var(--text-secondary); font-size: 14px; line-height: 1.8;
    margin-bottom: 20px;
}
.detail-info .detail-row {
    display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px;
}
.detail-info .detail-item {
    font-size: 13px; color: var(--text-secondary);
}
.detail-info .detail-item strong { color: var(--text); margin-right: 4px; }

/* Episodes */
.episodes-section { margin-top: 20px; }
.episodes-section h3 { font-size: 16px; margin-bottom: 12px; }
.episode-list {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.episode-btn {
            padding: 8px 16px; border-radius: var(--radius-sm);
            border: 1px solid var(--border); background: var(--bg-card); backdrop-filter: blur(8px);
            color: var(--text-secondary); cursor: pointer;
            font-size: 13px; transition: all var(--transition);
        }
.episode-btn:hover { border-color: var(--accent); color: var(--text); }
.episode-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ========== Toast ========== */
.toast {
            position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
            background: var(--bg-card); backdrop-filter: blur(16px);
            border: 1px solid var(--border);
            color: var(--text); padding: 12px 28px; border-radius: 50px;
            font-size: 14px; z-index: 999; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
            animation: toastIn 0.3s ease;
        }
        @keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

        /* ========== Footer ========== */
        .footer {
            text-align: center; padding: 24px; color: var(--text-secondary); font-size: 12px;
            border-top: 1px solid var(--border); position: relative; z-index: 1;
            background: rgba(10,10,15,0.5); backdrop-filter: blur(10px);
        }

/* ========== Responsive ========== */
@media (max-width: 600px) {
    .hero { padding: 50px 16px 30px; }
    .hero h1 { font-size: 28px; }
    .search-box button { padding: 16px 20px; font-size: 14px; }
    .movie-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .detail-poster { width: 100%; max-width: 200px; margin: 0 auto; }
    .modal { width: 95%; max-height: 95vh; }
}
