/*
  Шрифты. У Lilita One и Archivo Black на Google Fonts нет кириллицы,
  поэтому русские буквы берутся из Rubik. Если у вас есть кириллические
  версии шрифтов — подключите их в fonts.css (см. README) и они
  автоматически встанут первыми.
*/
@import url("/css/fonts.css");

:root {
  --bg: #161616;
  --paper: #efeadf;
  --ink: #151515;
  --line: rgba(239, 234, 223, 0.6);
  --muted: rgba(239, 234, 223, 0.55);
  --live: #ff3b30;

  --font-display: "Mir Display", "Lilita One", "Rubik", system-ui, sans-serif;
  --font-text: "Mir Text", "Archivo Black", "Rubik", system-ui, sans-serif;

  --gutter: clamp(16px, 6.2vw, 76px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-text);
  font-weight: 700;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- шапка ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 clamp(12px, 2.1vw, 26px) 0 var(--gutter);
  background: var(--paper);
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  flex-shrink: 0;
}

.brand-logo {
  height: 44px;
  width: auto;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-text b {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.01em;
}

.brand-text span {
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 19px;
  margin-top: 2px;
}

.topbar-line {
  flex: 1;
  height: 1px;
  background: var(--ink);
  margin-bottom: 4px;
  align-self: center;
}

.topbar-nav a {
  font-weight: 500;
  font-size: 20px;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.topbar-nav a:hover { border-bottom-color: var(--ink); }

.station {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: clamp(16px, 7vw, 90px);
  line-height: 1.05;
}
.station b {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
}
.station span {
  font-weight: 500;
  font-size: 12px;
}

.globe {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
}

/* ---------- сцена ---------- */

.stage {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 640px) minmax(210px, 245px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "live cover side"
    "chat cover side"
    "mark cover side";
  column-gap: 27px;
  padding: 24px var(--gutter) 0;
}

/* левая колонка — не отдельный блок: её части (кнопка, чат, знак) раскладывает сетка */
.side-left { display: contents; }
.live-control {
  grid-area: live;
  align-self: start;
  justify-self: start;
  padding-top: 20px;
}
.cover { grid-area: cover; }
.side-right { grid-area: side; }

.live-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px 6px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.live-btn:hover { background: #fff; }
.live-btn:active { transform: translateY(1px); }
.live-btn:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.live-btn svg { width: 12px; height: 14px; fill: currentColor; }
.live-btn .ico-pause { display: none; }
.live-btn[aria-pressed="true"] .ico-play { display: none; }
.live-btn[aria-pressed="true"] .ico-pause { display: block; }
.live-btn.is-loading span::after {
  content: "…";
}
.live-btn.is-waiting { animation: ring 1.6s ease-out infinite; }

.autoplay-hint {
  max-width: 190px;
  margin: 10px 0 0;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.mir-mark {
  grid-area: mark;
  align-self: end;
  display: flex;
  flex-direction: column;
  width: 64px;
  height: 66px;
  padding: 5px 6px;
  border: 2px solid var(--paper);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  line-height: 0.95;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

/* ---------- обложка ---------- */

.cover {
  position: relative;
  aspect-ratio: 638 / 548;
  overflow: hidden;
  background: #2a2723;
  border: 1px solid rgba(239, 234, 223, 0.25);
  container-type: size; /* размеры 3D-сцены считаются от обложки */
}

.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: fade 0.6s ease;
}

.cover-empty {
  position: absolute;
  inset: 0;
  /* сама 3D-сцена с кассетой — в deck.css */
}

.cover-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.38), transparent 38%),
    linear-gradient(to top, rgba(0, 0, 0, 0.35), transparent 30%);
  pointer-events: none;
}

.cover-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 26px 0 30px;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.cover-now { min-width: 0; }

.cover-now small {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 14px;
  margin-bottom: 18px;
}

.cover-now h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.cover-now p {
  margin: 4px 0 0;
  font-weight: 500;
  font-size: clamp(17px, 1.9vw, 22px);
  text-transform: uppercase;
  opacity: 0.9;
  overflow-wrap: anywhere;
}

.cover-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.15;
  flex-shrink: 0;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}
.live.is-on i { background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
.live.is-off { opacity: 0.55; }


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

.chat {
  grid-area: chat;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  contain: size; /* высоту задаёт сетка (по обложке), а не количество сообщений */
  margin: 22px 0 18px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.chat h2 {
  margin: 0 0 8px;
  font-weight: 500;
  font-size: 16px;
}

.chat-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 6px 0 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(239, 234, 223, 0.25) transparent;
}
.chat-list li {
  padding: 4px 0;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(239, 234, 223, 0.82);
  overflow-wrap: anywhere;
}
.chat-list b {
  margin-right: 5px;
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--paper);
}
.chat-list li.is-own b { color: var(--live); }
.chat-list time {
  margin-right: 5px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chat-list .chat-empty { color: var(--muted); }

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.chat-row {
  display: flex;
  gap: 6px;
}
.chat-input {
  width: 100%;
  min-width: 0;
  padding: 8px 9px 7px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: 500 13px var(--font-text);
}
.chat-input::placeholder { color: rgba(239, 234, 223, 0.35); }
.chat-input:focus {
  outline: none;
  border-color: var(--paper);
}
.chat-send {
  flex-shrink: 0;
  width: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.chat-send:hover { background: #fff; }
.chat-send:disabled { opacity: 0.5; cursor: default; }
.chat-send:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.chat-send svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: var(--paper);
  stroke-width: 1.2;
}
.chat-closed {
  margin: 10px 0 0;
  padding: 9px 10px 8px;
  border: 1px dashed var(--line);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.chat-error {
  margin: 0;
  font-weight: 500;
  font-size: 12px;
  color: #ff8a80;
}

/* ---------- правая колонка ---------- */

.side-right {
  display: flex;
  flex-direction: column;
  padding-top: 20px;
  min-width: 0;
}

.panel {
  border-top: 1px solid var(--line);
  padding: 8px 2px 18px;
  min-width: 0;
}
.panel:last-child { border-bottom: 1px solid var(--line); }
.panel:first-child { min-height: 164px; }
.panel + .panel { margin-top: 0; }

.panel h2,
.panel label {
  display: block;
  margin: 0 0 12px;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.panel-sub {
  margin: 2px 0 14px;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.progress {
  height: 2px;
  background: rgba(239, 234, 223, 0.2);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--paper);
  transition: width 0.5s linear;
}

.times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.panel-volume { padding-bottom: 22px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  background: var(--paper);
  border: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--paper);
  border: 0;
  border-radius: 0;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: q;
}
.queue li {
  counter-increment: q;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 2px 6px;
  padding: 6px 0;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.25;
}
.queue li + li { border-top: 1px dashed rgba(239, 234, 223, 0.18); }
.queue li::before {
  content: counter(q, decimal-leading-zero);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.queue li b {
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.queue li span {
  grid-column: 2;
  color: var(--muted);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.queue .empty { color: var(--muted); }
.queue .empty::before { content: none; }

/* ---------- подвал ---------- */

.bottom {
  width: 100%;
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 var(--gutter) 28px;
}
.bottom span {
  display: block;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- анимации ---------- */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(239, 234, 223, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(239, 234, 223, 0); }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- адаптив ---------- */

/* слева мало места — чат переезжает под плеер */
@media (max-width: 1100px) {
  .stage {
    grid-template-columns: minmax(130px, 1fr) minmax(0, 640px) minmax(210px, 245px);
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "live cover side"
      ".    cover side"
      "mark cover side"
      ".    chat  chat";
  }
  .chat {
    contain: none;
    height: 360px;
    margin: 24px 0 0;
  }
}

@media (max-width: 1000px) {
  .station { margin-left: 8px; }
  .topbar-line { display: none; }
  .topbar-nav { margin-left: auto; }
  .stage {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
    grid-template-rows: none;
    grid-template-areas:
      "live  mark"
      "cover side"
      "chat  chat";
    row-gap: 20px;
  }
  .live-control { padding-top: 0; align-self: center; }
  .mir-mark {
    justify-self: end;
    align-self: center;
    width: 50px;
    height: 52px;
    font-size: 20px;
    margin: 0;
  }
  .chat { margin: 0; }
  .side-right { padding-top: 0; }
}

@media (max-width: 700px) {
  .topbar { gap: 10px; }
  .brand-logo { height: 38px; }
  .brand-text b { font-size: 15px; }
  .brand-text span { font-size: 13px; }
  .topbar-nav a { font-size: 15px; }
  .station { display: none; }
  .globe { width: 26px; height: 26px; }

  .stage {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "live  mark"
      "cover cover"
      "side  side"
      "chat  chat";
  }
  .cover { aspect-ratio: 1 / 1; }
  .cover-top { padding: 18px 18px 0; }
  .cover-now small { margin-bottom: 10px; font-size: 12px; }
  .panel:first-child { min-height: 0; }
}

@media (max-width: 420px) {
  .brand-text { display: none; }
}
