/* ==========================================================================
   LG WebOS 5.x IPTV Player — Televizo-Style Design System
   Large, TV-friendly sizes for 64" screens. Persistent left nav rail +
   dedicated views (TV / Guide / Archive / Playlists / Settings).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-main: #07090e;
  --bg-sidebar: #0b0e17;
  --bg-pane: rgba(15, 20, 32, 0.92);
  --bg-panel: rgba(12, 16, 26, 0.88);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-card: #121826;
  --bg-focused: #183c4b;
  --bg-hover: rgba(255, 255, 255, 0.08);

  --accent-cyan: #00e5ff;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;

  --text-main: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --focus-glow: 0 0 0 4px #00e5ff, 0 8px 24px rgba(0, 229, 255, 0.35);
  --focus-glow-soft: 0 0 0 3px #00e5ff, 0 4px 16px rgba(0, 229, 255, 0.25);
  --border-focus: 3px solid var(--accent-cyan);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --guide-now-line: #ff3b30;
  --guide-corner-bg: rgba(10, 14, 22, 0.95);

  --rail-width: 220px;
}

/* Theme Options */
body.theme-webos {
  --bg-main: #0a0a0c;
  --bg-sidebar: #121216;
  --bg-pane: #18181f;
  --bg-panel: #14141a;
  --bg-glass: #22222a;
  --bg-card: #1d1d26;
  --bg-focused: #e6004c;
  --accent-cyan: #e6004c;
  --accent-blue: #ea2265;
  --text-main: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #888888;
  --focus-glow: 0 0 0 3px #ffffff, 0 0 0 6px #e6004c;
  --focus-glow-soft: 0 0 0 2px #ffffff, 0 0 0 4px #e6004c;
  --border-focus: 3px solid #ffffff;
}

body.theme-oled {
  --bg-main: #000000;
  --bg-sidebar: #050505;
  --bg-pane: rgba(8, 8, 8, 0.85);
  --bg-panel: rgba(5, 5, 5, 0.78);
  --bg-card: #0d0d0d;
  --bg-focused: #1a3f4a;
}

body.theme-slate {
  --bg-main: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-pane: rgba(30, 41, 59, 0.85);
  --bg-panel: rgba(15, 23, 42, 0.78);
  --bg-card: #334155;
  --bg-focused: #475569;
}

body.theme-neon {
  --bg-main: #090014;
  --bg-sidebar: #120024;
  --bg-pane: rgba(25, 0, 48, 0.85);
  --bg-panel: rgba(15, 0, 32, 0.8);
  --bg-card: #1f003b;
  --bg-focused: #4a0070;
  --accent-cyan: #ff007f;
  --focus-glow: 0 0 30px rgba(255, 0, 127, 0.8);
  --border-focus: 4px solid #ff007f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 28px;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 80% 20%, rgba(30, 40, 60, 0.4) 0%, var(--bg-main) 100%);
  cursor: default;
}

/* ==========================================================================
   Focus System
   ========================================================================== */
.focusable {
  outline: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

*:focus,
*:focus-visible {
  outline: none !important;
}

.focusable.focused {
  border: var(--border-focus) !important;
  box-shadow: var(--focus-glow) !important;
  transform: scale(1.02);
  z-index: 20;
  background-color: var(--bg-focused) !important;
}

/* ==========================================================================
   Fullscreen Video Player Stage
   ========================================================================== */
#player-stage {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 1;
}

#video-element {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#video-element.aspect-fill { object-fit: cover; }
#video-element.aspect-16-9 { object-fit: fill; }
#video-element.aspect-4-3 { object-fit: contain; }

.player-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 5;
}

.spinner {
  width: 64px;
  height: 64px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-badge {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  padding: 16px 28px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 24px;
}

/* ==========================================================================
   View Layers (above the video)
   ========================================================================== */
.view-layer {
  position: absolute;
  top: 0;
  left: var(--rail-width);
  right: 0;
  bottom: 0;
  z-index: 10;
  display: none;
}

.view-layer.active {
  display: block;
}

/* ==========================================================================
   Fullscreen Video (Menu Minimized) Mode
   ========================================================================== */
#app.menu-minimized #nav-rail,
#app.menu-minimized .view-layer {
  display: none !important;
}

#app.menu-minimized #player-stage {
  cursor: pointer;
}

/* ==========================================================================
   Persistent Left Navigation Rail
   ========================================================================== */
#nav-rail {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-width);
  background: linear-gradient(180deg, rgba(10, 14, 22, 0.95) 0%, rgba(8, 11, 18, 0.98) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 50;
  padding: 24px 16px;
}

.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.rail-brand .brand-logo {
  font-size: 36px;
}

.rail-brand .brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent-cyan), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rail-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 10px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.rail-item .rail-icon {
  font-size: 34px;
}

.rail-item .rail-label {
  font-size: 17px;
  font-weight: 600;
}

.rail-item.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.rail-item.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
  color: var(--text-main);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rail-clock {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.rail-date {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   Top Info Bar (TV view)
   ========================================================================== */
#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.55) 70%, transparent 100%);
  z-index: 30;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.brand-logo {
  font-size: 36px;
}

.brand-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent-cyan), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.category-indicator {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 20px;
  border-radius: 24px;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-center {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 1;
  min-width: 0;
  justify-content: center;
}

.now-ch-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-cyan);
  font-variant-numeric: tabular-nums;
}

.now-ch-name {
  font-size: 30px;
  font-weight: 800;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-prog-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 450px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.top-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.osd-clock {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.osd-date {
  font-size: 16px;
  color: var(--text-secondary);
}

.badge {
  font-size: 16px;
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  white-space: nowrap;
}

/* ==========================================================================
   Category Tabs (horizontal)
   ========================================================================== */
.category-tabs {
  position: absolute;
  top: 110px;
  left: 0;
  right: 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
  overflow-x: auto;
  z-index: 25;
  white-space: nowrap;
}

.category-tab {
  flex-shrink: 0;
  padding: 12px 28px;
  border-radius: 24px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.category-tab.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.5);
  color: var(--accent-cyan);
}

.category-tab.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
  color: var(--text-main);
}

/* ==========================================================================
   Channel List Panel (left)
   ========================================================================== */
.side-panel {
  position: absolute;
  top: 182px;
  bottom: 44px;
  left: 0;
  width: 600px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(28px) saturate(1.4);
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 20px 20px 0;
  border-left: none;
  z-index: 25;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 24px;
  font-size: 22px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

/* ==========================================================================
   Virtual Pane base styles
   ========================================================================== */
.virtual-container {
  position: relative;
  overflow-y: auto;
}

.virtual-spacer {
  pointer-events: none;
}

.virtual-cell {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

.virtual-cell.focused {
  border: var(--border-focus) !important;
  box-shadow: var(--focus-glow) !important;
  transform: scale(1.02);
  z-index: 15;
}

.virtual-row {
  background: var(--bg-glass);
}

.virtual-cell:focus-visible {
  border: var(--border-focus);
  box-shadow: var(--focus-glow);
}

/* ==========================================================================
   Channel rows
   ========================================================================== */
.channel-row-cell {
  border: 2px solid transparent;
  border-radius: var(--radius-md);
}

.channel-row-content {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  height: 100%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.channel-row-content.playing {
  border-color: rgba(0, 229, 255, 0.5);
  background: rgba(0, 229, 255, 0.08);
}

.channel-row-cell.focused .channel-row-content {
  background-color: var(--bg-focused);
  border-color: transparent;
}

.channel-row-logo {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 28px;
}

.channel-row-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.channel-row-info {
  flex: 1;
  min-width: 0;
}

.channel-row-topline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.channel-row-num {
  font-size: 20px;
  color: var(--accent-cyan);
  font-weight: 800;
  flex-shrink: 0;
}

.channel-row-name {
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-row-epg {
  font-size: 18px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-row-fav {
  color: var(--accent-yellow);
  font-size: 20px;
  flex-shrink: 0;
}

.channel-row-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
}

.channel-row-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), #3b82f6);
  width: 0%;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  display: inline-block;
  animation: pulse-live 1.5s infinite;
  flex-shrink: 0;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ==========================================================================
   Bottom Remote Hints Footer
   ========================================================================== */
#remote-key-hints {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.45) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  z-index: 30;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  padding: 0 20px;
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hint-item span {
  font-weight: 600;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.color-red { background: var(--accent-red); }
.color-green { background: var(--accent-green); }
.color-yellow { background: var(--accent-yellow); }
.color-blue { background: var(--accent-blue); }

/* ==========================================================================
   TV GUIDE VIEW
   ========================================================================== */
#guide-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--guide-corner-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 30;
}

.guide-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 24px;
}

.guide-tab {
  padding: 12px 30px;
  border-radius: 24px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.guide-tab.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.5);
  color: var(--accent-cyan);
}

.guide-tab.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
  color: var(--text-main);
}

.guide-pager {
  display: flex;
  align-items: center;
  gap: 18px;
}

.guide-nav-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

#guide-day-label {
  font-size: 20px;
  font-weight: 700;
  min-width: 110px;
  text-align: center;
}

#guide-body {
  position: absolute;
  top: 96px;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  background: rgba(8, 12, 20, 0.88);
  z-index: 10;
}

#guide-channels-col {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--guide-corner-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 20;
}

#guide-corner-cell {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.guide-ch-labels-scroll {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.guide-ch-label-cell {
  border: 2px solid transparent;
  border-radius: 10px;
}

.guide-ch-label {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  padding: 0 16px;
  border-radius: 10px;
  overflow: hidden;
}

.guide-ch-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 20px;
}

.guide-ch-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.guide-ch-name {
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-ch-label-cell.focused .guide-ch-label {
  background-color: var(--bg-focused);
}

#guide-grid-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
}

#guide-time-header {
  height: 56px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--guide-corner-bg);
  overflow: hidden;
}

.guide-hour-col {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

#guide-grid-area {
  position: absolute;
  top: 56px;
  left: 0;
  bottom: 0;
  overflow: hidden;
}

#guide-rows-layer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  min-width: 100%;
  z-index: 5;
}

.guide-prog-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 10px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.guide-prog-block .prog-time {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.guide-prog-block .prog-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  color: #fff;
}

.guide-prog-block .prog-catchup {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 2px 8px;
  display: inline-block;
  margin-top: 4px;
}

.guide-prog-block.focused {
  outline: var(--border-focus);
  outline-offset: -2px;
  box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.4), var(--focus-glow);
  z-index: 30;
  transform: scale(1.015);
}

#guide-canvas-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
}

.guide-vline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.07);
}

.guide-hline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}

.guide-row-highlight {
  position: absolute;
  left: 0;
  background: rgba(0, 229, 255, 0.08);
  border-top: 2px solid rgba(0, 229, 255, 0.5);
  border-bottom: 2px solid rgba(0, 229, 255, 0.5);
  pointer-events: none;
  z-index: 2;
}

#guide-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--guide-now-line);
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.9);
  z-index: 40;
  pointer-events: none;
}

#guide-now-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top: 12px solid var(--guide-now-line);
}

#guide-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: var(--guide-corner-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  z-index: 30;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  padding: 0 20px;
}

/* ==========================================================================
   Guide Archive Body
   ========================================================================== */
.guide-archive-body {
  position: absolute;
  top: 96px;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  background: rgba(8, 12, 20, 0.88);
  z-index: 10;
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--guide-corner-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.archive-channel-info {
  display: flex;
  align-items: center;
  gap: 18px;
}

.archive-logo {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 28px;
}

.archive-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.archive-channel-name {
  font-size: 24px;
  font-weight: 800;
}

.archive-hint {
  font-size: 16px;
  color: var(--text-secondary);
}

.archive-programs-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.archive-prog-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.archive-prog-item.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
}

.archive-prog-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
  font-variant-numeric: tabular-nums;
  min-width: 160px;
  flex-shrink: 0;
}

.archive-prog-title {
  flex: 1;
  font-size: 20px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-prog-catchup {
  font-size: 14px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border-radius: 12px;
  padding: 4px 12px;
  flex-shrink: 0;
}

.archive-prog-desc {
  font-size: 15px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 350px;
}

/* ==========================================================================
   Dedicated Screens (Playlists / Settings)
   ========================================================================== */
.screen-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--guide-corner-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 30;
}

.screen-body {
  position: absolute;
  top: 96px;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  background: rgba(8, 12, 20, 0.88);
  z-index: 10;
}

.screen-col-left {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--guide-corner-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 20;
}

.screen-col-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 40px;
  overflow-y: auto;
  gap: 20px;
}

.screen-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  font-size: 20px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
}

.screen-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.screen-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: var(--guide-corner-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  z-index: 30;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  padding: 0 20px;
}

/* Playlist items */
.playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.playlist-item.active {
  border-color: rgba(0, 229, 255, 0.5);
  background: rgba(0, 229, 255, 0.1);
}

.playlist-item.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
}

.playlist-item-name {
  font-size: 20px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item-count {
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 12px;
}

.playlist-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.playlist-detail-name {
  font-size: 22px;
  font-weight: 700;
}

.playlist-detail-url {
  font-size: 14px;
  color: var(--accent-cyan);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  opacity: 0.85;
}

.playlist-detail-meta {
  font-size: 16px;
  color: var(--text-secondary);
}

.playlist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Settings category items */
.settings-cat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.settings-cat-item.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.settings-cat-item.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
  color: var(--text-main);
}

/* ==========================================================================
   Channel Zap Popover
   ========================================================================== */
#channel-zap-badge {
  position: fixed;
  top: 50px;
  right: 60px;
  background: rgba(0, 229, 255, 0.95);
  color: #000;
  font-size: 30px;
  font-weight: 800;
  padding: 16px 30px;
  border-radius: 36px;
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.4);
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#channel-zap-badge.visible { opacity: 1; }

/* ==========================================================================
   Playlist Loading Overlay
   ========================================================================== */
.playlist-loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9500;
}

.playlist-loading-overlay.active {
  display: flex;
}

.loading-card {
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-width: 480px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.loading-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}

.loading-name {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 400px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-tracks {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.loading-track {
  height: 100%;
  width: 100%;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), #3b82f6);
  border-radius: 5px;
  transition: width 0.2s ease;
}

.loading-meta {
  font-size: 16px;
  color: var(--text-muted);
}

/* ==========================================================================
   Modals & Dialog Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(15px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group label {
  font-size: 18px;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-row .form-group {
  flex: 1;
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.folder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 2px solid transparent;
  color: var(--text-main);
  cursor: pointer;
}

.folder-item.selected {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.1);
}

.folder-item.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  background: var(--bg-focused);
}

.input-field, select.input-field {
  width: 100%;
  padding: 18px 22px;
  background: var(--bg-main);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 20px;
  font-family: inherit;
}

select.input-field option {
  background: var(--bg-sidebar);
  color: var(--text-main);
}

.input-field:focus, .input-field.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow);
  outline: none;
}

.btn {
  padding: 18px 30px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  background: var(--accent-blue);
  cursor: pointer;
}

.btn-primary { background: linear-gradient(135deg, var(--accent-cyan), #3b82f6); color: #000; font-weight: 700; }
.btn-danger { background: rgba(239, 68, 68, 0.2); border: 1px solid var(--accent-red); color: #fca5a5; }

/* Scrollbar styling (WebKit / WebOS) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   NEW 3-PANE LAYOUT (Categories middle column + Content right grid)
   ========================================================================== */

/* Category middle column — persistent focusable list */
.categories-panel {
  position: absolute;
  left: 0;
  top: 110px;
  bottom: 44px;
  width: 360px;
  background: var(--bg-pane);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 25;
}

.category-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin: 4px 0;
  border-radius: var(--radius-md);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.category-item.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.category-item .cat-icon { font-size: 24px; }
.category-item .cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-item .cat-count {
  font-size: 16px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
}

/* Content panel (right side) */
#channels-panel.panel-right {
  left: 360px;             /* categories column (360) anchored directly to main menu rail */
  right: 0;
  top: 110px;
  bottom: 44px;
  width: auto;
  background: var(--bg-pane);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 0;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Persistent "Jump to Live" badge */
.jump-to-live-btn {
  position: absolute;
  top: 40px;
  right: 50px;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(220, 38, 38, 0.9);
  color: #ffffff;
  border: 2px solid #ef4444;
  border-radius: 30px;
  padding: 10px 22px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.5);
  cursor: pointer;
  z-index: 120;
  transition: transform 0.2s ease, background 0.2s ease;
}
.jump-to-live-btn .live-badge-dot {
  color: #ffffff;
  font-size: 18px;
  animation: pulse-live-dot 1.5s infinite;
}
@keyframes pulse-live-dot {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}
.jump-to-live-btn.focused,
.jump-to-live-btn:hover {
  background: #ef4444;
  transform: scale(1.08);
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.7);
}

/* Unified Channel Mini-Guide (Left Rail 1/3) Overlay */
.osd-mini-guide {
  position: absolute;
  top: 40px;
  bottom: 40px;
  left: 40px;
  width: 520px;
  background: rgba(10, 15, 28, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  z-index: 115;
  pointer-events: auto;
}

.mini-guide-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.mini-guide-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mini-guide-ch-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-guide-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--accent-cyan);
}

.mini-guide-filter-hint {
  color: var(--accent-yellow);
  font-weight: 600;
}

.mini-guide-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.mini-guide-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-guide-item.archive {
  border-left: 4px solid var(--accent-blue);
}

.mini-guide-item.live {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.15);
}

.mini-guide-item.upcoming {
  border-left: 4px solid var(--text-secondary);
  opacity: 0.7;
}

.mini-guide-item.focused,
.mini-guide-item:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.18);
  box-shadow: 0 4px 18px rgba(0, 229, 255, 0.25);
}

.mini-guide-status-icon {
  font-size: 18px;
  min-width: 24px;
  text-align: center;
}

.mini-guide-item.archive .mini-guide-status-icon { color: var(--accent-cyan); }
.mini-guide-item.live .mini-guide-status-icon { color: #10b981; }
.mini-guide-item.upcoming .mini-guide-status-icon { color: var(--text-muted); }

.mini-guide-time {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 75px;
}

.mini-guide-prog-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Quick-Scrub Bar Overlay */
.osd-scrub-bar {
  position: absolute;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 1600px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 18px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  z-index: 110;
}
.scrub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.scrub-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
}
.scrub-hint {
  font-size: 14px;
  color: var(--text-secondary);
}
.scrub-cards-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 6px 4px 12px 4px;
}
.scrub-cards-container::-webkit-scrollbar {
  height: 6px;
}
.scrub-cards-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* Scrub program card */
.scrub-card {
  flex: 0 0 260px;
  background: rgba(30, 41, 59, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.scrub-card.archive {
  border-left: 4px solid var(--accent-blue);
}
.scrub-card.now {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.15);
}
.scrub-card.upcoming {
  border-left: 4px solid var(--text-secondary);
  opacity: 0.7;
}
.scrub-card.focused,
.scrub-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.2);
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 24px rgba(0, 229, 255, 0.3);
}
.scrub-card-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.scrub-card-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
}
.scrub-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scrub-card-dur {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==========================================================================
   PLAYER OSD (glassmorphism bottom overlay)
   ========================================================================== */

.player-osd {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;                 /* passthrough until visible */
  opacity: 0;
  transition: opacity 0.25s ease;
}

.player-osd.visible {
  opacity: 1;
  pointer-events: auto;
}

.osd-bottom-panel {
  position: absolute;
  left: 60px;
  right: 60px;
  bottom: 40px;
  padding: 28px 40px;
  border-radius: 28px;
  background: rgba(10, 14, 24, 0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(20px);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.player-osd.visible .osd-bottom-panel {
  transform: translateY(0);
}

.osd-channel-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.osd-channel-logo {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.osd-channel-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.osd-channel-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-cyan);
}

.osd-channel-name {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-main);
}

.osd-programme-info {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  font-size: 20px;
  color: var(--text-secondary);
}

.osd-codec-badge {
  font-size: 16px;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  padding: 3px 10px;
  border-radius: 10px;
}

.osd-progress-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  margin-top: 18px;
  overflow: hidden;
}

.osd-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), #00e5ff);
  width: 0%;
  transition: width 1s linear;
}

.osd-action-bar {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}

.osd-action {
  padding: 14px 26px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
}

.osd-action.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
  background: rgba(0, 229, 255, 0.2);
}

/* Quick Channel Flip Bar */
#osd-flip-channels {
  position: absolute;
  top: 120px;
  bottom: 220px;
  left: 40px;
  width: 380px;
  border-radius: 20px;
  background: rgba(10, 14, 24, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  opacity: 0;
  transform: translateX(-40px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.player-osd.flip-open #osd-flip-channels {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.flip-channel-row {
  margin: 6px;
}

.flip-channel-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 20px;
}

.flip-channel-content.current {
  background: rgba(0, 229, 255, 0.14);
  color: var(--accent-cyan);
}

.flip-channel-num {
  font-weight: 700;
  color: var(--text-muted);
  min-width: 48px;
}

/* Audio / Subtitle popup menus */
.osd-popup-menu {
  position: absolute;
  right: 60px;
  top: 120px;
  width: 340px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 20px;
  background: rgba(10, 14, 24, 0.88);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.osd-popup-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.osd-popup-header {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-cyan);
  padding: 8px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.osd-menu-item {
  padding: 14px 16px;
  margin: 4px 0;
  border-radius: 12px;
  font-size: 18px;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.2s ease;
}

.osd-menu-item.active {
  background: rgba(0, 229, 255, 0.18);
  color: var(--accent-cyan);
  font-weight: 600;
}

.osd-menu-item.focused {
  border: 2px solid var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
}

.osd-menu-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 18px;
}

/* ==========================================================================
   VOD & SERIES GRIDS (virtualized poster grids)
   ========================================================================== */

.vod-grid-container,
.series-grid-container {
  position: absolute;
  top: 130px;
  left: 220px;
  right: 40px;
  bottom: 70px;
  overflow-y: auto;
  padding: 4px;
}

.vod-categories {
  position: absolute;
  top: 90px;
  left: 220px;
  right: 40px;
  height: 50px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  align-items: center;
}

.vod-grid-cell {
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.vod-grid-cell.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
  transform: scale(1.04);
  z-index: 20;
}

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

.vod-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  color: var(--text-main);
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.series-grid-cell {
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}

.series-grid-cell.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
  transform: scale(1.04);
  z-index: 20;
}

/* ==========================================================================
   SERIES DETAIL MODAL
   ========================================================================== */

.modal-card.wide {
  width: 1100px;
  max-height: 80vh;
  overflow-y: auto;
}

.series-detail-header {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.series-detail-poster {
  width: 180px;
  height: 270px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
  flex-shrink: 0;
}

.series-detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.series-detail-info {
  flex: 1;
}

.series-detail-desc {
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.5;
  margin-top: 10px;
}

.series-seasons-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.season-tab {
  padding: 12px 24px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
}

.season-tab.active {
  background: rgba(0, 229, 255, 0.14);
  color: var(--accent-cyan);
  font-weight: 700;
}

.season-tab.focused {
  border-color: var(--accent-cyan);
}

.series-episodes-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.episode-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  border: 2px solid transparent;
}

.episode-row.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
}

.episode-thumb {
  width: 120px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}

.episode-info {
  flex: 1;
}

.episode-title {
  font-size: 19px;
  color: var(--text-main);
  font-weight: 600;
}

.episode-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  margin-top: 6px;
  overflow: hidden;
}

.watch-progress-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 2px;
}

/* ==========================================================================
   PARENTAL PIN MODAL
   ========================================================================== */

.pin-display {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 16px;
  color: var(--accent-cyan);
  text-align: center;
  margin: 16px 0;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 20px 0;
}

.pin-error {
  color: #fca5a5;
  font-size: 18px;
  text-align: center;
  margin-bottom: 12px;
}

.pin-keypad {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 360px;
  margin: 0 auto;
}

.pin-key {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  font-size: 32px;
  font-weight: 700;
  background: var(--bg-card);
  border: 2px solid rgba(255,255,255,0.08);
  color: var(--text-main);
  cursor: pointer;
}

.pin-key.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
  background: rgba(0,229,255,0.15);
}

/* ==========================================================================
   OLED BURN-IN PROTECTION
   ========================================================================== */

body.burnin-active #player-stage {
  animation: pixel-shift 90s linear infinite;
}

@keyframes pixel-shift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(1px, -2px); }
  75% { transform: translate(2px, 1px); }
}

/* ==========================================================================
   HORIAONTAL CATEGORY SCROLL (retained for backward compat)
   ========================================================================== */

#category-tabs {
  position: absolute;
  top: 90px;
  left: 220px;
  right: 40px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.category-tab {
  padding: 12px 26px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.category-tab.active {
  background: rgba(0,229,255,0.12);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.category-tab.focused {
  border-color: var(--accent-cyan);
  box-shadow: var(--focus-glow-soft);
}
