* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --accent: #a78bfa;
  --accent2: #7c3aed;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 18px;
}

#app {
  display: -webkit-flex;
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  width: 520px;
  height: 100vh;
  background: var(--surface);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  border-right: 1px solid rgba(167,139,250,0.15);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

#sidebar-header {
  padding: 32px 28px 18px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

#logo {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

#logo span {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#search-input {
  width: 100%;
  padding: 13px 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  cursor: text;
}

#search-input:focus {
  border-color: var(--accent);
  background: rgba(167,139,250,0.1);
  box-shadow: 0 0 0 2px rgba(167,139,250,0.3);
}

#station-list-wrapper {
  -webkit-flex: 1;
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 14px;
}

#station-list-wrapper::-webkit-scrollbar { width: 4px; }
#station-list-wrapper::-webkit-scrollbar-track { background: transparent; }
#station-list-wrapper::-webkit-scrollbar-thumb {
  background: rgba(167,139,250,0.3);
  border-radius: 4px;
}

#station-list {
  list-style: none;
}

#station-list li {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 3px;
}

#station-list li.active {
  background: rgba(167,139,250,0.12);
  border-color: rgba(167,139,250,0.3);
}

#station-list li.focused {
  border-color: var(--accent);
  background: rgba(167,139,250,0.1);
}

.station-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 16px;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  color: white;
  font-weight: 700;
}

.station-icon.playing {
  -webkit-animation: pulse-icon 1.5s ease-in-out infinite;
  animation: pulse-icon 1.5s ease-in-out infinite;
}

@-webkit-keyframes pulse-icon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167,139,250,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(167,139,250,0); }
}
@keyframes pulse-icon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167,139,250,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(167,139,250,0); }
}

.station-meta {
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}

.station-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-badge {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(167,139,250,0.15);
  color: var(--accent);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

/* Loading */
#loading {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(167,139,250,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  -webkit-animation: spin 0.8s linear infinite;
  animation: spin 0.8s linear infinite;
}

@-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

#error-msg {
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
}

#retry-btn {
  padding: 10px 22px;
  background: var(--accent2);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

/* ── Player Panel ── */
#player-panel {
  -webkit-flex: 1;
  flex: 1;
  position: relative;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  overflow: hidden;
}

#player-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 60% 40%, rgba(124,58,237,0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(167,139,250,0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#sidebar {
  position: relative;
  z-index: 10;
}

#player-content {
  position: relative;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  gap: 28px;
  z-index: 1;
}

#station-art {
  position: relative;
  width: 200px;
  height: 200px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
}

#art-icon {
  width: 200px;
  height: 200px;
}

#art-icon.playing {
  -webkit-animation: rotate-art 8s linear infinite;
  animation: rotate-art 8s linear infinite;
}

@-webkit-keyframes rotate-art { from { -webkit-transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); } }
@keyframes rotate-art { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

#art-waves {
  position: absolute;
  bottom: -18px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-end;
  align-items: flex-end;
  gap: 5px;
  height: 36px;
}

#art-waves span {
  display: block;
  width: 5px;
  background: var(--accent);
  border-radius: 3px;
  -webkit-animation: wave 1s ease-in-out infinite;
  animation: wave 1s ease-in-out infinite;
}

#art-waves span:nth-child(1) { -webkit-animation-delay: 0s; animation-delay: 0s; height: 18px; }
#art-waves span:nth-child(2) { -webkit-animation-delay: 0.1s; animation-delay: 0.1s; height: 32px; }
#art-waves span:nth-child(3) { -webkit-animation-delay: 0.2s; animation-delay: 0.2s; height: 26px; }
#art-waves span:nth-child(4) { -webkit-animation-delay: 0.15s; animation-delay: 0.15s; height: 34px; }
#art-waves span:nth-child(5) { -webkit-animation-delay: 0.05s; animation-delay: 0.05s; height: 20px; }

@-webkit-keyframes wave {
  0%, 100% { -webkit-transform: scaleY(0.4); opacity: 0.6; }
  50% { -webkit-transform: scaleY(1); opacity: 1; }
}
@keyframes wave {
  0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 1; }
}

#station-info { text-align: center; }

#station-name {
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  max-width: 680px;
  line-height: 1.2;
}

#station-genre {
  font-size: 17px;
  color: var(--accent);
  margin-top: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#controls {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 22px;
}

.ctrl-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  outline: none;
}

.ctrl-btn svg { width: 26px; height: 26px; }

.ctrl-btn.play {
  width: 84px;
  height: 84px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border: none;
  box-shadow: 0 8px 28px rgba(124,58,237,0.4);
}

.ctrl-btn.play svg { width: 34px; height: 34px; }

.ctrl-btn:focus {
  border-color: var(--accent);
  background: rgba(167,139,250,0.2);
}

.ctrl-btn.play:focus {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

#volume-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 220px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

#volume-label {
  font-size: 15px;
  color: var(--text-muted);
  min-width: 30px;
}

#status-bar {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--text-muted);
}

#status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

#status-dot.playing {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74,222,128,0.6);
  -webkit-animation: blink 2s ease-in-out infinite;
  animation: blink 2s ease-in-out infinite;
}

#status-dot.loading {
  background: #fbbf24;
  -webkit-animation: blink 0.8s ease-in-out infinite;
  animation: blink 0.8s ease-in-out infinite;
}

#status-dot.error { background: #f87171; }

@-webkit-keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
