/* Apply box-sizing globally for consistent layout calculations */
html, body, * {
  box-sizing: border-box;
}

:root {
  --wait-times-bar-height: 30px; /* Define the height of the scrolling wait times bar */
  --right-panel-width: 55px; /* Define the width of the new right panel (desktop) */
  --right-panel-height-mobile: 55px; /* NEW: Define the height of the right panel on mobile */
  --right-panel-bottom-item-height: 35px; /* Height of the bottom item, including margin */
  --mobile-controls-width: 40px; /* NEW: Width for mobile controls */
  --policy-banner-height: 40px; /* Define the height of the policy banner */
  --chat-scale: 0.75; /* NEW: Default chat scale */
  --desktop-controls-size: 40px; /* NEW: Size for desktop controls bar */
}

body {
  margin: 0;
  padding: 0;
  background-color: #121212;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  /* Prevent horizontal scrolling */
  overflow-y:auto; /* Changed from auto to hidden to prevent main window scrollbar on desktop */
}

/* --- START TABLET MODE --- */
/* Style changes when tablet mode is active */

/* MODIFICATION: Apply larger header buttons ONLY when in desktop/tablet (vertical bar) layout */
@media (min-width: 769px) {
    body.tablet-mode .settings-cog-btn {
        padding: 1rem;
        /* Explicitly set width/height to auto to accommodate new padding */
        width: auto; 
        height: auto;
    }
}

/* Keep nav link/button styles as they are for the slide-out panel */
body.tablet-mode .mobile-nav-link,
body.tablet-mode .mobile-nav-button {
    font-size: 1.5rem;
    padding: 1rem;
}


body.tablet-mode .hide-btn,
body.tablet-mode .chat-button,
body.tablet-mode .like-video-btn,
body.tablet-mode .focus-btn,
body.tablet-mode .dsn-icon-container,
body.tablet-mode .site-fullscreen-btn,
body.tablet-mode .desktop-controls { /* Hide desktop controls in tablet mode */
    display: none !important;
}

.tablet-controls-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2vmin;
    z-index: 27;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 2vw;
    flex-wrap: wrap;
}

.tablet-controls-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.tablet-control-btn {
    background-color: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    font-size: clamp(1.5rem, 6vmin, 2.5rem);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    width: clamp(60px, 15vmin, 100px);
    height: clamp(60px, 15vmin, 100px);
}

/* NEW: Added this rule to size the SVGs inside the tablet buttons */
.tablet-control-btn svg {
    width: 60%; /* Make the SVG fill 60% of the button's clamped size */
    height: 60%;
    stroke: currentColor; /* Inherit the button's color (white) */
}

.tablet-control-btn:hover {
    background-color: rgba(50, 50, 50, 0.9);
    transform: scale(1.1);
}

.tablet-control-btn.liked-video-btn {
    background-color: #444;
    cursor: not-allowed;
    opacity: 0.7;
}

.tablet-menu-btn {
    display: none; /* Hidden by default */
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 26; /* Above player, below controls overlay */
    background-color: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 28px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background-color 0.2s ease;
}

body.tablet-mode .tablet-menu-btn {
    display: flex; /* Show in tablet mode */
    align-items: center;
    justify-content: center;
}

.tablet-menu-btn:hover {
    background-color: rgba(50, 50, 50, 0.9);
}


/* --- END TABLET MODE --- */

/* --- START CHAT ONLY MODE --- */
/* Styles for when Chat Only Mode is active */

/* CRITICAL FIX: Ensure controls container is VISIBLE, but video wrapper is HIDDEN */

/* 1. Ensure the player container (which holds controls) is visible and structured correctly */
body.chat-only-mode .player-container {
    display: flex !important;
    flex-direction: column !important; /* Force stack */
    height: 100% !important; /* Ensure it fills parent */
    flex: 0 0 auto !important; /* Do not grow, just fit content */
    overflow: hidden !important;
}

/* 2. Hide the actual video wrapper inside */
body.chat-only-mode .video-wrapper {
    display: none !important;
}

/* 3. Force Desktop Controls to be visible and at the top */
body.chat-only-mode .desktop-controls {
    display: flex !important;
    width: 100% !important;
    order: -1 !important; /* Ensure it is at the very top */
    position: relative !important;
    height: var(--desktop-controls-size) !important;
    opacity: 1 !important;
    border: none !important;
    border-bottom: 1px solid #333 !important;
    background-color: #222 !important;
    flex-shrink: 0 !important; /* Do not shrink */
}

/* 4. Force specific buttons to be VISIBLE in Chat Only Mode */
body.chat-only-mode .desktop-controls .focus-btn,
body.chat-only-mode .desktop-controls .like-video-btn,
body.chat-only-mode .desktop-controls .hide-btn {
    display: flex !important;
    opacity: 1 !important;
}

/* 5. Hide redundant buttons in Chat Only Mode */
body.chat-only-mode .desktop-controls .chat-button, 
body.chat-only-mode .desktop-controls .site-fullscreen-btn, 
body.chat-only-mode .desktop-controls .control-bar-mute-btn {
    display: none !important;
}

/* 6. Layout for the stream container */
body.chat-only-mode .stream-container {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important; /* Fill grid cell */
    overflow: hidden !important;
}

/* 7. Chat Panel fills the remaining height */
body.chat-only-mode .chat-panel {
    display: block !important;
    width: 100% !important;
    flex: 1 1 auto !important; /* Grow to fill all remaining vertical space */
    position: relative !important; /* Establish positioning context for absolute iframe */
    background: #1e1e1e !important;
    border: none !important;
    overflow: hidden !important; /* Clip content */
}

/* 8. Iframe scaling and positioning */
body.chat-only-mode .chat-iframe {
    position: absolute !important; 
    top: 0 !important;
    left: 0 !important;
    transform-origin: top left !important;
    /* Recalculate dimensions to account for scale */
    width: calc(100% / var(--chat-scale)) !important;
    height: calc(100% / var(--chat-scale)) !important;
    transform: scale(var(--chat-scale)) !important;
    border: none !important;
}

/* 9. Mobile Specific override for height constraint */
@media (max-width: 768px) {
    body.chat-only-mode .stream-container {
        /* Force a reasonable height on mobile so it doesn't expand indefinitely */
        height: 85vh !important;
        margin-bottom: 10px !important;
        border-bottom: 1px solid #333 !important;
    }
}

/* --- END CHAT ONLY MODE --- */


/* NEW: Policy Modal Styles (reusing modal-content for structure) */
.policy-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.9); /* Darker overlay to emphasize modal */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s forwards;
}

.policy-modal.show {
  display: flex;
}

.policy-modal .modal-content h2 {
  margin-top: 0;
  color: #fff;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.policy-modal .modal-content p {
  margin-bottom: 10px;
  line-height: 1.5;
}

.policy-modal .modal-content a {
  color: #ADD8E6; /* Light blue for links */
  text-decoration: underline;
  font-weight: bold;
}

/* Specific style for the "Enter Site" button */
#enter-site-btn {
  margin-top: 20px;
  width: auto; /* Allow button to size based on content */
  padding: 12px 30px; /* Larger padding for a more prominent button */
  font-size: 1.1em; /* Larger font size */
  background-color: #007bff; /* Blue, similar to save settings */
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#enter-site-btn:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}


/* Loading Overlay Styles */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #121212; /* Match body background */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Ensure it's on top of everything */
  transition: opacity 0.5s ease;
  opacity: 1; /* Initially visible */
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none; /* Allow clicks once hidden */
}

/* NEW: Message on loading screen */
.loading-message {
  color: #ffffff; /* White text */
  font-size: .75em; /* Increased font size for prominence */
  line-height: 1.5em;
  margin-top: 60px; /* Increased space between message and logos */
  text-align: center;
}

/* NEW: Message on loading screen */
.loading-message-top {
  color: #ffffff; /* White text */
  font-size: 1.2em; /* Increased font size for prominence */
  margin-top: 60px; /* Increased space between message and logos */
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.7); /* Subtle glow effect */
  animation: fade-in-out-emphasize-top 4s ease-in-out infinite alternate;
}

@keyframes fade-in-out-emphasize {
  0% { opacity: 1; transform: translateY(-30) scale(1.1); } /* Start with lower opacity, no scale */
  25% { opacity: 0.7; transform: translateY(-15px) scale(1.05); } /* Slight pop up and scale */
  50% { opacity: 0.3; transform: translateY(-0px) scale(1); text-shadow: 0 0 15px rgba(255,255,255,0.8); } /* Peak prominence, higher scale, stronger glow */
  75% { opacity: 0.7; transform: translateY(-15px) scale(1.05); } /* Settle back down */
  100% { opacity: 1; transform: translateY(-30) scale(1); } /* End with lower opacity, no scale */
}

@keyframes fade-in-out-emphasize-top {
  0% { opacity: 0.2; transform: translateY(0) scale(1); } /* Start with lower opacity, no scale */
  25% { opacity: 0.7; transform: translateY(-15px) scale(1.05); } /* Slight pop up and scale */
  50% { opacity: 1; transform: translateY(-30px) scale(1.1); text-shadow: 0 0 15px rgba(255,255,255,0.8); } /* Peak prominence, higher scale, stronger glow */
  75% { opacity: 0.7; transform: translateY(-15px) scale(1.05); } /* Settle back down */
  100% { opacity: 0.2; transform: translateY(0) scale(1); } /* End with lower opacity, no scale */
}


/* NEW: Container for the two spinning logos */
.loading-logos-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 200px; /* Adjust height as needed to contain logos */
  position: relative; /* For absolute positioning of logos */
  margin-bottom: 20px;
}

.loading-logo {
  position: absolute; /* Position logos within the container */
  max-width: 120px; /* Adjust size as needed */
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3); /* Subtle glow effect */
}

.logo-one {
  animation: spin-and-move-logo1 4s ease-in-out infinite alternate;
  left: 35%; /* Initial position */
}

.logo-two {
  animation: spin-and-move-logo2 4s ease-in-out infinite alternate;
  right: 35%; /* Initial position */
}

.logo-three {
  animation: spin-and-move-logo3 4s ease-in-out infinite alternate;
  right: 48%; /* Initial position */
}

@keyframes spin-and-move-logo1 {
  0% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(50px) rotate(180deg); }
  100% { transform: translateX(0) rotate(360deg); }
}

@keyframes spin-and-move-logo2 {
  0% { transform: translateX(0) rotate(-180deg); } /* Reduced movement */
  100% { transform: translateX(0) rotate(-360deg); }
}
@keyframes spin-and-move-logo3 {
  0% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(50px) rotate(180deg); }
  100% { transform: translateX(0) rotate(-360deg); }
}


.loading-spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #ffffff; /* White spinner */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


.container {
  display: grid;
  width: 100vw;
  height: 100vh; /* Force it to fill viewport on desktop */
  gap: 0;
  transition: padding-top 0.3s ease; /* Smooth transition for padding-top */
  position: relative; /* Needed for swipe indicators */
}

/* NEW: Adjust container height when the scrolling bar is active */
body.wait-times-active .container {
  height: calc(100vh - var(--wait-times-bar-height)); /* Subtract the height of the scrolling bar */
  transition: opacity 0.5s ease;
}

.stream-container {
  position: relative;
  background-color: #000;
  overflow: hidden;
  display: flex; /* Default to flex for non-chat mobile, and desktop */
  flex-direction: row; /* Explicitly default to row for desktop */
  transition: all 0.3s ease;
  width: 100%; /* Ensure it fills the grid cell's width */
  height: 100%; /* Ensure it fills the grid cell's height */
}

/* NEW: Class to hide the stream container */
.stream-container.hidden-stream {
    display: none !important;
}

/* NEW: Class for applying the border */
.stream-container.with-border {
  border: 2px solid grey; /* Default border when displayVideoBorders is true */
}

/* NEW: Border colors based on stream status */
.stream-container.playing-muted {
  border: 2px solid grey; /* Playing and muted */
}

.stream-container.stopped {
  border: 2px solid red; /* Stopped, paused, ended, buffering, cued, unstarted */
}

.stream-container.playing-unmuted {
  border: 2px solid green; /* Playing and unmuted */
}

/* Stream container when chat is on the right (default for desktop) */
.stream-container.with-chat.chat-right .player-container {
  width: calc(100% - var(--chat-window-width)); /* Adjusted for chat panel width from JS */
  height: 100%; /* Take full height */
}

/* Stream container when chat is on the left */
.stream-container.with-chat.chat-left {
    flex-direction: row-reverse; /* Reverse order to place chat on left */
}
.stream-container.with-chat.chat-left .player-container {
    width: calc(100% - var(--chat-window-width)); /* Adjusted for chat panel width from JS */
    height: 100%; /* Take full height */
}

/* --- NEW: PLAYER CONTAINER AND CONTROLS LAYOUT --- */

.player-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex; /* Make player container a flexbox for layout */
}

/* Video Wrapper: Takes remaining space and holds the absolute player */
.video-wrapper {
    flex-grow: 1;
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
    /* FIXED: Removed transition here. Flexbox will handle resizing smoothly as sibling grows */
}

/* Desktop Controls Container */
.desktop-controls {
    display: flex;
    background-color: rgba(20, 20, 20, 1); /* Solid background, not transparent overlay */
    z-index: 20;
    flex-shrink: 0;
    gap: 10px;
    padding: 5px;
    justify-content: center;
    align-items: center;
    /* UPDATED: Added opacity to transition and !important to override JS-injected styles that break the height animation */
    transition: width 0.3s ease, height 0.3s ease, padding 0.3s ease, border-width 0.3s ease, opacity 0.3s ease !important;
    overflow: hidden; /* Ensure content doesn't show during slide */
    border-style: solid; /* Constant style to allow width transition */
    border-color: #555;
    border-width: 0; /* Default hidden border */
}

/* NEW: Allow overflow when interacting so tooltips/labels can pop out */
.desktop-controls:hover {
    overflow: visible;
}

/* Reset absolute positioning for buttons when inside desktop controls */
.desktop-controls .chat-button,
.desktop-controls .hide-btn,
.desktop-controls .like-video-btn,
.desktop-controls .focus-btn,
.desktop-controls .site-fullscreen-btn,
.desktop-controls .dsn-icon-container {
    position: static; /* Default static position */
    transform: none;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 0;
    opacity: 1 !important; /* Visiblity managed by parent */
    display: flex;
}

/* --- NEW: Styles for Elements Moved Inside Desktop Controls (Top/Bottom) --- */

/* Reset positioning for Label and View Count when inside the control bar */
.desktop-controls .channel-label,
.desktop-controls .view-count-display {
    /* Changed from static to relative to allow z-index layering and hover effects */
    position: relative !important;
    transform: none !important;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    background: none !important; /* Remove background so it blends with bar */
    margin: 0;
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    border-radius: 0;
    box-shadow: none !important;
}

/* Channel Label specific styles inside bar */
.desktop-controls .channel-label {
    flex-grow: 1; /* Push subsequent buttons to the right */
    justify-content: flex-start;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0; /* Allow flex shrinking */
    order: -10; /* Ensure label is after DSN icon but before other buttons */
}

/* NEW: Override for channel label hover behavior */
.desktop-controls .channel-label:hover {
    overflow: visible;
    z-index: 100; /* Layer above other controls */
    background: rgba(20, 20, 20, 1); /* Match control bar background */
    padding-right: 10px; /* Add some breathing room */
    border-radius: 0 4px 4px 0; /* Rounded corners on right */
    box-shadow: 4px 0 8px rgba(0,0,0,0.5); /* Shadow to lift it off */
}

.desktop-controls .channel-label .channel-name-text,
.desktop-controls .channel-label .video-title {
    background: none !important;
    padding: 0;
    margin-right: 5px;
    font-size: 14px;
    color: #fff;
    text-shadow: none;
}

/* Ensure text inside breaks out of ellipsis */
.desktop-controls .channel-label:hover .video-title {
    overflow: visible !important;
    text-overflow: clip !important;
}

/* Ensure child text elements have background to cover buttons if needed */
.desktop-controls .channel-label:hover .channel-name-text,
.desktop-controls .channel-label:hover .video-title {
    background: rgba(20, 20, 20, 1) !important;
}

/* View Count specific styles inside bar */
.desktop-controls .view-count-display {
    border-left: 1px solid #444; /* Separator line */
    justify-content: center;
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
    order: 100; /* Ensure it stays at the very end */
}

/* Force view count visibility when inside bar (override hover logic) */
.desktop-controls .view-count-display-on-hover {
    opacity: 1 !important;
}

/* Adjust general button spacing in the bar */
.desktop-controls > button, 
.desktop-controls > .chat-button,
.desktop-controls > .dsn-icon-container {
    margin: 0 2px; /* Tighten up spacing */
}

/* Explicitly set order for DSN icon container to be first */
.desktop-controls .dsn-icon-container {
    order: -20; /* NEW: DSN Icon is first */
}

/* Ensure video title truncation works */
.desktop-controls .video-title {
    text-overflow: ellipsis;
    overflow: hidden;
}

/* --- Layout Logic based on classes from ui.js --- */

/* Controls Left */
.controls-pos-left .player-container {
    flex-direction: row;
}
.controls-pos-left .desktop-controls {
    order: -1; /* Move to start (left) */
    flex-direction: column;
    width: var(--desktop-controls-size);
    height: 100%;
    border-right-width: 1px; /* Apply width to show border */
    border-top-width: 0;
    border-bottom-width: 0;
    border-left-width: 0;
}

/* Controls Right */
.controls-pos-right .player-container {
    flex-direction: row;
}
.controls-pos-right .desktop-controls {
    order: 1; /* Move to end (right) */
    flex-direction: column;
    width: var(--desktop-controls-size);
    height: 100%;
    border-left-width: 1px;
    border-right-width: 0;
    border-top-width: 0;
    border-bottom-width: 0;
}
/* Adjust View Count if controls are on right to avoid overlap */
.controls-pos-right .view-count-display {
    right: var(--desktop-controls-size) !important;
    border-radius: 0 0 3px 3px; /* Adjust border radius */
}

/* Controls Bottom */
.controls-pos-bottom .player-container {
    flex-direction: column;
}
.controls-pos-bottom .desktop-controls {
    order: 1; /* Move to end (bottom) */
    flex-direction: row;
    width: 100%;
    height: var(--desktop-controls-size);
    border-top-width: 1px;
    border-bottom-width: 0;
    border-left-width: 0;
    border-right-width: 0;
    padding: 0 10px; /* Horizontal padding */
}

/* Controls Top */
.controls-pos-top .player-container {
    flex-direction: column;
}
.controls-pos-top .desktop-controls {
    order: -1; /* Move to start (top) */
    flex-direction: row;
    width: 100%;
    height: var(--desktop-controls-size);
    border-bottom-width: 1px;
    border-top-width: 0;
    border-left-width: 0;
    border-right-width: 0;
    padding: 0 10px; /* Horizontal padding */
}

/* --- Visibility Logic (Updated for collapse/slide) --- */

/* Default 'Hover' state: Collapsed */
.controls-vis-hover .desktop-controls {
    padding: 0;
    overflow: hidden;
    opacity: 0; /* Match ui.js behavior explicitly */
}

/* Hover state: BOTTOM - collapse height */
.controls-vis-hover.controls-pos-bottom .desktop-controls {
    height: 0;
    border-width: 0;
}
.controls-vis-hover.controls-pos-bottom .stream-container:hover .desktop-controls {
    height: var(--desktop-controls-size);
    padding: 0 10px;
    border-top-width: 1px;
    opacity: 1;
}

/* Hover state: TOP - collapse height */
.controls-vis-hover.controls-pos-top .desktop-controls {
    height: 0;
    border-width: 0;
}
.controls-vis-hover.controls-pos-top .stream-container:hover .desktop-controls {
    height: var(--desktop-controls-size);
    padding: 0 10px;
    border-bottom-width: 1px;
    opacity: 1;
}

/* Hover state: LEFT/RIGHT - collapse width */
.controls-vis-hover.controls-pos-left .desktop-controls,
.controls-vis-hover.controls-pos-right .desktop-controls {
    width: 0;
    border-width: 0;
}
.controls-vis-hover.controls-pos-left .stream-container:hover .desktop-controls {
    width: var(--desktop-controls-size);
    padding: 5px;
    border-right-width: 1px;
    opacity: 1;
}
.controls-vis-hover.controls-pos-right .stream-container:hover .desktop-controls {
    width: var(--desktop-controls-size);
    padding: 5px;
    border-left-width: 1px;
    opacity: 1;
}


/* --- END LAYOUT LOGIC --- */


.yt-player {
  width: 133.33%; /* 100% / 0.75 to compensate for scale */
  height: 133.33%; /* 100% / 0.75 to compensate for scale */
  position: absolute; /* Position absolutely within video-wrapper */
  top: 0; 
  left: 0; 
  transform: scale(0.75); /* Scale down to 75% */
  transform-origin: 0 0; /* Scale from top-left corner */
}


.channel-label {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 12px;
  z-index: 10;
  margin: 0;
  display: flex;
  max-width: 100%;
  white-space: nowrap;
  overflow: visible;
  /* UPDATED: Slide transition */
  transition: transform 0.3s ease;
}

/* Slide Channel Label Right when Left controls appear */
.controls-vis-hover.controls-pos-left .stream-container:hover .channel-label {
    transform: translateX(var(--desktop-controls-size));
    /* DELAY REMOVED for synced slide */
}
/* Slide Channel Label Down when Top controls appear */
.controls-vis-hover.controls-pos-top .stream-container:hover .channel-label {
    transform: translateY(var(--desktop-controls-size));
    /* DELAY REMOVED for synced slide */
}

.channel-name-text {
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 0 0 3px 0;
  transition: background-color 0.3s ease;
}

.channel-name-text:hover {
  background: rgba(0, 0, 0, 0.9);
}

.video-title {
  opacity: 0;
  background: rgba(0, 0, 0, 0);
  padding: 2px 8px;
  padding-left: 1px;
  border-radius: 0 0 3px 0;
  transition: opacity 0.3s ease, background-color 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 0px;
  max-width: none;
  display: inline-block;
  vertical-align: top;
}

/* Fullscreen overlay controls */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  z-index: 1000;
  display: none;
}

.fullscreen-player-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.fullscreen-yt-player {
  width: 100%;
  height: 100%;
}

.fullscreen-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-overlay:hover .fullscreen-controls {
  opacity: 1;
}

.fullscreen-nav-btn {
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-nav-btn:hover {
  background: rgba(70,70,70,0.7);
}

.fullscreen-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: white;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-overlay:hover .fullscreen-close-btn {
  opacity: 1;
}

.fullscreen-channel-label {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0,0,0,0.7);
  padding: 5px 15px;
  font-size: 16px;
  border-radius: 4px;
  z-index: 1001;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fullscreen-overlay:hover .fullscreen-channel-label {
  opacity: 1;
}

/* NEW: Custom Site-Wide Fullscreen Mode */
#streams-container.site-fullscreen-mode {
    /* When in fullscreen, the grid layout is disabled and it becomes a positioning context. */
    display: block;
    position: relative;
}

/* Hide all stream containers by default when in this mode */
#streams-container.site-fullscreen-mode .stream-container {
    display: none !important;
}

/* Show ONLY the active stream and make it fill the container */
#streams-container.site-fullscreen-mode .stream-container.fullscreen-active {
    display: flex !important; /* Use important to override other display properties */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500; /* Bring it to the front of other streams */
    border: none; /* Remove any borders */
}

/* Ensure the player inside the fullscreen container scales to fill the space */
.stream-container.fullscreen-active .yt-player {
    /* Override the default scaled-down version */
    transform: scale(1);
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}