/* Spotify-style Discover page */

html {
  scroll-snap-type: none;
}

.page-discover {
  --discover-bg: #000000;
  --discover-panel: #121212;
  --discover-elevated: #242424;
  --discover-muted: #b3b3b3;
  --discover-topbar-h: 64px;
  --discover-sidebar-w: 350px;
  background: var(--discover-bg);
  overflow-x: hidden;
}

.page-discover .site-wrap {
  min-height: 100vh;
}

.page-discover .site-main.discover-main-wrap {
  padding-top: var(--discover-topbar-h);
  min-height: calc(100vh - var(--discover-topbar-h));
  height: auto;
  overflow: visible;
}

/* —— Top bar —— */
.discover-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: var(--discover-topbar-h);
  padding: 8px 24px;
  background: var(--discover-bg);
}

.discover-topbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.discover-topbar__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 4px;
}

.discover-topbar__logo img {
  display: block;
  height: 24px;
  width: auto;
  max-width: 140px;
}

.discover-search {
  position: relative;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  justify-self: center;
}

.discover-search__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--discover-muted);
  pointer-events: none;
}

.discover-search__icon svg {
  width: 16px;
  height: 16px;
}

.discover-search__input {
  width: 100%;
  height: 48px;
  padding: 0 48px;
  border: 0;
  border-radius: 999px;
  background: #282828;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.discover-search__input::placeholder {
  color: var(--discover-muted);
}

.discover-search__input:hover {
  background: #3e3e3e;
}

.discover-search__input:focus {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 0 2px #ffffff;
}

.discover-search__input:focus::placeholder {
  color: #6a6a6a;
}

.discover-topbar__nav {
  display: flex;
  align-items: center;
  gap: 24px;
  justify-self: end;
}

.discover-topbar__nav a {
  font-size: 14px;
  font-weight: 700;
  color: var(--discover-muted);
  white-space: nowrap;
  transition: color 0.2s ease, transform 0.2s ease;
}

.discover-topbar__nav a:hover {
  color: #ffffff;
  transform: scale(1.04);
}

.discover-topbar__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 20px;
  border-radius: 999px;
  background: #ffffff !important;
  color: #000000 !important;
  font-size: 14px;
  font-weight: 700;
}

.discover-topbar__cta:hover {
  background: #f5f5f5 !important;
  color: #000000 !important;
  transform: scale(1.04);
}

.discover-topbar__cta.is-active {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.discover-menu-btn {
  display: none;
  background: none;
  border: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px;
}

/* —— App shell —— */
.discover-app {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--discover-topbar-h) - 8px);
  height: auto;
  gap: 8px;
  padding: 0 8px 48px;
}

/* —— Sidebar —— */
.discover-sidebar {
  flex: 0 0 var(--discover-sidebar-w);
  width: var(--discover-sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--discover-panel);
  border-radius: 8px;
  padding: 8px;
  position: sticky;
  top: calc(var(--discover-topbar-h) + 8px);
  align-self: flex-start;
  max-height: calc(100vh - var(--discover-topbar-h) - 16px);
  overflow-y: auto;
}

.discover-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.discover-sidebar__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.discover-sidebar__create {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--discover-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.discover-sidebar__create:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.discover-sidebar__create svg {
  width: 16px;
  height: 16px;
}

.discover-sidebar__cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.discover-sidebar__card {
  background: #242424;
  border-radius: 8px;
  padding: 16px;
}

.discover-sidebar__card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.discover-sidebar__card p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--discover-muted);
}

.discover-sidebar__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 16px;
  border-radius: 999px;
  background: #ffffff;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.2s ease;
}

.discover-sidebar__pill:hover {
  transform: scale(1.04);
  color: #000000;
}

.discover-sidebar__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 8px 12px;
}

.discover-sidebar__legal a {
  font-size: 11px;
  color: var(--discover-muted);
  transition: color 0.2s ease;
}

.discover-sidebar__legal a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.discover-sidebar__lang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 12px 12px;
  width: fit-content;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.discover-sidebar__lang:hover {
  border-color: #ffffff;
  transform: scale(1.04);
}

.discover-sidebar__lang svg {
  width: 16px;
  height: 16px;
}

/* —— Main content —— */
.discover-content {
  flex: 1;
  min-width: 0;
  background: var(--discover-panel);
  border-radius: 8px;
  overflow: visible;
  padding: 24px 32px 80px;
}

.discover-row + .discover-row {
  margin-top: 40px;
}

.discover-row__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.discover-row__title {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.discover-row__more {
  font-size: 12px;
  font-weight: 700;
  color: var(--discover-muted);
  white-space: nowrap;
  transition: color 0.2s ease;
}

.discover-row__more:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.discover-row__scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 180px);
  gap: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #535353 transparent;
}

.discover-row__scroll::-webkit-scrollbar {
  height: 8px;
}

.discover-row__scroll::-webkit-scrollbar-thumb {
  background: #535353;
  border-radius: 4px;
}

/* —— Cards —— */
.discover-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition: transform 0.2s ease;
}

button.discover-card {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
}

.discover-card:hover {
  transform: none;
}

.discover-card__media {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: #282828;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.discover-card__media--round {
  border-radius: 50%;
}

.discover-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discover-card__play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1db954;
  color: #000000;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.discover-card--playable:hover .discover-card__play,
.discover-card.is-playing .discover-card__play {
  opacity: 1;
  transform: translateY(0);
}

.discover-card--album.discover-card--playable .discover-card__play {
  opacity: 0;
}

.discover-card--album.discover-card--playable:hover .discover-card__play,
.discover-card--album.discover-card--playable.is-playing .discover-card__play {
  opacity: 1;
  transform: translateY(0);
}

.discover-card.is-playing .discover-card__play {
  background: #1ed760;
}

.discover-card__play svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.discover-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #ffffff;
}

.discover-card__meta {
  display: block;
  font-size: 13px;
  color: var(--discover-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-card__explicit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 9px;
  font-weight: 700;
  vertical-align: middle;
}

.discover-card--artist .discover-card__title {
  font-size: 15px;
  font-weight: 700;
}

/* —— Wheel modal —— */
.discover-wheel-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.discover-wheel-modal[hidden] {
  display: none;
}

.discover-wheel-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
}

.discover-wheel-modal__dialog {
  position: relative;
  width: min(100%, 440px);
  padding: 28px 24px 24px;
  border-radius: 16px;
  background: linear-gradient(165deg, #2a2a2a 0%, #101010 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.discover-wheel-modal__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1db954;
}

.discover-wheel-modal__title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.discover-wheel-modal__text {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--discover-muted);
}

.discover-wheel {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1;
  margin: 0 auto 16px;
}

.discover-wheel__pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid #ffffff;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.discover-wheel__disk {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid #ffffff;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.45);
  background: conic-gradient(
    #1db954 0deg 45deg,
    #333333 45deg 90deg,
    #1db954 90deg 135deg,
    #333333 135deg 180deg,
    #ffd700 180deg 225deg,
    #333333 225deg 270deg,
    #1db954 270deg 315deg,
    #333333 315deg 360deg
  );
  transition: transform 4.2s cubic-bezier(0.12, 0.85, 0.18, 1);
  will-change: transform;
}

.discover-wheel__labels {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.discover-wheel__labels li {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  margin-left: -28px;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  transform: rotate(calc(var(--i) * 45deg + 22.5deg)) translateY(-108px);
}

.discover-wheel__labels li.is-jackpot {
  color: #111111;
  font-size: 15px;
}

.discover-wheel__hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #d9d9d9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #111111;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.discover-wheel__hub:not(:disabled):hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.discover-wheel__hub:disabled {
  cursor: default;
}

.discover-wheel-modal__status {
  min-height: 24px;
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.discover-wheel-modal__status.is-win {
  color: #ffd700;
  animation: discover-wheel-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes discover-wheel-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

.discover-wheel-modal__spin {
  min-height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 999px;
  background: #1db954;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.discover-wheel-modal__spin:hover {
  background: #1ed760;
}

.discover-wheel-modal__spin[hidden] {
  display: none;
}

/* —— Bonus modal —— */
.discover-bonus-modal {
  position: fixed;
  inset: 0;
  z-index: 510;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.discover-bonus-modal[hidden] {
  display: none;
}

.discover-bonus-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.discover-bonus-modal__dialog {
  position: relative;
  width: min(100%, 420px);
  padding: 32px 28px 28px;
  border-radius: 12px;
  background: linear-gradient(160deg, #282828 0%, #121212 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.discover-bonus-modal__x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--discover-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.discover-bonus-modal__x:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.discover-bonus-modal__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1db954;
}

.discover-bonus-modal__title {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.discover-bonus-modal__text {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--discover-muted);
}

.discover-bonus-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.discover-bonus-modal__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: #1db954;
  color: #000000;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.2s ease;
}

.discover-bonus-modal__cta:hover {
  background: #1ed760;
  transform: scale(1.02);
  text-decoration: none;
}

.discover-bonus-modal__ghost {
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--discover-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.discover-bonus-modal__ghost:hover {
  color: #ffffff;
}

body.discover-modal-open {
  overflow: hidden;
}

/* —— Bottom preview player —— */
.discover-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #181818;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}

.discover-player[hidden] {
  display: none;
}

.discover-player__cover {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #282828 center / cover no-repeat;
  flex-shrink: 0;
}

.discover-player__meta {
  min-width: 0;
  flex: 1;
}

.discover-player__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-player__artist {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--discover-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-player__progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.discover-player__time {
  flex-shrink: 0;
  min-width: 32px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--discover-muted);
}

.discover-player__seek {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.discover-player__seek-track {
  display: block;
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.discover-player__seek-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1db954;
  transition: width 0.1s linear;
}

.discover-player__seek:hover .discover-player__seek-track {
  background: rgba(255, 255, 255, 0.24);
}

.discover-player__seek:hover .discover-player__seek-fill {
  background: #1ed760;
}

.discover-player__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  flex-shrink: 0;
}

.discover-player__toggle svg {
  width: 20px;
  height: 20px;
}

.page-discover .discover-content {
  padding-bottom: 112px;
}

.discover-browse-head {
  margin-bottom: 28px;
}

.discover-browse-back {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--discover-muted);
  transition: color 0.2s ease;
}

.discover-browse-back:hover {
  color: #ffffff;
  text-decoration: none;
}

.discover-browse-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.discover-browse-count {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--discover-muted);
}

.discover-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px;
}

.page-discover-browse .discover-content {
  padding-bottom: 132px;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .discover-topbar {
    grid-template-columns: auto 1fr auto;
  }

  .discover-topbar__nav a:not(.discover-topbar__cta) {
    display: none;
  }
}

@media (max-width: 809px) {
  :root {
    --discover-sidebar-w: 100%;
  }

  .discover-topbar {
    grid-template-columns: auto 1fr auto;
    padding: 8px 16px;
    gap: 12px;
  }

  .discover-search {
    max-width: none;
  }

  .discover-topbar__nav {
    display: none;
  }

  .discover-menu-btn {
    display: block;
  }

  .discover-app {
    flex-direction: column;
    padding: 0 0 8px;
  }

  .discover-sidebar {
    display: none;
    flex: none;
    width: auto;
    position: static;
    max-height: 280px;
    margin: 0 8px;
  }

  .discover-sidebar.is-open {
    display: flex;
  }

  .discover-content {
    border-radius: 8px 8px 0 0;
    padding: 20px 16px 40px;
  }

  .discover-row__scroll {
    grid-auto-columns: minmax(132px, 160px);
    gap: 16px;
  }
}
