/* Swipe Song visitor UI — mobile-first */
html {
  height: 100%;
}

.ss-app {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  font-family: "DM Sans", system-ui, sans-serif;
  background: radial-gradient(120% 80% at 50% 0%, #1a2435 0%, #0c0f14 45%, #07090c 100%);
  color: #e8eaef;
  -webkit-tap-highlight-color: transparent;
}

.ss-root {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/*
 * Mobile deck: center .ss-deck-wrap in the viewport. justify-content alone fails when the flex
 * box shrinks to one child — use min-height = viewport + margin auto on the deck.
 */
@media (max-width: 1023.98px) {
  .ss-root.ss-root--deck {
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: 100svh;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .ss-root.ss-root--deck > .ss-deck-wrap {
    margin-top: auto;
    margin-bottom: auto;
    flex-shrink: 0;
    width: 100%;
    max-width: 22rem;
  }
}

@media (min-width: 900px) and (max-width: 1023.98px) {
  .ss-root.ss-root--deck > .ss-deck-wrap {
    max-width: 26rem;
  }
}

/* Vote limits — root: above empty/loading; topbar: in header when deck is open */
.ss-limits-strip[hidden] {
  display: none !important;
}
.ss-limits-strip--root {
  width: 100%;
  max-width: 22rem;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
  padding: 0 0.25rem;
}
@media (min-width: 900px) {
  .ss-limits-strip--root {
    max-width: 26rem;
  }
}
.ss-limits-strip--root:not([hidden]) {
  display: block;
}
.ss-limits-strip__inner {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 1.35rem;
}
.ss-limits-strip--root .ss-likes-pill {
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-limits-strip--topbar {
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
.ss-limits-strip--topbar:not([hidden]) {
  display: block;
}
.ss-limits-strip--topbar .ss-likes-pill {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  letter-spacing: normal;
}
.ss-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 28rem;
}
.ss-screen--active,
.ss-screen:not([hidden]) {
  display: flex;
}

.ss-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #6ee7b7;
  border-radius: 50%;
  animation: ss-spin 0.75s linear infinite;
  margin-bottom: 1rem;
}
@keyframes ss-spin {
  to {
    transform: rotate(360deg);
  }
}

.ss-muted {
  color: #9aa3b2;
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0;
}

.ss-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.ss-card--message {
  padding: 2rem 1.5rem;
  width: 100%;
}

.ss-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

/* Deck */
.ss-deck-wrap {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .ss-deck-wrap {
    max-width: 26rem;
  }
  .ss-card-stack {
    min-height: 26rem;
  }
}

.ss-round-banner {
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  line-height: 0;
  background: rgba(255, 255, 255, 0.04);
}

.ss-round-banner[hidden] {
  display: none !important;
}

.ss-round-banner__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 4.25rem;
  object-fit: cover;
  vertical-align: middle;
}

@media (min-width: 900px) {
  .ss-round-banner__img {
    max-height: 4.75rem;
  }
}

.ss-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a8494;
  gap: 0.5rem;
}

.ss-topbar__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.ss-topbar__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}

.ss-brand {
  font-weight: 600;
}

.ss-user-pill {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
  font-size: 0.65rem;
  color: #a8b0c0;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ss-user-pill[hidden] {
  display: none !important;
}

.ss-playing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(110, 231, 183, 0.1);
  border: 1px solid rgba(110, 231, 183, 0.25);
  color: #6ee7b7;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ss-playing-indicator[hidden] {
  display: none !important;
}

/* Playing badge on same row as artist, right-aligned */
.ss-playing-indicator--meta {
  margin-top: 0;
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0.04em;
}

.ss-playing-indicator--meta .ss-playing-bars {
  height: 0.85rem;
}

@media (max-width: 1023.98px) {
  .ss-actions--desktop {
    display: none !important;
  }

  .ss-hint-desktop {
    display: none !important;
  }

  .ss-hint-touch {
    display: block !important;
  }
}

.ss-playing-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 0.85rem;
}

.ss-playing-bar {
  width: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.85;
  transform-origin: bottom center;
  animation: ss-bar-bounce 0.55s ease-in-out infinite;
}

.ss-playing-bar:nth-child(1) {
  animation-delay: 0s;
  min-height: 0.25rem;
}
.ss-playing-bar:nth-child(2) {
  animation-delay: 0.1s;
  min-height: 0.45rem;
}
.ss-playing-bar:nth-child(3) {
  animation-delay: 0.2s;
  min-height: 0.35rem;
}
.ss-playing-bar:nth-child(4) {
  animation-delay: 0.15s;
  min-height: 0.55rem;
}

@keyframes ss-bar-bounce {
  0%,
  100% {
    transform: scaleY(0.35);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.ss-likes-pill {
  display: inline-block;
  background: rgba(110, 231, 183, 0.15);
  color: #6ee7b7;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.35;
  max-width: 100%;
  box-sizing: border-box;
}

.ss-banner {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fcd34d;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.65rem;
  text-align: center;
}

.ss-deck-wrap--intro .ss-actions--desktop {
  display: none !important;
}

/* iOS Safari can fail to paint blurred cards; intro uses a flat background instead. */
.ss-card--intro {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(255, 255, 255, 0.09);
}

.ss-card--intro .ss-track-title {
  white-space: pre-line;
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.4;
  margin-bottom: 0;
}

.ss-card--intro .ss-meta__artist-row {
  display: none;
}

.ss-card--intro .ss-cover-wrap {
  aspect-ratio: 1;
  min-height: 0;
  max-height: none;
}

.ss-card--intro .ss-cover {
  object-fit: cover;
}

.ss-card--intro .ss-cover-fallback {
  font-size: 2rem;
  color: rgba(232, 234, 239, 0.4);
}

.ss-deck-stage {
  position: relative;
}

.ss-deck-stage audio {
  pointer-events: none;
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ss-card-stack {
  perspective: 1200px;
  min-height: 22rem;
}

@media (max-width: 1023.98px) {
  .ss-card-stack--intro {
    min-height: 0;
  }
}

.ss-card--main {
  position: relative;
  transform-origin: 50% 80%;
  transition: transform 0.18s ease-out, opacity 0.18s ease-out;
  will-change: transform, opacity;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.ss-card--main:active {
  cursor: grabbing;
}

.ss-card--main.ss-card--exit-left {
  transform: translateX(-120%) rotate(-12deg);
  opacity: 0;
}
.ss-card--main.ss-card--exit-right {
  transform: translateX(120%) rotate(12deg);
  opacity: 0;
}

.ss-cover-wrap {
  aspect-ratio: 1;
  background: linear-gradient(145deg, #2a3548, #1a2230);
  position: relative;
}

.ss-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: auto;
}

.ss-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #6b7280;
  background: linear-gradient(145deg, #2a3548, #1a2230);
  pointer-events: none;
}

.ss-cover-fallback[hidden] {
  display: none !important;
}

.ss-meta {
  padding: 1rem 1.1rem 1.15rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
}

.ss-meta__artist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.ss-track-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.25;
}

.ss-track-artist {
  margin: 0;
  font-size: 0.95rem;
  color: #a8b0c0;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.ss-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.ss-hint-touch {
  display: none;
}

.ss-btn {
  flex: 1;
  max-width: 8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.75rem 0.5rem;
  border-radius: 1rem;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.ss-btn:active {
  transform: scale(0.96);
}

.ss-btn--dislike {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.ss-btn--like {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}

.ss-btn__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.ss-btn__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.9;
}

.ss-hint-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 0.75rem;
}

.ss-hint-wrap .ss-hint {
  margin-top: 0;
}

.ss-hint {
  text-align: center;
  font-size: 0.75rem;
  margin-top: 0.75rem;
}

.ss-user-pill--under-hint {
  margin-top: 0.4rem;
  width: max-content;
  max-width: min(100%, 22rem);
}

.ss-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
