* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f0f;
    color: #fff;
}

.search-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 70%;
    max-width: 400px;
    transition: bottom 0.3s ease;
}

.search-bar input:focus {
    bottom: 50vh;
}

.search-bar input:not(:focus) {
    bottom: 20px;
}

@media (min-width: 769px) {
    .search-bar {
        position: static;
        width: 300px;
        margin: 0;
        transform: none;
    }
}

.search-bar button {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    background: rgba(151, 123, 182, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #ffffe0;
    font-size: 16px;
    font-weight: bold;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-bar button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(151, 123, 182, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(151, 123, 182, 0.3);
    transform: translateY(-2px);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

.video-section {
    background: linear-gradient(145deg, #1a1a1a 0%, #252525 100%);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.video-player {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    border: 2px solid #333;
}

@media (max-width: 768px) {
    .video-player {
        padding-bottom: 100%;
    }
}

.video-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: transparent;
    z-index: 10;
    pointer-events: auto;
}

.video-info {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.video-info h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 15px;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    flex: 1;
}

.fullscreen-btn {
    display: none;
    background: rgba(151, 123, 182, 0.2);
    border: 1px solid rgba(151, 123, 182, 0.3);
    border-radius: 8px;
    padding: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
}

.fullscreen-btn.show {
    display: block;
}

.fullscreen-btn svg {
    width: 24px;
    height: 24px;
}

.fullscreen-btn:hover {
    background: rgba(151, 123, 182, 0.4);
    border-color: rgba(151, 123, 182, 0.5);
}

@media (max-width: 768px) {
    .container {
        padding: 0;
        min-height: 120vh;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 2px;
        min-height: 120vh;
    }
    
    .video-section {
        padding: 0;
        border-radius: 0;
    }
    
    .video-info h2 {
        margin-bottom: 0;
        font-size: 1rem;
    }
    
    .sidebar {
        height: 120vh !important;
        max-height: none !important;
        padding: 5px;
        margin: 0;
        padding-bottom: 80px;
        overflow-y: auto;
    }
    
    .episode-item {
        padding: 12px 10px;
        min-height: 45px;
    }
    
    .episode-item h3 {
        font-size: 0.9rem;
    }
}

.sidebar {
    background: linear-gradient(145deg, #1a1a1a 0%, #252525 100%);
    border-radius: 16px;
    padding: 25px;
    height: fit-content;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid #333;
    position: sticky;
    top: 20px;
}

.episode-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.episode-item {
    background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
    border-radius: 12px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    user-select: none;
    min-height: 60px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.episode-item.reveal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.episode-item:hover {
    background: linear-gradient(135deg, #3a3a3a 0%, #444 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(151, 123, 182, 0.15);
    border-color: rgba(151, 123, 182, 0.3);
}

.episode-item.active {
    border-color: #977bb6;
    background: linear-gradient(135deg, #977bb6 0%, #8569a3 100%);
    color: #000;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(151, 123, 182, 0.4);
    transform: translateY(-2px);
}

.episode-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.episode-item.hidden {
    display: none;
}

/* Enhanced scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 12px;
}

.sidebar::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 6px;
    border: 1px solid #333;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #977bb6 0%, #8569a3 100%);
    border-radius: 6px;
    border: 1px solid #333;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #8569a3 0%, #745890 100%);
    box-shadow: 0 2px 8px rgba(151, 123, 182, 0.3);
}

/* PC optimizations for larger screens */
@media (min-width: 1200px) {
    .container {
        max-width: 1800px;
        padding: 30px;
    }
    
    .main-content {
        grid-template-columns: 1fr 450px;
        gap: 40px;
    }
    
    .video-section {
        padding: 40px;
    }
    
    .sidebar {
        padding: 30px;
        max-height: 95vh;
    }
    
    .episode-item {
        padding: 20px 25px;
        min-height: 65px;
    }
    
    .episode-item h3 {
        font-size: 1.2rem;
    }
}

@media (min-width: 1600px) {
    .container {
        max-width: 2000px;
    }
    
    .main-content {
        grid-template-columns: 1fr 500px;
        gap: 50px;
    }
    
    header h1 {
        font-size: 3.5rem;
    }
    
    .video-info h2 {
        font-size: 2rem;
    }
}

/* Tablet and mobile responsive design */
@media (max-width: 768px) {
    .search-bar {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 70%;
        max-width: 400px;
    }
    
    .container {
        padding: 10px;
    }
    
    header {
        padding: 15px 0;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .search-box {
        max-width: 100% !important;
        margin: 15px 0 0 0 !important;
    }
    
    .search-box input {
        padding: 15px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .video-section {
        padding: 15px;
        border-radius: 8px;
    }
    

    
    .sidebar {
        max-height: 100vh;
        padding: 15px;
        border-radius: 8px;
        order: 2;
    }
    
    .episode-item {
        padding: 18px 15px;
        border-radius: 12px;
        margin-bottom: 8px;
        touch-action: manipulation;
    }
    
    .episode-item h3 {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    .episode-item:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* Enhanced keyboard navigation for PC */
@media (min-width: 769px) {
    .episode-item:focus {
        outline: 3px solid #977bb6;
        outline-offset: 2px;
        background: linear-gradient(135deg, #3a3a3a 0%, #444 100%);
    }
    
    header .search-box input::placeholder {
        color: #888;
        font-style: italic;
    }
    
    .video-section:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    }
    
    .sidebar:hover {
        box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    }
}

@media (max-width: 480px) {
    .video-info h2 {
        font-size: 0.9rem;
    }
    
    .sidebar {
        max-height: 35vh;
    }
    
    .episode-item {
        padding: 10px 8px;
        min-height: 40px;
    }
    
    .episode-item h3 {
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .video-info h2 {
        font-size: 0.8rem;
    }
    
    .sidebar {
        max-height: 30vh;
    }
    
    .episode-item {
        padding: 8px 6px;
        min-height: 35px;
    }
    
    .episode-item h3 {
        font-size: 0.8rem;
    }
}

/* Enhanced loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: #977bb6;
    font-size: 1.2rem;
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* PC-specific body classes */
.pc-mode {
    cursor: default;
}

.pc-mode .episode-item {
    cursor: pointer;
}

.pc-mode .episode-item:focus {
    outline: 2px solid #977bb6;
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
* {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Enhanced video section animations */
.video-section {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better focus indicators for accessibility */
:focus-visible {
    outline: 2px solid #977bb6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Custom selection colors disabled */
::selection {
    background: transparent;
}

::-moz-selection {
    background: transparent;
}