 /* --- Wrapper --- */
#player-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #111;
    position: relative;
    flex-direction: column;
    flex-grow: 1;
}


/* --- Main Container (Initially Hidden) --- */
#video-player-container {
    display: none; position: relative; width: 100%; height: 100%;
    background-color: #000; align-items: center; justify-content: center;
    cursor: default; overflow: hidden;
}
/* --- Styles for when player is active (Fixed Position) --- */
#video-player-container.active {
    display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;
}

/* Bottom gradient pseudo-element */
#video-player-container::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 120px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    z-index: 1; pointer-events: none; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}
#video-player-container.user-active::after { opacity: 1; visibility: visible; }

#video-player { display: block; width: 100%; height: 100%; object-fit: contain; background-color: #000; }

/* --- Top Gradient --- */
#top-gradient {
    position: absolute; top: 0; left: 0; width: 100%; height: 100px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
    z-index: 1; pointer-events: none; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}
#video-player-container.user-active #top-gradient { opacity: 1; visibility: visible; }

/* --- Overlay Elements --- */
#video-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
#video-info {
    position: absolute; top: 20px; left: 20px; background-color: transparent;
    padding: 10px 15px; border-radius: 5px; z-index: 3; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; pointer-events: auto;
    padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(15px + env(safe-area-inset-left));
}
#video-player-container.user-active #video-info { opacity: 1; visibility: visible; }
#video-title { font-size: 1.4em; margin-bottom: 5px; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }
#video-labels span { display: inline-block; padding: 3px 8px; margin-right: 5px; border-radius: 3px; font-size: 0.8em; font-weight: bold; color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }

/* --- Top Row UI (Skip, Next, WT, Chat) --- */
#top-row-ui-container { position: absolute; bottom: 85px; left: 20px; right: 20px; width: auto; z-index: 4; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; pointer-events: none; display: flex; justify-content: space-between; align-items: center; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); bottom: calc(85px + env(safe-area-inset-bottom)); }
#video-player-container.user-active #top-row-ui-container { opacity: 1; visibility: visible; pointer-events: auto; }
.top-row-left { display: flex; gap: 10px; align-items: center; pointer-events: auto;}
.top-row-right { display: flex; gap: 10px; align-items: center; pointer-events: auto;}
#skip-button-container { pointer-events: auto; opacity: 1; transition: opacity 0.3s ease-in-out, visibility 0.3s; }
#skip-button-container.hidden { opacity: 0; visibility: hidden; pointer-events: none; width: 0; overflow: hidden; margin: 0; padding: 0; border: 0; }
#skip-button { background-color: rgba(50, 50, 50, 0.8); color: #eee; border: 1px solid rgba(255, 255, 255, 0.3); padding: 10px 20px; font-size: 1em; border-radius: 5px; cursor: pointer; transition: background-color 0.2s ease; white-space: nowrap; }
#skip-button:hover { background-color: rgba(80, 80, 80, 0.9); }
#next-episode-button { background-color: rgba(60, 60, 60, 0.7); color: #eee; border: 1px solid rgba(255, 255, 255, 0.2); padding: 10px 20px; font-size: 1em; border-radius: 5px; cursor: pointer; transition: background-color 0.2s ease; white-space: nowrap; display: none; }
#next-episode-button:hover { background-color: rgba(80, 80, 80, 0.9); }
#next-episode-button i { margin-right: 8px; }
#watch-together-button { background-color: rgba(60, 60, 60, 0.7); color: #eee; border: 1px solid rgba(255, 255, 255, 0.2); padding: 8px 15px; font-size: 0.9em; border-radius: 5px; cursor: pointer; display: flex; align-items: center; gap: 5px; transition: background-color 0.2s ease; white-space: nowrap; pointer-events: auto; }
#watch-together-button:hover { background-color: rgba(80, 80, 80, 0.9); }
#watch-together-button i { font-size: 1em; }
#chat-button { background: rgba(60, 60, 60, 0.7); border: 1px solid rgba(255, 255, 255, 0.2); color: #eee; font-size: 0.9em; padding: 8px 12px; border-radius: 5px; cursor: pointer; transition: background-color 0.2s ease; display: none; line-height: 1; }
#chat-button:hover { background-color: rgba(80, 80, 80, 0.9); }
#chat-button i { font-size: 1em; }
#video-player-container.party-active #chat-button { display: block; }

/* --- Close Button --- */
#close-player-button { position: absolute; top: 15px; right: 15px; background: rgba(30, 30, 30, 0.6); color: #ccc; border: none; border-radius: 50%; width: 36px; height: 36px; font-size: 1.2em; line-height: 36px; text-align: center; cursor: pointer; z-index: 5; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out, background-color 0.2s ease; pointer-events: none; top: calc(15px + env(safe-area-inset-top)); right: calc(15px + env(safe-area-inset-right)); }
#video-player-container.user-active #close-player-button { opacity: 1; visibility: visible; pointer-events: auto; }
#close-player-button:hover { background: rgba(50, 50, 50, 0.8); color: #fff; }

/* --- Main Controls Bar --- */
#video-controls { position: absolute; bottom: 0; left: 0; width: 100%; background: none; padding: 15px 20px calc(20px + env(safe-area-inset-bottom)) 20px; padding-left: calc(20px + env(safe-area-inset-left)); padding-right: calc(20px + env(safe-area-inset-right)); display: flex; align-items: center; gap: 15px; z-index: 3; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0.3s; pointer-events: none; }
#video-player-container.user-active #video-controls { opacity: 1; visibility: visible; pointer-events: auto; }
#video-controls button { background: none; border: none; color: #eee; font-size: 1.4em; cursor: pointer; padding: 5px; line-height: 1; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); flex-shrink: 0; }
#video-controls button:hover { color: #fff; }
#video-controls button.disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Progress Bar & Time --- */
#progress-bar-container { flex-grow: 1; min-width: 50px; height: 12px; cursor: pointer; position: relative; background-color: rgba(80, 80, 80, 0.7); border-radius: 6px; display: flex; align-items: center; }
#progress-bar-container.disabled { cursor: not-allowed; }
#buffered-bar, #progress-bar { position: absolute; left: 0; top: 0; height: 100%; border-radius: 6px; pointer-events: none; }
#buffered-bar { background-color: rgba(120, 120, 120, 0.6); z-index: 1; }
#progress-bar { background-color: #e50914; z-index: 2; }
#progress-seek { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 4; }
#progress-seek:disabled { cursor: not-allowed; }
#time-display { font-size: 0.9em; min-width: 90px; text-align: center; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); flex-shrink: 0; }

/* --- Ad Cue Points --- */
#ad-cue-point-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.ad-cue-point { position: absolute; top: 0; width: 4px; height: 100%; background-color: #ffd700; transform: translateX(-50%); }

/* --- Volume, Subtitles, Fullscreen --- */
#volume-container { display: flex; align-items: center; flex-shrink: 0; }
#volume-slider { width: 70px; height: 6px; cursor: pointer; appearance: none; background: rgba(80, 80, 80, 0.7); border-radius: 3px; outline: none; margin-left: 8px; transition: opacity 0.2s; }
#volume-slider::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; background: #eee; border-radius: 50%; cursor: pointer; }
#volume-slider::-moz-range-thumb { width: 14px; height: 14px; background: #eee; border-radius: 50%; cursor: pointer; border: none; }
#subtitle-button { position: relative; margin-left: 10px; flex-shrink: 0; }
#subtitle-button.active::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; background-color: #e50914; border-radius: 50%; }
#fullscreen-button { margin-left: auto; flex-shrink: 0; }
#subtitle-menu { position: absolute; bottom: calc(65px + env(safe-area-inset-bottom)); right: calc(60px + env(safe-area-inset-right)); background-color: rgba(20, 20, 20, 0.9); border-radius: 4px; z-index: 4; max-height: 200px; overflow-y: auto; padding: 5px 0; transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out; pointer-events: auto; }
#subtitle-menu.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#subtitle-menu ul { list-style: none; padding: 0; margin: 0; }
#subtitle-menu li { padding: 8px 20px; cursor: pointer; font-size: 0.9em; color: #ccc; white-space: nowrap; }
#subtitle-menu li:hover { background-color: rgba(80, 80, 80, 0.7); color: #fff; }
#subtitle-menu li.selected { font-weight: bold; color: #fff; background-color: rgba(60, 60, 60, 0.8); }
#subtitle-menu li.selected::before { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-right: 10px; color: #e50914; }

/* --- Ad Container --- */
#ad-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5; pointer-events: auto; background-color: transparent; }
#ad-ui { position: absolute; bottom: 0; left: 0; width: 100%; padding: 15px; color: #fff; font-size: 0.9em; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent); display: flex; justify-content: space-between; align-items: center; padding-left: calc(15px + env(safe-area-inset-left)); padding-right: calc(15px + env(safe-area-inset-right)); padding-bottom: calc(15px + env(safe-area-inset-bottom));}
.ad-info-right { display: flex; align-items: center; gap: 8px; font-weight: bold; }
#ad-progress-bar-container { position: absolute; bottom: 60px; left: 15px; right: 15px; height: 3px; background-color: rgba(255, 255, 255, 0.3); bottom: calc(60px + env(safe-area-inset-bottom)); left: calc(15px + env(safe-area-inset-left)); right: calc(15px + env(safe-area-inset-right)); }
#ad-progress-bar { height: 100%; width: 0; background-color: #ffd700; }

/* --- Modals --- */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 1100; display: flex; justify-content: center; align-items: center; opacity: 1; visibility: visible; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal.modal-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.modal-content { background-color: #282828; color: #eee; padding: 30px 40px; border-radius: 8px; position: relative; text-align: center; max-width: 450px; width: 90%; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.modal-close { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 2em; color: #aaa; cursor: pointer; line-height: 1; padding: 0; }
.modal-close:hover { color: #fff; }
.modal-content h2 { margin-bottom: 15px; color: #fff; }
.modal-content p { margin-bottom: 20px; font-size: 0.95em; color: #ccc; }
#modal-qr-code-chat { margin-bottom: 25px; background-color: #fff; display: inline-block; padding: 10px; border-radius: 4px; }
#modal-qr-code-chat img { display: block; width: 150px; height: 150px; }
.modal-link-container { display: flex; align-items: center; background-color: #444; border-radius: 4px; padding: 5px; margin-bottom: 10px; }
.modal-link-input { flex-grow: 1; background: none; border: none; color: #eee; font-size: 0.9em; padding: 5px 8px; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; overflow-x: hidden; white-space: nowrap; text-overflow: ellipsis; }
.modal-copy-button { background-color: #555; color: #eee; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; margin-left: 5px; transition: background-color 0.2s ease; }
.modal-copy-button:hover { background-color: #666; }
.modal-copy-button i { font-size: 1em; }
.copy-status { color: #4CAF50; font-size: 0.85em; height: 1.2em; margin-top: 5px; margin-bottom: 0; opacity: 1; transition: opacity 0.5s ease-out; }
.copy-status.copy-status-hidden { opacity: 0; }

/* Watch Together Modal Specifics */
.wt-options { display: flex; justify-content: center; gap: 20px; margin-bottom: 25px; flex-wrap: wrap; }
.wt-options button { padding: 12px 25px; font-size: 1em; cursor: pointer; border-radius: 5px; border: none; transition: background-color 0.2s ease; margin-top: 10px; }
#create-party-button, #leave-party-button { background-color: #e50914; color: white; }
#create-party-button:hover, #leave-party-button:hover { background-color: #f40612; }
#join-party-button { background-color: #555; color: #eee; }
#join-party-button:hover { background-color: #666; }
#wt-back-button, #wt-back-button-join { background-color: #555; color: #eee; } /* Style Back buttons */
#wt-back-button:hover, #wt-back-button-join:hover { background-color: #666; }
.wt-section { display: none; }
.wt-section.active { display: block; }
#join-party-input { width: 100%; padding: 10px; margin-bottom: 15px; border-radius: 4px; border: 1px solid #555; background-color: #333; color: #eee; font-size: 1em; }
#modal-qr-code-wt { display: none; }

/* Loading Indicator */
#loading-indicator { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 6; display: flex; justify-content: center; align-items: center; pointer-events: none; opacity: 1; visibility: visible; transition: opacity 0.2s ease, visibility 0.2s ease; }
#loading-indicator.hidden { opacity: 0; visibility: hidden; }
.spinner { border: 4px solid rgba(255, 255, 255, 0.3); border-left-color: #eee; border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Styles for the new Resume Prompt --- */
#resume-prompt-modal .modal-content { text-align: center; }
#resume-prompt-modal .resume-options { display: flex; justify-content: center; gap: 15px; margin-top: 25px; }
#resume-prompt-modal .resume-button { padding: 12px 25px; font-size: 1em; cursor: pointer; border-radius: 5px; border: none; transition: background-color 0.2s ease; }
#resume-prompt-modal #resume-from-time-button { background-color: #e50914; color: white; }
#resume-prompt-modal #resume-from-start-button { background-color: #555; color: #eee; }

/* Responsive */
@media (max-width: 768px) { #volume-container { display: none; } #subtitle-button { margin-left: 10px; } #fullscreen-button { margin-left: auto; } #subtitle-menu { right: calc(20px + env(safe-area-inset-right)); } #video-controls { gap: 10px; padding-top: 10px; padding-bottom: calc(15px + env(safe-area-inset-bottom)); } #time-display { font-size: 0.85em; min-width: 80px; } #top-row-ui-container { bottom: calc(80px + env(safe-area-inset-bottom)); flex-direction: column; align-items: flex-end; gap: 10px; } .top-row-left { order: 2; align-self: flex-start; } .top-row-right { order: 1; } #close-player-button { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); width: 32px; height: 32px; line-height: 32px; font-size: 1em; } #watch-together-button { display: none; } #chat-button { display: none; } #video-player-container.active { height: 100%; } #player-wrapper { min-height: 0vh; } }
@media (max-width: 480px) { #video-title { font-size: 1.2em; } #skip-button, #next-episode-button { padding: 8px 12px; font-size: 0.9em; } #top-row-ui-container { bottom: calc(75px + env(safe-area-inset-bottom)); } #video-controls { padding-top: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); gap: 8px; } #subtitle-menu { right: calc(10px + env(safe-area-inset-right)); bottom: calc(60px + env(safe-area-inset-bottom)); } #time-display { min-width: 75px; } }

#video-player::cue {
    bottom: 100px !important;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    text-shadow: 1px 1px 2px black;
}