/* Your Top Songs shelf, full-page rankings, top artists filter, and player badge */
.top-songs-shelf-section,
.top-songs-page-section {
  order: 0;
  width: 100%;
  margin: 0;
}

body.player-open .top-songs-shelf-section,
body.player-open .top-songs-page-section {
  display: none !important;
}

.top-shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.top-shelf-actions,
.top-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-btn-primary,
.top-btn-ghost {
  border-radius: 999px;
  min-height: 40px;
  padding: 0 16px;
  font: 600 12px/1 'Space Grotesk', sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.top-btn-primary {
  border: 0;
  background: linear-gradient(120deg, #66d9f0, #b9a0ed);
  color: #0b101b;
  box-shadow: 0 8px 22px rgba(102, 217, 240, 0.24);
}

.top-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(102, 217, 240, 0.36);
}

.top-btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.045);
  color: #e6ebf8;
}

.top-btn-ghost:hover:not(:disabled) {
  border-color: rgba(102, 217, 240, 0.52);
  background: rgba(102, 217, 240, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.top-btn-primary:disabled,
.top-btn-ghost:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.top-songs-shelf-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(156px, 178px);
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.top-song-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 10px 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(188, 194, 225, 0.09);
  background: #141724;
  color: #f3f5fc;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.top-song-card:hover {
  transform: translateY(-4px);
  border-color: rgba(102, 217, 240, 0.42);
  background: #181c2c;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(102, 217, 240, 0.2);
}

.top-card-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #0d1019;
  margin-bottom: 10px;
}

.top-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.top-song-card:hover .top-card-art img {
  transform: scale(1.06);
}

.top-card-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(13, 17, 28, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #8be0f4;
  font: 700 10px/1.1 'Space Grotesk', sans-serif;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.top-card-rank.rank-1 {
  color: #ffd866;
  border-color: rgba(255, 216, 102, 0.58);
}

.top-card-rank.rank-2 {
  color: #e4e8f0;
  border-color: rgba(228, 232, 240, 0.48);
}

.top-card-rank.rank-3 {
  color: #eab280;
  border-color: rgba(234, 178, 128, 0.5);
}

.top-card-play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #82dff1, #c4b7ef);
  color: #131d2d;
  font-size: 11px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.48);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.top-song-card:hover .top-card-play {
  opacity: 1;
  transform: translateY(0);
}

.top-card-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #f4f6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-card-artist {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #9399b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-card-stats {
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #8be0f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-songs-empty {
  padding: 26px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(102, 217, 240, 0.3);
  background: rgba(255, 255, 255, 0.025);
  color: #f4f6ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.top-songs-empty i {
  font-size: 1.75rem;
  color: #66d9f0;
}

.top-songs-empty strong {
  font-size: 0.98rem;
}

.top-songs-empty small {
  color: var(--text-secondary, #9ea6c2);
  font-size: 0.82rem;
  max-width: 440px;
  line-height: 1.45;
}

/* ── Full Page ── */
.top-page-shell {
  width: 100%;
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(16, 20, 32, 0.84), rgba(10, 12, 20, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
}

.top-page-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  margin-bottom: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
  color: #dbe2f8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.top-page-back:hover {
  border-color: rgba(102, 217, 240, 0.55);
  background: rgba(102, 217, 240, 0.12);
  color: #fff;
}

.top-page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-page-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #66d9f0;
}

.top-page-hero h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 6px 0;
  color: #f6f7ff;
  letter-spacing: -0.6px;
}

.top-page-note {
  color: var(--text-secondary, #9ea6c2);
  font-size: 0.84rem;
  margin: 0;
}

.top-page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0 14px;
}

.top-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.top-tab {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: transparent;
  color: #b4bcd4;
  font: 600 12px/1 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.top-tab:hover {
  color: #fff;
}

.top-tab.active {
  background: linear-gradient(115deg, #8be0f4, #c4b7ef);
  color: #101726;
  box-shadow: 0 4px 14px rgba(102, 217, 240, 0.25);
}

.top-count-label {
  font-size: 12px;
  color: #8f97b4;
}

.top-artists-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.top-artists-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8b94b2;
  margin-right: 4px;
}

.top-artist-chip {
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  color: #dbe2f7;
  padding: 6px 12px;
  border-radius: 999px;
  font: 600 11.5px/1 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
}

.top-artist-chip:hover {
  border-color: rgba(102, 217, 240, 0.5);
  background: rgba(102, 217, 240, 0.12);
  color: #fff;
}

.top-artist-chip.active {
  border-color: transparent;
  background: linear-gradient(115deg, #66d9f0, #b9a0ed);
  color: #0e1523;
}

.top-songs-rows {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  overflow: visible;
}

.top-song-row {
  display: grid;
  grid-template-columns: 34px 46px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.16s ease;
}

.top-song-row:first-child {
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.top-song-row:last-child {
  border-bottom: 0;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

.top-song-row:hover {
  background: rgba(102, 217, 240, 0.08);
}

.top-row-rank {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #818a9f;
}

.top-row-rank.rank-1 { color: #ffd866; }
.top-row-rank.rank-2 { color: #e4e8f0; }
.top-row-rank.rank-3 { color: #eab280; }

.top-row-thumb {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  display: block;
  background: #0d1019;
}

.top-row-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.top-row-copy strong,
.top-row-copy small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-row-copy strong {
  color: #f4f6ff;
  font-size: 0.92rem;
}

.top-row-copy small {
  color: var(--text-secondary, #9ea6c2);
  font-size: 0.78rem;
}

.top-row-inline-stats {
  display: none;
  color: #8be0f4;
  font-size: 0.72rem;
  font-weight: 600;
}

.top-row-stats {
  font-size: 0.78rem;
  font-weight: 600;
  color: #8be0f4;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(102, 217, 240, 0.08);
  border: 1px solid rgba(102, 217, 240, 0.16);
}

.top-row-play,
.top-row-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #d8dcee;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.top-row-play:hover,
.top-row-menu-btn:hover {
  border-color: rgba(102, 217, 240, 0.55);
  background: rgba(102, 217, 240, 0.16);
  color: #fff;
}

.top-row-menu-wrap {
  position: relative;
}

.top-row-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 210px;
  padding: 6px;
  border-radius: 14px;
  background: #151927;
  border: 1px solid rgba(102, 217, 240, 0.25);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-row-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #e6ebf8;
  padding: 9px 11px;
  border-radius: 9px;
  font: 600 12px/1.2 'Space Grotesk', sans-serif;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.top-row-menu button:hover {
  background: rgba(102, 217, 240, 0.14);
  color: #fff;
}

.top-row-menu button.danger:hover {
  background: rgba(255, 107, 139, 0.16);
  color: #ff9ab3;
}

/* ── Player Top Song Badge & Clear History ── */
.ap-tags-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.ap-tags-row .ap-playlist-tag {
  margin-top: 0;
}

.ap-top-song-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #ffe394;
  background: rgba(255, 216, 102, 0.12);
  border: 1px solid rgba(255, 216, 102, 0.38);
}

.ap-top-song-badge.hidden {
  display: none;
}

.mix-menu-body .mix-danger {
  color: #ff9eb5;
  border: 1px solid rgba(255, 107, 139, 0.22);
  margin-top: 8px;
}

.mix-menu-body .mix-danger:hover {
  background: rgba(255, 107, 139, 0.14);
  border-color: rgba(255, 107, 139, 0.48);
  color: #ffd0dc;
}

.top-song-card:focus-visible,
.top-tab:focus-visible,
.top-artist-chip:focus-visible,
.top-song-row:focus-visible,
.top-row-play:focus-visible,
.top-row-menu-btn:focus-visible,
.top-btn-primary:focus-visible,
.top-btn-ghost:focus-visible,
.top-page-back:focus-visible {
  outline: 2px solid #8fe3f5;
  outline-offset: 2px;
}

@media (hover: none) {
  .top-card-play {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 620px) {
  .top-songs-shelf-track {
    grid-auto-columns: 142px;
    gap: 10px;
  }

  .top-page-shell {
    padding: 16px 14px;
    border-radius: 18px;
  }

  .top-page-hero {
    align-items: stretch;
  }

  .top-page-actions {
    width: 100%;
  }

  .top-page-actions .top-btn-primary,
  .top-page-actions .top-btn-ghost {
    flex: 1 1 0;
  }

  .top-song-row {
    grid-template-columns: 26px 42px minmax(0, 1fr) auto auto;
    gap: 9px;
    padding: 9px 10px;
  }

  .top-row-thumb {
    width: 42px;
    height: 42px;
  }

  .top-row-stats {
    display: none;
  }

  .top-row-inline-stats {
    display: block;
  }
}
