/* Радио — экран эфира. Тёмная кинематографичная тема, телефон — первое устройство. */

:root {
  --bg: #0a0a0c;
  --bg-soft: #121216;
  --ink: #f4f4f6;
  --ink-dim: rgba(244, 244, 246, 0.62);
  --ink-faint: rgba(244, 244, 246, 0.34);
  --accent: #f5b544;
  --accent-soft: rgba(245, 181, 68, 0.18);
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --radius: 20px;
  --shadow-btn: 0 18px 60px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.14) inset;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---------- заставка ---------- */

.cover {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 70% 10%, rgba(245, 181, 68, 0.16), transparent 60%),
    radial-gradient(90% 70% at 15% 90%, rgba(70, 108, 255, 0.16), transparent 65%),
    linear-gradient(160deg, #131319 0%, #0a0a0c 55%, #08080a 100%);
  overflow: hidden;
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  filter: saturate(1.05) brightness(0.72) blur(0.6px);
}

/* затемнение + шум, чтобы текст читался на любой картинке */
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 46% at 50% 46%, rgba(6, 6, 9, 0.42), transparent 72%),
    radial-gradient(58% 44% at 50% 44%, rgba(245, 181, 68, 0.10), transparent 70%),
    linear-gradient(180deg, rgba(8, 8, 10, 0.66) 0%, rgba(8, 8, 10, 0.46) 40%, rgba(8, 8, 10, 0.92) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
}

body.is-playing .cover img { animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to   { transform: scale(1.08) translate3d(-1.5%, -1%, 0); }
}

/* ---------- каркас ---------- */

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-t)) clamp(18px, 5vw, 48px) calc(18px + var(--safe-b));
  gap: 12px;
}

/* ---------- центр ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
  padding: 24px 0;
}

.title {
  margin: 0;
  font-weight: 200;
  font-size: clamp(38px, 12vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.55);
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.72) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 16px 0 0;
  max-width: 30ch;
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
}

/* кнопка play */
.play {
  position: relative;
  margin: clamp(28px, 7vh, 52px) 0 0;
  width: clamp(88px, 24vw, 112px);
  height: clamp(88px, 24vw, 112px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06) 55%),
    var(--glass);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1), box-shadow 0.3s, border-color 0.3s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.play:hover:not(:disabled) { transform: scale(1.045); border-color: rgba(245, 181, 68, 0.55); }
.play:active:not(:disabled) { transform: scale(0.97); }
.play:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.play:disabled { opacity: 0.45; cursor: progress; }

.play::before,
.play::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(245, 181, 68, 0.35);
  opacity: 0;
  pointer-events: none;
}
body.is-playing .play::before { animation: ring 3.4s ease-out infinite; }
body.is-playing .play::after  { animation: ring 3.4s ease-out 1.7s infinite; }

/* браузер не дал автозапуск — мягко подсказываем, что нужно касание */
body.needs-tap .play { animation: nudge 2.2s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: scale(1); box-shadow: var(--shadow-btn); }
  50%      { transform: scale(1.06); box-shadow: 0 18px 70px rgba(245, 181, 68, 0.35), 0 1px 0 rgba(255, 255, 255, 0.14) inset; }
}
@keyframes ring {
  from { opacity: 0.55; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.85); }
}

.play__icon {
  width: 40%;
  height: 40%;
  fill: currentColor;
  position: absolute;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.18s, transform 0.18s;
}
.play__icon--play { margin-left: 3px; }

.play.is-ready .play__icon--play { opacity: 1; transform: scale(1); }
.play.is-playing .play__icon--play { opacity: 0; transform: scale(0.8); }
.play.is-playing .play__icon--pause { opacity: 1; transform: scale(1); }
.play.is-busy .play__icon--wait { opacity: 1; transform: scale(1); }
.play.is-busy .play__icon--play,
.play.is-busy .play__icon--pause { opacity: 0; }
.play__icon--wait {
  stroke: currentColor;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* что играет */
.now {
  margin: 26px 0 0;
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 400;
  letter-spacing: 0.005em;
  max-width: 32ch;
  overflow-wrap: anywhere;
}

/* ---------- пульт ---------- */

.deck {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
  padding: 16px clamp(14px, 4vw, 22px);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
body.is-playing .deck,
body.is-ready .deck { opacity: 1; transform: none; pointer-events: auto; }

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.progress__time { flex: 0 0 auto; min-width: 4ch; text-align: center; }

/* слайдер перемотки */
.range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
.range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--fill, 0%), rgba(255, 255, 255, 0.16) var(--fill, 0%), rgba(255, 255, 255, 0.16) 100%);
}
.range::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
.range::-moz-range-progress { height: 3px; border-radius: 999px; background: var(--accent); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(245, 181, 68, 0.22);
  transition: transform 0.15s;
}
.range:active::-webkit-slider-thumb { transform: scale(1.25); }
.range::-moz-range-thumb {
  width: 12px; height: 12px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 4px rgba(245, 181, 68, 0.22);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 18px);
  margin-top: 6px;
}

.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  fill: currentColor;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ctl svg { width: 22px; height: 22px; fill: currentColor; }
.ctl svg .ic__wave,
.ctl svg path[fill="none"] { fill: none; }
.ctl:hover { background: var(--glass-strong); border-color: rgba(255, 255, 255, 0.2); }
.ctl:active { transform: scale(0.96); }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ctl--wide { padding: 0 16px; color: var(--ink-dim); }

/* кнопка «выключить звук»: глушит только звук, воспроизведение идёт дальше */
.ctl--icon { position: relative; min-width: 48px; padding: 0 10px; }
.ctl--icon .ic {
  position: absolute;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.ctl--icon .ic--mute { opacity: 0; transform: scale(0.82); }
.ctl--icon.is-muted { color: var(--accent); border-color: rgba(245, 181, 68, 0.45); background: rgba(245, 181, 68, 0.10); }
.ctl--icon.is-muted .ic--sound { opacity: 0; transform: scale(0.82); }
.ctl--icon.is-muted .ic--mute { opacity: 1; transform: scale(1); }

/* ---------- список ---------- */

.panel {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 15;
  width: min(680px, calc(100% - 20px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 12, 15, 0.94);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 -12px 50px rgba(0, 0, 0, 0.5);
  max-height: min(62dvh, 480px);
  overflow: auto;
  animation: rise 0.24s ease-out;
}
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.tracks { list-style: none; margin: 0; padding: 6px; }

.tracks li { margin: 0; }

.track {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.track:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.track.is-active { color: var(--ink); background: rgba(245, 181, 68, 0.10); }
.track__name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track__time { flex: 0 0 auto; font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.tracks__empty { padding: 22px 16px; text-align: center; font-size: 14px; color: var(--ink-faint); }

/* ---------- уведомления ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translate(-50%, 16px);
  z-index: 20;
  margin: 0;
  max-width: min(92vw, 460px);
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 20, 24, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

.veil {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: rgba(6, 6, 8, 0.6);
}

/* ---------- большие экраны ---------- */

/* На широком экране фото не растягиваем вслепую: исходник маленький (335×597),
   поэтому ставим его колонкой по центру, а поля по бокам добираем размытой копией. */
@media (min-width: 900px) {
  .cover::before {
    content: "";
    position: absolute;
    inset: -12%;
    background: url("img/cover.jpg") center 28% / cover no-repeat;
    filter: blur(52px) saturate(1.1) brightness(0.42);
    opacity: 0.8;
    z-index: 0;
  }

  .cover img {
    inset: 0 auto 0 50%;
    transform: translateX(-50%);
    height: 100%;
    width: auto;
    max-width: min(82vw, 820px);
    object-fit: contain;
    object-position: center top;
    filter: none;
    opacity: 1;
    animation: none !important;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  }

  body.is-playing .cover img { animation: none; }

  /* на широком экране подпись под заголовком лишняя — текст и так крупный */
  .lede { display: none; }
}

@media (min-width: 860px) and (min-height: 700px) {
  .stage {
    max-width: 640px;
    margin: 0 auto;
    padding-top: calc(28px + var(--safe-t));
  }
  .deck { padding: 18px 22px; }
}

/* узкий телефон, низкий экран */
@media (max-height: 720px) {
  .stage { gap: 8px; padding-top: calc(14px + var(--safe-t)); padding-bottom: calc(12px + var(--safe-b)); }
  .hero { padding: 6px 0; }
  .title { font-size: clamp(28px, 9vh, 46px); }
  .play { margin-top: 16px; width: 76px; height: 76px; }
  .now { margin-top: 14px; }
  .lede { display: none; }
  .deck { padding: 10px 14px; }
}

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