*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary: #667eea;
  --color-secondary: #764ba2;
  --color-bg: #1a1a2e;
  --color-surface: rgba(10, 10, 20, 0.15);
  --color-text: #f0f0f0;
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Background ── */
.app {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: calc(30px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  z-index: 1;
}

.app__logo {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
  flex-shrink: 0;
}

.app__bg {
  position: fixed;
  inset: 0;
  background: url('background.webp') center/cover no-repeat;
  z-index: 0;
}

.app__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

/* ── Install Banner ── */
.install-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.4s ease-out;
}

.install-banner.visible {
  display: flex;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.install-banner__content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.install-banner__icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.install-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.install-banner__text strong {
  font-size: 15px;
}

.install-banner__text span {
  font-size: 13px;
  opacity: 0.85;
}

.install-banner__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.install-banner__btn {
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.install-banner__btn:active {
  opacity: 0.7;
}

.install-banner__btn--install {
  background: #fff;
  color: var(--color-primary);
}

.install-banner__btn--dismiss {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ── iOS Hint ── */
.ios-hint {
  display: none;
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  z-index: 1000;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease-out;
}

.ios-hint.visible {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ios-hint p {
  flex: 1;
}

.ios-hint__close {
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Player Card ── */
.player {
  width: 100%;
  max-width: 340px;
  background: var(--color-surface);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 20px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1;
}

/* ── Album Art ── */
.player__art-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.player__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.player__art.loaded {
  display: block;
}

.player__art-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
}

.player__art-placeholder svg {
  width: 45px;
  height: 45px;
}

.player__art.loaded + .player__art-placeholder {
  display: none;
}

.player__art-wrap.playing .player__art {
  animation: artPulse 3s ease-in-out infinite;
}

@keyframes artPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* ── Track Info ── */
.player__info {
  text-align: center;
  width: 100%;
  overflow: hidden;
}

.player__station {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.player__title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.player__artist {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Progress Bar ── */
.player__progress {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.player__progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 2px;
  transition: width 1s linear;
}

/* ── Controls ── */
.player__controls {
  display: flex;
  align-items: center;
  justify-content: center;
}

.player__btn {
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.player__btn:active {
  transform: scale(0.9);
}

.player__btn--main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.player__icon {
  width: 22px;
  height: 22px;
}

.player__icon--hidden {
  display: none;
}

.player__icon--spin {
  animation: spin 0.8s linear infinite;
}

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

/* ── Volume ── */
.player__volume {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.player__volume-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.player__volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
}

.player__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(102, 126, 234, 0.5);
}

.player__volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px rgba(102, 126, 234, 0.5);
}

/* ── Next Track ── */
.player__next {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── EQ Toggle ── */
.player__eq-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.player__eq-toggle:active {
  opacity: 0.6;
}

.player__eq-toggle.active {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.player__next-label {
  opacity: 0.7;
  margin-right: 4px;
}

/* ── Equalizer ── */
.equalizer {
  position: fixed;
  top: 50%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 3px;
  padding: 0 4px;
  z-index: 0;
  pointer-events: none;
  transform: translateY(-50%);
}

.equalizer__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  max-width: none;
}

.equalizer__half {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.equalizer__half--up {
  flex-direction: column-reverse;
}

.equalizer__led {
  width: 100%;
  height: 6px;
  border-radius: 1px;
}

.equalizer.hidden {
  display: none;
}

/* ── Responsive ── */
@media (min-width: 600px) {
  .player__art-wrap {
    width: 200px;
    height: 200px;
  }

  .player {
    padding: 24px 24px 18px;
    gap: 16px;
    max-width: 380px;
  }

  .player__title {
    font-size: 24px;
  }
}

@media (min-width: 900px) {
  .player {
    max-width: 480px;
  }
}

/* ── Transitions ── */
.player__info {
  transition: opacity 0.3s ease;
}

.player__info.updating {
  opacity: 0.5;
}
