:root {
  --bg: #0a0a0c;
  --bg-card: rgba(20, 20, 24, 0.75);
  --bg-card-solid: #141418;
  --bg-elevated: rgba(28, 28, 34, 0.9);
  --text: #f5f5f7;
  --text-muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  /* station color overrides when set on .player-scene */
  --station-color: #c1272d;
  --station-color-rgb: 193, 39, 45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--station-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Full-bleed blurred cover + station-colored overlay */
.player-scene {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-height: 520px;
  border-radius: var(--radius);
  isolation: isolate;
  z-index: 1;
}

/* Full-viewport blurred background (behind everything) */
.bg-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.bg-cover {
  position: absolute;
  inset: -15%;
  width: 130%;
  height: 130%;
  object-fit: cover;
  filter: blur(40px) saturate(1.2) brightness(0.45);
  transform: scale(1.05);
  transition: opacity 0.6s ease;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    165deg,
    transparent 0%,
    rgba(var(--station-color-rgb), 0.12) 25%,
    rgba(0, 0, 0, 0.7) 60%,
    rgba(0, 0, 0, 0.92) 100%
  );
  pointer-events: none;
}

/* Glass card on top */
.player-container {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.station-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.station-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.station-info h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.station-info .tagline {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Now playing: cover + track */
.now-playing-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 20px;
  min-height: 88px;
}

.cover-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.cover-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-wrap--loading {
  background: linear-gradient(90deg, var(--border) 25%, rgba(255,255,255,0.06) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}

@keyframes skeleton {
  to { background-position: 200% 0; }
}

.track-info {
  flex: 1;
  min-width: 0;
}

.now-playing-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--station-color);
  margin-bottom: 4px;
  font-weight: 600;
}

.track-artist {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Controls: volume (mute + slider) left, play center */
.controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.volume-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.volume-controls .volume-slider {
  flex: 1;
  min-width: 80px;
}

.volume-controls .btn-mute {
  flex-shrink: 0;
}

.controls-row .btn-play {
  flex-shrink: 0;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.1s, border-color 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--station-color);
  border-color: rgba(var(--station-color-rgb), 0.4);
}

.btn-icon:active {
  transform: scale(0.95);
}

.btn-icon svg {
  width: 22px;
  height: 22px;
}

.btn-play {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--station-color);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s, box-shadow 0.25s;
  box-shadow: 0 4px 20px rgba(var(--station-color-rgb), 0.45);
}

.btn-play:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 28px rgba(var(--station-color-rgb), 0.5);
}

.btn-play:active {
  transform: scale(0.96);
}

.btn-play svg {
  width: 26px;
  height: 26px;
}

.btn-play.paused .icon-pause {
  display: none;
}

.btn-play.playing .icon-play {
  display: none;
}

/* Volume (inside .volume-controls) */
.volume-controls .volume-slider {
  margin: 0;
}

.volume-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--station-color);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 0 12px rgba(var(--station-color-rgb), 0.4);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--station-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 12px rgba(var(--station-color-rgb), 0.4);
}

/* Stream error + retry */
.stream-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: rgba(200, 60, 60, 0.15);
  border: 1px solid rgba(200, 60, 60, 0.4);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #f88;
}

.btn-retry {
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-retry:hover {
  background: rgba(255,255,255,0.15);
}

/* Mute button (same size as vol) */
.btn-mute .icon-muted,
.btn-mute .icon-unmuted {
  width: 22px;
  height: 22px;
}

/* Extra: sleep */
.extra-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sleep-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.sleep-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sleep-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sleep-input {
  width: 3.5em;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 0.8rem;
  text-align: center;
}

.sleep-input::placeholder {
  color: var(--text-muted);
}

.btn-sleep {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-sleep:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
}

.sleep-display {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Listening with (Discord) */
.listening-with {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
}

.listening-with-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.participants {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.participant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.participant-name {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-invite {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--station-color);
  border-radius: var(--radius-sm);
  background: rgba(var(--station-color-rgb), 0.15);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-invite:hover {
  background: rgba(var(--station-color-rgb), 0.25);
}

/* Station grid */
.station-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.station-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-align: left;
  backdrop-filter: blur(8px);
}

.station-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.station-btn.active {
  border-color: var(--station-color);
  background: rgba(var(--station-color-rgb), 0.18);
  box-shadow: 0 0 0 1px rgba(var(--station-color-rgb), 0.25);
}

.station-btn img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: cover;
}

.footer {
  margin-top: 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.footer a {
  color: var(--station-color);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.error-msg {
  color: #e55;
  font-size: 0.9rem;
  text-align: center;
  padding: 12px;
}

/* Reduced motion */
.reduce-motion .cover-wrap--loading,
.reduce-motion .loading-spinner {
  animation: none;
}

.reduce-motion .bg-cover {
  transition: none;
}

.reduce-motion .btn-play:hover,
.reduce-motion .volume-slider::-webkit-slider-thumb:hover {
  transform: none;
}

/* Compact layout (Discord small panel) */
.layout-compact .player-container {
  padding: 16px;
}

.layout-compact .station-header {
  margin-bottom: 12px;
}

.layout-compact .now-playing-card {
  padding: 10px;
  min-height: 64px;
}

.layout-compact .cover-wrap {
  width: 52px;
  height: 52px;
}

.layout-compact .extra-controls,
.layout-compact .listening-with {
  margin-bottom: 8px;
}
