/* Song select — arcade theme aligned with score + leaderboard screens */

.song-select-screen {
  --arcade-accent: #d946ef;
  --arcade-highlight: #f0abfc;

  position: relative;
  height: 100vh;
  height: 100dvh;
  padding: 1rem clamp(1rem, 3vw, 2.5rem);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background-color: #120820;
  color: #ffffff;
}

.song-select-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}

.song-select-screen__vignette {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 90% 70% at 50% 20%,
    rgb(0 0 0 / 0.12) 0%,
    transparent 50%
  );
}

.song-select-screen__scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgb(0 0 0 / 0.07) 2px,
    rgb(0 0 0 / 0.07) 4px
  );
  opacity: 0.35;
}

.song-select-screen__yt-preview {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 240px;
  height: 135px;
  z-index: 10;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.song-select-screen__yt-preview iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.song-select-screen__yt-preview.yt-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.8);
}

.song-select-screen__yt-preview.yt-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgba(217, 70, 239, 0.2);
  border-top-color: #d946ef;
  border-radius: 50%;
  animation: yt-spin 0.8s linear infinite;
}

@keyframes yt-spin {
  to { transform: rotate(360deg); }
}

.song-select-screen__content {
  position: relative;
  z-index: 2;
  width: min(980px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.5vw, 2.5rem);
}

.song-select-screen__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.song-select-screen__disco-ball {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.95) 0%, transparent 42%),
    conic-gradient(
      from 210deg,
      #8b9cb0,
      #d8e0ea,
      #5a6b7e,
      #a8b8c8,
      #6a7a8e,
      #c5d0dc,
      #8b9cb0
    );
  box-shadow:
    0 0 20px rgb(240 171 252 / 0.5),
    0 0 36px rgb(217 70 239 / 0.25),
    inset 0 -6px 12px rgb(0 0 0 / 0.35);
  border: 1px solid rgb(255 255 255 / 0.35);
  animation: songSelectDiscoSpin 18s linear infinite;
}

@keyframes songSelectDiscoSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .song-select-screen__disco-ball {
    animation: none;
  }
}

.song-select-screen__title {
  margin: 0;
  text-align: center;
  letter-spacing: 0.32em;
  font-size: var(--font-size-title);
  color: #ffffff;
  text-shadow: 0 0 24px rgb(255 255 255 / 0.25);
}

.song-select-screen__subtitle {
  margin: 0;
  text-align: center;
  letter-spacing: 0.2em;
  color: rgb(255 255 255 / 0.5);
}

.song-carousel {
  width: 100%;
  perspective: 1200px;
}

.song-carousel__viewport {
  position: relative;
  height: 360px;
  transform-style: preserve-3d;
}

.song-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 300px;
  margin-left: -120px;
  margin-top: -150px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  text-align: left;
  padding: 14px;
  transition: transform 240ms ease, opacity 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
  cursor: pointer;
  background: rgb(0 0 0 / 0.35);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.05),
    0 4px 16px rgb(0 0 0 / 0.4);
}

.song-card__custom-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  color: #d946ef;
  z-index: 2;
}

.song-card--active {
  border-color: var(--arcade-highlight);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    0 0 24px rgb(240 171 252 / 0.35),
    0 0 48px rgb(217 70 239 / 0.18),
    0 8px 24px rgb(0 0 0 / 0.45);
}

.song-card__banner {
  width: calc(100% + 28px);
  margin: -14px -14px 10px;
  height: 80px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.song-card__track {
  font-size: 11px;
  letter-spacing: 0.2em;
  opacity: 0.85;
}

.song-card__title {
  margin-top: 8px;
  font-size: var(--font-size-title);
  line-height: 1.15;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.song-card__artist {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 38px;
  font-size: 15px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-card__bottom-row {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.song-card__bpm {
  font-size: 12px;
  letter-spacing: 0.16em;
}

.song-card__difficulty {
  display: flex;
  gap: 6px;
}

.song-card__difficulty-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.song-info-bar {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 24px;
  align-items: center;
  border: 1px solid;
  padding: 16px 18px;
  box-sizing: border-box;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.06),
    0 4px 24px rgb(0 0 0 / 0.35);
  background: var(--info-bg-image) center / cover no-repeat;
  overflow: hidden;
  z-index: 0;
}

.song-info-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--info-bg-color);
  z-index: -1;
}

.song-info-bar__main {
  min-width: 0;
}

.song-info-bar__title {
  font-size: var(--font-size-display-lg);
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-info-bar__artist {
  margin-top: 6px;
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.85);
}

.song-info-bar__stats {
  display: flex;
  gap: 28px;
}

.song-info-bar__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 22px;
  line-height: 1;
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}

.song-info-bar__label {
  font-size: 11px;
  letter-spacing: 0.2em;
}

.song-info-bar__bpm-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.song-info-bar__pulse {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  transform: scale(0.7);
  transition: transform 90ms linear;
}

.song-info-bar__pulse--on {
  transform: scale(1.45);
}

.song-info-bar__dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.song-info-bar__dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.song-info-bar__confirm {
  border: 0;
  padding: 14px 28px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.2s ease;
}

.song-info-bar__confirm:hover {
  filter: brightness(1.08);
}

.song-info-bar__confirm:active {
  transform: scale(0.99);
}

.ar-hud {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.ar-hud__corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--arcade-highlight);
  border-style: solid;
  border-width: 0;
  opacity: 0.65;
}

.ar-hud__corner--top-left {
  top: 16px;
  left: 16px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.ar-hud__corner--top-right {
  top: 16px;
  right: 16px;
  border-top-width: 2px;
  border-right-width: 2px;
}

.ar-hud__corner--bottom-left {
  bottom: 16px;
  left: 16px;
  border-bottom-width: 2px;
  border-left-width: 2px;
}

.ar-hud__corner--bottom-right {
  bottom: 16px;
  right: 16px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.ar-hud__crosshair {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -11px;
  border: 2px solid var(--arcade-highlight);
}

.ar-hud__crosshair::before,
.ar-hud__crosshair::after {
  content: '';
  position: absolute;
  background-color: var(--arcade-highlight);
}

.ar-hud__crosshair::before {
  left: 50%;
  top: -7px;
  width: 2px;
  height: 34px;
  margin-left: -1px;
}

.ar-hud__crosshair::after {
  top: 50%;
  left: -7px;
  width: 34px;
  height: 2px;
  margin-top: -1px;
}

.ar-hud__track-counter {
  position: absolute;
  top: 20px;
  right: 44px;
  font-size: 14px;
  letter-spacing: 0.22em;
  opacity: 0.9;
}

.ar-hud__meta {
  position: absolute;
  bottom: 16px;
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.85;
}

.ar-hud__meta--left {
  left: 22px;
}

.ar-hud__meta--right {
  right: 22px;
}

@media (max-height: 820px) {
  .song-select-screen__header {
    gap: 0.25rem;
  }

  .song-select-screen__disco-ball {
    width: 32px;
    height: 32px;
  }

  .song-select-screen__content {
    gap: 0.5rem;
  }

  .song-carousel__viewport {
    height: 260px;
  }

  .song-card {
    width: 190px;
    height: 240px;
    margin-left: -95px;
    margin-top: -120px;
    padding: 10px;
  }

  .song-card__banner {
    width: calc(100% + 20px);
    margin: -10px -10px 8px;
    height: 60px;
  }

  .song-card__title {
    font-size: 22px;
  }

  .song-card__artist {
    bottom: 32px;
    font-size: 13px;
  }

  .song-card__bottom-row {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .song-info-bar {
    padding: 10px 14px;
    gap: 16px;
  }

  .song-info-bar__title {
    font-size: 24px;
  }

  .song-info-bar__stat {
    font-size: 18px;
  }

  .song-info-bar__confirm {
    padding: 10px 22px;
    font-size: 16px;
  }
}

.song-select-screen__add-btn {
  margin-top: 0.5rem;
  background: none;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.6);
  padding: 8px 24px;
  cursor: pointer;
  letter-spacing: 0.18em;
  font-size: 13px;
  transition: border-color 0.2s, color 0.2s;
}

.song-select-screen__add-btn:hover {
  border-color: #d946ef;
  color: #f0abfc;
}

@media (max-width: 960px) {
  .song-carousel__viewport {
    height: 292px;
  }

  .song-card {
    width: 182px;
    height: 238px;
    margin-left: -91px;
    margin-top: -119px;
  }

  .song-card__title {
    font-size: 26px;
  }

  .song-info-bar {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .song-info-bar__title {
    font-size: 24px;
  }

  .song-info-bar__stats {
    justify-content: space-between;
    gap: 14px;
  }

  .song-info-bar__confirm {
    width: 100%;
  }

  .ar-hud__meta {
    bottom: 12px;
  }

  .ar-hud__track-counter,
  .ar-hud__meta {
    font-size: 11px;
  }
}
