:root {
    --bg-color: #0f0f13; --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08); --primary: #8b5cf6;
    --primary-gradient: linear-gradient(135deg, #c084fc, #8b5cf6, #3b82f6);
    --text-main: #ffffff; --text-muted: #9ca3af;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); overflow-x: hidden; min-height: 100vh; }

.bg-blobs { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.4; animation: float 20s infinite ease-in-out; }
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: #8b5cf6; }
.blob-2 { bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: #3b82f6; animation-delay: -10s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(10%, 10%) scale(1.1); } }

.glass { background: var(--glass-bg); backdrop-filter: blur(16px); border: 1px solid var(--glass-border); }
.text-gradient { background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

nav { position: sticky; top: 0; z-index: 50; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); }
.logo { font-size: 1.5rem; font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text-muted); text-decoration: none; transition: 0.3s; font-weight: 500; cursor: pointer; }
.nav-links a:hover, .nav-links a.active { color: var(--text-main); }
.search-bar { display: flex; align-items: center; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); border-radius: 20px; padding: 5px 15px; }
.search-bar input { background: transparent; border: none; color: white; outline: none; padding: 5px; width: 200px; }

.btn { background: var(--primary-gradient); color: white; border: none; padding: 8px 20px; border-radius: 20px; cursor: pointer; font-weight: 500; transition: 0.3s; }
.btn:hover { opacity: 0.8; }
.btn-glass { background: var(--glass-bg); border: 1px solid var(--glass-border); }

.container { padding: 2rem; max-width: 1400px; margin: 0 auto; min-height: 80vh; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.5rem; }

.card { border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform 0.3s, box-shadow 0.3s; position: relative; background: var(--glass-bg); }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3); }
.card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.card-info { padding: 1rem; }
.card-title { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.fav-btn { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.6); border-radius: 50%; padding: 8px; border: none; color: white; cursor: pointer; backdrop-filter: blur(5px); z-index: 10; }
.fav-btn.active { color: #f43f5e; }

.section-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 8px;}
.loader { width: 40px; height: 40px; border: 4px solid var(--glass-border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 50px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-header { display: flex; gap: 2rem; margin-bottom: 2rem; }
.detail-poster { width: 300px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.detail-info h1 { font-size: 2.5rem; margin-bottom: 10px; }
.detail-info p { color: var(--text-muted); line-height: 1.6; margin-bottom: 15px;}

.video-container { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.5); margin-bottom: 2rem; position: relative; }
video { width: 100%; height: 100%; outline: none; }

.episodes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ep-btn { padding: 10px; text-align: center; border-radius: 8px; cursor: pointer; transition: 0.2s; background: var(--glass-bg); border: 1px solid var(--glass-border);}
.ep-btn:hover { background: var(--primary); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 100; opacity: 0; pointer-events: none; transition: 0.3s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal { width: 100%; max-width: 400px; padding: 2rem; border-radius: 20px; text-align: center; position: relative; }
.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; color: var(--text-muted);}
.input-group input { width: 100%; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); color: white; outline: none; }
.input-group input:focus { border-color: var(--primary); }
.modal-close { position: absolute; top: 15px; right: 15px; cursor: pointer; color: var(--text-muted); }

#toast { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 20px; transition: 0.3s; z-index: 200; }
#toast.show { bottom: 20px; }
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    nav { flex-direction: column; gap: 15px; padding: 1rem; }
    .search-bar, .search-bar input { width: 100%; }
    .detail-header { flex-direction: column; } .detail-poster { width: 100%; max-width: 300px; margin: 0 auto; }
}