/* ==========================================================================
   memodel — screen.css (стена зала, 1920×1080, тёмная тема)
   Сцена фиксированного размера масштабируется целиком через --scale (screen.js).
   ========================================================================== */

html,
body {
  height: 100%;
  overflow: hidden;
}

body.screen {
  background: var(--color-night);
  color: var(--color-night-ink);
  cursor: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

/* Фоновая «звёздная» плашка */
body.screen::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 12% 0%, rgb(114 0 163 / 0.35), transparent 70%),
    radial-gradient(45% 45% at 100% 100%, rgb(206 79 231 / 0.18), transparent 70%);
}

/* --------------------------------------------------------------------------
   Сцена
   -------------------------------------------------------------------------- */
.stage {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 480px;
  grid-template-rows: minmax(0, 1fr) 72px;
  grid-template-areas:
    'wall panel'
    'ticker ticker';
  gap: 16px 32px;
  width: 1920px;
  height: 1080px;
  padding: 40px 48px 0;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  transform-origin: center center;
}

.stage__wall {
  grid-area: wall;
  display: grid;
  min-width: 0;
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Стена
   -------------------------------------------------------------------------- */
.wall {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 24px;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

/* Малое число мемов — крупные превью по центру, а не одна карточка в углу */
.wall[data-count='1'],
.wall[data-count='2'],
.wall[data-count='3'],
.wall[data-count='4'] {
  transform: translateY(-2.5%);
}

.wall[data-count='1'] .wall__cell {
  width: 680px;
}

.wall[data-count='2'] .wall__cell {
  width: 560px;
}

.wall[data-count='3'] .wall__cell {
  width: 396px;
}

.wall[data-count='4'] .wall__cell {
  width: 444px;
}

.wall[data-count='5'] .wall__cell,
.wall[data-count='6'] .wall__cell {
  width: 421px;
}

.wall[data-count='7'] .wall__cell,
.wall[data-count='8'] .wall__cell {
  width: 308px;
}

.wall__cell {
  position: relative;
  width: 308px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 2px solid rgb(255 248 193 / 0.1);
  border-radius: 20px;
  background: var(--color-night-surface);
  box-shadow: 0 24px 48px rgb(0 0 0 / 0.35);
}

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

.wall__cell--new {
  animation: cell-in 500ms var(--ease) both;
}

@keyframes cell-in {
  from {
    opacity: 0;
    transform: translateY(-26px) scale(0.94);
  }
}

.wall__cell--leaving {
  animation: cell-out 300ms var(--ease) both;
}

@keyframes cell-out {
  to {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
}

.wall__caption {
  position: absolute;
  inset: auto 0 0;
  padding: 40px 16px 12px;
  background: linear-gradient(transparent, rgb(6 6 46 / 0.85));
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  color: var(--color-night-ink);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}

/* --------------------------------------------------------------------------
   Панель справа
   -------------------------------------------------------------------------- */
.panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
  padding: 36px 28px;
  border: 2px solid var(--color-night-border);
  border-radius: 32px;
  background: rgb(255 248 193 / 0.055);
  text-align: center;
}

.panel__kicker {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-night-muted);
}

.panel__kicker span {
  color: var(--color-accent);
}

.panel__title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: var(--weight-black);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--color-night-ink);
}

.panel__title span {
  color: var(--color-accent);
}

.panel__qr {
  padding: 20px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 16px 40px rgb(0 0 0 / 0.35);
}

.panel__qr-img {
  display: block;
  width: 320px;
  height: 320px;
  image-rendering: crisp-edges;
}

.panel__bot {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: var(--weight-bold);
  color: var(--color-highlight);
  overflow-wrap: anywhere;
}

.panel__domain {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  color: var(--color-night-ink);
  opacity: 0.85;
}

.panel__counter {
  margin-top: 4px;
  padding: 6px 22px;
  border: 2px solid var(--color-night-border);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: var(--weight-black);
  color: var(--color-night-ink);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Бегущая строка
   -------------------------------------------------------------------------- */
.ticker {
  grid-area: ticker;
  overflow: hidden;
  border-top: 2px solid var(--color-night-border);
  /* Мягкие края, чтобы обрезанные на старте буквы не выглядели поломкой */
  mask-image: linear-gradient(90deg, transparent 0, #000 72px, #000 calc(100% - 72px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 72px, #000 calc(100% - 72px), transparent 100%);
}

.ticker__track {
  display: flex;
  width: max-content;
  height: 100%;
  align-items: center;
  animation: ticker 48s linear infinite;
  will-change: transform;
}

.ticker__group {
  padding: 0 64px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-night-ink);
  opacity: 0.8;
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

/* --------------------------------------------------------------------------
   Пустое состояние / пауза / связь
   -------------------------------------------------------------------------- */
.empty {
  position: absolute;
  inset: 40px 48px 88px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 32px;
  background:
    radial-gradient(70% 70% at 50% 20%, rgb(114 0 163 / 0.35), transparent 75%),
    var(--color-night);
  text-align: center;
}

.empty__kicker {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.empty__spark {
  font-family: var(--font-display);
  font-size: 64px;
  line-height: 1;
  color: var(--color-accent);
}

.empty__title {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: var(--weight-black);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--color-night-ink);
}

.empty__cta {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-highlight);
}

.empty__qr {
  margin-top: 12px;
  padding: 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}

.empty__qr .panel__qr-img {
  width: 420px;
  height: 420px;
}

.empty__domain {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  color: var(--color-night-ink);
  opacity: 0.8;
}

.paused {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgb(6 6 46 / 0.94);
  text-align: center;
}

.paused__spark {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--color-accent);
  line-height: 1;
}

.paused__title {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: var(--weight-black);
  color: var(--color-night-ink);
}

.conn {
  position: absolute;
  top: 14px;
  left: 28px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--color-night-border);
  border-radius: 999px;
  background: rgb(6 6 46 / 0.7);
  font-family: var(--font-text);
  font-size: 14px;
  color: var(--color-night-muted);
}

.screen.is-kiosk .conn {
  display: none !important;
}

/* Kiosk: плашка «нет связи» на весь экран */
.offline {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgb(6 6 46 / 0.93);
  text-align: center;
}

.offline__spark {
  font-family: var(--font-display);
  font-size: 64px;
  line-height: 1;
  color: var(--color-accent);
}

.offline__title {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: var(--weight-black);
  letter-spacing: -0.02em;
  color: var(--color-night-ink);
}

.offline__text {
  font-family: var(--font-text);
  font-size: 24px;
  color: var(--color-night-muted);
}

.kiosk-hint {
  position: absolute;
  bottom: 96px;
  left: 50%;
  z-index: 9;
  min-height: 44px;
  padding: 10px 22px;
  border: 2px solid var(--color-night-border);
  border-radius: 999px;
  background: rgb(6 6 46 / 0.82);
  color: var(--color-night-ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--weight-bold);
  transform: translateX(-50%);
  cursor: pointer;
}

.kiosk-hint:hover {
  border-color: var(--color-night-ink);
}

.conn__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-highlight);
  animation: conn-pulse 1.2s ease-in-out infinite;
}

@keyframes conn-pulse {
  50% {
    opacity: 0.25;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ticker__track {
    animation: none;
  }

  .wall__cell--new,
  .wall__cell--leaving {
    animation: none;
  }

  .conn__dot {
    animation: none;
  }
}
