:root {
  /* Brand palette: neutral grays, green action, burgundy favourites and danger. */
  --bg: #171c18;
  --panel: #222922;
  --panel-2: #2d352e;
  --line: #414a42;
  --text: #f0f0f0;
  --muted: #b1b5b1;
  --accent: #bee2af;
  --accent-fill: #397f22;
  --accent-soft: rgba(190, 226, 175, .16);
  --star: #e5a9ad;
  --danger: #e5a9ad;
  --danger-fill: #830f15;
  --danger-soft: rgba(131, 15, 21, .2);
  --live-fill: #397f22;
  --live-on-fill: #fff;
  --row-h: 60px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font: inherit; color: inherit; }

.hidden { display: none !important; }

/* ---------- search ---------- */

.search {
  margin: 16px 16px 0;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row { display: flex; gap: 16px; align-items: flex-end; }

.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.field-narrow { flex: 0 0 170px; }
.field-wide { flex: 1; }

.combo, .free { position: relative; }

.combo input, .free input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  outline: none;
}
.free input { padding-right: 10px; }
.combo input:focus, .free input:focus { border-color: var(--accent); }
.combo.has-value input { border-color: var(--accent); background: var(--accent-soft); }

.combo-btn {
  position: absolute; right: 4px; top: 4px;
  width: 28px; height: 28px;
  border: 0; background: none; cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
}
.combo-btn:hover { color: var(--text); background: var(--line); }

.combo-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 20;
  max-height: 320px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.combo-menu li {
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-menu li.active { background: var(--accent-soft); }
.combo-menu li.selected { color: var(--accent); font-weight: 600; }
.combo-menu li.none { color: var(--muted); cursor: default; }

/* ---------- layout ---------- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 16px;
  padding: 16px;
}

.panel {
  min-height: 0;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none; border: 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600; text-align: left;
  cursor: pointer;
}
.section-head.static { cursor: default; }
.count {
  margin-left: auto;
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--panel-2); padding: 1px 8px; border-radius: 99px;
}
.caret {
  width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transition: transform .15s;
}
.section-head[aria-expanded="false"] .caret { transform: rotate(-90deg); }

.favs-body { max-height: 30vh; overflow-y: auto; border-bottom: 1px solid var(--line); }
.favs.collapsed .favs-body { display: none; }

.all { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.vlist { flex: 1; min-height: 0; overflow-y: auto; position: relative; }
.vlist-spacer { width: 1px; }
.vlist-items { position: absolute; top: 0; left: 0; right: 0; }

.empty { margin: 0; padding: 14px; color: var(--muted); font-size: 13px; }

/* ---------- list element ---------- */

.list { margin: 0; padding: 0; list-style: none; }

.item {
  height: var(--row-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 6px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.item:hover { background: var(--panel-2); }
.item.playing { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

.star {
  flex: 0 0 28px; height: 28px;
  border: 0; background: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--muted);
  border-radius: 6px;
}
.star:hover { color: var(--star); background: var(--line); }
.star.on { color: var(--star); }

.num {
  flex: 0 0 44px;
  font-variant-numeric: tabular-nums;
  font-size: 18px; font-weight: 700; text-align: right;
}

.meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meta .name, .meta .place { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .name { font-weight: 600; }
.meta .place { font-size: 12px; color: var(--muted); }


/* ---------- stage ---------- */

.stage {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.stage-head { display: flex; align-items: center; gap: 16px; }
.now { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.now-num { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.now-num:empty { display: none; }
.now-text { min-width: 0; display: flex; flex-direction: column; }
.now-text strong, .now-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-text span { color: var(--muted); font-size: 13px; }
.now-cams { display: flex; gap: 6px; }

.video {
  flex: 1; min-height: 0;
  position: relative;
  container: video / inline-size;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); text-align: center; padding: 16px;
}

/* ---------- overlays ---------- */

.ctx {
  position: fixed; z-index: 50;
  margin: 0; padding: 4px; list-style: none; min-width: 190px;
  background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.ctx li { padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.ctx li:hover { background: var(--accent-soft); }

.tip {
  position: fixed; z-index: 40; pointer-events: none;
  max-width: 360px;
  padding: 8px 10px;
  background: var(--tip-bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.tip small { display: block; color: var(--muted); margin-top: 2px; }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 8px 14px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
}

.ctx-title {
  padding: 8px 12px 6px !important;
  max-width: 300px;
  color: var(--muted); font-size: 12px;
  cursor: default !important; background: none !important;
  border-bottom: 1px solid var(--line); margin-bottom: 4px; border-radius: 0 !important;
}
.ctx-title:empty { display: none; }

.sheet-head, .filters-btn, .backdrop { display: none; }

/* ---------- mobile ---------- */

@media (max-width: 899px) {
  :root { --row-h: 72px; }

  body { height: 100dvh; }

  .layout { display: contents; }

  .stage {
    order: 1;
    flex: none;
    margin: 0;
    padding: 10px 12px;
    gap: 8px;
    border-radius: 0;
    border-width: 0 0 1px;
  }
  .stage-head { gap: 10px; }
  .now-num { font-size: 20px; }
  .now-text strong { font-size: 14px; }
  .now-text span { font-size: 12px; }
  .video { flex: none; aspect-ratio: 16 / 9; margin: 0 -12px -10px; border-radius: 0; }
  body:not(.is-playing) .video { display: none; }

  .search {
    order: 2;
    margin: 0;
    padding: 10px 12px;
    border-radius: 0;
    border-width: 0 0 1px;
  }
  .search .field > span { display: none; }
  .search-row { gap: 8px; }
  .free input, .combo input { height: 44px; font-size: 16px; }

  .filters-btn {
    display: inline-flex; align-items: center; gap: 6px;
    flex: none; height: 44px; padding: 0 14px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
    font-weight: 600; cursor: pointer;
  }
  .badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
    background: var(--accent-fill); color: #fff; font-size: 12px; line-height: 20px; text-align: center;
  }

  /* filters as bottom sheet */
  .filters {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 12px;
    max-height: 85dvh; overflow-y: auto;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    background: var(--panel);
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0,0,0,.5);
    transform: translateY(105%);
    transition: transform .2s ease;
  }
  body.filters-open .filters { transform: none; }
  .filters .field { flex: none; }
  .filters .field > span { display: block; font-size: 13px; }
  .field-narrow { flex: none; }
  .filters .combo-menu { position: static; margin-top: 4px; max-height: 40dvh; box-shadow: none; }

  .sheet-head { display: flex; align-items: center; gap: 8px; }
  .sheet-head strong { flex: 1; font-size: 16px; }
  .sheet-reset, .sheet-done {
    height: 40px; padding: 0 14px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--line); background: var(--panel-2); font-weight: 600;
  }
  .sheet-done { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }

  .backdrop {
    position: fixed; inset: 0; z-index: 25;
    background: rgba(0,0,0,.5);
  }
  body.filters-open .backdrop { display: block; }

  .panel {
    order: 3;
    flex: 1; min-height: 0;
    border-radius: 0; border-width: 0;
  }
  .favs-body { max-height: 25dvh; }

  .item { gap: 8px; padding: 0 12px 0 6px; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
  .item:hover { background: none; }
  .star { flex-basis: 44px; height: 44px; font-size: 22px; }
  .num { flex-basis: 40px; }

  .ctx { min-width: 220px; }
  .ctx li { padding: 12px 14px; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* phone in landscape while playing: video fills the screen */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  body.is-playing .search,
  body.is-playing .panel,
  body.is-playing .stage-head { display: none; }
  body.is-playing .layout { display: block; }
  body.is-playing .stage {
    position: fixed; inset: 0; z-index: 10;
    padding: 0; margin: 0; border: 0; border-radius: 0; background: #000;
  }
  body.is-playing .video { position: absolute; inset: 0; margin: 0; aspect-ratio: auto; border-radius: 0; }
}


/* ---------- multi-select combo ---------- */

.combo {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  min-height: 36px;
  padding: 3px 32px 3px 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: text;
}
.combo:focus-within, .combo.has-value { border-color: var(--accent); }
.combo .chips { display: contents; }
.combo input,
.combo.has-value input {
  flex: 1 0 60px; width: auto; min-width: 60px;
  height: 28px; padding: 0 6px;
  border: 0; background: none;
}
.combo-btn { top: 3px; }

.chip {
  display: inline-flex; align-items: center; gap: 2px;
  max-width: 100%;
  height: 26px; padding: 0 2px 0 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 13px; white-space: nowrap;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip-x {
  width: 20px; height: 20px; flex: none;
  border: 0; background: none; border-radius: 4px;
  color: var(--muted); cursor: pointer; line-height: 1;
}
.chip-x:hover { color: var(--text); background: var(--line); }

.combo-menu li { display: flex; gap: 8px; align-items: center; }
.combo-menu .check { width: 14px; flex: none; color: var(--accent); font-weight: 700; }

@media (max-width: 899px) {
  .combo { min-height: 44px; padding: 4px 40px 4px 4px; }
  .combo input, .combo.has-value input { height: 34px; font-size: 16px; }
  .combo-btn { top: 6px; width: 32px; height: 32px; }
  .chip { height: 32px; font-size: 14px; }
  .chip-x { width: 28px; height: 28px; font-size: 16px; }
}

:root { --num: #bee2af; }
.num, .now-num { color: var(--num); }

/* ---------- themes ---------- */

:root { --tip-bg: #171c18; --shadow: rgba(0,0,0,.45); color-scheme: dark; }

:root[data-theme="light"] {
  --bg: #f0f0f0;
  --panel: #ffffff;
  --panel-2: #f0f0f0;
  --line: #cfd1d0;
  --text: #252b26;
  --muted: #666c72;
  --accent: #326f1d;
  --accent-fill: #397f22;
  --accent-soft: rgba(57, 127, 34, .12);
  --star: #830f15;
  --danger: #830f15;
  --danger-fill: #830f15;
  --danger-soft: rgba(131, 15, 21, .1);
  --num: #326f1d;
  --tip-bg: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f0f0f0;
    --panel: #ffffff;
    --panel-2: #f0f0f0;
    --line: #cfd1d0;
    --text: #252b26;
    --muted: #666c72;
    --accent: #326f1d;
    --accent-fill: #397f22;
    --accent-soft: rgba(57, 127, 34, .12);
    --star: #830f15;
    --danger: #830f15;
    --danger-fill: #830f15;
    --danger-soft: rgba(131, 15, 21, .1);
    --num: #326f1d;
    --tip-bg: #ffffff;
    color-scheme: light;
  }
}

.theme-btn {
  flex: none; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); cursor: pointer; font-size: 17px; line-height: 1;
}
.theme-btn:hover { border-color: var(--accent); }
@media (max-width: 899px) { .theme-btn { width: 44px; height: 44px; } }

/* ---------- actions under the video ---------- */

.stage-actions { display: flex; gap: 8px; }
.stage-action {
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); cursor: pointer; font-weight: 600;
}
.stage-action:hover { border-color: var(--accent); }
.tip { overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .video { margin-bottom: 0; }
  .stage-action { height: 40px; flex: 1; }
}

/* ---------- camera buttons ---------- */

:root { --live: #bee2af; --live-soft: rgba(190, 226, 175, .16); }
:root[data-theme="light"] { --live: #326f1d; --live-soft: rgba(57, 127, 34, .12); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --live: #326f1d; --live-soft: rgba(57, 127, 34, .12); }
}

.item { cursor: pointer; }

.cam-group {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  flex: none;
  padding: 2px 3px 3px;
  border-radius: 8px;
  background: var(--bg);
  cursor: default;
}
.cam-btns { display: flex; gap: 3px; }
.cam-group.live
.cam-group .cam {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-width: 36px; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700; font-size: 13px;
  box-shadow: 0 1px 0 var(--line);
  cursor: pointer;
}
.cam-group .cam svg { width: 11px; height: 11px; color: var(--muted); }
.cam-group .cam:hover { border-color: var(--live); }
.cam-group .cam:hover svg { color: var(--live); }
.cam-group .cam.on,
.cam-group .cam.on:hover { background: var(--live-fill); border-color: var(--live-fill); color: var(--live-on-fill); box-shadow: none; }
.cam-group .cam.on svg { color: #fff; }

@media (max-width: 899px) {
  .cam-group { padding: 4px; }
    .cam-group .cam { min-width: 46px; height: 40px; font-size: 15px; }
  .cam-group .cam svg { width: 13px; height: 13px; }
}

.item.playing { background: var(--live-soft); box-shadow: inset 3px 0 0 var(--live); }


/* ---------- icons on copy actions ---------- */

.stage-action, .ctx li[data-action] { display: inline-flex; align-items: center; gap: 7px; }
.ctx li[data-action] { display: flex; }
.ico { width: 15px; height: 15px; flex: none; color: var(--muted); }
.ico-twitch { color: var(--accent); }
.stage-action:hover .ico:not(.ico-twitch) { color: var(--text); }
.stage-actions { flex-wrap: wrap; }
@media (max-width: 899px) {
  .stage-action { flex: 1 1 30%; padding: 0 8px; font-size: 13px; }
}

/* ---------- video iframe + fullscreen ---------- */

.tile-host, .tile-host iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video:fullscreen { border-radius: 0; }
.video:-webkit-full-screen { border-radius: 0; width: 100%; height: 100%; }

@media (max-width: 899px) {
  .stage-actions { align-items: center; }
  .stage-action { flex: 1 1 40%; }
}

/* ---------- tighter row start ---------- */

.item { gap: 6px; padding-left: 2px; }
.star { flex: 0 0 24px; width: 24px; height: 28px; font-size: 17px; padding: 0; }
.num { flex: 0 0 auto; min-width: 28px; }
@media (max-width: 899px) {
  .item { gap: 6px; padding-left: 2px; }
  .star { flex-basis: 34px; width: 34px; height: 44px; font-size: 21px; }
  .num { min-width: 30px; }
}

/* ---------- fallback full screen (fills the window) ---------- */

body.pseudo-fs .video {
  position: fixed; inset: 0; z-index: 100;
  margin: 0; border-radius: 0; aspect-ratio: auto;
  display: block !important;
}
.fs-exit {
  position: absolute; top: 44px; right: 12px; z-index: 101;
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.fs-exit:hover { background: rgba(0,0,0,.85); }

/* ---------- row: number top-left, small star top-right ---------- */

.item { position: relative; gap: 8px; padding: 0 22px 0 10px; }
.num {
  align-self: flex-start;
  margin-top: 7px;
  min-width: 0; flex: none;
  text-align: left;
  line-height: 1;
}
.star {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; flex: none;
  padding: 0; border-radius: 4px;
  font-size: 12px; line-height: 18px;
}
@media (max-width: 899px) {
  .item { gap: 8px; padding: 0 26px 0 12px; }
  .num { margin-top: 10px; }
  .star { top: 0; right: 0; width: 26px; height: 26px; font-size: 14px; line-height: 26px; flex-basis: auto; }
}

/* ---------- favourite star in the video pane ---------- */

.now-star {
  flex: none;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 6px; background: none;
  color: var(--muted); font-size: 20px; line-height: 30px;
  cursor: pointer;
}
.now-star:hover { color: var(--star); background: var(--panel-2); }
.now-star.on { color: var(--star); }
@media (max-width: 899px) { .now-star { width: 40px; height: 40px; line-height: 40px; font-size: 22px; } }

/* ---------- more than 3 cameras: scroll the buttons ---------- */

.cam-group .cam { flex: none; width: 40px; min-width: 0; padding: 0; }
.cam-group.scrolls .cam-btns {
  max-width: calc(3 * 40px + 2 * 3px);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.cam-group.scrolls .cam { scroll-snap-align: start; }
@media (max-width: 899px) {
  .cam-group .cam { width: 48px; }
  .cam-group.scrolls .cam-btns { max-width: calc(3 * 48px + 2 * 3px); }
}

/* ---------- video pane: show as many camera buttons as fit ---------- */

.stage-head { min-width: 0; }
.now { min-width: 180px; }
#now-cams { flex: 0 1 auto; min-width: 0; }
#now-cams .cam-group { max-width: 100%; min-width: 0; }
#now-cams .cam-btns { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
#now-cams .cam-group.scrolls .cam-btns { max-width: 100%; }
@media (max-width: 899px) { .now { min-width: 120px; } }

:root[data-theme="light"] .tip { box-shadow: 0 6px 20px rgba(20, 24, 33, .14); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .tip { box-shadow: 0 6px 20px rgba(20, 24, 33, .14); }
}

/* ---------- row hierarchy: БМ number > municipality/place > location name ---------- */

.num { font-size: 19px; font-weight: 800; white-space: nowrap; }
.num .bm, .now-num .bm {
  font-size: .6em; font-weight: 700; letter-spacing: .04em;
  margin-right: 3px; vertical-align: .12em; opacity: .8;
}
.meta { gap: 1px; }
.meta .place { font-size: 14px; font-weight: 600; color: var(--text); }
.meta .name { font-size: 11.5px; font-weight: 400; color: var(--muted); }
@media (max-width: 899px) {
  .num { font-size: 20px; }
  .meta .place { font-size: 15px; }
  .meta .name { font-size: 12.5px; }
}

/* ---------- camera buttons: modern, soft ---------- */

:root { --cam-bg: rgba(190, 226, 175, .07); --cam-bg-hover: rgba(190, 226, 175, .14); }
:root[data-theme="light"] { --cam-bg: rgba(102, 108, 114, .08); --cam-bg-hover: rgba(57, 127, 34, .13); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --cam-bg: rgba(102, 108, 114, .08); --cam-bg-hover: rgba(57, 127, 34, .13); }
}

.cam-group,
.cam-group.live { padding: 0; gap: 0; background: none; border: 0; border-radius: 0; }
.cam-btns { gap: 6px; padding: 4px 2px; }

.cam-group .cam {
  width: 56px; height: 40px;
  gap: 6px; padding: 0;
  border: 0; border-radius: 12px;
  background: var(--cam-bg);
  box-shadow: none;
  color: var(--text);
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: background-color .15s, transform .12s, box-shadow .15s;
}
.cam-group .cam .cam-btn-ico { width: 18px; height: 18px; color: var(--muted); transition: color .15s; }
.cam-group .cam:hover { background: var(--cam-bg-hover); transform: translateY(-1px); }
.cam-group .cam:hover .cam-btn-ico { color: var(--live); }
.cam-group .cam:active { transform: translateY(0) scale(.97); }
.cam-group .cam:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }
.cam-group .cam.on,
.cam-group .cam.on:hover {
  background: var(--live-fill);
  color: var(--live-on-fill);
  box-shadow: 0 4px 14px -4px var(--live-fill);
}
.cam-group .cam.on .cam-btn-ico { color: var(--live-on-fill); }

.cam-group.scrolls .cam-btns { max-width: calc(3 * 56px + 2 * 6px + 4px); scrollbar-width: thin; }
#now-cams .cam-group.scrolls .cam-btns { max-width: 100%; }

@media (max-width: 899px) {
  .cam-group .cam { width: 64px; height: 48px; font-size: 17px; border-radius: 14px; }
  .cam-group .cam .cam-btn-ico { width: 20px; height: 20px; }
  .cam-group.scrolls .cam-btns { max-width: calc(3 * 64px + 2 * 6px + 4px); }
}

/* ---------- resizable list ---------- */

.layout {
  grid-template-columns: var(--list-w, 400px) 16px minmax(0, 1fr);
  column-gap: 0;
}
.resizer {
  position: relative;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.resizer::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 3px; margin-left: -1.5px; border-radius: 3px;
  background: transparent;
  transition: background-color .15s;
}
.resizer:hover::after, .resizer:focus-visible::after, body.resizing .resizer::after { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
body.resizing iframe { pointer-events: none; }
@media (max-width: 899px) { .resizer { display: none; } }

/* ---------- shared description: БМ > place > full name ---------- */

.tip .d-bm, .ctx-title .d-bm { display: block; font-size: 14px; font-weight: 800; color: var(--num); }
.d-cam { font-weight: 500; color: var(--muted); font-size: 12px; }
.tip .d-place, .ctx-title .d-place { display: block; font-weight: 600; color: var(--text); margin-top: 1px; }
.tip .d-full, .ctx-title .d-full { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.ctx-title { font-size: 13px; }
.now-text strong { font-size: 15px; }

.actions-spacer { flex: 1 1 auto; min-width: 0; }

/* ---------- rounded list cards + clearer favourites / all split ---------- */

:root {
  --card: #2b332c; --card-hover: #354036; --card-line: transparent;
  --fav-bg: rgba(131, 15, 21, .08); --split: var(--bg);
}
:root[data-theme="light"] {
  --card: #f0f0f0; --card-hover: #e6ece3; --card-line: #d7dad6;
  --fav-bg: rgba(131, 15, 21, .05);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --card: #f0f0f0; --card-hover: #e6ece3; --card-line: #d7dad6;
    --fav-bg: rgba(131, 15, 21, .05);
  }
}

.list { display: flex; flex-direction: column; padding: 3px 0; }
.list .item {
  height: calc(var(--row-h) - 6px);
  margin: 3px 8px;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: none;
  transition: background-color .12s, border-color .12s;
}
.list .item:hover { background: var(--card-hover); }
.list .item.playing {
  background: var(--live-soft);
  border-color: var(--live);
  box-shadow: none;
}
.vlist-items { padding: 0; }

.favs { background: var(--fav-bg); }
.favs-body { border-bottom: 0; }
.favs .section-head { border-bottom: 0; }
.favs .section-head > span:nth-child(2)::before {
  content: '';
  display: inline-block;
  width: 18px; height: 18px; margin-right: 5px;
  vertical-align: -2px;
  background-color: var(--star);
  -webkit-mask: url('../assets/ikonice/dugmici-19.svg') center / 220% no-repeat;
  mask: url('../assets/ikonice/dugmici-19.svg') center / 220% no-repeat;
}
.all { border-top: 8px solid var(--split); }
.all .section-head { border-bottom: 1px solid var(--line); }
.section-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.now { gap: 10px; }
.now-text { flex: 0 1 auto; }
.now-star { margin-left: 2px; }

@media (max-width: 899px) {
  .list .item { margin: 3px 10px; }
}

/* ---------- narrow list: smaller camera buttons, max 2 visible ---------- */

.panel { container-type: inline-size; container-name: list; }
@container list (max-width: 360px) {
  .list .cam-group .cam { width: 42px; height: 34px; font-size: 13px; border-radius: 10px; gap: 3px; }
  .list .cam-group .cam .cam-btn-ico { width: 14px; height: 14px; }
  .list .cam-group .cam-btns { max-width: calc(2 * 42px + 6px + 4px); overflow-x: auto; scrollbar-width: thin; }
}

/* ---------- stacked layout (phones, tablets in portrait) ---------- */

@media (max-width: 899px) {
  .stage-head { flex-wrap: wrap; row-gap: 6px; }
  .now { flex: 1 1 auto; min-width: 40%; }
  #now-cams { flex: 1 1 auto; max-width: 100%; display: flex; justify-content: flex-end; }
  .video { max-height: 38dvh; }
  .stage-action { flex: 1 1 auto; }
  .favs-body { max-height: 20dvh; }
  .all { min-height: 160px; }
}
body.pseudo-fs .video { max-height: none; }
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  body.is-playing .video { max-height: none; }
}


/* ---------- favourites: burgundy section ---------- */

:root {
  --fav-bg: rgba(131, 15, 21, .15);
  --fav-card: rgba(131, 15, 21, .16);
  --fav-card-hover: rgba(131, 15, 21, .24);
  --fav-line: rgba(229, 169, 173, .38);
  --fav-head: #e5a9ad;
}
:root[data-theme="light"] {
  --fav-bg: #f8eeee;
  --fav-card: #f4e5e6;
  --fav-card-hover: #edd7d9;
  --fav-line: #d9aeb1;
  --fav-head: #830f15;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --fav-bg: #f8eeee;
    --fav-card: #f4e5e6;
    --fav-card-hover: #edd7d9;
    --fav-line: #d9aeb1;
    --fav-head: #830f15;
  }
}

.favs { background: var(--fav-bg); }
.favs .section-head { color: var(--fav-head); }
.favs .section-head .count { background: var(--fav-line); color: var(--text); }
.favs .caret { border-top-color: var(--fav-head); }
#favs-list .item { background: var(--fav-card); border-color: var(--fav-line); }
#favs-list .item:hover { background: var(--fav-card-hover); }
#favs-list .item.playing { background: var(--live-soft); border-color: var(--live); }
.favs .empty { color: var(--fav-head); opacity: .85; }

.stage-action.icon-only { width: 34px; padding: 0; justify-content: center; flex: none; }
.stage-action.icon-only .ico { width: 17px; height: 17px; }
@media (max-width: 899px) { .stage-action.icon-only { width: 44px; height: 40px; flex: none; } }

/* ---------- favourites: burgundy frame only ---------- */

.favs { background: none; }
#favs-list .item { background: var(--card); border: 1.5px solid var(--star); }
#favs-list .item:hover { background: var(--card-hover); }
#favs-list .item.playing { background: var(--live-soft); border-color: var(--live); }
.favs .section-head .count { background: var(--panel-2); color: var(--fav-head); }

/* ---------- same-location groups ---------- */

:root { --agg: #8e8f92; --agg-soft: rgba(142, 143, 146, .19); }
:root[data-theme="light"] { --agg: #666c72; --agg-soft: rgba(102, 108, 114, .13); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --agg: #666c72; --agg-soft: rgba(102, 108, 114, .13); }
}

/* merged row: neutral range number, click to split */
.num.agg-num { color: var(--agg); cursor: pointer; border-radius: 6px; padding: 0 3px; margin-left: -3px; }
.num.agg-num:hover { background: var(--agg-soft); }
.d-bm.agg { color: var(--agg); }

/* expanded group members: indented, joined by one clickable neutral line */
.list .item.g-member { margin-left: 24px; }
#favs-list { position: relative; }
.g-line-btn {
  position: absolute; left: 6px;
  width: 16px; padding: 0;
  border: 0; background: none;
  cursor: pointer;
  z-index: 1;
}
.g-line-btn::before {
  content: '';
  position: absolute; left: 5px; top: 0; bottom: 0;
  width: 6px; border-radius: 3px;
  background: var(--agg);
  transition: width .12s, left .12s;
}
.g-line-btn:hover::before, .g-line-btn:focus-visible::before { left: 4px; width: 8px; }

/* phase 1 of merging: rows fold into the first one (reverse when splitting) */
@keyframes g-fold {
  from { height: calc(var(--row-h) - 6px); margin-top: 3px; margin-bottom: 3px; opacity: 1; }
  to   { height: 0; margin-top: 0; margin-bottom: 0; opacity: 0; border-width: 0; }
}
.list .item.g-out { animation: g-fold .28s ease-in forwards; overflow: visible; }
.list .item.g-in  { animation: g-fold .28s ease-out reverse both; overflow: visible; }
.item.g-out > *, .item.g-in > * { opacity: 0; }

/* phase 2: the line shrinks into the БМ number, which takes the group color */
@keyframes bar-into-num { from { transform: scaleY(1); opacity: 1; } to { transform: scaleY(0); opacity: 0; } }
@keyframes num-brand-agg { from { color: var(--num); } to { color: var(--agg); } }
.item.agg-enter::before, .item.agg-leave::before {
  content: '';
  position: absolute; left: 2px; top: 10px; bottom: 10px;
  width: 6px; border-radius: 3px;
  background: var(--agg);
  transform-origin: 50% 30%;
}
.item.agg-enter::before { animation: bar-into-num .34s ease-in forwards; }
.item.agg-leave::before { animation: bar-into-num .34s ease-out reverse both; }
.item.agg-enter .num.agg-num { animation: num-brand-agg .34s ease-in both; }
.item.agg-leave .num.agg-num { animation: num-brand-agg .34s ease-out reverse both; }

/* video pane number follows the list, same colour change */
.now-num { transition: color .34s ease; }
.now-num.agg { color: var(--agg); }

/* partially favourited merged row */
.star.partial { opacity: .6; }

/* favourites picker for merged rows */
.favpick { min-width: 160px; max-height: 60vh; overflow-y: auto; }
.favpick li { font-variant-numeric: tabular-nums; }
.favpick li.on { color: var(--star); }
.favpick li[data-fav="all"] { font-weight: 700; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; margin-bottom: 3px; }

/* global merge / split button */
.group-btn { display: grid; place-items: center; }
.group-btn svg { width: 18px; height: 18px; }
.group-btn { color: var(--num); }
.group-btn.is-collapsed { color: var(--agg); }

@media (max-width: 899px) {
  .list .item.g-member { margin-left: 28px; }
  .g-line-btn { left: 8px; width: 20px; }
  .g-line-btn::before { left: 7px; }
  .group-btn { width: 44px; height: 44px; }
}
@media (max-width: 899px) { .item.agg-enter::before, .item.agg-leave::before { left: 4px; } }

/* ---------- taller rows so camera buttons have breathing room ---------- */

:root { --row-h: 66px; }
.cam-btns { padding: 2px; }
@media (max-width: 899px) { :root { --row-h: 78px; } }

/* ---------- icon-only actions under the video ---------- */

.stage-actions { flex-wrap: nowrap; align-items: center; }
.stage-action.icon-only { width: 36px; height: 34px; border-radius: 9px; }
.stage-action.icon-only .ico { width: 18px; height: 18px; }
.sharepop { min-width: 210px; }
@media (max-width: 899px) { .stage-action.icon-only { width: 44px; height: 40px; } }
.sharepop li { display: flex; align-items: center; gap: 9px; }
.stage-action.icon-only .ico-twitch { color: var(--accent); }

/* ---------- video header number: all merged numbers, text shrinks first ---------- */

.now-num { flex: none; white-space: nowrap; cursor: default; }
.now-num.agg { font-size: 22px; }
.now-num.agg.short { font-size: 26px; }
.now-text { flex: 0 1 auto; min-width: 0; }

/* global merge/split button in the shared list toolbar */
.panel-tools .group-btn {
  width: 28px; height: 28px; margin: -4px 0 -4px -6px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2);
  cursor: pointer;
}
.panel-tools .group-btn svg { width: 16px; height: 16px; }
.panel-tools .group-btn:hover { border-color: currentColor; }
@media (max-width: 899px) { .panel-tools .group-btn { width: 36px; height: 36px; } }

.tip .d-hint { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); opacity: .8; }

/* ---------- tiles: single view shows the first, split view is a grid of up to 9 ---------- */

.tiles { position: absolute; inset: 0; }
.tiles.single .tile { position: absolute; inset: 0; }
.tiles.single .tile:not(.first) { visibility: hidden; pointer-events: none; }
.tiles.single .tile-head { display: none; }

.tiles.split, .sp-grid { display: grid; gap: 4px; }
.tiles.split[data-n="1"], .sp-grid[data-n="1"] { grid-template: 1fr / 1fr; }
.tiles.split[data-n="2"], .sp-grid[data-n="2"] { grid-template: 1fr / 1fr 1fr; }
@container video (max-width: 540px) {
  .tiles.split[data-n="2"], .sp-grid[data-n="2"] { grid-template: 1fr 1fr / 1fr; }
}
.tiles.split[data-n="3"], .sp-grid[data-n="3"],
.tiles.split[data-n="4"], .sp-grid[data-n="4"] { grid-template: 1fr 1fr / 1fr 1fr; }
.tiles.split[data-n="5"], .sp-grid[data-n="5"],
.tiles.split[data-n="6"], .sp-grid[data-n="6"] { grid-template: 1fr 1fr / repeat(3, 1fr); }
.tiles.split[data-n="7"], .sp-grid[data-n="7"],
.tiles.split[data-n="8"], .sp-grid[data-n="8"],
.tiles.split[data-n="9"], .sp-grid[data-n="9"] { grid-template: repeat(3, 1fr) / repeat(3, 1fr); }

.tile { position: relative; min-width: 0; min-height: 0; background: #000; border-radius: 6px; overflow: hidden; }
.tiles.single .tile { border-radius: 0; }
.tile.will-replace { outline: 3px solid var(--danger); outline-offset: -3px; }

.stage.split-mode .stage-head { display: none; }

/* per-video header in split view */
.tile-head {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px 14px 8px;
  background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
  color: #fff; font-size: 12px; line-height: 1.2;
  transition: font-size .18s ease, padding .18s ease;
}
.th-num { flex: none; font-weight: 800; color: #bee2af; font-variant-numeric: tabular-nums; }
.th-num .bm { font-size: .7em; margin-right: 2px; opacity: .85; }
.th-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.th-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-text span { font-size: .85em; opacity: .75; }
.th-star, .th-close {
  flex: none; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 5px; background: rgba(255, 255, 255, .08);
  color: #fff; cursor: pointer; font-size: 13px; line-height: 22px;
}
.th-star.on { color: var(--star); }
.th-star:hover, .th-close:hover { background: rgba(255, 255, 255, .22); }

/* names grow while a position is being chosen */
body.selecting .tile-head, body.dragging .tile-head { font-size: 15px; padding: 8px 8px 18px 10px; }

/* name travelling between the header and the first tile */
.name-fly { position: fixed; z-index: 90; margin: 0; pointer-events: none; overflow: hidden; }
.name-fly.tile-head { background: none; }

/* drop catcher over the videos while dragging (iframes swallow drag events) */
.drop-catch { position: absolute; inset: 0; z-index: 5; display: none; }
body.dragging .drop-catch { display: block; }

/* position picker */
.split-pick {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column;
  background: rgba(8, 10, 14, .78);
  backdrop-filter: blur(2px);
}
.split-pick.replace { background: rgba(8, 10, 14, .25); backdrop-filter: none; }
.sp-grid { flex: 1; min-height: 0; }
.sp-cell {
  position: relative; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 8px; border-radius: 6px;
  border: 2px dashed rgba(255, 255, 255, .28);
  color: #fff; text-align: center; cursor: pointer;
  transition: background-color .12s, border-color .12s;
}
.sp-cell:hover { background: rgba(255, 255, 255, .06); }
.sp-num { position: absolute; top: 6px; left: 8px; font-size: 12px; font-weight: 700; opacity: .6; }
.sp-name { font-size: 17px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-hint { font-size: 12px; opacity: .75; }
.sp-cell.is-new { border: 2px solid #bee2af; background: rgba(57, 127, 34, .25); }
.sp-cell.is-new .sp-name { color: #bee2af; }
.split-pick.replace .sp-cell { border-color: transparent; background: none; justify-content: flex-end; padding-bottom: 14px; }
.split-pick.replace .sp-cell .sp-name { opacity: 0; }
.split-pick.replace .sp-cell.is-replace { border: 3px solid #e5a9ad; background: var(--danger-soft); }
.split-pick.replace .sp-cell.is-replace .sp-name { opacity: 1; color: #e5a9ad; }
.sp-bar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 10px; color: #fff; font-size: 12px; background: rgba(0, 0, 0, .55);
}
.sp-cancel { border: 1px solid rgba(255, 255, 255, .3); background: none; color: #fff; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.sp-cancel:hover { background: rgba(255, 255, 255, .12); }

.item[draggable="true"] { cursor: grab; }
body.dragging, body.dragging * { cursor: grabbing; }
.tile-head { background: rgba(10, 12, 16, .88); padding-bottom: 5px; }
body.selecting .tile-head, body.dragging .tile-head { padding-bottom: 8px; }
.sp-grid { position: absolute; inset: 0; }
.sp-bar { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 1; border-radius: 8px; max-width: calc(100% - 16px); }

/* ---------- readable text over video ---------- */

.tile-head { background: rgba(8, 10, 14, .94); padding-bottom: 5px; box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
.sp-name, .sp-hint, .sp-num {
  background: rgba(8, 10, 14, .9);
  padding: 3px 8px; border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.sp-num { padding: 1px 6px; opacity: 1; color: rgba(255, 255, 255, .8); }
.sp-hint { opacity: 1; color: rgba(255, 255, 255, .8); }
.sp-cell.is-new .sp-name { color: #bee2af; }
.split-pick.replace .sp-cell .sp-num { background: rgba(8, 10, 14, .75); }
.split-pick.replace .sp-cell.is-replace .sp-name { color: #e5a9ad; }
.split-pick.replace .sp-cell.is-replace .sp-hint { color: #e5a9ad; }
.sp-bar { background: rgba(8, 10, 14, .92); }

/* ---------- drag ghost: the station number with the cameras it carries ---------- */

.drag-ghost {
  position: fixed; top: -200px; left: -200px; z-index: 100;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  font-size: 13px;
}
.dg-num { font-weight: 800; color: var(--num); font-size: 16px; white-space: nowrap; }
.dg-num .bm { font-size: .65em; margin-right: 2px; }
.dg-place { font-weight: 600; white-space: nowrap; }
.dg-cams { display: flex; gap: 4px; }
.dg-cam {
  display: inline-flex; align-items: center; gap: 3px;
  height: 28px; padding: 0 8px; border-radius: 9px;
  background: var(--live-fill); color: var(--live-on-fill);
  font-weight: 700;
}
.dg-cam svg { width: 14px; height: 14px; }
.dg-more { align-self: center; font-weight: 700; color: var(--muted); }
.sp-num { top: auto; bottom: 6px; left: 8px; }

/* ---------- split-view name label: compact, text only, draggable to 4 corners ---------- */

.tile-head {
  left: auto; right: auto; top: auto; bottom: auto;
  display: inline-flex; width: auto; max-width: calc(100% - 16px);
  padding: 5px 9px; border-radius: 9px;
  background: rgba(8, 10, 14, .9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
}
.tile-head[data-corner="tl"] { top: 8px; left: 8px; }
.tile-head[data-corner="tr"] { top: 8px; right: 8px; }
.tile-head[data-corner="bl"] { bottom: 46px; left: 8px; }
.tile-head[data-corner="br"] { bottom: 46px; right: 8px; }
body.selecting .tile-head, body.dragging .tile-head { padding: 7px 11px; }
.th-fav { flex: none; color: #e5a9ad; font-size: 12px; }
body.label-dragging, body.label-dragging * { cursor: grabbing !important; }
body.label-dragging iframe { pointer-events: none; }
body.label-dragging .tile-head { transition: none; }

/* ---------- 4 corner holders per video: name label and remove button live in them ---------- */

.tile-corner {
  position: absolute; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  max-width: calc(100% - 16px);
  pointer-events: none;
}
.tile-corner > * { pointer-events: auto; }
.c-tl { top: 8px; left: 8px; }
.c-tr { top: 8px; right: 8px; flex-direction: row-reverse; }
.c-bl { bottom: 46px; left: 8px; }
.c-br { bottom: 46px; right: 8px; flex-direction: row-reverse; }
.tile-corner .tile-head { position: relative; top: auto; left: auto; right: auto; bottom: auto; min-width: 0; max-width: 100%; }
.tiles.single .tile-corner { display: none; }

.tile-minus {
  flex: none;
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(8, 10, 14, .9); color: #fff;
  font-size: 20px; font-weight: 700; line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  cursor: pointer; touch-action: none;
}
.tile-minus:hover { background: var(--danger-fill); }
body.selecting .tile-minus, body.dragging .tile-minus { display: none; }
@media (max-width: 899px) { .tile-minus { width: 34px; height: 34px; } }
.tile-minus { user-select: none; -webkit-user-select: none; }
body.label-dragging, body.label-dragging * { cursor: default; }
body.label-dragging .tile-head, body.label-dragging .tile-minus { cursor: grabbing !important; }

/* ---------- drag: transparent catcher, live insert line ---------- */

.split-pick, .split-pick.replace { background: transparent; backdrop-filter: none; }
.insert-line {
  position: absolute; z-index: 7; width: 5px; margin-left: -2.5px;
  border-radius: 3px;
  background: var(--live);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .45), 0 0 16px var(--live);
  pointer-events: none;
  animation: il-pulse 1s ease-in-out infinite alternate;
}
@keyframes il-pulse { from { opacity: .75; } to { opacity: 1; } }
.il-count {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: none; min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 13px; background: var(--live-fill); color: var(--live-on-fill);
  font-weight: 800; font-size: 14px; line-height: 26px; text-align: center;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .5);
}
.insert-line.multi .il-count { display: block; }

/* ---------- position menu (left click in split, or right click → Dodaj u podeljeni prikaz…) ---------- */

.posmenu { min-width: 250px; max-width: 340px; max-height: 70vh; overflow-y: auto; padding: 6px; }
.pm-head { display: flex; flex-direction: column; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pm-head strong { font-size: 13px; }
.pm-head span { font-size: 12px; color: var(--muted); }
.pm-cams { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pm-cam { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pm-cam.on { background: var(--live-fill); border-color: var(--live-fill); color: var(--live-on-fill); }
.pm-list { list-style: none; margin: 0; padding: 0; }
.pm-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pm-opt:hover { background: var(--live-soft); }
.pm-opt.replace:hover { background: var(--danger-soft); }
.pm-pos { width: 18px; text-align: center; font-weight: 800; color: var(--live); }
.pm-opt.replace .pm-pos { color: var(--danger); }
.pm-note { padding: 4px 8px 6px; font-size: 12px; color: var(--muted); }

/* ---------- name label: fully opaque, resizable ---------- */
:root { --label-scale: 1; }
.tile-head { background: #0b0d12; font-size: calc(12px * var(--label-scale)); padding: calc(5px * var(--label-scale)) calc(16px * var(--label-scale)) calc(5px * var(--label-scale)) calc(9px * var(--label-scale)); }
body.selecting .tile-head, body.dragging .tile-head { font-size: calc(15px * var(--label-scale)); }
.th-grip {
  position: absolute; right: 2px; bottom: 2px;
  width: 10px; height: 10px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 45%, rgba(255,255,255,.55) 45%, rgba(255,255,255,.55) 55%, transparent 55%),
    linear-gradient(135deg, transparent 70%, rgba(255,255,255,.55) 70%, rgba(255,255,255,.55) 80%, transparent 80%);
  opacity: .6;
}
.th-grip:hover { opacity: 1; }


/* ---------- active rows: index badge, and pinned when scrolled out of view ---------- */

.vlist-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pin-rows { position: absolute; left: 0; right: 10px; z-index: 4; padding: 0; background: var(--panel); display: none; }
.pin-rows.has-pins { display: flex; }
.pin-top { top: 0; box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .45); border-bottom: 1px solid var(--line); }
.pin-bottom { bottom: 0; box-shadow: 0 -6px 12px -8px rgba(0, 0, 0, .45); border-top: 1px solid var(--line); }
.pin-rows .item { margin-top: 3px; margin-bottom: 3px; }

.slot-idx {
  position: absolute; top: 3px; right: 22px;
  min-width: 18px; height: 16px; padding: 0 4px;
  border: 0; border-radius: 4px;
  background: var(--panel-2); color: var(--muted);
  font-size: 10.5px; font-weight: 700; line-height: 16px; font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.slot-idx:hover { background: var(--danger-fill); color: #fff; }
@media (max-width: 899px) { .slot-idx { right: 28px; top: 4px; height: 20px; line-height: 20px; font-size: 12px; } }
.tile.will-move { outline: 3px solid var(--num); outline-offset: -3px; }
.tile.loading-clear .tile-corner { display: none !important; }
.tile.hl { outline: 3px solid var(--live); outline-offset: -3px; box-shadow: 0 0 0 3px var(--live-soft); z-index: 1; }
.tile.hl .tile-head { font-size: calc(15px * var(--label-scale)); }

/* ---------- split tile = header bar above the video (nothing drawn over the video) ---------- */

.tile { display: flex; flex-direction: column; background: var(--panel-2); border-radius: 8px; container: tile / inline-size; }
.tiles.single .tile { background: #000; }
.tile-video { position: relative; flex: 1; min-height: 0; background: #000; }
.tiles.split .tile-video { border-radius: 0 0 8px 8px; overflow: hidden; }
.tile-video .tile-host, .tile-video .tile-host iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.tile .tile-head,
body.selecting .tile .tile-head, body.dragging .tile .tile-head {
  position: static; inset: auto; max-width: none; width: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 8px;
  background: var(--panel-2); color: var(--text);
  border-radius: 8px 8px 0 0; box-shadow: none;
  font-size: 12px;
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
}
.tile .th-num { color: var(--num); font-size: 15px; }
.tile .th-text { flex: 1; min-width: 0; }
.tile .th-text b { font-size: 12.5px; }
.tile .th-text span { color: var(--muted); opacity: 1; font-size: 11px; }
.tile .tile-head .cam-group .cam { width: 38px; height: 26px; font-size: 12px; border-radius: 8px; }
.tile .tile-head .cam-group .cam .cam-btn-ico { width: 13px; height: 13px; }
.tile .tile-head .cam-btns { padding: 0; gap: 3px; }
.th-star, .th-minus {
  flex: none; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 6px; background: none;
  color: var(--muted); font-size: 16px; line-height: 26px; cursor: pointer;
}
.th-star.on { color: var(--star); }
.th-star:hover { color: var(--star); background: var(--panel); }
.th-minus { font-size: 20px; font-weight: 700; }
.th-minus:hover { background: var(--danger-fill); color: #fff; }
body.selecting .tile .th-text b, body.dragging .tile .th-text b { font-size: 15px; }

/* Small split tiles need the name and controls on separate lines. */
@container tile (max-width: 300px) {
  .tile .tile-head,
  body.selecting .tile .tile-head,
  body.dragging .tile .tile-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 26px 26px;
    grid-template-rows: auto 26px;
    gap: 2px 4px;
    padding: 4px 5px;
  }
  .tile .th-num { grid-column: 1; grid-row: 1; }
  .tile .th-text { grid-column: 2 / -1; grid-row: 1; }
  .tile .tile-head .cam-group { grid-column: 1 / 3; grid-row: 2; justify-self: start; min-width: 0; max-width: 100%; }
  .tile .tile-head .cam-btns { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
  .tile .th-star { grid-column: 3; grid-row: 2; }
  .tile .th-minus { grid-column: 4; grid-row: 2; }
}

body.tile-dragging, body.tile-dragging * { cursor: grabbing !important; }
body.tile-dragging iframe { pointer-events: none; }
.tile.dragging-tile { opacity: .55; }

/* ---------- favourites: resizable height (double click on the line: show all) ---------- */

.favs-head { position: relative; display: flex; align-items: center; }
.favs-head .section-head { flex: 1; }
.favs-head .count { margin-right: 4px; }
.favs.collapsed + .favs-resizer, .favs.collapsed .favs-resizer { display: none; }
.favs-resizer {
  height: 8px; margin-top: -4px; position: relative; z-index: 2;
  cursor: row-resize; touch-action: none;
}
.favs-resizer::after {
  content: ''; position: absolute; left: 50%; top: 3px; width: 36px; height: 3px; margin-left: -18px;
  border-radius: 2px; background: var(--line); transition: background-color .15s, width .15s, margin-left .15s;
}
.favs-resizer:hover::after, body.favs-resizing .favs-resizer::after { background: var(--star); width: 60px; margin-left: -30px; }
body.favs-resizing, body.favs-resizing * { cursor: row-resize !important; user-select: none; }
body.favs-resizing iframe { pointer-events: none; }

/* merged stations in tile headers use the same neutral cue as the single view */
.tile .th-num.agg { color: var(--agg); cursor: default; }

/* "split N" in the row's bottom-right corner; camera buttons shifted left to make room */
.slot-idx { top: auto; bottom: 3px; right: 2px; min-width: 0; max-width: none; padding: 0 5px; white-space: nowrap; text-align: center; }
.item > .cam-group { margin-right: 12px; }
@media (max-width: 899px) { .slot-idx { top: auto; bottom: 3px; right: 1px; } }

/* merged location in the split view: red lock on its neutral number */
.num.agg-num.locked { cursor: not-allowed; display: inline-flex; align-items: baseline; gap: 2px; }
.num.agg-num.locked:hover { background: none; }
.num .num-lock { width: 10px; height: 10px; color: var(--danger); align-self: center; flex: none; }

/* one split tile full screen (double click on its header) */
.tile.fs-tile:fullscreen { width: 100%; height: 100%; border-radius: 0; background: #000; }
.tile.fs-tile:fullscreen .tile-video { flex: 1; }
body.pseudo-fs .tile.fs-tile { position: fixed; inset: 0; z-index: 100; border-radius: 0; background: #000; order: 0; }

/* expanded group locked by a split tile: red lock on its neutral line */
.g-line-btn.locked { cursor: not-allowed; }
.g-line-btn.locked:hover::before { left: 5px; width: 6px; }
.g-line-btn .num-lock {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 12px; height: 12px; padding: 1px; border-radius: 3px;
  color: var(--danger); background: var(--panel);
}

/* position menu: remove a camera that is already in the split view */
.pm-remove { border-bottom: 1px solid var(--line); margin-bottom: 4px; padding-bottom: 4px; }
.pm-rm .pm-pos { color: var(--danger); font-weight: 800; }
.pm-opt.pm-rm:hover { background: var(--danger-soft); }

/* pinned rows: one thin line */
.pin-rows .item.compact {
  height: 26px; margin: 2px 0; padding: 0 8px; gap: 6px;
  display: flex; align-items: center; cursor: default; border-radius: 6px;
}
.item.compact .num { align-self: center; margin: 0; font-size: 13px; }
.item.compact .num.agg-num { cursor: pointer; }
.item.compact .c-place { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.compact .c-cams { display: flex; gap: 3px; flex: none; }
.item.compact .c-cam { font-size: 10.5px; font-weight: 700; line-height: 16px; padding: 0 4px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.item.compact .c-cam.on { background: var(--live-fill); color: var(--live-on-fill); }
.pin-rows .item.compact.g-member { margin-left: 0; box-shadow: inset 3px 0 0 var(--agg); }

/* star icon in favourite menu items */
.ico.fav-ico { color: var(--muted); }
.ico.fav-ico.on { color: var(--star); }

/* full screen split view: a thin strip at the bottom reveals the control row */
.video.fs-split .tiles { left: 14px; top: 14px; bottom: 14px; }
.fs-hot {
  position: absolute; left: 0; right: 0; bottom: 0; height: 14px; z-index: 101;
  background: linear-gradient(to top, rgba(255, 255, 255, .10), transparent);
}
.fs-hot::after {
  content: ''; position: absolute; left: 50%; top: 5px; width: 44px; height: 4px; margin-left: -22px;
  border-radius: 2px; background: rgba(255, 255, 255, .35);
}
.fs-hot.hidden { display: none; }
.stage-actions.fs-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 102;
  padding: 10px 12px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
  transform: translateY(100%); transition: transform .18s ease;
}
.stage-actions.fs-bar.show { transform: none; }

/* "always show active rows" switch, next to the merge switch */
.panel-tools .group-btn.pin-btn { margin-left: 0; color: var(--muted); }
.panel-tools .group-btn.pin-btn.on { color: var(--live); background: var(--live-soft); border-color: var(--live); }
.panel-tools .group-btn.pin-btn svg { width: 15px; height: 15px; }
/* favourites keep their pinned lines inside their own box */
.favs-wrap { position: relative; }

/* shared toolbar for both lists (favourites + locations): merge switch and pin switch */
.panel-tools {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  flex: none;
}
.panel-tools .pt-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: auto; }
.panel-tools .group-btn { margin: 0; }

/* view switch icon: all nine squares green = go to split view */
.ico.ico-grid-live { color: var(--live); }

/* single view: stations waiting in the split view are pinned too, greyed out */
.pin-rows .item.compact.dimmed { background: var(--panel-2); border: 1px solid var(--line); opacity: .6; filter: grayscale(1); }
.pin-rows .item.compact.dimmed:hover { opacity: .85; }

/* full screen: left and top edge strips bring in the search and both lists, over the video */
.fs-hot.fs-hot-left { top: 0; bottom: 0; right: auto; width: 14px; height: auto; background: linear-gradient(to right, rgba(255, 255, 255, .10), transparent); }
.fs-hot.fs-hot-left::after { left: 5px; top: 50%; width: 4px; height: 44px; margin: -22px 0 0; }
.fs-hot.fs-hot-top { top: 0; bottom: auto; background: linear-gradient(to bottom, rgba(255, 255, 255, .10), transparent); }
.fs-hot.fs-hot-top::after { top: 5px; }
body.pseudo-fs .search {
  position: fixed; top: 0; left: 0; right: 0; margin: 0; z-index: 110;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transform: translateY(-105%); transition: transform .2s ease;
}
body.pseudo-fs .panel {
  position: fixed; left: 0; top: var(--fs-head-h, 120px); bottom: 0; z-index: 110;
  width: var(--list-w, 400px); max-width: calc(100vw - 60px);
  border-radius: 0 var(--radius) 0 0;
  box-shadow: 10px 0 30px rgba(0, 0, 0, .45);
  transform: translateX(-105%); transition: transform .2s ease;
}
body.pseudo-fs.fs-lists .search, body.pseudo-fs.fs-lists .panel { transform: none; }
/* menus, tooltips and messages above the full screen video and the lists */
body.pseudo-fs .ctx { z-index: 130; }
body.pseudo-fs .tip { z-index: 140; }
body.pseudo-fs .toast { z-index: 150; }

/* pin switch + pinned-row size: one rounded group, they belong together */
.pin-group {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
}
.pin-group .group-btn { border-radius: 999px; border-color: transparent; background: none; width: 26px; height: 26px; }
.pin-group .group-btn.pin-btn.on { background: var(--live-soft); border-color: var(--live); }
.pin-group .pin-size-btn { color: var(--live); }   /* green like the active rows it sizes */
.pin-group .pin-size-btn svg { width: 14px; height: 14px; }
.pin-group .pin-size-btn.hidden { display: none; }
.pin-group.off { background: var(--line); border-color: var(--line); }
.pin-group.off .group-btn.pin-btn { color: var(--muted); opacity: .8; }
@media (max-width: 899px) { .pin-group .group-btn { width: 34px; height: 34px; } }
/* full-size pinned rows: group members keep a neutral mark */
.pin-rows .item.pinned:not(.compact).g-member { margin-left: 0; box-shadow: inset 4px 0 0 var(--agg); }
.pin-rows .item.pinned:not(.compact).dimmed { opacity: .6; filter: grayscale(1); }
.pin-rows .item.pinned:not(.compact).dimmed:hover { opacity: .9; }

/* ---------- menus: one calmer look for every popup menu (right click, position, share, quality, favourites) ---------- */
.ctx {
  min-width: 240px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28), 0 2px 6px rgba(0, 0, 0, .12);
  font-size: 13.5px;
}
.ctx li { padding: 7px 10px; border-radius: 8px; }
.ctx li[data-action], .ctx li.ctx-row { gap: 10px; }
.ctx li:hover { background: var(--panel-2); }
.ctx li .ico { width: 16px; height: 16px; flex: none; color: var(--muted); }
.ctx li:hover .ico:not(.fav-ico.on):not(.ico-twitch) { color: var(--text); }
.ctx li.danger, .ctx li.danger .ico { color: var(--danger); }
.ctx li.danger:hover { background: var(--danger-soft); }
.ctx .ctx-sep { height: 1px; margin: 5px 4px; padding: 0; background: var(--line); pointer-events: none; }
.ctx .ctx-sep:hover { background: var(--line); }
#ctx .ctx-title {
  padding: 8px 10px 10px; margin: 0 0 4px; border-radius: 8px 8px 0 0;
  border-bottom: 1px solid var(--line); cursor: default;
}
#ctx .ctx-title:hover { background: none; }
.ctx-status {
  display: inline-block; margin-top: 7px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--accent-soft); color: var(--num);
}
.ctx-status.on { background: var(--live-soft); color: var(--live); }
/* one line per link kind, the cameras as small buttons on it */
.ctx li.ctx-row { display: flex; align-items: center; cursor: default; }
.ctx li.ctx-row:hover { background: none; }
.ctx-chips { display: flex; gap: 4px; margin-left: auto; }
.ctx-chip {
  min-width: 34px; height: 24px; padding: 0 7px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 700;
}
.ctx-chip:hover { border-color: var(--live); color: var(--live); background: var(--live-soft); }

/* hovering a list row highlights its video(s): a frame drawn above the video iframe (an outline alone
   is painted under it) and a tinted header */
.tile { position: relative; }
.tile.hl::after {
  content: ''; position: absolute; inset: 0; z-index: 8; pointer-events: none;
  border: 3px solid var(--live); border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), inset 0 0 24px var(--live-soft);
}
.tile.hl .tile-head { background: var(--live-soft); }

/* "s1 3" with several videos */
.slot-idx.multi { display: inline-flex; align-items: center; gap: 2px; padding: 0 3px 0 4px; }
.slot-idx .si-n { display: inline-block; }
.slot-idx.multi .si-n { min-width: 12px; padding: 0 3px; border-radius: 3px; text-align: center; line-height: 13px; }
.slot-idx.multi:hover .si-n { background: none; color: #fff; box-shadow: none; }

/* split view share / Twitch menus: one row per video with small buttons */
.sharepop { max-height: min(70vh, 560px); overflow-y: auto; max-width: min(560px, calc(100vw - 16px)); }
.ctx li.pop-head { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; padding: 6px 10px 4px; cursor: default; }
.ctx li.pop-head:hover { background: none; }
.pop-head strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pop-head span { font-size: 11.5px; color: var(--muted); opacity: .8; }
.pop-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.ctx li.pop-video { display: flex; align-items: center; gap: 8px; cursor: default; }
.ctx li.pop-video:hover { background: var(--panel-2); }
.pop-s { flex: none; min-width: 26px; padding: 1px 5px; border-radius: 5px; text-align: center; font-size: 11px; font-weight: 800; }
.pop-name { flex: 1; min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-name b { color: var(--num); margin-right: 2px; }
.pop-name small { color: var(--muted); }
.ctx li.pop-video .ctx-chips { flex: none; }

/* per-camera rows (mock-2-no-button): which camera of the station this row is */
.meta .cam-tag { font-size: 11px; font-weight: 600; color: var(--muted); }

/* ---------- split view tabs: named layouts ---------- */
.split-tabs { display: none; align-items: center; gap: 4px; margin: -4px 0 8px; overflow-x: auto; scrollbar-width: thin; }
.stage.split-mode .split-tabs { display: flex; }
.split-tabs .tab {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 2px 4px 2px 2px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2);
}
.split-tabs .tab.on { background: var(--panel); border-color: var(--live); box-shadow: 0 1px 0 var(--live), 0 2px 8px rgba(0, 0, 0, .08); }
.split-tabs .tab-name {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 4px 6px 4px 8px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-radius: 7px;
}
.split-tabs .tab.on .tab-name { color: var(--text); }
.split-tabs .tab-count { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--line); border-radius: 999px; padding: 0 6px; line-height: 16px; }
.split-tabs .tab.on .tab-count { background: var(--live-soft); color: var(--live); }
.split-tabs .tab-close, .split-tabs .tab-add {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: none;
  color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.split-tabs .tab-close:hover { background: var(--danger-soft); color: var(--danger); }
.split-tabs .tab-add { width: 28px; height: 28px; font-size: 18px; border: 1px dashed var(--line); flex: none; }
.split-tabs .tab-add:hover { color: var(--live); border-color: var(--live); }
.split-tabs .tab-edit { width: 150px; font: inherit; font-size: 13px; font-weight: 600; padding: 3px 6px; border: 1px solid var(--live); border-radius: 6px; background: var(--panel); color: var(--text); }

/* pinned rows take their own room above / below the list instead of lying over its rows,
   so a short search result is never half hidden */
.pin-rows { position: static; flex: none; left: auto; right: auto; top: auto; bottom: auto; }
.vlist-wrap .pin-top, .favs-wrap .pin-top { order: -1; }
.vlist-wrap .vlist { flex: 1 1 auto; min-height: 0; }
.favs-wrap { display: flex; flex-direction: column; min-height: 0; }
.favs-wrap .favs-body { flex: 1 1 auto; min-height: 0; }
.favs.collapsed .favs-wrap { display: none; }
/* many pinned rows in a small list: they scroll inside their own strip, and at least one list row stays */
.vlist-wrap .pin-rows, .favs-wrap .pin-rows { max-height: 35%; overflow-y: auto; flex-direction: column; }
.vlist-wrap .vlist { min-height: min(var(--row-h), 30%); }

/* several videos: stacked "sN" lines at the row's bottom-right, clear of the camera buttons */
.slot-idx.multi { flex-direction: column; align-items: flex-end; gap: 1px; padding: 0; height: auto; line-height: 1; }
.slot-idx.multi .si-n { min-width: 0; padding: 1px 4px; border-radius: 4px; line-height: 12px; font-size: 10px; }
.slot-idx.multi:hover .si-n { background: var(--danger-fill); color: #fff; }

/* ---------- list panel hierarchy: "Lokacije" is the panel's header, its switches apply to both
   sub-lists (Omiljena, Sva mesta), which hang under it on a rail ---------- */
.panel-tools { background: var(--panel-2); padding: 9px 12px; border-bottom: 1px solid var(--line); }
.panel-tools .pt-label { font-size: 13px; font-weight: 800; letter-spacing: .05em; color: var(--text); }
.panel > .favs, .panel > .all { margin-left: 14px; border-left: 2px solid var(--line); }
.panel > .favs .section-head, .panel > .all .section-head { padding-left: 12px; font-size: 11.5px; }
.panel > .favs .section-head::before, .panel > .all .section-head::before {
  content: ''; width: 10px; height: 2px; margin-left: -14px; margin-right: 2px; flex: none; background: var(--line);
}

/* ---------- clearer separation between the video, the search and the lists ---------- */
.search, .panel, .stage { box-shadow: 0 2px 10px rgba(0, 0, 0, .28); }
:root[data-theme="light"] .search, :root[data-theme="light"] .panel, :root[data-theme="light"] .stage { box-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .07); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .search, :root:not([data-theme="dark"]) .panel, :root:not([data-theme="dark"]) .stage { box-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .07); }
}
@media (max-width: 899px) {
  /* phone: the three blocks stacked with a visible gap of page background between them */
  .stage { border-width: 0 0 1px; }
  .search { margin-top: 8px; border-width: 1px 0; }
  .panel { margin-top: 8px; border-top: 1px solid var(--line); }
}
.panel > .favs, .panel > .all { border-left-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.panel > .favs .section-head::before, .panel > .all .section-head::before { background: color-mix(in srgb, var(--muted) 45%, transparent); }

/* phone: a resize line big enough for a finger (drag, or double tap to show all favourites) */
@media (max-width: 899px) {
  .favs-resizer { height: 22px; margin-top: -11px; }
  .favs-resizer::after { top: 9px; width: 48px; height: 4px; margin-left: -24px; }
}

/* ---------- compact lists: one line per place, same actions as the full rows ---------- */
:root { --row-h-compact: 38px; }   /* a bit taller than the pinned lines: easier to hit the camera buttons */
@media (max-width: 899px) { :root { --row-h-compact: 44px; } }
.list .item.compact:not(.pinned) {
  height: calc(var(--row-h-compact) - 6px); margin: 3px 8px; padding: 0 8px; gap: 6px;
  display: flex; align-items: center; border-radius: 8px;
}
.list .item.compact:not(.pinned).g-member { margin-left: 24px; }
.item.compact .c-place { flex: none; max-width: 55%; }
.item.compact .c-name { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.compact button.c-cam { border: 0; cursor: pointer; font-family: inherit; min-width: 28px; height: 22px; }
.pin-rows .item.compact button.c-cam { min-width: 24px; height: 18px; }
.item.compact button.c-cam:hover { background: var(--live-soft); color: var(--live); }
.item.compact button.c-cam.on:hover { background: var(--live-fill); color: var(--live-on-fill); }
@media (max-width: 899px) { .item.compact button.c-cam { min-width: 34px; height: 30px; font-size: 12px; } }
.list .item.compact:not(.pinned).in-split { box-shadow: inset 3px 0 0 var(--live); }
.list .item.compact:not(.pinned).g-member.in-split { box-shadow: inset 3px 0 0 var(--live); }

/* the switch in each list header */
.compact-btn {
  flex: none; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--muted);
}
.compact-btn svg { width: 14px; height: 14px; }
.compact-btn:hover, .compact-btn.on { color: var(--num); border-color: currentColor; }
.favs-head .compact-btn { margin-right: 10px; }
.all .section-head .compact-btn { margin-left: auto; }
@media (max-width: 899px) { .compact-btn { width: 36px; height: 36px; } }
.all .section-head .compact-btn + .count { margin-left: 6px; }

/* camera grouping switch in the Lokacije header */
.panel-tools .camrows-btn { position: relative; color: var(--muted); }
.panel-tools .camrows-btn.on { color: var(--num); }

/* row tooltip: star top right of the text, split positions with their connection state below */
.tip .rt-top { display: flex; align-items: flex-start; gap: 12px; }
.tip .rt-text { flex: 1; min-width: 0; }
.tip .rt-star { flex: none; font-size: 16px; line-height: 1; color: var(--muted); margin-top: 1px; }
.tip .rt-star.on { color: var(--star); }
.tip .rt-fav { display: block; margin-top: 4px; font-size: 11.5px; color: var(--star); }
.tip .rt-slots { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.tip .rt-slot { display: flex; align-items: center; gap: 7px; font-size: 12px; }

/* list headers: the number right after the name, in brackets — "Omiljena (4)", "Sva mesta (65)" */
.favs .section-head .count, .all .section-head .count, .all .section-head .compact-btn + .count {
  margin-left: 2px; padding: 0; background: none; border-radius: 0;
  font-size: inherit; font-weight: 600; color: var(--muted);
}
.favs .section-head .count::before, .all .section-head .count::before { content: '('; }
.favs .section-head .count::after, .all .section-head .count::after { content: ')'; }
.all .section-head .compact-btn { order: 1; margin-left: auto; }
.pin-rows > .item { flex-shrink: 0; }   /* the strip scrolls; its rows keep their height */
.th-minus { font-size: 18px; font-weight: 600; }
.tip .d-agg, .ctx-title .d-agg { display: block; margin-top: 5px; font-size: 12px; color: var(--agg); max-width: 300px; }
.tip .rt-hint { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
/* a camera already shown in another split video: can't be chosen here */
.tile-head .cam-group .cam.taken { opacity: .35; cursor: not-allowed; }
.tile-head .cam-group .cam.taken:hover { border-color: var(--line); }
#now { cursor: pointer; }
.drag-ghost.header-ghost { position: fixed; z-index: 200; pointer-events: none; padding: 5px 9px; border-radius: 8px; background: var(--panel); border: 1px solid var(--live); box-shadow: 0 6px 18px rgba(0,0,0,.3); font-size: 12.5px; }
.drag-ghost.header-ghost b { color: var(--num); }

/* one row per camera: cameras of the same place are bracketed on the right (the neutral mark on the
   left means places sharing a camera); rows keep their size, only the inner corners tighten */
.list .item.spot { position: relative; }
.list .item.spot::after {
  content: ''; position: absolute; right: -6px; width: 3px; top: -4px; bottom: -4px;
  border-radius: 2px; background: color-mix(in srgb, var(--num) 55%, transparent); pointer-events: none;
}
.list .item.spot-first::after { top: 30%; }
.list .item.spot-last::after { bottom: 30%; }
.list .item.spot-first { border-bottom-right-radius: 4px; }
.list .item.spot-mid { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.list .item.spot-last { border-top-right-radius: 4px; }

/* active-rows group: the main switch (pin) always rightmost; when it's on, the tray it sits in turns
   green and its two sub switches slide out to its left (mode: frozen / to the top, and pinned size) */
.pin-group { gap: 0; transition: background-color .2s, border-color .2s; }
.pin-subs { display: inline-flex; align-items: center; gap: 2px; max-width: 0; opacity: 0; overflow: hidden;
  transition: max-width .22s ease, opacity .18s ease, margin .22s ease, padding .22s ease; }
.pin-group.on { background: var(--live-soft); border-color: color-mix(in srgb, var(--live) 45%, transparent); }
.pin-group.on .pin-subs { max-width: 70px; opacity: 1; margin-right: 3px; padding-right: 3px;
  border-right: 1px solid color-mix(in srgb, var(--live) 40%, transparent); }
.pin-group .pin-subs .group-btn { color: var(--live); background: none; border-color: transparent; }
.pin-group .pin-subs .group-btn:hover { background: var(--panel); border-color: var(--live); }
.pin-group .pin-subs .group-btn svg { width: 14px; height: 14px; }
.pin-group .group-btn.pin-btn.on { background: var(--live-fill); color: var(--live-on-fill); border-color: var(--live-fill); }
.pin-group.off .pin-subs { display: none; }
.panel-tools .camrows-btn svg { width: 18px; height: 18px; }

/* drag and drop between the lists: into the favourites to add, out of them onto "Sva mesta" to remove */
.favs, .all { position: relative; }
body.drag-from-list .favs { outline: 2px dashed color-mix(in srgb, var(--star) 55%, transparent); outline-offset: -2px; }
body.drag-from-favs .all { outline: 2px dashed color-mix(in srgb, var(--danger) 50%, transparent); outline-offset: -2px; }
.favs.drop-here, .all.drop-here { outline-style: solid; }
.favs.drop-here { background: color-mix(in srgb, var(--star) 12%, var(--fav-bg, transparent)); }
.all.drop-here { background: var(--danger-soft); }
.favs.drop-here::after, .all.drop-here::after {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 20; pointer-events: none;
  padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap;
  background: var(--panel); box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.favs.drop-here::after { content: '★ Pusti da dodaš u omiljena'; color: var(--star); border: 1px solid var(--star); }
.all.drop-here::after { content: 'Pusti da ukloniš iz omiljenih'; color: var(--danger); border: 1px solid var(--danger); }

/* dragging a split video by its header over the lists */
body.tile-dragging .favs { outline: 2px dashed color-mix(in srgb, var(--star) 55%, transparent); outline-offset: -2px; }
body.tile-dragging .all { outline: 2px dashed color-mix(in srgb, var(--danger) 50%, transparent); outline-offset: -2px; }
.all.drop-unsplit { outline-style: solid; background: var(--danger-soft); }
.all.drop-unsplit::after {
  content: 'Pusti da ukloniš iz podeljenog prikaza'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 20; pointer-events: none; padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap;
  background: var(--panel); color: var(--danger); border: 1px solid var(--danger); box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
body.tile-dragging .favs.drop-here::after { content: '★ Pusti da dodaš u omiljena (ostaje u podeljenom prikazu)'; }

/* dropping a row or a video onto the search: the field it lands in lights up */
body.dragging .search, body.tile-dragging .search, body.selecting .search { outline: 2px dashed color-mix(in srgb, var(--num) 45%, transparent); outline-offset: -2px; }
.search .field.drop-field, .search.drop-field { outline: 2px solid var(--num); outline-offset: 2px; border-radius: 8px; background: color-mix(in srgb, var(--num) 10%, transparent); }
/* tabs also above the single video when there is more than one, so any tab can be reached */
.stage .split-tabs.many { display: flex; }

/* Replacement and move frames are drawn above the video iframe, like the hover highlight. */
.tile.will-replace::after, .tile.will-move::after {
  content: ''; position: absolute; inset: 0; z-index: 8; pointer-events: none; border-radius: inherit;
}
.tile.will-replace::after { border: 3px solid var(--danger); box-shadow: inset 0 0 26px color-mix(in srgb, var(--danger) 45%, transparent); }
.tile.will-move::after { border: 3px solid var(--num); box-shadow: inset 0 0 26px color-mix(in srgb, var(--num) 40%, transparent); }
.tile.will-replace .tile-head { background: var(--danger-soft); }

/* Supplied icon set. Masks let the same artwork follow each theme and active state. */
.design-icon {
  display: inline-block;
  flex: none;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask-image: var(--design-icon-url);
  mask-image: var(--design-icon-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 160%;
  mask-size: 160%;
}
.design-icon-05 { --design-icon-url: url('../assets/ikonice/dugmici-05.svg'); }
.design-icon-06 { --design-icon-url: url('../assets/ikonice/dugmici-06.svg'); }
.design-icon-07 { --design-icon-url: url('../assets/ikonice/dugmici-07.svg'); }
.design-icon-08 { --design-icon-url: url('../assets/ikonice/dugmici-08.svg'); }
.design-icon-09 { --design-icon-url: url('../assets/ikonice/dugmici-09.svg'); }
.design-icon-10 { --design-icon-url: url('../assets/ikonice/dugmici-10.svg'); }
.design-icon-11 { --design-icon-url: url('../assets/ikonice/dugmici-11.svg'); }
.design-icon-17 { --design-icon-url: url('../assets/ikonice/dugmici-17.svg'); }
.design-icon-18 { --design-icon-url: url('../assets/ikonice/dugmici-18.svg'); }
.design-icon-19 { --design-icon-url: url('../assets/ikonice/dugmici-19.svg'); }
.design-icon-34 { --design-icon-url: url('../assets/ikonice/dugmici-34.svg'); }
.design-icon-36 { --design-icon-url: url('../assets/ikonice/dugmici-36.svg'); }
.design-icon.cam-btn-ico {
  width: 34px; height: 34px;
  -webkit-mask-size: 130%; mask-size: 130%;
}
.design-icon.star-icon {
  width: 18px; height: 18px;
  -webkit-mask-size: 220%; mask-size: 220%;
}
.design-icon.theme-icon { width: 20px; height: 20px; }
.stage-action .design-icon.ico:not(.ico-twitch):not(.star-icon) {
  width: 22px; height: 22px;
  -webkit-mask-size: 160%; mask-size: 160%;
}
.ctx li .design-icon.ico:not(.ico-twitch):not(.star-icon) {
  width: 24px; height: 24px;
  -webkit-mask-size: 150%; mask-size: 150%;
}
.ctx li .design-icon.star-icon { width: 22px; height: 22px; }
.star .star-icon { width: 18px; height: 18px; }
.now-star .star-icon { width: 26px; height: 26px; }
.th-star .star-icon { width: 22px; height: 22px; }
.rt-star .star-icon { width: 22px; height: 22px; }
.cam-group .cam .cam-btn-ico.design-icon { width: 34px; height: 34px; color: var(--text); }
.cam-group .cam:hover .cam-btn-ico.design-icon { color: var(--live); }
.cam-group .cam.on .cam-btn-ico.design-icon { color: var(--live-on-fill); }
.tile .tile-head .cam-group .cam { gap: 1px; }
.tile .tile-head .cam-group .cam .cam-btn-ico.design-icon { width: 27px; height: 27px; }
.list .cam-group .cam .cam-btn-ico.design-icon { width: 34px; height: 34px; }
.dg-cam .design-icon { width: 22px; height: 22px; }
.group-btn .design-icon { width: 18px; height: 18px; }
.compact-btn .design-icon { width: 14px; height: 14px; }
.panel-tools .group-btn .design-icon { width: 16px; height: 16px; }
.panel-tools .camrows-btn .design-icon { width: 18px; height: 18px; }
.pin-group .pin-size-btn .design-icon,
.pin-group .pin-subs .design-icon { width: 14px; height: 14px; }
@media (max-width: 899px) {
  .star .star-icon { width: 22px; height: 22px; }
  .now-star .star-icon { width: 30px; height: 30px; }
  .design-icon.theme-icon { width: 22px; height: 22px; }
}
@container list (max-width: 360px) {
  .list .cam-group .cam .cam-btn-ico.design-icon { width: 27px; height: 27px; }
}
