/* Infinite PXL TV (v1.0.0) — Smart TV OS Design System (Anti-Slop Edition) */

:root {
  --bg-root: #09090d;
  --bg-rail: #0d0d12;
  --bg-surface: #14141b;
  --bg-elevated: #1b1b24;
  --bg-hover: #242430;
  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent-primary: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.18);
  --pluto-yellow: #fff200;
  --text-primary: #f8fafc;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
}

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

html, body {
  height: 100%;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ==================== SHELL LAYOUT ==================== */
.tv-os-shell {
  display: grid;
  grid-template-columns: 212px 1fr;
  min-height: 100vh;
}

/* ==================== LEFT NAVIGATION RAIL ==================== */
.tv-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg-rail);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 20px;
  z-index: 40;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  cursor: pointer;
  user-select: none;
}

.brand-mark {
  color: var(--text-primary);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.rail-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.rail-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.rail-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
}

.rail-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-meta {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 12.5px;
  font-weight: 600;
}

.profile-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== MAIN VIEWPORT ==================== */
.tv-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-root);
}

.top-utility {
  position: sticky;
  top: 0;
  z-index: 35;
  height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(9, 9, 13, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
  max-width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--text-secondary);
}

.search-pill:focus-within {
  border-color: var(--border-strong);
}

.search-pill input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
}

.utility-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.util-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.util-btn.active {
  border-color: var(--accent-primary);
  color: #ffffff;
  background: var(--accent-soft);
}

/* ==================== HERO LIVE STAGE ==================== */
.hero-stage {
  position: relative;
  padding: 16px 24px 12px;
}

.full-player-shell {
  width: 100%;
  background: #050508;
  border-radius: 14px;
  overflow: visible;
  border: 1px solid var(--border-hairline);
}

.crt-screen-frame.full-player-screen {
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}

.media-controls-bar {
  border-radius: 0 0 14px 14px;
}

.crt-cc-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 6;
  max-width: 82%;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(5, 5, 10, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}
.crt-cc-bar.hidden { display: none; }

.mc-settings-wrap {
  position: relative;
}

.mc-gear-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
}

.mc-settings-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  min-width: 196px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(18, 18, 26, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mc-settings-menu.hidden { display: none; }

.mc-set-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.mc-set-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.mc-set-state {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.mc-set-item.active .mc-set-state,
.mc-set-item.on .mc-set-state {
  background: var(--accent-soft);
  color: #fff;
}

.crt-screen-frame.full-player-screen {
  position: relative;
  width: min(100%, calc((100vh - 280px) * 16 / 9));
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100vh - 280px);
  margin: 0 auto;
  background: #050508;
  overflow: hidden;
}

.hero-stage.theater .crt-screen-frame.full-player-screen {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  max-height: calc(100vh - 150px);
}

.full-player-shell:fullscreen,
.full-player-shell.is-fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #000;
}
.full-player-shell.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.hero-stage .full-player-shell:fullscreen .crt-screen-frame.full-player-screen,
.full-player-shell:fullscreen .crt-screen-frame.full-player-screen,
.hero-stage .full-player-shell.is-fullscreen .crt-screen-frame.full-player-screen,
.full-player-shell.is-fullscreen .crt-screen-frame.full-player-screen {
  width: min(100vw, calc((100vh - 46px) * 16 / 9)) !important;
  max-height: calc(100vh - 46px) !important;
  height: auto !important;
  margin: auto;
}
.full-player-shell:fullscreen .hero-desc,
.full-player-shell.is-fullscreen .hero-desc {
  display: block !important;
}
.full-player-shell:fullscreen .media-controls-bar,
.full-player-shell.is-fullscreen .media-controls-bar {
  position: relative;
  z-index: 25;
  flex-shrink: 0;
  width: 100%;
}

#tv-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.crt-media-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crt-media-layer.hidden,
.crt-media-layer .hidden {
  display: none;
}

.crt-media-layer img,
.crt-media-layer video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.24) 3px,
    rgba(0, 0, 0, 0.24) 4px
  );
}

.crt-scanlines.off {
  opacity: 0;
}

/* Cinematic Scrim Overlay on Left of Hero */
/* Custom thin scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* Compact hero stage when browsing Guide or Channel Wall */
.hero-stage.compact-player .crt-screen-frame.full-player-screen {
  width: min(100%, calc(220px * 16 / 9));
  max-height: 220px;
}

.hero-stage.compact-player .hero-scrim {
  padding: 12px 18px 16px;
}

.hero-stage.compact-player .hero-desc,
.hero-stage.compact-player .quick-dock {
  display: none;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(9, 9, 13, 0.84) 0%, rgba(9, 9, 13, 0.48) 30%, transparent 56%);
  display: flex;
  align-items: flex-end;
  padding: 20px 24px 36px;
}

.hero-copy {
  pointer-events: auto;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-pill {
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.hero-ch-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.hero-title {
  font-size: clamp(20px, 2.5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 13.5px;
  font-weight: 600;
  color: #e4e4e7;
}

.hero-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.cta-primary {
  background: #ffffff;
  color: #09090d;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cta-primary:hover {
  background: #e4e4e7;
}

.cta-secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.cta-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
}

.cta-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.cta-icon:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* OSD Channel Bug & Banner */
.osd-bug {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(9, 9, 13, 0.72);
  border: 1px solid var(--border-hairline);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  pointer-events: none;
}

.osd-ch-num {
  color: var(--pluto-yellow);
  font-weight: 700;
}

.osd-banner {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(9, 9, 13, 0.9);
  border: 1px solid var(--accent-primary);
  padding: 7px 12px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.osd-banner.visible {
  opacity: 1;
  transform: translateY(0);
}

.osd-banner-ch {
  font-family: "JetBrains Mono", monospace;
  font-size: 20px;
  font-weight: 800;
  color: var(--pluto-yellow);
}

.osd-banner-name { font-size: 13px; font-weight: 700; }
.osd-banner-show { font-size: 11px; color: var(--text-secondary); }

/* Media Transport Bar */
.media-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #0d0d12;
  border-top: 1px solid var(--border-hairline);
}

.mc-left,
.mc-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mc-scrub-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}

.mc-scrub-wrap.is-live .mc-seek-slider {
  opacity: 0.25;
  pointer-events: none;
}

.mc-seek-slider { width: 100%; accent-color: var(--accent-primary); cursor: pointer; }
.mc-vol-slider { width: 76px; accent-color: var(--accent-primary); cursor: pointer; }

.mc-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 40px;
}

.mc-btn {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.mc-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.mc-btn.active { border-color: var(--accent-primary); color: #fff; background: var(--accent-soft); }

/* Quick-Actions Horizontal Pill Bar (cleanly below player, never overlapping video) */
.quick-dock {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.dock-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.dock-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.dock-item.active {
  background: var(--accent-soft);
  border-color: rgba(124, 58, 237, 0.55);
  color: #ffffff;
}

/* ==================== HOME DISCOVERY SHELVES ==================== */
.home-rows {
  padding: 8px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.home-rows.hidden-view,
.pluto-epg.hidden-view {
  display: none;
}

.shelf-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.shelf-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.shelf-card {
  flex: 0 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.shelf-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.shelf-card.active {
  border-color: var(--accent-primary);
}

.shelf-card.landscape {
  width: 210px;
}

.shelf-card.poster {
  width: 156px;
}

.shelf-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d0d12;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.shelf-card.poster .shelf-thumb {
  aspect-ratio: 4 / 3;
}

.shelf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shelf-thumb-ch {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(9, 9, 13, 0.85);
  border: 1px solid var(--border-hairline);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
}

.shelf-card-body {
  padding: 8px 10px;
}

.shelf-card-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ==================== LIVE GUIDE (EPG) & BROWSE WALL ==================== */
.pluto-epg {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  border-top: 1px solid var(--border-hairline);
  min-height: 460px;
}

.epg-sidebar {
  background: var(--bg-rail);
  border-right: 1px solid var(--border-hairline);
  padding: 14px 10px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 10px 8px;
}

.category-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.cat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.cat-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.cat-btn.active { background: var(--accent-soft); color: #fff; font-weight: 600; }
.cat-count { font-size: 11px; color: var(--text-muted); font-family: "JetBrains Mono", monospace; }

.epg-grid-area { display: flex; flex-direction: column; min-width: 0; }

.epg-time-header {
  position: sticky;
  top: 54px;
  z-index: 25;
  display: grid;
  grid-template-columns: 245px 1fr;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  height: 40px;
}

.epg-channel-col-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-hairline);
}

.ch-count-pill { background: var(--bg-elevated); padding: 2px 8px; border-radius: 999px; color: var(--text-primary); }
.epg-timeline-slots { display: grid; grid-template-columns: repeat(4, 1fr); }

.time-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-hairline);
}

.now-marker { background: var(--accent-primary); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }

.epg-row {
  display: grid;
  grid-template-columns: 245px 1fr;
  border-bottom: 1px solid var(--border-hairline);
  min-height: 74px;
  scroll-margin-top: 102px;
}

.epg-row:hover { background: rgba(255, 255, 255, 0.02); }
.epg-row.active-channel { background: var(--accent-soft); }

.epg-ch-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-right: 1px solid var(--border-hairline);
  cursor: pointer;
}

.epg-ch-num { font-family: "JetBrains Mono", monospace; font-size: 12.5px; font-weight: 700; width: 32px; }

.epg-ch-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
}

.epg-cover-thumb { width: 100%; height: 100%; object-fit: cover; }
.epg-ch-meta { min-width: 0; flex: 1; }
.epg-ch-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-ch-tag { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-fav-btn { background: transparent; border: none; color: var(--text-muted); font-size: 15px; cursor: pointer; }
.epg-fav-btn.is-fav { color: var(--pluto-yellow); }

.epg-programs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; gap: 6px; }

.prog-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  overflow: hidden;
}

.prog-tile:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.epg-row.active-channel .prog-tile.on-now { border-color: var(--accent-primary); }
.prog-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255, 255, 255, 0.1); }
.prog-bar-fill { height: 100%; background: var(--accent-primary); }

/* Browse Channel Wall */
.channel-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
}

.channel-wall.hidden,
.epg-rows.hidden,
.epg-time-header.hidden { display: none; }

.wall-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.wall-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.wall-card.active-channel { border-color: var(--accent-primary); background: var(--accent-soft); }

.wall-card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #07090d;
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
}

.wall-card-top { display: flex; align-items: center; justify-content: space-between; }
.wall-card-num { font-family: "JetBrains Mono", monospace; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.wall-card-icon { font-size: 24px; }
.wall-card-name { font-size: 13.5px; font-weight: 700; }
.wall-card-show { font-size: 11.5px; color: var(--text-secondary); }
.wall-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.wall-card-cat { font-size: 10.5px; color: var(--text-muted); }
.wall-fav-btn { background: transparent; border: none; color: var(--text-muted); font-size: 15px; cursor: pointer; }
.wall-fav-btn.is-fav { color: var(--pluto-yellow); }

/* ==================== BOTTOM REMOTE LEGEND BAR ==================== */
.tv-legend-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 8px 18px;
  background: rgba(13, 13, 18, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-hairline);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.tv-legend-bar kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--text-primary);
}

/* ==================== REMOTE, MODALS & POPOVERS ==================== */
.retro-remote {
  position: fixed;
  right: 20px;
  top: 66px;
  z-index: 80;
  width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.retro-remote.hidden { display: none; }
.remote-head { display: flex; align-items: center; justify-content: space-between; font-size: 10px; font-weight: 700; color: var(--text-secondary); }
.remote-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; }
.remote-screen { background: #09090d; border: 1px solid var(--border-hairline); border-radius: 6px; padding: 5px 8px; font-family: "JetBrains Mono", monospace; font-size: 16px; color: var(--pluto-yellow); text-align: center; }
.remote-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.remote-grid button, .remote-rockers button { background: var(--bg-elevated); color: #fff; border: 1px solid var(--border-hairline); border-radius: 6px; padding: 7px 0; font-size: 12px; font-weight: 600; cursor: pointer; }
.remote-grid button:hover, .remote-rockers button:hover { background: var(--bg-hover); border-color: var(--accent-primary); }
.remote-grid button.go { background: var(--accent-primary); border-color: var(--accent-primary); }
.remote-rockers { display: grid; grid-template-columns: 1fr 0.8fr 1fr; gap: 5px; }

.picture-popover {
  position: fixed;
  left: 224px;
  bottom: 24px;
  z-index: 90;
  width: 244px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.picture-popover.hidden { display: none; }
.pic-hdr { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; }
.pic-hdr button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; }
.picture-popover label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.picture-popover input[type="range"] { accent-color: var(--accent-primary); }
.pic-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.media-studio-card { max-width: 560px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close { background: var(--bg-elevated); border: none; color: var(--text-primary); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.modal-sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 14px; }
.modal-sub code { color: var(--pluto-yellow); }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-secondary); min-width: 0; }
.modal-form label.hidden { display: none; }

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-hairline); padding: 8px 14px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-pluto { background: var(--accent-primary); color: #fff; border: none; padding: 8px 18px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.btn-pluto:hover { background: #6d28d9; }

.shortcuts-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin-top: 12px; font-size: 13px; }
.shortcuts-grid kbd { background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 5px; padding: 2px 7px; font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--text-primary); }

.custom-list-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-hairline); display: flex; flex-direction: column; gap: 6px; max-height: 140px; overflow-y: auto; }
.custom-item-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; background: var(--bg-elevated); padding: 6px 10px; border-radius: 6px; }
.custom-del-btn { background: transparent; border: none; color: #f87171; cursor: pointer; font-weight: 700; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 960px) {
  .tv-os-shell { grid-template-columns: 1fr; }
  .tv-rail { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 14px; }
  .rail-nav { flex-direction: row; }
  .rail-footer { display: none; }
  .quick-dock { display: none; }
  .pluto-epg { grid-template-columns: 1fr; }
}

/* ==================== DEPTH, SHADOWS & SPECULAR POLISH ==================== */
.full-player-shell {
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.util-btn,
.dock-item {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.wall-card,
.poster-card,
.epg-row {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.modal-card,
.retro-remote {
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.74), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}


/* Broadcast YouTube Engine, Tuning Slate, Off-Air Standby, Power Gate & Mini-Player */
.yt-player-mount, .yt-player-mount iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 2;
}
.tv-tuning-slate, .tv-offair-card, .tv-power-gate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 18;
  background: rgba(8, 10, 14, 0.92);
  color: #fff;
  text-align: center;
}
.tv-tuning-slate {
  font-family: "JetBrains Mono", monospace;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.tv-offair-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 20px;
}
.tv-offair-card strong { font-size: 16px; letter-spacing: 0.08em; }
.tv-offair-card span { font-size: 13px; color: #94a3b8; }
.tv-power-gate { background: rgba(0, 0, 0, 0.55); z-index: 19; }
.yt-player-mount.hidden,
.tv-tuning-slate.hidden,
.tv-offair-card.hidden,
.tv-power-gate.hidden {
  display: none !important;
}

.full-player-shell.mini-player {
  position: fixed;
  right: 20px;
  bottom: 48px;
  width: min(360px, calc(100vw - 32px));
  z-index: 120;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0b0d12;
}
.full-player-shell.mini-player .hero-scrim { display: none; }
.full-player-shell.mini-player .media-controls-bar {
  padding: 6px 10px;
  gap: 6px;
  justify-content: space-between;
}
.full-player-shell.mini-player .mc-vol-slider,
.full-player-shell.mini-player .mc-scrub-wrap,
.full-player-shell.mini-player #mc-last,
.full-player-shell.mini-player #mc-sleep {
  display: none;
}
.hero-stage:has(.full-player-shell.mini-player) .quick-dock {
  display: none;
}

.hero-stage.is-osd-idle .media-controls-bar,
.hero-stage.is-osd-idle .osd-bug {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
