* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
  scrollbar-width: none;
}

::-webkit-scrollbar {
  display: none;
}

.player-page,
#app,
.player-container {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #000;
  outline: none;
}

.player-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* Letterbox frame: the largest 16:9 box that fits inside the viewport,
   centered, with black bars filling any leftover space on either axis. */
.player-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  background: #000;
  margin: auto;
}

#embedPlayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
  z-index: 1;
  /* Native player controls (progress bar, play/pause, volume, fullscreen)
     live inside this iframe's own document — pointer-events must be enabled
     so clicks/taps reach them directly instead of being blocked. */
  pointer-events: auto;
}

.programme-overlay {
  position: absolute;
  inset: auto 0 0;
  z-index: 35;
  padding: 132px 20px 20px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.18) 18%, rgba(0, 0, 0, 0.84) 100%);
  pointer-events: none;
}

.programme-panel {
  position: relative;
  pointer-events: auto;
  padding: 0 74px 8px 112px;
}

.programme-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.programme-eyebrow {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.programme-title {
  margin: 8px 0 0;
  font-size: clamp(26px, 2.8vw, 38px);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.programme-hint {
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: right;
}

.programme-rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 6px 8px 4px;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.programme-rail::-webkit-scrollbar {
  display: none;
}

.overlay-close-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 10px 0 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.overlay-close-bar-line {
  display: block;
  width: min(224px, 52vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.overlay-close-bar-text {
  color: rgba(255, 255, 255, 0.96);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.overlay-close-bar-programme {
  margin-top: 14px;
}

.overlay-close-bar-sidebar {
  padding: 0 22px 18px;
}

.programme-nav {
  position: absolute;
  top: 55%;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.86);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.programme-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.programme-nav-left {
  left: 24px;
}

.programme-nav-right {
  right: 24px;
}

.programme-card,
.programme-empty {
  flex: 0 0 clamp(216px, 19vw, 262px);
  scroll-snap-align: start;
}

.programme-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(12, 16, 24, 0.88);
  color: #fff;
  padding: 0;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.programme-card.is-focused {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.64);
  background: rgba(19, 24, 35, 0.94);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.programme-card.is-current {
  border-color: rgba(255, 93, 93, 0.56);
}

.programme-card.is-live-return {
  border-color: rgba(46, 212, 112, 0.46);
}

.programme-card.is-unavailable {
  opacity: 0.9;
}

.programme-poster-wrap {
  position: relative;
  width: 100%;
  height: 132px;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2332, #31445f 54%, #0e1118);
}

.programme-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.programme-poster-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.programme-poster-wrap.is-fallback .programme-poster {
  display: none;
}

.programme-poster-wrap.is-fallback .programme-poster-fallback {
  display: flex;
}

.programme-play-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 194, 95, 0.92);
  color: #041308;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.programme-play-badge.is-disabled {
  background: rgba(0, 0, 0, 0.78);
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.programme-play-badge.is-live {
  background: rgba(255, 82, 82, 0.94);
  color: #fff;
}

.programme-card-body {
  padding: 13px 14px 15px;
}

.programme-card-time {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.programme-card-title {
  margin-top: 8px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
}

.programme-card-meta {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 600;
}

.programme-card-synopsis {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
}

.programme-empty {
  display: flex;
  align-items: center;
  min-height: 190px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(12, 16, 24, 0.88);
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
}

.channel-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: min(340px, 88vw);
  height: 100vh;
  padding: 20px 0;
  background: rgba(8, 10, 16, 0.78);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: transform 220ms ease, opacity 220ms ease, visibility 220ms ease;
  pointer-events: auto;
}

.channel-sidebar.hidden {
  display: flex !important;
  transform: translateX(110%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.channel-sidebar-header {
  padding: 8px 22px 18px;
}

.channel-sidebar-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.channel-sidebar-hint {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: calc(50vh - 110px) 18px 18px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.channel-list::-webkit-scrollbar {
  display: none;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 92px;
  margin: 10px 0;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-align: left;
  cursor: pointer;
  opacity: 0.66;
  transform: scale(0.96);
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.channel-item.focused {
  opacity: 1;
  transform: scale(1);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.22);
}

.channel-item.is-current {
  border-color: rgba(255, 82, 82, 0.55);
}

.channel-logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  flex: 0 0 56px;
  overflow: hidden;
}

.channel-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.channel-logo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.channel-logo-wrap.is-fallback .channel-logo-fallback {
  display: flex;
}

.channel-item-body {
  min-width: 0;
  flex: 1;
}

.channel-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.channel-url {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-item-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.channel-item-status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #f34b4b;
  box-shadow: 0 0 0 5px rgba(243, 75, 75, 0.16);
}

@media (max-width: 768px) {
  .programme-overlay {
    padding: 116px 12px 12px;
  }

  .programme-panel {
    padding: 0 42px 4px 0;
  }

  .programme-header {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 14px;
  }

  .programme-hint {
    text-align: left;
    font-size: 12px;
  }

  .programme-nav {
    width: 46px;
    height: 46px;
    font-size: 30px;
  }

  .programme-nav-left {
    left: 2px;
  }

  .programme-nav-right {
    right: 2px;
  }

  .overlay-close-bar-line {
    width: min(168px, 56vw);
    height: 7px;
  }

  .overlay-close-bar-text {
    font-size: 12px;
  }

  .programme-card,
  .programme-empty {
    flex-basis: 62vw;
    max-width: 68vw;
  }

  .programme-poster-wrap {
    height: 118px;
  }

  .programme-card-time {
    font-size: 11px;
  }

  .programme-card-title {
    font-size: 17px;
  }

  .programme-card-synopsis {
    font-size: 12px;
  }

  .channel-sidebar {
    width: min(320px, 92vw);
  }

  .channel-item {
    min-height: 84px;
    padding: 14px 16px;
  }

  .channel-name {
    font-size: 18px;
  }
}

.hidden {
  display: none !important;
}