:root {
  --bg: #0f1419;
  --panel: #161d24;
  --panel-2: #1d2630;
  --line: #2a3541;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #3aa0ff;
  --star: #f5c542;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.load { display: flex; gap: 8px; flex: 1; min-width: 0; }
.load input { flex: 1; min-width: 0; }
input, select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .file {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; white-space: nowrap;
}
.load button[type="submit"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.file input { display: none; }
button:hover, .file:hover { filter: brightness(1.15); }

.layout { flex: 1; display: grid; grid-template-columns: 340px 1fr; min-height: 0; }
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.filters { display: grid; gap: 8px; padding: 12px; }
.tabs { display: flex; gap: 4px; padding: 0 12px 8px; }
.tab { flex: 1; background: transparent; border-color: transparent; color: var(--muted); }
.tab.active { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.tab span { color: var(--muted); font-size: 12px; }

.channels { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; }
.channel {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.channel:hover, .channel:focus { background: var(--panel-2); outline: none; }
.channel.playing { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.channel img { width: 40px; height: 30px; object-fit: contain; border-radius: 4px; background: #0b0f13; }
.channel img.missing { visibility: hidden; }
.channel strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel small { color: var(--muted); }
.channel div { min-width: 0; }
.star { color: var(--star); }
.hint { color: var(--muted); padding: 12px 16px; margin: 0; }

.stage { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 16px; gap: 12px; }
.player { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; max-height: 72vh; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 15px; pointer-events: none;
}
.now { display: flex; align-items: center; gap: 12px; }
.now img { width: 56px; height: 42px; object-fit: contain; }
.now h1 { font-size: 18px; margin: 0; }
.now p { margin: 2px 0 0; color: var(--muted); }
/* channel number in the list, and the number being typed (zapping) */
.channel .num { min-width: 2.2em; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; font-size: 13px; }
.channel:has(.num) { grid-template-columns: auto 40px 1fr auto; }
.zap { position: absolute; top: 16px; right: 16px; padding: 8px 16px; border-radius: 10px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.channel .progress { display: block; height: 3px; margin-top: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.channel .progress i { display: block; height: 100%; background: var(--accent); }
/* "a new version is ready" (Windows app) */
.update-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 16px; background: #133a5c; color: #fff; font-size: 13px; }
.update-bar button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 5px 12px; }
.now-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.player:fullscreen { max-height: none; border-radius: 0; }

/* MPV control bar (Windows app) */
.mpv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.mpv-bar button { display: grid; place-items: center; width: 36px; height: 32px; padding: 0; }
.mpv-bar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mpv-bar #mpvPause svg path { fill: currentColor; stroke: none; }
.mpv-bar input[type="range"] { width: 120px; padding: 0; accent-color: var(--accent); }
.mpv-bar select { max-width: 180px; padding: 5px 8px; font-size: 13px; }
.mpv-bar-label { margin-left: auto; color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.mpv-bar button.on { color: var(--accent); border-color: var(--accent); }
.mpv-time { display: flex; align-items: center; gap: 6px; flex-basis: 100%; }
.mpv-bar .mpv-time input[type="range"] { flex: 1; width: auto; min-width: 80px; }
.mpv-clock { min-width: 64px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.mpv-bar button.mpv-live { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.mpv-bar button.mpv-live.at-live { color: #fff; background: #b82828; border-color: #b82828; }
/* full screen with MPV: the video fills the window above the bar */
/* full screen with MPV: the video fills the screen; the controls float over it
   in their own window (public/controls.html), so the page's bar steps aside */
body.mpv-full .player { position: fixed; inset: 0; max-height: none; aspect-ratio: auto; border-radius: 0; z-index: 50; }
body.mpv-full .mpv-bar { display: none; }
body.mpv-full.cursor-idle, body.mpv-full.cursor-idle * { cursor: none !important; }
.fav[aria-pressed="true"] { color: var(--star); border-color: var(--star); }
.saved summary { cursor: pointer; color: var(--muted); }
.saved ul { list-style: none; padding: 8px 0 0; margin: 0; display: grid; gap: 6px; }
.saved li { display: flex; gap: 6px; }
.saved li button:first-child { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.saved .remove { color: var(--muted); }

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; }
  /* the address gets its own row; the three buttons share the next one */
  .load { flex-basis: 100%; flex-wrap: wrap; }
  .load input { flex-basis: 100%; }
  .load button, .load .file { flex: 1; text-align: center; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .stage { order: -1; overflow: visible; }
  .sidebar { border-right: 0; border-top: 1px solid var(--line); }
  /* while something plays, the video stays on top as the list scrolls under it */
  body.playing .stage { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-bottom: 8px; box-shadow: 0 6px 12px rgba(0, 0, 0, .35); }
  body.playing .saved { display: none; }
  .now h1 { font-size: 16px; }
  .now-actions { flex-wrap: wrap; justify-content: flex-end; }
}
/* touch screens: no keyboard hints, bigger rows to tap */
@media (pointer: coarse) {
  .keys-hint { display: none; }
  .channel { padding: 10px 8px; }
}

/* TV ("10-foot") layout: big screens without a mouse, or ?tv in the address.
   Everything works with the arrows and OK (Enter) of a remote. */
body.tv { font-size: 18px; }
body.tv .layout { grid-template-columns: 460px 1fr; }
body.tv .channel { grid-template-columns: auto 64px 1fr auto; padding: 12px; gap: 14px; }
body.tv .channel img { width: 64px; height: 48px; }
body.tv .channel strong { font-size: 20px; }
body.tv .now h1 { font-size: 26px; }
body.tv .epg { font-size: 17px; }
body.tv .keys-hint { display: none; }
.channel:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
body.tv .channel:focus { outline: 4px solid var(--accent); outline-offset: -4px; background: var(--panel-2); transform: scale(1.02); }

/* Xtream account, kind selector, EPG, login dialog */
.account { font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.account.warn { color: #ffb4a8; border-color: #7a3a32; }
#kindRow select { width: 100%; }
.channel.back { display: block; color: var(--accent); font-weight: 600; }
.epg { margin-top: 6px; display: grid; gap: 2px; font-size: 13px; }
.epg b { color: var(--accent); font-weight: 600; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.xtream { display: grid; gap: 12px; padding: 20px; }
.xtream h2 { margin: 0; font-size: 18px; }
.xtream label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.xtream label input { color: var(--text); }
.xtream .hint { padding: 0; font-size: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.actions .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---- TV guide grid (public/guide.js) ---------------------------------------
   Channels down the side (sticky), time across (sticky ruler), a red line at
   "now". Programmes: on now = tinted with a progress bar, ended = faded,
   picked = outlined, with a reminder = a bell. */
:root { --live: #ff5a5f; --g-ch: 216px; --g-row: 60px; }
dialog.guide {
  width: min(1480px, calc(100vw - 32px)); height: calc(100vh - 32px); max-width: none; max-height: none;
  display: none; flex-direction: column; overflow: hidden; background: var(--bg);
}
dialog.guide[open] { display: flex; }
.g-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.g-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; margin-right: auto; }
.g-title h2 { margin: 0; font-size: 18px; }
.g-day { color: var(--text); font-weight: 600; }
.g-count { color: var(--muted); font-size: 13px; }
.g-nav { display: flex; }
.g-nav button { border-radius: 0; margin-left: -1px; }
.g-nav button:first-child { border-radius: 8px 0 0 8px; }
.g-nav button:last-child { border-radius: 0 8px 8px 0; }
.g-close { width: 36px; padding: 8px 0; color: var(--muted); }
.g-empty-state { margin: auto; max-width: 420px; padding: 24px; text-align: center; color: var(--muted); }

.g-scroll { flex: 1; min-height: 0; overflow: auto; position: relative; overscroll-behavior: contain; scrollbar-color: var(--line) transparent; }
.g-times { position: sticky; top: 0; z-index: 4; display: flex; height: 34px; background: var(--panel); border-bottom: 1px solid var(--line); width: max-content; min-width: 100%; }
.g-corner { position: sticky; left: 0; z-index: 1; flex: none; width: var(--g-ch); background: var(--panel); border-right: 1px solid var(--line); }
.g-marks { position: relative; flex: none; }
.g-mark { position: absolute; top: 0; bottom: 0; padding: 8px 0 0 8px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-mark.day { color: var(--text); font-weight: 600; border-left-color: var(--muted); }
.g-body { position: relative; width: max-content; min-width: 100%; }
.g-row { display: flex; height: var(--g-row); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.g-ch {
  position: sticky; left: 0; z-index: 2; flex: none; width: var(--g-ch);
  display: flex; align-items: center; gap: 10px; padding: 0 12px; text-align: left;
  background: var(--panel); border: 0; border-right: 1px solid var(--line); border-radius: 0;
}
.g-ch:hover { filter: none; background: var(--panel-2); }
.g-ch.playing { box-shadow: inset 3px 0 0 var(--accent); }
.g-ch.playing .g-name { color: var(--accent); }
.g-num { min-width: 2em; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.g-ch img { flex: none; width: 40px; height: 30px; object-fit: contain; border-radius: 4px; background: #0b0f13; }
.g-ch img.missing { visibility: hidden; }
.g-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.g-track { position: relative; flex: none; }
.g-cell {
  position: absolute; top: 4px; bottom: 4px; display: flex; flex-direction: column; justify-content: center; gap: 1px;
  min-width: 0; padding: 0; overflow: clip; text-align: left;
  background: var(--panel-2); border: 1px solid transparent; border-radius: 6px;
}
.g-cell:hover { filter: none; background: color-mix(in srgb, var(--panel-2) 80%, var(--text)); }
.g-in { position: sticky; left: var(--g-ch); display: block; width: fit-content; max-width: 100%; padding: 0 10px; }
.g-cell strong, .g-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-cell strong { font-weight: 600; font-size: 13px; }
.g-cell small { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.g-cell.is-past { opacity: .5; }
.g-cell.is-now { background: color-mix(in srgb, var(--accent) 20%, var(--panel-2)); }
.g-cell.is-now::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--done, 0%); background: var(--accent); }
.g-cell.reminded strong::before { content: "🔔 "; font-size: 11px; }
.g-cell.selected, .g-cell:focus-visible, .g-ch:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.g-cell.selected { border-color: var(--accent); }
.g-empty, .g-loading { position: sticky; left: var(--g-ch); top: 0; height: calc(100% - 8px); margin-top: 4px; display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-size: 12px; }
.g-empty { width: 900px; max-width: calc(100vw - var(--g-ch) - 64px); border: 1px dashed var(--line); border-radius: 6px; }
.g-loading { width: 60%; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel) 50%, var(--panel-2) 100%) 0 0 / 200% 100%; animation: g-shimmer 1.4s linear infinite; }
@keyframes g-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .g-loading { animation: none; } }
.g-now { position: absolute; top: 0; bottom: 0; z-index: 1; width: 2px; margin-left: -1px; background: var(--live); pointer-events: none; }
.g-now::before { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--live); }
.g-more { position: sticky; left: 0; width: min(100%, 100vw - 32px); padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }

.g-detail {
  display: flex; align-items: flex-start; gap: 16px; min-height: 108px; padding: 14px 16px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.g-hint { margin: auto 0; color: var(--muted); }
.g-text { flex: 1; min-width: 0; }
.g-text h3 { margin: 0 0 4px; font-size: 17px; }
.g-meta { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.g-badge { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--text); }
.g-badge.is-now { background: var(--live); color: #fff; }
.g-desc { margin: 8px 0 0; max-width: 80ch; color: var(--text); opacity: .85; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.g-left { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.g-actions { display: flex; flex-direction: column; gap: 8px; flex: none; }
.g-actions .primary, .reminder .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.g-actions .on { color: var(--star); border-color: var(--star); }

/* reminders: 5 minutes before a programme picked in the guide */
.reminders { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; width: min(320px, calc(100vw - 32px)); }
.reminder {
  padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--star);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: reminder-in .2s ease-out;
}
.reminder p { margin: 0; color: var(--muted); font-size: 12px; }
.reminder .reminder-when { color: var(--star); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.reminder strong { display: block; margin: 2px 0; font-size: 15px; }
.reminder-actions { display: flex; gap: 8px; margin-top: 10px; }
.reminder-actions button { flex: 1; }
@keyframes reminder-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 800px) {
  :root { --g-ch: 132px; --g-row: 56px; }
  dialog.guide { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .g-head { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .g-title { flex: 1; }
  .g-nav { order: 3; width: 100%; }
  .g-nav button { flex: 1; }
  .g-count, #guideSource { display: none; }
  .g-ch { gap: 6px; padding: 0 8px; }
  .g-num { display: none; }
  .g-name { font-size: 12px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .g-ch img { width: 32px; height: 24px; }
  .g-detail { flex-direction: column; gap: 10px; min-height: 0; }
  .g-actions { flex-direction: row; width: 100%; }
  .g-actions button { flex: 1; }
}
body.tv { --g-ch: 280px; --g-row: 76px; }
body.tv .g-cell strong { font-size: 17px; }
body.tv .g-cell small { font-size: 14px; }
body.tv .g-name { font-size: 18px; }
body.tv .g-ch img { width: 56px; height: 42px; }
body.tv .g-cell:focus { outline: 4px solid var(--accent); outline-offset: -4px; }
/* Favorites: drag to reorder */
.channel[draggable="true"] { cursor: grab; }
.channel.dragging { opacity: .45; outline: 1px dashed var(--accent); }


/* export / import, and the yes/no dialog */
.backup { display: flex; gap: 8px; margin-top: 10px; }
.backup button, .backup .file { font-size: 13px; padding: 6px 10px; }
.confirm-text { margin: 0; line-height: 1.5; }

/* ---- Movie / series info page (public/info.js) ------------------------------ */
dialog.info { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; position: relative; background: var(--bg); }
.info-backdrop { position: absolute; inset: 0 0 auto; height: 260px; background: center / cover no-repeat; opacity: .35; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent); }
.info-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; padding: 6px 0; background: rgba(0, 0, 0, .45); border-color: transparent; }
.info-body { position: relative; display: flex; gap: 24px; padding: 28px; }
.info-cover { flex: none; width: 200px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--panel-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.info-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.info-text h2 { margin: 0; font-size: 26px; line-height: 1.2; }
.info-group { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.info-meta { margin: 0; color: var(--text); opacity: .85; font-variant-numeric: tabular-nums; }
.info-loading { margin: 0; color: var(--muted); font-size: 13px; }
.info-plot { margin: 4px 0 0; line-height: 1.55; max-width: 68ch; }
.info-people { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.info-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; }
.info-actions .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-width: 140px; }
@media (max-width: 640px) {
  .info-body { flex-direction: column; align-items: center; padding: 20px; }
  .info-cover { width: 150px; }
  .info-actions button { flex: 1; }
}
body.tv .info-text h2 { font-size: 32px; }
body.tv .info-plot { font-size: 18px; }

/* ---- Adjust panel (public/adjust.js) ---------------------------------------- */
.adjust { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.adj-grid { display: grid; gap: 8px; align-content: start; }
.adj-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.adj-row > span:first-child { width: 112px; flex: none; color: var(--muted); font-size: 13px; }
.adj-row button { padding: 4px 10px; }
.adj-row output { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.adj-row select { padding: 5px 8px; }
.adj-reset { color: var(--muted); font-size: 12px; }
.adj-folder { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; direction: rtl; text-align: left; }
.adj-picture h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.adj-picture h3 small { font-weight: 400; }
.adj-sliders { display: grid; gap: 6px; margin-bottom: 10px; }
.adj-slider { display: grid; grid-template-columns: 90px 1fr 60px; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.adj-slider input { padding: 0; accent-color: var(--accent); }
.adj-slider output { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
#adjPictureReset { font-size: 12px; padding: 5px 10px; }
#adjustButton.on, #pipButton.on { color: var(--accent); border-color: var(--accent); }
@media (max-width: 900px) { .adjust { grid-template-columns: 1fr; } }

/* recording (MPV bar) */
.mpv-bar button.rec { width: auto; min-width: 36px; gap: 6px; padding: 0 8px; grid-auto-flow: column; }
.mpv-bar button.rec svg circle { fill: currentColor; stroke: none; }
.mpv-bar button.rec.on { color: #fff; background: #c62828; border-color: #c62828; }
.mpv-bar button.rec span { font-size: 12px; font-variant-numeric: tabular-nums; }

/* mini window (picture-in-picture, Windows app): only the video */
body.mini .topbar, body.mini .sidebar, body.mini .categories, body.mini .now, body.mini .mpv-bar,
body.mini .saved, body.mini .adjust, body.mini .update-bar { display: none !important; }
body.mini .layout { grid-template-columns: 1fr !important; }
body.mini .stage { padding: 0; overflow: hidden; }
body.mini .player { position: fixed; inset: 0; max-height: none; aspect-ratio: auto; border-radius: 0; }
/* catch-up (Xtream): programmes that can be watched again, and channels that keep them */
.g-cell.catchup.is-past { opacity: .8; }
.g-cell.catchup small::before { content: "⏪ "; }
.g-arch { margin-left: auto; flex: none; color: var(--muted); font-size: 12px; }

/* help: features and keys */
.help-button { width: 36px; padding: 8px 0; font-weight: 700; color: var(--muted); }
dialog.help { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.help-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.help-head h2 { margin: 0; font-size: 18px; }
.help-body { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; padding: 18px; }
.help-body h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.help-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; line-height: 1.45; }
.help-keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.help-keys th { text-align: left; padding: 5px 12px 5px 0; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.help-keys td { padding: 5px 0; color: var(--muted); }
.help-keys tr + tr { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.help-keys .help-sub th { padding-top: 14px; color: var(--accent); font-weight: 600; }
@media (max-width: 760px) { .help-body { grid-template-columns: 1fr; } }

/* connection log (web version) */
.log-hint { margin: 0; padding: 12px 18px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.log-text { margin: 12px 18px; padding: 12px; max-height: 50vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.log-actions { padding: 0 18px 16px; }
#trackAudio, #trackSubs { max-width: 200px; }

