.channel-view {
  position: relative;
  display: flex;
  height: 100%;
  background: var(--bg-primary);
}

.sidebar {
  width: 380px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  /* The pencil that set this height moved to the button column. */
  min-height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.channel-count {
  font-size: calc(20px * var(--font-scale));
  color: var(--text-muted);
}

/* Live's button column (channel-list.ts renderActionColumn): round icon
   buttons, each naming itself beside it while focused. Tucked off the left
   edge until used, as on Movies/Series (genre-home.css .gh-side): a small
   tab shows it is there, and it slides in over the lists while focus is in
   it or the pointer is over the edge. */
.live-side {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 28px;
  z-index: 20;
}
.live-side-tab {
  position: absolute;
  top: 50%;
  left: 0;
  /* 16px: a TV's overscan crops the outermost ~8px of the picture (measured
     on the owner's C3: the 6px tab vanished altogether). */
  width: 16px;
  height: 88px;
  margin-top: -44px;
  border-radius: 0 6px 6px 0;
  background: var(--accent);
  opacity: 0.55;
  -webkit-transition: opacity 180ms ease-out;
  transition: opacity 180ms ease-out;
}
.live-side .live-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  box-sizing: border-box;
  -webkit-transform: translateX(-100%);
  transform: translateX(-100%);
  -webkit-transition: -webkit-transform 200ms ease-out, box-shadow 200ms ease-out;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}
.live-side.is-open .live-actions,
html:not(.keys-active) .live-side:hover .live-actions {
  -webkit-transform: translateX(0);
  transform: translateX(0);
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.6);
}
.live-side.is-open .live-side-tab,
html:not(.keys-active) .live-side:hover .live-side-tab {
  opacity: 0;
}

.live-actions {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  border-right: 1px solid var(--glass-edge);
}

.live-action {
  position: relative;
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.live-action.focused {
  color: var(--text-primary);
}

.live-action.is-on {
  background: var(--accent);
  color: var(--bg-primary);
}

.live-action-icon svg {
  display: block;
  width: 28px;
  height: 28px;
}

/* Icons drawn without their own stroke (the settings globe). */
.live-action-icon svg:not([stroke]) {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A button with a colour key is that colour, as on the remote. */
.live-action.remote-red { background: var(--remote-key-red); color: #fff; }
.live-action.remote-green { background: var(--remote-key-green); color: #fff; }
.live-action.remote-yellow { background: var(--remote-key-yellow); color: #1b1b1b; }
.live-action.remote-blue { background: var(--remote-key-blue); color: #fff; }

.live-action.remote-red.is-on,
.live-action.remote-green.is-on,
.live-action.remote-yellow.is-on,
.live-action.remote-blue.is-on {
  box-shadow: inset 0 0 0 4px var(--bg-primary);
}

.live-action-key-hint {
  display: block;
  margin-top: 2px;
  font-size: calc(15px * var(--font-scale));
  color: var(--text-secondary);
}

.live-action-label {
  position: absolute;
  left: 76px;
  top: 50%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  padding: 8px 16px;
  white-space: nowrap;
  font-size: calc(20px * var(--font-scale));
  line-height: 22px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
}

.live-action.focused .live-action-label,
.live-action:hover .live-action-label {
  opacity: 1;
}

/* Favorite mode: each row's star, filled once it is a favorite. */
.channel-fav-toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-left: 10px;
  color: var(--text-muted);
}

.channel-fav-toggle svg {
  display: block;
  width: 100%;
  height: 100%;
}

.channel-fav-toggle.is-on {
  color: var(--accent);
}

.channel-fav-toggle.is-on svg {
  fill: currentColor;
}

/* Playlist tabs */
.playlist-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.playlist-tab {
  padding: 10px 16px;
  font-size: calc(18px * var(--font-scale));
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  border: 2px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
}

.playlist-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-tertiary);
}

/* Focus is the app's ring all round: the chosen tab already has the
   accent underline, so an underline alone didn't show focus arriving. */
.playlist-tab.focused {
  border-color: var(--focus-ring) !important;
  box-shadow: 0 0 0 2px var(--accent-glow) !important;
  color: var(--text-primary);
}

.group-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.group-list {
  flex: 1;
  overflow-y: auto;
  /* Wider on the left than the right: the button column's tab sits at the
     screen's edge, and a focused row's glow ran into it. */
  padding: 8px 8px 8px 22px;
}

/* The region the rows at the top belong to, once its own row has scrolled
   away. Over the list, so showing it never moves a row. */
.group-region-header {
  position: absolute;
  top: 0;
  left: 8px;
  right: 8px;
  z-index: 2;
  box-sizing: border-box;
  height: 42px; /* REGION_HEADER_HEIGHT in channel-list.ts */
  padding: 10px 16px 0;
  font-size: calc(18px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--accent);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}

.group-list-spacer {
  position: relative;
}

/* Fixed height: the group list is virtualized, so GROUP_ROW_STRIDE in
   channel-list.ts must stay this height plus the 8px vertical margin. */
.group-item {
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  margin: 4px 0;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  gap: 12px;
}

.group-item.active {
  background: var(--bg-tertiary);
  border-color: var(--accent-dim);
}

.group-icon {
  font-size: calc(20px * var(--font-scale));
  width: 28px;
  text-align: center;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-icon .group-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.group-name {
  flex: 1;
  font-size: calc(24px * var(--font-scale));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  font-size: calc(18px * var(--font-scale));
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* Simple categories: a region's categories sit indented under it. */
.group-item.group-nested {
  padding-left: 44px;
}
.group-nested .group-name {
  font-size: calc(22px * var(--font-scale));
}
/* A region or Events & PPV that opens: points right folded, down open. */
.group-caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  margin-right: 12px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--text-secondary);
  -webkit-transition: -webkit-transform 0.15s;
  transition: transform 0.15s;
}
.group-caret.is-open {
  -webkit-transform: rotate(90deg);
  transform: rotate(90deg);
}

/* A service under a region's Events & PPV. */
.group-item.group-nested-2 {
  padding-left: 72px;
}

/* "Simplified categories": a toggle, so its state shows without focus. */
.group-view-toggle {
  color: var(--text-secondary);
}
.group-toggle-mark {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0 3px;
  border: 2px solid currentColor;
  border-radius: 4px;
  box-sizing: border-box;
}
.group-view-toggle.is-on .group-toggle-mark {
  background: var(--accent);
  border-color: var(--accent);
}

/* Channel main area */
.channel-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 8px 16px;
}

.channel-view.has-preview .channel-main {
  flex: 1 1 480px;
  max-width: 620px;
}

.channel-preview {
  flex: 1 1 760px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 28px 16px 12px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  min-height: 0;
}

.channel-preview-video {
  position: relative;
  width: 100%;
  height: 0;
  /* 16:9 — grows with the column so the mini-player fills the right pane */
  padding-bottom: 56.25%;
  flex-shrink: 0;
  background: #000;
  border-radius: 10px;
  overflow: visible;
  border: 3px solid transparent;
  box-sizing: border-box;
}

.channel-preview-video-frame {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.channel-preview-video[data-focusable] {
  cursor: pointer;
}

.channel-preview-video.focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb-legacy), 0.35);
}

.channel-preview-placeholder {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: calc(22px * var(--font-scale));
  color: var(--text-muted);
}

.channel-preview-info {
  flex: 1;
  min-height: 0;
  margin-top: 16px;
  /* visible so the Versions focus glow is not clipped on the left */
  overflow: visible;
}

/* The channel's name, and at the right its real size once it has played
   ("1920x1080", catalog-view's stream-resolution helpers). */
.channel-preview-head {
  display: flex;
  align-items: baseline;
  margin-bottom: 14px;
}
.channel-preview-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: calc(26px * var(--font-scale));
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-preview-resolution {
  flex: 0 0 auto;
  margin-left: 16px;
  font-size: calc(22px * var(--font-scale));
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.channel-preview-programme {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.channel-preview-programme.now .channel-preview-title {
  color: var(--accent);
}

.channel-preview-label {
  font-size: calc(16px * var(--font-scale));
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.channel-preview-time {
  font-size: calc(18px * var(--font-scale));
  color: var(--text-secondary);
  margin-top: 2px;
}

.channel-preview-title {
  font-size: calc(22px * var(--font-scale));
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-preview-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 12px;
  /* Room for the focus ring; overflow:hidden ancestors used to clip the left glow. */
  padding: 4px;
  margin-left: -4px;
}

.channel-preview-versions {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  font-size: calc(20px * var(--font-scale));
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 0 0 0 transparent;
}

.channel-preview-versions.focused,
.channel-preview-versions:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb-legacy), 0.35);
}

.channel-preview-hint {
  margin-top: 12px;
  font-size: calc(18px * var(--font-scale));
  color: var(--text-muted);
}

.has-channel-hints .channel-main {
  padding-bottom: 64px;
}

.channel-list-scroll {
  position: relative;
}

.channel-list-scroll.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-list-scroll.recent-list .channel-item {
  position: relative;
  flex-shrink: 0;
}

.channel-list-spacer {
  position: relative;
  width: 100%;
}

/* Focus on a group or channel: the background, ring and glow are a layer
   painted once and faded, not a repaint of the row on every frame of a
   fade (~18 frames a second at 4K, Follow-up 149). */
.group-item,
.channel-item {
  isolation: isolate;
  transition: none;
}
.group-item::before,
.channel-item::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -2px;
  right: -2px;
  bottom: -2px;
  left: -2px;
  border: 2px solid var(--focus-ring);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms cubic-bezier(0.2, 0, 0, 1);
}
.group-item.focused::before,
.channel-item.focused::before { opacity: 1; }
.group-item[data-focusable].focused,
.channel-item[data-focusable].focused {
  border-color: transparent !important;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .group-item::before,
  .channel-item::before { transition: none; }
}

/* Fixed height: the channel list is virtualized, so CHANNEL_ROW_STRIDE in
   channel-list.ts must stay this height plus the 4px row gap. The two text
   lines only just fit, so check this box before growing either font. */
.channel-item {
  position: absolute;
  left: 0;
  right: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  gap: 16px;
  height: 84px;
}

.channel-item.playing {
  background: rgba(var(--accent-rgb-legacy), 0.08);
  border-color: var(--accent-dim);
}

.channel-item.recent-catchup {
  height: 96px;
}

.channel-number {
  font-size: calc(18px * var(--font-scale));
  color: var(--text-muted);
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.channel-logo-wrap {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel-logo {
  max-width: 48px;
  max-height: 48px;
  border-radius: 4px;
  object-fit: contain;
}

.channel-logo-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(24px * var(--font-scale));
  font-weight: 600;
  color: var(--accent);
}

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

.channel-name {
  display: flex;
  align-items: center;
  font-size: calc(24px * var(--font-scale));
  line-height: 1.25;
  font-weight: 500;
  min-width: 0;
}

.channel-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.channel-version-badge {
  flex-shrink: 0;
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  font-size: calc(16px * var(--font-scale));
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.channel-version-badge.subtle {
  font-weight: 500;
  background: transparent;
  padding: 0;
  color: var(--text-secondary);
}

.channel-version-picker {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Light enough that the glass dialog has something to frost. */
  background: rgba(0, 0, 0, 0.5);
}

.channel-version-picker.hidden {
  display: none;
}

.channel-version-dialog {
  width: 720px;
  max-width: 86%;
  max-height: 80%;
  overflow: hidden;
  padding: 28px 32px;
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  border: 1px solid var(--glass-edge);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow);
}

.channel-version-title {
  margin: 0 0 8px;
  font-size: calc(28px * var(--font-scale));
}

.channel-version-hint {
  margin: 0 0 18px;
  font-size: calc(18px * var(--font-scale));
  color: var(--text-secondary);
}

/* What the copies are, under the ask: one short line. */
.channel-version-hint.channel-version-explain {
  margin-top: -12px;
  font-size: calc(16px * var(--font-scale));
  color: var(--text-muted);
}

/* A copy that played: a small mark after its name. */
.channel-version-works {
  margin-left: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: calc(14px * var(--font-scale));
  font-weight: 600;
  vertical-align: middle;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.channel-version-failed {
  color: var(--danger);
}

/* The title and hint stay; only the list scrolls (a station can have dozens
   of copies, a language list ~190 rows). Its padding keeps the focused row's
   grown outline unclipped. A fixed height, not a flex column: on the TV the
   flex layout made each arrow press cost ~40ms instead of ~7ms. */
.channel-version-list {
  display: block;
  max-height: 56vh;
  overflow-y: auto;
  margin: 0 -14px;
  padding: 8px 14px;
}

.channel-version-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin: 0 0 8px;
  padding: 14px 16px;
  text-align: left;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.channel-version-option.focused {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
}

.channel-version-close .channel-version-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.channel-version-close.focused .channel-version-label {
  color: var(--text-primary);
}

.channel-version-label {
  font-size: calc(22px * var(--font-scale));
  font-weight: 600;
}

.channel-version-meta {
  margin-top: 4px;
  font-size: calc(16px * var(--font-scale));
  color: var(--text-secondary);
}

/* A checklist modal (checklist-picker.ts): one line per option. */
.checklist-picker-option {
  flex-direction: row;
  align-items: center;
}
.checklist-picker-option > * + * {
  margin-left: 14px;
}
.checklist-picker-option .channel-version-label {
  flex: 1;
}
.checklist-picker-mark {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 4px;
  box-sizing: border-box;
}
.checklist-picker-option.is-on .checklist-picker-mark {
  background: var(--accent);
  border-color: var(--accent);
}

/* One answer (where the app opens): round marks. */
.checklist-picker-dialog.is-single .checklist-picker-mark {
  border-radius: 50%;
}
/* A heading between options, like the Settings language dropdown's. */
.checklist-picker-section {
  padding: 14px 16px 6px;
  font-size: calc(16px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.checklist-picker-meta.is-rank {
  color: var(--accent);
  font-weight: 600;
}
.checklist-picker-meta {
  font-size: calc(16px * var(--font-scale));
  color: var(--text-secondary);
}

.channel-now {
  font-size: calc(18px * var(--font-scale));
  line-height: 1.25;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-kind-badge {
  flex-shrink: 0;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: calc(14px * var(--font-scale));
  font-weight: 700;
  letter-spacing: 0.05em;
}

.recent-kind-badge.catchup {
  color: var(--text-secondary);
}

.recent-progress {
  width: 100%;
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg-tertiary);
}

.recent-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.playing-indicator {
  font-size: calc(20px * var(--font-scale));
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* --- Channel list edit mode (reorder / hide / rename / regroup) */

.channel-item.hidden-entry,
.group-item.hidden-entry {
  opacity: 0.45;
}

.channel-item.grabbed,
.group-item.grabbed {
  background: rgba(var(--accent-rgb-legacy), 0.16);
  border-color: var(--accent);
  cursor: grabbing;
}

.channel-item.favorite-selected {
  background: rgba(var(--accent-rgb-legacy), 0.16);
  border-color: var(--accent);
}

.favorite-managing .channel-item {
  user-select: none;
}

.favorite-checkbox {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  color: var(--bg-primary);
}

.favorite-selected .favorite-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: var(--accent);
  background: var(--accent);
}

.favorite-checkbox svg {
  width: 20px;
  height: 20px;
}

.editing .channel-item,
.editing .group-item[data-group^="source:"] {
  cursor: grab;
  user-select: none;
}

.hidden-badge {
  font-size: calc(13px * var(--font-scale));
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.channel-source-name {
  font-style: italic;
}

.edit-text-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: calc(20px * var(--font-scale));
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}

.channel-item .edit-text-input {
  font-size: calc(24px * var(--font-scale));
  line-height: 1.25;
  font-weight: 500;
}

.group-item .edit-text-input {
  font-size: calc(24px * var(--font-scale));
}

.edit-hints {
  position: absolute;
  right: 0;
  bottom: 0;
  /* Past the button column (88px) and the categories (380px). */
  left: 468px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.edit-hint {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
  font-size: calc(15px * var(--font-scale));
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.edit-action {
  padding: 6px 8px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius);
}

.edit-action:hover,
.edit-action.focused {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.edit-action[data-edit-action="yellow"] {
  gap: 0;
}

.edit-key-separator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
}

.edit-action[data-edit-action="yellow"] .key-back {
  margin-right: 8px;
}

.edit-key {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.edit-key.key-red { background: var(--remote-key-red); }
.edit-key.key-green { background: var(--remote-key-green); }
.edit-key.key-yellow { background: var(--remote-key-yellow); }
.edit-key.key-blue { background: var(--remote-key-blue); }

.edit-key.key-ok,
.edit-key.key-back {
  width: auto;
  height: auto;
  padding: 1px 8px;
  font-size: calc(13px * var(--font-scale));
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

.edit-key.key-back {
  display: inline-flex;
  width: 30px;
  height: 22px;
  padding: 1px 4px;
}

.edit-key.key-back svg {
  width: 100%;
  height: 100%;
  transform: translateY(-2px);
}

.group-picker {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 20;
  width: 520px;
  max-height: 70%;
  overflow-y: auto;
  padding: 20px;
  transform: translate(-50%, -50%);
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.5);
}

.group-picker-title {
  margin-bottom: 12px;
  font-size: calc(22px * var(--font-scale));
  font-weight: 600;
  color: var(--text-primary);
}

.group-picker-option {
  padding: 12px 16px;
  font-size: calc(20px * var(--font-scale));
  color: var(--text-primary);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.epg-mapping-picker {
  top: 40px;
  width: 780px;
  max-width: 80vw;
  max-height: 78%;
  padding: 28px;
  overflow: hidden;
  transform: translateX(-50%);
}

.epg-mapping-picker.keyboard-visible .epg-mapping-list {
  max-height: 24vh;
}

.epg-mapping-heading {
  margin-bottom: 20px;
}

.epg-mapping-heading .group-picker-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: calc(28px * var(--font-scale));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epg-mapping-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 58px;
  box-sizing: border-box;
  margin-bottom: 18px;
  padding: 0 18px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: 10px;
  transition: var(--transition);
}

.epg-mapping-search-wrap:focus-within {
  color: var(--accent);
  background: rgba(var(--accent-rgb-legacy), 0.1);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.epg-mapping-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}

.epg-mapping-search-icon svg {
  width: 100%;
  height: 100%;
}

.epg-mapping-search {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: calc(22px * var(--font-scale));
}

.epg-mapping-search::placeholder {
  color: var(--text-muted);
}

.epg-mapping-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 8px;
  border-top: 1px solid var(--border);
  transition: max-height var(--transition);
}

@media (prefers-reduced-motion: reduce) {
  .epg-mapping-list { transition: none; }
}

.epg-mapping-spacer {
  position: relative;
}

.epg-mapping-option {
  position: absolute;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  height: 72px;
  box-sizing: border-box;
}

.epg-mapping-option.active {
  color: var(--accent);
}

.epg-mapping-option.pointer-hovered {
  z-index: 10;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

.epg-mapping-meta,
.epg-mapping-empty {
  color: var(--text-muted);
  font-size: calc(16px * var(--font-scale));
}

.epg-mapping-empty {
  position: absolute;
  top: 78px;
  right: 16px;
  left: 16px;
}

.epg-offset-picker {
  width: 620px;
  max-width: 80vw;
  overflow: hidden;
  text-align: center;
}

.epg-offset-picker .group-picker-title {
  overflow: hidden;
  font-size: calc(26px * var(--font-scale));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epg-offset-current {
  margin: 24px 0;
  color: var(--accent);
  font-size: calc(48px * var(--font-scale));
  font-weight: 700;
}

.channel-epg-offset-controls {
  display: grid;
  grid-template-columns: 54px max-content 54px;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.channel-epg-offset-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--bg-tertiary);
}

.channel-epg-offset-step {
  font-size: calc(20px * var(--font-scale));
  line-height: 1;
}

.channel-epg-offset-source {
  font-weight: 600;
  white-space: nowrap;
}

.epg-offset-hint {
  margin-top: 20px;
  color: var(--text-muted);
  font-size: calc(16px * var(--font-scale));
}

.channel-edit-overlay-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: calc(15px * var(--font-scale));
  font-weight: 600;
}

.epg-mapped-badge,
.epg-offset-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: calc(14px * var(--font-scale));
  font-weight: 700;
  white-space: nowrap;
}

.epg-mapped-badge {
  color: #2ed573;
  border: 1px solid #2ed573;
}

.epg-offset-badge {
  gap: 5px;
  color: #3498db;
  border: 1px solid #3498db;
}

.epg-offset-badge-icon,
.epg-offset-badge-icon svg {
  width: 14px;
  height: 14px;
}

.epg-offset-badge-icon {
  display: inline-flex;
}

.epg-mapped-badge-value,
.epg-offset-badge-value {
  transform: translateY(1px);
}

.edit-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.edit-action-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Live editing's menu (action-menu.ts): one line per action, its colour
   key (a shortcut where the remote has one) at the end. */
.action-menu-option {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.action-menu-option .edit-key {
  flex: 0 0 auto;
  margin-left: 16px;
}

/* Editing: room under the last channel for the bar. */
.channel-view.editing .channel-main {
  padding-bottom: 80px;
}
