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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0d0e12;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #ffffff;
  user-select: none;
}

/* Hide default CAF media player controls so our custom UI renders cleanly */
cast-media-player {
  display: none !important;
}

#player-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#background-backdrop {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.25);
  transform: scale(1.1);
  z-index: 1;
  transition: background-image 0.8s ease-in-out;
}

/* Plexamp Brand Watermark (~1/9 area of cover art: 106px on desktop, 60px on small screens) */
#brand-watermark {
  position: absolute;
  z-index: 10;
  width: 106px;
  height: 106px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

#brand-watermark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-top-right {
  top: 36px;
  right: 36px;
}

.brand-bottom-right {
  bottom: 36px;
  right: 36px;
}

#content-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 1100px;
  padding: 24px;
}

#artwork-wrapper {
  flex-shrink: 0;
  width: 320px;
  height: 320px;
  margin-right: 48px; /* Universal spacing compatible with legacy Cast runtimes lacking flex gap */
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  background-color: #1a1c23;
  display: flex;
  align-items: center;
  justify-content: center;
}

#track-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#metadata-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

#track-title {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

#track-artist {
  font-size: 1.4rem;
  font-weight: 500;
  color: #e5a00d; /* Plex accent gold/amber */
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#track-album {
  font-size: 1.1rem;
  font-weight: 400;
  color: #a0a5b5;
  margin-bottom: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#playback-badge-container {
  display: flex;
  margin-bottom: 28px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #d1d5db;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-right: 10px; /* Universal spacing compatible with legacy Cast runtimes lacking flex gap */
}

.badge:last-child {
  margin-right: 0;
}

.badge.direct-play {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
}

.badge.transcode-lossless {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
}

.badge.transcode-lossy {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
  border-color: rgba(234, 179, 8, 0.4);
}

#progress-container {
  width: 100%;
}

#progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

#progress-bar-fill {
  width: 0%;
  height: 100%;
  background-color: #e5a00d;
  transition: width 0.2s linear;
}

#time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #9ca3af;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* Responsive tweaks for smaller screens (e.g. 3.5" to 5" touchscreens like WiiM Ultra) */
@media (max-width: 720px) {
  #content-container {
    flex-direction: column;
    text-align: center;
    padding: 12px;
  }

  #artwork-wrapper {
    width: 180px;
    height: 180px;
    margin-right: 0;
    margin-bottom: 18px;
  }

  #track-title {
    font-size: 1.4rem;
  }

  #track-artist {
    font-size: 1.05rem;
  }

  #playback-badge-container {
    justify-content: center;
  }

  #brand-watermark {
    width: 60px;
    height: 60px;
    border-radius: 14px;
  }

  .brand-top-right {
    top: 16px;
    right: 16px;
  }

  .brand-bottom-right {
    bottom: 16px;
    right: 16px;
  }
}

#track-artist:empty,
#track-album:empty {
  display: none;
}

#idle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 860px;
  padding: 32px 24px;
}

#idle-message {
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.65;
  color: #e5e7eb;
  margin-bottom: 40px;
}

#idle-subtext {
  font-size: 1.35rem;
  font-weight: 500;
  color: #e5a00d; /* Plex accent gold/amber */
  letter-spacing: 0.03em;
}

@media (max-width: 720px) {
  #idle-wrapper {
    padding: 16px 8px;
  }

  #idle-message {
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 26px;
  }

  #idle-subtext {
    font-size: 1.1rem;
  }
}
