:root {
    --primary-color: #e50914;
    --primary-hover: #f40612;
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --border-color: #333333;
    --progress-bg: #333333;
    --progress-fill: #e50914;
    --progress-buffered: #444444;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

[data-theme="light"] {
    --primary-color: #e50914;
    --primary-hover: #f40612;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #dddddd;
    --progress-bg: #e0e0e0;
    --progress-fill: #e50914;
    --progress-buffered: #c0c0c0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    position: relative;
}

.app-container {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 100%);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    width: 100%;
    max-width: 100%;
}

[data-theme="light"] .header {
    background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 100%);
}

.header-content {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    flex-shrink: 0;
    min-width: 0;
}

.logo svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    gap: 4px;
    padding: 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-item {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 16px;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    color: var(--primary-color);
    background-color: rgba(229, 9, 20, 0.15);
}

.nav-item.active:hover {
    background-color: rgba(229, 9, 20, 0.25);
}

.search-control {
    position: relative;
    margin-left: auto;
}

.search-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
    flex-shrink: 0;
    padding: 4px;
}

.search-btn:hover {
    background-color: var(--bg-tertiary);
}

.search-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.search-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 8px;
    display: none;
    flex-direction: column;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
}

.search-control.active .search-options {
    display: flex;
}

.search-option {
    border: none;
    background: transparent;
    color: var(--text-primary);
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color var(--transition-fast);
}

.search-option:hover {
    background-color: var(--bg-secondary);
}

.search-option.active {
    color: var(--primary-color);
    background-color: rgba(229, 9, 20, 0.15);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
    flex-shrink: 0;
    padding: 4px;
    margin-left: 4px;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

[data-theme="light"] .sun-icon {
    display: block;
}

[data-theme="light"] .moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(12px + env(safe-area-inset-top));
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
    }
    
    .controls {
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .progress-bar-container {
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
    }
}

@media (max-width: 480px) {
    @supports (padding-top: env(safe-area-inset-top)) {
        .header {
            padding-top: calc(10px + env(safe-area-inset-top));
            padding-left: calc(12px + env(safe-area-inset-left));
            padding-right: calc(12px + env(safe-area-inset-right));
        }
        
        .controls {
            padding-left: calc(12px + env(safe-area-inset-left));
            padding-right: calc(12px + env(safe-area-inset-right));
            padding-bottom: calc(10px + env(safe-area-inset-bottom));
        }
        
        .progress-bar-container {
            padding-left: calc(12px + env(safe-area-inset-left));
            padding-right: calc(12px + env(safe-area-inset-right));
        }
    }
}

.main-content {
    padding-top: 60px;
}

.player-section {
    position: relative;
    width: 100%;
    background-color: #000;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.video-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.play-button {
    width: 80px;
    height: 80px;
    border: none;
    background: rgba(229, 9, 20, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.play-button:hover {
    transform: scale(1.1);
    background: rgba(244, 6, 18, 0.95);
}

.play-button svg {
    width: 32px;
    height: 32px;
    margin-left: 4px;
}

.progress-bar-container {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    padding: 0 20px;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.progress-bar-container.hidden {
    opacity: 0;
    pointer-events: none;
}



.progress-bar {
    position: relative;
    height: 6px;
    background-color: var(--progress-bg);
    border-radius: 3px;
    overflow: visible;
}

.progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--progress-buffered);
    border-radius: 3px;
    z-index: 1;
}

.progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--progress-fill);
    border-radius: 3px;
    z-index: 2;
    transition: width var(--transition-fast);
}

.progress-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    margin-bottom: 8px;
}

.progress-bar-container:hover .progress-tooltip {
    opacity: 1;
}

.controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.controls.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.controls-left, .controls-center, .controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.controls-center {
    flex: 0 0 auto;
}

.control-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
}

.control-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

.play-icon, .fullscreen-exit, .volume-muted {
    display: none;
}

.playing .play-icon {
    display: none;
}

.playing .pause-icon {
    display: block;
}

.fullscreen .fullscreen-enter {
    display: none;
}

.fullscreen .fullscreen-exit {
    display: block;
}

.muted .volume-high {
    display: none;
}

.muted .volume-muted {
    display: block;
}

.time-display {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 100px;
}

.speed-control, .quality-control {
    position: relative;
}

.speed-btn, .quality-btn {
    width: auto;
    min-width: 56px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
}

.speed-options, .quality-options {
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    padding: 4px;
    margin-bottom: 8px;
    display: none;
    flex-direction: column;
    min-width: 80px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.speed-control:hover .speed-options,
.quality-control:hover .quality-options {
    display: flex;
}

.speed-option, .quality-option {
    border: none;
    background: transparent;
    color: var(--text-primary);
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    border-radius: 2px;
    font-size: 14px;
    transition: background-color var(--transition-fast);
}

.speed-option:hover, .quality-option:hover {
    background-color: var(--bg-secondary);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--progress-bg);
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.content-section {
    max-width: 1920px;
    margin: 0 auto;
    padding: 24px 20px;
}

.content-info {
    margin-bottom: 32px;
}

.title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.2;
}

.metadata {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.meta-divider {
    color: var(--text-muted);
}

.rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}



.episodes-section {
    margin-top: 32px;
}

.episodes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.episode-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.episodes-container {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.episode-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
}

.episode-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(229, 9, 20, 0.3);
}

.episode-card.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(229, 9, 20, 0.12) 0%, rgba(229, 9, 20, 0.06) 100%);
}

.episode-info {
    padding: 12px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    position: relative;
    z-index: 1;
}

.episode-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.episode-card.active .episode-number {
    color: var(--primary-color);
}



@media (min-width: 768px) {
    .header {
        padding: 16px 32px;
    }

    .logo {
        font-size: 22px;
    }

    .logo svg {
        width: 32px;
        height: 32px;
    }

    .nav-menu {
        gap: 8px;
        padding: 0 16px;
    }

    .nav-item {
        padding: 10px 20px;
        font-size: 15px;
        border-radius: 20px;
    }

    .main-content {
        padding-top: 72px;
    }

    .video-overlay:hover .play-button {
        transform: scale(1.15);
    }

    .controls {
        padding: 16px 24px;
    }

    .control-btn {
        width: 48px;
        height: 48px;
    }

    .control-btn svg {
        width: 22px;
        height: 22px;
    }

    .volume-slider {
        width: 100px;
    }

    .content-section {
        padding: 32px;
    }

    .title {
        font-size: 32px;
    }

    .synopsis {
        max-height: 180px;
    }

    .episodes-grid {
        gap: 12px;
    }

    .search-input {
        width: 240px;
    }
}

@media (min-width: 1024px) {
    .main-content {
        display: flex;
    }

    .player-section {
        flex: 1;
        position: sticky;
        top: 72px;
        height: calc(100vh - 72px);
    }

    .video-container {
        height: 100%;
        aspect-ratio: unset;
    }

    .video-player {
        height: 100%;
        object-fit: cover;
    }

    .content-section {
        width: 420px;
        flex-shrink: 0;
        padding: 32px 24px;
        overflow-y: auto;
        max-height: calc(100vh - 72px);
    }

    .episode-card {
        display: block;
    }

    .episode-info {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 52px;
    }
}

@media (min-width: 1280px) {
    .content-section {
        width: 480px;
    }
}

@media (min-width: 1600px) {
    .content-section {
        width: 520px;
    }
}

@media (max-width: 320px) {
    .header {
        padding: 8px 10px;
        min-height: 52px;
        display: flex;
        align-items: center;
    }

    .logo {
        font-size: 16px;
        gap: 6px;
    }

    .logo svg {
        width: 24px;
        height: 24px;
    }

    .logo span {
        display: none;
    }

    .search-btn {
        width: 36px;
        height: 36px;
        padding: 2px;
        margin-right: 2px;
    }

    .search-btn svg {
        width: 18px;
        height: 18px;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        padding: 2px;
        margin-left: 2px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .main-content {
        padding-top: 52px;
    }

    .controls {
        padding: 8px 10px;
        gap: 6px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
    }

    .control-btn svg {
        width: 16px;
        height: 16px;
    }

    .time-display {
        display: none;
    }

    .speed-control, .quality-control {
        display: none;
    }

    .volume-slider {
        width: 50px;
    }

    .content-section {
        padding: 12px 10px;
    }

    .title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .metadata {
        font-size: 11px;
        gap: 6px;
        margin-bottom: 12px;
    }

    .section-title {
        font-size: 16px;
    }

    .episode-count {
        font-size: 12px;
    }

    .episodes-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .episode-info {
        padding: 8px 6px;
        min-height: 40px;
    }

    .episode-number {
        font-size: 12px;
    }
}

@media (min-width: 321px) and (max-width: 480px) {
    .header {
        padding: 10px 12px;
        min-height: 56px;
        display: flex;
        align-items: center;
    }

    .logo {
        font-size: 16px;
        gap: 6px;
    }

    .logo svg {
        width: 26px;
        height: 26px;
    }

    .logo span {
        display: none;
    }

    .search-btn {
        width: 38px;
        height: 38px;
        padding: 3px;
        margin-right: 2px;
    }

    .search-btn svg {
        width: 19px;
        height: 19px;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        padding: 3px;
        margin-left: 2px;
    }

    .theme-toggle svg {
        width: 19px;
        height: 19px;
    }

    .main-content {
        padding-top: 56px;
    }

    .controls {
        padding: 10px 12px;
        gap: 8px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }

    .control-btn svg {
        width: 18px;
        height: 18px;
    }

    .time-display {
        font-size: 12px;
        min-width: 80px;
    }

    .speed-control, .quality-control {
        display: none;
    }

    .volume-slider {
        width: 60px;
    }

    .content-section {
        padding: 16px 12px;
    }

    .title {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .metadata {
        font-size: 12px;
        gap: 8px;
        margin-bottom: 14px;
    }

    .section-title {
        font-size: 17px;
    }

    .episode-count {
        font-size: 13px;
    }

    .episodes-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .episode-info {
        padding: 9px 7px;
        min-height: 44px;
    }

    .episode-number {
        font-size: 13px;
    }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.error-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.error-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: #e50914;
}

.error-icon svg {
    width: 100%;
    height: 100%;
}

.error-content h3 {
    font-size: 20px;
    color: #ffffff;
    margin-bottom: 12px;
}

.error-content p {
    font-size: 14px;
    color: #b3b3b3;
    margin-bottom: 24px;
}

.retry-btn {
    padding: 12px 32px;
    background-color: #e50914;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-btn:hover {
    background-color: #f40612;
}