/* COZONE Web — Live TV & EPG Page Styles (Edition R1: 极简深灰 · Apple TV / Infuse) */

.live-page {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 31.5%, 380px);
  gap: 20px;
  align-items: start;
  color: var(--text, #F4F4F6);
}

/* =========================================================
   LEFT COLUMN: THEATER STAGE + CHANNEL INFO & EPG BAR
   ========================================================= */
.live-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-xl, 12px);
  overflow: hidden;
  background: #0D0D10;
  border: 1px solid var(--border, #242429);
  user-select: none;
}

[data-theme="light"] .live-stage {
  background: #18181B;
}

.live-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.055);
  pointer-events: none;
  z-index: 12;
}

.live-video-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 2;
}

.live-video-host.is-audio-hidden {
  width: 1px;
  height: 1px;
  inset: auto;
  bottom: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.live-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000000;
  z-index: 3;
}

/* Calm matte R1 cards inside the 16:9 stage (Ready / Audio / Official / HTTP) */
.live-stage-card {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #121215;
  color: #F4F4F6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 32px;
  gap: 10px;
}

.live-stage-emblem {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #1E1E22;
  border: 1px solid #2C2C32;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.live-stage-emblem-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #D8D8DC;
  font-variant-numeric: tabular-nums;
}

.live-stage-emblem-img:not([src]),
.live-stage-emblem-img[src=""] {
  display: none;
}

.live-stage-emblem-img {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.live-stage-emblem-img.is-loaded {
  display: block;
  opacity: 1;
}

.live-stage-emblem.has-logo .live-stage-emblem-text {
  opacity: 0;
}

.live-stage-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  line-height: 16px;
  color: #8E8E93;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.live-stage-title {
  margin: 0;
  max-width: 560px;
  font-size: 22px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-stage-desc {
  margin: 0;
  max-width: 460px;
  font-size: 13px;
  line-height: 19px;
  color: #8E8E93;
}

.live-stage-epg-line {
  margin: 0;
  max-width: 500px;
  font-size: 13px;
  line-height: 18px;
  color: #B4B4BA;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-stage-url-box {
  max-width: 480px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  background: #1A1A1E;
  border: 1px solid #28282E;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  line-height: 16px;
  color: #8E8E93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}

.live-stage-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.live-stage-btn-primary {
  height: 36px;
  padding: 0 20px;
  border-radius: var(--radius-md, 8px);
  background: #FFFFFF;
  color: #141416;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: opacity 0.14s ease;
}

.live-stage-btn-primary:hover {
  opacity: 0.88;
}

.live-stage-btn-secondary {
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md, 8px);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #F4F4F6;
  font-size: 13px;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.14s ease;
}

.live-stage-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.live-stage-hint {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 16px;
  color: #636368;
}

/* Calm audio volume control (ZERO fake oscilloscopes) */
.live-audio-vol {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #8E8E93;
}

.live-vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 112px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.live-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #F4F4F6;
  cursor: pointer;
}

.live-vol-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: #F4F4F6;
  cursor: pointer;
}

/* Tiny 6px whisper-quiet link health dot (zero neon/glow) */
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  background: var(--health-idle, #636366);
  opacity: 0.55;
  transition: background-color 0.16s ease, opacity 0.16s ease;
}

.live-dot.is-indirect {
  opacity: 0.24;
}

.live-dot.is-online,
.live-dot.is-health-healthy {
  background: var(--health-ok, #30D158);
  opacity: 1;
}

.live-dot.is-health-degraded {
  background: var(--health-warn, #FFD60A);
  opacity: 0.92;
}

.live-dot.is-health-cooldown {
  background: var(--health-bad, #FF453A);
  opacity: 0.85;
}

.live-dot.is-health-untested {
  background: var(--health-idle, #636366);
}

/* Quiet minimal numeric jump OSD pill */
.live-osd {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 24;
  min-width: 84px;
  max-width: 240px;
  padding: 8px 14px;
  border-radius: var(--radius-lg, 10px);
  background: rgba(20, 20, 22, 0.92);
  border: 1px solid #323238;
  color: #F4F4F6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

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

.live-osd-num {
  font-family: var(--font-mono, monospace);
  font-size: 21px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
}

.live-osd-label {
  max-width: 100%;
  font-size: 11px;
  line-height: 14px;
  color: #8E8E93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   CHANNEL INFO & EPG BAR BELOW STAGE
   ========================================================= */
.live-info-panel {
  background: var(--bg-elevated, #19191D);
  border: 1px solid var(--border, #242429);
  border-radius: var(--radius-xl, 12px);
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.live-info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  flex-wrap: wrap;
}

.live-channel-id {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 220px;
}

.live-info-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md, 8px);
  background: var(--surface, #1E1E22);
  border: 1px solid var(--border, #242429);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.live-info-avatar-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary, #8E8E93);
  font-variant-numeric: tabular-nums;
}

.live-info-avatar-img:not([src]),
.live-info-avatar-img[src=""] {
  display: none;
}

.live-info-avatar-img {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.live-info-avatar-img.is-loaded {
  display: block;
  opacity: 1;
}

.live-info-avatar.has-logo .live-info-avatar-text {
  opacity: 0;
}

.live-info-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.live-info-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
}

.live-info-name {
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
  font-size: 16px;
  font-weight: 600;
  line-height: 21px;
  color: var(--text, #F4F4F6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-info-telemetry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.live-tel-ms {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 14px;
  color: var(--text-secondary, #8E8E93);
  white-space: nowrap;
}

.live-tel-backup {
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  line-height: 16px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface, #1E1E22);
  border: 1px solid var(--border, #242429);
  color: var(--text-secondary, #8E8E93);
  white-space: nowrap;
}

.live-tel-switched {
  font-size: 10.5px;
  line-height: 14px;
  color: var(--text-muted, #636368);
  white-space: nowrap;
}

.live-info-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary, #8E8E93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.live-info-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
}

.live-ctrl-btn {
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-md, 8px);
  background: var(--surface, #1E1E22);
  border: 1px solid var(--border, #242429);
  color: var(--text, #F4F4F6);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  font-variant-numeric: tabular-nums;
}

.live-ctrl-btn:hover:not(:disabled) {
  background: var(--surface-hover, #26262B);
  border-color: var(--border-strong, #323238);
}

.live-ctrl-btn.is-active {
  background: var(--surface-hover, #26262B);
  border-color: var(--border-strong, #323238);
  color: var(--nav-active, #FFFFFF);
  font-weight: 500;
}

.live-ctrl-btn:disabled {
  opacity: 0.44;
  cursor: default;
}

/* EPG Progress Strip */
.live-epg-block {
  padding-top: 11px;
  border-top: 1px solid var(--border, #242429);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.live-epg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.live-epg-now {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.live-epg-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted, #636368);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.live-epg-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: var(--text, #F4F4F6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-epg-title.is-empty {
  color: var(--text-secondary, #8E8E93);
  font-weight: 400;
}

.live-epg-time {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 16px;
  color: var(--text-secondary, #8E8E93);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.live-epg-bar {
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--progress-track, rgba(255, 255, 255, 0.14));
  overflow: hidden;
}

.live-epg-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--progress-fill, #FFFFFF);
  transition: width 0.35s ease;
}

.live-epg-next {
  font-size: 11.5px;
  line-height: 15px;
  color: var(--text-muted, #636368);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   RIGHT COLUMN: #19191D ROUNDED CHANNEL LIST CONTAINER
   ========================================================= */
.live-sidebar {
  min-width: 0;
  background: var(--bg-elevated, #19191D);
  border: 1px solid var(--border, #242429);
  border-radius: var(--radius-xl, 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: clamp(540px, calc(100dvh - var(--topbar-h, 56px) - var(--audiobar-h, 52px) - 56px), 710px);
}

.live-sidebar-head {
  padding: 13px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.live-sidebar-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.live-sidebar-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  color: var(--text, #F4F4F6);
}

.live-sidebar-count {
  font-size: 11.5px;
  line-height: 15px;
  color: var(--text-muted, #636368);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-sidebar-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.live-import-btn {
  height: 26px;
  padding: 0 8px;
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #1E1E22);
  border: 1px solid var(--border, #242429);
  color: var(--text-secondary, #8E8E93);
  font-size: 11.5px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: color 0.14s ease, background-color 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}

.live-import-btn:hover:not(:disabled) {
  color: var(--text, #F4F4F6);
  background: var(--surface-hover, #26262B);
  border-color: var(--border-strong, #323238);
}

.live-import-btn:disabled {
  opacity: 0.56;
  cursor: default;
}

.live-probe-btn.is-busy {
  color: var(--text, #F4F4F6);
  border-color: var(--border-strong, #323238);
}

/* Quiet Region Tabs — horizontal scroll with smooth edge-fade mask */
.live-regions-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--border, #242429);
  flex-shrink: 0;
}

.live-regions {
  padding: 2px 14px 10px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.live-regions::-webkit-scrollbar {
  display: none;
}

.live-regions.is-fade-right {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
}

.live-regions.is-fade-left {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 100%);
}

.live-regions.is-fade-both {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.live-region-tab {
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-sm, 6px);
  font-size: 12px;
  line-height: 26px;
  font-weight: 400;
  color: var(--text-secondary, #8E8E93);
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.14s ease, background-color 0.14s ease;
}

.live-region-tab:hover {
  color: var(--text, #F4F4F6);
}

.live-region-tab.is-active {
  background: var(--surface-hover, #26262B);
  color: var(--nav-active, #FFFFFF);
  font-weight: 600;
}

/* Inline Filter & Playable-Only Toggle */
.live-filter-row {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--border, #242429);
  flex-shrink: 0;
}

.live-filter-box {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-md, 8px);
  background: var(--bg, #141416);
  border: 1px solid var(--border, #242429);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.14s ease;
}

.live-filter-box:focus-within {
  border-color: var(--border-strong, #323238);
}

.live-filter-icon {
  color: var(--text-muted, #636368);
  flex-shrink: 0;
  pointer-events: none;
}

.live-filter-input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: var(--text, #F4F4F6);
}

.live-filter-input:focus-visible {
  outline: none;
}

.live-filter-input::placeholder {
  color: var(--text-muted, #636368);
}

.live-filter-clear {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #636368);
  flex-shrink: 0;
}

.live-filter-clear:hover {
  color: var(--text, #F4F4F6);
}

.live-toggle-playable {
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-md, 8px);
  background: var(--bg, #141416);
  border: 1px solid var(--border, #242429);
  color: var(--text-secondary, #8E8E93);
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.live-toggle-playable:hover {
  color: var(--text, #F4F4F6);
  border-color: var(--border-strong, #323238);
}

.live-toggle-playable.is-on {
  background: var(--surface-hover, #26262B);
  border-color: var(--border-strong, #323238);
  color: var(--text, #F4F4F6);
}

.live-toggle-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #636368);
  flex-shrink: 0;
}

.live-toggle-playable.is-on .live-toggle-indicator {
  background: var(--health-ok, #30D158);
}

/* =========================================================
   VIRTUALIZED CHANNEL LIST (EXACT 48px ROW HEIGHT)
   ========================================================= */
.live-vlist {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  overscroll-behavior: contain;
}

.live-vlist-spacer {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.live-vlist-window {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  will-change: transform;
}

.live-row {
  height: 48px;
  padding: 0 10px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.032);
  position: relative;
  cursor: pointer;
  transition: background-color 0.1s ease;
  user-select: none;
}

[data-theme="light"] .live-row {
  border-bottom-color: rgba(20, 20, 22, 0.05);
}

.live-row:hover {
  background: var(--surface, #1E1E22);
}

.live-row.is-active {
  background: var(--surface-hover, #26262B);
}

.live-row.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 0 1px 1px 0;
  background: var(--nav-active, #FFFFFF);
}

.live-row.is-muted .live-row-name {
  color: var(--text-secondary, #8E8E93);
}

.live-row-num {
  width: 26px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 14px;
  color: var(--text-muted, #636368);
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
}

.live-row.is-active .live-row-num {
  color: var(--text-secondary, #8E8E93);
}

.live-row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.live-row-name {
  font-size: 13px;
  font-weight: 400;
  line-height: 17px;
  color: var(--text, #F4F4F6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-row.is-active .live-row-name {
  font-weight: 600;
  color: var(--nav-active, #FFFFFF);
}

.live-row-epg {
  font-size: 11px;
  line-height: 14px;
  color: var(--text-secondary, #8E8E93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-row-prog {
  width: 100%;
  height: 1.5px;
  margin-top: 1px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

[data-theme="light"] .live-row-prog {
  background: rgba(20, 20, 22, 0.1);
}

.live-row-prog.is-idle {
  visibility: hidden;
}

.live-row-prog-fill {
  height: 100%;
  background: var(--text-secondary, #8E8E93);
}

.live-row.is-active .live-row-prog-fill {
  background: var(--nav-active, #FFFFFF);
}

.live-row-telemetry {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.live-row-ms {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  line-height: 13px;
  color: var(--text-muted, #636368);
  white-space: nowrap;
}

.live-row-backup {
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
  line-height: 12px;
  color: var(--text-muted, #636368);
  opacity: 0.88;
  white-space: nowrap;
}

.live-row.is-active .live-row-ms,
.live-row.is-active .live-row-backup {
  color: var(--text-secondary, #8E8E93);
}

.live-row-fav {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm, 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #636368);
  opacity: 0.45;
  flex-shrink: 0;
  transition: opacity 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.live-row:hover .live-row-fav,
.live-row.is-active .live-row-fav,
.live-row-fav:focus-visible {
  opacity: 0.9;
}

.live-row-fav:hover {
  color: var(--text, #F4F4F6);
  background: rgba(255, 255, 255, 0.06);
}

.live-row-fav.is-fav {
  opacity: 1;
  color: var(--text, #F4F4F6);
}

.live-list-empty {
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  color: var(--text-secondary, #8E8E93);
  font-size: 12.5px;
  line-height: 18px;
}

.live-list-empty-sub {
  font-size: 11.5px;
  color: var(--text-muted, #636368);
}

.live-sidebar-foot {
  height: 28px;
  padding: 0 12px;
  border-top: 1px solid var(--border, #242429);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted, #636368);
  flex-shrink: 0;
}

/* =========================================================
   CUSTOM M3U / TVBOX .TXT IMPORT MODAL
   ========================================================= */
.live-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: var(--overlay-backdrop, rgba(10, 10, 12, 0.72));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.live-modal-panel {
  width: 100%;
  max-width: 540px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  background: var(--surface, #1E1E22);
  border: 1px solid var(--border-strong, #323238);
  border-radius: var(--radius-xl, 12px);
  box-shadow: var(--shadow-modal, 0 24px 60px rgba(0, 0, 0, 0.52));
  color: var(--text, #F4F4F6);
}

.live-modal-body {
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-field-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text, #F4F4F6);
}

.live-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md, 8px);
  background: var(--bg, #141416);
  border: 1px solid var(--border-strong, #323238);
  font-size: 13px;
  color: var(--text, #F4F4F6);
}

.live-input:focus,
.live-textarea:focus {
  outline: none;
  border-color: var(--text-secondary, #8E8E93);
}

.live-dropzone {
  border: 1px dashed var(--border-strong, #323238);
  border-radius: var(--radius-lg, 10px);
  background: var(--bg, #141416);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary, #8E8E93);
  font-size: 12.5px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.live-dropzone:hover,
.live-dropzone.is-dragover {
  border-color: var(--text, #F4F4F6);
  background: var(--bg-elevated, #19191D);
  color: var(--text, #F4F4F6);
}

.live-dropzone-sub {
  font-size: 11px;
  color: var(--text-muted, #636368);
}

.live-textarea {
  width: 100%;
  min-height: 132px;
  max-height: 240px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: var(--radius-md, 8px);
  background: var(--bg, #141416);
  border: 1px solid var(--border-strong, #323238);
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text, #F4F4F6);
}

.live-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.live-modal-status {
  font-size: 12px;
  color: var(--text-secondary, #8E8E93);
  min-height: 16px;
}

.live-modal-status.is-error {
  color: var(--status-danger, #EF4444);
}

.live-modal-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.live-saved-sources {
  padding-top: 12px;
  border-top: 1px solid var(--border, #242429);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md, 8px);
  background: var(--bg, #141416);
  border: 1px solid var(--border, #242429);
  font-size: 12.5px;
}

.live-saved-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.live-saved-name {
  color: var(--text, #F4F4F6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-saved-count {
  font-size: 11px;
  color: var(--text-muted, #636368);
  font-variant-numeric: tabular-nums;
}

.live-saved-del {
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary, #8E8E93);
  font-size: 11.5px;
  flex-shrink: 0;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.live-saved-del:hover {
  color: var(--text, #F4F4F6);
  background: var(--surface-hover, #26262B);
}

/* =========================================================
   TABLET & COMPACT SPLIT (< 900px)
   ========================================================= */
@media (max-width: 899.98px) {
  .live-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .live-main {
    width: 100%;
    gap: 10px;
  }

  .live-sidebar {
    width: 100%;
    height: 440px;
  }

  .live-regions {
    padding: 8px 14px;
    gap: 4px;
  }

  .live-sidebar-foot {
    display: none;
  }
}

/* =========================================================
   MOBILE PWA LAYOUT (< 768px — PINNED 16:9 STAGE AT TOP)
   ========================================================= */
@media (max-width: 767.98px) {
  .live-page {
    height: calc(
      100dvh - 111px - var(--mobile-audio-h, 48px) - var(--mobile-tab-h, 54px) - 22px
      - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
    );
    min-height: 480px;
    gap: 10px;
  }

  .live-main {
    flex-shrink: 0;
    gap: 8px;
  }

  .live-stage {
    border-radius: var(--radius-xl, 12px);
  }

  .live-stage-card {
    padding: 14px 16px;
    gap: 5px;
  }

  .live-stage-emblem {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    margin-bottom: 0;
  }

  .live-stage-emblem-text {
    font-size: 11px;
  }

  .live-stage-kicker {
    font-size: 10.5px;
    line-height: 14px;
  }

  .live-stage-title {
    font-size: 16px;
    line-height: 20px;
    max-width: 100%;
  }

  .live-stage-epg-line,
  .live-stage-desc {
    font-size: 11.5px;
    line-height: 15px;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
  }

  .live-stage-url-box {
    display: none;
  }

  .live-stage-actions {
    margin-top: 4px;
    gap: 7px;
  }

  .live-stage-btn-primary,
  .live-stage-btn-secondary {
    height: 30px;
    padding: 0 13px;
    font-size: 12px;
    border-radius: 7px;
  }

  .live-stage-hint {
    display: none;
  }

  .live-osd {
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    min-width: 64px;
  }

  .live-osd-num {
    font-size: 16px;
    line-height: 19px;
  }

  /* Concise channel / EPG strip on mobile */
  .live-info-panel {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 10px 12px;
    gap: 7px;
    border-radius: var(--radius-lg, 10px);
  }

  .live-info-top {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 7px;
  }

  .live-channel-id {
    flex: 0 0 auto;
    gap: 9px;
    width: 100%;
    min-width: 0;
  }

  .live-info-avatar {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }

  .live-info-name {
    font-size: 14px;
    line-height: 18px;
  }

  .live-tel-ms {
    font-size: 10px;
  }

  .live-tel-backup {
    font-size: 9.5px;
    line-height: 14px;
    padding: 0 4px;
  }

  .live-tel-switched {
    display: none;
  }

  .live-info-meta {
    font-size: 11px;
    line-height: 14px;
  }

  .live-info-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-shrink: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 1px;
  }

  .live-info-actions::-webkit-scrollbar {
    display: none;
  }

  .live-ctrl-btn {
    height: 26px;
    padding: 0 7px;
    gap: 3px;
    font-size: 10.5px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .live-epg-block {
    padding-top: 7px;
    gap: 5px;
  }

  .live-epg-tag {
    display: none;
  }

  .live-epg-title {
    font-size: 12px;
    line-height: 15px;
  }

  .live-epg-time {
    font-size: 10.5px;
  }

  .live-epg-next {
    display: none;
  }

  /* Scrollable single-column channel list fills remaining pinned viewport */
  .live-sidebar {
    flex: 1 1 auto;
    height: auto;
    min-height: 210px;
    border-radius: var(--radius-lg, 10px);
  }

  .live-sidebar-head {
    display: none;
  }

  .live-regions {
    padding: 7px 12px;
  }

  .live-region-tab {
    height: 25px;
    line-height: 25px;
    padding: 0 8px;
    font-size: 12px;
  }

  .live-filter-row {
    padding: 7px 10px;
    gap: 5px;
  }

  .live-toggle-playable {
    height: 28px;
    padding: 0 7px;
    font-size: 11px;
    gap: 4px;
  }

  .live-filter-box {
    height: 28px;
    padding: 0 8px;
  }

  .live-mobile-probe-btn {
    display: inline-flex;
    height: 28px;
    padding: 0 7px;
    font-size: 11px;
  }

  .live-mobile-import-btn {
    display: inline-flex;
    height: 28px;
    padding: 0 7px;
  }

  .live-row {
    padding: 0 8px 0 10px;
    gap: 7px;
  }

  .live-row-fav {
    opacity: 0.72;
  }

  .live-modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .live-modal-body {
    padding: 14px 16px 18px;
  }
}

@media (min-width: 768px) {
  .live-mobile-probe-btn,
  .live-mobile-import-btn {
    display: none;
  }
}
