/* Горячие клавиши */
kbd { display: inline-block; min-width: 22px; padding: 2px 6px; margin-left: 4px; border-radius: 5px; background: var(--bg4); border: 1px solid var(--border); border-bottom-width: 2px; font: 700 11px/1.4 "Noto Sans", sans-serif; text-transform: uppercase; text-align: center; color: var(--text); }
.info-box { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, #3b82f6 14%, transparent); border: 1px solid color-mix(in srgb, #3b82f6 45%, transparent); font-size: 14px; }
.info-box .ic { width: 18px; height: 18px; color: #60a5fa; }
.kb-head, .kb-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: center; }
.kb-head { font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 0 4px; }
.kb-row { padding: 8px 0; border-top: 1px solid var(--border); }
.kb-row.off { opacity: .55; }
.kb-keys { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--input); border-radius: 10px; padding: 5px 6px 5px 8px; min-height: 42px; }
.kb-combo kbd:first-child { margin-left: 0; }
.kb-table { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.kb-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); font-size: 15px; }
.kb-line:first-child { border-top: 0; }
.kb-capture { font-size: 26px; text-align: center; padding: 24px; background: var(--bg3); border-radius: 12px; min-height: 80px; }
.kb-capture kbd { font-size: 18px; padding: 6px 12px; }
@media (max-width: 700px) { .kb-head { display: none; } .kb-row { grid-template-columns: 1fr; } }

/* Специальные возможности */
.ticks { display: flex; justify-content: space-between; gap: 2px; margin: 10px 0 14px; position: relative; padding-top: 4px; }
.ticks::before { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 4px; border-radius: 2px; background: var(--bg4); }
.ticks button { position: relative; z-index: 1; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 0 0 18px; display: flex; flex-direction: column; align-items: center; min-width: 26px; }
.ticks button::after { content: ""; position: absolute; bottom: 2px; width: 2px; height: 12px; background: var(--faint); border-radius: 1px; }
.ticks button.cur { color: var(--ok); font-weight: 700; }
.ticks button.cur::after { width: 18px; height: 18px; bottom: -1px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px var(--accent); }
.radio-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.radio-line input { width: 18px; height: 18px; accent-color: var(--accent); }
.related-link { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: transparent; padding: 12px; border-radius: 10px; text-align: left; }
.related-link:hover { background: var(--bg2); }
.related-link > .ic:first-child { width: 40px; height: 40px; padding: 9px; background: var(--bg4); border-radius: 10px; }
.related-link small { display: block; color: var(--muted); font-size: 13px; }
.ic.flip-x { transform: rotate(180deg); opacity: .6; }
.a11y-preview .msg { padding-right: 0; }
.a11y-preview .msg:hover { background: transparent; }
.opt.dim { opacity: .5; }

body.underline-links .msg .text a, body.underline-links .a11y-preview a { text-decoration: underline; }
body.hc { --text: #fff; --muted: #d0d2d8; --faint: #a8aab3; --border: #6b6e78; }
body.hc.light { --text: #000; --muted: #222; --faint: #444; --border: #555; }
body.hc .side-item, body.hc .btn { outline: 1px solid transparent; }
body.hc .side-item.active, body.hc .side-item:focus-visible { outline-color: var(--accent); }
body.desat #app, body.desat #settings, body.desat .overlay, body.desat .menu, body.desat .popout { filter: saturate(var(--sat)); }
body.desat img, body.desat video { filter: saturate(calc(1 / max(var(--sat), .01))); }
body.msg-compact .msg { padding-top: 1px; padding-bottom: 1px; }
body.msg-compact .msg .avatar { display: none; }
body.msg-compact .msg.first { margin-top: 4px; }
body.msg-compact .msg .body { display: block; }
body.msg-compact .msg .meta { display: inline-flex; margin-right: 6px; }
body.msg-compact .msg .text { display: inline; }
body .msg.first { margin-top: var(--group-gap, 14px); }
body[data-density="compact"] .side-item { padding-top: 3px; padding-bottom: 3px; }
body[data-density="compact"] .member { padding-top: 3px; padding-bottom: 3px; }
body[data-density="compact"] #rail { gap: 4px; }
body[data-density="spacious"] .side-item { padding-top: 10px; padding-bottom: 10px; }
body[data-density="spacious"] .member { padding-top: 9px; padding-bottom: 9px; }
body[data-density="spacious"] #rail { gap: 12px; }
body.roles-off .member .name, body.roles-off .msg .author { color: inherit !important; }

/* Изменение размеров панелей мышкой */
#sidebar { width: var(--side-w, 248px); }
#members { width: var(--mem-w, 240px); }
#members.dm-side { width: var(--mem-w, 340px); }
#call { height: var(--call-h, 46%); }
#call.full { height: 100%; }
#userbar { width: calc(72px + var(--side-w, 248px) - 16px); }
.rz-col { position: relative; z-index: 30; width: 8px; margin: 0 -4px; flex-shrink: 0; cursor: ew-resize; }
.rz-col::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.rz-col:hover::after, .rz-col.drag::after { background: var(--accent); }
.rz-row { position: relative; z-index: 30; height: 8px; margin: -4px 0; flex-shrink: 0; cursor: ns-resize; }
.rz-row::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 2px; background: transparent; transition: background .15s; }
.rz-row:hover::after, .rz-row.drag::after { background: var(--accent); }
.rz-col[data-rz="mem"]:has(+ #members.hidden) { display: none; }
body.resizing { user-select: none; }
body.resizing iframe, body.resizing video { pointer-events: none; }
body.rz-ew, body.rz-ew * { cursor: ew-resize !important; }
body.rz-ns, body.rz-ns * { cursor: ns-resize !important; }
@media (max-width: 860px) { .rz-col[data-rz="mem"] { display: none; } }
@media (max-width: 640px) { .rz-col { display: none; } #sidebar { width: calc(100vw - 60px); } }

/* Настройки сервера */
.srv-settings .pane { padding-top: 40px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.banner-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-width: 560px; }
.banner-sw { height: 62px; border-radius: 8px; border: 2px solid transparent; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #000) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 60%, #fff) 100%); cursor: pointer; transition: transform .15s; }
.banner-sw:hover { transform: translateY(-2px); }
.banner-sw.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.tag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 800px) { .tag-grid { grid-template-columns: 1fr 1fr; } }
.srv-card { width: 300px; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-top: 40px; }
.srv-banner { height: 120px; background-image: linear-gradient(160deg, rgba(0,0,0,.25), rgba(255,255,255,.12)); }
.srv-icon { width: 72px; height: 72px; margin: -36px 0 0 14px; border-radius: 18px; border: 5px solid var(--bg2); background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; overflow: hidden; position: relative; }
.srv-icon img { width: 100%; height: 100%; object-fit: cover; }
.srv-body { padding: 8px 16px 16px; }
.srv-body b { font-size: 17px; }
.srv-meta { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); margin-top: 3px; }
.srv-meta .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); margin-left: 4px; }
.srv-meta .dot:first-child { margin-left: 0; }
.srv-desc { font-size: 13px; margin-top: 10px; white-space: pre-wrap; }
.inv-line { display: grid !important; grid-template-columns: 1.2fr 1fr 1fr 1.4fr 40px; }
.inv-line code { background: var(--bg4); padding: 2px 6px; border-radius: 5px; }
.official.bot { background: #5865f2; }

/* Админ-панель */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.adm-stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.adm-stat b { display: block; font-size: 24px; font-weight: 800; }
.adm-stat span { font-size: 12px; color: var(--muted); }
.adm-tabs { margin: 0 0 14px; display: flex; gap: 4px; flex-wrap: wrap; }
.adm-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.adm-tabs .ic { width: 16px; height: 16px; }
.adm-list { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.adm-row:first-child { border-top: 0; }
.adm-row.banned { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.adm-row .n { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.adm-row .u { font-size: 12px; color: var(--muted); }
.adm-actions { display: flex; align-items: center; gap: 6px; }
.adm-tag { display: inline-block; font-size: 12px; margin-top: 4px; padding: 1px 8px; border-radius: 6px; margin-right: 6px; }
.adm-tag.ban { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.adm-tag.mute { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.adm-quote { border-left: 3px solid var(--border); padding: 4px 10px; color: var(--muted); font-size: 14px; white-space: pre-wrap; }

.sq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) { .sq-grid { grid-template-columns: 1fr; } }
.sq-preset { border: 1px solid var(--border); cursor: pointer; }
.sq-preset:hover { border-color: var(--accent); }
.modal:has(.sq-grid) { width: min(620px, 100%); }

/* Расширенное меню (участник звонка, трансляция) */
.menu.rich { width: 250px; padding: 6px; }
.menu.rich button { align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px; }
.menu.rich button .grow { display: flex; flex-direction: column; min-width: 0; }
.menu.rich button small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.menu.rich button:hover small { color: inherit; opacity: .85; }
.menu.rich button.dim { opacity: .6; pointer-events: none; }
.rm-check { width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--muted); display: grid; place-items: center; flex-shrink: 0; font-style: normal; }
.rm-check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rm-check .ic { width: 14px; height: 14px; stroke-width: 3; }
.menu.rich button:hover .rm-check { border-color: currentColor; }
.ic.rm-arrow { width: 16px; height: 16px; transform: rotate(180deg); opacity: .7; }
.rm-slider { padding: 8px 10px 10px; font-size: 14px; }
.rm-slider span { display: block; margin-bottom: 8px; }
.rm-slider input { width: calc(100% - 44px); accent-color: var(--accent); vertical-align: middle; }
.rm-slider small { display: inline-block; width: 40px; text-align: right; color: var(--muted); font-size: 12px; }

/* Своя трансляция — плашка вместо «зеркала» */
.tile.screen.own { grid-row: span 1; background: radial-gradient(circle at 50% 30%, #2a2140, #15161b); }
.own-stream { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 16px; color: #e8e9ed; }
.own-stream > .ic { width: 40px; height: 40px; color: var(--accent); }
.own-stream b { font-size: 16px; }
.own-stream small { color: #a9abb5; font-size: 12px; }
.own-stream .row { margin-top: 8px; flex-wrap: wrap; justify-content: center; }

/* ===== Раскладка звонка ===== */
#call { display: flex; flex-direction: column; }
/* Без трансляций: ровные плитки 16:9 по центру */
.people-grid { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 10px; padding: 14px; overflow: auto; }
.people-grid .tile { min-height: 0; aspect-ratio: 16 / 9; width: clamp(200px, calc((100% - 30px) / 3), 520px); }
.people-grid.n1 .tile { width: clamp(240px, 60%, 760px); }
.people-grid.n2 .tile { width: clamp(220px, calc((100% - 10px) / 2), 640px); }
.people-grid .tile .avatar.lg { width: 84px; height: 84px; font-size: 30px; }
/* С трансляцией: сцена + полоса людей */
.stage { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 12px 12px 0; grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); }
.stage.n2, .stage.n4 { grid-template-columns: 1fr 1fr; }
.stage.n3 { grid-template-columns: 1fr 1fr; }
.stage .tile { min-height: 0; height: 100%; grid-column: auto; grid-row: auto; background: #000; }
.stage .tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.strip { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; justify-content: center; flex-shrink: 0; }
.strip .tile { flex-shrink: 0; width: 176px; height: 99px; min-height: 0; }
.strip .tile .avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.strip .tile .label { font-size: 11px; left: 6px; bottom: 6px; }
/* Нижняя панель: инфо слева, кнопки по центру */
#call .bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: nowrap; }
#call .bar .info { position: static; flex: 1 1 0; min-width: 0; font-size: 12px; line-height: 1.35; overflow: hidden; }
#call .bar .bar-spacer { flex: 1 1 0; }
@media (max-width: 900px) { #call .bar .info, #call .bar .bar-spacer { display: none; } #call .bar { justify-content: center; flex-wrap: wrap; } }
.screen-btn-wrap { position: relative; display: inline-flex; }

.mention-tag[data-mention] { cursor: pointer; transition: background .12s; }
.mention-tag[data-mention]:hover { background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); text-decoration: underline; }

/* Сообщения о звонках в ЛС */
.msg.call-msg { align-items: center; gap: 14px; padding-top: 6px; padding-bottom: 6px; color: var(--muted); }
.msg.call-msg .call-ic { width: 40px; display: grid; place-items: center; flex-shrink: 0; color: var(--ok); }
.msg.call-msg .call-ic .ic { width: 20px; height: 20px; }
.msg.call-msg b { color: var(--text); font-weight: 600; }
.msg.call-msg .time { font-size: 11px; color: var(--faint); margin-left: 4px; }
.msg.call-msg.missed .call-ic { color: var(--muted); transform: rotate(135deg); }
.msg.call-msg.live .call-ic { animation: speak-pulse 1.4s ease-in-out infinite; border-radius: 50%; }
.msg.call-msg .btn { margin-left: 10px; vertical-align: middle; }
.msg.call-msg + .msg:not(.call-msg) { margin-top: 14px; }
.sub.missed-call { color: var(--danger) !important; }
.sub .ic.dim { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; }

/* Трансляция — ровный прямоугольник 16:9 по центру сцены */
.stage { place-items: center; container-type: size; }
.stage .tile.screen { width: min(100%, calc(100cqh * 16 / 9)); height: auto; aspect-ratio: 16 / 9; max-height: 100%; border-radius: 10px; }
.stage.n3 .tile.screen, .stage.n4 .tile.screen { width: min(100%, calc(50cqh * 16 / 9 - 8px)); }
.stage .tile.screen.own { width: min(100%, calc(100cqh * 16 / 9)); }

.call-who { cursor: pointer; }
.call-who:hover { text-decoration: underline; }

/* Подсказки «@» */
.composer { position: relative; }
.mention-ac { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); max-height: 340px; overflow-y: auto; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 40; }
body.grad .mention-ac { background: #1c1c23; }
body.grad.grad-light .mention-ac { background: #fff; }
.mention-ac .ac-head { font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 8px; }
.mention-ac hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.ac-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ac-row.sel { background: var(--bg4); }
.ac-row .ac-name { font-weight: 600; white-space: nowrap; }
.ac-row .ac-sub { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-tag.everyone { cursor: default; }

/* Активность пользователя (админ-панель) */
.act-body { margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.act-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
@media (max-width: 700px) { .act-grid { grid-template-columns: repeat(2, 1fr); } }
.act-week { display: flex; align-items: flex-end; gap: 8px; height: 90px; background: var(--bg3); border-radius: 10px; padding: 10px 12px 4px; }
.act-week > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.act-week i { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; }
.act-week small { font-size: 11px; color: var(--muted); }
.act-v { text-align: right; max-width: 60%; overflow-wrap: anywhere; }
.act-msg { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 14px; }
.act-msg:first-child { border-top: 0; }
.act-msg .row { font-size: 12px; margin-bottom: 3px; }
.act-diff { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.act-diff .old { opacity: .6; text-decoration: line-through; }
.act-img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; vertical-align: middle; }
.act-diff .old .act-img { text-decoration: none; }
.act-color { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* Плитки людей вписываются и по ширине, и по высоте — подписи не обрезаются */
.people-grid { container-type: size; }
.people-grid .tile { width: min(520px, calc((100cqw - 30px) / 3), calc((100cqh - 28px) * 16 / 9)); }
.people-grid.n1 .tile { width: min(760px, 100cqw - 28px, calc((100cqh - 28px) * 16 / 9)); }
.people-grid.n2 .tile { width: min(640px, calc((100cqw - 38px) / 2), calc((100cqh - 28px) * 16 / 9)); }
.people-grid .tile .avatar.lg { width: clamp(44px, 22cqh, 96px); height: clamp(44px, 22cqh, 96px); }

/* Микрофон, пока выключен звук: серый и неактивный */
.icon-btn.mic-locked, .call-btn.mic-locked { opacity: .35; cursor: not-allowed; pointer-events: none; }

.update-toast { border-color: var(--ok); display: block; }
.update-toast .ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }

/* Кнопка и окно «Скачать Swich» */
.rail-item.dl { color: var(--ok); }
.rail-item.dl .ic { width: 22px; height: 22px; }
.rail-item.dl:hover { background: var(--ok); color: #fff; }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .dl-grid { grid-template-columns: 1fr; } }
.dl-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 14px; background: var(--bg3); border: 2px solid var(--border); }
.dl-card.rec { border-color: var(--accent); }
.dl-card .dl-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.dl-card .dl-ic .ic { width: 26px; height: 26px; }
.dl-card b { font-size: 18px; }
.dl-card small { color: var(--muted); }
.dl-card ul { margin: 6px 0 10px; padding-left: 18px; font-size: 13px; color: var(--muted); flex: 1; }
.dl-card .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.dl-card .btn .ic { width: 18px; height: 18px; }
.dl-steps { font-size: 13px; background: var(--bg2); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.dl-url { font-family: Consolas, monospace; color: var(--accent); }
.dl-steps b { font-size: inherit; }

/* Перетаскивание каналов */
#side-list .side-item[draggable="true"] { cursor: grab; }
.side-item.dd-dragging { opacity: .4; }
.side-item.dd-before { box-shadow: inset 0 2px 0 var(--accent); }
.side-item.dd-after { box-shadow: inset 0 -2px 0 var(--accent); }
.side-cat.dd-into { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 6px; }
