/* ECHO / COSMOS. Подключать ПОСЛЕ style.css и effects.css. */
:root {
  --bg: #08090b;
  --panel: #111318;
  --ink: #edf0f5;
  --mute: #aeb4bf;
  --line: #d5dfef26;
}
body {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Golos Text', 'Segoe UI', sans-serif;
}
/* Отдельный фон: не занимает места и не перехватывает клики. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .64;
}
body::before,
.home-sky::before,
.home-sky::after {
  background: url('/img/echo-cosmos.png') center / cover no-repeat;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, #08090b20, #08090b10 40%, #08090be0);
}

body:has(#content-home.active)::after {
  background:
    radial-gradient(ellipse at center, transparent 26%, #04050735 64%, #040507ba 100%),
    linear-gradient(180deg, #08090b10 34%, #08090be0);
}

.home-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.home-sky {
  --sky-cycle: 54s;
  --sky-phase: calc(var(--sky-cycle) / -2);
  position: absolute;
  inset: 0;
  opacity: .64;
}

.home-sky::before,
.home-sky::after {
  content: '';
  position: absolute;
  inset: 0;
  transform-origin: center;
}

.home-nebula {
  position: absolute;
  inset: 0;
  opacity: .66;
  mix-blend-mode: screen;
}

/* По краям движутся фрагменты туманности из общей текстуры космоса. */
.home-nebula::before,
.home-nebula::after {
  content: '';
  position: absolute;
  inset-block: -18%;
  width: clamp(320px, 64vw, 1050px);
  background: url('/img/echo-cosmos.png') no-repeat;
  background-size: auto 100%;
  filter: blur(1.5px) brightness(.78);
}

.home-nebula::before {
  left: -9vw;
  background-position: left center;
  mask-image:
    linear-gradient(to right, transparent, #000 12%),
    radial-gradient(ellipse 72% 66% at 29% 47%, #000 19%, #000c 46%, transparent 88%);
  mask-composite: intersect;
}

.home-nebula::after {
  right: -4vw;
  background-position: right center;
  mask-image:
    linear-gradient(to left, transparent, #000 12%),
    linear-gradient(transparent 24%, #000 40%),
    radial-gradient(ellipse 72% 66% at 71% 53%, #000 19%, #000c 46%, transparent 88%);
  mask-composite: intersect;
}

.home-shooting-star {
  position: absolute;
  width: clamp(64px, 9vw, 146px);
  height: 3px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, #9baac180 80%, #edf3ff);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.home-shooting-star::after {
  content: '';
  position: absolute;
  inset: 0 0 0 auto;
  width: 5px;
  border-radius: 50%;
  background: #f8faff;
}

:root[data-echo-motion='on'] body:has(#content-home.active)::before { opacity: 0; }
:root[data-echo-motion='on'] .home-backdrop { display: block; }

:root[data-echo-motion='on'] .home-sky::before {
  animation: home-sky-zoom var(--sky-cycle) linear infinite;
}

/* Верхний слой закрывает момент, когда нижний начинает следующий цикл. */
:root[data-echo-motion='on'] .home-sky::after {
  animation:
    home-sky-zoom var(--sky-cycle) linear var(--sky-phase) infinite,
    home-sky-crossfade var(--sky-cycle) ease-in-out var(--sky-phase) infinite;
}

:root[data-echo-motion='on'] .home-nebula::before {
  animation: home-nebula-drift 16s ease-in-out -6s infinite alternate;
}

:root[data-echo-motion='on'] .home-nebula::after {
  animation: home-nebula-drift 21s ease-in-out -13s infinite alternate-reverse;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-echo-motion='on'] #content-home .hero-sculpture {
    transform-origin: 50% 38%;
    transition: transform .56s cubic-bezier(.2, .7, .3, 1);
    transform: perspective(1050px)
      rotateY(calc(var(--pointer-x, 0) * 11deg))
      rotateX(calc(var(--pointer-y, 0) * -5.5deg));
  }
}

@keyframes home-sky-zoom {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

@keyframes home-sky-crossfade {
  0%, 39%, 66%, 100% { opacity: 0; }
  47%, 56% { opacity: 1; }
}

@keyframes home-nebula-drift {
  from { transform: translate3d(-9%, 9%, 0) scale(.96); }
  to { transform: translate3d(13%, -12%, 0) scale(1.08); }
}

.hero-screen { isolation: auto; }
.hero-scene { mix-blend-mode: screen; }
.hero-title, .lead { text-shadow: 0 2px 18px #000; }
.composer { border-color: #d5dfef35; box-shadow: 0 20px 65px #0005, inset 0 1px #ffffff08; }
.field { background: #080a0ed9; border-color: #d5dfef24; }
.field::placeholder { color: #a5abb6; }
.field:focus { border-color: #c7d0df99; box-shadow: 0 0 0 3px #c7d0df0d; }
.btn { background: linear-gradient(135deg, #fff, #d6dbe3); color: #11141a; }
.btn-ghost { background: #14181edb; border-color: #d5dfef35; color: var(--ink); }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { background: #11151ac9; border-color: #d5dfef30; }
.join-strip { border-color: var(--line); }
.steps article { border-color: var(--line); }
.steps h3 { font-weight: 500; }
.steps p, .muted, .faq p { color: var(--mute); }
.faq summary { padding-block: 6px; color: #dce1e9; }
footer { border-color: var(--line); color: #a8afbb; }

/* КАТАЛОГ И ИЗБРАННОЕ */
body:has(#content-movies.active)::before,
body:has(#content-library.active)::before { opacity: .32; }
#content-movies, #content-library { min-height: 76svh; }
.catalog-header { max-width: 850px; padding: 138px 0 42px; }
.catalog-header .eyebrow { color: #b6bfcd; letter-spacing: .2em; }
.catalog-header h1 {
  font: 500 clamp(36px, 4.5vw, 62px)/1.15 'Golos Text', sans-serif;
  letter-spacing: -.055em;
  margin: 20px 0 18px;
}
.catalog-header p { line-height: 1.8; }
.catalog-header .search {
  max-width: 520px;
  min-height: 56px;
  padding-inline: 20px;
  border-radius: 14px;
  background: #101319eb;
}
.catalog-actions { gap: 12px; }
.catalog-actions .btn { border-radius: 30px; padding-inline: 20px; }
.catalog-reset { padding: 10px 14px; }
.catalog-note { color: #c0c8d5; font-size: 14px; }
.movie-grid { gap: 28px 22px; padding-bottom: 32px; }
.movie-card {
  position: relative;
  border: 1px solid #d5dfef1f;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #1a1e26e6, #101217f2);
  box-shadow: 0 12px 32px #0003;
  transition: transform .22s ease, border-color .22s ease;
}
.movie-card:hover, .movie-card:focus-visible {
  transform: translateY(-5px);
  border-color: #d5dfef70;
}
.movie-poster { border-radius: 0; transition: filter .22s; }
.movie-card:hover .movie-poster { filter: brightness(1.05); }
.movie-info { padding: 16px; min-height: 94px; }
.movie-title { font-size: 15px; font-weight: 500; line-height: 1.45; }
.movie-meta { margin-top: 8px; color: #a7afbe; font-size: 13px; }
.fav-btn {
  width: 40px;
  height: 40px;
  background: #080a0dd9;
  border: 1px solid #ffffff50;
  backdrop-filter: blur(8px);
}
.fav-btn.active { color: #171b22; background: #edf0f5; }
.fav-btn:focus-visible { outline-offset: 3px; }
.movie-grid > .muted {
  width: 100%;
  margin: 0;
  padding: 64px 24px;
  border: 1px dashed #c4cede40;
  border-radius: 20px;
  background: #11151cc2;
  text-align: center;
  line-height: 1.8;
}

/* БОКОВОЕ МЕНЮ */
dialog::backdrop { background: #030508b8; backdrop-filter: blur(12px); }
.navigation-dialog {
  width: min(360px, 90vw);
  border-radius: 0 24px 24px 0;
  border-color: #c4cede30;
  background: linear-gradient(160deg, #191e27fa, #0c0f14 65%);
  padding: 28px 22px;
}
.drawer-header .wordmark { font-size: 30px; letter-spacing: -.06em; }
.drawer-caption { font-size: 12px; line-height: 1.8; color: #9ea9b9; }
.nav-menu { gap: 10px; }
.nav-item { border-radius: 12px; padding: 18px; font-size: 16px; }
.nav-item.active {
  background: linear-gradient(110deg, #d1dbef1c, #d1dbef05);
  border-color: #d1dbef36;
}
.drawer-footer { border-top: 1px solid var(--line); padding-top: 28px; }
.drawer-motion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 0;
  padding: 4px 10px;
  color: #c1c9d5;
  font-size: 14px;
}
.drawer-motion select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11151c;
  color: var(--ink);
  font: inherit;
}

/* ВХОД И РЕГИСТРАЦИЯ */
.account-dialog {
  width: min(480px, calc(100% - 32px));
  border: 1px solid #c4cede40;
  border-radius: 24px;
  padding: 32px;
  background: radial-gradient(ellipse at 0 0, #2b3345, transparent 70%), #101319;
  box-shadow: 0 30px 100px #0009;
}
.modal-header h2 { font: 500 27px/1.25 'Golos Text', sans-serif; letter-spacing: -.045em; }
.auth-tabs { border-radius: 12px; background: #080b10; padding: 5px; }
.auth-tab { font-size: 14px; padding: 12px 8px; }
.auth-tab.active { background: #2b3340; box-shadow: inset 0 1px #ffffff12; }
.auth-field label { color: #c1c9d5; font-size: 14px; }
.auth-field .field { min-height: 54px; font-size: 16px; }
.show-password { color: #adb7c6; font-size: 14px; }
.auth-note { font-size: 12px; color: #a8b2c2; }
.guest-btn { font-size: 14px; padding: 10px; }
.auth-status { background: #d3dff00b; border-color: #d3dff030; }

/* КОМНАТА ПРОСМОТРА */
.room-page::before { opacity: .2; }
.room-page { --display: 'Golos Text', sans-serif; }
.room-topbar {
  padding: 20px 32px;
  background: #0c1016d9;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.room-title { font-weight: 500; letter-spacing: -.025em; }
.room-code { font-size: 13px; color: #abb5c4; }
.room-code #codeLabel { color: #e4e9f2; font-family: monospace; letter-spacing: .12em; }
.room-topbar .ghost-btn { min-height: 40px; border-radius: 10px; padding: 8px 12px; }
.room-topbar .ghost-btn:hover { background: #ffffff0a; }
#cinemaBtn { border: 1px solid #d5dfef30; }
#cinemaBtn[aria-pressed='true'] { color: #11141a; background: #e4e9f2; }
.room-topbar #copyBtn { height: auto !important; min-height: 32px; font-size: 12px !important; }
.connection-status { max-width: 1800px; margin: auto; color: #aab5c5; font-size: 13px; padding-block: 18px; }
.room-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; }
.player-wrap { border: 1px solid #c4cede30; border-radius: 18px; box-shadow: 0 25px 70px #0006; }
.notice { color: #b0bac9; line-height: 1.7; }
.bar { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #10141bd9; }
.bar .field { font-size: 14px; }
.bar .btn { font-size: 14px; padding-inline: 18px; }
.side {
  background: linear-gradient(155deg, #1b2230e6, #0d1118f5);
  border: 1px solid #c4cede30;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 32px #0003;
}
.side-header h3 { font-size: 19px; font-weight: 500; letter-spacing: -.03em; }
.users-label { font-size: 13px; color: #a9b5c8; line-height: 1.7; }
.message { background: #262e3c; color: #edf0f5; line-height: 1.65; }
.message b { color: #c4cfdf; font-size: 12px; }
.message.system { color: #9eabc0; font-size: 12px; }
.messages:empty::before { content: 'Здесь можно обсудить всё, что на экране.'; display: block; margin-top: 30px; text-align: center; color: #a2afc2; font-size: 14px; line-height: 1.8; }
.chat-form .field { font-size: 14px; }
.send-btn { display: grid; place-items: center; background: linear-gradient(135deg, #fff, #bec8d7); }
.cinema::before { opacity: 0; }
.cinema .room-layout { grid-template-columns: 1fr; max-width: 1500px; }
.cinema .player-wrap { margin: auto; }
.cinema .room-topbar { background: #08090b; }

/* АДАПТАЦИЯ */
@media (max-width: 1100px) {
  .room-layout { grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; }
  .side { padding: 16px; }
}
@media (max-width: 760px) {
  body::before, .home-sky::before, .home-sky::after { background-position: 46% top; }
  body::before, .home-sky { opacity: .45; }
  .catalog-header { padding-top: 112px; padding-bottom: 30px; }
  .catalog-header h1 { font-size: 36px; }
  .catalog-header p { font-size: 15px; }
  .movie-grid { gap: 16px 12px; }
  .movie-card { border-radius: 12px; }
  .movie-info { padding: 13px 11px; min-height: 90px; }
  .movie-title { font-size: 14px; }
  .fav-btn { width: 36px; height: 36px; top: 8px; right: 8px; }
  .account-dialog { padding: 24px; border-radius: 20px; }
  .modal-header h2 { font-size: 24px; }
  .room-topbar { padding: 14px 16px; }
  .room-layout { grid-template-columns: 1fr; gap: 18px; }
  .connection-status { padding-inline: 16px; }
  .room-title-wrap { padding-top: 8px; }
  .bar { flex-wrap: wrap; }
  .bar .field { flex-basis: 100%; }
  .bar .btn { width: 100%; }
  .side { height: 430px; }
  .player-wrap { border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .movie-card, .movie-poster { transition: none; }
  .movie-card:hover { transform: none; }
}
