/* K-Group · прототип
   Вечерняя комната: глубокий сине-сланцевый фон и тёплый «ламповый» янтарь.
   Янтарное свечение вокруг аватара — главный акцент: так видно, кто говорит. */

:root {
  --night: #1c1f2b;
  --panel: #242838;
  --panel-2: #2c3144;
  --line: #373d54;
  --text: #eceae4;
  --dim: #9a9db0;
  --lamp: #f2b84b;
  --lamp-soft: rgba(242, 184, 75, 0.18);
  --danger: #e8615a;

  --font-display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --r-lg: 18px;
  --r-md: 12px;
  --r-pill: 999px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--night);
  color: var(--text);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Бренд ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--lamp); color: var(--night);
  font: 700 20px/1 var(--font-display);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-company { font: 700 16px/1.2 var(--font-display); }
.brand-app { color: var(--dim); font-size: 13px; }
.brand-small .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }

/* ---------- Кнопки ---------- */
.btn {
  border: 0; cursor: pointer; border-radius: var(--r-pill);
  padding: 12px 22px; font-weight: 600;
  transition: filter .15s, opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--lamp); color: var(--night); }
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }

/* ---------- Экран входа ---------- */
.join { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.join-card { width: min(440px, 100%); }
.join h1 {
  font: 700 clamp(26px, 5vw, 34px)/1.15 var(--font-display);
  letter-spacing: -0.01em;
  margin: 40px 0 12px;
}
.lead { color: var(--dim); margin: 0 0 32px; max-width: 38ch; }

#joinForm { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 500; font-size: 14px; }
.field small { color: var(--dim); font-size: 13px; }
.field input {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px;
}
.field input::placeholder { color: #6d7187; }
.field input:focus { border-color: var(--lamp); outline: none; }
#joinBtn { margin-top: 6px; justify-self: start; }
.link-btn {
  margin-top: 22px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--dim); font-size: 14px;
}
.link-btn:hover { color: var(--text); }
.set-group[hidden] { display: none; }
.join-error {
  margin: 0; padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(232, 97, 90, .12); color: #ffb3ae; font-size: 14px;
}

/* ---------- Приложение ---------- */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

/* Боковая панель */
.side {
  display: flex; flex-direction: column; min-height: 0;
  background: #181b26;
  border-right: 1px solid #2a2f42;
}
.side-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 14px 16px;
  border-bottom: 1px solid #2a2f42;
}
.brand-mark-small { width: 32px; height: 32px; border-radius: 9px; font-size: 16px; flex: none; }
.side-title { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.side-title strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-title span { color: var(--dim); font-size: 12px; }

.icon-btn {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: transparent; color: var(--dim); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn-leave:hover { color: #ffb3ae; }
.side-head { flex-wrap: wrap; }
.invite-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1 0 100%;
  padding: 7px 12px 7px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.invite-btn svg { width: 16px; height: 16px; }
.invite-btn:hover { border-color: var(--lamp); color: var(--lamp); }

.side-label { margin: 0 0 6px; padding: 0 10px; color: var(--dim); font-size: 13px; font-weight: 500; }

.channels { padding: 16px 8px 8px; }
.channel {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; border: 0;
  background: transparent; color: var(--dim); text-align: left; font-weight: 500;
}
.channel svg { width: 18px; height: 18px; }
.channel.is-active { background: var(--panel-2); color: var(--text); }
.channel-voice { cursor: pointer; margin-top: 2px; }
.channel-voice:hover { background: var(--panel); color: var(--text); }
.app.in-voice .channel-voice { color: var(--lamp); background: var(--lamp-soft); cursor: default; }
.channel-count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }

.voice-members { list-style: none; margin: 4px 0 0; padding: 0 0 0 20px; display: grid; gap: 2px; }
.vm {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 8px; font-size: 14px;
}
.vm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vm-icons { display: inline-flex; gap: 4px; color: var(--dim); }
.vm-icons svg { width: 15px; height: 15px; }
.vm-icons .muted-icon { color: var(--danger); }
.vm-icons .live { color: var(--night); background: var(--danger); border-radius: 5px; font-size: 11px; font-weight: 600; padding: 1px 6px; line-height: 1.4; }

.avatar {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel-2);
  font: 700 15px/1 var(--font-display);
  transition: box-shadow .12s ease-out;
}
.avatar-small { width: 32px; height: 32px; font-size: 13px; }
.avatar-tiny { width: 24px; height: 24px; font-size: 11px; }
/* Главный акцент: тёплое свечение вокруг того, кто говорит */
.vm.speaking .avatar { box-shadow: 0 0 0 2px var(--lamp), 0 0 12px 3px var(--lamp-soft); }

.online { padding: 12px 8px; flex: 1; min-height: 0; overflow-y: auto; }
.online-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.online-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; }
.online-list .ol-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-list .ol-you { color: var(--dim); font-size: 13px; }
.online-list svg { width: 15px; height: 15px; color: var(--lamp); }

/* Панель голосового канала */
.voice-bar {
  margin: 0 8px 8px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--panel);
}
.voice-status { margin: 0 0 8px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.voice-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.voice-status[data-state="ok"] { color: #7ed69a; }
.voice-status[data-state="ok"]::before { background: #7ed69a; }
.voice-status[data-state="connecting"]::before { background: var(--lamp); }
.voice-status[data-state="waiting"] { color: var(--dim); }
.voice-status[data-state="error"] { color: #ffb3ae; }
.voice-status[data-state="error"]::before { background: var(--danger); }
.voice-buttons { display: flex; gap: 8px; }
.vbtn {
  flex: 1; display: grid; place-items: center;
  height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer;
}
.vbtn:not(:disabled):hover { background: var(--line); }
.vbtn:disabled { opacity: .4; cursor: not-allowed; }
.vbtn .icon-off { display: none; }
#micBtn[aria-pressed="true"] { border-color: var(--danger); color: #ffb3ae; }
#micBtn[aria-pressed="true"] .icon-on { display: none; }
#micBtn[aria-pressed="true"] .icon-off { display: block; }
#shareBtn[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: var(--night); }
.vbtn-leave { color: #ffb3ae; }
.vbtn-leave:hover { border-color: var(--danger); }

/* Нижняя панель «я» */
.me-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 10px 14px;
  border-top: 1px solid #2a2f42;
  background: #151822;
}
.me-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-note { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-bar .icon-btn { width: 30px; }
.me-note .on-air { color: var(--lamp); font-weight: 600; }

/* Основная область */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage {
  position: relative; flex: 3 1 0; min-height: 200px;
  margin: 16px 16px 0;
  border-radius: var(--r-lg);
  background: #151822;
  overflow: hidden;
  display: grid; place-items: center;
}
.stage[hidden] { display: none; }
.stage-empty { text-align: center; padding: 24px; max-width: 44ch; }
.stage-empty-title { font: 500 17px/1.3 var(--font-display); margin: 0 0 6px; }
.stage-empty-text { color: var(--dim); margin: 0; }

.remote-video { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage.has-screen .remote-video { display: block; }
.stage.has-screen .stage-empty { display: none; }

.stage-btn {
  display: none;
  position: absolute; top: 12px; right: 12px;
  width: 38px; height: 38px; border-radius: 10px; border: 0; cursor: pointer;
  background: rgba(28, 31, 43, .75); color: var(--text);
  place-items: center;
}
.stage.has-screen .stage-btn { display: grid; }

.local-preview {
  position: absolute; left: 12px; bottom: 12px; margin: 0;
  width: min(220px, 35%);
  border-radius: var(--r-md); overflow: hidden;
  background: #000; border: 1px solid var(--line);
}
.local-preview video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }
/* Показываю только я — превью крупно по центру вместо пустой заглушки */
.stage.self-sharing:not(.has-screen) .stage-empty { display: none; }
.stage.self-sharing:not(.has-screen) .local-preview { position: static; width: min(640px, calc(100% - 32px)); }
.local-preview figcaption { font-size: 12px; padding: 4px 8px; background: var(--panel); color: var(--dim); }

/* Чат */
.chat { flex: 2 1 0; display: flex; flex-direction: column; min-height: 0; }
.app:not(.has-stage) .chat { flex: 1 1 auto; }
.chat-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 24px 12px; border-bottom: 1px solid #2a2f42;
}
.chat-head svg { color: var(--dim); }
.chat-head h2 { font: 500 16px/1.3 var(--font-display); margin: 0; }
.chat-head p { margin: 0; color: var(--dim); font-size: 13px; flex-basis: 100%; }
@media (min-width: 1100px) { .chat-head p { flex-basis: auto; margin-left: auto; } }

.messages {
  list-style: none; margin: 0; padding: 16px 24px;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 14px;
}
.msg { max-width: 72ch; }
.msg-meta { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.msg-author { font-weight: 600; }
.msg.mine .msg-author { color: var(--lamp); }
.msg-time { color: var(--dim); font-size: 12px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-system { color: var(--dim); font-size: 13px; }
.messages-empty { color: var(--dim); margin: auto; text-align: center; }

.chat-form { display: flex; gap: 8px; padding: 12px 24px 18px; }
.chat-form input {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 12px 18px;
}
.chat-form input:focus { border-color: var(--lamp); outline: none; }
.chat-form input:disabled, .btn-send:disabled { opacity: .5; }
.btn-send { background: var(--panel-2); padding: 10px 18px; }
.btn-send:not(:disabled):hover { background: var(--line); }

/* Приглашение */
.invite-row { display: flex; gap: 8px; }
.invite-row input {
  flex: 1; min-width: 0;
  background: var(--night); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 10px 16px;
}
.invite-row[hidden] { display: none; }

/* ---------- Кнопки: дополнительные ---------- */
.btn-secondary { background: var(--panel-2); border: 1px solid var(--line); }
.btn-secondary:not(:disabled):hover { background: var(--line); }
.btn-small { padding: 7px 14px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; border-radius: var(--r-pill); text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }
.btn-small:hover { background: var(--line); }
.btn-small.btn-active { border-color: var(--lamp); color: var(--lamp); }

/* ---------- Голосовой канал: дополнения ---------- */
.vm-clickable { cursor: pointer; }
.vm-clickable:hover { background: var(--panel); }
.vm-vol { font-size: 11px; color: var(--dim); }
.vbtn .icon-off { display: none; }
#deafenBtn[aria-pressed="true"] { border-color: var(--danger); color: #ffb3ae; }
#deafenBtn[aria-pressed="true"] .icon-on { display: none; }
#deafenBtn[aria-pressed="true"] .icon-off { display: block; }
.voice-buttons { gap: 6px; }
.vbtn svg { width: 18px; height: 18px; }
.voice-toast { margin: 8px 0 0; font-size: 13px; color: var(--lamp); }

.sharer-tabs {
  position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 80px);
}
.sharer-tabs button {
  border: 0; border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer;
  background: rgba(28, 31, 43, .8); color: var(--text); font-size: 13px; font-weight: 600;
}
.sharer-tabs button[aria-pressed="true"] { background: var(--lamp); color: var(--night); }

/* ---------- Сообщения ---------- */
.messages { gap: 2px; padding: 16px 16px 8px; }
.msg {
  position: relative; max-width: none;
  display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px;
  padding: 6px 8px; margin-top: 10px; border-radius: 10px;
}
.msg.grouped { margin-top: 0; padding-top: 2px; }
.msg.grouped .msg-avatar { visibility: hidden; height: 0; }
.msg.grouped .msg-meta { display: none; }
.msg:hover { background: rgba(255, 255, 255, .03); }
.msg-avatar { grid-row: 1 / span 2; }
.msg-body { min-width: 0; }
.msg-author { font-weight: 600; }
.msg.mine .msg-author { color: inherit; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text a { color: #8ec5ff; }
.msg-text.big-emoji { font-size: 34px; line-height: 1.25; }
.msg-system { padding: 4px 8px 4px 60px; margin-top: 6px; }

.msg-tools {
  position: absolute; top: -12px; right: 12px; display: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 2px;
}
.msg:hover .msg-tools, .msg:focus-within .msg-tools { display: flex; }
.msg-tool { border: 0; background: transparent; cursor: pointer; padding: 4px 8px; border-radius: 8px; font-size: 14px; }
.msg-tool:hover { background: var(--panel-2); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reactions:empty { display: none; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-pill); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); font-size: 14px;
}
.reaction:hover { border-color: var(--dim); }
.reaction.mine { background: var(--lamp-soft); border-color: var(--lamp); }
.reaction-count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Вложения */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-image {
  padding: 0; border: 0; background: #11131b; cursor: zoom-in;
  border-radius: 10px; overflow: hidden; max-width: min(360px, 100%);
}
.att-video { display: block; max-width: min(420px, 100%); max-height: 320px; border-radius: 10px; background: #000; }
.att-image img { display: block; max-width: 100%; max-height: 300px; object-fit: contain; }
.att-file {
  display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 360px;
  padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.att-file:hover { border-color: var(--dim); }
.att-icon {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 8px;
  background: var(--panel-2); color: var(--lamp); font-size: 11px; font-weight: 700;
}
.att-info, .pending-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att-size { color: var(--dim); font-size: 12px; }

/* ---------- Поле ввода ---------- */
.composer-wrap { padding: 0 16px 14px; }
.typing { margin: 0 0 4px 8px; min-height: 18px; font-size: 12px; color: var(--dim); }
.composer {
  display: flex; align-items: flex-end; gap: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 6px;
}
.composer:focus-within { border-color: var(--lamp); }
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; background: transparent; outline: none;
  padding: 8px 6px; max-height: 180px; line-height: 1.45;
}
.composer textarea::placeholder { color: #6d7187; }
.composer-btn, .composer-send {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px;
  border: 0; border-radius: 10px; background: transparent; color: var(--dim); cursor: pointer;
}
.composer-btn:hover { background: var(--panel-2); color: var(--text); }
.composer-send { background: var(--lamp); color: var(--night); }
.composer-send:disabled, .composer-btn:disabled { opacity: .45; cursor: default; }

.pending { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pending-item {
  position: relative; display: flex; align-items: center; gap: 10px; max-width: 260px;
  padding: 8px 32px 8px 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line);
}
.pending-item.error { border-color: var(--danger); }
.pending-item.error .att-size { color: #ffb3ae; }
.pending-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.pending-remove {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 6px;
  background: transparent; color: var(--dim); cursor: pointer; font-size: 18px; line-height: 1;
}
.pending-remove:hover { background: var(--panel-2); color: var(--text); }

.chat { position: relative; }
.drop-overlay {
  position: absolute; inset: 8px; display: grid; place-items: center; z-index: 5;
  border: 2px dashed var(--lamp); border-radius: var(--r-lg); background: rgba(28, 31, 43, .88);
  pointer-events: none;
}
.drop-overlay p { font: 500 18px/1.3 var(--font-display); color: var(--lamp); }

/* ---------- Всплывающие панели ---------- */
.popover {
  position: fixed; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.emoji-panel { width: 340px; max-height: 340px; overflow-y: auto; padding: 8px 10px 10px; }
.emoji-group { margin: 6px 4px 4px; color: var(--dim); font-size: 12px; font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-grid button, .reaction-panel button {
  border: 0; background: transparent; cursor: pointer; font-size: 22px; line-height: 1;
  padding: 6px 0; border-radius: 8px;
}
.emoji-grid button:hover, .reaction-panel button:hover { background: var(--panel-2); }
.reaction-panel { display: grid; grid-template-columns: repeat(6, 40px); padding: 6px; }

.soundboard-panel { width: 320px; padding: 12px; }
.soundboard-title { margin: 0 0 10px; color: var(--dim); font-size: 12px; }
.soundboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.soundboard-grid button {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; font-size: 13px; font-weight: 500;
}
.soundboard-grid button:hover { border-color: var(--lamp); }
.sb-emoji { font-size: 20px; }

.user-panel { width: 250px; padding: 14px; display: grid; gap: 10px; }
.user-panel-name { margin: 0; font-weight: 600; }
.user-panel input[type="range"] { width: 100%; accent-color: var(--lamp); }

/* ---------- Просмотр картинки ---------- */
.lightbox {
  max-width: 96vw; max-height: 96vh; padding: 0; border: 0; background: transparent;
  display: none; flex-direction: column; align-items: center; gap: 10px; overflow: visible;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: rgba(8, 9, 14, .88); }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 8px; cursor: zoom-out; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; color: var(--text); }
.lightbox-bar span { color: var(--dim); font-size: 14px; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Окна (приглашение, настройки) ---------- */
.dialog {
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--panel); color: var(--text);
}
.dialog::backdrop { background: rgba(12, 14, 20, .65); }
.dialog-body { padding: 22px 24px 20px; display: grid; gap: 20px; }
.dialog h2 { font: 500 20px/1.2 var(--font-display); margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; }

.set-group { display: grid; gap: 8px; }
.set-label { font-weight: 600; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-row output { color: var(--dim); font-variant-numeric: tabular-nums; }
.set-hint { margin: 0; color: var(--dim); font-size: 13px; }
.set-hint.warn { color: #ffb3ae; }
.invite-row { display: flex; gap: 8px; }
.invite-row input, .dialog input:not([type]), .dialog select {
  flex: 1; min-width: 0; width: 100%;
  background: var(--night); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px;
}
.dialog input:not([type]):focus, .dialog select:focus { border-color: var(--lamp); outline: none; }
.dialog input[type="range"] { width: 100%; accent-color: var(--lamp); }

/* Настройки: разделы слева, содержимое справа */
.settings { width: min(860px, calc(100% - 32px)); height: min(680px, calc(100% - 32px)); }
.settings[open] { display: flex; flex-direction: column; }
.settings-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.settings-nav {
  display: flex; flex-direction: column; gap: 2px; padding: 22px 12px 16px;
  background: #1f2231; border-right: 1px solid var(--line);
}
.settings-nav h2 { padding: 0 10px 12px; }
.settings-tab {
  text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 9px 12px; border-radius: 10px; color: var(--dim); font-weight: 500;
}
.settings-tab:hover { background: var(--panel); color: var(--text); }
.settings-tab[aria-selected="true"] { background: var(--panel-2); color: var(--text); }
.settings-nav-spacer { flex: 1; }
.settings-nav .link-btn { margin: 0; padding: 8px 12px; text-align: left; font-size: 13px; }
.settings-content { overflow-y: auto; padding: 22px 28px 12px; }
.settings-pane { display: grid; gap: 24px; }
.settings-pane h3 { font: 500 18px/1.2 var(--font-display); margin: 0; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-close { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); margin: 0; }

.level { position: relative; height: 8px; border-radius: 4px; background: var(--night); overflow: hidden; }
.level-bar { height: 100%; width: 0%; background: var(--dim); border-radius: 4px; transition: width .05s linear; }
.level-bar.active { background: var(--lamp); }
.level-marker { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; margin-left: -1px; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); cursor: pointer;
}
.mode:has(input:checked) { border-color: var(--lamp); background: var(--lamp-soft); }
.mode input { accent-color: var(--lamp); margin-top: 3px; }
.mode span, .switch-row > span { display: grid; gap: 2px; }
.mode small, .switch-row small { color: var(--dim); font-size: 13px; font-weight: 400; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 8px 0; cursor: pointer;
}
.switch-row + .switch-row { border-top: 1px solid rgba(255, 255, 255, .05); }
.switch {
  appearance: none; flex: none; width: 40px; height: 22px; border-radius: 11px; margin: 0;
  background: var(--line); position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform .15s;
}
.switch:checked { background: var(--lamp); }
.switch:checked::after { transform: translateX(18px); background: var(--night); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: var(--r-pill); font-weight: 500;
}
.pills button:hover { border-color: var(--dim); }
.pills button[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: var(--night); }

.ptt-key-wrap { display: inline-flex; align-items: center; gap: 8px; }
kbd {
  min-width: 36px; padding: 5px 10px; text-align: center;
  border-radius: 8px; border: 1px solid var(--line); border-bottom-width: 3px;
  background: var(--night); font: 600 14px/1.2 var(--font-body);
}
kbd.listening { border-color: var(--lamp); color: var(--lamp); }

.profile-preview { display: flex; align-items: center; gap: 14px; }
.profile-preview span:last-child { display: grid; }
.profile-preview small { color: var(--dim); }
.avatar-large { width: 64px; height: 64px; font-size: 24px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--night) inset; }

.avatar { color: var(--night); }

/* ---------- Эмодзи и стикеры ---------- */
.emoji-panel { width: 360px; height: 400px; max-height: 400px; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); flex: none; }
.panel-tabs button {
  border: 0; background: transparent; cursor: pointer; padding: 8px 12px; font-weight: 600; color: var(--dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.panel-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--lamp); }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.panel-empty { color: var(--dim); font-size: 13px; padding: 16px 6px; display: grid; gap: 10px; justify-items: start; }
.emoji-grid .custom-emoji-btn img, .emoji-grid .custom-emoji-btn video { width: 26px; height: 26px; object-fit: contain; display: block; margin: 0 auto; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.sticker-grid button { border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: 10px; aspect-ratio: 1; }
.sticker-grid button:hover { background: var(--panel-2); }
.sticker-grid img, .sticker-grid video { width: 100%; height: 100%; object-fit: contain; display: block; }

.custom-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin: 0 1px; cursor: pointer; }
.msg-text.big-emoji .custom-emoji { width: 48px; height: 48px; vertical-align: -10px; }

.msg-sticker .sticker { display: block; width: 160px; height: 160px; object-fit: contain; margin-top: 4px; }
.msg-sticker .sticker-btn { padding: 0; border: 0; background: transparent; cursor: pointer; }

.action-panel { padding: 6px; display: grid; gap: 2px; min-width: 200px; }
.action-panel button {
  text-align: left; border: 0; background: transparent; cursor: pointer; padding: 8px 10px; border-radius: 8px; font-weight: 500;
}
.action-panel button:hover { background: var(--panel-2); }
.action-panel p { margin: 4px 10px 6px; color: var(--dim); font-size: 12px; }

.pack-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pack-list { display: grid; gap: 10px; }
.pack-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; display: grid; gap: 10px; }
.pack-head { display: flex; align-items: center; gap: 10px; }
.pack-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-head input { flex: 1; min-width: 0; }
.pack-badge { font-size: 12px; color: var(--dim); white-space: nowrap; }
.pack-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.pack-preview img, .pack-preview video { width: 40px; height: 40px; object-fit: contain; }
.pack-preview.emoji img, .pack-preview.emoji video { width: 28px; height: 28px; }
.pack-card .link-btn { margin: 0; font-size: 13px; }
.pack-card .link-btn.danger:hover { color: #ffb3ae; }

/* ---------- Видеокружочки ---------- */
.circle { position: relative; width: 220px; height: 220px; margin-top: 4px; cursor: pointer; border-radius: 50%; }
.circle video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #000; display: block; }
.circle svg { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); pointer-events: none; }
.circle svg circle { fill: none; stroke: var(--lamp); stroke-width: 2.5; stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; }
.circle-badge {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  background: rgba(12, 14, 20, .7); color: #fff; border-radius: var(--r-pill); padding: 2px 10px; font-size: 12px;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.circle.playing .circle-badge .circle-mute { display: none; }

.circle-dialog { width: min(380px, calc(100% - 32px)); }
.circle-rec { padding: 24px; display: grid; justify-items: center; gap: 12px; }
.circle-rec-view { position: relative; width: 280px; height: 280px; }
.circle-rec-view video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #000; transform: scaleX(-1); }
.circle-ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); }
.circle-ring circle { fill: none; stroke: var(--danger); stroke-width: 2.5; stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.circle-timer { margin: 0; font: 500 18px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.circle-timer.rec::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: 8px; vertical-align: 2px; }
.circle-actions { display: flex; gap: 10px; }

/* ---------- Аватары с картинкой ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ol-clickable { cursor: pointer; }
.ol-clickable:hover { background: var(--panel); }
.msg-avatar, .msg-author { cursor: pointer; }

/* ---------- Профиль ---------- */
.profile-welcome { margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--lamp-soft); color: var(--lamp); font-size: 14px; }
.profile-preview-card { position: relative; }
.profile-preview-card, .profile-card { border-radius: 16px; overflow: hidden; background: var(--night); border: 1px solid var(--line); }
.pc-banner { height: 120px; background: linear-gradient(135deg, var(--lamp), #2c3144); }
.pc-avatar { position: absolute; left: 16px; top: 80px; width: 80px; height: 80px; font-size: 30px; border: 5px solid var(--night); box-sizing: content-box; }
.pc-info { display: grid; gap: 2px; padding: 12px 16px 16px 120px; min-height: 64px; }
.pc-info strong { font: 600 17px/1.3 var(--font-body); }
.pc-user { color: var(--dim); font-size: 13px; }
.pc-about { font-size: 14px; overflow-wrap: anywhere; }
.pc-status { color: var(--dim); font-size: 12px; margin-top: 4px; }
.profile-card { width: 320px; padding: 0; }
.profile-card .pc-banner { height: 110px; }
.profile-card .pc-avatar { top: 70px; }
.profile-card .pc-info { padding: 52px 16px 14px; }
.pc-edit { margin: 0 16px 14px; }

/* ---------- Обрезка аватара ---------- */
.crop-dialog { width: min(380px, calc(100% - 32px)); }
.crop-stage { display: grid; place-items: center; }
#cropCanvas { width: 280px; height: 280px; border-radius: 12px; background: #000; cursor: grab; touch-action: none; }
#cropCanvas:active { cursor: grabbing; }

/* ---------- Редактор рисования ---------- */
.editor-dialog { width: min(1100px, calc(100% - 24px)); max-height: calc(100% - 24px); }
.editor { display: grid; gap: 12px; padding: 18px 20px; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-history { display: flex; gap: 6px; flex-wrap: wrap; }
.editor-history .btn-small:disabled { opacity: .45; cursor: default; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.tool-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tool-group button {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-pill);
  padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.tool-group button[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: var(--night); }
.tool-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.tool-inline input[type="color"] { width: 34px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }
.tool-inline input[type="range"] { width: 120px; accent-color: var(--lamp); }
.tool-inline select { background: var(--night); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.ed-sticker-bar { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--night); border-radius: 10px; }
.ed-sticker-bar button { flex: none; width: 44px; height: 44px; border: 2px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; font-size: 26px; display: grid; place-items: center; }
.ed-sticker-bar button[aria-pressed="true"] { border-color: var(--lamp); }
.ed-sticker-bar img { width: 36px; height: 36px; object-fit: contain; }
.editor-bg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-bg-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-bg-swatch { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); cursor: pointer; }
.editor-stage { display: grid; place-items: center; background: #0d0f15; border-radius: 12px; padding: 10px; }
.editor-canvas-wrap { position: relative; width: 100%; max-height: 56vh; max-width: calc(56vh * 3); }
.editor-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; }
#edOverlay { touch-action: none; }
.ed-text-input {
  position: absolute; z-index: 2; min-width: 120px; background: rgba(0,0,0,.25); border: 1px dashed var(--lamp);
  border-radius: 4px; padding: 0 4px; font-weight: 700; outline: none;
}

/* ---------- Обои чата ---------- */
.chat-head-btn { margin-left: 4px; }
.chat.has-wall { background: var(--wall); }
.chat.has-wall::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: rgba(17, 19, 27, var(--wall-dim, .4));
}
.chat > * { position: relative; }
.chat > .drop-overlay { position: absolute; }
.chat.has-wall .chat-head { background: rgba(28, 31, 43, .55); backdrop-filter: blur(6px); }
.chat.has-wall .msg-system { text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.wall-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.wall-preset { aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.wall-preset[aria-pressed="true"] { border-color: var(--text); }
.wall-none { background: var(--night); border: 1px dashed var(--line); font-size: 12px; color: var(--dim); }

/* ---------- Анимированные стикеры ---------- */
.lottie-box { display: block; }
.lottie-box canvas { width: 100% !important; height: 100% !important; }
.sticker.lottie-box { width: 160px; height: 160px; }
.custom-emoji.lottie-box { display: inline-block; vertical-align: -5px; }
.sticker-grid .lottie-box, .pack-preview .lottie-box { width: 100%; height: 100%; aspect-ratio: 1; }
.pack-preview .lottie-box { width: 40px; height: 40px; }

/* ---------- Горячие клавиши, отчёт ---------- */
.hotkey-row { padding: 8px 0; }
.hotkey-row + .hotkey-row { border-top: 1px solid rgba(255, 255, 255, .05); }
.report-text {
  width: 100%; resize: vertical; min-height: 110px;
  background: var(--night); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px;
}
.report-text:focus { border-color: var(--lamp); outline: none; }
.report-actions { gap: 8px; flex-wrap: wrap; }

/* ---------- Вход ---------- */
.auth-step { display: grid; gap: 16px; }
.auth-step h1 { margin: 32px 0 0; }
.auth-step .lead { margin: 0; }
.inline-link { margin: 0; padding: 0; font-size: inherit; color: var(--lamp); }
.dev-note { margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--lamp-soft); color: var(--lamp); font-size: 14px; }
#codeInput { letter-spacing: .3em; font-size: 20px; font-variant-numeric: tabular-nums; }
.loading-screen { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--dim); }
.loading-screen .brand-mark { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.92); } }

/* ---------- Колонка групп ---------- */
.app { grid-template-columns: 72px 272px minmax(0, 1fr); }
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 0; background: #12141c; border-right: 1px solid #2a2f42; overflow-y: auto;
}
.rail-groups { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--line); }
.rail-btn {
  position: relative; width: 48px; height: 48px; flex: none; border: 0; cursor: pointer;
  border-radius: 50%; background: var(--panel-2); color: var(--text);
  display: grid; place-items: center; font: 700 15px/1 var(--font-display);
  transition: border-radius .15s, background .15s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { border-radius: 16px; }
.rail-group { background: var(--g); color: var(--night); }
.rail-group.active { border-radius: 16px; box-shadow: 0 0 0 3px var(--night), 0 0 0 5px var(--g); }
.rail-group.has-unread::after {
  content: ''; position: absolute; left: -12px; top: 50%; width: 6px; height: 10px; margin-top: -5px;
  border-radius: 0 4px 4px 0; background: var(--text);
}
.rail-add { color: #7ed69a; font-size: 26px; font-weight: 400; }
.rail-add:hover { background: #7ed69a; color: var(--night); }
.rail-dm { color: var(--dim); }

/* ---------- Шапка группы и каналы ---------- */
.group-title {
  display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0;
  border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 8px; text-align: left;
}
.group-title:hover { background: var(--panel); }
.group-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.group-title svg { width: 16px; height: 16px; color: var(--dim); }
.channel-section { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.channel-section:first-child { margin-top: 0; }
.section-add { border: 0; background: transparent; color: var(--dim); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.section-add:hover { color: var(--text); }
.channel-row { position: relative; display: flex; align-items: center; }
.channel-row .channel { flex: 1; min-width: 0; cursor: pointer; }
.channel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel:hover { background: var(--panel); color: var(--text); }
.channel.has-unread { color: var(--text); font-weight: 600; }
.channel.has-unread::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text); flex: none; }
.channel.in-this-voice { color: var(--lamp); background: var(--lamp-soft); }
.channel-edit {
  position: absolute; right: 4px; display: none; width: 26px; height: 26px; border: 0; border-radius: 6px;
  background: var(--panel-2); color: var(--dim); cursor: pointer; place-items: center;
}
.channel-edit svg { width: 15px; height: 15px; }
.channel-row:hover .channel-edit { display: grid; }
.channel-edit:hover { color: var(--text); }
.channels { overflow-y: auto; max-height: 50vh; }
.voice-members { padding-left: 26px; margin: 2px 0 6px; }
.online-list li.offline { opacity: .45; }
.ol-role { font-size: 12px; }
.side-head { flex-wrap: nowrap; }
.side-head .invite-btn { flex: none; width: auto; padding: 6px 10px; }
.side-head .invite-btn span { display: none; }
.app.in-voice .channel-voice:not(.in-this-voice) { color: var(--dim); background: transparent; cursor: pointer; }
.app.in-voice .channel-voice:not(.in-this-voice):hover { background: var(--panel); color: var(--text); }

/* ---------- Пустое состояние ---------- */
.empty-state { margin: auto; text-align: center; max-width: 420px; padding: 24px; display: grid; gap: 12px; justify-items: center; }
.empty-state h2 { font: 700 24px/1.2 var(--font-display); margin: 0; }
.empty-state p { color: var(--dim); margin: 0; }
.app.no-group .chat, .app.no-group .stage { display: none; }
.app.no-group .main { display: flex; }

/* ---------- Окна групп ---------- */
.dialog-tabs { padding: 0; margin-top: -6px; }
.danger-btn { color: #ffb3ae; margin-right: auto; }
.danger-btn:hover { border-color: var(--danger); }
.gs-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.gs-members li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.gs-members li span:nth-child(2) { flex: 1; }
.gs-members .link-btn { margin: 0; font-size: 13px; }
.link-btn.danger:hover { color: #ffb3ae; }
.test-invites { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.test-invites li { display: flex; align-items: center; gap: 12px; }
.test-invites code { font: 600 14px/1.4 ui-monospace, Consolas, monospace; background: var(--night); padding: 3px 8px; border-radius: 6px; }
.test-invites .link-btn { margin: 0; font-size: 13px; }

/* ---------- Друзья и личные сообщения ---------- */
.friends-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.friends-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 24px 0; border-bottom: 1px solid #2a2f42; }
.friends-head h2 { font: 500 16px/1.3 var(--font-display); margin: 0 0 8px; }
.friends-tabs { border: 0; padding: 0; }
.add-friend-tab { color: #7ed69a !important; }
.req-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; margin-left: 4px; }
.add-friend { padding: 16px 24px 0; display: grid; gap: 8px; max-width: 620px; }
.friends-list { list-style: none; margin: 0; padding: 10px 16px; overflow-y: auto; display: grid; gap: 2px; align-content: start; }
.friends-list li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; border-top: 1px solid rgba(255,255,255,.04); }
.friends-list li:hover { background: var(--panel); }
.fr-info { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.fr-info small { color: var(--dim); font-size: 12px; }
.fr-actions { display: flex; gap: 6px; }
.fr-actions button { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 500; }
.fr-actions button:hover { border-color: var(--dim); }
.fr-actions .fr-accept { background: #2f5d43; border-color: #2f5d43; }
.fr-actions .fr-danger:hover { border-color: var(--danger); color: #ffb3ae; }
.friends-empty { color: var(--dim); padding: 24px 8px; }
.avatar-wrap { position: relative; display: inline-grid; flex: none; }
.online-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: #7ed69a; border: 3px solid #181b26; }
.online-dot.off { background: #6d7187; }
.dm-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; text-align: left; color: var(--dim); }
.dm-row:hover { background: var(--panel); color: var(--text); }
.dm-row.is-active { background: var(--panel-2); color: var(--text); }
.dm-row.has-unread { color: var(--text); font-weight: 600; }
.dm-row .dm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-row.has-unread::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text); }
.home-friends-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; color: var(--dim); cursor: pointer; font-weight: 600; }
.home-friends-btn.is-active, .home-friends-btn:hover { background: var(--panel-2); color: var(--text); }
.rail-dm.active { background: var(--lamp); color: var(--night); border-radius: 16px; }
.rail-dm.has-unread::after { content: ''; position: absolute; right: 2px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid #12141c; }
.app.home .online { display: none; }
.app.home .channels { flex: 1; max-height: none; }
.app.home .chat-head-btn { display: none; }
.call-btn { margin-left: 8px; }
.app.home .chat-head > svg { display: none; }
.msg-call { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.msg-call.missed { color: #ffb3ae; }

.pc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 16px 14px; }
.home-hint { padding: 4px 10px; }

/* ---------- Окно звонка ---------- */
.call-overlay {
  position: fixed; right: 24px; bottom: 24px; z-index: 200; width: 280px;
  display: grid; justify-items: center; gap: 8px; padding: 22px 18px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.call-avatar .avatar { width: 84px; height: 84px; font-size: 32px; }
.call-overlay.ringing .call-avatar .avatar { animation: ringPulse 1.2s ease-out infinite; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(126,214,154,.6); } 100% { box-shadow: 0 0 0 22px rgba(126,214,154,0); } }
.call-overlay strong { font-size: 18px; }
.call-status { color: var(--dim); font-size: 14px; }
.call-actions { display: flex; gap: 28px; margin-top: 8px; }
.call-round { width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; }
.call-round svg { width: 24px; height: 24px; }
.call-accept { background: #3fa564; }
.call-decline { background: var(--danger); }
.call-round:hover { filter: brightness(1.1); }

/* ---------- Звонки: настройки, отрывок трека ---------- */
.ringback-info { margin: 0; font-size: 14px; }
.my-tunes, .friend-ringtones { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.my-tunes li, .friend-ringtones li { display: flex; align-items: center; gap: 10px; }
.my-tunes li > span, .friend-ringtones li > span:not(.avatar) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-ringtones select { max-width: 220px; background: var(--night); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.my-tunes .link-btn { margin: 0; font-size: 13px; }
.trim-dialog { width: min(700px, calc(100% - 32px)); }
#trimWave { width: 100%; height: 110px; background: var(--night); border-radius: 10px; }

/* ---------- Эффекты, шёпот ---------- */
.fx-panel { width: 320px; padding: 12px; }
.soundboard-grid button[aria-pressed="true"] { border-color: var(--lamp); background: var(--lamp-soft); }
#fxBtn { font-size: 17px; }
#fxBtn.fx-on { border-color: var(--lamp); background: var(--lamp-soft); }
.whisper-note { margin: 8px 0 0; font-size: 13px; color: var(--dim); }
.whisper-note.active { color: #c79bff; font-weight: 600; }
.whisper-note.incoming { color: #c79bff; font-weight: 600; }
.user-panel #userWhisper { justify-self: start; }
.hk-sub { display: block; color: var(--dim); font-size: 12px; }

/* ---------- Во что играю, поиск пати ---------- */
.activity-btn { font-size: 17px; }
.activity-panel { width: 340px; padding: 14px; display: grid; gap: 10px; max-height: 80vh; overflow-y: auto; }
.activity-panel .set-label { margin: 0; }
.activity-panel hr { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }
.act-current { margin: 0; font-size: 14px; }
.act-custom summary { cursor: pointer; color: var(--dim); font-size: 13px; }
.act-custom[open] { display: grid; gap: 8px; }
.act-custom .invite-row input { min-width: 0; width: 100%; background: var(--night); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.act-game-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.act-game-list li { display: flex; justify-content: space-between; gap: 8px; }
.act-game-list .link-btn { margin: 0; font-size: 12px; }
.lfg-form { display: grid; gap: 8px; }
.lfg-form input, .lfg-form select { width: 100%; background: var(--night); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.lfg-form select { width: auto; }
.lfg-active p { margin: 0 0 8px; font-size: 14px; }
.ol-namewrap { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.ol-namewrap .ol-name { flex: none; }
.ol-activity { font-size: 11px; color: #7ed69a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-lfg { color: var(--lamp); }
.pc-game { color: #7ed69a; font-size: 13px; margin-top: 4px; }
.pc-lfg { display: grid; gap: 6px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--lamp-soft); color: var(--lamp); font-size: 13px; justify-items: start; }
.lfg-board { padding: 12px 24px 0; display: grid; gap: 8px; }
.lfg-board .side-label { padding: 0; margin: 0; }
.lfg-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--lamp-soft); border: 1px solid rgba(242,184,75,.35); }
.lfg-info { flex: 1; min-width: 0; display: grid; }
.lfg-info span { color: var(--dim); font-size: 13px; }
.btn-small-primary { padding: 8px 14px; font-size: 13px; }

/* Панель голоса: семь кнопок в один ряд */
.voice-buttons { gap: 4px; }
.vbtn { min-width: 0; padding: 0; height: 36px; }
#watchBtn, #fxBtn { font-size: 15px; }

/* ---------- Совместный просмотр ---------- */
.watch-view { position: absolute; inset: 0; display: flex; flex-direction: column; background: #000; z-index: 1; }
.watch-host { flex: 1; min-height: 0; display: grid; place-items: center; }
.watch-host video, .watch-host iframe, .watch-host .watch-frame { width: 100%; height: 100%; border: 0; background: #000; }
.watch-error { color: #ffb3ae; padding: 24px; text-align: center; max-width: 480px; }
.watch-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: rgba(20,22,32,.92); }
.watch-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.watch-sync { color: var(--dim); font-size: 13px; }
.stage.watching-video .stage-btn { display: none; }
.stage .sharer-tabs { z-index: 2; }

/* ---------- Свои звуки ---------- */
.soundboard-grid button { position: relative; }
.sb-del { position: absolute; top: 2px; right: 6px; color: var(--dim); font-size: 14px; display: none; }
.soundboard-grid button:hover .sb-del { display: block; }
.sb-del:hover { color: #ffb3ae; }
.sb-add { justify-content: center; color: #7ed69a; border-style: dashed !important; }
.soundboard-panel { max-height: 70vh; overflow-y: auto; }

/* ---------- Мини-игры ---------- */
.row-disabled { opacity: .5; }
.games-panel { width: 340px; padding: 12px; }
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.games-grid button { display: grid; gap: 2px; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.games-grid button:hover { border-color: var(--lamp); }
.games-grid strong { font-size: 14px; }
.games-grid small { color: var(--dim); font-size: 12px; line-height: 1.3; }
.game-view { position: absolute; inset: 0; display: flex; flex-direction: column; background: radial-gradient(ellipse at top, #2c3144, #151822); z-index: 1; }
.game-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; place-items: center; padding: 20px; text-align: center; }
.game-big { font: 700 clamp(28px, 5vw, 46px)/1.15 var(--font-display); margin: 0; }
.game-sub { color: var(--dim); margin: 6px 0 0; }
.game-names { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.game-name { padding: 8px 14px; border-radius: var(--r-pill); background: var(--panel-2); border: 2px solid transparent; font-weight: 600; transition: transform .08s; }
.game-name.hot { border-color: var(--lamp); background: var(--lamp-soft); color: var(--lamp); transform: scale(1.08); }
.game-name.win { border-color: var(--lamp); background: var(--lamp); color: var(--night); transform: scale(1.15); }
.dice-row { display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-radius: 12px; }
.dice-row.best { background: var(--lamp-soft); }
.dice-faces { font-size: 40px; line-height: 1; }
.dice-list { display: grid; gap: 6px; }
.coin { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font: 700 22px/1 var(--font-display); background: linear-gradient(135deg, #f2b84b, #c98a1c); color: var(--night); margin: 0 auto 14px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.coin.flipping { animation: coinFlip .3s linear infinite; }
@keyframes coinFlip { 50% { transform: scaleX(0.05); } }
.ttt { display: grid; grid-template-columns: repeat(3, 84px); gap: 8px; margin: 14px auto; }
.ttt button { width: 84px; height: 84px; border-radius: 14px; border: 0; background: var(--panel-2); font: 700 40px/1 var(--font-display); cursor: pointer; color: var(--text); }
.ttt button:disabled { cursor: default; }
.ttt button.x { color: #6fb7ff; }
.ttt button.o { color: #ff8fa3; }
.ttt button.line { background: var(--lamp-soft); outline: 2px solid var(--lamp); }
.croc-word { font: 700 clamp(30px, 6vw, 52px)/1.1 var(--font-display); color: var(--lamp); letter-spacing: .02em; margin: 6px 0; }
.croc-mask { font: 600 30px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .25em; margin: 8px 0; }
.croc-timer { font-variant-numeric: tabular-nums; color: var(--dim); }
.croc-input { display: flex; gap: 8px; margin: 12px auto 0; max-width: 360px; }
.croc-input input { flex: 1; min-width: 0; background: var(--night); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 10px 14px; }
.croc-feed { list-style: none; margin: 12px auto 0; padding: 0; max-width: 360px; display: grid; gap: 3px; font-size: 13px; text-align: left; }
.croc-feed .ok { color: #7ed69a; font-weight: 600; }
.croc-scores { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; font-size: 13px; }
.croc-scores span { padding: 4px 10px; border-radius: var(--r-pill); background: var(--panel-2); }
.react-pad { width: min(420px, 90%); height: 200px; border-radius: 20px; border: 0; cursor: pointer; font: 700 34px/1 var(--font-display); color: #fff; margin: 0 auto; display: grid; place-items: center; }
.react-pad.wait { background: #a8423d; }
.react-pad.go { background: #3fa564; }
.react-pad.done { background: var(--panel-2); cursor: default; }
.react-list { list-style: none; padding: 0; margin: 14px auto 0; display: grid; gap: 4px; min-width: 240px; }
.react-list li { display: flex; justify-content: space-between; gap: 20px; padding: 6px 12px; border-radius: 10px; background: var(--panel-2); }
.react-list li:first-child { background: var(--lamp-soft); color: var(--lamp); font-weight: 700; }

/* ---------- Создатель группы, безопасность ---------- */
.online-list li.ol-section { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); padding: 8px 8px 2px; cursor: default; }
.online-list li.ol-section:hover { background: none; }
.online-list li.ol-owner .ol-name { color: var(--g); font-weight: 600; }
.pc-owner { color: var(--g); font-size: 13px; font-weight: 600; margin-top: 2px; }
.sec-line { margin: 0; }
.sec-note { color: var(--dim); font-size: 12px; }
.local-server-badge {
  position: fixed; left: 50%; top: 6px; transform: translateX(-50%); z-index: 50; pointer-events: none;
  font-size: 11px; color: var(--dim); background: rgba(20,22,32,.8); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: var(--r-pill);
}

/* ---------- Подсказки ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: var(--r-pill); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px;
}

@media (max-width: 820px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .rail { grid-row: 1 / span 2; }
}

/* ---------- Связь ---------- */
.conn-banner {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin: 0; padding: 8px 16px; font-size: 14px; font-weight: 500; text-align: center;
  background: var(--lamp-soft); color: var(--lamp);
}
.conn-banner[data-kind="error"] { background: rgba(232, 97, 90, .14); color: #ffb3ae; }
.conn-banner[data-kind="ok"] { background: rgba(126, 214, 154, .14); color: #7ed69a; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: auto; min-height: 100%; }
  .side { border-right: 0; border-bottom: 1px solid #2a2f42; }
  .online { max-height: 140px; }
  .stage { flex: none; aspect-ratio: 16 / 10; min-height: 0; margin: 12px 12px 0; }
  .chat { min-height: 70vh; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .settings-nav h2, .settings-nav-spacer { display: none; }
  .set-grid, .mode-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
