/* D.a.M.A.G. Games — общий стиль. Палитра снята с эмблемы студии. */

/* Шрифты лежат у нас, а не у Google: минус лишнее соединение, которое держало отрисовку.
   Оба шрифта переменные — один файл на все начертания. */
@font-face {
  font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/golos-cyr.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/golos-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Oswald'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(fonts/oswald-cyr.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Oswald'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(fonts/oswald-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #06070A;
  --panel: #0E1016;
  --panel2: #151822;
  --line: #262B38;
  --line2: #1B1F2A;
  --cy: #00ABFF;
  --vi: #5B40E3;
  --gold: #DDBA00;
  --ice: #9AE3F5;
  --fg: #EDF1F6;
  --mut: #98A1B2;
  --dim: #7E879A;
  --ok: #5CD98A;
  --bad: #EF5350;
  --pad: 60px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: 'Golos Text', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

img, svg, video, iframe { max-width: 100%; }

a { color: var(--cy); text-decoration: none; }
a:hover { color: var(--ice); }

h1, h2, h3 {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1;
  margin: 0;
}

.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 var(--pad); }

/* ---------------------------------------------------------------- шапка */

.top {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 76px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line2);
  position: sticky;
  top: 0;
  background: var(--ink);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; transition: opacity .15s; }
.brand:hover { opacity: .75; }
.brand img { width: 36px; height: 36px; display: block; }
.brand b {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 700; font-size: 18px; letter-spacing: .14em; color: var(--fg);
}
.brand span {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 600; font-size: 18px; letter-spacing: .14em; color: var(--cy);
}

.nav { display: flex; align-items: center; gap: 24px; font-size: 14px; font-weight: 500; }
.nav.mob { display: none; }
.nav a { color: var(--mut); transition: color .15s; white-space: nowrap; }
.top > .brand, .top .btn { flex-shrink: 0; }
.btn svg { flex-shrink: 0; }
.nav a:hover, .nav a.on { color: var(--fg); }
.spacer { flex-grow: 1; }

/* ---------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--cy); color: var(--ink);
  font-weight: 700; font-size: 15px; padding: 13px 22px;
  border: 0; cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.btn:hover { background: var(--ice); color: var(--ink); }
.btn.ghost { background: transparent; border: 1px solid #5A6274; color: #C6CEDB; }
.btn.ghost:hover { border-color: var(--fg); color: var(--fg); background: transparent; }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #F0CE1A; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: 9px 14px; font-size: 13px; }

/* ---------------------------------------------------------------- поля */

label { display: block; font-size: 13px; font-weight: 600; color: var(--mut); margin-bottom: 7px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=search], input[type=number], input[type=tel], textarea, select {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  color: var(--fg); font-family: inherit; font-size: 15px; padding: 12px 14px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--cy); outline-offset: -1px; }
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
input[type=file] { color: var(--mut); font-size: 14px; }
.field { margin-bottom: 20px; }
.hint { font-size: 13px; color: var(--dim); margin-top: 6px; }

/* ---------------------------------------------------------------- блоки */

.split-top { height: 6px; background: var(--cy); }
.split-bot { height: 6px; background: var(--vi); }

.card { border: 1px solid var(--line); background: var(--panel); }
.panel { border: 1px solid var(--line); background: var(--panel); padding: 26px 28px; }

.msg { border-left: 3px solid var(--cy); background: var(--panel); padding: 14px 18px; margin-bottom: 22px; font-size: 15px; }
.msg.err { border-left-color: var(--bad); color: #F0B4B2; }
.msg.ok { border-left-color: var(--ok); }

.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-size: 13px; font-weight: 600; letter-spacing: .28em; color: var(--gold);
  margin-bottom: 16px;
}
.eyebrow::before { content: ''; width: 26px; height: 3px; background: var(--gold); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--mut); font-size: 12px; font-weight: 600; padding: 6px 11px;
}
.badge.pending { border-color: #4A3E00; background: #1A1600; color: var(--gold); }
.badge.approved { border-color: #17402B; background: #0A1A12; color: var(--ok); }
.badge.rejected { border-color: #4A2020; background: #140A0A; color: var(--bad); }

/* ---------------------------------------------------------------- сетка игр */

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.game-card { display: block; border: 1px solid var(--line); background: var(--panel); overflow: hidden; transition: border-color .15s, transform .15s; }
.game-card:hover { border-color: var(--cy); transform: translateY(-3px); }
.game-card .cover { aspect-ratio: 16 / 10; background: #0A0C12; display: block; width: 100%; object-fit: cover; }
.game-card .nocover { aspect-ratio: 16 / 10; background: linear-gradient(135deg, #0A0C12, #151822); display: flex; align-items: center; justify-content: center; }
.game-card .body { padding: 16px 18px 18px; }
.game-card h3 { font-size: 20px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.game-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--mut); }
.game-card .meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--dim); }

.tag { display: inline-block; border: 1px solid var(--line); color: var(--mut); font-size: 12px; padding: 4px 9px; margin: 0 6px 6px 0; }
a.tag:hover { border-color: var(--cy); color: var(--ice); }
a.tag.on { background: var(--cy); border-color: var(--cy); color: var(--ink); }

/* ---------------------------------------------------------------- голоса и комментарии */

.vote { display: flex; align-items: center; gap: 10px; }
.vote button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--mut);
  font-family: inherit; font-size: 15px; font-weight: 600; padding: 11px 18px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.vote button:hover { border-color: var(--cy); color: var(--fg); }
.vote button.on.up { border-color: var(--ok); color: var(--ok); background: #0A1A12; }
.vote button.on.down { border-color: var(--bad); color: var(--bad); background: #140A0A; }

.comment { border-top: 1px solid var(--line2); padding: 20px 0; }
.comment:first-child { border-top: 0; }
.comment .who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment .who b { font-size: 14px; color: var(--fg); }
.comment .who time { font-size: 13px; color: var(--dim); }
.comment p { margin: 0; font-size: 15px; line-height: 1.6; color: #C6CEDB; white-space: pre-wrap; word-wrap: break-word; }

/* ---------------------------------------------------------------- таблица админки */

table.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rows th { text-align: left; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
table.rows td { padding: 14px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.rows tr:hover td { background: var(--panel); }
table.rows tr.unseen td { background: #15130A; }
table.rows tr.unseen td:first-child { box-shadow: inset 3px 0 0 var(--gold); color: var(--gold); }

/* ---------------------------------------------------------------- подвал */

.foot { border-top: 1px solid var(--line2); margin-top: 80px; padding: 34px var(--pad) 46px; display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.foot .small { font-size: 13px; color: var(--dim); }

/* ---------------------------------------------------------------- адаптив */

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .top { gap: 16px; }
  .nav { gap: 16px; font-size: 13px; }
  .nav a:nth-child(n+4) { display: none; }
  .brand b, .brand span { letter-spacing: .08em; font-size: 16px; }
  .submit-btn { width: 44px; padding: 0; justify-content: center; }
  .submit-btn span { display: none; }
}
@media (max-width: 820px) {
  :root { --pad: 22px; }
  .grid, .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav.mob { display: flex; gap: 16px; font-size: 13px; overflow-x: auto; padding: 12px var(--pad); border-bottom: 1px solid var(--line2); }
}
@media (max-width: 520px) {
  .grid, .grid.g3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- просмотр скриншотов */

a.shot { display: block; cursor: zoom-in; }
a.shot img { transition: opacity .15s; }
a.shot:hover img { opacity: .82; }

.lightbox {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(4, 5, 9, .93);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.lightbox.on { display: block; }
/* Подложка идёт по разметке после кнопок, поэтому без явных слоёв она их
   перекрывала: клик по стрелке попадал в подложку и закрывал просмотр
   вместо листания. Кнопки — выше, подложка — ниже. */
.lightbox .lb-stage {
  position: absolute; inset: 0; margin: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 64px 76px;
}
.lightbox .lb-stage img {
  display: block; max-width: 100%; max-height: calc(100vh - 150px);
  border: 1px solid var(--line); background: #05060B; object-fit: contain;
}
.lightbox figcaption {
  font-family: Oswald, 'Arial Narrow', sans-serif; font-size: 13px;
  letter-spacing: .16em; color: var(--dim);
}
.lightbox button {
  position: absolute; z-index: 2;
  border: 1px solid var(--line); background: rgba(14, 16, 22, .9);
  color: var(--mut); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
}
.lightbox button:hover { border-color: var(--cy); color: var(--fg); background: var(--panel); }
.lightbox button[hidden] { display: none; }
.lightbox .lb-close { top: 18px; right: 18px; width: 42px; height: 42px; }
.lightbox .lb-dl {
  position: absolute; z-index: 2; top: 18px; right: 70px; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: rgba(14, 16, 22, .9); color: var(--mut);
}
.lightbox .lb-dl:hover { border-color: var(--cy); color: var(--fg); }
.lightbox .lb-dl[hidden] { display: none; }
.att.img a { display: block; cursor: zoom-in; }
.lightbox .lb-nav { top: 50%; margin-top: -26px; width: 44px; height: 52px; }
.lightbox .lb-prev { left: 16px; }
.lightbox .lb-next { right: 16px; }

@media (max-width: 620px) {
  .lightbox .lb-stage { padding: 60px 14px 76px; }
  .lightbox .lb-nav { top: auto; bottom: 16px; margin-top: 0; }
  .lightbox .lb-prev { left: 24%; }
  .lightbox .lb-next { right: 24%; }
}

/* ================================================================ платформы */

.plat {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--mut); font-size: 12px; font-weight: 600; padding: 6px 11px;
  white-space: nowrap;
}
.plat svg { flex: 0 0 auto; }
.plat.big { color: var(--ice); border-color: #234A5C; background: #08161C; padding: 7px 13px; font-size: 13px; }
.plat.mini { padding: 4px 8px; font-size: 11px; gap: 5px; background: rgba(6, 7, 10, .82); }

/* ============================================================ ряд-подборка */

.row-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.row-head h2 { font-size: clamp(24px, 3.6vw, 36px); }
.row-head .note { font-size: 14px; color: var(--mut); margin-top: 8px; }
.row-head .more {
  font-family: 'Oswald', 'Arial Narrow', sans-serif; font-weight: 600;
  font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--cy);
  white-space: nowrap; padding-bottom: 4px;
}
.row-head .more span { display: inline-block; transition: transform .15s; }
.row-head .more:hover span { transform: translateX(4px); }

/* Карточка: значки платформ поверх обложки */
.game-card .shell { position: relative; display: block; }
.game-card .plats { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; }

/* ================================ переключатель платформы в каталоге */

.pick {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--mut); padding: 10px 14px; font-size: 14px;
  transition: border-color .15s, color .15s, background .15s;
}
.pick .ic { display: inline-flex; align-items: center; gap: 3px; color: var(--dim); }
.pick b { font-weight: 600; color: #C6CEDB; }
.pick i { font-style: normal; font-size: 12px; color: var(--dim); }
.pick:hover { border-color: var(--cy); color: var(--fg); }
.pick:hover b, .pick:hover .ic { color: var(--fg); }
.pick.on { border-color: var(--cy); background: #071A26; }
.pick.on b, .pick.on .ic { color: var(--cy); }
.pick.on i { color: var(--ice); }

/* ================================================================= каталог */

.cat-top { padding-top: 40px; padding-bottom: 18px; }
.cat-top .eyebrow { margin-bottom: 0; }

.cat-layout {
  display: grid; grid-template-columns: 264px minmax(0, 1fr);
  gap: 34px; align-items: start; padding-top: 30px; scroll-margin-top: 90px;
}

.side { position: sticky; top: 92px; }
.side-toggle { display: none; width: 100%; justify-content: center; margin-bottom: 14px; }
.side-box { border: 1px solid var(--line); background: var(--panel); padding: 16px 16px 18px; margin-bottom: 14px; }
.side-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif; font-size: 13px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--dim); margin-bottom: 12px;
}
.side-clear { font-family: 'Golos Text', sans-serif; font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--cy); }

.plat-pick { display: flex; flex-direction: column; gap: 8px; }
.plat-pick .pick { justify-content: flex-start; }
.plat-pick .pick i { margin-left: auto; }

.side-list { display: flex; flex-direction: column; }
.side-list.tags { max-height: 320px; overflow-y: auto; margin-right: -6px; padding-right: 6px; }
.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--mut); font-size: 14px; padding: 8px 10px; border-left: 2px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.side-link i { font-style: normal; font-size: 12px; color: var(--dim); }
.side-link:hover { color: var(--fg); background: var(--panel2); }
.side-link.on { color: var(--cy); border-left-color: var(--cy); background: #071A26; }
.side-link[hidden] { display: none; }

/* Теги набираются, а не выбираются по одному: слева галочка или плюс,
   уже набранные подняты в начало списка. */
.side-list.tags .side-link { gap: 4px; }
.side-list.tags .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-list.tags .tick {
  flex: 0 0 14px; text-align: center; font-size: 12px; line-height: 1;
  color: var(--dim); opacity: .55; transition: opacity .12s, color .12s;
}
.side-list.tags .side-link:hover .tick { opacity: 1; color: var(--fg); }
.side-list.tags .side-link.on .tick { opacity: 1; color: var(--cy); }
.side-list.tags .side-link.on .nm { font-weight: 600; }
.side-list.tags .side-link.on + .side-link:not(.on) { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.side-empty { font-size: 13px; color: var(--dim); padding: 8px 10px; }

.side-find {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  border: 1px solid var(--line); background: var(--ink); padding: 0 10px; color: var(--dim);
}
.side-find input {
  flex: 1 1 auto; width: 100%; min-width: 0; border: 0; background: transparent;
  color: var(--fg); font-size: 14px; padding: 9px 0;
}
.side-find input::placeholder { color: var(--dim); }
.side-find input:focus { outline: 0; }
.side-reset { width: 100%; justify-content: center; }

.cat-main { min-width: 0; }

.findbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 24px; }
.findbar-in {
  flex: 1 1 300px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--panel); padding: 0 14px; color: var(--dim);
}
.findbar-in input {
  flex: 1 1 auto; width: 100%; min-width: 0; border: 0; background: transparent;
  color: var(--fg); padding: 12px 0; font-size: 15px;
}
.findbar-in input::placeholder { color: var(--dim); }
.findbar-in input:focus { outline: 0; }
.findbar-in:focus-within { border-color: var(--cy); }
.findbar-sort { display: flex; align-items: center; gap: 8px; margin: 0; }
.findbar-sort span { font-size: 13px; color: var(--dim); white-space: nowrap; }
.findbar-sort select { width: auto; padding: 11px 12px; font-size: 14px; }

.cat-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-head h2 { font-size: clamp(22px, 3vw, 32px); }
.cat-count { font-size: 13px; color: var(--dim); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--cy); background: #071A26; color: var(--ice);
  font-size: 12px; font-weight: 600; padding: 6px 11px;
}
.chip:hover { background: var(--cy); color: var(--ink); }

.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 34px; }
.pg {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px;
  padding: 0 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--mut); font-size: 14px; font-weight: 600;
}
.pg:hover { border-color: var(--cy); color: var(--fg); }
.pg.on { background: var(--cy); border-color: var(--cy); color: var(--ink); }
.pg.dots { border-color: transparent; background: transparent; min-width: 20px; padding: 0 2px; }

/* ============================================================ SEO-подвязка */

/* Мелко и приглушённо: текст для поисковых роботов, а не для чтения. */
.seo { padding-top: 56px; max-width: 1000px; }
.seo p { font-size: 11.5px; line-height: 1.6; color: var(--dim); margin: 0 0 8px; }
.seo p b { color: var(--mut); font-weight: 600; }
.seo .links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.seo .links a { border: 1px solid #1F2430; color: var(--dim); font-size: 11.5px; padding: 4px 8px; }
.seo .links a:hover { border-color: var(--cy); color: var(--ice); }

/* ==================================================== комментарии по центру */
/* Не у левого края и не строго посередине: колонка стоит чуть левее центра —
   так она читается как продолжение текста страницы, а не как отдельный столбец. */
.talk { max-width: 900px; margin-left: max(0px, calc(50% - 540px)); margin-right: auto; }

/* ================================================= предпросмотр вложений */

[data-pick] .thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
[data-pick] .thumbs:empty { display: none; }
.thumb {
  position: relative; width: 128px; border: 1px solid var(--line); background: var(--panel2);
  padding: 6px; display: flex; flex-direction: column; gap: 6px;
}
.thumb img { display: block; width: 100%; height: 76px; object-fit: cover; background: #05060B; }
.thumb .ext {
  height: 76px; display: flex; align-items: center; justify-content: center;
  background: #05060B; color: var(--cy);
  font-family: 'Oswald', 'Arial Narrow', sans-serif; font-size: 20px; letter-spacing: .08em;
}
.thumb .cap { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .x {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px;
  border: 1px solid var(--line); background: var(--ink); color: var(--mut);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.thumb .x:hover { border-color: var(--bad); color: var(--bad); }
[data-pick] .count { font-size: 13px; color: var(--gold); margin-top: 8px; min-height: 1px; }

/* Кнопки-переключатели платформы в форме */
.plat-radio { display: flex; gap: 10px; flex-wrap: wrap; }
.plat-radio label {
  display: inline-flex; align-items: center; gap: 9px; margin: 0; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--mut);
  padding: 12px 16px; font-size: 14px; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.plat-radio label:hover { border-color: var(--cy); color: var(--fg); }
.plat-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.plat-radio label.on { border-color: var(--cy); background: #071A26; color: var(--cy); }
.plat-radio .ic { display: inline-flex; gap: 4px; }

form.vote.busy { opacity: .6; pointer-events: none; }

/* ==================================================== адаптив новых блоков */

@media (max-width: 1100px) {
  .cat-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 900px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .side-toggle { display: inline-flex; }
  .side-body { display: none; }
  .side-body.open { display: block; }
  .side-list.tags { max-height: 260px; }
  .talk { margin-left: 0; }
}
@media (max-width: 620px) {
  .findbar-sort { flex: 1 1 100%; }
  .findbar-sort select { flex: 1 1 auto; }
  .thumb { width: calc(50% - 5px); }
}

/* ============================================== страница игры и мелочи вёрстки */

.gamepage {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 46px; align-items: start; margin-top: 22px;
}
.shots-grid { margin-top: 36px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* Место под скриншот занимаем заранее: иначе при догрузке страница дёргается. */
.shots-grid img { aspect-ratio: 16 / 10; object-fit: cover; background: #0A0C12; }

/* ==================================================================== ТЕЛЕФОН
   Шапка, сетки и формы на узком экране. Правило одно: ничего не должно
   уезжать вбок, а всё, во что тыкают пальцем, — не меньше 44 px в высоту. */

@media (max-width: 900px) {
  .gamepage { grid-template-columns: minmax(0, 1fr); gap: 30px; }
}

@media (max-width: 820px) {
  /* Шапка: логотип и одна главная кнопка в строке, остальное — во второй */
  .top {
    height: auto; min-height: 60px; gap: 10px 12px;
    padding: 10px var(--pad); flex-wrap: wrap;
  }
  .top .brand img { width: 30px; height: 30px; }
  .top .brand b, .top .brand span { font-size: 15px; letter-spacing: .1em; }
  .top .spacer { flex-basis: 0; }
  .top .btn.sm { padding: 10px 13px; }

  .nav.mob { position: sticky; top: 0; z-index: 39; background: var(--ink); }
  .nav.mob a { white-space: nowrap; }

  /* Заголовки и отступы: гигантские кегли на 400 px читаются хуже, а не лучше */
  .wrap { padding: 0 var(--pad); }
  .panel { padding: 20px 18px; }
  .row-head { gap: 10px; margin-bottom: 18px; }
  .row-head .more { font-size: 13px; }

  .findbar { gap: 8px; }
  .findbar > .btn { width: 100%; justify-content: center; }
  .findbar-in input { padding: 13px 0; font-size: 16px; }  /* 16px — иначе iOS зумит форму */

  input[type=text], input[type=email], input[type=password],
  input[type=url], input[type=search], textarea, select { font-size: 16px; }

  .vote { flex-wrap: wrap; }
  .vote button { flex: 1 1 auto; justify-content: center; min-height: 46px; }

  .plat-radio label { flex: 1 1 100%; min-height: 48px; }
  .plat-pick .pick { min-height: 48px; }
  .side-link { padding: 11px 10px; }

  /* Таблицы админки и профиля: прокрутка вбок вместо ломаной вёрстки */
  table.rows { display: block; overflow-x: auto; white-space: nowrap; }
  table.rows td, table.rows th { padding: 10px 8px; }

  .foot { margin-top: 50px; padding: 26px var(--pad) 34px; gap: 16px; }
}

@media (max-width: 620px) {
  /* Логотип отдельной строкой, кнопки — поровну под ним: так они попадают под палец */
  .top { padding: 9px var(--pad); }
  .top .brand { flex: 1 1 100%; }
  .top .spacer { display: none; }
  .top .btn { flex: 1 1 0; justify-content: center; }
  .shots-grid { grid-template-columns: minmax(0, 1fr); margin-top: 26px; }
  .cat-top { padding-top: 28px; }
  .cat-head { margin-bottom: 12px; }
  .talk .panel { padding: 4px 18px; }
  .game-card .body { padding: 14px 15px 16px; }
  .game-card h3 { font-size: 18px; }
  .seo { padding-top: 40px; }
}

/* ================================================================ люди и общение */

/* вкладки: админка, друзья, настройки */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.tabs a { padding: 11px 16px; color: var(--mut); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--fg); }
.tabs a.on { color: var(--fg); border-bottom-color: var(--cy); }
.tabs .n { background: var(--gold); color: var(--ink); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.tabs .n.dim { background: var(--line); color: var(--mut); }

/* значки в шапке: колокольчик, сообщения, лента модерации */
.btn.icon { padding: 9px 11px; position: relative; gap: 6px; }
.btn.icon.lit { border-color: var(--cy); color: var(--fg); }
.btn .cnt, .chat-item .cnt {
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}

.who-link { color: var(--fg); font-weight: 600; }
.who-link:hover { color: var(--cy); }
.linkish { background: none; border: 0; color: var(--dim); font-size: 12px; cursor: pointer; font-family: inherit; padding: 0; }
.linkish:hover { color: var(--bad); }
.btn.subtle { border-color: var(--line); color: var(--dim); }

/* аватар-буква: своих картинок у аккаунтов нет */
.ava {
  width: 84px; height: 84px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--vi), var(--cy)); color: #fff;
  font-size: 40px; font-weight: 700;
}
.ava.ava-sm { width: 38px; height: 38px; font-size: 17px; }
.ava.grp { background: linear-gradient(135deg, #3A2F00, var(--gold)); }

.profile-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

.people { padding: 4px 22px; }
.person { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line2); }
.person:last-child { border-bottom: 0; }
.person .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* оповещения */
.note { padding: 16px 0; border-bottom: 1px solid var(--line2); display: grid; gap: 6px; }
.note:last-child { border-bottom: 0; }
.note.unseen { box-shadow: inset 3px 0 0 var(--gold); padding-left: 14px; margin-left: -14px; }
.note .line { color: #C6CEDB; }
.note .quote { color: var(--mut); font-size: 14px; border-left: 2px solid var(--line); padding-left: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note time { color: var(--dim); font-size: 12px; }

/* настройки */
.settings h2 { font-size: 24px; margin: 40px 0 14px; scroll-margin-top: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; font-weight: 500; color: #C6CEDB; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--cy); flex: none; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); }
.seg label { margin: 0; padding: 10px 16px; cursor: pointer; color: var(--mut); font-size: 14px; border-right: 1px solid var(--line); position: relative; }
.seg label:last-child { border-right: 0; }
.seg label.on, .seg label:has(input:checked) { background: var(--cy); color: var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.danger-zone { border-color: #4A2020; }

/* ---------------------------------------------------------------- чаты */

.chat-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0; padding-top: 28px; }
.chat-list { border: 1px solid var(--line); border-right: 0; background: var(--panel); display: flex; flex-direction: column; height: calc(100vh - 120px); min-height: 480px; }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--line2); }
.chat-list-head h1 { font-size: 22px; }
.chat-list [data-chat-list] { overflow-y: auto; flex: 1; }
.chat-list .empty { color: var(--mut); font-size: 14px; padding: 16px; }
.chat-item { display: flex; gap: 11px; align-items: center; padding: 11px 16px; color: var(--fg); border-bottom: 1px solid var(--line2); }
.chat-item:hover { background: var(--panel2); color: var(--fg); }
.chat-item.on { background: var(--panel2); box-shadow: inset 3px 0 0 var(--cy); }
.chat-item .t { flex: 1; min-width: 0; display: grid; }
.chat-item .t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .t small { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-main { border: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; height: calc(100vh - 120px); min-height: 480px; position: relative; }
.chat-main > .back-link, .chat-main > h2, .chat-main > form.panel { margin-left: 22px; margin-right: 22px; }
.chat-main > .back-link { margin-top: 18px; }
.chat-main > form.panel { border: 0; padding: 0; background: none; }
.chat-empty { margin: auto; text-align: center; color: var(--dim); padding: 40px; }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head small { color: var(--dim); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mob-only { display: none; }
.back-link { color: var(--mut); font-size: 14px; }

.group-panel { margin: 0; border-width: 0 0 1px; max-height: 50vh; overflow-y: auto; }
.gp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.gp-grid h3 { font-size: 15px; margin: 0 0 10px; letter-spacing: .06em; }
.gp-grid form + h3 { margin-top: 18px; }
.gp-member { display: flex; gap: 10px; align-items: center; padding: 5px 0; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { padding: 9px 12px; }

.msgs { flex: 1; overflow-y: auto; padding: 16px 20px 10px; display: flex; flex-direction: column; }
.msgs .empty { color: var(--dim); text-align: center; margin: auto; }
.msgs .older { align-self: center; margin-bottom: 12px; }
.m { padding: 6px 0 2px; max-width: 760px; }
.m.cont { padding-top: 0; }
.m.cont .h { display: none; }
.m .h { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.m .h time { color: var(--dim); font-size: 11px; }
.m .h .linkish { visibility: hidden; }
.m:hover .h .linkish { visibility: visible; }
.m .b { color: #D3D9E3; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 15px; }
.m.mine .h .who-link { color: var(--cy); }
.m.del .b { color: var(--dim); font-style: italic; font-size: 13px; }
.m.sys-row { align-self: center; text-align: center; padding: 8px 0; }
.sys { color: var(--dim); font-size: 12px; }
img.emo { width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }
img.emo.big { width: 48px; height: 48px; }

.composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 46px; max-height: 200px; resize: none; padding: 12px 14px; flex: 1; overflow-y: hidden; }
.composer .btn { height: 46px; }
.composer-off { margin: 12px 16px; }

/* кнопка эмодзи справа от поля и панель, прижатая к его правому краю */
.emo-host { position: relative; }
.emo-btn {
  background: var(--panel2); border: 1px solid var(--line); color: var(--mut);
  height: 46px; width: 46px; cursor: pointer; flex: none; display: grid; place-items: center; padding: 0;
  transition: color .15s, border-color .15s;
}
.emo-btn:hover, .emo-btn:focus-visible { color: var(--fg); border-color: var(--cy); }
.emo-wrap { display: block; position: relative; }
.emo-wrap .emo-btn { position: absolute; right: 6px; bottom: 6px; height: 34px; width: 34px; background: transparent; border-color: transparent; }
.emo-wrap .emo-btn:hover { border-color: var(--line); }
.emo-wrap textarea, .emo-wrap input { padding-right: 48px; }
.emo-wrap input + .emo-btn { top: 50%; bottom: auto; transform: translateY(-50%); }

.emo-pop {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 100;
  width: 352px; max-width: calc(100vw - 24px); height: 380px;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.emo-pop.below { bottom: auto; top: calc(100% + 8px); }
.emo-pop[hidden] { display: none; }
.emo-top { padding: 8px; border-bottom: 1px solid var(--line2); }
.emo-top input { padding: 8px 10px; font-size: 14px; background: var(--panel2); }
.emo-tabs { display: flex; border-bottom: 1px solid var(--line2); flex: none; }
.emo-tabs.dim { opacity: .45; }
.emo-tab {
  flex: 1 1 0; min-width: 0; height: 36px; display: grid; place-items: center;
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--dim); cursor: pointer; padding: 0;
}
.emo-tab:hover { color: var(--fg); }
.emo-tab.on { color: var(--fg); border-bottom-color: var(--cy); }
.emo-tab img { display: block; filter: grayscale(.6); opacity: .8; }
.emo-tab.on img, .emo-tab:hover img { filter: none; opacity: 1; }
.emo-body { flex: 1; overflow-y: auto; position: relative; padding: 0 6px 6px; scrollbar-width: none; }
.emo-body::-webkit-scrollbar { display: none; }
.emo-sec[hidden] { display: none; }
.emo-h {
  position: sticky; top: 0; z-index: 1; background: var(--panel);
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 8px 4px 6px;
}
.emo-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.emo-cell { background: none; border: 0; font-size: 24px; height: 40px; cursor: pointer; border-radius: 6px; padding: 0; display: grid; place-items: center; line-height: 1; }
.emo-cell[hidden] { display: none; }
.emo-cell:hover { background: var(--panel2); }
.emo-cell img { width: 30px; height: 30px; object-fit: contain; }
.emo-none { color: var(--dim); font-size: 13px; padding: 14px 6px; }

/* подвал: документы */
.foot .legal { flex-basis: 100%; font-size: 12px; color: var(--dim); }
.foot .legal a { color: var(--mut); text-decoration: underline; text-underline-offset: 2px; }
.doc { max-width: 820px; }
.doc h2 { font-size: 22px; margin: 34px 0 10px; }
.doc p, .doc li { color: #C6CEDB; line-height: 1.7; }
.doc ul { padding-left: 22px; }

@media (max-width: 900px) {
  .chat-wrap { grid-template-columns: minmax(0, 1fr); padding-top: 14px; }
  .chat-list { border-right: 1px solid var(--line); height: auto; min-height: 0; }
  .chat-wrap.has-open .chat-list { display: none; }
  .chat-wrap:not(.has-open) .chat-main { display: none; }
  .chat-main { height: calc(100vh - 150px); height: calc(100dvh - 150px); }
  .mob-only { display: inline; }
  .chat-head .lbl { display: none; }
  .gp-grid { grid-template-columns: minmax(0, 1fr); }
  .m .h .linkish { visibility: visible; }
}

@media (max-width: 620px) {
  .top .btn.icon { flex: 0 0 auto; }
  .ava { width: 64px; height: 64px; font-size: 30px; }
  .person { flex-wrap: wrap; }
  .person .acts { flex-basis: 100%; justify-content: flex-start; }
  .seg { display: flex; }
  .seg label { flex: 1 1 auto; text-align: center; }
  .stage-bar .btn { flex: 1 1 auto; justify-content: center; }
  /* шапка здесь в две строки плюс лента разделов — окно чата ровно до низа экрана */
  .chat-main { height: calc(100vh - 192px); height: calc(100dvh - 192px); min-height: 360px; }
}

/* ================================================================ аватарки и статусы */

.ava { position: relative; overflow: visible; border-radius: 50%; color: #fff; line-height: 1; font-family: 'Oswald', 'Arial Narrow', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.ava > span:first-child { display: block; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ava > img { width: 64%; height: 64%; object-fit: contain; }
.ava.ava-xs { width: 24px; height: 24px; font-size: 13px; }
.ava.ava-sm { width: 38px; height: 38px; font-size: 18px; }
.ava.ava-msg { width: 36px; height: 36px; font-size: 17px; }
.ava.ava-lg { width: 56px; height: 56px; font-size: 26px; }
.ava.ava-call { width: 72px; height: 72px; font-size: 34px; }
.ava.ava-xl { width: 96px; height: 96px; font-size: 46px; }

.pres {
  position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%;
  border: 2.5px solid var(--panel); background: #6B7385; box-sizing: content-box;
}
.ava.ava-xl .pres { width: 20px; height: 20px; border-width: 4px; right: 2px; bottom: 2px; }
.ava.ava-xs .pres { width: 8px; height: 8px; border-width: 2px; }
.pres.online { background: #3BB273; }
.pres.idle { background: radial-gradient(circle at 28% 30%, var(--panel) 0 36%, var(--gold) 38%); }
.pres.dnd { background: var(--bad); }
.pres.dnd::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; margin-top: -1px; background: var(--panel); border-radius: 1px; }
.pres.offline { background: var(--panel); box-shadow: inset 0 0 0 2.5px #6B7385; }

/* меню под ником в шапке */
.me-menu { position: relative; }
.me-menu > summary, .mute-menu > summary { list-style: none; cursor: pointer; }
.me-menu > summary::-webkit-details-marker, .mute-menu > summary::-webkit-details-marker { display: none; }
.me-menu > summary { gap: 8px; padding: 6px 12px 6px 7px; position: relative; }
.me-menu > summary .pres { position: absolute; left: 24px; bottom: 4px; width: 8px; height: 8px; border-width: 2px; border-color: var(--ink); }
.me-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 230px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.55); padding: 6px;
}
.me-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 10px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
.me-item {
  display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; background: none; border: 0;
  color: #C6CEDB; font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.me-item:hover { background: var(--panel2); color: var(--fg); }
.me-item.on { color: var(--fg); font-weight: 600; }
.me-item .pres { position: static; flex: none; border-color: var(--panel); }
.me-sep { height: 1px; background: var(--line2); margin: 4px 0; }
.me-pop form { margin: 0; }
.mute-menu { position: relative; }
.mute-menu .me-pop { min-width: 270px; padding: 14px; }
.mute-menu .check { font-size: 14px; }

/* редактор аватарки */
.avatar-edit { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.av-preview { flex: none; padding-top: 4px; }
.av-fields { flex: 1; min-width: 240px; }
.av-colors { display: flex; gap: 10px; }
.av-colors input[type=color] { width: 54px; height: 40px; padding: 2px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.av-colors input[hidden] { display: none; }

.author-link { color: var(--mut); }
.author-link b { color: var(--fg); margin-left: 4px; }
.author-link:hover { border-color: var(--cy); }
.author-link:hover b { color: var(--cy); }

/* ================================================================ всплывашки */

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; gap: 12px; align-items: center; padding: 12px 12px 12px 14px; color: var(--fg);
  background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--cy);
  box-shadow: 0 14px 34px rgba(0,0,0,.5); animation: toast-in .25s ease-out; transition: opacity .35s, transform .35s;
}
.toast:hover { color: var(--fg); border-color: var(--cy); }
.toast.quiet { border-left-color: var(--line); }
.toast.out { opacity: 0; transform: translateX(20px); }
.toast .tx { flex: 1; min-width: 0; display: grid; gap: 2px; }
.toast .tx b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .tx span { font-size: 13px; color: var(--mut); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tx-close { background: none; border: 0; color: var(--dim); font-size: 20px; cursor: pointer; padding: 0 4px; align-self: flex-start; }
.tx-close:hover { color: var(--fg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.ringcard {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 95;
  display: flex; gap: 16px; align-items: center; padding: 16px 18px; width: 440px; max-width: calc(100vw - 24px);
  background: var(--panel2); border: 1px solid var(--cy); box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 4px rgba(0,171,255,.12);
  animation: ring-pulse 1.6s ease-in-out infinite;
}
.ringcard .tx { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ringcard .tx b { font-size: 16px; }
.ringcard .tx span { font-size: 13px; color: var(--mut); }
.ringcard .acts { display: flex; gap: 8px; }
.ringcard .accept { background: #3BB273; color: #fff; }
.ringcard .accept:hover { background: #4CC985; color: #fff; }
@keyframes ring-pulse { 50% { box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 10px rgba(0,171,255,.05); } }

/* ================================================================ чат: аватарки, вложения, игры */

.chat-head > .ava { flex: none; }
.chat-item.muted .t b { color: var(--mut); }
.chat-item.muted .cnt { background: var(--line); color: var(--mut); }
.share-pick { padding: 12px 16px; background: #0A1A24; color: var(--ice); font-size: 13px; border-bottom: 1px solid #0F3A55; }

.m { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0 2px; }
.m.cont { padding-top: 2px; }
.m-ava { flex: none; width: 36px; }
.m.cont .m-ava { visibility: hidden; height: 0; }
.m-col { flex: 1; min-width: 0; }
.m.sys-row { display: block; }

.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att { display: grid; gap: 4px; max-width: 340px; }
.att.img img { display: block; max-width: 340px; max-height: 300px; width: auto; height: auto; border: 1px solid var(--line); background: var(--panel2); }
.att-file { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 10px 14px; background: var(--panel2); border: 1px solid var(--line); color: var(--fg); min-width: 220px; }
.att-file:hover { border-color: var(--cy); color: var(--fg); }
.att-file svg { grid-row: span 2; color: var(--cy); }
.att-file .nm { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file small { color: var(--dim); font-size: 12px; }
.att .ttl { color: var(--dim); font-size: 11px; }
.att.gone { padding: 8px 12px; border: 1px dashed var(--line); color: var(--dim); font-size: 12px; font-style: italic; }

.gcard { display: flex; gap: 0; max-width: 420px; margin: 6px 0; background: var(--panel2); border: 1px solid var(--line); white-space: normal; overflow: hidden; }
.gcard.gone { padding: 10px 14px; color: var(--dim); font-size: 13px; }
.gc-cover { flex: none; width: 130px; background: #0B0D12; display: block; }
.gc-cover img { width: 130px; height: 100%; min-height: 96px; object-fit: cover; display: block; }
.gc-nocover { display: block; width: 130px; height: 100%; min-height: 96px; background: linear-gradient(135deg, #12151E, #1C2130); }
.gc-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; min-width: 0; }
.gc-body b { font-family: 'Oswald', 'Arial Narrow', sans-serif; font-size: 17px; letter-spacing: .02em; color: var(--fg); }
.gc-body small { color: var(--mut); font-size: 13px; line-height: 1.4; }
.gc-acts { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.gc-acts .btn { padding: 7px 12px; font-size: 12px; }

.composer { align-items: flex-end; }
.composer.busy { opacity: .6; }
.att-btn { flex: none; width: 46px; height: 46px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line); color: var(--mut); cursor: pointer; padding: 0; }
.att-btn:hover { color: var(--fg); border-color: var(--cy); }
.composer-note { padding: 0 16px 10px; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.composer-note code { color: var(--mut); }
.attach-strip { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px 0; border-top: 1px solid var(--line); }
.attach-strip[hidden] { display: none; }
.chip { display: flex; gap: 8px; align-items: center; padding: 4px 6px 4px 4px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--mut); max-width: 260px; }
.chip img { width: 34px; height: 34px; object-fit: cover; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 16px; }
.chip button:hover { color: var(--bad); }
.chat-main.drop { outline: 2px dashed var(--cy); outline-offset: -8px; }

/* ================================================================ звонок */

.call-banner { display: flex; gap: 12px; align-items: center; padding: 10px 18px; background: #0B1F14; border-bottom: 1px solid #1C4A31; color: #9FE3BC; font-size: 14px; flex: none; }
.call-banner[hidden], .call[hidden], .quality[hidden], .group-panel[hidden], .composer[hidden], .composer-note[hidden], .check[hidden] { display: none; }
.call-banner span { flex: 1; }
.call { background: #05060A; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; flex: none; max-height: 72%; position: relative; overflow: hidden; }
.call.with-screen { flex: 1 1 auto; height: 72%; }
.call-screen { display: flex; flex-direction: column; background: #000; flex: 1 1 auto; min-height: 140px; overflow: hidden; }
.call-screen[hidden] { display: none; }
.call-screen video { width: 100%; flex: 1 1 auto; min-height: 0; height: 0; background: #000; object-fit: contain; }
.quality { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; padding: 14px; background: var(--panel); border-top: 1px solid var(--line2); flex: none; max-height: 45%; overflow-y: auto; }
.quality label { margin: 0; }
.quality select { margin-top: 6px; padding: 8px 10px; font-size: 14px; }
.quality input[type=range] { width: 100%; margin-top: 10px; accent-color: var(--cy); }
.quality output { color: var(--fg); float: right; font-variant-numeric: tabular-nums; }
.quality .check { margin: 0; font-size: 13px; align-self: center; }
.quality .hint { grid-column: 1 / -1; margin: 0; }
.call-screen-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: var(--panel2); font-size: 13px; }
.call-screen-bar .stats { color: var(--ok); font-size: 12px; font-variant-numeric: tabular-nums; }
.call-screen-bar .spacer { flex: 1; }

.call-tiles { display: grid; gap: 8px; padding: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); overflow-y: auto; }
.call.with-screen .call-tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 130px; }
.tile { position: relative; aspect-ratio: 16 / 10; background: #10131B; border: 2px solid transparent; display: grid; place-items: center; overflow: hidden; transition: border-color .12s; }
.call.with-screen .tile { aspect-ratio: 16 / 9; }
.call.with-screen .tile .ava.ava-call { width: 44px; height: 44px; font-size: 21px; }
.tile.talk { border-color: #3BB273; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile video[hidden] { display: none; }
.tile.cam .tile-ava { visibility: hidden; }
.tile-name { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 6px; align-items: center; padding: 3px 8px; background: rgba(0,0,0,.6); font-size: 12px; color: #fff; max-width: calc(100% - 12px); }
.tile-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-name .mic-off { color: var(--bad); display: inline-flex; }
.tile-name .mic-off[hidden] { display: none; }
.tile-state { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--gold); }

.call-bar { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 10px; border-top: 1px solid var(--line2); }
.call-time { position: absolute; left: 14px; bottom: 20px; color: var(--mut); font-size: 13px; font-variant-numeric: tabular-nums; }
.cbtn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel2); color: var(--mut); cursor: pointer; padding: 0; }
.cbtn:hover { color: var(--fg); border-color: var(--fg); }
.cbtn[aria-pressed=true] { background: var(--fg); color: var(--ink); border-color: var(--fg); }
.cbtn[data-call-mic][aria-pressed=false] { background: #3A1515; color: var(--bad); border-color: #6A2424; }
.cbtn.hang { background: var(--bad); color: #fff; border-color: var(--bad); }
.cbtn.hang svg { transform: rotate(135deg); }
.cbtn.hang:hover { background: #FF6B68; }
.sound-tap { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 3; }
.call-note { position: absolute; left: 12px; right: 12px; top: 8px; background: rgba(0,0,0,.75); padding: 8px 12px; margin: 0; z-index: 3; }
.chat-head .btn.icon { padding: 9px 10px; }

@media (max-width: 620px) {
  .toasts { left: 12px; right: 12px; width: auto; bottom: 12px; }
  .ringcard { flex-wrap: wrap; top: 10px; }
  .ringcard .acts { width: 100%; }
  .ringcard .acts .btn { flex: 1; justify-content: center; }
  .me-menu > summary .nick { display: none; }
  .att.img img, .att { max-width: 100%; }
  .gc-cover, .gc-cover img, .gc-nocover { width: 96px; }
  .call-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-time { position: static; }
}

/* описание в профиле */
.bio { margin-top: 12px; max-width: 64ch; color: #C6CEDB; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bio.empty { color: var(--dim); font-size: 14px; }

/* ================================================================ строка ввода: всё одной высоты */

.composer { align-items: flex-end; gap: 8px; }
.composer > .att-btn, .composer > .emo-btn, .composer > .send {
  width: 44px; height: 44px; flex: none; padding: 0; display: grid; place-items: center;
}
.composer textarea { min-height: 44px; height: 44px; padding: 11px 14px; line-height: 20px; font-size: 15px; }

/* ================================================================ выбор участников группы */

.pick-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.pick {
  position: relative; display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px;
  border: 1px solid var(--line); background: var(--panel2); cursor: pointer; transition: border-color .15s, background .15s;
}
.pick:hover { border-color: #3A4152; }
.pick[hidden] { display: none; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-mark { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid #3A4152; display: grid; place-items: center; color: transparent; transition: all .15s; }
.pick:has(input:checked) { border-color: var(--cy); background: #0A1822; }
.pick:has(input:checked) .pick-mark { background: var(--cy); border-color: var(--cy); color: var(--ink); }
.pick:has(input:focus-visible) { outline: 2px solid var(--cy); outline-offset: 2px; }
.pick-count { float: right; color: var(--cy); font-weight: 600; letter-spacing: 0; }
.pick-search { margin-bottom: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ================================================================ тумблеры и ползунок */

.switches { display: grid; }
.switch-row { display: flex; align-items: center; gap: 18px; margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line2); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.sw-text { flex: 1; display: grid; gap: 3px; }
.sw-text b { color: var(--fg); font-size: 15px; font-weight: 600; }
.sw-text small { color: var(--dim); font-size: 13px; font-weight: 400; line-height: 1.45; }
input.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; margin: 0; border: 0; cursor: pointer;
  width: 48px; height: 28px; border-radius: 14px; background: #2B3141; transition: background .2s;
}
input.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #9AA3B5; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s, background .2s;
}
input.switch:checked { background: var(--cy); }
input.switch:checked::after { transform: translateX(20px); background: #fff; }
input.switch:focus-visible { outline: 2px solid var(--cy); outline-offset: 3px; }

.vol { display: flex; align-items: center; gap: 14px; margin: 18px 0 8px; max-width: 480px; }
.vol-label { font-size: 14px; font-weight: 600; color: var(--mut); }
.vol output { min-width: 44px; text-align: right; color: var(--fg); font-variant-numeric: tabular-nums; font-weight: 600; }
input.range {
  -webkit-appearance: none; appearance: none; flex: 1; height: 6px; margin: 0; padding: 0; border: 0; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, var(--cy) var(--fill, 25%), #2B3141 var(--fill, 25%));
}
input.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 5px rgba(0,171,255,.22), 0 1px 4px rgba(0,0,0,.5); transition: box-shadow .15s;
}
input.range:active::-webkit-slider-thumb { box-shadow: 0 0 0 8px rgba(0,171,255,.28), 0 1px 4px rgba(0,0,0,.5); }
input.range::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(0,171,255,.22); }
input.range:focus-visible { outline: 2px solid var(--cy); outline-offset: 6px; }

/* ================================================================ звонок: шапка, устройства */

.call-top { display: none; }
.call-devices[hidden] { display: none; }
.call-devices label { margin: 0; font-size: 12px; }
.call-devices select { margin-top: 5px; padding: 8px 10px; font-size: 14px; }
.call-devices .hint { grid-column: 1 / -1; margin: 0; }
.cbtn.flat { background: transparent; border-color: transparent; }

/* нижняя панель вкладок — только на телефоне */
.tabbar { display: none; }

/* ================================================================ телефон: как отдельное приложение */

@media (max-width: 760px) {
  body.has-tabbar { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  /* шапка — одна строка: логотип, аватар с меню статуса, «+» */
  .top {
    position: sticky; top: 0; z-index: 60; height: auto; min-height: 0; flex-wrap: nowrap; gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: rgba(6,7,10,.94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line2);
  }
  .top .brand { flex: 1 1 auto; min-width: 0; }
  .top .brand img { width: 28px; height: 28px; }
  .top .brand b, .top .brand span { font-size: 14px; letter-spacing: .08em; }
  .top .spacer { display: none; }
  .top .btn { flex: none; }
  .top .hide-m { display: none; }
  .top .me-menu > summary { padding: 3px; border-color: transparent; border-radius: 50%; }
  .top .me-menu > summary .ava.ava-xs { width: 34px; height: 34px; font-size: 16px; }
  .top .me-menu > summary .pres { left: 26px; bottom: 2px; }
  .top .me-menu > summary .nick { display: none; }
  .submit-btn { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .submit-btn span { display: none; }
  .nav.mob { display: none !important; }
  .top .nav { display: none; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(10,12,17,.97); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--dim); font-size: 10.5px; font-weight: 600; -webkit-tap-highlight-color: transparent;
  }
  .tabbar a:active { background: rgba(255,255,255,.03); }
  .tabbar a.on { color: var(--fg); }
  .tabbar a.on svg { color: var(--cy); }
  .tabbar a.on .ava { box-shadow: 0 0 0 2px var(--cy); }
  .tabbar .ava.ava-xs { width: 24px; height: 24px; font-size: 12px; }
  .tabbar .cnt { position: absolute; top: 5px; left: calc(50% + 5px); background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; line-height: 1; padding: 3px 5px; border-radius: 9px; min-width: 17px; text-align: center; }

  .foot { padding-bottom: 24px; }
  .toasts { bottom: calc(70px + env(safe-area-inset-bottom)); }

  /* ---------------- чаты на весь экран */
  body.chat-page .top, body.chat-page .foot { display: none; }
  body.chat-page { padding-bottom: 0; overflow: hidden; }
  body.chat-page .chat-wrap {
    position: fixed; left: 0; right: 0; top: 0; bottom: calc(60px + env(safe-area-inset-bottom));
    display: block; padding: 0; margin: 0; max-width: none;
  }
  body.chat-page.chat-open .tabbar { display: none; }
  body.chat-page.chat-open .chat-wrap { bottom: 0; }
  body.chat-page > .flash { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 96; padding: 0 !important; animation: flash-away 0s 6s forwards; }
  body.chat-page > .flash .msg { margin: 0; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
  @keyframes flash-away { to { visibility: hidden; } }

  .chat-list { height: 100%; min-height: 0; border: 0; }
  .chat-list-head { padding: calc(14px + env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--line2); }
  .chat-list-head h1 { font-size: 24px; }
  .chat-item { padding: 12px 16px; gap: 12px; border-bottom: 0; }
  .chat-item .ava.ava-sm { width: 48px; height: 48px; font-size: 22px; }
  .chat-item .t b { font-size: 15px; }
  .chat-item .t small { font-size: 13px; }

  .chat-main { height: 100%; min-height: 0; border: 0; }
  .chat-main > .back-link { margin: calc(14px + env(safe-area-inset-top)) 16px 0; }
  .chat-main > h2, .chat-main > form.panel { margin-left: 16px; margin-right: 16px; }
  .chat-head {
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px 4px; gap: 8px; background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .chat-head .back-link.mob-only { display: grid; place-items: center; width: 40px; height: 40px; font-size: 24px; color: var(--fg); flex: none; }
  .chat-head h2 { font-size: 17px; font-family: 'Golos Text', 'Segoe UI', sans-serif; text-transform: none; letter-spacing: 0; font-weight: 700; }
  .chat-head small { font-size: 12px; }
  .chat-head .btn.icon, .chat-head .mute-menu > summary { width: 40px; height: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .chat-head > .btn.ghost.sm:not(.icon) { padding: 8px 10px; border-color: transparent; }
  .mute-menu .me-pop { right: -4px; width: min(300px, calc(100vw - 24px)); }

  .msgs { padding: 12px 12px 8px; }
  .m { gap: 10px; }
  .m .b { font-size: 15.5px; }
  .gcard { max-width: 100%; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; background: var(--panel); border-top: 1px solid var(--line); }
  .composer textarea { font-size: 16px; }   /* 16px — иначе iOS зумит поле */
  .attach-strip { background: var(--panel); }

  /* ---------------- звонок поверх всего, как в приложении */
  body.in-call:not(.call-mini) .call {
    position: fixed; inset: 0; z-index: 85; max-height: none; height: 100%;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
    border: 0; background: #07080C;
  }
  body.call-mini .call { display: none; }
  .call-top { display: flex; align-items: center; gap: 6px; padding: 8px 10px; flex: none; }
  .call-title { display: grid; }
  .call-title b { font-size: 16px; }
  .call-title span { font-size: 13px; color: var(--mut); font-variant-numeric: tabular-nums; }
  .call .call-time { display: none; }
  .call-tiles { flex: 1 1 auto; align-content: center; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); padding: 10px 12px; }
  .call-tiles[data-n="1"], .call-tiles[data-n="2"] { grid-template-columns: minmax(0, 1fr); }
  .call-tiles[data-n="2"] .tile { aspect-ratio: auto; height: calc((100dvh - 260px) / 2); }
  .call-tiles[data-n="1"] .tile { aspect-ratio: auto; height: calc(100dvh - 260px); }
  .tile .ava.ava-call { width: 88px; height: 88px; font-size: 40px; }
  .call.with-screen .call-tiles { flex: none; display: flex; overflow-x: auto; max-height: none; gap: 8px; padding: 8px 12px; }
  .call.with-screen .call-tiles .tile { flex: 0 0 116px; height: auto; aspect-ratio: 4 / 3; }
  .call-screen { flex: 1 1 auto; min-height: 0; }
  .call-screen-bar { padding: 8px 12px; }
  .call-screen-bar b { display: none; }
  .call-bar { gap: 14px; padding: 14px 10px 18px; border-top: 0; }
  .cbtn { width: 56px; height: 56px; }
  .cbtn svg { width: 22px; height: 22px; }
  .call-devices { grid-template-columns: minmax(0, 1fr); }
  .call-banner { padding: 10px 14px; }
}

/* ================================================================ свои элементы вместо браузерных */

/* полосы прокрутки — тонкие и тёмные везде */
* { scrollbar-width: thin; scrollbar-color: #2B3141 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2B3141; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3A4152; background-clip: padding-box; }
::-webkit-scrollbar-button, ::-webkit-scrollbar-corner { display: none; background: transparent; }

.ui-hidden { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; }

/* окна подтверждения */
.ui-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(4,5,8,.72); animation: ui-fade .12s ease-out; }
.ui-modal.out { opacity: 0; transition: opacity .15s; }
.ui-dialog { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0,0,0,.6); padding: 22px 22px 18px; animation: ui-pop .16s ease-out; }
.ui-dialog p { margin: 0 0 20px; color: var(--fg); font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.ui-acts { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes ui-fade { from { opacity: 0; } }
@keyframes ui-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* выпадающий список */
.ui-select {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); color: var(--fg); font: inherit; font-size: 15px; padding: 11px 14px; cursor: pointer;
}
.ui-select::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--mut); border-bottom: 2px solid var(--mut); transform: rotate(45deg) translateY(-3px); flex: none; }
.ui-select:hover, .ui-select[aria-expanded=true] { border-color: #3A4152; }
.ui-select:focus-visible { outline: 2px solid var(--cy); outline-offset: -1px; }
.ui-menu {
  position: fixed; z-index: 210; max-height: 300px; overflow-y: auto; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.55); animation: ui-pop .12s ease-out;
}
.ui-opt { display: block; width: 100%; text-align: left; padding: 9px 12px; background: none; border: 0; color: #C6CEDB; font: inherit; font-size: 14px; cursor: pointer; }
.ui-opt:hover, .ui-opt:focus-visible { background: var(--panel2); color: var(--fg); outline: none; }
.ui-opt.on { color: var(--cy); font-weight: 600; }

/* выбор цвета */
.ui-swatch { width: 44px; height: 40px; border: 2px solid var(--line); cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px var(--panel); }
.ui-swatch[hidden] { display: none; }
.ui-swatch:hover { border-color: var(--fg); }
.ui-palette { display: grid; grid-template-columns: repeat(6, 30px); gap: 6px; padding: 10px; }
.ui-pal { width: 30px; height: 30px; border: 2px solid transparent; cursor: pointer; padding: 0; border-radius: 50%; }
.ui-pal:hover { transform: scale(1.1); }
.ui-pal.on { border-color: #fff; }
.ui-hex { grid-column: 1 / -1; margin-top: 4px; padding: 7px 10px !important; font-size: 13px !important; font-family: ui-monospace, Consolas, monospace !important; }

/* флажки и переключатели */
input[type=checkbox]:not(.switch) {
  -webkit-appearance: none; appearance: none; flex: none; width: 18px; height: 18px; margin: 2px 0 0; cursor: pointer;
  border: 2px solid #3A4152; background: var(--panel); border-radius: 4px; display: inline-grid; place-items: center; transition: all .12s;
}
input[type=checkbox]:not(.switch)::after { content: ''; width: 9px; height: 5px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
input[type=checkbox]:not(.switch):checked { background: var(--cy); border-color: var(--cy); }
input[type=checkbox]:not(.switch):checked::after { opacity: 1; }
input[type=radio] {
  -webkit-appearance: none; appearance: none; flex: none; width: 18px; height: 18px; margin: 0; cursor: pointer;
  border: 2px solid #3A4152; border-radius: 50%; background: var(--panel); display: inline-grid; place-items: center;
}
input[type=radio]::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cy); transform: scale(0); transition: transform .12s; }
input[type=radio]:checked { border-color: var(--cy); }
input[type=radio]:checked::after { transform: scale(1); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--cy); outline-offset: 2px; }

/* кнопка выбора файла */
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 9px 14px; border: 1px solid #5A6274; background: transparent; color: #C6CEDB;
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
input[type=file]::file-selector-button:hover { border-color: var(--fg); color: var(--fg); }

/* ползунки — везде одинаковые */
input[type=range]:not(.range) {
  -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: #2B3141; cursor: pointer; padding: 0; border: 0;
}
input[type=range]:not(.range)::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(0,171,255,.22); }
input[type=range]:not(.range)::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; }

/* ================================================================ ответы и реакции */

.m { position: relative; }
.m.flash { animation: m-flash 1.4s ease-out; }
@keyframes m-flash { 0%, 30% { background: rgba(0,171,255,.12); } }
.quote {
  display: grid; gap: 1px; max-width: 520px; margin: 2px 0 4px; padding: 5px 10px; text-align: left; cursor: pointer;
  background: var(--panel2); border: 0; border-left: 3px solid var(--cy); color: var(--mut); font: inherit; font-size: 13px;
}
.quote b { color: var(--cy); font-size: 12px; }
.quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote.gone { border-left-color: var(--line); font-style: italic; }
.quote:hover { background: #1B1F2A; }

.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reacts[hidden] { display: none; }
.react {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 12px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); color: var(--mut); font: inherit; font-size: 15px; line-height: 1.2;
}
.react i { font-style: normal; font-size: 12px; font-weight: 600; }
.react img.emo { width: 18px; height: 18px; vertical-align: 0; }
.react:hover { border-color: #3A4152; }
.react.mine { border-color: var(--cy); background: #0A1822; color: var(--fg); }

.m-tools {
  position: absolute; top: -12px; right: 8px; z-index: 3; display: none; gap: 2px; padding: 2px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.m-tools button { width: 30px; height: 28px; display: grid; place-items: center; background: none; border: 0; color: var(--mut); cursor: pointer; padding: 0; }
.m-tools button:hover { color: var(--fg); background: var(--panel2); }
.m-tools button.danger:hover { color: var(--bad); }
.m:hover > .m-tools, .m.show-tools > .m-tools, .m-tools:focus-within { display: flex; }
.m:hover { background: rgba(255,255,255,.015); }

.react-pop {
  position: fixed; z-index: 120; display: flex; gap: 2px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0,0,0,.5); border-radius: 22px;
}
.react-pop button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; font-size: 21px; cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--mut); }
.react-pop button:hover { background: var(--panel2); transform: scale(1.12); }
.emo-pop.floating { position: fixed; right: auto; bottom: auto; z-index: 125; }

.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel); color: var(--cy); }
.reply-bar[hidden] { display: none; }
.rb-text { flex: 1; min-width: 0; display: grid; font-size: 13px; }
.rb-text b { color: var(--cy); }
.rb-text span { color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-x { background: none; border: 0; color: var(--dim); font-size: 22px; cursor: pointer; padding: 0 4px; }
.rb-x:hover { color: var(--fg); }

/* редактор аватарки группы */
.group-panel h3 { margin-top: 22px; }
.group-panel h3:first-child { margin-top: 0; }
.group-ava .av-edit { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 10px; }
.group-ava .av-fields { flex: 1; min-width: 200px; }
.group-ava .ava.ava-xl { width: 72px; height: 72px; font-size: 34px; }

/* ================================================================ звонок: кнопки, окошки, экран */

.chat-main svg:not([width]) { width: 18px; height: 18px; }
.cgroup { display: flex; align-items: center; }
.cbtn svg:not([width]) { width: 42%; height: 42%; }
.ccaret {
  width: 22px; height: 22px; margin-left: -10px; margin-top: 24px; z-index: 1; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); color: var(--mut);
}
.ccaret svg:not([width]) { width: 13px; height: 13px; }
.ccaret:hover, .ccaret[aria-expanded=true] { color: var(--fg); border-color: var(--fg); }
.call-bar { gap: 14px; }

.call-screen { position: relative; }
.scr-overlay {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: linear-gradient(rgba(0,0,0,.65), transparent); opacity: 0; transition: opacity .2s; font-size: 13px; color: #fff;
}
.call-screen:hover .scr-overlay, .call-screen:focus-within .scr-overlay { opacity: 1; }
@media (hover: none) { .scr-overlay { opacity: 1; } }
.scr-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.scr-overlay .stats { color: var(--ok); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scr-overlay .spacer { flex: 1; }
.ov-btn { width: 34px; height: 34px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; cursor: pointer; }
.ov-btn[hidden] { display: none; }
.ov-btn:hover { background: rgba(0,0,0,.75); }
.ov-btn svg:not([width]) { width: 18px; height: 18px; }

.tile .live { position: absolute; top: 6px; left: 6px; z-index: 2; padding: 2px 7px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tile .live[hidden] { display: none; }
.tile.is-live { cursor: pointer; }
.tile.watched { border-color: var(--cy); }

.call-pop {
  position: fixed; z-index: 130; width: 300px; max-width: calc(100vw - 16px); max-height: min(70vh, 520px); overflow-y: auto; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.6); animation: ui-pop .12s ease-out;
}
.cp-h { padding: 8px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.cp-item { display: grid; width: 100%; text-align: left; gap: 2px; padding: 8px 10px 8px 30px; position: relative; background: none; border: 0; color: #C6CEDB; font: inherit; font-size: 14px; cursor: pointer; }
.cp-item small { color: var(--dim); font-size: 12px; }
.cp-item:hover { background: var(--panel2); color: var(--fg); }
.cp-item::before { content: ''; position: absolute; left: 9px; top: 12px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #3A4152; }
.cp-item.on { color: var(--fg); }
.cp-item.on::before { border-color: var(--cy); background: radial-gradient(circle, var(--cy) 0 40%, transparent 45%); }
.cp-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 8px 10px; }
.cp-chips button { padding: 6px 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--mut); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.cp-chips button:hover { color: var(--fg); }
.cp-chips button.on { background: var(--cy); border-color: var(--cy); color: var(--ink); }
.cp-range { display: grid; gap: 8px; margin: 0; padding: 6px 8px 10px; font-size: 13px; color: var(--mut); font-weight: 600; }
.cp-range > span { display: flex; justify-content: space-between; }
.cp-range b { color: var(--fg); font-variant-numeric: tabular-nums; }
.cp-switch { display: flex; align-items: center; gap: 12px; margin: 0; padding: 8px; font-size: 13px; color: #C6CEDB; cursor: pointer; }
.cp-switch span { flex: 1; }
.cp-note { margin: 4px 8px 6px; font-size: 12px; color: var(--dim); line-height: 1.45; }

@media (max-width: 760px) {
  .ccaret { width: 24px; height: 24px; margin-top: 30px; }
  .cbtn svg:not([width]) { width: 40%; height: 40%; }
  .call-pop { left: 8px !important; right: 8px; width: auto; bottom: calc(96px + env(safe-area-inset-bottom)); top: auto !important; max-height: 60vh; }
  .m-tools { top: auto; bottom: calc(100% - 6px); }
}

/* Ничего не должно вылезать за край экрана */
html, body { max-width: 100%; overflow-x: hidden; }
