* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body, html {
  height: 100%;
  overflow: hidden;
  background: #000;
}
#player {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  position: relative;
  z-index: 1;
}
#menu-btn {
  position: fixed;
  top: -5px;
  left: -5px;
  z-index: 100;
  cursor: pointer;
  color: #fff;
  font-size: 24px;
  transition: opacity 0.3s;
  padding: 16px 40px 16px 16px;  /* vertical padding 16px, left (icon side) minimal 16px, right expansion 40px inward for hit area */
}
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 1500px;
  max-width: 100vw;
  height: 100%;
  background: rgba(0,0,0,0.8);
  transform: translateX(-100%);
  transition: transform .3s;
  z-index: 101;
  padding: 60px 16px 220px 16px;
  overflow-y: hidden;
}
#sidebar.open {
  transform: translateX(0);
}
.channel {
  color: #fff;
  cursor: pointer;
  display: flex;
}
.channel:hover {
  background: #333;
}
.channel-header {
  width: 160px;
  padding: 12px;
  display: flex;
  align-items: center;
}
.channel-header img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}
.timeline-container {
  flex: 1;
  position: relative;
  height: 75px;
  background: #222;
  overflow: hidden;
}
.program-block {
  position: absolute;
  top: 0;
  height: 100%;
  background: #333;
  border-right: 1px solid #444;
  color: #fff;
  padding: 4px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  z-index: 1;
  pointer-events: auto;
}
.program-block:hover {
  background: #3a3a3a;
  border: 1px solid #aaa;
  z-index: 3;
}
.program-block.now-playing {
  background: #4a1a1a;
  border-right: 1px solid #ff4444;
  box-shadow: inset 0 0 8px rgba(255, 0, 0, 0.4);
}
.program-block.now-playing:hover {
  background: #5a2a2a;
  border: 1px solid #ff7777;
}
.program-block .prog-title {
  font-weight: bold;
  color: #fff;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.program-block .prog-episode {
  display: block;
  color: #ccc;
  font-size: 11px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.current-time {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: red;
  z-index: 10;
  pointer-events: none;
}
.current-time::before {
  content: '';
  position: absolute;
  top: 0;
  left: -10px;
  right: -10px;
  bottom: 0;
  pointer-events: none;
}
.guide-header {
  display: flex;
  position: sticky;
  top: 0;
  background: #111;
  z-index: 1;
}
.timeline-header {
  flex: 1;
  position: relative;
  height: 30px;
  color: #aaa;
  font-size: 12px;
}
.time-label {
  position: absolute;
  transform: translateX(-50%);
}
.close {
  position: absolute;
  top: 0px;
  right: 0px;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 16px 16px 16px 40px;  /* vertical padding 16px, right (icon side) minimal 16px, left expansion 40px inward for hit area */
  line-height: 1;
}
.title {
  position: absolute;
  top: 16px;
  left: 16px;
  color: #fff;
  font-size: 24px;
}
#play-btn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 48px;
  cursor: pointer;
  z-index: 10;
  background: rgba(0,0,0,0.5);
  padding: 20px 40px;
  border-radius: 12px;
  transition: opacity 0.3s;
}
#fullscreen-btn {
  position: fixed;
  top: -5px;
  right: -5px;
  z-index: 100;
  cursor: pointer;
  color: #fff;
  font-size: 24px;
  transition: opacity 0.3s;
  padding: 16px 16px 16px 40px;  /* vertical padding 16px, right (icon side) minimal 16px, left expansion 40px inward for hit area */
}
#timeline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75px;
  background: transparent;
  color: #fff;
  padding: 8px;
  font-size: 12px;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.3s;
}
#progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #0f0;
  width: 0%;
  z-index: 3;
}
#now-playing {
  font-weight: bold;
  pointer-events: none;
}
#up-next {
  margin-top: 4px;
  opacity: 0.8;
  pointer-events: none;
}
.hidden {
  opacity: 0;
  pointer-events: none;
}
.grid-line {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(255,255,255,0.15);
}
.grid-line.half {
  background: rgba(255,255,255,0.08);
}
#details-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 1500px;
  max-width: 100vw;
  height: 220px;
  background: #111;
  padding: 16px;
  color: #fff;
  border-top: 1px solid #444;
  z-index: 102;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
}
#details-panel .image-container {
  width: 140px;
  height: 180px;
  flex-shrink: 0;
  margin-right: 16px;
  overflow: hidden;
  background: #222;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
#details-panel .image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
#details-panel .content-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#details-panel .title-section {
  flex-shrink: 0;
  margin-bottom: 8px;
}
#details-panel .title-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
#details-panel .title-section h4 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 2px 0;
  color: #eee;
}
#details-panel .title-section .episode {
  font-size: 13px;
  color: #ccc;
  margin: 0;
}
#details-panel .description-section {
  flex: 1;
  overflow-y: auto;
  color: #ddd;
  font-size: 13px;
  line-height: 1.45;
  padding-right: 8px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}
#details-panel .description-section::-webkit-scrollbar {
  width: 6px;
}
#details-panel .description-section::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}
#details-panel .description-section::-webkit-scrollbar-thumb:hover {
  background: #777;
}
#details-panel .description-section:hover {
  overflow-y: auto;
}
#details-panel .description-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, #111);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#details-panel .description-section:hover::after {
  opacity: 1;
}
#details-panel .rating-section {
  flex-shrink: 0;
  margin-top: 8px;
  font-size: 13px;
  color: #aaa;
  font-style: italic;
  padding-right: 8px;
}
#channels {
  padding-bottom: 200px;
}
/* Existing mobile hide (max-width) remains */
@media (max-width: 767px) {
  #details-panel {
    display: none;
  }
}
/* NEW: Hide details-panel on short screens (height < 630px) */
@media (max-height: 629px) {
  #details-panel {
    display: none !important;
  }
}
/* NEW: Fix scrollbars on short screens (~817px height or less) */
@media (max-height: 850px) {
  #sidebar {
    padding: 60px 16px 180px 16px;          /* reduce bottom padding to fit details-panel */
    overflow-y: hidden;                     /* no sidebar scrollbar */
  }

  #details-panel {
    height: 180px;                          /* slightly shorter panel on small heights */
    padding: 12px;                          /* less internal padding */
  }

  #details-panel .image-container {
    height: 140px;                          /* smaller image to save vertical space */
  }

  #details-panel .description-section {
    font-size: 12.5px;                      /* slightly smaller text */
    line-height: 1.4;
    overflow-y: hidden;                     /* no scrollbar unless really needed */
  }

  #details-panel .description-section:hover {
    overflow-y: auto;                       /* only show scrollbar on hover if content overflows */
  }

  #details-panel .title-section h3 {
    font-size: 16px;                        /* smaller title */
  }

  #details-panel .title-section h4,
  #details-panel .title-section .episode {
    font-size: 13px;
  }

  #details-panel .rating-section {
    font-size: 12px;
  }

  #channels {
    padding-bottom: 160px;                  /* reduced buffer */
  }
}

/* Mobile portrait: switch to vertical list layout */
@media (max-width: 767px) {
  #sidebar {
    padding: 0;
    overflow-y: hidden;
  }

  .mobile-sidebar-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #111;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  }

  .mobile-sidebar-header .title {
    position: static;
    font-size: 20px;
    margin: 0;
  }

  .mobile-sidebar-header .close {
    position: static;
    font-size: 32px;
    padding: 8px;
    cursor: pointer;
  }

  .channel-list {
    margin-top: 60px;
    padding: 12px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide the guide-header completely in mobile portrait */
  .guide-header {
    display: none !important;
  }

  /* Hide the timeline grid completely */
  .timeline-container,
  .grid-line,
  .current-time,
  .program-block {
    display: none !important;
  }

  /* Make each channel a full-width vertical card */
  .channel {
    display: block;
    margin-bottom: 16px;
    background: #222;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
  }

  .channel-header {
    width: 100%;
    padding: 12px;
    background: #111;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #333;
  }

  .channel-header strong {
    font-size: 1.1em;
    margin-right: 12px;
  }

  .channel-header img {
    width: 32px;
    height: 32px;
    margin-right: 12px;
  }

  .channel-header div {
    font-size: 1em;
    flex: 1;
  }

  /* Program list inside each channel */
  .channel-programs {
    padding: 8px 12px;
  }

  .channel-program {
    padding: 8px 0;
    border-bottom: 1px solid #333;
    font-size: 0.95em;
  }

  .channel-program:last-child {
    border-bottom: none;
  }

  .channel-program.now-playing {
    background: #4a1a1a;
    padding: 10px 12px;
    margin: 0 -12px;
    border-radius: 4px;
  }

  .channel-program-title {
    font-weight: bold;
    color: #fff;
  }

  .channel-program-time {
    color: #aaa;
    font-size: 0.85em;
    margin: 2px 0;
  }

  .channel-program-episode {
    color: #ccc;
    font-size: 0.9em;
  }

  /* Details panel stays hidden on mobile as before */
  #details-panel {
    display: none !important;
  }

  #sidebar > .title,
  #sidebar > .close {
    display: none;
  }
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 4px;
  font-size: 13px;
  color: #ddd;
  pointer-events: auto;       /* important – allows interaction */
  z-index: 4;
}

.volume-icon {
  font-size: 16px;
  opacity: 0.9;
}

#volume-slider {
  width: 120px;
  height: 6px;
  -webkit-appearance: none;
  background: rgb(255 255 255 / 70%);
  border-radius: 3px;
  outline: none;
  margin: 0;
  cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #0f0;           /* matches your progress bar accent */
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,255,0,0.6);
}

#volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #0f0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,255,0,0.6);
}


#volume-slider::-moz-range-track {
  background: rgba(255,255,255,0.25);
}

/* Optional: make it a bit less visible when controls are hidden */
#timeline.hidden .volume-container {
  opacity: 0.3;
}

/* Very small screens – make slider shorter */
@media (max-width: 420px) {
  #volume-slider {
    width: 90px;
  }
}
