:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-hover: #252933;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --player-height: 120px;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: var(--player-height);
}

.header {
  background: var(--surface);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}
.header h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.controls input, .controls select {
  flex: 1;
  min-width: 120px;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid #334155;
  color: var(--text);
  border-radius: 8px;
}
.controls button {
  padding: 0.5rem 1rem;
  background: var(--accent);
  border: none;
  color: white;
  border-radius: 8px;
  cursor: pointer;
}
.controls button:hover { background: var(--accent-hover); }

.container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.badge-ok { background: var(--success); color: #000; }
.badge-warn { background: var(--warning); color: #000; }
.badge-dead { background: var(--danger); color: #fff; }

.loading { text-align: center; padding: 2rem; color: var(--text-muted); }
.btn {
  display: block;
  margin: 1.5rem auto;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
}
.hidden { display: none; }

.player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--player-height);
  background: var(--surface);
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 20;
}
.player-info { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.player-controls { display: flex; align-items: center; gap: 0.75rem; }
#play-pause-btn { font-size: 1.5rem; background: none; border: none; cursor: pointer; }
#volume { width: 80px; accent-color: var(--accent); }

.status-idle::after { content: "⏹"; }
.status-loading::after { content: "⏳"; }
.status-playing::after { content: "▶️"; }
.status-error::after { content: "❌"; }

@media (max-width: 768px) {
  .header { padding: 0.75rem; }
  .controls { gap: 0.4rem; }
  .player { padding: 0 0.75rem; }
  #volume { width: 60px; }
}

.station-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-hover);
}

.card .meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* === УЛУЧШЕННЫЙ ПЛЕЕР === */
.player {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 20px rgba(59, 130, 246, 0.3);
}

.status-playing {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* === КНОПКА ИЗБРАННОГО === */
.card button {
  transition: transform 0.2s;
}

.card button:hover {
  transform: scale(1.2);
}

/* === АДАПТИВ ДЛЯ ИКОНОК === */
@media (max-width: 768px) {
  .station-icon {
    width: 24px;
    height: 24px;
  }
}

.card > * {
  position: relative;
  z-index: 1;
}

.card h3 {
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* === КРУГЛЫЕ ИКОНКИ === */
.station-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* === АУДИО-ВИЗУАЛАЙЗЕР === */
.visualizer-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  min-width: 0;
}

/* === УМНЫЙ ПЛЕЕР (всегда внизу) === */
.player {
  position: fixed;        /* ← Фиксируем относительно окна */
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--player-height);
  z-index: 1000;          /* ← Поверх всего! */
  background: var(--surface);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5); /* Тень вверх */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  transition: transform 0.3s ease; /* Плавное скрытие/показ */
}

/* Скрываем плеер при прокрутке вниз (добавляется через JS) */
.player.hidden {
  transform: translateY(100%); /* Уезжает вниз за экран */
}

/* Компенсация высоты плеера, чтобы контент не перекрывался */
body {
  padding-bottom: var(--player-height);
}

/* На мобильных: чуть меньше отступы */
@media (max-width: 768px) {
  .player {
    padding: 0 0.75rem;
  }
}

#visualizer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* Самый нижний слой */
  opacity: 0.3; /* Немного прозрачности, чтобы текст читался */
  pointer-events: none; /* Чтобы клики проходили сквозь канвас */
}

.player-content {
  position: relative;
  z-index: 10; /* Поверх канваса */
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
}

/* Тень для текста, чтобы было видно на любом фоне */
.player-info span {
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Текст должен быть ПОВЕРХ канваса */
.card > * {
  position: relative;
  z-index: 1;
}

/* 1. БАЗОВЫЙ БЛОК (Состояние покоя) */
.card {
  position: relative;
  overflow: hidden; /* Чтобы зум не вылезал за края */
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  
  /* Настройки фона */
  background: var(--surface);
  background-size: 100%; /* Исходный размер (или cover) */
  background-position: center;
  background-repeat: no-repeat;
  
  padding: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  
  /*  КЛЮЧЕВОЙ МОМЕНТ: Время анимации */
  transition: transform 0.8s cubic-bezier(0.25, 0.45, 0.45, 0.95),
              background-size 2.8s cubic-bezier(0.25, 0.45, 0.45, 0.95), /* <-- Анимация зума фона */
              box-shadow 0.8s ease;
              
  isolation: isolate;
}

/* Затемнение (оставь как было) */
.card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(26,29,36,0.3) 0%, rgba(15,17,21,0.8) 100%);
  z-index: 0;
  pointer-events: none;
}

/* 2. БЛОК НАВЕДЕНИЯ (Конечная цель) */
.card:hover {
  /* Карточка увеличивается */
  transform: translateY(-10px) scale(1.1); /* 1.2 может быть слишком много, попробуй 1.1 */
  
  /* 📷 Фон увеличивается до 150% (благодаря transition это займет 0.8 сек) */
  background-size: 150%; 
  
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(59, 130, 246, 0.3);
  z-index: 10;
  border-color: rgba(59, 130, 246, 0.5);
}

/* 🎵 АКТИВНАЯ (ИГРАЮЩАЯ) КАРТОЧКА */
.card.active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

/* Контент поверх фона и затемнения */
.card > * {
  position: relative;
  z-index: 2;
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.card .meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 🎨 Цветные полоски жанров */
.card[data-tags*="dance"] { border-left: 3px solid #8b5cf6; }
.card[data-tags*="rock"] { border-left: 3px solid #ef4444; }
.card[data-tags*="jazz"] { border-left: 3px solid #f59e0b; }
.card[data-tags*="news"] { border-left: 3px solid #3b82f6; }
.card[data-tags*="pop"] { border-left: 3px solid #ec4899; }
.card[data-tags*="chanson"] { border-left: 3px solid #10b981; }
.card[data-tags*="electronic"] { border-left: 3px solid #06b6d4; }

/* 📊 Мини-визуалайзер (под текстом, над фоном) */
.card-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  border-radius: var(--radius);
}
