/* ==========================================
   Переменные
   ========================================== */
:root {
  --bg:           #050505;
  --glass:        rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text:         #f0f0f0;
  --text-dim:     rgba(255, 255, 255, 0.35);
}

/* ==========================================
   Сброс и базовые стили
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Arial', sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   Canvas с каплями — фиксирован поверх всего
   ========================================== */
canvas#drops {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  pointer-events: none;
}

/* ==========================================
   Шапка
   ========================================== */
header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.5em;
  color: #fff;
  animation: pulse-icon 4s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

.logo-text {
  font-size: 1.2em;
  font-weight: bold;
  letter-spacing: 5px;
}

/* Бейдж ON AIR / OFF AIR */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass);
  transition: border-color 0.4s;
}

.status-badge.live {
  border-color: rgba(255, 255, 255, 0.4);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.4s;
}

.status-badge.live .status-dot {
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.status-label {
  font-size: 0.7em;
  letter-spacing: 3px;
  color: var(--text-dim);
  transition: color 0.4s;
}

.status-badge.live .status-label { color: #fff; }

/* ==========================================
   Основной контент
   ========================================== */
main {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 64px;
  padding: 20px 48px;
  overflow: hidden;
}

/* ==========================================
   Панель станций (слева)
   ========================================== */
.stations {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 270px;
}

.panel-title {
  font-size: 0.65em;
  letter-spacing: 5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  padding-left: 2px;
}

.station-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.station-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(4px);
}

.station-card.active {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.05);
}

.station-cover {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.station-info { flex: 1; min-width: 0; }

.station-name {
  font-size: 0.92em;
  font-weight: bold;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-desc {
  font-size: 0.73em;
  color: var(--text-dim);
}

/* Анимированный мини-эквалайзер */
.station-eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  opacity: 0;
  transition: opacity 0.3s;
  flex-shrink: 0;
}

.station-card.active .station-eq { opacity: 1; }

.station-eq span {
  display: block;
  width: 3px;
  height: 4px;
  background: #fff;
  border-radius: 2px;
}

.station-eq span:nth-child(1) { animation: eq 0.8s  ease-in-out infinite; }
.station-eq span:nth-child(2) { animation: eq 1.1s  ease-in-out infinite 0.15s; }
.station-eq span:nth-child(3) { animation: eq 0.9s  ease-in-out infinite 0.3s; }
.station-eq span:nth-child(4) { animation: eq 1.25s ease-in-out infinite 0.1s; }

@keyframes eq {
  0%, 100% { height: 4px; }
  50%       { height: 20px; }
}

/* ==========================================
   Центральный плеер
   ========================================== */
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* ==========================================
   Обёртка: CD кейс + визуализатор
   ========================================== */
.cd-case-wrap {
  position: relative;
  width: 390px;
  height: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* transform применяется из JS на каждый кадр — GPU-слой */
  will-change: transform;
  transform-origin: center center;
}

.track-info {
  will-change: transform;
  transform-origin: center center;
}

/* Фоновая волна — полноэкранный canvas за всем UI */
canvas#visualizer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ==========================================
   CD Jewel Case
   ========================================== */
.cd-case {
  position: relative;
  z-index: 2;
  width: 285px;
  height: 285px;
  border-radius: 10px;

  /* Прозрачный пластик */
  background: rgba(255, 255, 255, 0.025);
  border: 2px solid rgba(255, 255, 255, 0.22);

  /* Тени: внешняя тень + внутренние блики рёбер */
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.96),
    0 8px 24px  rgba(0, 0, 0, 0.7),
    inset 0  2px 0  rgba(255, 255, 255, 0.38), /* верхнее ребро */
    inset 0 -2px 0  rgba(0, 0, 0, 0.45),        /* нижнее ребро */
    inset  2px 0 0  rgba(255, 255, 255, 0.2),   /* левое ребро  */
    inset -2px 0 0  rgba(0, 0, 0, 0.2);          /* правое ребро */

  /* overflow: visible — чтобы spine не обрезался */
  overflow: visible;
}

/* Пластиковая защёлка / петля слева */
.case-spine {
  position: absolute;
  left: -17px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 88px;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-right: none;
  border-radius: 5px 0 0 5px;
  background: linear-gradient(
    to right,
    rgba(255,255,255,0.03),
    rgba(255,255,255,0.16),
    rgba(255,255,255,0.06)
  );
}

/* Внутренняя часть кейса — клипает диск */
.case-inner {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Диск с обложкой станции */
.cd-disc {
  width: 228px;
  height: 228px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: #111;
  animation: spin 9s linear infinite;
  animation-play-state: paused;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.07),
    inset 0 0 40px rgba(0, 0, 0, 0.55);
  transition: box-shadow 0.3s;
}

.cd-disc:hover {
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.2),
    inset 0 0 40px rgba(0, 0, 0, 0.55);
}

/* Центральное отверстие диска */
.disc-hole {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(5, 5, 5, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  z-index: 2;
  pointer-events: none;
}

/* Световой блик на поверхности пластика.
   height: 100% + gradient до transparent на 55% —
   нижний край div-а никогда не виден как линия. */
.case-glare {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    155deg,
    rgba(255,255,255,0.06) 0%,
    rgba(255,255,255,0.01) 40%,
    transparent            55%
  );
  border-radius: 8px;
  pointer-events: none;
  z-index: 3;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ==========================================
   Информация о треке
   ========================================== */
.track-info {
  text-align: center;
  min-height: 3em;
  /* will-change и transform-origin заданы выше вместе с cd-case-wrap */
}

.track-name {
  font-size: 1.15em;
  font-weight: bold;
  margin-bottom: 5px;
  transition: opacity 0.25s;
}

.track-artist {
  font-size: 0.82em;
  color: var(--text-dim);
  letter-spacing: 1px;
  transition: opacity 0.25s;
}

/* ==========================================
   Контролы
   ========================================== */
.controls {
  display: flex;
  align-items: center;
  gap: 22px;
}

.btn-play {
  -webkit-appearance: none;
  appearance: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: #111;
  color: var(--text);
  font-size: 1.1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.btn-play:hover {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
  transform: scale(1.08);
}

.btn-play:focus,
.btn-play:focus-visible,
.btn-play:active {
  outline: none;
  background: var(--glass) !important;
  border-color: var(--glass-border) !important;
  color: var(--text) !important;
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
}

input[type="range"] {
  width: 130px;
  appearance: none;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ==========================================
   Подвал
   ========================================== */
footer {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 13px 32px;
  border-top: 1px solid var(--glass-border);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.82em;
  letter-spacing: 2px;
  transition: all 0.25s;
}

.social-link img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: 0.5;
  filter: grayscale(1) brightness(2);
  transition: all 0.25s;
}

.social-link:hover { color: #fff; }

.social-link:hover img {
  opacity: 0.9;
  filter: grayscale(1) brightness(3);
}

/* ==========================================
   Адаптив — планшет (≤ 900px)
   ========================================== */
@media (max-width: 900px) {
  main { gap: 32px; padding: 16px 24px; }

  .cd-case-wrap { width: 330px; height: 330px; }
  .cd-case      { width: 244px; height: 244px; }
  .cd-disc      { width: 192px; height: 192px; }

  .stations     { min-width: 220px; }
  .station-card { padding: 11px 12px; }
  .station-cover { width: 48px; height: 48px; }
}

/* ==========================================
   Адаптив — телефон (≤ 640px)
   ========================================== */
@media (max-width: 640px) {
  body { height: auto; min-height: 100svh; overflow-y: auto; }

  header { padding: 10px 16px; }
  .logo-text { font-size: 1em; letter-spacing: 3px; }
  .status-label { display: none; }

  main {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 16px;
  }

  .player   { order: 1; }
  .stations { order: 2; }

  .cd-case-wrap { width: 275px; height: 275px; }
  .cd-case      { width: 202px; height: 202px; border-radius: 7px; }
  .cd-disc      { width: 160px; height: 160px; }
  .disc-hole    { width: 16px;  height: 16px; }
  .case-spine   { left: -13px; width: 12px; height: 66px; }

  .stations {
    flex-direction: row;
    justify-content: center;
    width: 100%;
    min-width: unset;
    gap: 12px;
  }

  .panel-title { display: none; }

  .station-card {
    flex: 1;
    max-width: 175px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 12px 10px;
    transform: none !important;
  }

  @media (hover: none) {
    .station-card:hover { transform: none; }
  }

  .station-cover { width: 52px; height: 52px; }
  .station-name  { font-size: 0.82em; }
  .station-desc  { font-size: 0.68em; }
  .station-eq    { display: none; }

  .controls  { gap: 14px; }
  input[type="range"] { width: 108px; }
  input[type="range"]::-webkit-slider-thumb { width: 18px; height: 18px; }

  footer { gap: 28px; padding: 10px 16px; }
  .social-link span { display: none; }
  .social-link img  { width: 30px; height: 30px; }
}
