#spotify-scroll-container {
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  /* Extra bottom/right so repeat badge can sit past the card corner (mockup). */
  padding: 5px 8px 20px 0;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#spotify-scroll-container:active {
  cursor: grabbing;
}

#spotify-scroll-container::-webkit-scrollbar {
  display: none;
}

#favorite-scroll-container {
  box-sizing: border-box;
  padding-right: 8px;
  padding-bottom: 20px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

#game-history-container {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
}

.spotify-track-row {
  display: flex;
  gap: 12px;
  padding: 5px 0 11px 0;
  will-change: transform;
  width: max-content;
}

.spotify-card {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 12px;
  background-color: #101010;
  border: 1px solid #202020;
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  opacity: 1;
  overflow: hidden;
  
  animation: slideInAndFadeIn 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.25s ease, 
              border-color 0.25s ease,
              background-color 0.25s ease;
}

a.spotify-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}


.spotify-card.is-playing {
  border-color: var(--colors-accent-DEFAULT) !important;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.spotify-card .icon-box {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-right: 12px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.spotify-card .icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.spotify-card .gif-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  opacity: 0.8;
  background: rgba(0,0,0,0.2);
}

.spotify-card.is-playing .art {
  opacity: 0.4;
}

.spotify-card.is-playing .gif-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotify-card .text-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.spotify-card--has-count .text-info {
  padding-right: 22px;
}

/* Badge sits outside the rounded rect; must not clip it */
.spotify-card.spotify-card--has-count {
  overflow: visible;
}

.spotify-card .track-title, 
.spotify-card .song-name {
  color: #eee;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotify-card .track-artist, 
.spotify-card .artist-name {
  color: #888;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#spotify-measurer {
  position: absolute;
  visibility: hidden;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Repeat count: 19px circle, mockup position (top 42px @ 181px width → ~5px past bottom-right) */
.spotify-card__badge-count {
  position: absolute;
  z-index: 2;
  right: -5px;
  bottom: -5px;
  top: auto;
  left: auto;
  transform: none;
  width: 19px;
  height: 19px;
  padding: 0;
  box-sizing: border-box;
  background: #202020;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: var(--font-mono, monospace);
  font-size: 8.8px;
  font-weight: 450;
  line-height: 13.2px;
  color: #495363;
}

.spotify-card__badge-count span {
  display: block;
  white-space: nowrap;
}

/* Favorite tracks: 19px circle + crown — same bottom-right offset as repeat-count */
.spotify-card__badge-favorite {
  position: absolute;
  z-index: 2;
  right: -5px;
  bottom: -5px;
  width: 19px;
  height: 19px;
  box-sizing: border-box;
  background: #202020;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.spotify-card__badge-favorite svg {
  display: block;
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  pointer-events: none;
}

.spotify-card__badge-favorite--skeleton {
  background: #2a2a2a;
}

.spotify-card--favorite .text-info {
  padding-right: 22px;
}

.spotify-card.spotify-card--favorite {
  overflow: visible;
}

/* Avoid re-triggering entry animations when class is applied (e.g. empty state). */
.spotify-card--no-anim {
  animation: none !important;
}

/* Placeholder row: matches real card (#101010) + grey blocks + shimmer (see mockup) */
.spotify-card.skeleton {
  background: #101010;
  border-color: #202020;
  animation: none !important;
  cursor: default;
}

.spotify-card.skeleton .icon-box.skeleton-block {
  background-color: #202020;
  position: relative;
  overflow: hidden;
}

.spotify-card.skeleton .icon-box.skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #1a1a1a 0%,
    #2f2f2f 42%,
    #1a1a1a 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 2s ease-in-out infinite;
}

.spotify-card.skeleton .skeleton-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.spotify-card.skeleton .skeleton-line {
  height: 11px;
  border-radius: 999px;
  background-color: #202020;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.spotify-card.skeleton .skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #1a1a1a 0%,
    #2f2f2f 42%,
    #1a1a1a 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 2s ease-in-out infinite;
}

.spotify-card.skeleton .skeleton-line--title {
  width: 92%;
}

.spotify-card.skeleton .skeleton-line--artist {
  width: 52%;
  height: 10px;
}

.spotify-card.skeleton .icon-box,
.spotify-card.skeleton .text-info {
  pointer-events: none;
}

@keyframes skeletonShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

#spotify-scroll-hint {
  margin-top: 9px;
  text-align: center;
  font-size: 9px;
  color: #707070;
}

@keyframes slideInAndFadeIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .spotify-card {
    height: 50px;
    padding: 0 10px;
    border-radius: 10px;
  }

  .spotify-card .icon-box {
    width: 28px;
    height: 28px;
    margin-right: 8px;
  }

  .spotify-card .track-title,
  .spotify-card .song-name {
    font-size: 11px;
  }

  .spotify-card .track-artist,
  .spotify-card .artist-name {
    font-size: 10px;
  }

  .spotify-track-row {
    gap: 8px;
  }

  #spotify-scroll-hint,
  #favorite-scroll-hint {
    font-size: 8px;
  }

  .spotify-card.skeleton .skeleton-lines {
    gap: 6px;
  }

  .spotify-card.skeleton .skeleton-line--title {
    height: 10px;
  }

  .spotify-card.skeleton .skeleton-line--artist {
    height: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spotify-card.skeleton .icon-box.skeleton-block::after,
  .spotify-card.skeleton .skeleton-line::after {
    animation: none;
  }
}
