/* ============================================================
   Кинотека — интерфейс в духе Rave.
   Токены — в tokens.css. Принципы взяты из скриншотов Rave:
   видео занимает три четверти экрана, чат справа, сверху тонкая
   стеклянная панель, фон подсвечен цветом самого видео, у чата
   нет «пузырей», а главное действие — белый круг.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Oswald:wght@500;600;700&display=swap");

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

/* hidden должен побеждать display из компонентов */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

/* Страница одна и не двигается: прокручиваются только чат и плейлист.
   position: fixed у body — единственный способ, которым iOS Safari перестаёт
   «резинить» страницу и сдвигать её под клавиатуру; overscroll-behavior снимает
   «потянуть для обновления» на Android; pan-x pan-y отключает масштабирование щипком. */
html {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .24) transparent;
}

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

::selection {
  background: rgba(255, 255, 255, .28);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Иконки: контур 2, заливка — только у отмеченных в спрайте ---------- */
.icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 17px;
  height: 17px;
}

/* ============================================================
   Подсветка фона
   Слои лежат позади всего интерфейса: пятна, размытый постер
   и затемнение, которое держит текст читаемым.
   ============================================================ */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
  pointer-events: none;
}

.ambient__aurora {
  position: absolute;
  inset: 0;
  opacity: .8;
}

.ambient__aurora i {
  position: absolute;
  width: 72vmax;
  height: 72vmax;
  border-radius: 50%;
  will-change: transform;
}

.ambient__aurora i:nth-child(1) {
  left: -24vmax;
  top: -30vmax;
  background: radial-gradient(circle, var(--blob-1) 0%, transparent 62%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.ambient__aurora i:nth-child(2) {
  right: -26vmax;
  top: -14vmax;
  background: radial-gradient(circle, var(--blob-2) 0%, transparent 62%);
  animation: drift-b 31s ease-in-out infinite alternate;
}

.ambient__aurora i:nth-child(3) {
  left: -12vmax;
  bottom: -40vmax;
  background: radial-gradient(circle, var(--blob-3) 0%, transparent 62%);
  opacity: .75;
  animation: drift-c 35s ease-in-out infinite alternate;
}

.ambient__aurora i:nth-child(4) {
  right: -20vmax;
  bottom: -36vmax;
  background: radial-gradient(circle, var(--blob-4) 0%, transparent 62%);
  animation: drift-d 29s ease-in-out infinite alternate;
}

.ambient__img {
  position: absolute;
  left: -20%;
  top: -20%;
  width: 140%;
  height: 140%;
  object-fit: cover;
  opacity: 0;
  filter: blur(46px) saturate(2.4) brightness(1);
  transition: opacity 1.3s ease;
  will-change: opacity, transform;
}

.ambient__img.is-on {
  opacity: .96;
}

.ambient__shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(130% 100% at 50% 40%, rgba(5, 3, 14, 0) 0%, rgba(5, 3, 14, .55) 100%),
    rgba(5, 3, 14, .1);
}

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

/* Пилюля: стеклянная; главное действие — белая */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass-2);
  color: var(--ink);
  font: 600 14px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast),
    opacity var(--d-fast), box-shadow var(--d-base), transform .35s var(--ease-spring);
}

.btn:hover {
  background: var(--glass-3);
  transform: scale(1.04);
}

.btn:active {
  transform: scale(.94);
}

.btn:disabled {
  opacity: .35;
  pointer-events: none;
}

.btn--primary {
  border-color: #fff;
  background: #fff;
  color: #0a0714;
}

.btn--primary:hover {
  background: #fff;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  backdrop-filter: none;
  color: var(--ink-2);
}

.btn--ghost:hover {
  background: var(--glass-2);
  color: var(--ink);
}

.btn--icon {
  width: 42px;
  padding: 0;
}

.btn--sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.btn--sm.btn--icon {
  width: 34px;
  padding: 0;
}

.btn--danger {
  color: #ff9aae;
}

/* Круглая иконка без фона — кнопки верхней панели */
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--d-fast);
}

.icon-btn .icon,
.icon-btn .avatar,
.ctl .icon {
  transition: transform .35s var(--ease-spring);
}

.icon-btn:hover {
  background: var(--glass-2);
}

.icon-btn:hover .icon,
.icon-btn:hover .avatar {
  transform: scale(1.14);
}

.icon-btn:active .icon,
.icon-btn:active .avatar {
  transform: scale(.88);
}

.icon-btn--avatar {
  width: 44px;
  height: 44px;
}

/* Белый круг — как кнопка микрофона в Rave. Здесь это «отправить» и «добавить» */
.round-btn {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #0a0714;
  cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6);
  transition: opacity var(--d-base), box-shadow var(--d-base), transform .4s var(--ease-spring);
}

.round-btn .icon {
  width: 20px;
  height: 20px;
}

.round-btn:not(:disabled):hover {
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6);
  transform: scale(1.1);
}

.round-btn:not(:disabled):active {
  transform: scale(.9);
}

.round-btn:disabled {
  opacity: .32;
  transform: scale(.88);
  cursor: default;
}

/* ---------- Поля ввода ---------- */
.field {
  min-width: 0;
  height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass-2);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font: 500 15px/1.4 var(--sans);
  transition: border-color var(--d-base), background var(--d-base), box-shadow var(--d-base);
}

.field::placeholder {
  color: var(--muted);
}

.field:focus {
  outline: none;
  border-color: rgba(255, 255, 255, .6);
  background: var(--glass-3);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .08);
}

/* ---------- Аватары: фото в белом кольце, как у Rave ---------- */
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .1));
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .92), 0 4px 12px -4px rgba(0, 0, 0, .7);
  font: 600 14px/1 var(--sans);
  user-select: none;
}

.avatar--sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.avatar--lg {
  width: 92px;
  height: 92px;
  font-size: 32px;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   Раскладка: верхняя панель и под ней сцена с боковой панелью
   ============================================================ */
/* Высота и сдвиг приходят из js/viewport.js: под экранную клавиатуру приложение
   сжимается, а не уезжает за край. Без скрипта (компьютер) — просто весь экран. */
.app {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: var(--vh, 100dvh);
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  transform: translateY(var(--vv-top, 0px));
}

/* Не-прокручиваемые области глотают жесты: свайп по ним ничего не двигает.
   Чат и плейлист листаются только по вертикали. */
.top,
.stage,
.side__tabs {
  touch-action: none;
}

.chat,
.playlist {
  touch-action: pan-y;
}

.layout {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.stage {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
}

.side {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, rgba(6, 4, 16, .12), rgba(6, 4, 16, .34));
}

/* ---------- Верхняя панель ---------- */
.top {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  margin: 0 calc(-1 * env(safe-area-inset-right)) 0 calc(-1 * env(safe-area-inset-left));
  padding-left: calc(12px + env(safe-area-inset-left));
  padding-right: calc(12px + env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: var(--toolbar);
  backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 10px 30px -14px rgba(0, 0, 0, .7);
}

.top__group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.top__group--end {
  justify-content: flex-end;
  gap: 12px;
}

/* Логотип по центру, как в Rave: просто белое слово */
.brand {
  margin: 0;
  font: 600 26px/1 var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand__word {
  display: inline-block;
}

.members {
  display: flex;
  align-items: center;
  gap: 4px;
}

.members__stack {
  display: flex;
}

.members__stack .avatar + .avatar {
  margin-left: -10px;
}

/* Значок «люди» с числом в углу — как у Rave в правом верхнем углу */
.members__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
}

.members__icon .icon {
  width: 26px;
  height: 26px;
}

.members__count {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: #0a0714;
  font: 600 11px/18px var(--sans);
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}

.members__count.is-bump {
  animation: pop .45s var(--ease-spring);
}

/* ============================================================
   Плеер: кадр вписан в сцену, управление поверх него
   ============================================================ */
.player {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
}

.player__screen {
  position: relative;
  flex: 1;
  min-height: 0;
  container-type: size;
  /* Поля вокруг кадра: тёмное стекло, сквозь которое виден цвет фона */
  background: rgba(2, 1, 8, .62);
}

/* Кадр 16:9 по центру. Ширина — меньшее из «вся сцена» и «вся высота в 16:9»,
   поэтому плеер всегда занимает максимум места. */
.player__media {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  width: min(100cqw, calc(100cqh * 16 / 9));
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  background: #000;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
}

.player__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Постер при паузе: закрывает чужой оверлей плеера (название, логотип, большая кнопка) */
.player__poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--d-base) var(--ease-out);
}

.player.is-paused .player__poster {
  opacity: 1;
}

.player.is-empty .player__poster {
  display: none;
}

.player__poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .78;
}

/* Большая кнопка на паузе: стеклянный круг с расходящимся кольцом */
.player__big-play {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(44px, min(9cqw, 26cqh), 96px);
  height: clamp(44px, min(9cqw, 26cqh), 96px);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(14px);
  color: #fff;
  box-shadow: 0 10px 40px -8px rgba(0, 0, 0, .7);
}

.player__big-play .icon {
  width: 42%;
  height: 42%;
  fill: currentColor;
  stroke: none;
}

.player.is-paused .player__big-play {
  animation: pop .55s var(--ease-spring) both;
}

/* Прозрачный щит: перехватывает клики раньше плеера и его оверлеев */
.player__shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.player.is-idle:not(.is-paused) .player__shield {
  cursor: none;
}

/* Вспышка при смене состояния: значок вырастает и тает */
.player__flash {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  background: rgba(10, 7, 20, .55);
  backdrop-filter: blur(10px);
  color: #fff;
  opacity: 0;
  pointer-events: none;
}

.player__flash .icon {
  width: 44px;
  height: 44px;
}

.player__flash.is-go {
  animation: flash .7s var(--ease-out) forwards;
}

/* Название поверх кадра: появляется вместе со строкой управления */
.player__top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 18px 22px 54px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .74), transparent);
  pointer-events: none;
  transition: opacity var(--d-slow) var(--ease-out), transform var(--d-slow) var(--ease-out);
}

.now__title {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font: 600 19px/1.3 var(--sans);
  text-overflow: ellipsis;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
  white-space: nowrap;
}

.now__meta {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font: 500 13px/1.4 var(--sans);
  text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  white-space: nowrap;
}

/* Пустой зал — как лендинг Rave: крупный заголовок капсом на сияющем фоне */
.player__empty {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(70% 70% at 50% 45%, rgba(7, 5, 15, .15), rgba(7, 5, 15, .6));
}

.player__empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(560px, 100%);
}

.player__empty h2 {
  margin: 8px 0 0;
  color: #fff;
  font: 600 clamp(38px, 6.4cqw, 72px)/1 var(--display);
  letter-spacing: .03em;
  text-transform: uppercase;
  text-shadow: 0 6px 40px rgba(0, 0, 0, .5), 0 0 28px rgba(255, 255, 255, .25);
  -webkit-text-stroke: 1px currentColor;
}

.player__empty p {
  max-width: 440px;
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}

.player__empty-glyph {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--glass-2);
  backdrop-filter: blur(14px);
  color: #fff;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, .7);
}

.player__empty-glyph .icon {
  width: 30px;
  height: 30px;
}

/* Строка «ссылка + кнопка» */
.prompt {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 18px;
  padding: 6px 6px 6px 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass-2);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 50px -18px rgba(0, 0, 0, .8);
  transition: border-color var(--d-base), box-shadow var(--d-base);
}

.prompt:focus-within {
  border-color: rgba(255, 255, 255, .65);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .08), 0 16px 50px -18px rgba(0, 0, 0, .8);
}

.prompt__input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: 500 15px/1 var(--sans);
}

.prompt__input::placeholder {
  color: var(--muted);
}

.prompt__input:focus {
  outline: none;
}

/* Пока ролика нет, с кадром ничего не сделать, а поля пропадают:
   пустой зал занимает всю сцену, как лендинг */
.player.is-empty .player__screen {
  background: transparent;
}

.player.is-empty .player__media,
.player.is-empty .player__top,
.player.is-empty .player__bar {
  display: none;
}

/* ---------- Строка управления поверх кадра ---------- */
.player__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  padding: 56px 18px 24px;
  /* Низ плотный: у YouTube в правом нижнем углу кадра остаётся водяной знак, и он
     не должен просвечивать сквозь кнопки */
  background: linear-gradient(0deg, rgba(0, 0, 0, .95) 0%, rgba(0, 0, 0, .9) 32%, rgba(0, 0, 0, .5) 62%, transparent 100%);
  transition: opacity var(--d-slow) var(--ease-out), transform var(--d-slow) var(--ease-out);
}

.player:fullscreen .player__bar {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* Во время просмотра панели прячутся, когда указатель не двигается */
.player.is-idle:not(.is-paused) .player__bar {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}

/* Заголовок — только на паузе, когда кадр закрыт постером. Пока ролик идёт, YouTube
   показывает под ним свой заголовок и аватар канала, и два текста друг на друге
   читаются как мусор. */
.player:not(.is-paused) .player__top {
  opacity: 0;
  transform: translateY(-14px);
}

/* Кнопки строки управления */
.ctl {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background var(--d-fast), box-shadow var(--d-base);
}

.ctl:hover {
  background: var(--glass-2);
}

.ctl:hover .icon {
  transform: scale(1.16);
}

.ctl:active .icon {
  transform: scale(.86);
}

.ctl--play {
  width: 48px;
  height: 48px;
  background: #fff;
  color: #0a0714;
}

.ctl--play:hover {
  background: #fff;
}

.icon--shrink,
.player:fullscreen .icon--expand {
  display: none;
}

.player:fullscreen .icon--shrink {
  display: block;
}

.time {
  margin: 0 8px;
  color: #fff;
  font: 600 13px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}

.time i {
  margin: 0 4px;
  font-style: normal;
  opacity: .5;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0 10px;
  color: var(--ink-2);
  font: 600 12px/1 var(--sans);
  white-space: nowrap;
}

.sync-badge__dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.sync-badge__dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff;
  animation: ripple 2.6s var(--ease-out) infinite;
}

.sync-badge.is-syncing .sync-badge__dot {
  animation: pulse .9s var(--ease) infinite;
}

/* Полоса позиции: тонкая, на наведении толстеет; заливка и бегунок
   двигаются трансформациями */
.scrubber {
  position: relative;
  flex: 1 0 100%;
  height: 24px;
  cursor: pointer;
  touch-action: none;
}

.scrubber__track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  margin-top: -2px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, .26);
  transition: height var(--d-base) var(--ease-out), margin-top var(--d-base) var(--ease-out);
}

.scrubber:hover .scrubber__track,
.scrubber:focus-visible .scrubber__track,
.scrubber.is-dragging .scrubber__track {
  height: 8px;
  margin-top: -4px;
}

.scrubber__fill {
  position: absolute;
  inset: 0;
  background: #fff;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform .3s var(--ease-out);
}

.scrubber.is-dragging .scrubber__fill {
  transition: none;
}

.scrubber__knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .22);
  transform: translateX(calc(var(--p, 0) * var(--track-w, 0px))) scale(0);
  transition: transform .3s var(--ease-out);
}

.scrubber.is-dragging .scrubber__knob {
  transition: none;
}

/* Бегунок виден на наведении и фокусе; на тач-экране — всегда */
.scrubber:hover .scrubber__knob,
.scrubber:focus-visible .scrubber__knob,
.scrubber.is-dragging .scrubber__knob {
  transform: translateX(calc(var(--p, 0) * var(--track-w, 0px))) scale(1);
}

@media (hover: none) {
  .scrubber__knob {
    transform: translateX(calc(var(--p, 0) * var(--track-w, 0px))) scale(.85);
  }
}

/* Картинка в картинке и полный экран: кадр везде чёрный и во всё окно */
.player.is-pip {
  position: fixed;
  inset: 0;
  height: 100%;
  background: #000;
}

.player.is-pip .player__screen,
.player:fullscreen .player__screen {
  background: #000;
}

.player:fullscreen {
  background: #000;
}

/* Карточка «в отдельном окне», пока кадр вынесен */
.stage__away {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  background: rgba(2, 1, 8, .5);
  animation: rise .6s var(--ease-out) both;
}

.stage__away h2 {
  margin: 14px 0 0;
  font: 600 clamp(28px, 4vw, 44px)/1.05 var(--display);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.stage__away p {
  max-width: 380px;
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 15px;
}

/* ============================================================
   Боковая панель: чат и плейлист
   ============================================================ */
.side__tabs {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  margin: 12px 14px 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass-1);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 600 14px/1 var(--sans);
  cursor: pointer;
  transition: color var(--d-base);
}

.tab:hover,
.tab[aria-selected="true"] {
  color: #fff;
}

/* Плашка скользит к выбранной вкладке */
.tabs__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: var(--w, 0px);
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .26), 0 6px 18px -8px rgba(0, 0, 0, .6);
  transform: translateX(var(--x, 0px));
  transition: transform .45s var(--ease-out), width .45s var(--ease-out);
}

.tab__count {
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff;
  color: #0a0714;
  font: 600 11px/22px var(--sans);
  text-align: center;
}

.pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.pane__empty {
  margin: auto;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---------- Чат: без «пузырей», текст прямо на подсвеченном фоне ---------- */
.chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Верхний край уходит в прозрачность: сообщения «растворяются» под вкладками */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 32px);
  mask-image: linear-gradient(180deg, transparent 0, #000 32px);
}

.msg {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 4px;
  border-radius: 14px;
  transform: translateX(var(--pull, 0px));
  transition: transform .45s var(--ease-spring);
}

/* Пока тянут — сообщение идёт точно за пальцем, без задержки */
.msg.is-swiping {
  transition: none;
  will-change: transform;
}

.msg.is-head {
  margin-top: 16px;
}

.msg:first-child {
  margin-top: 0;
}

.msg__avatar-slot {
  flex: 0 0 36px;
  width: 36px;
}

.msg__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: calc(100% - 46px);
}

/* Имя и текст идут в одной строке: «Кристиан: Привет!» */
.msg__line {
  color: #fff;
  font: 500 14.5px/1.45 var(--sans);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}

.msg__author {
  margin-right: 6px;
  font-weight: 600;
}

/* Пузырь. Чужие сообщения — тёмное стекло, свои — светлее. Острый угол у первого
   сообщения серии смотрит на аватар. Размытия фона у пузырей нет: их до двухсот штук,
   и по размытию на каждом мобильный браузер бы сильно тормозил. */
.msg__bubble {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px;
  background: rgba(18, 15, 38, .64);
  box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .8);
  text-align: left;
}

.msg.is-head .msg__bubble {
  border-top-left-radius: 6px;
}

.msg--own .msg__bubble {
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .2);
}

.msg--own.is-head .msg__bubble {
  border-top-left-radius: 18px;
  border-top-right-radius: 6px;
}

/* Одни эмодзи — крупно и с подскоком, как в Rave */
.msg--emoji .msg__line {
  font-size: 42px;
  line-height: 1.15;
  text-shadow: none;
  transform-origin: left bottom;
}

.msg--emoji .msg__bubble:not(:has(.msg__quote)) {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.msg--emoji .msg__author {
  display: block;
  margin: 0 0 2px;
  font-size: 13px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .75);
}

/* Свои сообщения — справа, с аватаром справа */
.msg--own {
  flex-direction: row-reverse;
}

.msg--own .msg__col {
  align-items: flex-end;
  text-align: right;
}

.msg--system {
  justify-content: center;
  margin-top: 10px;
}

.msg--system .msg__line {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--glass-1);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  text-shadow: none;
}

.msg__reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.msg--own .msg__reactions {
  justify-content: flex-end;
}

.reaction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  color: #fff;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
  transition: transform .3s var(--ease-spring), background var(--d-fast), border-color var(--d-fast);
}

.reaction:hover {
  background: var(--glass-3);
  transform: scale(1.08);
}

.reaction:active {
  transform: scale(.88);
}

.reaction.is-mine {
  border-color: #fff;
  background: rgba(255, 255, 255, .24);
}

.msg__reactions.is-new .reaction.is-new {
  animation: pop .45s var(--ease-spring);
}

.reaction-picker {
  position: fixed;
  z-index: 50;
  display: flex;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(20, 16, 44, .82);
  backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: var(--shadow);
  animation: picker-in .35s var(--ease-spring) both;
}

.reaction-picker button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--d-fast);
}

.reaction-picker button:hover {
  background: var(--glass-2);
}

.reaction-picker__emoji {
  display: block;
  transition: transform .35s var(--ease-spring);
}

.reaction-picker button:hover .reaction-picker__emoji {
  transform: scale(1.28);
}

.reaction-picker button:active .reaction-picker__emoji {
  transform: scale(.9);
}

/* «Печатает…» */
.typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  color: var(--ink-2);
  font: 600 12.5px/1.4 var(--sans);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .7);
}

.typing:empty {
  display: none;
}

.typing:not(:empty) {
  padding-top: 6px;
}

.typing__dots {
  display: inline-flex;
  gap: 4px;
}

.typing__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: bounce 1.2s var(--ease) infinite;
  animation-delay: calc(var(--i) * .15s);
}

/* Строка ввода: стеклянная капсула и белый круг, как внизу чата в Rave */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0, 0, 0, .5), transparent);
}

/* Рамка общая для поля и плашки ответа: так плашка выглядит продолжением поля */
.composer__box {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 24px;
  background: var(--glass-2);
  backdrop-filter: blur(16px);
  transition: border-color var(--d-base), background var(--d-base), box-shadow var(--d-base);
}

.composer__box:focus-within {
  border-color: rgba(255, 255, 255, .6);
  background: var(--glass-3);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .08);
}

.composer__input {
  display: block;
  flex: none;
  width: 100%;
  min-height: 46px;
  max-height: 120px;
  padding: 12px 20px;
  overflow-y: hidden;
  resize: none;
  border: 0;
  border-radius: 0;
  background: none;
  color: #fff;
  font: 500 15px/1.4 var(--sans);
}

.composer__input::placeholder {
  color: var(--muted);
}

.composer__input:focus {
  outline: none;
}

/* ---------- Плейлист ---------- */
.playlist {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 12px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.track {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--glass-1);
  backdrop-filter: blur(10px);
  transition: background var(--d-base), border-color var(--d-base), box-shadow var(--d-slow), transform .5s ease;
}

/* Наведение: фон карточки светлеет, размер не меняется */
.track:hover,
.track:focus-within {
  background: var(--glass-2);
}

.track.is-current {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .17);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.track.is-new {
  animation: rise .5s var(--ease-spring);
}

.track__open {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.track__thumb {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 96px;
  width: 96px;
  height: 54px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .45);
  color: var(--muted);
}

.track__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Бегущие столбики на играющем ролике, как значок «сейчас играет» в музыкальных плеерах */
.track__eq {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding-bottom: 8px;
  background: rgba(0, 0, 0, .5);
}

.track__eq i {
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: #fff;
  transform-origin: bottom;
  animation: eq 1s ease-in-out infinite;
  animation-play-state: paused;
}

.track__eq i:nth-child(2) {
  animation-delay: -.45s;
  animation-duration: .8s;
}

.track__eq i:nth-child(3) {
  animation-delay: -.2s;
  animation-duration: 1.15s;
}

.app:has(.player:not(.is-paused)) .track.is-current .track__eq i {
  animation-play-state: running;
}

.track__body {
  flex: 1;
  min-width: 0;
}

.track__title {
  display: -webkit-box;
  overflow: hidden;
  color: #fff;
  font: 600 14px/1.3 var(--sans);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.track__meta {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font: 500 12px/1.4 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track__remove {
  margin-right: 6px;
  opacity: 0;
  transition: opacity var(--d-base), background var(--d-fast);
}

.track:hover .track__remove,
.track:focus-within .track__remove,
.track__remove:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .track__remove {
    opacity: .7;
  }
}

.playlist__add {
  display: flex;
  gap: 10px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0, 0, 0, .5), transparent);
}

.playlist__add .field {
  flex: 1;
}

/* ---------- Ответы на сообщения ---------- */

/* Значок выезжает слева, пока сообщение тянут вправо; «заряжается» на пороге */
.msg__hint {
  position: absolute;
  left: -46px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  border-radius: 50%;
  background: var(--glass-3);
  color: #fff;
  opacity: var(--swipe, 0);
  transform: scale(calc(.5 + var(--swipe, 0) * .5));
  pointer-events: none;
  transition: background var(--d-fast), color var(--d-fast), box-shadow var(--d-base);
}

.msg.is-armed .msg__hint {
  background: #fff;
  color: #0a0714;
}

/* Цитата того, на что отвечают. Ширину ей задаёт сам ответ: цитата тянется до его
   текста, а оригинал внутри обрезается в одну строку с многоточием — иначе длинное
   исходное сообщение раздувало бы короткий ответ на всю ширину чата. */
.msg__quote {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 2px;
  min-width: 92px;
  max-width: 100%;
  margin: 0 0 6px;
  padding: 6px 12px 6px 10px;
  border: 0;
  border-left: 3px solid rgba(255, 255, 255, .85);
  border-radius: 4px 10px 10px 4px;
  background: rgba(0, 0, 0, .28);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background var(--d-fast), transform .35s var(--ease-spring);
}

.msg__quote:hover {
  background: rgba(0, 0, 0, .4);
}

.msg__quote:active {
  transform: scale(.97);
}

.msg__quote-author {
  font: 600 12px/1.3 var(--sans);
}

/* width: 0 при min-width: 100% — текст не участвует в расчёте ширины блока (она берётся
   от ответа и имени автора), но занимает всё доступное место и сам обрезается */
.msg__quote-text {
  display: block;
  width: 0;
  min-width: 100%;
  overflow: hidden;
  color: var(--ink-2);
  font: 500 12.5px/1.35 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Когда к сообщению прокрутили по цитате, вспыхивает его пузырь целиком. В кадре 30% ключ
   задаёт яркое состояние, а к исходному цвету пузырь возвращается сам. */
.msg .msg__bubble.is-flash {
  animation: bubble-flash 1.6s ease-out;
}

@keyframes bubble-flash {
  0%,
  30% {
    border-color: rgba(255, 255, 255, .9);
    background-color: rgba(255, 255, 255, .5);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .3);
  }
}

/* Мышь: сообщение «схвачено» после короткого удержания — теперь его можно потянуть
   вправо. Текст при этом не выделяется, а пузырь обводится. */
.msg.is-held,
.msg.is-held * {
  cursor: grabbing;
  user-select: none;
}

.msg.is-held .msg__bubble {
  border-color: rgba(255, 255, 255, .7);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .14);
}

/* Плашка ответа — верхняя часть поля ввода: той же ширины, без зазора, под общей
   рамкой и скруглением; от самого поля её отделяет только тонкая линия. */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
  background: rgba(0, 0, 0, .25);
  color: rgba(255, 255, 255, .62);
  animation: reply-in .3s var(--ease-out);
}

.reply-bar > .icon {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, .75);
}

.reply-bar__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding-left: 10px;
  border-left: 3px solid rgba(255, 255, 255, .75);
}

.reply-bar__author {
  color: rgba(255, 255, 255, .75);
  font: 600 12.5px/1.3 var(--sans);
}

.reply-bar__text {
  overflow: hidden;
  font: 500 13px/1.35 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-bar__close {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, .75);
  width: 34px;
  height: 34px;
}

@keyframes reply-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Листы: профиль и приглашение
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vv-top, 0px);
  height: 100%;
  height: var(--vh, 100%);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--scrim);
  backdrop-filter: blur(10px);
  animation: fade-in .25s var(--ease);
}

.sheet-backdrop.is-closing {
  animation: fade-out .22s var(--ease) forwards;
}

.sheet {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  max-height: calc(var(--vh, 100dvh) - 32px);
  padding: 28px;
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(52, 44, 108, .78), rgba(14, 12, 34, .88));
  backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .16);
  animation: sheet-in .55s var(--ease-spring);
}

.sheet__title {
  margin: 0;
  font: 600 32px/1.05 var(--display);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.sheet__subtitle {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

.sheet__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet__label {
  color: var(--muted);
  font: 500 13px/1.2 var(--sans);
}

.sheet__section .field {
  width: 100%;
}

.sheet__divider {
  height: 1px;
  background: var(--line);
}

.sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.sheet__actions .btn {
  flex: 1 1 auto;
}

.profile-preview {
  display: flex;
  justify-content: center;
}

.invite__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass-1);
}

.invite__link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font: 600 14px/1 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Уведомления ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 12px 22px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(20, 16, 44, .84);
  backdrop-filter: blur(22px) saturate(1.5);
  color: #fff;
  font: 600 14px/1.4 var(--sans);
  box-shadow: var(--shadow);
  animation: rise .5s var(--ease-spring);
}

.toast.is-leaving {
  animation: fade-out .3s var(--ease) forwards;
}

/* ============================================================
   Адаптив
   ============================================================ */

/* iOS приближает страницу, когда фокус попадает в поле со шрифтом меньше 16px,
   и после этого экран «уезжает». На сенсорных экранах поля — ровно 16px. */
@media (pointer: coarse) {
  .field,
  .composer__input,
  .prompt__input {
    font-size: 16px;
  }
}

/* Экранная клавиатура открыта (js/viewport.js): остаётся то, чем пользуются, пока
   печатают, — кадр поменьше, чат и строка ввода. Вкладки и нижний отступ под
   домашний индикатор уходят: индикатор закрыт клавиатурой. */
.is-keyboard .composer,
.is-keyboard .playlist__add {
  padding-bottom: 12px;
}

@media (max-width: 759px) {
  .is-keyboard .side__tabs,
  .is-keyboard .player__top {
    display: none;
  }

  .is-keyboard .player__screen {
    flex: none;
    aspect-ratio: auto;
    height: min(56.25vw, calc(var(--vh, 100dvh) * .3));
  }

  /* Нет видео, а печатают в чате: пустой экран ужимается, чтобы чату осталось место.
     Если печатают в самом поле ссылки (фокус внутри сцены), он остаётся прежним. */
  .is-keyboard .stage:not(:focus-within) .player.is-empty .player__screen {
    min-height: 0;
    height: 150px;
  }

  .is-keyboard .stage:not(:focus-within) .player__empty p {
    display: none;
  }

  .is-keyboard .player__bar {
    padding: 14px 8px 10px;
  }

  .is-keyboard .scrubber {
    height: 16px;
  }

  .is-keyboard .ctl {
    width: 28px;
    height: 28px;
  }

  .is-keyboard .ctl .icon {
    width: 16px;
    height: 16px;
  }

  .is-keyboard .ctl--play {
    width: 32px;
    height: 32px;
  }

  .is-keyboard .time {
    font-size: 11px;
  }

  .is-keyboard .player__flash {
    display: none;
  }

  .is-keyboard .composer {
    gap: 8px;
    padding-top: 8px;
  }

  .is-keyboard .composer__input {
    min-height: 40px;
    padding: 8px 16px;
  }

  .is-keyboard .composer__send {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .is-keyboard .top,
  .is-keyboard .side__tabs {
    display: none;
  }
}

/* Планшет и ноутбук: видео слева на три четверти, чат справа — пропорции Rave */
@media (min-width: 760px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side-w);
  }

  .stage {
    height: 100%;
  }

  .side {
    border-left: 1px solid var(--line);
  }
}

/* Телефон стоя, как в Rave: сверху кадр на всю ширину, ниже чат на оставшуюся высоту */
@media (max-width: 759px) {
  :root {
    --top-h: 52px;
  }

  .player {
    height: auto;
  }

  .player__screen {
    flex: none;
    aspect-ratio: 16 / 9;
  }

  .player.is-empty .player__screen {
    aspect-ratio: auto;
    min-height: 300px;
  }

  .side {
    border-top: 1px solid var(--line);
  }

  .brand {
    font-size: 22px;
  }

  .members__stack {
    display: none;
  }

  .player__top {
    padding: 10px 14px 34px;
  }

  .now__title {
    font-size: 15px;
  }

  .now__meta {
    font-size: 12px;
  }

  .player__bar {
    padding: 24px 10px 14px;
    gap: 0 2px;
  }

  .scrubber {
    height: 20px;
  }

  .ctl {
    width: 34px;
    height: 34px;
  }

  .ctl .icon {
    width: 18px;
    height: 18px;
  }

  .ctl--play {
    width: 38px;
    height: 38px;
  }

  .time {
    margin: 0 4px;
    font-size: 11.5px;
  }

  .player__flash {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
  }

  .player__flash .icon {
    width: 30px;
    height: 30px;
  }

  #syncText {
    display: none;
  }

  .sync-badge {
    padding: 0 6px;
  }

  /* Пустой экран должен целиком умещаться в свои 300px вместе с полем ссылки:
     значок убран, заголовок и текст помельче */
  .player__empty {
    padding: 16px;
  }

  .player__empty-glyph {
    display: none;
  }

  .player__empty h2 {
    margin: 0;
    font-size: clamp(32px, 11vw, 44px);
  }

  .player__empty p {
    font-size: 14px;
    line-height: 1.5;
  }

  .player__empty .prompt {
    margin-top: 12px;
  }

  .stage__away {
    aspect-ratio: 16 / 9;
    height: auto;
  }
}

/* Телефон лёжа: кадр слева, чат узкой колонкой справа */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --top-h: 44px;
    --side-w: clamp(240px, 34vw, 340px);
  }

  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side-w);
  }

  .stage {
    height: 100%;
  }

  .player {
    height: 100%;
  }

  .player__screen {
    flex: 1;
    aspect-ratio: auto;
  }

  .side {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .brand {
    font-size: 20px;
  }

  .icon-btn,
  .members__icon {
    width: 36px;
    height: 36px;
  }

  .icon-btn--avatar {
    width: 38px;
    height: 38px;
  }

  .avatar {
    width: 30px;
    height: 30px;
  }

  .side__tabs {
    margin-top: 8px;
  }

  .tab {
    height: 32px;
  }

  .player__empty h2 {
    font-size: 36px;
  }

  .player__empty p {
    display: none;
  }

  .player__empty-glyph {
    display: none;
  }

  .stage__away {
    aspect-ratio: auto;
    height: 100%;
  }
}

/* Телефон лёжа: кадр невысокий, поэтому и кнопки на нём меньше */
@media (max-height: 500px) and (orientation: landscape) {
  .player__bar {
    padding: 28px 12px 12px;
    gap: 0 2px;
  }

  .scrubber {
    height: 20px;
  }

  .ctl {
    width: 34px;
    height: 34px;
  }

  .ctl .icon {
    width: 18px;
    height: 18px;
  }

  .ctl--play {
    width: 38px;
    height: 38px;
  }

  .time {
    margin: 0 4px;
    font-size: 11.5px;
  }
}

/* ============================================================
   Анимации
   ============================================================ */

/* Страница собирается: три блока по очереди выплывают вверх на одно и то же расстояние */
.top {
  animation: page-in .6s var(--ease-out) both;
}

.stage {
  animation: page-in .7s var(--ease-out) .08s both;
}

.side {
  animation: page-in .7s var(--ease-out) .16s both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.95);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes pop {
  0% {
    transform: scale(.6);
  }

  60% {
    transform: scale(1.14);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: .5;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .3;
  }
}

/* Пятна фона плывут по кругу — каждое со своей скоростью */
@keyframes drift-a {
  to {
    transform: translate(18vmax, 14vmax) scale(1.15);
  }
}

@keyframes drift-b {
  to {
    transform: translate(-16vmax, 20vmax) scale(.9);
  }
}

@keyframes drift-c {
  to {
    transform: translate(20vmax, -14vmax) scale(1.2);
  }
}

@keyframes drift-d {
  to {
    transform: translate(-22vmax, -10vmax) scale(1.05);
  }
}

@keyframes ripple {
  0% {
    opacity: .7;
    transform: scale(1);
  }

  70%,
  100% {
    opacity: 0;
    transform: scale(3);
  }
}

/* Вспышка значка при паузе и запуске */
@keyframes flash {
  0% {
    opacity: 0;
    transform: scale(.55);
  }

  25% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes eq {
  0%,
  100% {
    transform: scaleY(.25);
  }

  50% {
    transform: scaleY(1);
  }
}

/* Иконка play/pause перекручивается при смене */
.icon.is-swap {
  animation: icon-swap .4s var(--ease-spring);
}

@keyframes icon-swap {
  from {
    opacity: 0;
    transform: scale(.4) rotate(-45deg);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Сообщения влетают со своей стороны: свои — справа, чужие — слева */
.msg--own.is-new .msg__col,
.msg--own.is-new .msg__avatar-slot {
  animation: msg-in-own .5s var(--ease-spring);
}

.msg:not(.msg--own):not(.msg--system).is-new .msg__col,
.msg:not(.msg--own):not(.msg--system).is-new .msg__avatar-slot {
  animation: msg-in-other .5s var(--ease-spring);
}

.msg--system.is-new .msg__line {
  animation: rise .45s var(--ease-spring);
}

.msg--emoji.is-new .msg__line {
  animation: emoji-pop .8s var(--ease-spring);
}

@keyframes msg-in-own {
  from {
    opacity: 0;
    transform: translate(28px, 8px) scale(.9);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes msg-in-other {
  from {
    opacity: 0;
    transform: translate(-28px, 8px) scale(.9);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes emoji-pop {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(.2) rotate(-18deg);
  }

  55% {
    opacity: 1;
    transform: translateY(-6px) scale(1.25) rotate(8deg);
  }

  100% {
    transform: none;
  }
}

@keyframes picker-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.8);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Удаление ролика: строка сжимается и уходит, и только потом уходит команда серверу */
.track.is-leaving {
  animation: track-out .24s var(--ease-in) forwards;
  pointer-events: none;
}

@keyframes track-out {
  to {
    opacity: 0;
    transform: translateX(-24px) scale(.94);
  }
}

/* Новый участник в стопке появляется с пружинкой */
.members__stack .avatar.is-new {
  animation: pop .55s var(--ease-spring);
}

/* Листы: появление с пружиной, уход с затуханием */
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(.92);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.sheet-backdrop.is-closing .sheet {
  animation: sheet-out .22s var(--ease-in) forwards;
}

@keyframes sheet-out {
  to {
    opacity: 0;
    transform: translateY(12px) scale(.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
