/* Зимняя тема: ночное небо с северным сиянием, «ледяное» стекло, снег */
:root {
  --bg: #0a1626;
  --card: rgba(160, 205, 255, .075);
  --card-hi: rgba(190, 225, 255, .12);
  --line: rgba(170, 215, 255, .2);
  --line-soft: rgba(170, 215, 255, .12);
  --field: rgba(4, 14, 28, .55);
  --text: #eaf4ff;
  --dim: #9db3cc;
  --accent: #6cc4ff;
  --accent-2: #a6e6ff;
  --ink: #06213c;          /* тёмный текст на светлых «ледяных» кнопках */
  --ok: #6ee7c5;
  --warn: #ffd27a;
  --bad: #ff7b86;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  user-select: none;
  background:
    radial-gradient(900px 380px at 12% -12%, rgba(88, 196, 255, .24), transparent 62%),
    radial-gradient(760px 340px at 96% -4%, rgba(146, 122, 255, .17), transparent 60%),
    radial-gradient(600px 300px at 55% -18%, rgba(110, 231, 197, .12), transparent 60%),
    linear-gradient(180deg, #071120 0%, #0c1c33 52%, #13294a 100%);
  background-attachment: fixed;
  background-color: var(--bg);
}
.hidden { display: none !important; }

/* Снег и сугробы — позади всего и не мешают кликам */
#snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
body::after {
  content: '';
  position: fixed; left: 0; right: 0; bottom: 0; height: 90px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70px at 18% 100%, rgba(235, 246, 255, .16), transparent 70%),
    radial-gradient(90% 56px at 72% 100%, rgba(235, 246, 255, .13), transparent 70%),
    radial-gradient(60% 40px at 46% 100%, rgba(235, 246, 255, .1), transparent 72%);
}
header, main { position: relative; z-index: 1; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: rgba(170, 215, 255, .22); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(170, 215, 255, .4); background-clip: padding-box; border: 2px solid transparent; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(160, 205, 255, .08), transparent);
}
.brand { font-size: 18px; font-weight: 700; display: flex; align-items: baseline; gap: 6px; }
.brand .logo { display: inline-block; font-weight: 400; color: var(--accent-2); text-shadow: 0 0 12px rgba(120, 205, 255, .8); animation: spin 14s linear infinite; }
.brand .word { background: linear-gradient(90deg, #fff, var(--accent-2) 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span.sub { font-size: 12px; font-weight: 400; color: var(--dim); }
@keyframes spin { to { transform: rotate(360deg); } }

main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Блоки плавно «всплывают» при открытии экрана */
main > * { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
main > *:nth-child(2) { animation-delay: .05s; }
main > *:nth-child(3) { animation-delay: .1s; }
main > *:nth-child(4) { animation-delay: .15s; }
main > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--line);
  border-top-color: rgba(225, 242, 255, .38); /* иней по верхней кромке */
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(2, 10, 24, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.card h2 { margin: 0; font-size: 15px; letter-spacing: .2px; }
.card p { margin: 0; color: var(--dim); }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; min-width: 0; }

/* ---------- Кнопки ---------- */
button {
  position: relative;
  overflow: hidden;
  font: inherit;
  color: var(--text);
  background: linear-gradient(180deg, rgba(175, 215, 255, .16), rgba(140, 190, 245, .08));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .16s cubic-bezier(.2, .8, .2, 1), box-shadow .22s, background .22s, border-color .22s, color .22s;
}
/* блик, пробегающий по кнопке при наведении */
button::after {
  content: '';
  position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .34), transparent);
  transform: skewX(-20deg);
  opacity: 0;
  pointer-events: none;
}
button:hover { transform: translateY(-2px); border-color: rgba(190, 228, 255, .55); box-shadow: 0 8px 22px rgba(60, 160, 255, .28); }
button:hover::after { animation: sheen .75s ease; }
button:active { transform: translateY(1px) scale(.975); box-shadow: 0 2px 8px rgba(60, 160, 255, .2); transition-duration: .06s; }
@keyframes sheen { 0% { left: -70%; opacity: 1; } 100% { left: 135%; opacity: 1; } }

button.primary {
  background: linear-gradient(135deg, #57b4ff 0%, #8fdcff 55%, #c9f1ff 100%);
  border-color: rgba(220, 244, 255, .8);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(70, 170, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
}
button.primary:hover { box-shadow: 0 10px 28px rgba(90, 190, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .7); }
button.ghost { background: transparent; }
button.small { padding: 6px 10px; flex: 0 0 auto; border-radius: 10px; }
/* главные кнопки стартового экрана мягко «дышат» */
#btnCall, #btnGroupJoin { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 6px 18px rgba(70, 170, 255, .32), inset 0 1px 0 rgba(255, 255, 255, .6); }
  50% { box-shadow: 0 8px 30px rgba(110, 205, 255, .62), inset 0 1px 0 rgba(255, 255, 255, .7); }
}

input[type="text"], select {
  font: inherit;
  width: 100%;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input[type="text"]::placeholder { color: rgba(157, 179, 204, .75); }
select option { background: #10223a; color: var(--text); }
input[type="text"]:hover, select:hover { border-color: rgba(190, 228, 255, .4); }
input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 196, 255, .22), 0 0 18px rgba(108, 196, 255, .18); background: rgba(6, 20, 40, .7); }
button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.err { color: var(--bad); margin: 0; animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.note { font-size: 12.5px; color: var(--dim); margin: 0; }
.note.warn { color: var(--warn); }
.note.ok { color: var(--ok); }

/* ---------- Статус ---------- */
#status { display: flex; align-items: center; gap: 10px; font-weight: 600; }
#dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
#dot.ok { background: var(--ok); box-shadow: 0 0 10px rgba(110, 231, 197, .9); }
#dot.ok::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ok); animation: ping 2.2s ease-out infinite; }
#dot.wait { background: var(--warn); box-shadow: 0 0 10px rgba(255, 210, 122, .7); animation: pulse 1.2s infinite; }
#dot.bad { background: var(--bad); box-shadow: 0 0 10px rgba(255, 123, 134, .8); }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes ping { from { transform: scale(1); opacity: .8; } to { transform: scale(2.8); opacity: 0; } }

#codeOut, .codebox {
  font: 12.5px/1.3 Consolas, monospace;
  color: var(--accent-2);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
}

/* ---------- Сцена звонка на двоих ---------- */
#stage {
  position: relative;
  flex: 1 1 200px;
  min-height: 180px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(40, 80, 130, .35), rgba(3, 9, 18, .85));
  border: 1px solid var(--line);
  border-top-color: rgba(225, 242, 255, .32);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(2, 10, 24, .4);
  transition: border-color .15s, box-shadow .2s;
}
#rScreen, #rCam { width: 100%; height: 100%; object-fit: contain; background: #000; }
#stage.both #rCam {
  position: absolute; left: 10px; bottom: 10px;
  width: 30%; height: auto; max-height: 40%;
  border-radius: 10px; border: 1px solid var(--line);
}
#lCam {
  position: absolute; right: 10px; bottom: 10px;
  width: 26%; max-height: 36%;
  border-radius: 10px; border: 1px solid rgba(225, 242, 255, .4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  transform: scaleX(-1);
  background: #000;
}
#avatar { position: relative; width: 104px; height: 104px; display: flex; align-items: center; justify-content: center; }
#avatarText { font-size: 13px; color: var(--dim); text-align: center; }
#ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: radial-gradient(circle at 50% 30%, rgba(170, 220, 255, .14), transparent 65%);
  transition: border-color .12s, box-shadow .12s;
}
#stage.talking #ring { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(110, 231, 197, .16), 0 0 26px rgba(110, 231, 197, .55); }
#stage.talking { border-color: rgba(110, 231, 197, .7); box-shadow: 0 0 26px rgba(110, 231, 197, .22); }
#badges { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.badge { background: rgba(4, 14, 28, .7); border: 1px solid rgba(255, 210, 122, .35); border-radius: 8px; padding: 3px 8px; font-size: 12px; color: var(--warn); backdrop-filter: blur(6px); }

#stats { font-size: 12.5px; color: var(--dim); min-height: 18px; text-align: center; white-space: pre-line; font-variant-numeric: tabular-nums; transition: color .3s; }
#stats.good { color: var(--ok); }
#stats.mid { color: var(--warn); }
#stats.bad { color: var(--bad); }
#spark { width: 100%; height: 26px; display: block; flex: 0 0 auto; }
header .row > * { flex: 0 0 auto; }

/* ---------- Группа: плитки участников ---------- */
body.group #stage, body.group #spark { display: none !important; }
#grid { flex: 1 1 220px; min-height: 180px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); grid-auto-rows: minmax(110px, 1fr); }
.tile {
  position: relative; cursor: pointer;
  background: radial-gradient(120% 90% at 50% 0%, rgba(40, 80, 130, .35), rgba(3, 9, 18, .85));
  border: 1px solid var(--line); border-top-color: rgba(225, 242, 255, .3);
  border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 110px; opacity: .5;
  transition: border-color .15s, box-shadow .2s, opacity .3s, transform .2s;
  animation: pop .35s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(40, 140, 255, .22); }
.tile.on { opacity: 1; }
.tile.talking { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(110, 231, 197, .5), 0 0 24px rgba(110, 231, 197, .4); }
.tile .tv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile.self .tv { transform: scaleX(-1); }
.tile .tav { color: var(--dim); font-size: 13px; padding: 0 8px; text-align: center; overflow-wrap: anywhere; }
.tile .tbar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 8px; padding: 4px 9px; font-size: 11.5px; background: linear-gradient(180deg, transparent, rgba(3, 10, 22, .82)); z-index: 2; }
.tile .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tstat { flex: 0 0 auto; color: var(--dim); font-variant-numeric: tabular-nums; }
.tile .tstat.good { color: var(--ok); } .tile .tstat.mid { color: var(--warn); } .tile .tstat.bad { color: var(--bad); }
.tile .tvol { position: absolute; left: 8px; right: 8px; top: 6px; width: auto; z-index: 2; opacity: 0; transition: opacity .15s; }
.tile:hover .tvol { opacity: 1; }
/* Участник, открытый крупно двойным кликом: во всю ширину, остальные — рядом маленькими плитками */
#grid.hasfocus { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); grid-auto-rows: minmax(70px, auto); }
#grid.hasfocus .tile { min-height: 70px; }
#grid.hasfocus .tile.focus { grid-column: 1 / -1; order: -1; min-height: 52vh; }
#grid.hasfocus .tile.focus:hover { transform: none; }
body.mini #grid { gap: 2px; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); grid-auto-rows: minmax(60px, 1fr); min-height: 0; }
body.mini .tile { border-radius: 0; min-height: 0; }
body.mini .tile.self { display: none; }
details label input[type="text"] { color: var(--text); }

.fld { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 12.5px; }
#legacy { display: flex; flex-direction: column; }
#legacy > summary { cursor: pointer; color: var(--dim); padding: 4px 2px; transition: color .2s; }
#legacy > summary:hover { color: var(--accent-2); }
#legacy[open] > summary { margin-bottom: 10px; }
#legacy > section { margin-bottom: 12px; }

#secure { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 7px 11px; border-radius: 12px; border: 1px solid var(--line); background: rgba(4, 14, 28, .35); backdrop-filter: blur(10px); }
#secure span { flex: 1; }
#secure.sec-ok { color: var(--ok); border-color: rgba(110, 231, 197, .4); }
#secure.sec-new { color: var(--warn); border-color: rgba(255, 210, 122, .5); }
#secure.sec-bad { color: #fff; background: #7a1f2a; border-color: var(--bad); font-weight: 600; animation: shake .4s; }
body.mini #secure { display: none !important; }
body.mini #secure.sec-bad { display: flex !important; position: absolute; left: 0; right: 0; top: 26px; z-index: 4; font-size: 11px; padding: 3px 6px; border-radius: 0; }
body.mini #secure.sec-bad.hidden { display: none !important; }

#miniBar { display: none; position: absolute; right: 6px; top: 6px; gap: 4px; z-index: 3; }
#miniBar button { padding: 3px 8px; background: rgba(4, 14, 28, .7); }
#miniBar button.off { border-color: var(--bad); }
#stage:fullscreen { border: 0; border-radius: 0; }

#chatDot { color: var(--accent); animation: pulse 1.2s infinite; }
#chatLog { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; user-select: text; overflow-wrap: anywhere; }
#chatLog:empty { display: none; }
#chatLog .mine b { color: var(--dim); }
#chatLog .theirs b { color: var(--accent-2); }

/* ---------- Мини-окно: только видео, статус и две кнопки ---------- */
body.mini #snow, body.mini::after { display: none; }
body.mini main > * { animation: none; }
body.mini header, body.mini #hostBox, body.mini .controls, body.mini #settings, body.mini #chat, body.mini #spark { display: none !important; }
body.mini main { padding: 0; gap: 0; position: relative; overflow: hidden; }
body.mini #stage { border: 0; border-radius: 0; min-height: 0; flex: 1; box-shadow: none; }
body.mini #miniBar { display: flex; }
body.mini #status { position: absolute; left: 8px; top: 6px; z-index: 3; font-size: 11.5px; text-shadow: 0 1px 3px #000; }
body.mini #stats { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; font-size: 11px; min-height: 0; padding: 2px 0; background: rgba(3, 10, 22, .6); }
body.mini #lCam { display: none; }
body.mini #avatar { transform: scale(.7); }

/* ---------- Кнопки управления звонком ---------- */
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ctl { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; border-radius: 14px; }
.ctl .ico { position: relative; display: inline-flex; transition: transform .2s cubic-bezier(.2, .9, .3, 1.4); }
.ctl .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ctl:hover .ico { transform: translateY(-2px) scale(1.12); }
.ctl b { font-weight: 600; font-size: 13px; }
.ctl i { font-style: normal; font-size: 11.5px; color: var(--dim); }
.ctl.on { border-color: rgba(110, 231, 197, .6); background: linear-gradient(180deg, rgba(110, 231, 197, .18), rgba(110, 231, 197, .06)); }
.ctl.on .ico { color: var(--ok); filter: drop-shadow(0 0 6px rgba(110, 231, 197, .6)); }
.ctl.on i { color: var(--ok); }
.ctl.off { border-color: rgba(255, 123, 134, .6); background: linear-gradient(180deg, rgba(255, 123, 134, .16), rgba(255, 123, 134, .05)); }
.ctl.off .ico { color: var(--bad); }
/* выключено — иконка перечёркнута */
.ctl.off .ico::after { content: ''; position: absolute; left: -2px; right: -2px; top: 50%; height: 2px; border-radius: 2px; background: var(--bad); transform: rotate(-42deg); box-shadow: 0 0 0 1.5px rgba(10, 22, 38, .9); animation: strike .2s ease-out both; }
@keyframes strike { from { transform: rotate(-42deg) scaleX(0); } }
.ctl.off i { color: var(--bad); }
.ctl.danger { background: linear-gradient(180deg, rgba(255, 110, 125, .26), rgba(255, 110, 125, .1)); border-color: rgba(255, 130, 145, .55); justify-content: center; }
.ctl.danger .ico { color: #ffb3ba; }
.ctl.danger:hover { box-shadow: 0 8px 22px rgba(255, 90, 110, .32); border-color: rgba(255, 160, 170, .8); }
.ctl.danger:hover .ico { animation: wiggle .5s ease; }
@keyframes wiggle { 20% { transform: rotate(-14deg) scale(1.12); } 50% { transform: rotate(12deg) scale(1.12); } 80% { transform: rotate(-6deg) scale(1.12); } }
/* говоришь — кнопка микрофона светится в такт */
.ctl.me-talking { box-shadow: 0 0 0 2px rgba(110, 231, 197, .6), 0 0 22px rgba(110, 231, 197, .4); }
.ctl.me-talking .ico { animation: bob .5s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-2px) scale(1.1); } }

details summary { cursor: pointer; font-weight: 600; transition: color .2s; }
details summary:hover { color: var(--accent-2); }
details label { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 12.5px; }
details label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }

/* Кому анимации мешают — выключаем их целиком */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #snow { display: none; }
}

/* ================= Версия 1.9 ================= */

/* Северное сияние медленно плывёт (только пока окно активно — см. класс idle) */
body::before {
  content: "";
  position: fixed; inset: -20% -10% auto -10%; height: 70%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 55% at 22% 30%, rgba(96, 205, 255, .20), transparent 70%),
    radial-gradient(36% 50% at 70% 22%, rgba(150, 120, 255, .17), transparent 70%),
    radial-gradient(30% 45% at 48% 12%, rgba(110, 231, 197, .13), transparent 70%);
  filter: blur(18px);
  animation: aurora 26s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
@keyframes aurora {
  0% { transform: translate3d(-4%, 0, 0) scale(1); opacity: .75; }
  50% { transform: translate3d(3%, 2%, 0) scale(1.08); opacity: 1; }
  100% { transform: translate3d(6%, -1%, 0) scale(1.03); opacity: .8; }
}
body.idle::before, body.mini::before { animation-play-state: paused; }
body.mini::before { display: none; }
/* окно не в фокусе (идёт игра) — все бесконечные анимации стоят и не тратят видеокарту */
body.idle .brand .logo, body.idle #btnCall, body.idle #btnGroupJoin, body.idle #dot.ok::after { animation-play-state: paused; }

/* Шапка */
header { backdrop-filter: blur(10px); }
.brand .word { letter-spacing: .3px; }

/* Аватарки: цвет — из имени */
.ava {
  --hue: 200;
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  background: linear-gradient(135deg, hsl(var(--hue) 78% 62%), hsl(calc(var(--hue) + 45) 70% 44%));
  box-shadow: 0 4px 14px hsl(var(--hue) 80% 50% / .35), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.4), box-shadow .2s;
}

/* Список друзей */
#contacts { display: flex; flex-direction: column; gap: 8px; }
#contacts:empty { display: none; }
.contact {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px;
  background: rgba(4, 14, 28, .38); border: 1px solid var(--line-soft);
  transition: background .2s, border-color .2s, transform .2s;
}
.contact:hover { background: rgba(20, 50, 90, .45); border-color: var(--line); transform: translateX(2px); }
.contact .ava { cursor: pointer; }
.contact:hover .ava { transform: scale(1.08); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who input { padding: 5px 8px; }
button.icon { width: 32px; padding: 6px 0; color: var(--dim); }
button.icon:hover { color: var(--text); }

/* Входящий звонок */
#ringBox {
  flex-direction: row; align-items: center; gap: 12px;
  border-color: rgba(110, 231, 197, .65);
  background: linear-gradient(135deg, rgba(110, 231, 197, .22), rgba(108, 196, 255, .12));
  animation: rise .35s both, ringGlow 1.6s ease-in-out infinite;
}
#ringBox .ava { width: 48px; height: 48px; font-size: 20px; animation: ringShake 1.6s ease-in-out infinite; }
#ringBox .who b { font-size: 16px; }
#ringBox .who small { font-size: 12.5px; color: var(--ok); }
#ringBox button { flex: 0 0 auto; }
@keyframes ringGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(110, 231, 197, .45), 0 10px 30px rgba(2, 10, 24, .35); }
  50% { box-shadow: 0 0 0 10px rgba(110, 231, 197, 0), 0 10px 34px rgba(110, 231, 197, .28); }
}
@keyframes ringShake { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } }

/* Кружок друга на сцене: буква, имя и волны в такт голосу */
#avatar { --lvl: 0; --hue: 200; width: auto; height: auto; flex-direction: column; gap: 12px; }
#avatar .disc { position: relative; width: 112px; height: 112px; display: flex; align-items: center; justify-content: center; }
#avatarText {
  position: relative; z-index: 1; width: 88px; height: 88px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 700; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  background: linear-gradient(135deg, hsl(var(--hue) 78% 62%), hsl(calc(var(--hue) + 45) 70% 42%));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 8px 26px hsl(var(--hue) 80% 45% / .45);
  transform: scale(calc(1 + var(--lvl) * .08));
  transition: transform .13s linear;
}
#avatarCap { font-size: 14px; font-weight: 600; color: var(--text); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ring {
  inset: 0; border: 2px solid hsl(var(--hue) 80% 70% / .35); background: none;
  transform: scale(calc(1 + var(--lvl) * .22));
  opacity: calc(.45 + var(--lvl) * .55);
  transition: transform .13s linear, opacity .13s linear, border-color .15s, box-shadow .15s;
}
#avatar .wave {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(110, 231, 197, .55);
  transform: scale(calc(1.08 + var(--lvl) * .55)); opacity: calc(var(--lvl) * .8);
  transition: transform .13s linear, opacity .13s linear;
}
#avatar .wave.w2 { transform: scale(calc(1.16 + var(--lvl) * .95)); opacity: calc(var(--lvl) * .45); }
/* пока звоним — от кружка расходятся круги */
#avatar.calling .wave { opacity: 0; border-color: rgba(108, 196, 255, .7); animation: callWave 2s ease-out infinite; transition: none; }
#avatar.calling .wave.w2 { animation-delay: 1s; }
@keyframes callWave { from { transform: scale(.85); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
body.idle #avatar.calling .wave { animation-play-state: paused; }
body.mini #avatar .disc { width: 84px; height: 84px; }
body.mini #avatarText { width: 64px; height: 64px; font-size: 28px; }
body.mini #avatarCap { font-size: 11.5px; }

/* Панель управления звонком — «док» с круглыми кнопками */
.controls {
  align-self: center; width: min(100%, 460px);
  padding: 10px 12px; gap: 6px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(175, 215, 255, .13), rgba(140, 190, 245, .06));
  border: 1px solid var(--line); border-top-color: rgba(225, 242, 255, .34);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 14px 34px rgba(2, 10, 24, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.ctl { --lvl: 0; background: none; border-color: transparent; padding: 4px 2px 2px; gap: 4px; overflow: visible; }
.ctl::after { display: none; }
.ctl:hover { transform: none; box-shadow: none; border-color: transparent; }
.ctl .ico {
  width: 48px; height: 48px; border-radius: 50%; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(175, 215, 255, .2), rgba(140, 190, 245, .08));
  border: 1px solid var(--line);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.4), background .2s, border-color .2s, box-shadow .2s, color .2s;
}
.ctl:hover .ico { transform: translateY(-3px) scale(1.08); border-color: rgba(190, 228, 255, .6); box-shadow: 0 8px 20px rgba(60, 160, 255, .3); }
.ctl:active { transform: none; }
.ctl:active .ico { transform: scale(.93); transition-duration: .06s; }
.ctl b { font-size: 11.5px; font-weight: 600; color: var(--dim); }
.ctl i { display: none; }
.ctl.on, .ctl.off, .ctl.danger { background: none; border-color: transparent; }
.ctl.on .ico { color: var(--ink); background: linear-gradient(135deg, #6ee7c5, #a8f5df); border-color: rgba(200, 255, 240, .8); filter: none; box-shadow: 0 6px 18px rgba(110, 231, 197, .4); }
.ctl.on b { color: var(--ok); }
.ctl.off .ico { color: #fff; background: linear-gradient(135deg, #ff7b86, #e2566a); border-color: rgba(255, 190, 196, .7); box-shadow: 0 6px 18px rgba(255, 110, 125, .35); }
.ctl.off b { color: var(--bad); }
.ctl.off .ico::after { left: 10px; right: 10px; background: #fff; box-shadow: 0 0 0 1.5px #e2566a; }
.ctl.danger .ico { color: #fff; background: linear-gradient(135deg, #ff6e7d, #d8415a); border-color: rgba(255, 190, 196, .7); box-shadow: 0 6px 18px rgba(255, 90, 110, .4); }
.ctl.danger:hover { box-shadow: none; border-color: transparent; }
.ctl.danger:hover .ico { box-shadow: 0 10px 26px rgba(255, 90, 110, .55); }
/* говоришь — вокруг микрофона расходится кольцо */
.ctl.me-talking { box-shadow: none; }
.ctl.me-talking .ico { animation: none; box-shadow: 0 0 0 4px rgba(110, 231, 197, .35), 0 0 26px rgba(110, 231, 197, .65); }

/* Строка статистики — «таблеткой» */
#stats:not(:empty) {
  align-self: center; padding: 4px 14px; border-radius: 14px;
  background: rgba(4, 14, 28, .4); border: 1px solid var(--line-soft);
}
body.mini #stats:not(:empty) { align-self: stretch; border-radius: 0; border: 0; }

/* Всплывающие уведомления */
#toasts { position: fixed; left: 0; right: 0; top: 54px; z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 86%; padding: 9px 14px; border-radius: 14px; font-size: 13px;
  background: rgba(10, 28, 52, .92); border: 1px solid var(--line); border-top-color: rgba(225, 242, 255, .4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45); backdrop-filter: blur(12px);
  animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2) both;
  transition: opacity .3s, transform .3s;
}
.toast.warn { border-color: rgba(255, 210, 122, .6); color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
body.mini #toasts { top: 28px; }
body.mini .toast { font-size: 11px; padding: 4px 8px; }

/* Окно выбора, что показать */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 9, 18, .62); backdrop-filter: blur(6px); animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(100%, 720px); max-height: 100%; overflow-y: auto; animation: pop .3s cubic-bezier(.2, .9, .3, 1.2) both; }
#pickGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; gap: 6px; padding: 6px; text-align: left; }
.pick img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 8px; }
.pick span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#stats { flex: 0 0 auto; }
#ringBox, .controls, #secure, #hostBox, #status { flex: 0 0 auto; }

/* ================= Версия 1.10 ================= */
/* «Не показывать мне моё изображение»: камера работает, друзья видят, у себя — скрыто */
body.noself #lCam, body.noself #gSelf, body.noself .tile.self { display: none !important; }
/* Кого позвать в группу */
#inviteList { display: flex; flex-direction: column; gap: 8px; }
#inviteList:empty { display: none; }
#inviter .sheet { width: min(100%, 440px); }
button:disabled { opacity: .7; cursor: default; }
