:root {
    --space-dark: #05070a;
    --space-card: #0d1117;
    --accent-gold: #ffc107;
    --accent-star: #ffffff;
    --nebula-purple: rgba(84, 13, 110, 0.4);
    --nebula-blue: rgba(13, 59, 102, 0.4);
    --text-main: #f0f0f0;
    --text-muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 20px rgba(255, 193, 7, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    background-color: var(--space-dark);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Effects */
.starfield-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 20px 30px, #eee, rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 40px 70px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(1px 1px at 130px 80px, #fff, rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.3;
    z-index: -2;
    animation: moveStars 100s linear infinite;
}

@keyframes moveStars {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 1000px;
    }
}

.nebula-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, var(--nebula-purple), transparent 40%),
        radial-gradient(circle at 80% 70%, var(--nebula-blue), transparent 40%);
    z-index: -1;
    filter: blur(60px);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(5, 7, 10, 0.8);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.logo-wrapper {
    width: 42px;
    height: 42px;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    animation: logoPulse 4s infinite ease-in-out;
}

@keyframes logoPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.4);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-search-wrapper {
    flex: 1;
    max-width: 600px;
}

.search-input-group {
    position: relative;
    width: 100%;
}

.search-input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 10px 50px 10px 20px;
    color: #fff;
    font-size: 15px;
    outline: none;
}

.search-input-group button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-gold);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drama Grid */
.drama-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.drama-card {
    background: var(--space-card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    cursor: pointer;
}

.drama-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-gold);
}

.card-poster-wrap {
    position: relative;
    aspect-ratio: 9/13;
    overflow: hidden;
}

.card-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.drama-card:hover .card-poster {
    transform: scale(1.1);
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-gold);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
}

.card-body {
    padding: 12px;
}

.card-title {
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Detail Page */
.detail-layout {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}

.detail-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.detail-img-wrap {
    width: 240px;
    flex-shrink: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.detail-img-wrap img {
    width: 100%;
    display: block;
}

.detail-info {
    flex: 1;
}

.detail-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
}

.detail-desc {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.btn-play-large {
    background: var(--accent-gold);
    color: #000;
    border: none;
    padding: 14px 36px;
    border-radius: 35px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-play-large:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 193, 7, 0.5);
}

/* Episode Orbs */
.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.ep-orb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.ep-orb:hover {
    border-color: var(--accent-gold);
    transform: translateY(-3px);
}

.ep-orb.active {
    background: var(--accent-gold);
    color: #000;
    font-weight: 800;
    box-shadow: 0 0 15px var(--accent-gold);
}

/* Player */
.player-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    margin-bottom: 24px;
}

#stardust-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile */
@media (max-width: 768px) {
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .nav-search-wrapper {
        display: none;
    }

    .player-container {
        aspect-ratio: 9/16;
    }
}

.btn-icon {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
}

.mobile-search-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-search-toggle {
        display: flex;
    }
}

.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 10, 0.98);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.mobile-search-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.m-search-box {
    width: 85%;
    position: relative;
}

.m-search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-gold);
    padding: 15px;
    border-radius: 12px;
    color: #fff;
    outline: none;
}

.m-search-box button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
}

/* Loading */
.loading-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
}

.stardust-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #000;
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    border: 1px solid var(--accent-gold);
    transition: 0.3s;
    z-index: 3000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}