*, *::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;
}

/* ── Landing ── */
.landing {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.landing--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

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

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

.landing__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px 100px;
  max-width: 400px;
  gap: 16px;
}

.landing__logo {
  width: 140px;
  height: auto;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.5));
  animation: landingLogoIn 0.8s ease-out;
}

@keyframes landingLogoIn {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.landing__brand {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing__desc {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.landing__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 8px;
}

.landing__btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.landing__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.landing__btn:active {
  transform: scale(0.96);
}

.landing__pwa-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 4px;
}

.landing__about {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
}

.landing__site-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
  margin-top: 8px;
}

.landing__site-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.landing__site-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

/* ── Landing Footer ── */
.landing__footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  padding: 16px 20px calc(16px + var(--safe-bottom));
  text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
}

.landing__footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.landing__footer-links a {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s;
}

.landing__footer-links a:hover {
  color: rgba(255, 255, 255, 0.8);
}

.landing__footer-sep {
  color: rgba(255, 255, 255, 0.25);
  font-size: 12px;
}

.landing__copyright {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

/* ── App Hidden ── */
.app--hidden {
  display: none !important;
}

/* ── 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;
}

/* ── Social Links ── */
.social-links {
  display: flex;
  gap: 24px;
  margin-top: auto;
  padding-bottom: 4px;
  z-index: 2;
}

.social-links__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.social-links__item svg {
  width: 28px;
  height: 28px;
}

.social-links__item:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text);
  transform: translateY(-2px);
}

.social-links__item:active {
  transform: scale(0.9);
  opacity: 0.7;
}

/* Update Banner */
.update-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(102, 126, 234, 0.95);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease;
}
.update-banner button {
  background: #fff;
  color: #333;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
