/* PirateMedia Live TV Guide — cinematic neon EPG */

:root {
  --pm-bg: #060608;
  --pm-bg-elevated: #0c0c12;
  --pm-bg-panel: rgba(14, 14, 22, 0.92);
  --pm-bg-card: rgba(18, 18, 28, 0.94);
  --pm-text: #ffffff;
  --pm-text-dim: rgba(255, 255, 255, 0.72);
  --pm-text-mute: rgba(255, 255, 255, 0.48);
  --pm-magenta: #ff00ff;
  --pm-cyan: #00ffff;
  --pm-mint: #00ff88;
  --pm-purple: #a855f7;
  --pm-gradient: linear-gradient(135deg, #ff00ff, #00ff88);
  --pm-gradient-cyan: linear-gradient(135deg, #ff00ff, #00ffff);
  --pm-border: rgba(255, 255, 255, 0.08);
  --pm-border-strong: rgba(255, 255, 255, 0.14);
  --pm-radius: 14px;
  --pm-radius-sm: 10px;
  --pm-radius-pill: 999px;
  --pm-header-h: 64px;
  --pm-pad: clamp(16px, 3.2vw, 44px);
  --pm-font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pm-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --pm-glow-magenta: 0 0 32px rgba(255, 0, 255, 0.35);
  --pm-glow-cyan: 0 0 28px rgba(0, 255, 255, 0.28);

  --epg-accent: var(--pm-magenta);
  --epg-accent-2: var(--pm-cyan);
  --epg-accent-soft: rgba(255, 0, 255, 0.16);
  --epg-accent-glow: rgba(255, 0, 255, 0.45);
  --epg-accent-bar: var(--pm-mint);
  --epg-accent-light: rgba(0, 255, 136, 0.22);
  --epg-row-h: 70px;
  --epg-channel-w: 132px;
  --epg-slot-w: 148px;
  --epg-header-h: 34px;
  --epg-row-gap: 4px;
  --epg-prog-inset: 5px;
  --epg-bg-row: #0a0a10;
  --epg-bg-prog: #14141f;
  --epg-bg-prog-live: #1a1020;
  --epg-line: rgba(255, 0, 255, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

.schedule-body {
  font-family: var(--pm-font);
  background: var(--pm-bg);
  color: var(--pm-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

.pm-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pm-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 10% -10%, rgba(255, 0, 255, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 0%, rgba(0, 255, 255, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(0, 255, 136, 0.08) 0%, transparent 55%),
    linear-gradient(180deg, #060608 0%, #09090f 50%, #060608 100%);
  /* Static on Live TV — animated filter/scale was a constant compositor tax */
  animation: none;
}

.pm-noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes pm-atmosphere {
  from { filter: hue-rotate(0deg) saturate(1); transform: scale(1); }
  to { filter: hue-rotate(12deg) saturate(1.08); transform: scale(1.04); }
}

/* —— Header —— */

.pm-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--pm-header-h);
  background: rgba(6, 6, 10, 0.78);
  border-bottom: 1px solid var(--pm-border);
  backdrop-filter: blur(18px) saturate(1.2);
}

.pm-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--pm-pad);
  display: flex;
  align-items: center;
  gap: 20px;
}

.pm-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}

.pm-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.pm-logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.pm-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.pm-nav::-webkit-scrollbar { display: none; }

.pm-nav-link {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--pm-radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--pm-text-dim);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.pm-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.pm-nav-link.is-active {
  color: #fff;
  background: rgba(168, 85, 247, 0.35);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.45);
}

.pm-discord {
  flex-shrink: 0;
  margin-left: auto;
  padding: 9px 16px;
  border-radius: var(--pm-radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--pm-purple);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.35);
  transition: transform 0.15s, filter 0.15s;
}

.pm-discord:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* —— Hero —— */

.pm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pm-hero {
  position: relative;
  padding: clamp(40px, 7vw, 88px) var(--pm-pad) clamp(28px, 4vw, 44px);
  overflow: hidden;
  animation: pm-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pm-hero-glow {
  position: absolute;
  width: min(720px, 90vw);
  height: min(420px, 55vw);
  left: -8%;
  top: -30%;
  background: radial-gradient(circle, rgba(255, 0, 255, 0.28) 0%, transparent 68%);
  filter: blur(8px);
  pointer-events: none;
  animation: pm-glow-drift 12s ease-in-out infinite alternate;
}

@keyframes pm-glow-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8%, 10%) scale(1.12); }
}

.pm-eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 7px 14px;
  border-radius: var(--pm-radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--pm-border-strong);
}

.pm-live-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pm-magenta);
  box-shadow: 0 0 0 0 rgba(255, 0, 255, 0.55);
  animation: pm-pip 1.5s ease-out infinite;
}

@keyframes pm-pip {
  0% { box-shadow: 0 0 0 0 rgba(255, 0, 255, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(255, 0, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 0, 255, 0); }
}

.pm-title {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 0.95;
}

.pm-title-brand {
  font-size: clamp(3.2rem, 12vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  background: var(--pm-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(255, 0, 255, 0.35));
}

.pm-title-sub {
  font-size: clamp(1.6rem, 4.8vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.pm-lede {
  position: relative;
  margin: 22px 0 0;
  max-width: 36rem;
  font-size: clamp(15px, 1.7vw, 17px);
  line-height: 1.55;
  color: var(--pm-text-dim);
}

@keyframes pm-rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* —— Control rail —— */

.pm-rail {
  position: sticky;
  top: var(--pm-header-h);
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 var(--pm-pad);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 10, 16, 0.78);
  border: 1px solid var(--pm-border-strong);
  backdrop-filter: blur(20px) saturate(1.25);
  box-shadow: var(--pm-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Avoid opacity:0 entrance flash on the Live TV listing shell */
.schedule-body:not(.listing-page--livetv) .pm-rail {
  animation: pm-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.schedule-day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.schedule-day-tab {
  padding: 7px 12px;
  border-radius: var(--pm-radius-pill);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--pm-text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.schedule-day-tab:hover {
  color: #fff;
  border-color: var(--pm-border-strong);
}

.schedule-day-tab.is-active {
  color: #fff;
  background: rgba(168, 85, 247, 0.4);
  border-color: rgba(168, 85, 247, 0.55);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
}

.pm-rail-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.schedule-search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 190px;
  max-width: 340px;
}

.schedule-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--pm-text-mute);
  pointer-events: none;
}

.schedule-search {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: var(--pm-radius-pill);
  border: 1px solid var(--pm-border-strong);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.schedule-search:focus {
  border-color: var(--pm-magenta);
  box-shadow: 0 0 0 3px rgba(255, 0, 255, 0.18), var(--pm-glow-magenta);
}

.schedule-search::placeholder {
  color: var(--pm-text-mute);
}

.schedule-country-wrap {
  position: relative;
  flex: 0 1 220px;
  min-width: 160px;
}

.schedule-country-wrap[hidden] {
  display: none !important;
}

.schedule-country-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--pm-radius-pill);
  border: 1px solid var(--pm-border-strong);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.schedule-country-btn:hover,
.schedule-country-dropdown.is-open .schedule-country-btn {
  border-color: var(--pm-cyan);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.14);
}

.schedule-country-chevron {
  width: 16px;
  height: 16px;
  color: var(--pm-text-mute);
  transition: transform 0.2s;
}

.schedule-country-dropdown.is-open .schedule-country-chevron {
  transform: rotate(180deg);
}

.schedule-country-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  max-height: min(52vh, 380px);
  min-width: 280px;
  border-radius: 16px;
  background: rgba(12, 12, 18, 0.96);
  border: 1px solid var(--pm-border-strong);
  box-shadow: var(--pm-shadow), 0 0 40px rgba(255, 0, 255, 0.12);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.schedule-country-panel[hidden] {
  display: none !important;
}

.schedule-country-search-wrap {
  padding: 12px;
  border-bottom: 1px solid var(--pm-border);
}

.schedule-country-search {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--pm-radius-pill);
  border: 1px solid var(--pm-border);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.schedule-country-search:focus {
  border-color: var(--pm-magenta);
}

.schedule-country-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.schedule-country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--pm-text-dim);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.schedule-country-option:hover,
.schedule-country-option:focus {
  outline: none;
  color: #fff;
  background: rgba(255, 0, 255, 0.12);
}

.schedule-country-option.is-active {
  color: #fff;
  background: rgba(168, 85, 247, 0.28);
}

.schedule-country-flag { font-size: 16px; }
.schedule-country-option-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-country-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--pm-cyan);
}
.schedule-country-count {
  font-size: 11px;
  color: var(--pm-text-mute);
}

.schedule-country-option.is-adult .schedule-country-option-text {
  color: #ff7ab8;
}

.schedule-genre-wrap .schedule-country-btn {
  min-width: 148px;
}

.schedule-clear-btn {
  padding: 11px 14px;
  border-radius: var(--pm-radius-pill);
  border: 1px solid var(--pm-border-strong);
  background: transparent;
  color: var(--pm-text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.schedule-clear-btn:hover {
  color: var(--pm-magenta);
  border-color: var(--pm-magenta);
}

.schedule-clear-btn[hidden] {
  display: none !important;
}

.schedule-view-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--pm-radius-pill);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--pm-border);
}

.schedule-view-btn {
  padding: 9px 14px;
  border: none;
  border-radius: var(--pm-radius-pill);
  background: transparent;
  color: var(--pm-text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}

.schedule-view-btn.is-active {
  color: #fff;
  background: var(--pm-gradient);
  box-shadow: var(--pm-glow-magenta);
}

.schedule-now-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--pm-radius-pill);
  background: var(--pm-gradient);
  color: #060608;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--pm-glow-magenta);
  transition: transform 0.15s, filter 0.15s;
}

.schedule-now-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.schedule-now-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #060608;
  animation: pm-pip 1.5s ease-out infinite;
}

/* —— Meta —— */

.pm-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 18px var(--pm-pad) 10px;
  font-size: 13px;
  color: var(--pm-text-mute);
}

.pm-meta-day { color: var(--pm-text-dim); font-weight: 500; }
.pm-meta-count { color: var(--pm-mint); font-weight: 600; }
.pm-meta-updated strong { color: var(--pm-text-dim); font-weight: 600; }
.pm-meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

/* —— Status / loading —— */

.schedule-status {
  margin: 8px var(--pm-pad);
  padding: 18px 20px;
  border-radius: var(--pm-radius);
  border: 1px solid var(--pm-border-strong);
  border-left: 3px solid var(--pm-magenta);
  background: var(--pm-bg-card);
  color: var(--pm-text-dim);
  font-size: 14px;
}

.schedule-status.is-error {
  border-left-color: #ff4d6d;
  color: #ffb3c1;
}

.schedule-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 42vh;
  padding: 48px var(--pm-pad);
  color: var(--pm-text-dim);
  font-size: 15px;
}

.schedule-loading-spin {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--pm-magenta);
  border-right-color: var(--pm-cyan);
  animation: epg-spin 0.75s linear infinite;
  box-sizing: border-box;
}

@keyframes epg-spin { to { transform: rotate(360deg); } }

.schedule-loading[hidden],
.schedule-status[hidden],
.epg-shell[hidden],
.schedule-cards-shell[hidden] {
  display: none !important;
}

.epg-rail-row.is-filtered-out,
.epg-timeline-row.is-filtered-out,
.epg-prog.is-filtered-out,
.schedule-card.is-filtered-out {
  display: none !important;
}

.epg-filter-empty,
.cards-filter-empty {
  margin: 24px 16px;
}


/* —— Cards / Now —— */

.schedule-cards-shell {
  padding: 16px;
  animation: epg-fade-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.schedule-cards-shell.is-updating {
  animation: epg-view-pulse 0.28s ease both;
}

.schedule-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  max-width: none;
  width: 100%;
  align-items: stretch;
}

.schedule-status--empty {
  margin: 0;
  padding: 28px 20px;
  text-align: center;
  border-radius: 14px;
  border: 1px dashed rgba(255, 0, 255, 0.28);
  background: rgba(255, 0, 255, 0.04);
  color: var(--pm-text-dim);
}

.schedule-card {
  --card-progress: 0%;
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  padding: 14px 14px 14px 16px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--pm-radius);
  background:
    linear-gradient(135deg, rgba(255, 0, 255, 0.07), transparent 42%),
    linear-gradient(160deg, var(--pm-bg-card), rgba(10, 10, 16, 0.99));
  border: 1px solid var(--pm-border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  animation: epg-card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--stagger, 0ms);
  overflow: hidden;
}

.schedule-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(255, 255, 255, 0.12);
}

.schedule-card.is-live::before {
  background: var(--pm-gradient);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.45);
}

.schedule-card.is-upcoming::before {
  background: linear-gradient(180deg, var(--pm-cyan), var(--pm-purple));
}

.schedule-card:hover,
.schedule-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 0, 255, 0.45);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.4),
    var(--pm-glow-magenta);
  outline: none;
}

.schedule-card.is-live {
  border-color: rgba(0, 255, 136, 0.28);
  background:
    linear-gradient(135deg, rgba(0, 255, 136, 0.08), transparent 46%),
    linear-gradient(160deg, rgba(18, 18, 28, 0.98), rgba(10, 10, 16, 0.99));
}

.schedule-card.is-live:hover,
.schedule-card.is-live:focus-visible {
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.4),
    0 0 26px rgba(0, 255, 136, 0.14);
}

.schedule-card-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

.schedule-card-media .epg-channel-rail {
  width: auto;
  pointer-events: none;
}

.schedule-card-media .epg-channel-country {
  display: none;
}

.schedule-card-media .epg-channel-brand,
.schedule-card-channel .epg-channel-brand {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 8px;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 8px 18px rgba(0, 0, 0, 0.35);
}

.schedule-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.schedule-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 2px;
}

.schedule-card-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.schedule-card-badge--live {
  color: #06140c;
  background: linear-gradient(135deg, #00ff88, #00d4aa);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.35);
}

.schedule-card-badge--live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #06140c;
  box-shadow: 0 0 0 2px rgba(6, 20, 12, 0.25);
  animation: livetv-card-pip 1.2s ease-in-out infinite;
}

@keyframes livetv-card-pip {
  50% { opacity: 0.35; }
}

.schedule-card-badge--upcoming {
  color: #061018;
  background: linear-gradient(135deg, #00ffff, #7dd3fc);
}

.schedule-card-badge--past,
.schedule-card-badge--idle {
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.schedule-card-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

.schedule-card-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card-show {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  min-width: 0;
}

.schedule-card-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.48);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card-countdown {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pm-mint);
}

.schedule-card.is-upcoming .schedule-card-countdown {
  color: var(--pm-cyan);
}

.schedule-card-progress {
  margin-top: 8px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.schedule-card-progress > span {
  display: block;
  height: 100%;
  width: var(--card-progress, 0%);
  border-radius: inherit;
  background: var(--pm-gradient);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.35);
}

.schedule-card-cta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  align-self: stretch;
  min-width: 58px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 0, 255, 0.1);
  border: 1px solid rgba(255, 0, 255, 0.22);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.schedule-card.is-live .schedule-card-cta {
  background: rgba(0, 255, 136, 0.12);
  border-color: rgba(0, 255, 136, 0.28);
  color: var(--pm-mint);
}

.schedule-card:hover .schedule-card-cta,
.schedule-card:focus-visible .schedule-card-cta {
  background: var(--pm-gradient);
  border-color: transparent;
  color: #060608;
}

@media (max-width: 640px) {
  .schedule-cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .schedule-card {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    padding: 12px;
  }

  .schedule-card-media,
  .schedule-card-media .epg-channel-brand {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .schedule-card-cta {
    display: none;
  }

  .schedule-card-name { font-size: 14px; }
  .schedule-card-show { font-size: 12px; }
}

@media (min-width: 1600px), (min-width: 1280px) and (pointer: coarse) and (hover: none) {
  .schedule-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
  }

  .schedule-card {
    grid-template-columns: 76px minmax(0, 1fr) auto;
    min-height: 124px;
    padding: 18px;
    gap: 16px;
  }

  .schedule-card-media,
  .schedule-card-media .epg-channel-brand {
    width: 76px;
    height: 76px;
    flex-basis: 76px;
  }

  .schedule-card-name { font-size: 17px; }
  .schedule-card-show { font-size: 15px; }
  .schedule-card-cta {
    min-width: 72px;
    font-size: 11px;
  }
}

/* —— EPG stage —— */

.epg-shell {
  padding: 4px var(--pm-pad) 0;
  animation: epg-fade-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.epg-shell.is-updating {
  animation: epg-view-pulse 0.28s ease both;
}

@keyframes epg-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes epg-view-pulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

@keyframes epg-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes epg-row-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.epg-viewport {
  position: relative;
  border-radius: 20px;
  border: 1px solid var(--pm-border-strong);
  background:
    linear-gradient(180deg, rgba(16, 16, 26, 0.96) 0%, rgba(8, 8, 14, 0.98) 100%);
  box-shadow:
    var(--pm-shadow),
    0 0 0 1px rgba(255, 0, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.epg-split {
  display: flex;
  align-items: stretch;
  height: var(--epg-split-h, min(62dvh, 640px));
  max-height: var(--epg-split-h, min(62dvh, 640px));
  min-height: 240px;
}

.epg-rail {
  flex: 0 0 var(--epg-channel-w);
  width: var(--epg-channel-w);
  min-width: var(--epg-channel-w);
  min-height: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: #0a0a10;
  border-right: 1px solid var(--epg-line);
}

.epg-rail-corner {
  flex: 0 0 var(--epg-header-h);
  height: var(--epg-header-h);
  border-bottom: 1px solid var(--epg-line);
  background: rgba(8, 8, 14, 0.98);
}

.epg-rail-list {
  flex: 1;
  min-height: 0;
  overflow: hidden; /* transform-synced to timeline — no second scrollbar */
  overscroll-behavior: contain;
}

.epg-rail-track {
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

.epg-virt-spacer {
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
}

.epg-rail-window,
.epg-grid-window {
  contain: layout style;
}

.epg-grid-body {
  position: relative;
  contain: layout style;
}

.epg-rail-row {
  height: var(--epg-row-h);
  min-height: var(--epg-row-h);
  margin-bottom: var(--epg-row-gap);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  content-visibility: auto;
  contain-intrinsic-size: auto var(--epg-row-h);
  contain: layout style paint;
}

.epg-rail-row:hover,
.epg-rail-row:focus-within {
  background: rgba(255, 0, 255, 0.035);
}

.epg-scroll {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--pm-magenta) rgba(0, 0, 0, 0.35);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto;
}

.epg-scroll::-webkit-scrollbar { height: 12px; width: 12px; }
.epg-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--pm-magenta), var(--pm-cyan));
  border-radius: 8px;
}

.epg-grid { position: relative; min-width: max-content; }

.epg-time-row {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--epg-header-h);
  background: rgba(8, 8, 14, 0.98);
  border-bottom: 1px solid var(--epg-line);
}

.epg-time-slots { display: flex; flex: 1; }

.epg-time-slot {
  flex: 0 0 var(--epg-slot-w);
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--pm-text-mute);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.epg-time-slot.is-hour {
  color: var(--pm-text-dim);
}

.epg-time-now {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  transform: translateX(calc(var(--epg-now-offset, 0px) - 50%));
  width: 0;
  pointer-events: none;
  z-index: 22;
}

.epg-time-now span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 4px 9px;
  border-radius: var(--pm-radius-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #060608;
  background: var(--pm-cyan);
  box-shadow: var(--pm-glow-cyan);
  white-space: nowrap;
}

.epg-timeline-row {
  height: var(--epg-row-h);
  min-height: var(--epg-row-h);
  margin-bottom: var(--epg-row-gap);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  content-visibility: auto;
  contain-intrinsic-size: auto var(--epg-row-h);
  contain: layout style paint;
}

.epg-channel-cell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.epg-channel-rail {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: default;
  outline: none;
}

.epg-channel-rail:focus-visible {
  outline: 2px solid var(--pm-cyan);
  outline-offset: 2px;
  border-radius: 12px;
}

.epg-channel-brand {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #fff 0%, #e8e8f0 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  overflow: hidden;
  padding: 5px;
  box-sizing: border-box;
}

.epg-channel-cell:hover .epg-channel-brand,
.epg-channel-cell:focus-within .epg-channel-brand {
  box-shadow: 0 0 0 1px rgba(255, 0, 255, 0.35);
}

.epg-channel-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.epg-channel-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--pm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-channel-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--pm-text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-channel-country {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 3;
  max-width: calc(100% - 6px);
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #060608;
  background: var(--pm-gradient);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  line-height: 1.2;
}

.epg-channel-logo,
.epg-channel-fallback {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
}

.epg-channel-logo {
  display: block;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  padding: 0;
}

.epg-channel-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  color: #1a1a28;
  line-height: 1.1;
}

/* display:flex above would otherwise override the hidden attribute */
.epg-channel-fallback[hidden] {
  display: none !important;
}

.epg-channel-tip {
  position: fixed;
  left: 0;
  top: 0;
  transform: translateY(-50%) translateX(-6px);
  width: min(300px, 55vw);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(160deg, rgba(22, 18, 32, 0.98) 0%, rgba(10, 10, 16, 0.98) 100%);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 0, 255, 0.14),
    0 0 28px rgba(0, 255, 255, 0.1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 10000;
}

.epg-channel-tip[hidden] {
  display: none !important;
}

.epg-channel-tip.is-open {
  display: block !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.epg-channel-tip-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.epg-channel-tip-brand {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff 0%, #e8e8f0 100%);
  overflow: hidden;
  padding: 6px;
  box-sizing: border-box;
}

.epg-channel-tip-brand .epg-channel-logo,
.epg-channel-tip-brand .epg-channel-fallback {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.epg-channel-tip-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
}

.epg-channel-tip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.epg-channel-tip-tag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--pm-cyan);
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.22);
}

.epg-channel-tip-body {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.epg-channel-tip-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--pm-text-mute);
}

.epg-channel-tip-status.is-live { color: var(--pm-mint); }
.epg-channel-tip-status.is-upcoming { color: var(--pm-cyan); }

.epg-channel-tip-show {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--pm-text);
}

.epg-channel-tip-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--pm-text-mute);
}

.epg-channel-tip-watch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: #060608;
  background: var(--pm-gradient);
  box-shadow: 0 0 18px rgba(255, 0, 255, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}

.epg-channel-tip-watch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(0, 255, 255, 0.3);
}

.epg-timeline {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: var(--epg-row-h);
  height: var(--epg-row-h);
  min-width: calc(var(--epg-slot-w) * var(--epg-slot-count, 48));
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 1px,
    transparent var(--epg-slot-w)
  );
}

.epg-prog {
  position: absolute;
  top: var(--epg-prog-inset);
  bottom: var(--epg-prog-inset);
  min-width: 0;
  /* Tight vertical padding so badge + title + time fit inside --epg-row-h. */
  padding: 5px 9px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--epg-bg-prog);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  z-index: 1;
  box-sizing: border-box;
  isolation: isolate;
  contain: layout style;
}

.epg-prog:hover {
  border-color: rgba(255, 0, 255, 0.5);
  z-index: 4;
}

.epg-prog.is-live {
  background: var(--epg-bg-prog-live);
  border-color: rgba(0, 255, 136, 0.45);
  z-index: 3;
}

.prog-live-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(255, 0, 255, 0.28), rgba(0, 255, 136, 0.18));
  border-radius: 11px 0 0 11px;
  pointer-events: none;
  z-index: 0;
}

/* While scrolling: skip expensive paint (hover shadows / tip work). */
.epg-shell.is-scrolling .epg-prog {
  pointer-events: none;
}
.epg-shell.is-scrolling .epg-channel-tip {
  visibility: hidden !important;
}

.epg-prog-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  /* Allow body to shrink so .epg-prog-time is not clipped by overflow:hidden. */
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.epg-prog.is-past { opacity: 0.48; }

.epg-prog.is-upcoming {
  border-color: rgba(0, 255, 255, 0.28);
  background: #101820;
}

.epg-prog-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
  overflow: hidden;
  white-space: nowrap;
}

.epg-prog-badge {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.epg-prog-badge--live {
  color: #060608;
  background: var(--pm-mint);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.epg-prog-badge--upcoming {
  color: #061018;
  background: var(--pm-cyan);
}

.epg-prog-badge--past {
  color: #d1d5db;
  background: rgba(75, 85, 99, 0.5);
}

.epg-prog.is-ended { cursor: default; }

.epg-prog-countdown {
  font-size: 11px;
  font-weight: 600;
  color: var(--pm-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-prog.is-live .epg-prog-countdown { color: var(--pm-mint); }
.epg-prog.is-upcoming .epg-prog-countdown { color: var(--pm-cyan); }

.epg-prog-title {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  /* Title yields vertical space to time when the row is dense. */
  min-height: 0;
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: #fff;
  overflow: hidden;
}

.epg-prog-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.epg-prog-play {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--pm-magenta);
}

.epg-prog-time {
  font-size: 10px;
  line-height: 1.15;
  color: var(--pm-text-mute);
  white-space: nowrap;
  /* All-or-nothing: JS only emits a label that fits; never ellipsis mid-time. */
  overflow: hidden;
  text-overflow: clip;
  /* Never shrink — row/padding sized so this stays fully visible. */
  flex: 0 0 auto;
}

.epg-prog.is-tiny {
  padding: 8px;
  justify-content: center;
}

.epg-prog.is-tiny .epg-prog-status,
.epg-prog.is-tiny .epg-prog-time,
.epg-prog.is-tiny .epg-prog-play { display: none; }

.epg-prog.is-tiny .epg-prog-title {
  font-size: 12px;
  justify-content: center;
  text-align: center;
}

.epg-prog.is-compact .epg-prog-time { display: none; }
.epg-prog.is-compact .epg-prog-title { font-size: 11px; }
.epg-prog.is-live .epg-prog-time { color: rgba(0, 255, 136, 0.75); }
.epg-prog-progress { display: none; }

.epg-now-marker {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--pm-cyan);
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.65);
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
  z-index: 50;
  left: 0;
  transform: translateX(var(--epg-now-offset, 0px));
  user-select: none;
  will-change: transform, top;
}

.epg-now-marker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -14px;
  width: 30px;
  cursor: ew-resize;
}

.epg-now-marker::before {
  content: '';
  position: absolute;
  left: -5px;
  top: var(--epg-header-h);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pm-cyan);
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.7);
  pointer-events: none;
}

.epg-now-badge {
  position: absolute;
  left: 50%;
  top: calc(var(--epg-header-h) + 8px);
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #060608;
  background: var(--pm-cyan);
  white-space: nowrap;
  pointer-events: auto;
  cursor: ew-resize;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.35);
}

/* Scrub line must stay interactive while scroll perf disables programme hit-testing. */
.epg-shell.is-scrolling .epg-now-marker,
.epg-shell.is-scrolling .epg-now-marker::after,
.epg-shell.is-scrolling .epg-now-badge {
  pointer-events: auto;
}

.epg-now-marker.is-scrubbing {
  background: #5eead4;
  box-shadow: 0 0 18px rgba(94, 234, 212, 0.75);
}

.epg-now-marker.is-scrubbing::before,
.epg-now-marker.is-scrubbing .epg-now-badge {
  background: #5eead4;
}

.epg-now-marker.is-dragging {
  z-index: 60;
}

.epg-now-marker.is-dragging .epg-now-badge {
  transform: translateX(-50%) scale(1.08);
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.55);
}

.epg-now-marker.is-pinned-start .epg-now-badge,
.epg-now-marker.is-pinned-end .epg-now-badge {
  box-shadow: 0 0 16px rgba(94, 234, 212, 0.65);
}

.epg-now-marker.is-pinned-start::before {
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
  border-radius: 0;
  left: -2px;
  width: 10px;
  height: 14px;
}

.epg-now-marker.is-pinned-end::before {
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  border-radius: 0;
  left: -6px;
  width: 10px;
  height: 14px;
}

.epg-time-now.is-scrubbing span {
  background: #5eead4;
}

/* —— Footer —— */

.pm-footer {
  margin-top: auto;
  padding: 36px var(--pm-pad) 28px;
  border-top: 1px solid var(--pm-border);
  text-align: center;
  font-size: 13px;
  color: var(--pm-text-mute);
}

.pm-footer a {
  color: var(--pm-text-dim);
  text-decoration: none;
}

.pm-footer a:hover { color: var(--pm-cyan); }
.pm-footer-brand {
  font-weight: 700;
  background: var(--pm-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pm-footer-sep { margin: 0 6px; opacity: 0.5; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1024px) {
  .pm-nav { display: none; }

  .pm-rail {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pm-rail-tools {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .schedule-search-wrap {
    max-width: none;
    flex: 1 1 100%;
    min-width: 0;
  }

  .schedule-day-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .schedule-day-tabs::-webkit-scrollbar { display: none; }

  .schedule-day-tab {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .schedule-country-btn,
  .schedule-view-btn,
  .schedule-now-btn,
  .schedule-clear-btn {
    min-height: 40px;
  }

  .epg-split {
    height: var(--epg-split-h, min(60dvh, 560px));
    max-height: var(--epg-split-h, min(60dvh, 560px));
  }

  .schedule-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .pm-hero { padding: 20px 12px 12px; }
  .pm-rail {
    margin: 0;
    padding: 10px;
    border-radius: 12px;
    position: sticky;
    top: calc(var(--pm-header-h, 56px) + 4px);
  }
  .pm-meta {
    padding: 10px 2px 8px;
    font-size: 12px;
    gap: 6px 8px;
  }
  .epg-shell,
  .schedule-cards-shell {
    margin: 0;
    border-radius: 12px;
  }

  .schedule-cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: none;
  }

  .schedule-cards-shell {
    padding: 12px;
  }

  .schedule-card {
    padding: 12px;
    gap: 12px;
    border-radius: 12px;
  }

  .schedule-card-media,
  .schedule-card-media .epg-channel-brand {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  :root,
  .schedule-body,
  .epg-layout-mobile {
    --epg-channel-w: 64px;
    --epg-slot-w: 112px;
    --epg-row-h: 58px;
    --epg-header-h: 32px;
    --epg-prog-inset: 4px;
    --epg-row-gap: 3px;
  }

.epg-layout-laptop {
  --epg-channel-w: 132px;
  --epg-slot-w: 148px;
  --epg-row-h: 70px;
  --epg-header-h: 34px;
  --epg-prog-inset: 5px;
  --epg-row-gap: 4px;
}

.epg-layout-desktop {
  --epg-channel-w: 148px;
  --epg-slot-w: 164px;
  --epg-row-h: 76px;
  --epg-header-h: 36px;
  --epg-prog-inset: 5px;
  --epg-row-gap: 4px;
}

  .epg-split {
    height: var(--epg-split-h, min(56dvh, 480px));
    max-height: var(--epg-split-h, min(56dvh, 480px));
  }

  .epg-channel-text { display: none; }
  .epg-channel-brand {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    padding: 4px;
    border-radius: 9px;
  }
  .epg-channel-cell { padding: 4px 6px; justify-content: center; }
  .epg-channel-tip {
    width: min(300px, calc(100vw - 20px));
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
  }
  .epg-prog {
    padding: 4px 7px;
    border-radius: 8px;
    /* Larger tap targets on phones — keep ≤ row − insets so time isn't clipped */
    min-height: 0;
  }
  .epg-prog-title { font-size: 11px; line-height: 1.15; }
  .epg-prog-time { font-size: 9px; line-height: 1.15; }
  .epg-prog-badge { font-size: 8px; padding: 1px 5px; line-height: 1.15; }
  .epg-time-slot { font-size: 10px; padding-left: 8px; }

  .schedule-country-wrap,
  .schedule-genre-wrap {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .schedule-country-btn {
    width: 100%;
    justify-content: space-between;
  }

  .schedule-country-panel {
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .schedule-view-toggle {
    flex: 1 1 auto;
  }

  .schedule-view-btn {
    flex: 1;
  }

  .schedule-now-btn {
    flex: 0 0 auto;
  }

  .pm-rail-tools {
    gap: 8px;
  }

  /* Prefer Now cards on very small screens when that view is active */
  .epg-view-cards .schedule-cards-shell {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

/* Landscape phones — give the grid more height */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  .listing-page--livetv .movies-hero,
  .pm-hero {
    display: none;
  }
  .epg-split {
    height: var(--epg-split-h, min(78dvh, 420px));
    max-height: var(--epg-split-h, min(78dvh, 420px));
  }
  .pm-rail {
    padding: 8px 10px;
  }
}

/* Large desktop / TV — bigger type, focus rings for remotes */
@media (min-width: 1600px), (min-width: 1280px) and (pointer: coarse) and (hover: none) {
  :root,
  .schedule-body,
  .epg-layout-tv {
    --epg-row-h: 86px;
    --epg-channel-w: 172px;
    --epg-slot-w: 196px;
    --epg-header-h: 42px;
    --epg-row-gap: 5px;
    --epg-prog-inset: 7px;
  }

  .epg-split {
    height: var(--epg-split-h, min(70dvh, 860px));
    max-height: var(--epg-split-h, min(70dvh, 860px));
  }

  .schedule-day-tab,
  .schedule-country-btn,
  .schedule-view-btn,
  .schedule-now-btn,
  .schedule-clear-btn,
  .schedule-search {
    min-height: 48px;
    font-size: 15px;
  }

  .epg-channel-brand {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
    padding: 6px;
    border-radius: 12px;
  }

  .epg-channel-name { font-size: 14px; }
  .epg-channel-sub { font-size: 12px; }
  .epg-prog { padding: 8px 14px; border-radius: 12px; }
  .epg-prog-title { font-size: 15px; }
  .epg-prog-time { font-size: 12px; line-height: 1.2; }
  .epg-prog-badge { font-size: 11px; padding: 3px 9px; }
  .epg-time-slot { font-size: 13px; }
  .schedule-card { padding: 22px; gap: 18px; }
  .schedule-card-name { font-size: 18px; }
  .schedule-card-show { font-size: 15px; }
  .schedule-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
  }

  .epg-prog:focus-visible,
  .epg-channel-cell:focus-visible,
  .schedule-card:focus-visible,
  .schedule-day-tab:focus-visible,
  .schedule-country-btn:focus-visible,
  .schedule-view-btn:focus-visible,
  .schedule-now-btn:focus-visible,
  .schedule-country-option:focus-visible {
    outline: 3px solid var(--pm-cyan);
    outline-offset: 3px;
    z-index: 6;
  }

  .epg-now-marker::after {
    left: -16px;
    width: 34px;
  }
}

/* Touch devices — suppress hover lift that feels laggy */
@media (hover: none) {
  .epg-prog:hover {
    transform: none;
  }
  .schedule-card:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pm-atmosphere,
  .pm-hero,
  .pm-hero-glow,
  .pm-rail,
  .pm-live-pip,
  .schedule-now-dot,
  .schedule-card,
  .epg-channel-row,
  .epg-shell,
  .schedule-cards-shell,
  .schedule-loading-spin {
    animation: none !important;
  }

  .schedule-card:hover,
  .epg-prog:hover,
  .epg-channel-cell:hover .epg-channel-brand,
  .epg-channel-cell:focus-within .epg-channel-brand,
  .schedule-now-btn:hover {
    transform: none;
  }
}
