* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ── Loading Screen ── */

#loading-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.loading-content {
  text-align: center;
}

.logo {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.3em;
}

.logo span {
  color: #e44;
  font-weight: 400;
}

.tagline {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 1.5em;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #1a1a1a;
  border-top-color: #e44;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Player Screen ── */

#player-screen {
  width: 100%;
  height: 100%;
  background: #000;
  position: relative;
}

.player-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.player-layer.active {
  opacity: 1;
  pointer-events: auto;
}

.player-layer iframe,
.player-layer div {
  width: 100% !important;
  height: 100% !important;
  border: none;
}

/* Kill YouTube branding/controls that leak through iframe */
.player-layer iframe {
  outline: none;
}

/* ── Up Next Overlay ── */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  animation: fadeIn 0.3s ease;
}

.overlay-content {
  text-align: center;
  max-width: 700px;
  padding: 2em;
}

.overlay .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #e44;
  margin-bottom: 0.8em;
}

.overlay .title {
  display: block;
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.4;
  color: #ccc;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Top Bar ── */

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent);
  pointer-events: none;
}

.channel-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 14px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #e44;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.channel-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #fff;
  text-transform: uppercase;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.current-time {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Bottom Bar ── */

.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  padding: 16px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  pointer-events: none;
}

.now-playing {
  pointer-events: auto;
}

.np-title {
  font-size: 0.85rem;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
}

/* ── EPG Panel ── */

.epg-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  width: 340px;
  max-width: 85vw;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.epg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.epg-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #e44;
}

.epg-close {
  background: none;
  border: none;
  color: #555;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s;
}

.epg-close:hover {
  color: #fff;
}

.epg-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.epg-list::-webkit-scrollbar {
  width: 3px;
}

.epg-list::-webkit-scrollbar-thumb {
  background: #222;
  border-radius: 2px;
}

/* ── EPG Channel Header ── */

.epg-channel-header {
  padding: 10px 18px 6px;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #e44;
  background: rgba(228, 68, 68, 0.04);
  border-bottom: 1px solid #1a1a1a;
}

/* ── EPG Item ── */

.epg-item {
  padding: 10px 18px;
  border-bottom: 1px solid #141414;
  transition: background 0.15s;
  cursor: default;
}

.epg-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.epg-item.active {
  background: rgba(228, 68, 68, 0.08);
  border-left: 3px solid #e44;
}

.epg-item-number {
  font-size: 0.65rem;
  font-weight: 500;
  color: #444;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.epg-item.active .epg-item-number {
  color: #e44;
}

.epg-item-title {
  font-size: 0.8rem;
  color: #999;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 400;
}

.epg-item.active .epg-item-title {
  color: #eee;
  font-weight: 500;
}

.epg-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.epg-item-time {
  font-size: 0.6rem;
  font-weight: 500;
  color: #555;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 50px;
}

.epg-item.active .epg-item-time {
  color: #e44;
}

.epg-progress {
  flex: 1;
  height: 3px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
}

.epg-progress-bar {
  height: 100%;
  width: 0%;
  background: #e44;
  border-radius: 2px;
  transition: width 0.3s linear;
}

/* ── Start Overlay ── */
.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: opacity 0.3s;
}
.start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.start-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.start-play-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}
.start-overlay:hover .start-play-btn {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
  transform: scale(1.08);
}
.start-label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Responsive ── */

@media (max-width: 600px) {
  .logo { font-size: 2rem; }
  .overlay .title { font-size: 1.1rem; }
  .epg-panel { width: 280px; }
  .top-bar, .bottom-bar { padding: 12px 14px; }
  .start-play-btn { width: 64px; height: 64px; font-size: 26px; }
}
