/* ============ Шрифты ============ */

@font-face {
  font-family: 'Involve';
  src: url('/fonts/involve-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Involve';
  src: url('/fonts/involve-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('/fonts/Montserrat-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Unbounded';
  src: url('/fonts/Unbounded-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* ============ Основа ============ */

:root {
  --bg: #000;
  --accent: #fff; /* цвет «главных» кнопок, своих сообщений, значков — тема комнаты может его менять */
  --on-accent: #000;
  --fill: #131315;
  --fill2: #1c1c1e;
  --fill3: #2c2c2e;
  --fill4: #3a3a3c;
  --sep: rgba(255, 255, 255, 0.09);
  --sep2: rgba(255, 255, 255, 0.18);
  --label: #fff;
  --label2: rgba(255, 255, 255, 0.62);
  --label3: rgba(255, 255, 255, 0.34);
  --glass: rgba(24, 24, 26, 0.66);
  --blur: blur(26px) saturate(170%);

  --font: 'Involve', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Involve', sans-serif;

  /* кривая iOS для шторок и переходов + мягкая «пружина» с лёгким перелётом */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.45, 0.5, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html {
  height: 100%;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--label);
  font: 400 15px/1.45 var(--font);
  font-synthesis: none;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

/* Приложение занимает ровно видимую часть экрана — и когда на телефоне открыта клавиатура */
#app {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vvt, 0px);
  height: 100vh;
  height: var(--vvh, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: view-in 0.6s var(--ease) backwards;
}
.view.push {
  animation: push-in 0.55s var(--ease) backwards;
}
.view.pop {
  animation: pop-in 0.55s var(--ease) backwards;
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
}
@keyframes push-in {
  from {
    opacity: 0.4;
    transform: translateX(32%);
  }
}
@keyframes pop-in {
  from {
    opacity: 0.4;
    transform: translateX(-14%);
  }
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
  font-weight: 400;
}
b,
strong {
  font-weight: 500;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  text-align: inherit;
  touch-action: manipulation;
}
a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-color: var(--label3);
}

:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.icon {
  flex: none;
  display: block;
}
.muted {
  color: var(--label2);
}
.spacer {
  flex: 1;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--fill4) transparent;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--fill4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ============ Кнопки и поля ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.5s var(--spring),
    background 0.25s,
    opacity 0.25s,
    box-shadow 0.25s;
}
.btn:active {
  transform: scale(0.94);
  transition-duration: 0.1s;
}
.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-soft {
  background: rgba(255, 255, 255, 0.12);
}
.btn-ghost {
  color: var(--label2);
  box-shadow: inset 0 0 0 1px var(--sep2);
}
.btn-danger {
  background: var(--fill4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.btn-sm {
  height: 34px;
  padding: 0 15px;
  font-size: 13.5px;
  gap: 6px;
}
.btn-lg {
  height: 54px;
  padding: 0 28px;
  font-size: 16px;
}
.btn-block {
  width: 100%;
}

.btn-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--label2);
  transition:
    transform 0.5s var(--spring),
    background 0.25s,
    color 0.25s;
}
.btn-icon:active {
  transform: scale(0.88);
  background: rgba(255, 255, 255, 0.1);
  transition-duration: 0.1s;
}
.link {
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--label3);
}

@media (hover: hover) {
  .btn-primary:hover {
    background: #e6e6e6;
  }
  .btn-soft:hover {
    background: rgba(255, 255, 255, 0.18);
  }
  .btn-ghost:hover {
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  }
  .btn-icon:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
  }
}

.input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--fill2);
  color: #fff;
  font-size: 16px; /* меньше нельзя: айфон начнёт увеличивать страницу при вводе */
  outline: none;
  transition:
    background 0.25s,
    box-shadow 0.25s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder {
  color: var(--label3);
}
.input:focus {
  background: #242427;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.32);
}
.input[type='search']::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.4);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field > span {
  padding: 0 4px;
  font-family: 'Montserrat', var(--font);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label2);
}
.form-error {
  padding: 0 4px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #fff;
}
.form-error:not(:empty)::before {
  content: '— ';
  color: var(--label3);
}
.form-error:empty {
  display: none;
}

/* Переключатель с плавающим «бегунком» */
.segmented {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: 14px;
  background: var(--fill2);
  isolation: isolate;
}
.seg-thumb {
  position: absolute;
  z-index: -1;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: 11px;
  background: var(--fill4);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.segmented.ready .seg-thumb {
  transition:
    transform 0.55s var(--ease),
    width 0.55s var(--ease);
}
.seg-btn {
  flex: 1;
  min-width: 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 11px;
  text-align: center;
  font-weight: 500;
  font-size: 14px;
  color: var(--label2);
  transition:
    color 0.3s,
    transform 0.4s var(--spring);
}
.seg-btn.on {
  color: #fff;
}
.seg-btn:active {
  transform: scale(0.95);
}

/* Список выбора, как в настройках iOS */
.choice-list {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--fill2);
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  transition: background 0.2s;
}
.choice + .choice::before {
  content: '';
  position: absolute;
  top: 0;
  left: 58px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.choice:active {
  background: var(--fill3);
}
.choice-icon {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--label2);
  transition: color 0.3s;
}
.choice.on .choice-icon {
  color: #fff;
}
.choice-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.choice-text b {
  font-weight: 500;
}
.choice-text small {
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.35;
}
.choice-mark {
  flex: none;
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.25s,
    transform 0.5s var(--spring);
}
.choice.on .choice-mark {
  opacity: 1;
  transform: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 11px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--label2);
  font-size: 12.5px;
  white-space: nowrap;
}
.chip-dark {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.chip-accent {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}
.chip-btn {
  height: 32px;
  border-radius: 16px;
  color: #fff;
  transition: transform 0.4s var(--spring);
}
.chip-btn:active {
  transform: scale(0.93);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: 'Montserrat', var(--font);
  font-size: 10.5px;
  line-height: 1;
  animation: badge-pop 0.5s var(--spring);
}
.badge.quiet {
  background: rgba(255, 255, 255, 0.14);
  color: var(--label2);
}
@keyframes badge-pop {
  from {
    transform: scale(0);
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--label2);
  font-size: 12.5px;
  white-space: nowrap;
}
.tag.ok {
  color: #fff;
}

.hint {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--fill);
  color: var(--label2);
  font-size: 13px;
  line-height: 1.5;
}
.hint .icon {
  margin-top: 2px;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  text-align: center;
  color: var(--label2);
}
.empty .icon {
  color: var(--label3);
  margin-bottom: 6px;
}
.empty p {
  color: #fff;
  font-size: 16px;
}
.empty small {
  font-size: 13.5px;
  max-width: 300px;
}
.empty .btn {
  margin-top: 12px;
}
.empty-line {
  padding: 12px 4px;
  color: var(--label2);
  font-size: 13.5px;
  line-height: 1.5;
}

.avatar {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-family: 'Montserrat', var(--font);
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  user-select: none;
  -webkit-user-select: none;
}
.avatar-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #000;
  border: 2px solid #000;
  box-shadow: inset 0 0 0 1.5px var(--label3);
}
.avatar-dot.online {
  background: #fff;
  box-shadow: none;
}
/* «Спит»: белый полумесяц на чёрном кружке */
.avatar-dot.away {
  background: #000;
  box-shadow: inset -3.5px 0 0 0 #fff;
}

/* ============ Уведомления: баннер сверху, как в iOS ============ */

#toasts {
  position: fixed;
  z-index: 90;
  top: calc(var(--vvt, 0px) + var(--safe-t) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 20px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 13px 44px 13px 14px;
  border-radius: 24px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    0 18px 50px -10px rgba(0, 0, 0, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  font-size: 14px;
  touch-action: pan-x;
  animation: toast-in 0.7s var(--spring);
  transition:
    opacity 0.3s,
    transform 0.4s var(--ease);
}
.toast.out {
  opacity: 0;
  transform: translateY(-130%) scale(0.92);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-140%) scale(0.88);
  }
}
.toast::before {
  content: 'i';
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font: 400 12px/1 'Montserrat', var(--font);
}
.toast-ok::before {
  content: '✓';
  background: #fff;
  color: #000;
}
.toast-warn::before,
.toast-error::before {
  content: '!';
  box-shadow: inset 0 0 0 1.5px #fff;
  background: none;
}
.toast-text {
  flex: 1;
  min-width: 140px;
  overflow-wrap: anywhere;
}
.toast-actions {
  display: flex;
  gap: 6px;
}
.toast-x {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-top: -14px;
  border-radius: 50%;
  color: var(--label3);
}

/* ============ Окна: на ПК — по центру, на телефоне — шторка снизу с жестами ============ */

.modal-back {
  position: fixed;
  z-index: 80;
  left: 0;
  right: 0;
  top: var(--vvt, 0px);
  height: 100vh;
  height: var(--vvh, 100dvh);
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, calc(0.62 * var(--dim, 1)));
  -webkit-backdrop-filter: blur(calc(14px * var(--dim, 1)));
  backdrop-filter: blur(calc(14px * var(--dim, 1)));
  animation: fade 0.3s;
  transition:
    background 0.4s,
    backdrop-filter 0.4s,
    -webkit-backdrop-filter 0.4s;
}
.modal-back.out {
  --dim: 0;
  pointer-events: none;
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--fill);
  border-radius: 30px;
  box-shadow:
    0 40px 100px -20px #000,
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  animation: dialog-in 0.6s var(--spring);
  transition:
    transform 0.5s var(--ease),
    opacity 0.3s;
  will-change: transform;
}
.modal-back.out .modal {
  opacity: 0;
  transform: scale(0.94);
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
}
.modal.dragging {
  transition: none;
}
.modal-grip {
  display: none;
  flex: none;
  height: 22px;
  cursor: grab;
  touch-action: none;
}
.modal-grip::after {
  content: '';
  display: block;
  width: 38px;
  height: 5px;
  margin: 9px auto 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.28);
}
.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 4px 24px;
  touch-action: none;
}
.modal-head h2 {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: -0.02em;
}
.modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 20px 22px;
}
.modal .hint,
.modal .invite-code {
  background: var(--fill2);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.modal-sub {
  padding: 0 4px;
  font-family: 'Montserrat', var(--font);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label2);
}

/* ============ Вход ============ */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  overflow-y: auto;
  overflow-x: hidden;
}
.orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.orbs i {
  position: absolute;
  width: min(62vmin, 640px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.06), transparent 65%);
  transition: translate 1.2s var(--ease);
}
.orbs i:nth-child(1) {
  left: 26%;
  top: 8%;
  animation: float 11s ease-in-out infinite alternate;
}
.orbs i:nth-child(2) {
  left: 40%;
  top: 22%;
  animation: float 13s ease-in-out infinite alternate-reverse;
}
@keyframes float {
  to {
    transform: translate(2.5%, -4%) scale(1.04);
  }
}
.auth-hero,
.auth-side {
  position: relative;
}
.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: 56px clamp(28px, 6vw, 96px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand-lg {
  font-size: 19px;
  gap: 12px;
}
.logo-mark {
  flex: none;
  display: block;
}
.auth-hero h1 {
  font-family: var(--display);
  font-size: clamp(30px, 4.2vw, 60px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  max-width: 11em;
}
.auth-hero h1 em {
  font-style: normal;
  color: var(--label3);
}
.auth-lead {
  font-size: 17px;
  line-height: 1.55;
  color: var(--label2);
  max-width: 30em;
}
.auth-feats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  max-width: 600px;
}
.feat {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--sep);
}
.feat-icon {
  flex: none;
  color: var(--label2);
  margin-top: 1px;
}
.feat b {
  display: block;
  font-size: 14.5px;
}
.feat small {
  color: var(--label2);
  font-size: 13px;
  line-height: 1.4;
  display: block;
}
.auth-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px clamp(20px, 4vw, 64px);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 26px;
  border-radius: 32px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    0 50px 120px -40px #000,
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: rise 0.8s 0.15s var(--ease) backwards;
}
.auth-invite {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13.5px;
  line-height: 1.45;
}
.auth-hint {
  color: var(--label3);
  font-size: 12.5px;
  text-align: center;
}
.auth-hint:empty {
  display: none;
}

/* ============ Главный экран ============ */

.topbar {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--safe-t) + 12px) max(28px, var(--safe-r)) 12px max(28px, var(--safe-l));
  background: transparent;
  transition:
    background 0.35s,
    box-shadow 0.35s;
}
.topbar.scrolled {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: 0 1px 0 var(--sep);
}
.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px 0 4px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.09);
  max-width: 220px;
  transition: transform 0.5s var(--spring);
}
.profile-btn:active {
  transform: scale(0.94);
}
.profile-btn span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
}
.home-main,
.home-friends {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.home-main {
  padding: calc(var(--safe-t) + 84px) max(36px, var(--safe-r)) 56px max(36px, var(--safe-l));
}
.home-friends {
  padding: calc(var(--safe-t) + 84px) 24px 40px;
  border-left: 1px solid var(--sep);
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 18px 0 8px;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(30px, 3.8vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  max-width: 10em;
}
.hero p {
  margin-top: 12px;
  color: var(--label2);
  font-size: 16px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.join-form {
  display: flex;
  gap: 8px;
  flex: 1 1 320px;
  max-width: 440px;
}
.join-form .input {
  flex: 1;
  min-width: 120px;
}
.join-form .input {
  height: 54px;
  border-radius: 27px;
  padding: 0 22px;
}
.join-form .btn {
  height: 54px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 44px 0 16px;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: -0.02em;
}
.section-title .icon {
  color: var(--label2);
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 26px 18px;
}
.room-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition: transform 0.55s var(--spring);
}
.room-card:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}
.stagger > * {
  animation: rise 0.8s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}
.room-card.skeleton {
  aspect-ratio: 16 / 12;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--fill) 25%, var(--fill2) 50%, var(--fill) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.room-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.room-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.05);
  transition:
    transform 0.9s var(--ease),
    filter 0.5s;
}
@media (hover: hover) {
  .room-card:hover .room-card-thumb img {
    transform: scale(1.05);
    filter: grayscale(0.6);
  }
}
.room-card-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--label3);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.09), transparent 60%),
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(255, 255, 255, 0.025) 14px 15px), var(--fill);
}
.room-card-count {
  position: absolute;
  top: 10px;
  right: 10px;
}
.room-card-prov {
  position: absolute;
  left: 10px;
  bottom: 10px;
}
.room-card-body {
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.room-card-name {
  font-weight: 500;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-card-sub {
  color: var(--label2);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-card-host {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--label3);
  font-size: 12.5px;
  min-height: 18px;
}

/* Нижняя панель вкладок: «плавающая» стеклянная капсула */
.tabbar {
  display: none;
}

/* ============ Друзья и строки с людьми ============ */

.friends-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel-title {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}
.list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 4px 4px;
  font-family: 'Montserrat', var(--font);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label2);
}
.user-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  min-width: 0;
}
.user-row + .user-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 54px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crown {
  color: #fff;
  display: inline-flex;
}
.user-sub {
  color: var(--label2);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.user-actions .btn-icon {
  width: 34px;
  height: 34px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-head b,
.profile-head small {
  display: block;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 4px;
}
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition:
    transform 0.5s var(--spring),
    outline-offset 0.3s;
  outline: 2px solid transparent;
  outline-offset: 3px;
}
.swatch.on {
  outline-color: #fff;
  transform: scale(1.08);
}

/* ============ Комната ============ */

.room-gate {
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.gate h2 {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.gate-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fill2);
  box-shadow: inset 0 0 0 1px var(--sep2);
  margin-bottom: 6px;
}
.gate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    'top side'
    'main side';
  background: var(--bg);
}

.room-top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 12px) 20px 12px max(14px, var(--safe-l));
  min-width: 0;
}
.room-title {
  flex: 1;
  min-width: 0;
}
.room-name {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--label2);
  font-size: 12.5px;
  white-space: nowrap;
}
.room-meta b {
  font-family: 'Montserrat', var(--font);
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.12em;
  user-select: all;
  -webkit-user-select: all;
}
.sep {
  color: var(--label3);
}

.room-main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 14px 18px max(20px, var(--safe-l));
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.player {
  position: absolute;
  inset: 0;
}
.player > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges; /* полоса прокрутки не сдвигает содержимое: по центру остаётся по центру */
  background: radial-gradient(520px 320px at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%), #050505;
  animation: fade 0.5s;
}
.stage-empty {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  animation: rise 0.8s var(--ease) backwards;
}
.stage-empty h3 {
  font-family: var(--display);
  font-size: clamp(18px, 2.2vw, 24px);
  letter-spacing: -0.03em;
}
.stage-empty p {
  color: var(--label2);
  max-width: 34em;
}
.stage-empty .url-form {
  margin-top: 6px;
}
.stage-empty .sources {
  justify-content: center;
}
.stage-empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #000;
  margin-bottom: 4px;
}
.stage-empty-icon.warn {
  background: none;
  color: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.5);
}

.url-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.url-row .input {
  flex: 1 1 210px;
  min-width: 0;
}
.url-row .input {
  height: 48px;
  border-radius: 24px;
  padding: 0 20px;
}
.url-row .btn {
  height: 48px;
  flex: none;
}

.nudge {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 8px 8px 18px;
  border-radius: 28px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-size: 13.5px;
  animation: nudge-in 0.7s var(--spring);
}
@keyframes nudge-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-24px) scale(0.9);
  }
}
.nudge small {
  flex-basis: 100%;
  text-align: center;
  color: var(--label2);
  padding-right: 10px;
}

.stage-fabs {
  display: none;
}
.fab {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: transform 0.5s var(--spring);
}
.fab:active {
  transform: scale(0.88);
}
.fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
}

.nowbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  min-width: 0;
}
.now-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.now-text {
  min-width: 0;
}
.now-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-sub {
  color: var(--label2);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Правая панель: чат, люди, очередь */
.side {
  grid-area: side;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: calc(var(--safe-t) + 12px) max(12px, var(--safe-r)) 12px 0;
  border-radius: 28px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.grip-zone {
  display: none;
}
.tabs {
  flex: none;
  margin: 10px 10px 6px;
}
.tabs .seg-btn {
  height: 36px;
  font-size: 13.5px;
}
.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: fade 0.45s;
}
.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 16px calc(16px + var(--safe-b));
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 6px;
  color: var(--label2);
  font-size: 13.5px;
}

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

.chat-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px 6px;
}
.chat-list > :first-child {
  margin-top: auto;
}
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
  margin-top: 9px;
}
.msg.cont {
  margin-top: 0;
}
.msg.own {
  justify-content: flex-end;
}
.msg.fresh,
.msg-sys.fresh {
  animation: msg-in 0.6s var(--spring);
  transform-origin: 0 100%;
}
.msg.own.fresh {
  transform-origin: 100% 100%;
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.86);
  }
}
.msg-ava {
  flex: none;
  width: 30px;
  height: 30px;
}
.msg-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: min(82%, 420px);
}
.msg.own .msg-col {
  align-items: flex-end;
}
.msg-bubble {
  max-width: 100%;
  padding: 8px 13px 7px;
  border-radius: 20px 20px 20px 6px;
  background: var(--fill3);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.4;
  user-select: text;
  -webkit-user-select: text;
}
.msg.cont .msg-bubble {
  border-radius: 20px;
}
.msg.own .msg-bubble {
  border-radius: 20px 20px 6px 20px;
  background: var(--accent);
  color: var(--on-accent);
}
.msg-name {
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 1px;
  color: var(--label2);
}
.msg-text a {
  text-decoration: underline;
}
.msg-time {
  float: right;
  margin: 5px 0 0 10px;
  font-family: 'Montserrat', var(--font);
  font-size: 10px;
  opacity: 0.5;
  user-select: none;
  -webkit-user-select: none;
}
.msg-sys {
  align-self: center;
  max-width: 92%;
  margin: 10px 0 3px;
  color: var(--label3);
  font-size: 12.5px;
  text-align: center;
  overflow-wrap: anywhere;
}
.new-pill {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px -6px #000;
  animation: nudge-in 0.6s var(--spring);
}
.typing {
  flex: none;
  height: 18px;
  padding: 0 20px;
  color: var(--label3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-form {
  flex: none;
  display: flex;
  align-items: center;
  padding: 4px 12px calc(12px + var(--safe-b));
}
.chat-input {
  height: 46px;
  border-radius: 23px;
  padding: 0 52px 0 18px;
  background: var(--fill3);
}
.chat-input:focus {
  background: #343437;
}
.btn-send {
  flex: none;
  width: 34px;
  height: 34px;
  margin-left: -42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.5s var(--spring),
    opacity 0.2s;
}
.chat-form.has .btn-send {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.chat-form.has .btn-send:active {
  transform: scale(0.88);
}

/* ----- очередь, приглашения ----- */

.queue-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  min-width: 0;
}
.queue-item + .queue-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 92px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.queue-thumb {
  flex: none;
  width: 80px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: var(--fill3);
  color: var(--label3);
}
.queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}
.queue-title {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.invite-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--fill);
  color: var(--label2);
  font-size: 13.5px;
}
.invite-code b {
  color: #fff;
  font-family: 'Montserrat', var(--font);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: 0.22em;
  user-select: all;
  -webkit-user-select: all;
}
.copy-row {
  display: flex;
  gap: 8px;
}
.copy-row .btn {
  flex: none;
  height: 48px;
}
.copy-row .input {
  font-size: 14px;
  color: var(--label2);
}
.invite-list {
  margin: -4px 0 0;
}

/* ============ Планшет и телефон ============ */

@media (max-width: 1100px) {
  .home-body {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .room {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
}

@media (max-width: 860px) {
  .hide-mobile {
    display: none !important;
  }

  /* вход */
  .auth {
    display: block;
  }
  .orbs i {
    width: 92vw;
  }
  .orbs i:nth-child(1) {
    left: -30%;
    top: 4%;
  }
  .orbs i:nth-child(2) {
    left: 20%;
    top: 14%;
  }
  .auth-hero {
    padding: calc(var(--safe-t) + 30px) 24px 4px;
    gap: 16px;
  }
  .auth-hero h1 {
    font-size: 29px;
  }
  .auth-lead {
    font-size: 15px;
  }
  .auth-feats,
  .auth-hero .sources {
    display: none;
  }
  .auth-side {
    padding: 22px 16px calc(30px + var(--safe-b));
  }
  .auth-card {
    padding: 22px;
    max-width: 520px;
  }

  /* главный экран: вкладки внизу */
  .topbar {
    padding: calc(var(--safe-t) + 10px) max(18px, var(--safe-r)) 10px max(20px, var(--safe-l));
  }
  .home-body {
    display: block;
  }
  .home-main,
  .home-friends {
    height: 100%;
    border: 0;
    padding: calc(var(--safe-t) + 70px) max(18px, var(--safe-r)) calc(120px + var(--safe-b)) max(20px, var(--safe-l));
  }
  .home[data-tab='rooms'] .home-friends,
  .home[data-tab='friends'] .home-main {
    display: none;
  }
  .home-main,
  .home-friends {
    animation: view-in 0.55s var(--ease) backwards;
  }
  .hero h1 {
    font-size: 30px;
  }
  .hero p {
    font-size: 15px;
  }
  .hero-actions {
    flex-direction: column;
  }
  .hero-actions .btn-lg {
    width: 100%;
  }
  .join-form {
    max-width: none;
    flex: none;
  }
  .section-title {
    margin: 34px 0 14px;
  }
  .rooms-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .tabbar {
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: calc(var(--safe-b) + 12px);
    transform: translateX(-50%);
    display: flex;
    width: min(360px, calc(100% - 32px));
    padding: 5px;
    border-radius: 34px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    box-shadow:
      0 20px 50px -10px rgba(0, 0, 0, 0.9),
      inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    isolation: isolate;
    transition:
      transform 0.6s var(--ease),
      opacity 0.3s;
    animation: tabbar-in 0.9s 0.2s var(--spring) backwards;
  }
  @keyframes tabbar-in {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(90px);
    }
  }
  .tabbar-thumb {
    position: absolute;
    z-index: -1;
    top: 5px;
    left: 0;
    height: calc(100% - 10px);
    border-radius: 29px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
  .tabbar.ready .tabbar-thumb {
    transition:
      transform 0.6s var(--ease),
      width 0.6s var(--ease);
  }
  .tabbar-btn {
    flex: 1;
    min-width: 0;
    height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 29px;
    color: var(--label2);
    font-size: 11px;
    transition:
      color 0.3s,
      transform 0.5s var(--spring);
  }
  .tabbar-btn.on {
    color: #fff;
  }
  .tabbar-btn:active {
    transform: scale(0.92);
  }
  .tabbar-ic {
    position: relative;
    display: grid;
  }
  .tabbar-ic .badge {
    position: absolute;
    top: -6px;
    left: 13px;
  }
  html.kb-open .tabbar {
    transform: translateX(-50%) translateY(140%);
    opacity: 0;
    pointer-events: none;
  }

  /* окна → шторка снизу */
  .modal-back {
    place-items: end center;
    padding: 0;
  }
  .modal {
    max-width: 580px;
    max-height: 94%;
    border-radius: 34px 34px 0 0;
    animation: sheet-in 0.7s var(--ease);
  }
  .modal-back.out .modal {
    opacity: 1;
    transform: translateY(105%);
  }
  .modal-grip {
    display: block;
  }
  .modal-head {
    padding-top: 2px;
  }
  .modal-body {
    padding-bottom: calc(24px + var(--safe-b));
  }
  @keyframes sheet-in {
    from {
      transform: translateY(100%);
    }
  }

  /* комната: видео сверху, под ним — шторка с чатом, которую можно тянуть */
  .room {
    display: flex;
    flex-direction: column;
  }
  .room-top {
    flex: none;
    gap: 2px;
    padding: calc(var(--safe-t) + 4px) max(8px, var(--safe-r)) 4px max(4px, var(--safe-l));
  }
  .room-invite {
    width: 38px;
    padding: 0;
  }
  .room-invite span {
    display: none;
  }
  .room-main {
    flex: none;
    padding: 0;
    gap: 0;
  }
  .stage {
    flex: none;
    width: 100%;
    height: min(56.25vw, 44dvh);
    border-radius: 0;
    box-shadow: none;
    transition: height 0.6s var(--ease);
  }
  .room[data-sheet='full'] .stage {
    height: 92px;
  }
  .room.dragging .stage {
    transition: none;
  }
  .nowbar {
    padding: 8px 8px 8px 16px;
  }
  .now-info .chip {
    display: none;
  }
  .side {
    flex: 1;
    margin: 0;
    border-radius: 28px 28px 0 0;
    background: var(--fill);
    box-shadow:
      0 -1px 0 rgba(255, 255, 255, 0.09),
      0 -20px 50px -20px #000;
  }
  .grip-zone {
    flex: none;
    display: block;
    height: 22px;
    cursor: grab;
    touch-action: none;
  }
  .grip-zone::after {
    content: '';
    display: block;
    width: 38px;
    height: 5px;
    margin: 9px auto 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.28);
  }
  .tabs {
    margin: 0 12px 6px;
  }
  .stage-empty-icon {
    display: none;
  }
  .stage-empty p {
    font-size: 13.5px;
  }
  .url-row .btn {
    padding: 0 16px;
  }
  .stage-empty {
    gap: 8px;
  }

  /* открыта клавиатура — освобождаем место под сообщения */
  html.kb-open .room-top,
  html.kb-open .nowbar,
  html.kb-open .typing {
    display: none;
  }
  html.kb-open .stage {
    height: 92px;
  }
  html.kb-open .chat-form {
    padding-bottom: 8px;
  }

  #toasts {
    width: calc(100vw - 20px);
  }
}

@media (max-width: 420px) {
  .hide-narrow {
    display: none;
  }
  .url-row {
    flex-wrap: wrap;
  }
  .url-row .input {
    flex: 1 1 100%;
  }
  .url-row .btn {
    flex: 1;
  }
}

/* Телефон боком: видео на весь экран, чат — выдвижной колонкой */
@media (orientation: landscape) and (max-height: 520px) {
  .room {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(330px, 42vw);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: 'main side';
  }
  .room.chat-hidden {
    grid-template-columns: minmax(0, 1fr);
  }
  .room.chat-hidden .side {
    display: none;
  }
  .room-top,
  .nowbar,
  .grip-zone {
    display: none;
  }
  .room-main {
    padding: 0;
    flex: 1;
  }
  .stage,
  .room[data-sheet='full'] .stage,
  html.kb-open .stage {
    flex: 1;
    width: auto;
    height: auto;
    margin-left: var(--safe-l);
  }
  .side {
    margin: 0;
    border-radius: 0;
    padding-top: var(--safe-t);
    box-shadow: -1px 0 0 var(--sep);
  }
  .stage-fabs {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
  }
  .nudge {
    top: 6px;
  }
  .tabs .seg-btn {
    font-size: 0;
  }
}

/* ============ Профиль: фото, флаги, статусы ============ */

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.flag {
  display: inline-block;
  flex: none;
  vertical-align: middle;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.user-name .nm,
.vtile-name .nm,
.country-row .nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link.small {
  font-size: 13px;
  font-weight: 400;
}
.section-title .push {
  margin-left: auto;
}
.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  min-width: 0;
}
.ava-edit {
  position: relative;
  display: block;
  border-radius: 50%;
  transition: transform 0.5s var(--spring);
}
.ava-edit:active {
  transform: scale(0.94);
}
.ava-cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 3px var(--fill);
}
.select-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.select-btn .nm {
  flex: 1;
}
.select-btn .icon:last-child {
  color: var(--label3);
}
.country-list {
  display: flex;
  flex-direction: column;
  max-height: 52vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -8px;
}
.country-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 8px;
  border-radius: 12px;
}
.country-row:active {
  background: var(--fill3);
}
.country-row .nm {
  flex: 1;
}
.country-row.on {
  font-weight: 500;
}
.country-none {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fill3);
  color: var(--label2);
}

/* Переключатель, как в iOS */
.switch {
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background: var(--fill4);
  transition: background 0.3s;
}
.switch.on {
  background: var(--accent);
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.5s var(--spring),
    background 0.3s,
    width 0.2s;
}
.switch.on .switch-knob {
  transform: translateX(20px);
  background: #000;
}
.switch:active .switch-knob {
  width: 33px;
}
.switch.on:active .switch-knob {
  transform: translateX(14px);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--fill2);
}
.switch-row small {
  display: block;
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.35;
}

/* Смахивание строки */
.swipe {
  position: relative;
  overflow: hidden;
}
.swipe > .user-row {
  position: relative;
  background: var(--bg);
  will-change: transform;
}
.swipe + .swipe > .user-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 54px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 88px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  opacity: 0;
}

/* ============ История ============ */

.hist-list {
  display: flex;
  flex-direction: column;
}
.hist-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  min-width: 0;
}
.hist-item + .hist-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 110px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.hist-thumb {
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: var(--fill2);
  color: var(--label3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.hist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}
.hist-info {
  flex: 1;
  min-width: 0;
}
.hist-title {
  font-weight: 500;
  font-size: 14.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hist-meta {
  margin-top: 2px;
  color: var(--label2);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-item.compact .hist-thumb {
  width: 72px;
}
.hist-item.compact + .hist-item.compact::before {
  left: 86px;
}
.recent {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recent:empty {
  display: none;
}

/* ============ Эмодзи-реакции и меню у сообщения (в стиле iOS) ============ */

.emoji,
.react-btn,
.fly-emoji {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}
.pop-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  transition: opacity 0.2s;
}
.pop-layer.out {
  opacity: 0;
  pointer-events: none;
}
.pop-back {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 0.25s;
}
.pop-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: pop-box-in 0.55s var(--spring);
}
@keyframes pop-box-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
}
.react-bar {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 32px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    0 20px 50px -10px rgba(0, 0, 0, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.react-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 27px;
  line-height: 1;
  transition:
    transform 0.4s var(--spring),
    background 0.2s;
  animation: react-in 0.55s var(--spring) backwards;
  animation-delay: calc(var(--i) * 28ms + 70ms);
}
@keyframes react-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.3);
  }
}
.react-btn.on {
  background: rgba(255, 255, 255, 0.2);
}
.react-btn:active {
  transform: scale(1.45) translateY(-8px);
}
@media (hover: hover) {
  .react-btn:hover {
    transform: scale(1.35) translateY(-7px);
  }
}
.pop-menu {
  align-self: flex-start;
  min-width: 200px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    0 20px 50px -10px rgba(0, 0, 0, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.pop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 13px 16px;
}
.pop-item + .pop-item {
  box-shadow: inset 0 1px 0 var(--sep);
}
.pop-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.msg-reacts {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -7px 6px 0;
}
.msg.own .msg-reacts {
  justify-content: flex-end;
}
.react-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border-radius: 13px;
  background: var(--fill4);
  box-shadow: 0 0 0 2px var(--fill);
  font-size: 13px;
  animation: badge-pop 0.5s var(--spring);
  transition: transform 0.4s var(--spring);
}
.react-chip:active {
  transform: scale(0.88);
}
.react-chip.mine {
  background: var(--accent);
  color: var(--on-accent);
}
.react-chip .cnt {
  font-family: 'Montserrat', var(--font);
  font-size: 11px;
}
.msg-react-btn {
  flex: none;
  align-self: center;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--label3);
  opacity: 0;
  transition: opacity 0.2s;
}
.msg.own .msg-react-btn {
  order: -1;
}
@media (hover: hover) {
  .msg:hover .msg-react-btn {
    opacity: 1;
  }
}
@media (pointer: coarse) {
  .msg-react-btn {
    display: none;
  }
  .msg-bubble {
    -webkit-user-select: none;
    user-select: none;
  }
}
.msg-name {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* «Печатает…»: пузырёк с прыгающими точками */
.typing-bubble {
  display: inline-flex;
  align-items: center;
  padding: 12px 15px;
}
.dots {
  display: inline-flex;
  gap: 4px;
}
.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--label2);
  animation: dot 1.25s infinite ease-in-out;
}
.dots i:nth-child(2) {
  animation-delay: 0.16s;
}
.dots i:nth-child(3) {
  animation-delay: 0.32s;
}
@keyframes dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}
.typing-msg:not([hidden]) {
  animation: msg-in 0.5s var(--spring);
  transform-origin: 0 100%;
}
.typing-name {
  margin: 2px 0 0 6px;
  color: var(--label3);
  font-size: 11.5px;
}

/* Кнопка реакции и взлетающие эмодзи */
.react-main .emoji {
  display: block;
  font-size: 21px;
  line-height: 1;
}
.react-main.bump .emoji {
  animation: bump 0.5s var(--spring);
}
@keyframes bump {
  40% {
    transform: scale(1.7) rotate(-8deg);
  }
}
.stage-fx {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}
.fly {
  position: absolute;
  left: var(--x);
  bottom: -6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: fly var(--dur) cubic-bezier(0.22, 0.7, 0.3, 1) forwards;
}
.fly-emoji {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}
.fly-who {
  padding: 2px 8px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 11px;
  white-space: nowrap;
}
@keyframes fly {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.3);
  }
  10% {
    opacity: 1;
    transform: translate(0, -24px) scale(1.2) rotate(var(--rot));
  }
  100% {
    opacity: 0;
    transform: translate(var(--sway), -240px) scale(1) rotate(0);
  }
}

/* ============ Голос и камеры ============ */

.voice-ind {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--label2);
}
.voice-ind.off {
  color: var(--label3);
}
.vtiles {
  display: flex;
  gap: 8px;
}
.vtile {
  position: relative;
  flex: none;
  overflow: hidden;
  background: var(--fill2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  outline: 2.5px solid transparent;
  outline-offset: 2px;
  transition:
    outline-color 0.2s,
    transform 0.4s var(--spring),
    opacity 0.3s;
  animation: badge-pop 0.55s var(--spring);
}
.vtile.speaking {
  outline-color: #fff;
}
.vtile.connecting .vtile-media {
  opacity: 0.45;
}
.vtile-media {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transition: opacity 0.3s;
}
.vtile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.vtile.mirror video {
  transform: scaleX(-1);
}
.vtile-name {
  position: absolute;
  left: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12px;
}
.vcontrols {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.vbtn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  transition:
    transform 0.5s var(--spring),
    background 0.25s,
    color 0.25s;
}
.vbtn:active {
  transform: scale(0.88);
}
.vbtn.off,
.vbtn.on {
  background: var(--accent);
  color: var(--on-accent);
}
.vbtn.leave {
  background: var(--fill4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

/* полоса под плеером, пока идёт видео */
.voicebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  animation: rise 0.5s var(--ease);
}
.voicebar .vtiles {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 4px 4px;
  scrollbar-width: none;
}
.voicebar .vtile {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}
.voicebar .vtile.cam {
  width: 92px;
  border-radius: 16px;
}
.voicebar .vtile-name {
  display: none;
}
.voicebar .vtile.cam .vtile-name {
  display: flex;
  left: 4px;
  bottom: 4px;
  padding: 2px 6px;
  font-size: 11px;
}
.voicebar .vcontrols .btn {
  height: 40px;
}
.voicebar .vbtn {
  width: 42px;
  height: 42px;
}

/* комната «только общение»: плитки на месте экрана */
.talk {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 8px;
  animation: rise 0.7s var(--ease) backwards;
}
.talk-head {
  text-align: center;
}
.talk-head h3 {
  font-family: var(--display);
  font-size: clamp(18px, 2.2vw, 24px);
  letter-spacing: -0.03em;
}
.talk-head p {
  margin-top: 6px;
  color: var(--label2);
  max-width: 32em;
}
.talk .vtiles {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 240px));
  justify-content: center; /* один-два человека — небольшие плитки ровно по центру, а не на всю ширину */
  gap: 10px;
}
.talk .vtiles:empty {
  display: none;
}
.talk .vtile {
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  outline-offset: -2px;
}
.talk .vtile .avatar {
  width: 76px !important;
  height: 76px !important;
  font-size: 32px !important;
}

.edge-swipe {
  position: absolute;
  z-index: 50;
  left: 0;
  top: 0;
  bottom: 0;
  width: 18px;
  touch-action: none;
}

@media (max-width: 860px) {
  /* вкладка «История» на телефоне */
  .home[data-tab='history'] .home-friends,
  .home[data-tab='rooms'] .history,
  .home[data-tab='history'] .hero,
  .home[data-tab='history'] .rooms-box {
    display: none;
  }
  .history .section-title {
    margin-top: 8px;
  }
  .hist-thumb {
    width: 84px;
  }
  .hist-item + .hist-item::before {
    left: 98px;
  }
  /* голос и «только общение» в узком экране */
  .talk {
    gap: 10px;
    padding: 4px;
  }
  .talk-head p {
    display: none;
  }
  .talk-head h3 {
    font-size: 15px;
  }
  .talk .vtiles {
    display: flex;
    justify-content: safe center;
    overflow-x: auto;
    padding: 2px;
  }
  .talk .vtile {
    width: 104px;
    aspect-ratio: 1;
    border-radius: 20px;
  }
  .talk .vtile .avatar {
    width: 50px !important;
    height: 50px !important;
    font-size: 21px !important;
  }
  .voicebar {
    padding: 6px 12px;
    box-shadow: 0 1px 0 var(--sep);
  }
}

/* Высокие окна (профиль, «это устройство») должны прокручиваться внутри, а не вылезать за экран:
   строка сетки обязана быть высотой с экран, иначе max-height у окна не с чем сравнивать */
.modal-back {
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
}
/* блоки внутри окна не сжимаются, когда содержимого больше, чем помещается, — окно просто прокручивается */
.modal-body > * {
  flex-shrink: 0;
}

/* ============ Анимированные иконки (.lottie) ============ */

.lottie {
  position: relative;
  display: inline-grid;
  flex: none;
  vertical-align: middle;
}
.lottie-img,
.lottie-canvas {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}
.lottie-img {
  object-fit: contain;
  transition: opacity 0.3s;
}
.lottie-canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.lottie.live .lottie-canvas {
  opacity: 1;
}
.lottie.live .lottie-img {
  opacity: 0;
}
.empty .lottie,
.gate-art .lottie {
  margin-bottom: 6px;
}
.confirm-art {
  display: grid;
  place-items: center;
  margin: -6px 0 -2px;
}
.confirm-text {
  max-width: 34em;
  margin: 0 auto;
  text-align: center;
}
.gate-art {
  display: grid;
  place-items: center;
}
.auth-duck {
  margin: -10px 0 -8px;
}
.talk-head .lottie {
  margin: 0 auto 2px;
}
.toast::before {
  content: none !important;
}
.toast-ic {
  flex: none;
  display: grid;
  place-items: center;
}
.user-sub .lottie {
  margin-right: 5px;
  vertical-align: -3px;
}

/* строки настроек в профиле */
.settings-list {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--fill2);
}
.setting {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 16px;
  text-align: left;
}
.setting + .setting::before {
  content: '';
  position: absolute;
  top: 0;
  left: 64px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
button.setting:active {
  background: var(--fill3);
}
.setting-ic {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
}
.setting-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.setting-text b {
  font-weight: 500;
}
.setting-text small {
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.35;
}
.setting > .icon:last-child {
  color: var(--label3);
}
.setting-val {
  flex: none;
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--fill3);
  color: var(--label2);
  font-size: 12.5px;
}
.uprofile-status.closed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--label2) !important;
}
.country-guess {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: var(--fill2);
  font-size: 19px;
}
.country-guess b {
  font-weight: 500;
}

.shield-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}
.privacy-preview {
  display: flex;
  justify-content: center;
  gap: 32px;
}
.privacy-preview figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.privacy-preview figcaption {
  color: var(--label2);
  font-size: 12.5px;
}
.ph-ava {
  width: 64px;
  height: 64px;
  padding: 15px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--fill3);
}

/* выбор друзей, которым видно фото */
.friend-pick {
  display: flex;
  flex-direction: column;
}
.pick-row {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 12px;
}
.pick-check {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: transparent;
  box-shadow: inset 0 0 0 1.5px var(--label3);
  transition:
    background 0.25s,
    color 0.25s,
    transform 0.5s var(--spring);
}
.pick-row.on .pick-check {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
  transform: scale(1.05);
}

/* «Это устройство» */
.modal-wide {
  max-width: 540px;
}
.device {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.device-load {
  display: grid;
  place-items: center;
  padding: 36px;
}
.kv-list {
  border-radius: 18px;
  overflow: hidden;
  background: var(--fill2);
}
.kv-group > .modal-sub {
  margin-bottom: 8px;
}
.kv {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 16px;
  font-size: 14px;
}
.kv + .kv::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.kv-k {
  flex: none;
  max-width: 46%;
  color: var(--label2);
}
.kv-v {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.kv-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kv-ua {
  display: block;
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
  color: var(--label2);
  word-break: break-all;
}
.kv:has(.kv-ua) {
  flex-direction: column;
  gap: 6px;
}

/* ============ Обои чата, стикеры, изменение сообщений ============ */

.chat-wrap::before,
.dm-body::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.06);
  -webkit-mask: url('/images/chat-wallpaper.svg') center top / 640px auto repeat;
  mask: url('/images/chat-wallpaper.svg') center top / 640px auto repeat;
}
.chat-list,
.dm-list {
  position: relative;
  z-index: 1;
}
.sticker-panel {
  flex: none;
  height: min(290px, 38vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--sep);
  background: var(--fill2);
  animation: rise 0.4s var(--ease);
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 6px;
  padding: 10px;
}
.sticker-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 14px;
  transition:
    transform 0.45s var(--spring),
    background 0.2s;
}
.sticker-cell:active {
  transform: scale(0.86);
  background: rgba(255, 255, 255, 0.09);
}
.sticker-cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sticker-btn {
  flex: none;
  width: 40px;
  height: 44px;
  margin-right: 2px;
}
.chat-form .chat-input {
  min-width: 0;
}
.edit-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-top: 1px solid var(--sep);
  background: var(--fill2);
  animation: rise 0.3s var(--ease);
}
.edit-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
}
.edit-info b {
  font-weight: 500;
}
.edit-prev {
  color: var(--label2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-bubble.sticker,
.msg.own .msg-bubble.sticker {
  padding: 2px 4px 0;
  background: none;
  color: var(--label2);
}
.msg-bubble.sticker .msg-time {
  float: none;
  display: block;
  margin: 0;
  text-align: right;
}
.msg-edited {
  margin-left: 8px;
  font-size: 10px;
  opacity: 0.55;
}
.typing-bubble {
  gap: 4px;
  padding: 4px 14px 4px 6px;
}
.typing-bubble .lottie {
  margin-right: 2px;
}

/* ============ Личные сообщения ============ */

.dm-layer {
  position: fixed;
  inset: 0;
  z-index: 75;
}
.dm-back {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade 0.3s;
  transition: opacity 0.3s;
}
.dm {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--fill);
  box-shadow:
    -30px 0 80px -20px #000,
    inset 1px 0 0 var(--sep2);
  animation: dm-in 0.55s var(--ease);
  padding-top: var(--safe-t);
}
@keyframes dm-in {
  from {
    transform: translateX(100%);
  }
}
.dm-layer.out .dm {
  transform: translateX(105%);
  transition: transform 0.42s var(--ease);
}
.dm-layer.out .dm-back {
  opacity: 0;
}
.dm-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 6px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: 0 1px 0 var(--sep);
  z-index: 3;
}
.dm-info {
  min-width: 0;
}
.dm-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.dm-name .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-sub {
  color: var(--label2);
  font-size: 12.5px;
}
.typing-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}
.dots.tiny i {
  width: 4px;
  height: 4px;
}
.dm-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.dm-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px 6px;
}
.dm-list > :first-child {
  margin-top: auto;
}
.dm .chat-form {
  padding-bottom: calc(12px + var(--safe-b));
}
.dm-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 14px 4px 8px;
  border-radius: 20px 20px 20px 6px;
  background: var(--fill3);
  animation: msg-in 0.5s var(--spring);
  transform-origin: 0 100%;
}
.dm-typing small {
  color: var(--label3);
  font-size: 11.5px;
  margin-left: 4px;
}
.dm-empty {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: var(--label2);
  padding: 20px;
}
.dm-empty p {
  color: #fff;
  font-size: 16px;
}
.dm-call {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 7px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--label2);
  font-size: 13px;
  transition: transform 0.4s var(--spring);
}
.dm-call:active {
  transform: scale(0.95);
}
.dm-call.missed {
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--sep2);
}
.dm-call-time {
  font-size: 11px;
  opacity: 0.55;
}
.msg-sys.day {
  margin: 12px 0 4px;
}
.tick {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  opacity: 0.55;
  vertical-align: -1px;
}
.tick .icon + .icon {
  margin-left: -8px;
}
.tick.read {
  opacity: 1;
}
.dm-btn {
  position: relative;
}
.dm-badge {
  position: absolute;
  top: -1px;
  right: -1px;
}

/* ============ Звонки ============ */

.call {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: #000;
  opacity: 0;
  transform: scale(1.04);
  transition:
    opacity 0.4s,
    transform 0.55s var(--ease);
  overflow: hidden;
}
.call.in {
  opacity: 1;
  transform: none;
}
.call-stage {
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 400px at 50% 30%, rgba(255, 255, 255, 0.07), transparent 70%), #050505;
}
.call-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.call-stage:not(.has-video) .call-video,
.call-stage:not(.has-screen) .call-video.screen {
  display: none;
}
.call-video.screen {
  object-fit: contain;
  z-index: 1;
}
.call-video.mini {
  z-index: 3;
  inset: auto;
  right: 14px;
  top: calc(var(--safe-t) + 78px);
  width: 112px;
  height: 150px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 10px 30px #000a;
}
.call-peer {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}
.call-peer.compact {
  display: none;
}
.call-peer h2 {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: -0.03em;
}
.call-status {
  color: var(--label2);
  font-size: 15px;
}
.call.ringing .call-peer .avatar {
  animation: ring-pulse 1.7s infinite;
}
@keyframes ring-pulse {
  from {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
  }
  to {
    box-shadow: 0 0 0 44px rgba(255, 255, 255, 0);
  }
}
.call-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-t) + 14px) 16px 22px;
  background: linear-gradient(rgba(0, 0, 0, 0.7), transparent);
}
.call-who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}
.call-who .call-status {
  flex-basis: 100%;
  font-size: 13px;
}
.call-key {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.call-key .emoji {
  font-size: 16px;
  letter-spacing: 2px;
}
.call-pip {
  position: absolute;
  z-index: 6;
  right: 14px;
  bottom: calc(var(--safe-b) + 128px);
  width: 112px;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  background: #111;
  box-shadow:
    0 12px 34px #000a,
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  touch-action: none;
  cursor: grab;
}
.call-pip-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.call-pip.mirror video {
  transform: scaleX(-1);
}
.call-controls {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(var(--safe-b) + 26px);
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 42px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: calc(100vw - 16px);
}
.call-btn {
  flex: none;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition:
    transform 0.5s var(--spring),
    background 0.25s,
    color 0.25s;
}
.call-btn:active {
  transform: scale(0.88);
}
.call-btn.off,
.call-btn.on,
.call-btn.ok {
  background: #fff;
  color: #000;
}
.call-btn.end {
  background: var(--fill4);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.65);
}
.call-btn.sm {
  width: 46px;
  height: 46px;
}
.incoming {
  position: fixed;
  z-index: 96;
  top: calc(var(--vvt, 0px) + var(--safe-t) + 12px);
  left: 50%;
  width: min(430px, calc(100vw - 20px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 8px;
  border-radius: 34px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    0 22px 60px -10px #000,
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateX(-50%);
  animation: incoming-in 0.8s var(--spring);
  transition:
    opacity 0.3s,
    transform 0.4s var(--ease);
}
@keyframes incoming-in {
  from {
    opacity: 0;
    transform: translate(-50%, -140%) scale(0.88);
  }
}
.incoming.out {
  opacity: 0;
  transform: translate(-50%, -130%) scale(0.92);
}
.incoming-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.incoming-info small {
  color: var(--label2);
}

/* показ экрана в комнате */
.stage-overlay:has(.screen-view) {
  scrollbar-gutter: auto;
  padding: 0;
  overflow: hidden;
  background: #000;
  display: block;
}
.screen-view {
  position: absolute;
  inset: 0;
  background: #000;
}
.screen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.screen-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--label2);
}
.screen-wait:empty {
  display: none;
}
.screen-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 16px;
  border-radius: 26px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.screen-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  min-width: 0;
}
.screen-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 860px) {
  .dm {
    width: 100%;
  }
  .call-controls {
    gap: 6px;
    padding: 8px;
  }
  .call-btn {
    width: 50px;
    height: 50px;
  }
  .call-pip {
    width: 96px;
  }
  /* «жидкое стекло» нижней панели: бегунок можно зажать, вести и растягивать */
  .tabbar {
    touch-action: none;
  }
  .tabbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    -webkit-backdrop-filter: blur(8px) brightness(1.3) saturate(1.6);
    backdrop-filter: blur(8px) brightness(1.3) saturate(1.6);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.4),
      inset 0 0 0 1px rgba(255, 255, 255, 0.12),
      0 6px 20px rgba(0, 0, 0, 0.45);
    will-change: transform;
  }
  .tabbar.ready.settling .tabbar-thumb {
    transition:
      transform 0.8s cubic-bezier(0.34, 1.55, 0.5, 1),
      width 0.6s var(--ease),
      background 0.3s,
      box-shadow 0.4s;
  }
  .tabbar.pressing .tabbar-thumb {
    background: rgba(255, 255, 255, 0.27);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.55),
      inset 0 0 0 1px rgba(255, 255, 255, 0.2),
      0 16px 36px rgba(0, 0, 0, 0.55),
      0 0 34px rgba(255, 255, 255, 0.1);
    transition:
      background 0.2s,
      box-shadow 0.3s !important;
  }
  .tabbar.pressing {
    transform: translateX(-50%) scale(1.03);
  }
  .tabbar-btn.hover {
    color: #fff;
  }
}

/* ============ Аватарка по умолчанию, статусы ============ */

.avatar-img.ph {
  object-fit: contain;
  padding: 16%;
  background: none;
}
.avatar.light .avatar-img.ph {
  filter: invert(1);
}
.avatar-dot.dnd {
  background: #fff;
  box-shadow: none;
}
.avatar-dot.dnd::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: #000;
}
[data-profile] {
  cursor: pointer;
}
.profile-btn [data-profile],
.ava-edit [data-profile] {
  cursor: inherit;
}

/* ============ Профиль человека и статистика ============ */

.uprofile {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.uprofile-head {
  display: flex;
  align-items: center;
  gap: 18px;
}
.uprofile-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.uprofile-name h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.03em;
}
.uprofile-name small {
  color: var(--label2);
}
.uprofile-status {
  color: #fff !important;
}
.uprofile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stats {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 560px) {
  .stat-cards {
    gap: 10px;
  }
}
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: 20px;
  background: var(--fill2);
  text-align: center;
}
.stat-card b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.stat-card small {
  color: var(--label2);
  font-size: 12px;
  line-height: 1.25;
  text-wrap: balance;
}
@media (max-width: 420px) {
  .stat-card {
    padding: 12px 6px;
  }
  .stat-card small {
    font-size: 11px;
  }
}
.rank-list {
  border-radius: 18px;
  background: var(--fill2);
  overflow: hidden;
}
.rank-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}
.rank-row + .rank-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  right: 0;
  height: 1px;
  background: var(--sep);
}
.rank-n {
  width: 30px;
  flex: none;
  text-align: center;
  color: var(--label3);
  font-family: 'Montserrat', var(--font);
}
.rank-thumb {
  flex: none;
  width: 64px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border-radius: 9px;
  overflow: hidden;
  background: var(--fill3);
  color: var(--label3);
}
.rank-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}
.rank-info {
  flex: 1;
  min-width: 0;
}
.rank-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-bar {
  height: 4px;
  margin-top: 7px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  animation: bar-grow 0.9s var(--ease) backwards;
}
@keyframes bar-grow {
  from {
    width: 0 !important;
  }
}
.rank-time {
  flex: none;
  color: var(--label2);
  font-size: 12.5px;
}
.stat-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border-radius: 20px;
  background: var(--fill2);
  text-align: center;
}
.stat-locked p {
  font-size: 16px;
}
.stat-locked small {
  color: var(--label2);
}
.empty.small {
  padding: 18px;
}

/* ============ Пароль и вход через соцсети ============ */

.pw-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pw {
  position: relative;
}
.pw .input {
  padding-right: 50px;
}
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--label2);
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.4s var(--spring);
}
.pw-eye:active {
  transform: scale(0.88);
  background: rgba(255, 255, 255, 0.1);
}
.pw-eye[aria-pressed='true'] {
  color: #fff;
}
.pw-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.pw-bars {
  flex: 1;
  display: flex;
  gap: 4px;
}
.pw-bars i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.3s;
}
.pw-meter[data-level='1'] .pw-bars i:nth-child(-n + 1) {
  background: rgba(255, 255, 255, 0.35);
}
.pw-meter[data-level='2'] .pw-bars i:nth-child(-n + 2) {
  background: rgba(255, 255, 255, 0.55);
}
.pw-meter[data-level='3'] .pw-bars i:nth-child(-n + 3) {
  background: rgba(255, 255, 255, 0.8);
}
.pw-meter[data-level='4'] .pw-bars i {
  background: #fff;
}
.pw-meter small {
  min-width: 64px;
  text-align: right;
  color: var(--label2);
  font-size: 12px;
}
.pw-generate {
  align-self: flex-start;
}
.pw-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--fill3);
  animation: rise 0.4s var(--ease);
}
.pw-card-text b {
  display: block;
  font-weight: 500;
}
.pw-card-text small {
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.4;
}
.pw-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.social {
  margin-top: 18px;
}
.social-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--label3);
  font-size: 12.5px;
}
.social-or::before,
.social-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sep);
}
.social-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  border-radius: 14px;
  background: var(--fill2);
  font-size: 13.5px;
  transition:
    transform 0.45s var(--spring),
    background 0.2s;
}
.social-btn:active {
  transform: scale(0.94);
}
@media (hover: hover) {
  .social-btn:hover {
    background: var(--fill3);
  }
}
.social-logo {
  flex: none;
}

/* ============ Защита содержимого: ни выделить, ни перетащить ============ */

html,
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
img,
svg,
canvas,
video,
audio,
a,
.lottie,
.avatar,
.flag {
  -webkit-user-drag: none;
  user-drag: none;
}
img {
  pointer-events: none;
}
.msg-bubble,
.msg-text,
.room-meta b,
.invite-code b,
.kv-ua {
  -webkit-user-select: none !important;
  user-select: none !important;
}
::selection {
  background: transparent;
}
input::selection,
textarea::selection {
  background: rgba(255, 255, 255, 0.3);
}

/* Пользователь выключил анимации в профиле */
html.no-motion *,
html.no-motion *::before,
html.no-motion *::after {
  animation-duration: 0.01ms !important;
  animation-delay: 0ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (max-width: 860px) {
  .auth-duck .lottie {
    width: 92px !important;
    height: 92px !important;
  }
  .talk-head .lottie {
    display: none;
  }
  .kv {
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ Площадки, «чистый плеер» ============ */

.svc-mono {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.svc-mono.long {
  font-size: 8px;
}
.svc-chip {
  padding-left: 5px;
}
button.svc-chip {
  cursor: pointer;
  transition:
    background 0.25s,
    color 0.25s,
    transform 0.4s var(--spring);
}
button.svc-chip:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
button.svc-chip:active {
  transform: scale(0.94);
}
.svc-chip.screen {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.svc-chip.screen .svc-mono {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.svc-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 8px;
}
.svc-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 6px 10px;
  border-radius: 18px;
  background: var(--fill2);
  color: #fff;
  text-align: center;
  transition:
    background 0.25s,
    transform 0.4s var(--spring);
}
.svc-tile:hover {
  background: var(--fill3);
}
.svc-tile:active {
  transform: scale(0.95);
}
.svc-tile .svc-mono {
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 14px;
}
.svc-tile .svc-mono.long {
  font-size: 11px;
}
.svc-tile.screen .svc-mono {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.4);
}
.svc-name {
  font-size: 13px;
  line-height: 1.2;
}
.svc-tile small {
  margin-top: -4px;
  color: var(--label2);
  font-size: 11px;
}
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  color: var(--label2);
  font-size: 14px;
  line-height: 1.4;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12.5px;
}
.steps li b {
  color: #fff;
  font-weight: 500;
}
.svc-accounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.svc-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--fill2);
}
.svc-account .svc-mono {
  min-width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 12px;
}
.svc-account-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.svc-account-text small {
  color: var(--label2);
  font-size: 12.5px;
}

/* Свой «щит» над плеером и своя панель вместо родной панели YouTube */
.player-shield {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.stage.pb-on:not(.pb-active):not(.pb-paused) .player-shield {
  cursor: none;
}
.player-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #000;
  pointer-events: none;
}
.player-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(3px) brightness(0.5);
  transform: scale(1.05);
}
.player-shield[hidden],
.player-poster[hidden],
.player-bar[hidden],
.pb-big[hidden] {
  display: none;
}
.pb-big {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: #fff;
  transition: transform 0.45s var(--spring);
}
.pb-big .icon {
  margin-left: 4px;
  fill: #fff;
}
.pb-big:active {
  transform: scale(0.92);
}
.player-bar {
  position: absolute;
  z-index: 3;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border-radius: 28px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.35s,
    transform 0.55s var(--ease);
}
.stage.pb-active .player-bar,
.stage.pb-menu-open .player-bar,
.stage.pb-paused .player-bar {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.pb-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  transition: transform 0.4s var(--spring);
}
.pb-btn:active {
  transform: scale(0.88);
}
.pb-btn:not(.pb-fs) .icon polygon,
.pb-btn .icon rect {
  fill: currentColor;
}
.pb-time {
  flex: none;
  min-width: 40px;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.pb-time.dim {
  color: var(--label2);
}
input.pb-range {
  -webkit-appearance: none;
  appearance: none;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --p: 0%;
}
.pb-seek {
  flex: 1;
  min-width: 0;
}
.pb-vol {
  flex: none;
  width: 84px;
}
input.pb-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, 0.28) var(--p));
}
input.pb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s var(--spring);
}
input.pb-range:active::-webkit-slider-thumb {
  transform: scale(1.35);
}
input.pb-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
}
input.pb-range::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
input.pb-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}
input.pb-range:disabled {
  opacity: 0.4;
  cursor: default;
}
.stage.pb-locked .pb-seek,
.stage.pb-locked .pb-big {
  opacity: 0.55;
}
.stage.pb-full {
  border-radius: 0;
}
/* Панель подстраивается под ширину самой сцены, а не окна: в узкой колонке комнаты кнопок меньше */
.stage {
  container-type: inline-size;
  container-name: stage;
}
@container stage (max-width: 780px) {
  .pb-s5,
  .pb-vol {
    display: none;
  }
}
@container stage (max-width: 560px) {
  .player-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 2px;
    padding: 4px 10px 4px 4px;
  }
  .pb-time {
    min-width: 36px;
    font-size: 12px;
  }
  .pb-time.dim,
  .pb-react,
  .pb-mute {
    display: none;
  }
  .pb-menu {
    right: 8px;
    bottom: 64px;
  }
}

/* Меню настроек плеера: скорость, качество, субтитры, автовыключение */
.pb-menu {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 72px;
  width: min(300px, calc(100% - 16px));
  max-height: min(64%, 400px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border-radius: 22px;
  background: rgba(28, 28, 30, 0.94);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 14px 40px rgba(0, 0, 0, 0.5);
  transform-origin: bottom right;
  animation: pb-menu-in 0.4s var(--spring);
}
.pb-menu[hidden] {
  display: none;
}
@keyframes pb-menu-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}
.pb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  color: #fff;
  font-size: 14.5px;
  text-align: left;
}
.pb-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.pb-item:active {
  background: rgba(255, 255, 255, 0.14);
}
.pb-item-label {
  flex: 1;
  min-width: 0;
}
.pb-item-val {
  color: var(--label2);
  font-size: 13px;
  white-space: nowrap;
}
.pb-item .icon {
  flex: none;
  color: var(--label2);
}
.pb-item.on .icon {
  color: #fff;
}
.pb-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 4px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--sep);
  color: #fff;
  font-size: 14px;
  text-align: left;
}
.pb-note {
  margin: 6px 12px 8px;
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.4;
}
.pb-loading {
  display: grid;
  place-items: center;
  padding: 16px;
}
.pb-native {
  margin: 2px 12px 10px;
}

/* Всплывашки на видео: скорость и перемотка по двойному нажатию */
.pb-pill {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 13.5px;
  pointer-events: none;
  animation: nudge-in 0.5s var(--spring);
}
.pb-pill[hidden] {
  display: none;
}
.pb-ratepill {
  left: auto;
  right: 14px;
  transform: none;
  animation: none;
}
.pb-skipfx {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 108px;
  height: 108px;
  margin-top: -54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
}
.pb-skipfx.left {
  left: 12%;
}
.pb-skipfx.right {
  right: 12%;
}
.pb-skipfx.on {
  animation: pb-skip 0.85s var(--ease);
}
@keyframes pb-skip {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  18% {
    opacity: 1;
    transform: scale(1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}
.pb-react {
  color: #fff;
}
.pb-gear .icon {
  transition: transform 0.5s var(--ease);
}
.stage.pb-menu-open .pb-gear .icon {
  transform: rotate(60deg);
}
.player-shield {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.skip-icon text {
  font-weight: 400;
}
/* ============ Фото в чатах, выбор сообщений, поиск и календарь, очистка ============ */

.attach-btn {
  flex: none;
  width: 40px;
  height: 44px;
}
.panel-chat {
  position: relative;
}
.dm-head {
  position: relative;
}
.msg {
  position: relative;
}

/* фото */
.msg-bubble.photo,
.msg.own .msg-bubble.photo {
  position: relative;
  padding: 3px;
  border-radius: 20px 20px 20px 8px;
  background: var(--fill3);
  line-height: 0;
}
.msg.own .msg-bubble.photo {
  border-radius: 20px 20px 8px 20px;
  background: var(--accent);
}
.msg.cont .msg-bubble.photo {
  border-radius: 20px;
}
.msg-bubble.photo .msg-name {
  padding: 4px 10px 5px;
  line-height: 1.3;
}
.photo {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  padding: 0;
  border-radius: 17px;
  overflow: hidden;
  background: #1c1c1e;
  color: var(--label2);
  cursor: zoom-in;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  pointer-events: none;
}
.photo.loading {
  cursor: progress;
  background: linear-gradient(100deg, #1c1c1e 30%, #2b2b2e 50%, #1c1c1e 70%) 0 0 / 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.photo.failed {
  cursor: default;
  padding: 12px;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}
.msg-bubble.photo .msg-time {
  position: absolute;
  right: 10px;
  bottom: 9px;
  float: none;
  margin: 0;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  line-height: 1.5;
  opacity: 1;
}
.msg.pending {
  opacity: 0.85;
}

/* просмотр фото */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 650;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.96);
  animation: fade 0.25s;
  -webkit-user-select: none;
  user-select: none;
}
.lightbox.out {
  opacity: 0;
  transition: opacity 0.25s;
}
.lb-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 12px 14px 18px;
  background: linear-gradient(rgba(0, 0, 0, 0.7), transparent);
}
.lb-count {
  color: var(--label2);
  font-size: 14px;
}
.lb-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 56px) 12px calc(var(--safe-b) + 20px);
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  -webkit-user-drag: none;
  transition:
    filter 0.35s,
    opacity 0.25s;
}
.lb-img.loading {
  filter: blur(6px) brightness(0.85);
}
.lb-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
}
.lb-nav.prev {
  left: 14px;
}
.lb-nav.next {
  right: 14px;
}
.lb-nav[hidden] {
  display: none;
}
@media (hover: none) {
  .lb-nav {
    display: none;
  }
}

/* выбор сообщений */
.msg-check {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  display: none;
  place-items: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.6px rgba(255, 255, 255, 0.45);
  color: transparent;
  transition:
    background 0.2s,
    color 0.2s;
}
.selecting .msg {
  padding-left: 34px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.selecting .msg .msg-check {
  display: grid;
}
.selecting .msg.selected {
  background: rgba(255, 255, 255, 0.08);
}
.selecting .msg.selected .msg-check {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}
.selecting .msg-react-btn {
  display: none;
}
.selecting .msg-bubble {
  pointer-events: none;
}
.sel-bar {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px 0 6px;
  background: var(--fill2);
  animation: fade 0.2s;
}
.sel-bar[hidden] {
  display: none;
}
.sel-bar b {
  margin-left: 6px;
  font-size: 15px;
  font-weight: 500;
}
.chat-bar {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 8px 0 18px;
  color: var(--label2);
  font-size: 13.5px;
}
.chat-bar b {
  color: #fff;
  font-weight: 500;
}
.msg.flash .msg-bubble {
  animation: flash-bubble 2.2s var(--ease);
}
@keyframes flash-bubble {
  0%,
  55% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95);
  }
  100% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0);
  }
}

/* поиск по сообщениям */
.chat-search {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--fill);
  animation: fade 0.25s;
}
.dm .chat-search {
  top: calc(var(--safe-t) + 62px);
}
.chat-search[hidden] {
  display: none;
}
.cs-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 6px 6px;
}
.cs-field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}
.cs-field .icon {
  position: absolute;
  left: 14px;
  color: var(--label3);
  pointer-events: none;
}
.cs-field .input {
  height: 40px;
  border-radius: 20px;
  padding: 0 14px 0 38px;
  background: var(--fill3);
}
.cs-bar .btn-icon.on {
  background: var(--accent);
  color: var(--on-accent);
}
.cs-chips {
  flex: none;
  padding: 0 14px;
}
.cs-chips:has(.cs-day[hidden]) {
  display: none;
}
.cs-day {
  gap: 6px;
  cursor: pointer;
}
.cs-cal {
  flex: none;
  margin: 6px 12px 2px;
  padding: 10px;
  border-radius: 20px;
  background: var(--fill2);
  animation: rise 0.3s var(--ease);
}
.cs-cal[hidden] {
  display: none;
}
.cs-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 16px;
}
.cs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 34px 20px;
  color: var(--label2);
  text-align: center;
}
.sr-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: left;
}
.sr-item:hover {
  background: var(--fill2);
}
.sr-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--label2);
  font-size: 12.5px;
}
.sr-top b {
  color: #fff;
  font-weight: 500;
}
.sr-text {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.35;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.sr-text mark {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.sr-more {
  display: block;
  margin: 8px auto;
}

/* календарь */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.cal-title {
  font-weight: 500;
}
.cal-week,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-week span {
  padding: 4px 0;
  color: var(--label3);
  font-size: 11.5px;
}
.cal-day {
  position: relative;
  height: 36px;
  border-radius: 12px;
  color: var(--label3);
  font-size: 14px;
}
.cal-day.has {
  color: #fff;
}
.cal-day.has::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}
.cal-day.today {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.cal-day.on {
  background: var(--accent);
  color: var(--on-accent);
}
.cal-day:disabled {
  opacity: 0.22;
}
.cal-day:not(:disabled):not(.on):hover {
  background: var(--fill3);
}

/* удаление переписки у обоих */
.wipe-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--sep);
  background: var(--fill2);
  font-size: 13.5px;
  animation: rise 0.3s var(--ease);
}
.wipe-bar[hidden] {
  display: none;
}
.wipe-bar > span {
  flex: 1;
  min-width: 0;
}
.wipe-actions {
  display: flex;
  flex: none;
  gap: 6px;
}
.setting.plain {
  margin: 6px 0;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--fill2);
}
.dm-layer.dropping .dm::after {
  content: 'Отпусти, чтобы отправить фото';
  position: absolute;
  inset: 10px;
  z-index: 9;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
/* ============ Сцена с несколькими экранами и камерами ============ */

/* без показа картинок плитки лежат как раньше: «контейнеры» vmain и vside для раскладки не нужны */
.vtiles:not(.stage) > .vmain,
.vtiles:not(.stage) > .vside {
  display: contents;
}
.stage-overlay:has(.vstage) {
  scrollbar-gutter: auto;
  display: block;
  padding: 0;
  overflow: hidden;
  background: #050505;
}
.vstage {
  position: absolute;
  inset: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 0;
  animation: fade 0.4s;
}
.vstage .vcontrols {
  flex: none;
}
.vtiles.stage {
  flex: 1;
  width: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}
.vtiles.stage > .vmain {
  flex: 1;
  min-height: 0;
  display: grid;
  /* колонки удвоены: так неполный нижний ряд можно сдвинуть на пол-плитки и поставить по центру */
  grid-template-columns: repeat(calc(var(--cols, 1) * 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
  gap: 8px;
}
.vtiles.stage > .vmain > .vtile {
  grid-column: var(--gcs, auto) / span 2;
}
.vtiles.stage > .vside {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 2px 4px;
}
.vtiles.stage > .vside:empty {
  display: none;
}
.vtiles.stage > .vmain > .vtile {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  border-radius: 20px;
  aspect-ratio: auto;
  cursor: pointer;
}
.vtiles.stage > .vside > .vtile {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}
.vtiles.stage > .vside .vtile-name {
  display: none;
}
.vtile.screen {
  background: #000;
}
.vtile.screen video {
  object-fit: contain;
}
/* нажали на плитку: она на первый план, остальные — полоской под ней */
.vtiles.stage > .vmain[data-focus]:not([data-focus='']) {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
}
.vmain[data-focus]:not([data-focus='']) > .vtile.focus {
  flex: 1 1 100%;
  order: -1;
  height: calc(100% - 112px);
  min-height: 0;
  cursor: zoom-out;
}
.vmain[data-focus]:not([data-focus='']) > .vtile.mini {
  flex: 0 0 150px;
  height: 104px;
  border-radius: 14px;
}
.vtile-fs {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.vtile:hover .vtile-fs,
.vtile.focus .vtile-fs,
.vtile:focus-within .vtile-fs {
  opacity: 1;
}
@media (hover: none) {
  .vtile-fs {
    opacity: 1;
  }
}
.vtile-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--label2);
  text-align: center;
}
.vtile-wait:empty {
  display: none;
}
.vtile:fullscreen {
  border-radius: 0;
}
@container stage (max-width: 560px) {
  .vtiles.stage > .vmain[data-n='2']:not([data-focus]:not([data-focus=''])) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .vtiles.stage > .vmain[data-n='2'] > .vtile {
    grid-column: 1;
  }
  .vmain[data-focus]:not([data-focus='']) > .vtile.mini {
    flex-basis: 110px;
    height: 80px;
  }
  .vmain[data-focus]:not([data-focus='']) > .vtile.focus {
    height: calc(100% - 88px);
  }
}
/* ============ UID, QR-код, архив, закреп, уведомления, код-пароль ============ */

.id-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 14px;
}
.copy-row,
.mine-id {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-radius: 18px;
  background: var(--fill2);
}
.copy-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.copy-text small {
  color: var(--label2);
  font-size: 12px;
}
.copy-text b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 15.5px;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
  -webkit-user-select: all;
}
.id-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.id-actions .btn {
  justify-content: center;
}
.mine-id {
  margin-top: 14px;
}
.modal-actions.wrap {
  flex-wrap: wrap;
}
.modal-actions.wrap .btn {
  flex: 1 1 auto;
}

/* QR-код */
.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-radius: 32px;
  background: #fff;
  color: #000;
}
.qr-holder {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.qr {
  position: relative;
  width: 100%;
  height: 100%;
  animation: fade 0.5s;
}
.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}
.qr-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  transform: translate(-50%, -50%);
}
.qr-logo .avatar,
.qr-logo .lottie,
.qr-logo canvas {
  width: 100% !important;
  height: 100% !important;
}
.qr-who {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.qr-who b {
  font-weight: 500;
  font-size: 17px;
}
.qr-who small {
  color: rgba(0, 0, 0, 0.55);
}

/* заголовок «Друзья» с кнопками */
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-tools {
  display: flex;
  gap: 2px;
}
.panel-tools .locked {
  color: #fff;
  background: var(--fill3);
}
.pin-ico,
.muted-ico {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--label3);
}
.badge.dot {
  min-width: 10px;
  width: 10px;
  height: 10px;
  padding: 0;
}
.badge.quiet {
  background: var(--fill4);
  color: var(--label2);
}
.archive-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--fill2);
  text-align: left;
  transition: background 0.25s;
}
.archive-row:hover {
  background: var(--fill3);
}
.archive-ic {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fill3);
}
.archive-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.archive-text small {
  color: var(--label2);
  font-size: 12.5px;
}
.archive-row > .icon {
  color: var(--label3);
  transition: transform 0.35s var(--ease);
}
.archive-row.open > .icon {
  transform: rotate(90deg);
}
.archive-list {
  margin-top: 4px;
  animation: rise 0.4s var(--ease);
}
.pop-item.danger {
  color: #ff6259;
}
.pop-item.danger .icon {
  color: #ff6259;
}
.choice.on-strong {
  background: var(--accent);
  color: var(--on-accent);
}
.choice.on-strong small {
  color: rgba(0, 0, 0, 0.6);
}
.list-title + .choice {
  margin-top: 4px;
}
.muted-ico .icon {
  vertical-align: -2px;
}

/* код-пароль */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 6px 0 4px;
}
.pin-dots i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.8px rgba(255, 255, 255, 0.5);
  transition:
    background 0.18s,
    transform 0.35s var(--spring);
}
.pin-dots i.on {
  background: var(--accent);
  transform: scale(1.12);
}
.pin-dots.shake {
  animation: pin-shake 0.45s;
}
@keyframes pin-shake {
  20%,
  60% {
    transform: translateX(-9px);
  }
  40%,
  80% {
    transform: translateX(9px);
  }
}
.pin-msg {
  min-height: 20px;
  margin-bottom: 4px;
  color: #ff8a80;
  font-size: 13px;
  text-align: center;
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  grid-auto-rows: 68px;
  justify-content: center;
  gap: 12px 18px;
  width: max-content;
  max-width: 100%;
  margin: 8px auto 10px;
}
.pin-key {
  width: 68px;
  height: 68px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fill3);
  font-family: var(--display);
  font-size: 22px;
  transition:
    background 0.2s,
    transform 0.4s var(--spring);
}
.pin-key:active {
  transform: scale(0.92);
  background: var(--fill4);
}
.pin-key.small {
  background: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--label2);
}
.pin-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* телефон: когда в комнате показывают экраны или камеры, сцене нужно больше места, чем обычному 16:9 */
@media (max-width: 860px) {
  .room:not([data-sheet='full']) .stage:has(.vstage .vmain:not([data-n='0']):not([data-n='1'])) {
    height: min(96vw, 50dvh);
  }
  html:not(.kb-open) .room:not([data-sheet='full']) .stage:has(.vstage .vmain[data-n='1']) {
    height: min(70vw, 44dvh);
  }
  .vtiles.stage > .vmain[data-n='2'] > .vtile .vtile-name,
  .vtiles.stage > .vmain[data-n='3'] > .vtile .vtile-name {
    font-size: 12px;
  }
}

/* ============ Сканер QR-кодов ============ */
.scan {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  color: #fff;
  opacity: 0;
  clip-path: circle(0% at 50% 100%);
  transition:
    clip-path 0.75s var(--ease),
    opacity 0.3s;
}
.scan.on {
  opacity: 1;
  clip-path: circle(150% at 50% 100%);
}
.scan.out {
  opacity: 0;
  clip-path: circle(0% at 50% 100%);
  transition:
    clip-path 0.4s var(--ease),
    opacity 0.4s;
}
.scan-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition:
    opacity 0.6s,
    transform 1.2s var(--ease);
}
.scan.live .scan-video {
  opacity: 1;
  transform: none;
}
.scan-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(#000a, transparent 22%, transparent 68%, #000b),
    radial-gradient(circle at 50% 40%, transparent 30%, rgba(0, 0, 0, 0.35));
}
.scan-top {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t, 0px) + 14px) 16px 10px;
}
.scan-top b {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: -0.02em;
  font-weight: 500;
}
.scan-top .push {
  flex: 1;
}
.scan-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition:
    background 0.2s,
    transform 0.4s var(--spring);
}
.scan-btn:active {
  transform: scale(0.9);
}
.scan-btn.on {
  background: #fff;
  color: #000;
}
.scan-frame {
  --s: min(70vmin, 330px);
  position: relative;
  z-index: 2;
  width: var(--s);
  height: var(--s);
  border-radius: 34px;
  /* всё вокруг рамки затемнено — подсвечена только область, где ищем код */
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.58);
  transform: scale(0.25);
  opacity: 0;
  transition:
    transform 0.9s var(--spring) 0.15s,
    opacity 0.45s 0.15s,
    border-radius 0.7s var(--ease),
    background 0.5s;
}
.scan.on .scan-frame {
  transform: none;
  opacity: 1;
}
.scan-corners i {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 0 solid #fff;
  opacity: 0;
  transform: scale(1.5);
  animation: scan-corner 0.7s var(--spring) forwards;
}
.scan.on .scan-corners i {
  animation-delay: 0.45s;
}
.scan-corners .c0 {
  left: -3px;
  top: -3px;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 34px;
}
.scan-corners .c1 {
  right: -3px;
  top: -3px;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 34px;
}
.scan-corners .c2 {
  right: -3px;
  bottom: -3px;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 34px;
}
.scan-corners .c3 {
  left: -3px;
  bottom: -3px;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 34px;
}
@keyframes scan-corner {
  to {
    opacity: 1;
    transform: none;
  }
}
.scan-laser {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 10%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #fff 25%, #fff 75%, transparent);
  box-shadow:
    0 0 14px 3px rgba(255, 255, 255, 0.55),
    0 0 40px 10px rgba(255, 255, 255, 0.18);
  opacity: 0;
}
.scan.live .scan-laser,
.scan.on .scan-laser {
  opacity: 1;
  animation: scan-laser 2.1s ease-in-out 0.9s infinite alternate;
}
@keyframes scan-laser {
  from {
    top: 9%;
  }
  to {
    top: calc(91% - 2px);
  }
}
.scan-frame.shake {
  animation: scan-shake 0.5s;
}
@keyframes scan-shake {
  20%,
  60% {
    transform: translateX(-10px);
  }
  40%,
  80% {
    transform: translateX(10px);
  }
}
.scan-ok {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 0.35s,
    transform 0.7s var(--spring);
}
.scan.done .scan-frame {
  border-radius: 50%;
  transform: scale(0.62);
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.scan.done .scan-corners,
.scan.done .scan-laser {
  opacity: 0;
  animation: none;
}
.scan.done .scan-ok {
  opacity: 1;
  transform: none;
}
.scan-bottom {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px 20px calc(var(--safe-b, 0px) + 24px);
  text-align: center;
}
.scan-msg {
  max-width: 430px;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition:
    background 0.25s,
    color 0.25s;
}
.scan-msg.bad,
.scan-msg.ok {
  background: #fff;
  color: #000;
}
.scan-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  color: #fff;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: transform 0.4s var(--spring);
}
.scan-pill:active {
  transform: scale(0.94);
}
.scan-state {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 32px 40px;
  text-align: center;
}
.scan-state[hidden] {
  display: none;
}
.scan-state b {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 500;
}
.scan-state p {
  max-width: 340px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14.5px;
  line-height: 1.4;
}
.scan.nocam .scan-frame {
  display: none;
}
/* кнопка «сканировать» рядом с полем «Код или ссылка» и в окнах с QR-кодом */
.join-form .btn-icon.scan-open {
  flex: none;
}

/* ============ Мои активные комнаты, кнопка «по QR» ============ */
.btn-icon-only {
  flex: none;
  width: 54px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.my-rooms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.my-room {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 24px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  animation: rise 0.6s var(--ease) backwards;
}
.my-room-ic {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--fill3);
}
.my-room-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.my-room-body b {
  font-weight: 500;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.my-room-body small {
  color: var(--label2);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.my-room-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
@media (max-width: 560px) {
  .my-room {
    padding: 12px;
    gap: 10px;
  }
  .my-room-ic {
    display: none;
  }
}

/* ============ Информация о комнате, связь, выбор при выходе ============ */
.room-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.info-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}
.info-head b {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.info-head small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--label2);
  font-size: 13px;
}
.info-head small b {
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--label);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.info-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px;
  border-radius: 22px;
  background: var(--fill2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  min-width: 0;
}
.info-cell small {
  margin-top: 6px;
  color: var(--label2);
  font-size: 12.5px;
}
.info-cell b {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.info-cell em {
  font-style: normal;
  color: var(--label3, var(--label2));
  font-size: 12px;
  line-height: 1.3;
}
.info-cell em:empty {
  display: none;
}
.info-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-line > small {
  color: var(--label2);
  font-size: 12.5px;
  padding-left: 4px;
}
.info-line p {
  margin: 0;
  padding: 0 4px;
  font-size: 14.5px;
}
.net-ind {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill3);
  color: var(--label2);
}
.net-ind.lost {
  color: #ff8a80;
}
.choice.danger b,
.choice.danger .choice-icon {
  color: #ff8a80;
}

/* ============ Профиль: о себе, рекорды, соцсети, интересы, превью; заблокированные ============ */
.pcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  border-radius: 24px;
  background: var(--fill2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.pcard-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}
.pcard-head b {
  flex: 1;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.bio-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.stat-cards.records {
  margin: 12px 0;
}
.vis-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  font-size: 11.5px;
  color: var(--label2);
  background: var(--fill3);
  white-space: nowrap;
  transition:
    background 0.2s,
    transform 0.4s var(--spring);
}
.vis-chip:hover {
  background: var(--fill4);
}
.vis-chip:active {
  transform: scale(0.94);
}
.stat-card .vis-chip {
  margin-top: 6px;
  align-self: flex-start;
}
.social-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--fill3);
  color: var(--label);
  text-decoration: none;
  transition:
    background 0.2s,
    transform 0.4s var(--spring);
}
.social-link:hover {
  background: var(--fill4);
}
.social-link:active {
  transform: scale(0.985);
}
.soc-name {
  flex: none;
  font-size: 14px;
  color: var(--label2);
  min-width: 78px;
}
.soc-handle {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.interests .modal-sub {
  margin-bottom: 0;
}
.donuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.pcard.donut {
  margin: 8px 0;
}
.donut-body {
  display: flex;
  align-items: center;
  gap: 16px;
}
.donut-chart {
  position: relative;
  flex: none;
  width: 118px;
  height: 118px;
}
.donut-chart svg {
  width: 100%;
  height: 100%;
}
.donut-chart .seg {
  stroke-linecap: butt;
  animation: donut-in 0.9s var(--ease) backwards;
  animation-delay: calc(var(--i) * 0.08s);
}
@keyframes donut-in {
  from {
    opacity: 0;
    stroke-width: 6;
  }
}
.donut-title {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.donut-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.donut-legend i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.donut-legend span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donut-legend b {
  flex: none;
  font-weight: 500;
  color: var(--label2);
  font-variant-numeric: tabular-nums;
}
.uprofile-head {
  position: relative;
}
.preview-btn {
  margin-left: auto;
  align-self: flex-start;
  flex: none;
}
.preview-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px 10px 16px;
  border-radius: 20px;
  background: #fff;
  color: #000;
  font-size: 14px;
  animation: rise 0.5s var(--ease);
}
.preview-banner span {
  flex: 1;
  min-width: 0;
}
.preview-banner .btn-primary {
  background: #000;
  color: #fff;
}

/* соцсети: окно ввода */
.socials {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.soc-edit-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.social-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.social-label b {
  font-weight: 500;
  font-size: 14.5px;
}
.social-input {
  display: flex;
  align-items: center;
  gap: 8px;
}
.social-input span {
  color: var(--label2);
  font-size: 16px;
}
.social-input .input {
  flex: 1;
}
.field textarea.input {
  height: auto;
  min-height: 84px;
  padding: 12px 18px;
  border-radius: 22px;
  resize: vertical;
  line-height: 1.4;
}
.field .field-count {
  align-self: flex-end;
  font-size: 11.5px;
  color: var(--label3, var(--label2));
}
.field > span .vis-chip {
  margin-left: 8px;
  vertical-align: middle;
}

/* заблокированные */
.blocked-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 34px;
}
.blocked-head .push {
  flex: 1;
}
.danger-text {
  color: #ff8a80;
}
.blocked-list {
  display: flex;
  flex-direction: column;
}
.blocked-foot {
  margin-top: 12px;
}
.blocked-foot:empty {
  display: none;
}
.archive-row.blocked-row .archive-ic {
  display: grid;
  place-items: center;
  color: var(--label2);
}
.vis-hub .settings-list {
  margin-bottom: 14px;
}
.setting .setting-val {
  white-space: nowrap;
}

/* ============ Оформление комнаты: фон, палитра, обои чата ============ */

.room.has-bd {
  background: transparent;
}
.room-bd {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}
.room-bd-img {
  position: absolute;
  inset: -28px;
  background: var(--bd, none);
  filter: blur(var(--rt-blur, 0px));
  animation: fade 0.9s;
}
.room-bd-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--rt-dim, 0));
}
.room.has-bd > .room-top,
.room.has-bd > .room-main,
.room.has-bd > .side {
  position: relative;
  z-index: 1;
}
/* панели становятся «матовым стеклом»: сквозь них виден фон, но текст остаётся читаемым */
.room.has-bd .side {
  background: color-mix(in srgb, var(--fill) 62%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}
.room.has-bd.wp-room .side {
  background: color-mix(in srgb, var(--fill) 34%, transparent);
}
.room.has-bd .stage {
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.room.has-bd .stage-overlay:not(:has(.vstage)):not(:has(.screen-view)) {
  background:
    radial-gradient(520px 320px at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
    rgba(5, 5, 5, 0.3);
}
.room.has-bd .room-title,
.room.has-bd .room-meta {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

/* обои чата: свои вместо рисунка из набросков */
.chat-wrap[data-wp='none']::before,
.chat-wrap[data-wp='room']::before {
  display: none;
}
.chat-wrap[data-wp='custom']::before {
  -webkit-mask: none;
  mask: none;
  background:
    linear-gradient(rgba(0, 0, 0, var(--wp-dim, 0)), rgba(0, 0, 0, var(--wp-dim, 0))),
    var(--wp);
}

/* окно выбора */
.rt-prev {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40%;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  height: 196px;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--sep);
}
.rt-prev-bd {
  position: absolute;
  inset: 0;
  z-index: -1;
}
.rt-prev-img {
  position: absolute;
  inset: -10px;
  background: var(--bd, none);
  background-size: auto;
  filter: blur(var(--rt-blur, 0px));
}
.rt-prev-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--rt-dim, 0));
}
.rt-prev-top {
  grid-column: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 4px;
  min-width: 0;
}
.rt-prev-top b {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rt-prev-top span {
  flex: none;
  font-size: 10.5px;
  color: var(--label2);
}
.rt-prev-stage {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--label2);
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.rt-prev-side {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 18px;
  overflow: hidden;
  background: color-mix(in srgb, var(--fill) 62%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.rt-prev-chat {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
  padding: 8px;
  overflow: hidden;
}
.rt-prev-chat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.06);
  -webkit-mask: url('/images/chat-wallpaper.svg') center top / 300px auto repeat;
  mask: url('/images/chat-wallpaper.svg') center top / 300px auto repeat;
}
.rt-prev-chat[data-wp='none']::before,
.rt-prev-chat[data-wp='room']::before {
  display: none;
}
.rt-prev-chat[data-wp='custom']::before {
  -webkit-mask: none;
  mask: none;
  background:
    linear-gradient(rgba(0, 0, 0, var(--wp-dim, 0)), rgba(0, 0, 0, var(--wp-dim, 0))),
    var(--wp);
}
.rt-prev-chat .b {
  position: relative;
  align-self: flex-start;
  max-width: 92%;
  padding: 5px 9px;
  border-radius: 12px 12px 12px 4px;
  background: var(--fill3);
  font-style: normal;
  font-size: 10.5px;
  line-height: 1.3;
}
.rt-prev-chat .b.own {
  align-self: flex-end;
  border-radius: 12px 12px 4px 12px;
  background: var(--accent);
  color: var(--on-accent);
}
.rt-prev-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 6px 6px;
  padding: 6px 6px 6px 10px;
  border-radius: 14px;
  background: var(--fill2);
  color: var(--label3);
  font-size: 10.5px;
}
.rt-prev-form em {
  margin-left: auto;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
}

.rt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 10px;
}
.rt-grid.small {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 8px;
}
.rt-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  text-align: left;
}
.rt-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition:
    transform 0.4s var(--spring),
    box-shadow 0.25s;
}
.rt-tile.small .rt-thumb {
  aspect-ratio: 1;
  border-radius: 14px;
}
.rt-tile:active .rt-thumb {
  transform: scale(0.95);
}
.rt-tile.on .rt-thumb {
  box-shadow:
    0 0 0 2.5px var(--accent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.rt-check {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  transform: scale(0);
  opacity: 0;
  transition:
    transform 0.45s var(--spring),
    opacity 0.2s;
}
.rt-tile.on .rt-check,
.rt-pal.on .rt-check {
  transform: none;
  opacity: 1;
}
.rt-name {
  font-size: 12.5px;
  color: var(--label2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rt-tile.on .rt-name,
.rt-pal.on .rt-name {
  color: var(--label);
}
.rt-pals {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 6px;
}
.rt-pal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 64px;
}
.rt-dot {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition:
    transform 0.45s var(--spring),
    outline-color 0.2s;
  outline: 2.5px solid transparent;
  outline-offset: 3px;
}
.rt-pal:active .rt-dot {
  transform: scale(0.9);
}
.rt-pal.on .rt-dot {
  outline-color: var(--label);
}
.rt-dot .rt-check {
  position: static;
  width: 100%;
  height: 100%;
  background: transparent;
  color: #000;
}
.rt-sliders {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
  transition: opacity 0.3s;
}
.rt-sliders.off {
  opacity: 0.4;
}
.rt-slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rt-slider > span {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--label2);
}
.rt-slider b {
  font-weight: 400;
  color: var(--label);
  font-variant-numeric: tabular-nums;
}
.rt-range {
  width: 100%;
  accent-color: var(--accent);
}
.rt-default {
  margin-top: 18px;
}
@media (max-width: 480px) {
  .rt-grid.small {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .rt-prev {
    height: 172px;
  }
}

/* шапка комнаты на узких экранах: кнопок стало больше — подпись приватности прячем, кнопки чуть уже */
.room-title {
  overflow: hidden;
}
@media (max-width: 480px) {
  .room-top {
    gap: 0;
  }
  .room-top .btn-icon {
    width: 36px;
  }
  .room-meta .meta-priv {
    display: none;
  }
}
.room-meta .meta-priv {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
@media (max-width: 480px) {
  .room-meta .meta-priv {
    display: none;
  }
}

/* карточка профиля: главные кнопки поровну на всю ширину, ниже — «друг» слева и «Заблокировать» справа, в одну линию */
.uprofile-actions > .btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
}
.uprofile-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin-top: 10px;
}
.block-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin-left: auto;
  padding: 0 12px 0 10px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--label2);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--sep2);
  transition:
    color 0.2s,
    background 0.2s,
    transform 0.4s var(--spring);
}
.block-btn:hover {
  color: #ff8a80;
  background: rgba(255, 138, 128, 0.08);
}
.block-btn:active {
  transform: scale(0.95);
}

.uprofile-sub .tag {
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 13px;
}
.uprofile-sub .btn-sm {
  height: 32px;
}

/* ============ Загрузка с устройства, фото в комнате ============ */
.upl {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.upl-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border-radius: 22px;
  text-align: left;
  color: var(--label);
  background: var(--fill2);
  box-shadow: inset 0 0 0 1.5px var(--sep2);
  transition:
    background 0.2s,
    box-shadow 0.2s,
    transform 0.4s var(--spring);
}
.upl-zone:hover {
  background: var(--fill3);
}
.upl-zone:active {
  transform: scale(0.985);
}
.upl-zone:disabled {
  opacity: 0.55;
}
.upl-zone.drag {
  background: var(--fill3);
  box-shadow:
    inset 0 0 0 2px var(--accent),
    0 0 0 4px rgba(255, 255, 255, 0.08);
}
.upl-zone > svg {
  flex: none;
}
.upl-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.upl-text b {
  font-weight: 500;
  font-size: 15px;
}
.upl-text small {
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.35;
}
.upl-zone.compact {
  width: auto;
  padding: 10px 16px;
  border-radius: 20px;
  gap: 10px;
}
.upl-zone.compact .upl-text small {
  display: none;
}
.upl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upl-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 10px 14px;
  border-radius: 18px;
  background: var(--fill2);
}
.upl-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.upl-name b {
  flex: 1;
  min-width: 0;
  font-weight: 400;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upl-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.upl-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.25s linear;
}
.upl-row small {
  color: var(--label2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.upl-row.ok small {
  color: var(--label);
}
.upl-row.bad small {
  color: #ff8a80;
}
.upl-row.ok .upl-bar i {
  transform: scaleX(1);
}
.url-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--label2);
  font-size: 13.5px;
  line-height: 1.35;
}
.url-status[hidden] {
  display: none;
}
.url-help {
  margin-top: 6px;
  color: var(--label2);
  font-size: 13px;
  line-height: 1.4;
}
.spinner.small {
  flex: none;
  width: 18px;
  height: 18px;
  border-width: 2px;
}
.player-photo {
  object-fit: contain;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
}

/* регистрация: проверка логина */
.uname-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.uname-row .input {
  flex: 1;
  min-width: 0;
}
.uname-suggest {
  flex: none;
  height: 46px;
  padding: 0 14px;
}
.uname-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -4px 4px 0;
  font-size: 13px;
  color: var(--label2);
}
.uname-status[hidden] {
  display: none;
}
.uname-status.ok {
  color: var(--label);
}
.uname-status.bad {
  color: #ff8a80;
}

/* безопасность: плашка «24 часа», сеансы */
.sec-lock {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--fill2);
  box-shadow: inset 0 0 0 1px var(--sep2);
}
.sec-lock > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.sec-lock b {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.3;
}
.sec-lock small {
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.4;
}
.sess-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sess-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--fill2);
}
.sess-row.cur {
  box-shadow: inset 0 0 0 1.5px var(--sep2);
}
.sess-ic {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--fill3);
  color: var(--label2);
}
.sess-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sess-info b {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 500;
  font-size: 14.5px;
}
.sess-info small {
  color: var(--label2);
  font-size: 12.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.sess-info small.online {
  color: var(--label);
}
.sess-foot {
  margin-top: 12px;
}
.sess-foot:empty {
  display: none;
}
.sess-top .confirm-text {
  margin-bottom: 12px;
}
.apple-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
