:root {
  --bg: #0b0d12;
  --panel: #12161f;
  --panel-2: #181d28;
  --card: #1c2230;
  --card-hover: #252c3d;
  --line: #262d3c;
  --text: #eef1f7;
  --muted: #8b94a8;
  --accent: #ffc629;
  --accent-2: #ffd75e;
  --accent-ink: #1a1400;
  --live: #ff3b4e;
  --ok: #34d399;
  --danger: #ff4d5e;
  --radius: 14px;
  --radius-sm: 10px;
  --top-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s, border-color .15s;
}
.btn:hover { background: var(--card-hover); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 77, 94, .12); }
.btn-lg { padding: 14px 28px; font-size: 18px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--card); color: var(--text); }

/* ---------- login ---------- */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 198, 41, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(80, 120, 255, .12), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 36px 28px; border-radius: 22px; background: rgba(18, 22, 31, .85);
  border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); backdrop-filter: blur(10px);
}
.login-logo { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; background: var(--card); }
.login-title { margin: 0; font-size: 28px; font-weight: 800; text-align: center; line-height: 1.25; color: var(--accent); }
.login-title span, .brand-text strong span { color: var(--accent); }
.login-sub { margin: -6px 0 6px; color: var(--muted); }
.login-card input {
  width: 100%; padding: 14px; font-size: 24px; text-align: center; letter-spacing: 8px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
}
.login-card input:focus { border-color: var(--accent); outline: none; }
.login-card .btn { width: 100%; }
.login-err { min-height: 1.3em; margin: 0; color: var(--danger); font-weight: 500; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- app shell ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); flex-shrink: 0; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--card); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: 19px; font-weight: 800; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.actions { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.actions::-webkit-scrollbar { display: none; }
.act {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.act:hover { background: var(--card); }
.act.on { background: var(--accent); color: var(--accent-ink); }
.act-power { color: var(--danger); border-color: rgba(255, 77, 94, .35); }
.act-power:hover { background: rgba(255, 77, 94, .12); }

.stage { flex: 1; min-height: 0; display: flex; }
.screen { flex: 1; min-width: 0; position: relative; background: #000; display: flex; }

/* ---------- main player ---------- */
.player { position: relative; flex: 1; display: flex; background: #000; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player:fullscreen { width: 100vw; height: 100vh; }
.player:-webkit-full-screen { width: 100vw; height: 100vh; }

.osd {
  position: absolute; inset: 0 0 auto 0; pointer-events: none; padding: 14px 16px 40px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .65), transparent);
  opacity: 1; transition: opacity .4s;
}
.osd.fade { opacity: 0; }
.osd-top { display: flex; align-items: center; gap: 10px; }
.live-dot {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px;
  background: var(--live); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .5px;
}
.live-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.osd-name { font-size: 20px; font-weight: 700; text-shadow: 0 1px 6px #000; }
.route {
  margin-inline-start: auto; font-size: 12px; padding: 3px 9px; border-radius: 6px;
  background: rgba(255, 255, 255, .14); color: #fff; backdrop-filter: blur(6px);
}
.route:empty { display: none; }

.status {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: rgba(0, 0, 0, .55); text-align: center; padding: 20px; z-index: 2;
}
.status p { margin: 0; font-size: 17px; font-weight: 500; max-width: 420px; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.unmute {
  position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 30px;
  border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
  cursor: pointer; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); animation: pop .3s;
}
@keyframes pop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }

/* ---------- split screen ---------- */
.split {
  flex: 1; display: grid; gap: 8px; padding: 8px; overflow: auto; align-content: center; justify-content: center;
  grid-template-columns: repeat(var(--cols, 3), var(--tile-w, 1fr)); background: #05060a;
}
.tile {
  position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden;
  border: 2px solid var(--line); cursor: pointer; transition: border-color .15s;
}
.tile.audio { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(255, 198, 41, .25); }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-bar {
  position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .75), transparent); font-weight: 700; font-size: 14px;
}
.tile-bar .sp { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-btn {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer;
}
.tile-btn:hover { background: rgba(255, 255, 255, .2); }
.tile-btn svg { width: 16px; height: 16px; }
.tile-btn.x:hover { background: var(--danger); }
.tile-status { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); pointer-events: none; }
.tile-status .spinner { width: 28px; height: 28px; border-width: 3px; }

/* ---------- channel list ---------- */
.channels {
  width: 340px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-inline-start: 1px solid var(--line);
}
.stage.no-list .channels { display: none; }
.channels-head { padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.channels-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--accent); }
.channels-head h2 small { color: var(--muted); font-weight: 500; font-size: 13px; }
.search { position: relative; display: block; }
.search svg { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input {
  width: 100%; padding: 10px 40px 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
}
.search input:focus { border-color: var(--accent); outline: none; }
.groups { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.groups:empty { display: none; }
.chip {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

.ch-list { list-style: none; margin: 0; padding: 4px 10px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ch {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px;
  background: var(--card); border: 1px solid transparent; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, transform .1s;
}
.ch:hover { background: var(--card-hover); }
.ch:active { transform: scale(.985); }
.ch.active { border-color: var(--accent); background: linear-gradient(90deg, rgba(255, 198, 41, .06), rgba(255, 198, 41, .16)); }
.ch.in-split { border-color: rgba(255, 198, 41, .45); }
.ch-num { width: 22px; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.ch-logo {
  width: 52px; height: 36px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--panel-2); overflow: hidden; font-weight: 800; font-size: 15px; color: var(--accent);
}
.ch-logo img { width: 100%; height: 100%; object-fit: contain; }
.ch-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-eq { display: none; gap: 2px; align-items: flex-end; height: 14px; }
.ch.active .ch-eq { display: inline-flex; }
.ch-eq i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq 1s infinite ease-in-out; }
.ch-eq i:nth-child(2) { animation-delay: -.3s; }
.ch-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.ch-empty { color: var(--muted); text-align: center; padding: 30px 10px; }

.ticker {
  margin: 0 10px 10px; margin-bottom: calc(10px + var(--safe-b)); padding: 10px 0; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255, 198, 41, .5); background: linear-gradient(90deg, #0d0f14, #171b24, #0d0f14);
}
.ticker-track { position: relative; height: 24px; overflow: hidden; }
.ticker-track span {
  position: absolute; top: 0; white-space: nowrap; color: var(--accent); font-weight: 700; line-height: 24px;
  text-shadow: 0 0 8px rgba(255, 198, 41, .7); animation: ticker 20s linear infinite;
}
/* left to right: enters from the left edge, leaves on the right */
@keyframes ticker { from { left: 0; transform: translateX(-100%); } to { left: 100%; transform: translateX(0); } }

/* ---------- power off ---------- */
.power {
  position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center;
}
.power-clock { font-size: clamp(64px, 16vw, 160px); font-weight: 300; font-variant-numeric: tabular-nums; color: #d8dce6; line-height: 1; }
.power-date { font-size: clamp(16px, 3vw, 24px); color: var(--muted); margin-bottom: 30px; }

/* ---------- dialogs ---------- */
.dlg {
  width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.dlg-wide { width: min(860px, calc(100% - 24px)); height: min(720px, calc(100% - 24px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.dlg-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; height: 100%; }
.dlg-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dlg-head h3 { margin: 0; font-size: 20px; font-weight: 800; }
.dlg-head .icon-btn { margin-inline-start: auto; }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
h4 { margin: 4px 0 0; font-size: 16px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.adv summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.adv[open] { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span2 { grid-column: 1 / -1; }

.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tab { border: 0; background: transparent; padding: 7px 12px; white-space: nowrap; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--card); color: var(--text); }
.tab-pane { display: none; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; min-height: 0; }
.tab-pane.active { display: flex; }

.m-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.m-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--card); }
.m-item.is-hidden { opacity: .55; }
.m-item .ch-logo { width: 44px; height: 30px; font-size: 13px; }
.m-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-info small { color: var(--muted); direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.m-tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.m-tag.def { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.m-btns { display: flex; gap: 2px; }
.m-btns .icon-btn { width: 34px; height: 34px; }
.m-btns .icon-btn.del:hover { color: var(--danger); }

.toast {
  position: fixed; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translate(-50%, 20px); z-index: 100;
  padding: 12px 20px; border-radius: 12px; background: #262d3c; color: var(--text); font-weight: 500;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #4a1820; }

/* ---------- top bar "more" menu (phones) ---------- */
.more-menu { display: contents; }
.act-more { display: none; }
.act-admin { color: var(--accent); }
a.act { text-decoration: none; }

/* ---------- small helpers ---------- */
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn svg { width: 18px; height: 18px; }
label.btn { position: relative; }
.h-ico { width: 20px; height: 20px; vertical-align: -4px; color: var(--accent); }
.hint.small { font-size: 12.5px; }
.hint a { color: var(--accent); }
.row-inline { display: flex; align-items: flex-end; gap: 10px; }
.row-inline .grow { flex: 1; }
.row-start { display: flex; flex-wrap: wrap; gap: 10px; }
.dlg-narrow { width: min(400px, calc(100% - 24px)); }
.code-input {
  width: 100%; padding: 14px; font-size: 22px; text-align: center; letter-spacing: 6px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
}
.code-input:focus { border-color: var(--accent); outline: none; }

/* ---------- system admin screen ---------- */
.dlg-admin {
  width: min(1100px, calc(100% - 24px)); height: min(820px, calc(100% - 24px));
  max-width: none; max-height: none;
}
.admin {
  height: 100%; display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr;
  grid-template-areas: "head head" "nav main";
}
.admin-head {
  grid-area: head; position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.admin-head h3 { margin: 0; margin-inline-end: auto; font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.admin-nav { grid-area: nav; display: flex; flex-direction: column; gap: 4px; padding: 12px; border-inline-end: 1px solid var(--line); overflow-y: auto; }
.a-tab {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; text-align: start; white-space: nowrap;
}
.a-tab:hover { background: var(--card); color: var(--text); }
.a-tab.active { background: var(--accent); color: var(--accent-ink); }
.admin-main { grid-area: main; overflow-y: auto; padding: 18px 20px 24px; min-height: 0; }
.a-pane { display: none; flex-direction: column; gap: 14px; }
.a-pane.active { display: flex; }
.a-pane h4 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pane-head .hint { margin-top: 4px; }
.pane-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.card .field input, .card .field textarea { background: var(--bg); }
.code-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.ticker-preview { margin: 0; }
.brand-edit { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.brand-preview { width: 120px; height: 120px; border-radius: 22px; object-fit: cover; background: var(--card); border: 1px solid var(--line); }
.brand-controls { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.brand-controls .row-inline { width: 100%; }

/* broken-link check */
.check-box { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); display: flex; flex-direction: column; gap: 8px; }
.check-box.bad { border-color: rgba(255, 77, 94, .5); background: rgba(255, 77, 94, .07); }
.check-box.good { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .07); }
.check-box b { font-size: 15px; }
.check-box ul { margin: 0; padding-inline-start: 18px; color: var(--text); font-size: 14px; }
.check-box li span { color: var(--muted); }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.st { font-size: 12px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; font-weight: 600; }
.st.ok { background: rgba(52, 211, 153, .15); color: var(--ok); }
.st.bad { background: rgba(255, 77, 94, .15); color: var(--danger); }
.st.wait { background: var(--panel-2); color: var(--muted); }
.st.unknown { background: var(--panel-2); color: var(--muted); }
.m-item.broken { box-shadow: inset 3px 0 0 var(--danger); }

/* shortcut dialog */
.sc-box { padding: 14px; border-radius: 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.sc-box h4 { margin: 0; }
.sc-box.mine { outline: 2px solid var(--accent); }

/* ---------- tablets ---------- */
@media (max-width: 1180px) {
  .act span { display: none; }
  .act { padding: 0 11px; }
  .channels { width: 290px; }
}

/* ---------- phones (portrait) ---------- */
@media (max-width: 820px) and (orientation: portrait), (max-width: 600px) {
  :root { --top-h: 56px; }
  .topbar { gap: 6px; padding-inline: 10px; }
  .brand { flex: 1; overflow: hidden; gap: 8px; }
  .brand-clock { overflow: hidden; text-overflow: ellipsis; }
  .actions { gap: 2px; flex-shrink: 0; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-text strong { font-size: 16px; }
  .brand-clock { font-size: 12px; }
  .act { height: 38px; width: 38px; padding: 0; justify-content: center; }
  .act-more { display: inline-flex; }
  .more-menu {
    display: none; position: fixed; top: calc(var(--top-h) + env(safe-area-inset-top, 0px) - 4px); inset-inline-end: 10px; z-index: 40;
    flex-direction: column; gap: 2px; padding: 6px; min-width: 210px; border-radius: 14px;
    background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  }
  .more-menu.open { display: flex; }
  .more-menu .act { width: 100%; justify-content: flex-start; padding: 0 12px; height: 44px; }
  .more-menu .act span { display: inline; }
  /* system admin screen on a phone: full screen, sections as a scrolling strip */
  .dlg-admin { width: 100%; height: 100%; max-height: 100%; border-radius: 0; border: 0; }
  .admin { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "head" "nav" "main"; }
  .admin-head { padding: 10px 12px; gap: 6px; }
  .admin-head h3 { font-size: 17px; width: 100%; }
  .admin-head .icon-btn { position: absolute; top: 8px; inset-inline-end: 8px; }
  .admin-nav { flex-direction: row; overflow-x: auto; border: 0; border-bottom: 1px solid var(--line); padding: 8px; scrollbar-width: none; }
  .a-tab { padding: 8px 12px; }
  .admin-main { padding: 14px 12px 24px; }
  .code-form { grid-template-columns: 1fr; }
  .row-inline { flex-wrap: wrap; }
  .stage { flex-direction: column; }
  .screen { flex: none; aspect-ratio: 16 / 9; max-height: 45vh; }
  .stage.split-mode .screen { flex: 1; aspect-ratio: auto; max-height: none; }
  .stage.split-mode .channels { flex: none; max-height: 34vh; }
  .channels { width: auto; flex: 1; border: 0; border-top: 1px solid var(--line); }
  .stage.no-list .screen { flex: 1; aspect-ratio: auto; max-height: none; }
  .channels-head { padding: 12px 12px 6px; }
  .channels-head h2 { display: none; }
  .ch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 6px 12px 12px; align-content: start; }
  .ch { flex-direction: column; gap: 6px; padding: 10px 8px; text-align: center; position: relative; }
  .ch-num { position: absolute; top: 6px; inset-inline-start: 6px; width: auto; font-size: 11px; }
  .ch-logo { width: 72px; height: 44px; }
  .ch-name { width: 100%; font-size: 14px; }
  .ch-eq { position: absolute; top: 8px; inset-inline-end: 8px; }
  .osd-name { font-size: 16px; }
  .grid-form { grid-template-columns: 1fr; }
  .dlg-wide { height: calc(100% - 24px); }
  .m-tag { display: none; }
  .m-item { flex-wrap: wrap; row-gap: 4px; }
  .m-info { flex-basis: calc(100% - 60px); }
  .m-btns { width: 100%; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 4px; }
  .dlg-head .tabs { order: 3; width: 100%; }
  .dlg-head .tab { flex: 1; }
}

/* phones in landscape: the video gets the whole screen */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --top-h: 48px; }
  .act span { display: none; }
  .brand-clock { display: none; }
  .channels { width: 240px; }
  .ch-logo { width: 40px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track span { animation-duration: 60s; }
  .live-dot::before, .ch-eq i { animation: none; }
}
