@font-face {
    font-family: 'Morpheus';
    src: url('/assets/MORPHEUS.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.bingewatch-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a2e 50%, #0a0a0a 100%);
    background-attachment: fixed;
    padding: 0;
    margin: 0;
    position: relative;
}

/* Animated background effect */
.bingewatch-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.bingewatch-page > * {
    position: relative;
    z-index: 1;
}

.bingewatch-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Category Selector */
.category-selector {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(45, 45, 45, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.5));
    border: 1px solid rgba(139, 92, 246, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.category-content {
    padding: 1rem 1.5rem;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.category-selector.collapsed .category-content {
    max-height: 0;
    padding: 0 1.5rem;
    opacity: 0;
}

/* Toggle Button */
.category-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    cursor: pointer;
    background: rgba(139, 92, 246, 0.2);
    border-top: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0 0 var(--radius-md, 12px) var(--radius-md, 12px);
    transition: background 0.2s ease;
}

.category-toggle:hover {
    background: rgba(139, 92, 246, 0.4);
}

.toggle-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    transition: background 0.2s ease;
}

.category-toggle:hover .toggle-handle {
    background: rgba(255, 255, 255, 0.7);
}

/* Collapsed state - just shrinks, toggle stays visible */
.category-selector.collapsed .category-toggle {
    border-top: none;
    border-radius: var(--radius-md, 12px);
}

.category-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
}

.category-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary, #3a3a3a);
    color: var(--text-primary, #e0e0e0);
    border: 2px solid transparent;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-base, 300ms);
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
}

.category-btn:hover {
    background: var(--bg-secondary, #2d2d2d);
    border-color: var(--purple, #8b5cf6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.category-btn.active {
    border-color: var(--purple, #8b5cf6);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(124, 58, 237, 0.3) 100%);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    color: var(--purple-light, #a78bfa);
}

/* Streamer Filter Button */
.streamer-filter-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.streamer-dropdown.show ~ .dropdown-arrow {
    transform: rotate(180deg);
}

/* Streamer Dropdown */
.streamer-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-secondary, #2d2d2d);
    border: 2px solid var(--purple, #8b5cf6);
    border-radius: var(--radius-md, 12px);
    padding: 1rem;
    min-width: 300px;
    max-width: 400px;
    max-height: 400px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.streamer-dropdown.show {
    display: block;
}

.streamer-search {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary, #3a3a3a);
    border: 2px solid var(--border-color, #4a4a4a);
    border-radius: var(--radius-sm, 8px);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.streamer-search:focus {
    outline: none;
    border-color: var(--purple, #8b5cf6);
}

.streamer-search::placeholder {
    color: var(--text-secondary, #999);
}

.streamer-list {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

.streamer-list::-webkit-scrollbar {
    width: 8px;
}

.streamer-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary, #3a3a3a);
    border-radius: 4px;
}

.streamer-list::-webkit-scrollbar-thumb {
    background: var(--purple, #8b5cf6);
    border-radius: 4px;
}

.streamer-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: var(--radius-sm, 8px);
    transition: all 0.2s ease;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 0.25rem;
}

.streamer-item:hover {
    background: var(--bg-tertiary, #3a3a3a);
    border-left: 3px solid var(--purple, #8b5cf6);
    padding-left: calc(1rem - 3px);
}

.category-btn:active {
    transform: translateY(0);
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 80vh;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto 1rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    isolation: isolate; /* Create stacking context for z-index to work properly */
}

.video-wrapper video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80vh;
}

/* Twitch Embed Container */
.twitch-embed-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
    z-index: 1; /* Lower than nav-overlay (z-index: 10) so clicks work */
}

/* Twitch Embed API creates nested elements */
.twitch-embed-container > div,
.twitch-embed-container iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none;
    z-index: 1;
}

/* Navigation Overlays */
.nav-overlay {
    position: absolute;
    top: 0;
    bottom: 60px;  /* Leave space for video controls at bottom */
    width: 20%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
    z-index: 10;
    pointer-events: auto;
}

.video-wrapper:hover .nav-overlay,
.nav-overlay:hover {
    opacity: 1;
}

.nav-overlay-left {
    left: 0;
}

.nav-overlay-right {
    right: 0;
}

.nav-overlay:hover {
    /* No background */
}

.nav-overlay-arrow {
    font-size: 4rem;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    transition: transform 0.2s;
}

.nav-overlay:hover .nav-overlay-arrow {
    transform: scale(1.2);
}

/* Clip Info Overlay */
.clip-info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 2rem 2rem 1.5rem 2rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 5;
}

.video-wrapper:hover .clip-info-overlay {
    opacity: 1;
}

.clip-info-overlay h3 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
}

.clip-meta-inline {
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
}

.clip-meta-inline span {
    margin-right: 0.5rem;
}

/* Progress Indicator */
.progress-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 5;
}

/* Reaction Panel */
.reaction-panel {
    background: #1a1a1a;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.reaction-header {
    margin-bottom: 1rem;
    color: #fff;
    font-size: 1.1rem;
}

.already-voted {
    color: #4caf50;
    font-weight: bold;
}

.emoji-reactions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.emoji-btn-inline {
    font-size: 1.8rem;
    padding: 0.5rem 1rem;
    background: #2a2a2a;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.emoji-btn-inline:hover:not(:disabled) {
    background: #3a3a3a;
    transform: scale(1.1);
}

.emoji-btn-inline.selected {
    border-color: #ff8c00;
    background: rgba(255, 140, 0, 0.2);
}

.emoji-btn-inline:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.vote-stats-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: #888;
    font-size: 0.95rem;
}

.vote-stat {
    padding: 0.3rem 0.8rem;
    background: #2a2a2a;
    border-radius: 4px;
}

.no-votes-inline {
    font-style: italic;
}

.no-clips-message {
    text-align: center;
    padding: 3rem;
    color: white;
}

.no-clips-message p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* Playback Controls */
.playback-controls {
    display: flex;
    gap: 2rem;
    padding: 1rem 2rem;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 1rem;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.speed-section, .volume-section {
    flex: 1;
}

.speed-section h4, .volume-section h4, .autoplay-section h4 {
    color: #fff;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.speed-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.speed-btn {
    padding: 0.5rem 1rem;
    background: #2a2a2a;
    color: #fff;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    transition: all 0.2s;
    white-space: nowrap;
}

.speed-btn:hover {
    background: #3a3a3a;
}

.speed-btn.active {
    border-color: #ff8c00;
    background: rgba(255, 140, 0, 0.2);
}

/* Autoplay Section */
.autoplay-section {
    flex: 0 0 auto;
    text-align: center;
}

.autoplay-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2a2a2a;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.autoplay-btn:hover {
    background: #3a3a3a;
    transform: scale(1.05);
}

.autoplay-btn.active {
    border-color: #ff8c00;
    background: rgba(255, 140, 0, 0.2);
}

.autoplay-icon {
    font-size: 1.1rem;
    color: #fff;
    transition: all 0.2s;
}

.autoplay-btn.active .autoplay-icon {
    color: #ff8c00;
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.volume-icon {
    font-size: 1.2rem;
}

.volume-slider {
    flex: 1;
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #ff8c00;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #ff8c00;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.volume-value {
    color: #fff;
    font-weight: bold;
    min-width: 45px;
    text-align: right;
}

/* Keyboard Shortcuts Overlay */
.shortcuts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.shortcuts-overlay.show {
    display: flex;
}

.shortcuts-modal {
    background: #1a1a1a;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shortcuts-header h3 {
    color: #fff;
    margin: 0;
    font-size: 1.2rem;
}

.shortcuts-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.shortcuts-close:hover {
    color: #fff;
}

.shortcuts-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shortcut-item kbd {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-family: monospace;
    font-size: 0.9rem;
    color: #ff8c00;
    min-width: 60px;
    text-align: center;
}

.shortcut-item span {
    color: #ccc;
    font-size: 0.95rem;
}

/* Cookie Toast Notification */
.cookie-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cookie-toast.hidden {
    display: none;
}

.cookie-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.cookie-toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #ff8c00 0%, #ff6600 100%);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.4);
    max-width: 350px;
    animation: cookieBounce 0.5s ease;
}

@keyframes cookieBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.cookie-icon {
    font-size: 2rem;
    animation: cookieRotate 2s ease-in-out infinite;
}

@keyframes cookieRotate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.cookie-text {
    flex: 1;
    color: white;
}

.cookie-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.cookie-text p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
}

.cookie-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.cookie-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-overlay {
        width: 25%;
    }

    .nav-overlay-arrow {
        font-size: 3rem;
    }

    .clip-info-overlay h3 {
        font-size: 1.1rem;
    }

    .emoji-btn-inline {
        font-size: 1.5rem;
        padding: 0.4rem 0.8rem;
    }

    .playback-controls {
        flex-direction: column;
        gap: 1.5rem;
    }

    .category-selector {
        top: 70px;
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
        left: 1rem;
        transform: none;
    }

    .category-content {
        padding: 0.75rem 1rem;
    }

    .category-selector.collapsed .category-content {
        padding: 0 1rem;
    }

    .category-buttons {
        gap: 0.4rem;
    }

    .category-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .cookie-toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .cookie-toast-content {
        max-width: 100%;
    }
}

/* Death Clip Timestamp Section (below video) */
.death-timestamp-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
}

.death-timestamp {
    color: #ff6b6b;
    font-weight: 600;
    font-size: 1rem;
}

/* Chromie Indicator */
.chromie-indicator {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}

.chromie-approved {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.chromie-lost {
    background: rgba(128, 128, 128, 0.2);
    color: #888;
    border: 1px solid rgba(128, 128, 128, 0.3);
}

/* Optimistic UI - Voting feedback */
.emoji-btn-inline.voting {
    opacity: 0.7;
    transform: scale(0.95);
}

.emoji-btn-inline.selected {
    background: rgba(139, 92, 246, 0.3) !important;
    border-color: #8b5cf6 !important;
    transform: scale(1.1);
}

/* Toast notifications */
.reaction-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1a1a2e;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.reaction-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.reaction-toast.error {
    border-color: rgba(255, 107, 107, 0.5);
    background: rgba(255, 107, 107, 0.1);
}

/* Small mobile devices */
@media (max-width: 480px) {
    .bingewatch-container {
        padding: 0.5rem;
    }

    .video-wrapper {
        border-radius: 4px;
        max-height: 50vh;
    }

    .video-wrapper video {
        max-height: 50vh;
    }

    .nav-overlay {
        width: 30%;
        opacity: 0.7;
    }

    .nav-overlay-arrow {
        font-size: 2.5rem;
    }

    .clip-info-overlay {
        padding: 1rem;
    }

    .clip-info-overlay h3 {
        font-size: 0.95rem;
    }

    .clip-meta-inline {
        font-size: 0.8rem;
    }

    .progress-indicator {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Playback controls */
    .playback-controls {
        padding: 0.75rem 1rem;
        gap: 1rem;
    }

    .speed-section h4, .volume-section h4, .autoplay-section h4 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }

    .speed-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
        min-width: 48px;
        min-height: 40px;
    }

    .autoplay-btn {
        width: 40px;
        height: 40px;
    }

    .volume-slider-container {
        gap: 0.5rem;
    }

    .volume-value {
        font-size: 0.875rem;
        min-width: 40px;
    }

    /* Category selector */
    .category-selector {
        top: 60px;
    }

    .category-content {
        padding: 0.5rem 0.75rem;
    }

    .category-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
        min-width: auto;
        min-height: 36px;
    }

    /* Reaction panel */
    .reaction-panel {
        padding: 1rem;
    }

    .emoji-reactions-inline {
        gap: 0.35rem;
    }

    .emoji-btn-inline {
        font-size: 1.4rem;
        padding: 0.4rem 0.6rem;
        min-height: 44px;
        min-width: 44px;
    }

    .vote-stats-inline {
        font-size: 0.8rem;
        gap: 0.5rem;
    }

    .vote-stat {
        padding: 0.25rem 0.6rem;
    }

    /* Streamer dropdown */
    .streamer-dropdown {
        min-width: 280px;
        max-width: calc(100vw - 2rem);
    }

    /* Death timestamp section */
    .death-timestamp-section {
        padding: 0.5rem 0.75rem;
        gap: 0.75rem;
    }

    .death-timestamp {
        font-size: 0.875rem;
    }

    /* Cookie toast */
    .cookie-toast-content {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .cookie-icon {
        font-size: 1.5rem;
    }

    .cookie-text strong {
        font-size: 0.875rem;
    }

    .cookie-text p {
        font-size: 0.75rem;
    }

    /* Shortcuts modal */
    .shortcuts-modal {
        min-width: 280px;
        max-width: calc(100vw - 2rem);
        padding: 1rem;
    }

    .shortcuts-header h3 {
        font-size: 1rem;
    }

    .shortcut-item kbd {
        min-width: 50px;
        font-size: 0.8rem;
    }

    .shortcut-item span {
        font-size: 0.85rem;
    }
}
