/* Пульт оператора и админка: тёмный интерфейс, удобный с телефона в тёмном зале. */
:root {
  --bg: #15121b; --bg2: #1e1a26; --bg3: #2a2533; --line: #353041; --fg: #f1ebf2; --muted: #9d93a7;
  --gold: #e6c584; --gold-fg: #1b1418; --ok: #6fd39b; --bad: #ef7b7b; --warn: #f2c14b;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Unbounded", "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-body); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--gold); }
.muted { color: var(--muted); font-size: 13px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 max(14px, env(safe-area-inset-right)) 40px max(14px, env(safe-area-inset-left)); }

.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); padding: max(12px, env(safe-area-inset-top)) 0 0; }
.top .wrap { padding-bottom: 0; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; }
.top small { color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.top h1 { font-family: var(--f-display); font-weight: 500; font-size: 18px; line-height: 1.2; }
.scr { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dot { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--bg3); color: var(--muted); white-space: nowrap; }
.dot.on { background: rgba(111,211,155,.15); color: var(--ok); }
.dot.err { background: rgba(239,123,123,.15); color: var(--bad); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tabs button { font: inherit; font-size: 14px; font-weight: 700; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 4px; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--gold); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 12px; line-height: 20px; }

section.tab { display: grid; gap: 14px; padding-top: 16px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 12px; }
.card h2 { font-size: 15px; font-weight: 800; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row > div { min-width: 0; }
.row b { display: block; }

.seg { display: flex; background: var(--bg3); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; font: inherit; font-size: 14px; font-weight: 700; color: var(--muted); background: none; border: 0; border-radius: 9px; padding: 9px 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--gold-fg); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 800; font-size: 14px; color: var(--fg); background: var(--bg3); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; text-decoration: none; text-align: center; }
.btn.main { background: var(--gold); color: var(--gold-fg); border-color: var(--gold); }
.btn.ok { background: rgba(111,211,155,.16); color: var(--ok); border-color: transparent; }
.btn.bad { background: rgba(239,123,123,.14); color: var(--bad); border-color: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .seg button:focus-visible, .tabs button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns .btn { flex: 1; }

.sw { position: relative; width: 48px; height: 28px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; border-radius: 99px; background: #4a4354; transition: background .2s; }
.sw span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #d8d2dc; transition: transform .2s; }
.sw input:checked + span { background: var(--ok); }
.sw input:checked + span::after { transform: translateX(20px); background: #fff; }

input[type=range] { width: 100%; accent-color: var(--gold); }
select, input[type=text], input[type=password], input:not([type]) { font: inherit; color: var(--fg); background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
select { min-width: 120px; }
.val { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 800; }

.list { display: grid; gap: 10px; }
.item { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
.item.textonly { grid-template-columns: minmax(0, 1fr); }
.thumb { position: relative; width: 96px; height: 96px; border-radius: 10px; background: var(--bg3) center/cover no-repeat; overflow: hidden; cursor: pointer; border: 0; padding: 0; }
.thumb.play::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-40%, -50%); border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.item video { width: 100%; max-height: 360px; border-radius: 10px; background: #000; grid-column: 1 / -1; }
.meta { display: grid; gap: 6px; align-content: start; min-width: 0; }
.meta .who { font-weight: 800; }
.meta .txt { overflow-wrap: anywhere; white-space: pre-wrap; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg3); color: var(--muted); }
.tag.bad { background: rgba(239,123,123,.15); color: var(--bad); }
.tag.pin { background: rgba(230,197,132,.15); color: var(--gold); }
.tag.vid { background: rgba(120,160,255,.15); color: #9db8ff; }
.item .btns { grid-column: 1 / -1; }
.item .btns .btn { padding: 9px 8px; font-size: 13.5px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.track { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.track:first-child { border-top: 0; }
.track .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track.cur .t { color: var(--gold); font-weight: 800; }
.track .btn { padding: 7px 10px; }
.player { display: grid; gap: 12px; }
.now { font-weight: 800; overflow-wrap: anywhere; }
.warn { color: var(--warn); font-size: 13px; }

.linkrow { display: grid; gap: 6px; }
.linkrow code { display: block; font-size: 12.5px; background: var(--bg3); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; color: var(--fg); }
.qrimg { width: 160px; height: 160px; background: #fff; border-radius: 12px; padding: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--bg3); border-radius: 12px; padding: 10px; }
.stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--fg); color: var(--bg); font-weight: 800; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
.toast.err { background: var(--bad); color: #fff; }

/* админка */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
.form input, .form select { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.evlist { display: grid; gap: 12px; }
.ev h3 { font-size: 17px; }
