/* атаракс — viewer page. v4: calm glass. Тёмная палитра Apple, стекло, пружинная анимация. */

/* Onest cyrillic */
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(fonts/onest-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Onest latin */
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(fonts/onest-latin.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 {
  /* поверхности */
  --atx-bg: #000;
  --atx-elevated: #1c1c1e;
  --atx-fill: rgba(120, 120, 128, .24);
  --atx-fill-2: rgba(120, 120, 128, .16);
  --atx-fill-3: rgba(120, 120, 128, .32);
  --atx-hover: rgba(255, 255, 255, .08);
  --atx-sep: rgba(255, 255, 255, .1);
  --atx-glass: rgba(30, 30, 32, .58);
  --atx-glass-strong: rgba(28, 28, 30, .78);
  /* текст */
  --atx-text: #f5f5f7;
  --atx-text-2: rgba(235, 235, 245, .62);
  --atx-text-3: rgba(235, 235, 245, .34);
  /* цвета: один акцент и системные статусы */
  --atx-accent: #0a84ff;
  --atx-accent-soft: rgba(10, 132, 255, .26);
  --atx-red: #ff453a;
  --atx-green: #30d158;
  --atx-orange: #ff9f0a;
  /* шрифт */
  --atx-font: "Onest", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  /* форма */
  --atx-chat-w: 380px;
  --atx-r-card: 28px;
  --atx-r-panel: 24px;
  /* движение: app.js подменяет пружины на точные linear()-кривые */
  --atx-spring: cubic-bezier(.32, 1.15, .6, 1);
  --atx-spring-dur: 520ms;
  --atx-snappy: cubic-bezier(.3, 1.3, .6, 1);
  --atx-snappy-dur: 380ms;
  --atx-soft: cubic-bezier(.2, .8, .2, 1);
  --atx-soft-dur: 650ms;
  --atx-ease: cubic-bezier(.25, .1, .25, 1);
  --atx-ease-out: cubic-bezier(.2, .8, .2, 1);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--atx-bg); }
body {
  margin: 0;
  background: var(--atx-bg);
  color: var(--atx-text);
  font: 400 15px/1.45 var(--atx-font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
input, textarea { font: inherit; }
input::placeholder { color: var(--atx-text-3); }
:focus-visible { outline: 2px solid var(--atx-accent); outline-offset: 2px; }
::selection { background: var(--atx-accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 17px; height: 17px; }
.icon-xs { width: 14px; height: 14px; }
.digits { display: inline-block; font-variant-numeric: tabular-nums; }

/* Цветовой отсвет кадра за интерфейсом: еле заметный, рисует app.js */
.ambient {
  position: fixed; inset: -15%;
  width: 130%; height: 130%;
  z-index: 0;
  pointer-events: none;
  filter: blur(100px) saturate(1.05);
  opacity: 0;
  transition: opacity 2s var(--atx-ease);
}
body.ambient-on .ambient { opacity: .32; }
#login, #room { position: relative; z-index: 1; }

/* ---------- Стекло ---------- */
.glass {
  background: var(--atx-glass);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  backdrop-filter: blur(40px) saturate(1.5);
  box-shadow:
    inset 0 .5px 0 rgba(255, 255, 255, .16),
    0 0 0 .5px rgba(255, 255, 255, .07),
    0 16px 48px -16px rgba(0, 0, 0, .7);
}
/* тонкий блик по кромке, сверху сильнее */
.glass::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: .5px;
  pointer-events: none;
  background: linear-gradient(170deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .04) 40%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, .1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* ---------- Кнопки ---------- */
.btn-cta, .btn-ghost {
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: background .25s var(--atx-ease), opacity .25s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.btn-cta { background: var(--atx-text); color: #000; }
.btn-cta:hover { background: #fff; }
.btn-ghost { background: var(--atx-fill); color: var(--atx-text); }
.btn-ghost:hover { background: var(--atx-fill-3); }
.btn-cta:active, .btn-ghost:active { transform: scale(.96); transition-duration: .12s, .12s, .12s; transition-timing-function: var(--atx-ease); }
.btn-cta:disabled { opacity: .55; }
.btn-danger-text { color: var(--atx-red); }
.btn-small { height: 44px; padding: 0 18px; font-size: 15px; }
.btn-link {
  align-self: center;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--atx-text-2);
  font-size: 14px;
  transition: color .2s;
}
.btn-link:hover { color: var(--atx-text); }
.icon-btn {
  width: 32px; height: 32px; flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--atx-text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.icon-btn:hover { background: var(--atx-hover); color: var(--atx-text); }
.icon-btn:active { transform: scale(.88); }
.icon-btn.round { background: var(--atx-fill); }
.icon-btn.round:hover { background: var(--atx-fill-3); }

/* ---------- Вход ---------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(90% 60% at 50% 0%, #1a1a1c 0%, #000 72%);
  overflow-y: auto;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  border-radius: var(--atx-r-card);
  overflow: hidden;
}
.login-hero {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 34px 28px 4px;
  text-align: center;
}
.hero-art { margin-bottom: 16px; display: flex; justify-content: center; }
.login-kicker { font-size: 13px; font-weight: 500; color: var(--atx-text-2); }
.login-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.login-sub { margin: 2px 0 0; font-size: 15px; color: var(--atx-text-2); }
.login-sub:empty { display: none; }
.login-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px; }

/* значок шага в онбординге */
.hero-icon {
  width: 68px; height: 68px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .05));
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .35), 0 0 0 .5px rgba(255, 255, 255, .08), 0 10px 30px -10px rgba(0, 0, 0, .8);
}
.hero-icon .icon { width: 32px; height: 32px; stroke-width: 1.5; }

.intro-text { margin: 0; font-size: 16px; line-height: 1.5; color: var(--atx-text-2); text-align: center; min-height: 96px; }
.intro-dots { display: flex; justify-content: center; gap: 6px; padding: 2px 0 6px; }
.intro-dots span {
  width: 7px; height: 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .22);
  transition: width var(--atx-spring-dur) var(--atx-spring), background .35s var(--atx-ease);
}
.intro-dots .is-done { background: rgba(255, 255, 255, .5); }
.intro-dots .is-on { width: 22px; background: var(--atx-text); }
.intro-dots .is-on.is-fresh { width: 7px; }
.step-actions { display: flex; gap: 10px; }
.step-actions > * { flex: 1; }

/* поля: сгруппированный список, как в Настройках */
.field-group { border-radius: 14px; background: var(--atx-fill-2); overflow: hidden; }
.field-row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 50px;
  padding: 0 6px 0 16px;
  transition: background .2s;
}
.field-row + .field-row::before {
  content: "";
  position: absolute; left: 16px; right: 0; top: 0;
  height: .5px;
  background: var(--atx-sep);
}
.field-row:focus-within { background: rgba(255, 255, 255, .04); }
.field-label { width: 66px; flex: none; font-size: 15px; color: var(--atx-text); }
.field {
  flex: 1; min-width: 0;
  height: 100%;
  border: 0; padding: 0;
  background: transparent;
  color: var(--atx-text);
  font-size: 16px;
  outline: none;
}
.field-row:has(.is-error) .field-label, .field-row.is-error .field-label { color: var(--atx-red); }
.field-solo {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--atx-fill-2);
  transition: box-shadow .2s;
}
.field-solo:focus { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.pw-toggle {
  width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--atx-text-3);
  display: grid; place-items: center;
  transition: color .2s, background .2s;
}
.pw-toggle:hover { color: var(--atx-text); background: var(--atx-hover); }
.pw-toggle[aria-pressed="true"] { color: var(--atx-accent); }
.login-error { margin: 0; font-size: 13px; line-height: 1.4; color: var(--atx-red); text-align: center; }

/* ---------- Аватарки ---------- */
.avatar {
  --hue: 330;
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, oklch(.66 .075 var(--hue)), oklch(.5 .07 var(--hue)));
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  user-select: none;
}
.avatar-photo, .avatar-sticker { background: var(--atx-fill); }
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sticker .sticker { padding: 12%; }
.avatar-xl { width: 88px; height: 88px; font-size: 36px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8), 0 0 0 .5px rgba(255, 255, 255, .1); }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }

.av-picker { display: flex; flex-direction: column; gap: 16px; }
/* сегменты с ползунком, который переезжает пружиной */
.seg {
  --seg-i: 0;
  --seg-n: 3;
  position: relative;
  display: flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--atx-fill);
}
.seg::before {
  content: "";
  position: absolute; top: 2px; bottom: 2px; left: 2px;
  width: calc((100% - 4px) / var(--seg-n));
  border-radius: 8px;
  background: #636366;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  transform: translateX(calc(100% * var(--seg-i)));
  transition: transform var(--atx-spring-dur) var(--atx-spring), width .3s var(--atx-ease);
}
.seg-btn {
  position: relative;
  flex: 1;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--atx-text);
  font-size: 13px;
  font-weight: 500;
}
.av-photo { display: flex; flex-direction: column; align-items: stretch; gap: 10px; min-height: 112px; }
.av-photo-btn { display: flex; cursor: pointer; }
.av-photo input:focus-visible + .av-photo-btn { outline: 2px solid var(--atx-accent); outline-offset: 2px; }
.av-photo-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--atx-text-3); text-align: center; }
.av-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.av-stickers { grid-template-columns: repeat(5, minmax(0, 1fr)); max-height: 210px; overflow-y: auto; padding: 3px; margin: -3px; scrollbar-width: none; }
.av-option {
  aspect-ratio: 1;
  min-height: 40px;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow .25s var(--atx-ease), transform var(--atx-snappy-dur) var(--atx-snappy);
}
.av-option .avatar { width: 100%; height: 100%; font-size: 15px; }
.av-option-sticker { border-radius: 14px; padding: 6px; }
.av-option:hover { box-shadow: 0 0 0 2px var(--atx-fill-3); }
.av-option:active { transform: scale(.9); }
.av-option[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--atx-text); }

/* ---------- PIN ---------- */
.pin-dots { display: flex; justify-content: center; gap: 20px; padding: 4px 0 0; }
.pin-dots span {
  width: 13px; height: 13px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5);
  transform: scale(.85);
  transition: background .12s, box-shadow .12s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.pin-dots .is-on { background: var(--atx-text); box-shadow: inset 0 0 0 1.5px var(--atx-text); transform: none; }
.pin-dots.is-busy span { animation: atx-breathe 1s var(--atx-ease) infinite alternate; }
.pin-dots.is-busy span:nth-child(2) { animation-delay: .12s; }
.pin-dots.is-busy span:nth-child(3) { animation-delay: .24s; }
.pin-dots.is-busy span:nth-child(4) { animation-delay: .36s; }
.pin-dots.is-ok span { background: var(--atx-green); box-shadow: inset 0 0 0 1.5px var(--atx-green); animation: none; }
/* затухающая тряска, как у экрана блокировки */
.pin-dots.shake { animation: atx-shake .5s linear; }
.pin-dots.shake span { box-shadow: inset 0 0 0 1.5px var(--atx-red); }
@keyframes atx-breathe { to { opacity: .35; } }
@keyframes atx-shake {
  0% { transform: none; }
  12% { transform: translateX(-14px); }
  26% { transform: translateX(11px); }
  40% { transform: translateX(-8px); }
  54% { transform: translateX(5px); }
  68% { transform: translateX(-2.5px); }
  82% { transform: translateX(1px); }
  100% { transform: none; }
}
.pin-error { min-height: 18px; }
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  justify-content: center;
  gap: 14px 22px;
  padding: 2px 0;
}
.key {
  width: 76px; height: 76px;
  border: 0;
  border-radius: 50%;
  background: var(--atx-fill);
  color: var(--atx-text);
  font-size: 30px;
  font-weight: 400;
  display: flex; align-items: center; justify-content: center;
  transition: background .45s var(--atx-ease);
}
.key:hover { background: var(--atx-fill-3); }
.key:active, .key.is-pressed { background: rgba(255, 255, 255, .42); transition: none; }
.key-text { background: transparent; font-size: 15px; font-weight: 500; color: var(--atx-text-2); }
.key-text:hover { background: transparent; color: var(--atx-text); }
.key-text:active, .key-text.is-pressed { background: var(--atx-hover); }
.pin-hint { margin: 0; text-align: center; font-size: 13px; color: var(--atx-text-3); }
@media (max-height: 820px) {
  .login-hero { padding-top: 24px; }
  .avatar-xl { width: 72px; height: 72px; font-size: 30px; }
  .hero-art { margin-bottom: 10px; }
  .key { width: 66px; height: 66px; font-size: 26px; }
  .keypad { grid-template-columns: repeat(3, 66px); gap: 10px 20px; }
  .login-body { padding: 18px 20px 20px; gap: 12px; }
}

/* ---------- Комната ---------- */
.room {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--atx-chat-w);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "player chat";
  column-gap: 20px;
  padding: 0 20px 20px;
  /* скрытие чата: колонка схлопывается, видео растёт на её место */
  transition: grid-template-columns var(--atx-soft-dur) var(--atx-soft), column-gap var(--atx-soft-dur) var(--atx-soft);
}
.room.chat-hidden { grid-template-columns: minmax(0, 1fr) 0px; column-gap: 0px; }
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  height: 64px;
  padding: 0 2px;
}
.brand { font-size: 19px; font-weight: 600; letter-spacing: -.03em; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--atx-fill-2);
  color: var(--atx-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .25s var(--atx-ease), transform var(--atx-snappy-dur) var(--atx-snappy);
}
.pill:hover { background: var(--atx-fill); }
.pill:active { transform: scale(.95); }
.viewers .icon { color: var(--atx-text-2); }
.viewers-word { color: var(--atx-text-2); font-weight: 400; }
.me-btn { padding: 0 14px 0 4px; }
.me-avatar { display: flex; }
.icon-pill { position: relative; width: 36px; padding: 0; justify-content: center; }
.icon-pill .ct-panel { fill: currentColor; stroke: none; opacity: .4; transition: opacity .35s var(--atx-ease); }
.icon-pill[aria-pressed="true"] .ct-panel { opacity: 0; }
.unread {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--atx-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #000;
}
.me-nick { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Плеер ---------- */
.player {
  /* the video and the info under it share one width; app.js measures the info */
  --info-h: var(--info-h-js, 96px);
  grid-area: player;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  container-type: size;
}
.frame {
  position: relative;
  flex: none;
  width: min(100cqw, (100cqh - var(--info-h)) * 16 / 9);
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: #000;
  isolation: isolate;
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .9), 0 0 0 .5px rgba(255, 255, 255, .09);
}
.frame video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}
.player:fullscreen { --info-h: 0px; background: #000; }
.player:fullscreen .stream-info { display: none; }
.player:fullscreen .frame { width: min(100vw, 100vh * 16 / 9); border-radius: 0; box-shadow: none; }

/* метка эфира в углу кадра */
.badge {
  position: absolute; left: 14px; top: 14px;
  z-index: 2;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(0, 0, 0, .42);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--atx-text);
  transition: opacity .4s var(--atx-ease), transform .5s var(--atx-ease-out);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--atx-red); }
.badge[data-state="live"]::before { animation: atx-live 2s var(--atx-ease) infinite; }
.badge:not([data-state="live"]) { opacity: 0; transform: translateY(-6px); }
@keyframes atx-live { 50% { opacity: .35; } }

.overlay {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--atx-ease), visibility 0s .5s;
}
.overlay strong { font-size: clamp(15px, 1.6cqw, 19px); font-weight: 600; letter-spacing: -.01em; }
.overlay span { font-size: clamp(13px, 1.2cqw, 15px); color: var(--atx-text-2); }
.player[data-state="connecting"] .overlay-connecting,
.player[data-state="offline"] .overlay-offline,
.player[data-state="reconnecting"] .overlay-reconnecting { opacity: 1; visibility: visible; transition: opacity .5s var(--atx-ease); }
.overlay-connecting { background: #000; gap: 14px; }
.overlay-offline { background: radial-gradient(70% 70% at 50% 45%, #161618 0%, #000 100%); }
.overlay-reconnecting { background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); gap: 6px; }
.overlay-reconnecting .spinner { margin-bottom: 8px; }
.overlay-icon {
  width: clamp(36px, 5cqw, 52px); height: auto;
  margin-bottom: 8px;
  fill: none; stroke: var(--atx-text-3); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round;
}

/* индикатор загрузки из восьми лепестков */
.spinner { position: relative; width: 26px; height: 26px; }
.spinner i {
  position: absolute; left: 50%; top: 0;
  width: 2.6px; height: 7.5px;
  margin-left: -1.3px;
  border-radius: 2px;
  background: var(--atx-text);
  transform-origin: 50% 13px;
  animation: atx-petal .8s linear infinite;
}
.spinner i:nth-child(1) { transform: rotate(0deg); animation-delay: -.7s; }
.spinner i:nth-child(2) { transform: rotate(45deg); animation-delay: -.6s; }
.spinner i:nth-child(3) { transform: rotate(90deg); animation-delay: -.5s; }
.spinner i:nth-child(4) { transform: rotate(135deg); animation-delay: -.4s; }
.spinner i:nth-child(5) { transform: rotate(180deg); animation-delay: -.3s; }
.spinner i:nth-child(6) { transform: rotate(225deg); animation-delay: -.2s; }
.spinner i:nth-child(7) { transform: rotate(270deg); animation-delay: -.1s; }
.spinner i:nth-child(8) { transform: rotate(315deg); animation-delay: 0s; }
@keyframes atx-petal { from { opacity: 1; } to { opacity: .15; } }

.unmute {
  position: absolute; left: 50%; top: 50%;
  z-index: 3;
  height: 50px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  color: var(--atx-text);
  display: flex; align-items: center; gap: 10px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform var(--atx-snappy-dur) var(--atx-snappy), opacity .3s, background .25s;
}
.unmute:hover { background: var(--atx-glass-strong); }
.unmute:active { transform: translate(-50%, -50%) scale(.95); }
@starting-style { .unmute { opacity: 0; transform: translate(-50%, -50%) scale(.9); } }
.unmute-short { display: none; }

.stats {
  position: absolute; left: 14px; top: 52px;
  z-index: 2;
  padding: 12px 14px;
  border-radius: 16px;
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 22px;
  row-gap: 4px;
  font-size: 12px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition: opacity .25s, transform var(--atx-spring-dur) var(--atx-spring);
}
@starting-style { .stats { opacity: 0; transform: translateY(-6px) scale(.97); } }
.stats .k { color: var(--atx-text-2); }
.stats .v { color: var(--atx-text); text-align: right; font-weight: 500; }
.stats .ok { color: var(--atx-green); }
.stats .warn { color: var(--atx-orange); }
.stats .bad { color: var(--atx-red); }

/* панель управления: стеклянная капсула внизу кадра */
.controls {
  position: absolute; left: 50%; bottom: 16px;
  z-index: 2;
  height: 52px;
  padding: 0 6px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 2px;
  color: var(--atx-text);
  transform: translateX(-50%);
  transition: opacity .35s var(--atx-ease), transform var(--atx-spring-dur) var(--atx-spring);
}
.controls-group { display: flex; align-items: center; gap: 2px; }
.player.idle .controls { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.96); pointer-events: none; transition: opacity .5s var(--atx-ease), transform .6s var(--atx-ease); }
.player.idle .badge { opacity: 0; }
.player.idle { cursor: none; }
.player:not([data-state="live"]):not([data-state="reconnecting"]) .controls,
.player:not([data-state="live"]):not([data-state="reconnecting"]) .stats { display: none; }
.ctl {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--atx-text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.ctl:hover { background: rgba(255, 255, 255, .12); }
.ctl:active { transform: scale(.86); }
.ctl[aria-pressed="true"] { background: rgba(255, 255, 255, .2); }
.controls-live { display: none; padding: 0 10px; font-size: 13px; font-weight: 600; }

.volume {
  --pct: 100%;
  width: 0;
  height: 28px;
  margin: 0;
  opacity: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: width var(--atx-spring-dur) var(--atx-spring), opacity .25s, margin var(--atx-spring-dur) var(--atx-spring);
}
.vol-group:hover .volume, .volume:focus-visible, .volume:active { width: 96px; opacity: 1; margin: 0 10px 0 4px; }
.volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(var(--atx-text), var(--atx-text)) 0 0 / var(--pct) 100% no-repeat, rgba(255, 255, 255, .22);
}
.volume::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); }
.volume::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--atx-text); }
.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.volume::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.volume.is-muted::-webkit-slider-runnable-track {
  background: linear-gradient(rgba(255, 255, 255, .4), rgba(255, 255, 255, .4)) 0 0 / var(--pct) 100% no-repeat, rgba(255, 255, 255, .22);
}
.volume.is-muted::-moz-range-progress { opacity: .4; }

/* ---------- Под видео: что смотрим ---------- */
.stream-info {
  flex: none;
  width: min(100cqw, (100cqh - var(--info-h)) * 16 / 9);
  padding: 16px 4px 0;
}
.si-view { display: flex; align-items: flex-start; gap: 16px; }
.si-main { flex: 1; min-width: 0; }
.si-meta { display: flex; align-items: center; gap: 8px; min-height: 20px; font-size: 13px; color: var(--atx-text-2); }
.stream-info.is-live .si-meta::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--atx-red); animation: atx-live 2s var(--atx-ease) infinite; }
.stream-info.is-live #si-status { color: var(--atx-text); font-weight: 500; }
#si-uptime::before { content: "·"; margin-right: 8px; color: var(--atx-text-3); }
.si-chip {
  height: 19px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--atx-fill);
  color: var(--atx-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 19px;
  letter-spacing: .02em;
}
.si-title { margin: 4px 0 0; font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.si-title.is-empty { color: var(--atx-text-3); }
.si-desc {
  margin: 4px 0 0;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--atx-text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.si-desc.is-open { display: block; -webkit-line-clamp: unset; max-height: 30cqh; overflow-y: auto; scrollbar-width: thin; }
.si-more {
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--atx-text);
  font-size: 14px;
  font-weight: 600;
  transition: opacity .2s;
}
.si-more:hover { opacity: .7; }
.si-edit { margin-top: 2px; }
.si-form { display: flex; flex-direction: column; gap: 8px; }
.si-title-input { font-size: 16px; font-weight: 600; }
.si-desc-input { height: auto; padding: 10px 14px; resize: none; font-size: 15px; line-height: 1.45; }
.si-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.si-form-actions .btn-small { height: 38px; padding: 0 16px; font-size: 14px; }
.si-count { margin-right: auto; font-size: 12px; color: var(--atx-text-3); }

/* ---------- Чат ---------- */
.chat {
  grid-area: chat;
  position: relative;
  display: flex; flex-direction: column;
  /* fixed width: while the column folds, the chat slides out whole instead of squeezing */
  width: var(--atx-chat-w);
  justify-self: start;
  min-height: 0;
  border-radius: var(--atx-r-panel);
  overflow: hidden;
  transition: opacity .45s var(--atx-ease), transform var(--atx-soft-dur) var(--atx-soft), visibility 0s;
}
.room.chat-hidden .chat {
  opacity: 0;
  transform: translateX(48px) scale(.98);
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s var(--atx-ease), transform var(--atx-soft-dur) var(--atx-soft), visibility 0s .5s;
}
.chat-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px;
  padding: 6px 12px 0 20px;
}
.chat-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.chat-head-end { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-clear {
  height: 30px; padding: 0 12px;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--atx-red);
  font-size: 14px;
  transition: background .2s;
}
.chat-clear:hover { background: rgba(255, 69, 58, .14); }
.chat-status {
  margin: 4px 12px 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 159, 10, .12);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--atx-orange);
  transition: opacity .3s, transform var(--atx-spring-dur) var(--atx-spring);
}
@starting-style { .chat-status { opacity: 0; transform: translateY(-6px); } }
.chat-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; animation: atx-live 1.4s var(--atx-ease) infinite; }
.chat-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages {
  list-style: none;
  margin: 0;
  padding: 10px 14px 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .14) transparent;
  -webkit-mask-image: linear-gradient(transparent, #000 18px);
  mask-image: linear-gradient(transparent, #000 18px);
}
.messages > :first-child { margin-top: auto; }
.msg {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  max-width: 84%;
  cursor: pointer;
}
.msg + .msg:not(.same) { margin-top: 10px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg:not(.me) { padding-left: 36px; }
.msg-avatar { position: absolute; left: 0; top: 0; width: 28px; height: 28px; font-size: 12px; }
.msg-bubble {
  max-width: 100%;
  padding: 7px 12px 7px;
  border-radius: 18px;
  background: var(--atx-fill);
  font-size: 15px;
  line-height: 1.38;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  transition: transform var(--atx-snappy-dur) var(--atx-snappy), filter .2s;
}
.msg.same:not(.me) .msg-bubble { border-top-left-radius: 7px; }
.msg.me.same .msg-bubble { border-top-right-radius: 7px; }
.msg.me .msg-bubble { background: var(--atx-accent); color: #fff; }
.msg:active .msg-bubble, .msg:active .msg-media { transform: scale(.97); }
.msg.is-menu .msg-bubble { filter: brightness(1.25); }
.msg-nick { display: block; margin-bottom: 1px; font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-sticker > .msg-nick { padding-left: 2px; }
.msg-time {
  float: right;
  margin: 7px 0 -3px 10px;
  font-size: 11px;
  line-height: 1;
  color: var(--atx-text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.msg.me .msg-time { color: rgba(255, 255, 255, .62); }
.msg-reply {
  display: block;
  margin: 2px 0 5px;
  padding: 3px 9px;
  border-left: 2.5px solid currentColor;
  border-radius: 3px 8px 8px 3px;
  background: rgba(255, 255, 255, .06);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.msg.me .msg-reply { background: rgba(255, 255, 255, .16); color: #fff; }
.msg-reply b { display: block; font-size: 12.5px; font-weight: 600; }
.msg-reply span { opacity: .75; }
.msg-sticker .msg-reply { background: var(--atx-fill); }
.msg-sticker .msg-media { position: relative; transition: transform var(--atx-snappy-dur) var(--atx-snappy); }
.msg-sticker .msg-time {
  position: absolute; right: 2px; bottom: 2px;
  float: none; margin: 0;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .5);
  color: #fff;
}
.msg-reply-btn {
  position: absolute; top: 50%; right: -38px;
  width: 30px; height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--atx-fill);
  color: var(--atx-text-2);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(.7);
  transition: opacity .18s, transform var(--atx-snappy-dur) var(--atx-snappy), color .2s;
}
.msg-reply-btn:hover { color: var(--atx-text); }
.msg.me .msg-reply-btn { right: auto; left: -38px; }
.msg:hover .msg-reply-btn, .msg-reply-btn:focus-visible { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
.msg-system {
  align-self: center;
  margin: 4px 0 10px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--atx-text-3);
  text-align: center;
}

/* реакции под сообщением */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.msg.me .msg-reactions { justify-content: flex-end; }
.reaction {
  height: 26px;
  padding: 0 9px 0 7px;
  border: 0;
  border-radius: 999px;
  background: var(--atx-fill);
  color: var(--atx-text);
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .2s, box-shadow .2s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.reaction:hover { background: var(--atx-fill-3); }
.reaction:active { transform: scale(.9); }
.reaction.is-mine { background: var(--atx-accent-soft); box-shadow: inset 0 0 0 1px rgba(10, 132, 255, .55); }
.reaction-emoji { font-size: 15px; line-height: 1; }
.reaction-count { display: inline-block; font-variant-numeric: tabular-nums; }

/* меню сообщения: реакции, ответить, удалить */
.msg-menu {
  position: fixed;
  z-index: 50;
  width: 252px;
  padding: 6px;
  border-radius: 20px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--atx-glass-strong);
}
.menu-reactions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; }
.menu-reaction {
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  transition: transform var(--atx-snappy-dur) var(--atx-snappy), background .15s;
}
.menu-reaction:hover { background: var(--atx-hover); transform: scale(1.14); }
.menu-reaction:active { transform: scale(.9); }
.menu-reaction.is-mine { background: var(--atx-accent-soft); }
.menu-items { display: flex; flex-direction: column; padding-top: 4px; border-top: .5px solid var(--atx-sep); }
.menu-item {
  height: 40px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--atx-text);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 15px;
  text-align: left;
  transition: background .15s;
}
.menu-item:hover { background: var(--atx-hover); }
.menu-danger { color: var(--atx-red); }

/* стикер: картинка, видео или Lottie */
.sticker {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.sticker img, .sticker video, .sticker svg { width: 100% !important; height: 100% !important; object-fit: contain; }
.sticker-fallback { font-size: 40px; line-height: 1; }
.msg-media { width: 148px; height: 148px; }

.chat-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  text-align: center;
  font-size: 14px;
  color: var(--atx-text-3);
  pointer-events: none;
  transition: opacity .4s var(--atx-ease);
}
.chat-empty-icon { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.new-msgs {
  position: absolute; left: 50%; bottom: 10px;
  z-index: 2;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--atx-text);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity .25s, transform var(--atx-spring-dur) var(--atx-spring);
}
@starting-style { .new-msgs { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.95); } }

.reply-bar {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px 2px;
  padding: 6px 6px 6px 12px;
  border-radius: 14px;
  background: var(--atx-fill-2);
  color: var(--atx-accent);
  transition: opacity .25s, transform var(--atx-spring-dur) var(--atx-spring);
}
@starting-style { .reply-bar { opacity: 0; transform: translateY(8px); } }
.reply-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.reply-bar-nick { font-weight: 600; }
.reply-bar-snippet { color: var(--atx-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-form {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 12px;
  transition: opacity .3s;
}
.chat-form:has(.chat-input:disabled) { opacity: .45; }
.composer {
  flex: 1; min-width: 0;
  height: 42px;
  display: flex; align-items: center;
  padding: 0 4px 0 16px;
  border-radius: 999px;
  background: var(--atx-fill-2);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .08);
  transition: box-shadow .25s, background .25s;
}
.composer:focus-within { background: var(--atx-fill); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.chat-input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; padding: 0;
  background: transparent;
  color: var(--atx-text);
  font-size: 15px;
  outline: none;
}
.sticker-btn {
  width: 34px; height: 34px; flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--atx-text-2);
  display: flex; align-items: center; justify-content: center;
  transition: color .2s, background .2s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.sticker-btn:hover { color: var(--atx-text); background: var(--atx-hover); }
.sticker-btn:active { transform: scale(.86); }
.sticker-btn[aria-expanded="true"] { color: var(--atx-accent); }
.chat-send {
  width: 36px; height: 36px; flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--atx-accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--atx-snappy-dur) var(--atx-snappy), opacity .2s, background .2s;
}
.chat-send .icon { stroke-width: 2.2; }
/* пустое поле: кнопка отправки притихает, с первым символом выпрыгивает */
.chat-form:has(.chat-input:placeholder-shown) .chat-send { transform: scale(.78); opacity: .35; background: var(--atx-fill-3); }
.chat-send:not(:disabled):active { transform: scale(.86); }

/* ---------- Панель стикеров ---------- */
.sticker-panel {
  flex: none;
  height: 300px;
  display: flex; flex-direction: column;
  border-top: .5px solid var(--atx-sep);
  overflow: hidden;
}
.sticker-tabs {
  flex: none;
  display: flex; gap: 4px;
  padding: 8px 10px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
@media (hover: hover) and (pointer: fine) {
  .sticker-tabs:hover { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
  .sticker-tabs::-webkit-scrollbar { height: 0; }
  .sticker-tabs:hover::-webkit-scrollbar { height: 4px; }
  .sticker-tabs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 2px; }
}
.sticker-tab {
  width: 42px; height: 42px; flex: none;
  padding: 7px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--atx-text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .25s var(--atx-ease), color .2s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.sticker-tab:hover { background: var(--atx-hover); color: var(--atx-text); }
.sticker-tab:active { transform: scale(.9); }
.sticker-tab[aria-selected="true"] { background: var(--atx-fill-3); color: var(--atx-text); }
.sticker-grid {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 2px 10px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  grid-auto-rows: 72px;
  gap: 4px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .14) transparent;
}
.sticker-tile {
  padding: 6px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  transition: background .2s, transform var(--atx-snappy-dur) var(--atx-snappy);
}
.sticker-tile:hover { background: var(--atx-hover); }
.sticker-tile:active { transform: scale(.86); }
.sticker-empty { grid-column: 1 / -1; grid-row: span 3; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--atx-text-2); font-size: 14px; padding: 0 20px; }

.admin-form {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.admin-form .btn-cta { height: 44px; font-size: 15px; }
.admin-title { margin: 0; font-size: 15px; font-weight: 600; }
.admin-msg { margin: 0; font-size: 13px; line-height: 1.45; color: var(--atx-text-2); }
.admin-msg:empty { display: none; }
.admin-msg.is-error { color: var(--atx-red); }
.admin-packs { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.admin-pack { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; line-height: 1.3; }
.admin-pack + .admin-pack { border-top: .5px solid var(--atx-sep); }
.admin-pack-icon { width: 38px; height: 38px; flex: none; }
.admin-pack-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.admin-pack-name small { display: block; color: var(--atx-text-3); font-size: 12.5px; }
.admin-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--atx-text-3); }
.admin-tools { margin-top: 6px; padding-top: 8px; border-top: .5px solid var(--atx-sep); }
.admin-tools summary { min-height: 38px; display: flex; align-items: center; cursor: pointer; font-size: 14px; color: var(--atx-text-2); list-style: none; }
.admin-tools summary::-webkit-details-marker { display: none; }
.admin-tools summary::after { content: "›"; margin-left: 8px; font-size: 18px; transition: transform .3s var(--atx-ease); }
.admin-tools[open] summary::after { transform: rotate(90deg); }
.admin-tools[open] { display: flex; flex-direction: column; gap: 10px; }
.admin-row { display: flex; gap: 8px; }
.admin-row .field { flex: 1; min-width: 0; }

/* ---------- Окна: люди в комнате и профиль ---------- */
dialog::backdrop { background: rgba(0, 0, 0, .45); transition: opacity .35s var(--atx-ease); }
@starting-style { dialog[open]::backdrop { opacity: 0; } }
dialog.is-closing::backdrop { opacity: 0; }
.drawer {
  margin: 0 0 0 auto;
  width: min(380px, 92vw);
  height: 100dvh;
  max-height: none;
  max-width: none;
  padding: 12px;
  border: 0;
  background: transparent;
  color: var(--atx-text);
  overflow: visible;
}
.drawer-panel {
  position: relative;
  height: 100%;
  display: flex; flex-direction: column;
  border-radius: var(--atx-r-panel);
  background: var(--atx-glass-strong);
  overflow: hidden;
}
.sheet-grabber { display: none; width: 36px; height: 5px; margin: 8px auto 0; border-radius: 5px; background: rgba(255, 255, 255, .28); flex: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 16px 10px 20px; }
.drawer-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.drawer-sub { margin: 4px 0 0; font-size: 13px; color: var(--atx-text-2); }
.people-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 12px; border-radius: 14px; transition: background .2s; }
.person:hover { background: var(--atx-hover); }
.person-avatar { width: 38px; height: 38px; font-size: 16px; }
.person-nick { flex: 1; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-tag { font-size: 12px; color: var(--atx-text-2); background: var(--atx-fill); padding: 3px 9px; border-radius: 999px; }

.profile {
  width: min(400px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--atx-text);
  overflow: visible;
}
.profile .login-card { max-height: calc(100dvh - 24px); overflow-y: auto; scrollbar-width: none; background: var(--atx-glass-strong); }
.hero-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
/* focus lands on the panel itself when a dialog opens, not on its close button */
.drawer-panel:focus, .profile .login-card:focus { outline: none; }

/* ---------- Телефон вертикально / узкий экран ---------- */
@media (max-width: 900px) {
  .room {
    display: flex; flex-direction: column;
    height: 100dvh;
    gap: 8px;
    padding: 0 8px;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .topbar { flex: none; height: 52px; padding: 0 6px; }
  .brand { font-size: 17px; }
  .pill { height: 34px; padding: 0 12px; }
  .viewers-word, .me-nick { display: none; }
  .me-btn { width: 34px; padding: 0; justify-content: center; }
  .player { flex: none; width: 100%; container-type: normal; display: block; }
  .stream-info { width: auto; padding: 10px 8px 2px; }
  .si-title { font-size: 17px; margin-top: 2px; }
  .si-meta { font-size: 12px; }
  .si-desc { font-size: 14px; -webkit-line-clamp: 1; }
  .si-desc.is-open { max-height: 30dvh; }
  .frame { width: 100%; border-radius: 18px; }
  .badge { left: 10px; top: 10px; height: 26px; font-size: 12px; }
  .stats { left: 10px; top: 44px; padding: 10px 12px; column-gap: 18px; row-gap: 2px; font-size: 11px; }
  .controls { height: 46px; bottom: 10px; }
  .ctl { width: 38px; height: 38px; }
  .chat { flex: 1; width: auto; border-radius: 22px 22px 0 0; }
  .room.chat-hidden .chat { display: none; }
  .room.chat-hidden .player { margin-block: auto; }
  .icon-pill { width: 34px; }
  .chat-head { min-height: 44px; padding: 4px 10px 0 18px; }
  .msg-media { width: 132px; height: 132px; }
  .chat-form { padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
  .chat-input { font-size: 16px; }
  .sticker-panel { height: min(42dvh, 300px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .sticker-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); grid-auto-rows: 66px; }
  .unmute { height: 44px; padding: 0 16px 0 14px; font-size: 14px; }
  .unmute-long { display: none; }
  .unmute-short { display: inline; }

  /* люди: лист снизу */
  .drawer { margin: auto 0 0; width: 100%; max-width: 100%; height: fit-content; max-height: 82dvh; padding: 0 8px max(8px, env(safe-area-inset-bottom)); }
  .drawer-panel { height: auto; max-height: calc(82dvh - 8px); border-radius: 30px; touch-action: pan-y; }
  .sheet-grabber { display: block; }
  .drawer-head { padding-top: 12px; }
}

/* Сенсорные экраны: громкость кнопками телефона, меню по тапу */
@media (hover: none) {
  .volume { display: none; }
  .msg-reply-btn { display: none !important; }
}

/* ---------- Телефон горизонтально: только видео ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .room { display: block; height: 100dvh; padding: 0; }
  .topbar, .chat { display: none; }
  .player { --info-h: 0px; position: fixed; inset: 0; aspect-ratio: auto; display: flex; container-type: size; }
  .stream-info { display: none; }
  .frame { border-radius: 0; box-shadow: none; width: min(100cqw, 100cqh * 16 / 9); }
  .player[data-state="live"] .controls-live { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .spinner i { animation: none; opacity: .6; }
}
