:root {
  --overlay-bg: rgba(0,0,0,0.55);
  --accent: #e50914;
}

html, body {
  height:100%;
  margin:0;
  background:#000;
  color:#fff;
  font-family:Segoe UI,Roboto,Arial,sans-serif;
  overflow:hidden;
}

/* ================= VIDEO ================= */
#videoWrapper {
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:0;
}

video {
  width:100vw;
  height:100vh;
  object-fit:contain;
  transition:opacity .45s ease;
  opacity:0;
}

video.loaded { opacity:1; }

/* ================= GUIDE ================= */
#guide {
  position:fixed;
  top:0;
  right:0;
  height:100vh;
  width:320px;
  background:linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.85));
  padding:0.5rem 0.75rem;
  box-sizing:border-box;
  transform:translateX(100%);
  transition:transform .32s cubic-bezier(.2,.9,.2,1);
  overflow:hidden;
  z-index:60;
}

#guide.visible { transform:none; }

#guide > #channelBtn {
    display: none !important;
}

/* Header "MyIPTV" */
#guideHeader {
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.9);
  color: #4682B4;
  font-weight: 700;
  font-size: 1.6rem;
  padding: 12px 10px;
  z-index: 70;
}

/* Search bar */
#searchInput {
  position: sticky;
  top: 40px;
  background: #2c2c2c;
  color: #fff;
  font-size: 0.95rem;
  height: 40px;
  padding: 0 12px;
  border-radius: 20px;
  border: none;
  margin-bottom: 8px;
  z-index: 70;
  box-sizing: border-box;
  outline: none;
  transition: background 0.3s, box-shadow 0.3s;
}

#searchInput:focus {
  background: #3a3a3a;
  box-shadow: 0 0 8px rgba(255,255,255,0.2);
}

/* ================= CHANNEL LIST ================= */
/* Scrollable channel list with hidden scrollbar */
#channelListContainer {
  overflow-y: auto;
  max-height: calc(100vh - 40px - 56px); /* header + search bar */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

#channelListContainer::-webkit-scrollbar {
  width: 0px; /* Chrome, Edge, Safari */
}

/* Channel list items */
.channel {
  display:flex;
  align-items:center;
  gap:.75rem;
  padding:.5rem;
  border-radius:8px;
  cursor:pointer;
  transition:all .15s ease;
}

.channel img {
  width:56px;
  height:32px;
  object-fit:contain;
  border-radius:4px;
}

.channel .name {
  font-size:1rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.channel:hover,
.channel.selected {
  background:rgba(255,255,255,0.06);
}

.channel.selected {
  background: rgba(0, 170, 255, 0.3) !important;
  transform: scale(1.03);
  border-left: 4px solid #00aaff;
  font-weight: bold;
}

/* ================= OVERLAYS ================= */
#overlay {
  position:fixed;
  left:24px;
  top:22px;
  background:var(--overlay-bg);
  border-radius:14px;
  padding:10px 16px;
  backdrop-filter:blur(5px);
  z-index:55;
  box-shadow:0 6px 18px rgba(0,0,0,0.6);
}

#overlay img {
  width:96px;
  height:72px;
  object-fit:contain;
  border-radius:10px;
}

#resolutionBadge {
  position:fixed;
  left:24px;
  top:20px;
  background:rgba(0,0,0,0.6);
  padding:6px 10px;
  border-radius:8px;
  font-weight:600;
  z-index:55;
  opacity:0;
  transition:opacity .3s;
}
#resolutionBadge.show { opacity:1; }

/* ================= PROGRESS BAR ================= */
#progressWrap {
  position:fixed;
  left:24px;
  right:24px;
  bottom:18px;
  height:8px;
  z-index:55;
  display:flex;
  align-items:center;
  gap:12px;
  padding-bottom: 6px;
}

#progressBar { flex:1; height:6px; background:rgba(255,255,255,0.12); border-radius:4px; overflow:hidden; position:relative; }
#bufferBar { position:absolute; left:0; top:0; height:6px; background:rgba(255,255,255,0.35); width:0%; }
#playedBar { position:absolute; left:0; top:0; height:6px; background:var(--accent); width:0%; }
#liveIndicator { position:fixed; right:24px; top:70px; background:var(--accent); color:#fff; padding:4px 8px; border-radius:6px; font-weight:700; font-size:.86rem; z-index:55; }

/* ================= SPINNER ================= */
#spinner {
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  z-index:70;
  display:none;
}

.spinner-dot { width:12px; height:12px; background:rgba(255,255,255,0.95); border-radius:50%; display:inline-block; margin:6px; animation:spin .9s linear infinite; }
.spinner-dot:nth-child(2){ animation-delay:.12s; }
.spinner-dot:nth-child(3){ animation-delay:.24s; }

@keyframes spin { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-8px); } }

/* ================= CHANNEL NUMBER ================= */
#channelNumber {
  position:fixed;
  left:50%;
  top:45%;
  transform:translate(-50%,-50%);
  background:rgba(0,0,0,0.65);
  padding:14px 22px;
  border-radius:12px;
  font-size:3.2rem;
  font-weight:700;
  z-index:80;
  opacity:0;
  transition:opacity .2s;
}
#channelNumber.show { opacity:1; }

/* ================= FULLSCREEN BTN ================= */
#fullscreenBtn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  padding: 8px 12px;
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 20px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#fullscreenBtn:hover {
  opacity: 0.6;
}

/* ================= PLAY OVERLAY ================= */
#playOverlay {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:75;
  cursor:pointer;
}

#playOverlay button {
  background: linear-gradient(135deg, #ffa733, #ff8800);
  border:none;
  border-radius:50%;
  width:90px;
  height:90px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 0 20px rgba(255,136,0,0.5);
  animation:pulse 1.5s infinite;
}

#playOverlay svg { width:38px; height:38px; fill:white; margin-left:4px; }

@keyframes pulse { 0%{transform:scale(1); box-shadow:0 0 10px rgba(255,136,0,0.4);} 50%{transform:scale(1.1); box-shadow:0 0 25px rgba(255,136,0,0.8);} 100%{transform:scale(1); box-shadow:0 0 10px rgba(255,136,0,0.4);} }

/* ================= EDGE ZONES ================= */
#edgeZone { position:fixed; top:0; right:0; width:60px; height:100vh; background:transparent; z-index:50; pointer-events:none; }
@media (hover: none) and (pointer: coarse) { #edgeZone { pointer-events:auto; } }
#focusEdge { pointer-events:auto; }

#rightEdgeTouchStrip {
  background: transparent;
}


/* ================= NOTIFY ================= */
#notify {
  position: fixed;
  top:20px;
  left:50%;
  transform: translateX(-50%);
  background: rgba(255,140,0,0.9);
  color:#fff;
  padding:10px 18px;
  border-radius:8px;
  font-weight:600;
  z-index:120;
  opacity:0;
  transition: opacity 0.4s ease, top 0.4s ease;
  will-change: top, opacity;
}
#notify.show { opacity:1; top:40px; }

/* ================= RESPONSIVE ================= */
@media(max-width:900px){
  #guide{ width:260px; }
  #overlay img{ width:72px; height:56px; }
}

/* ================= REMOVE WHITE NON-FUNCTIONAL BUTTON ================= */
#channelBtn.white-button {
  display: none !important;
}

