/* Swipe Song visitor UI — mobile-first */
html {
  height: 100%;
}

.ss-app {
  --ss-page-bg: radial-gradient(120% 80% at 50% 0%, #1a2435 0%, #0c0f14 45%, #07090c 100%);
  --ss-fg: #e8eaef;
  --ss-muted: #9aa3b2;
  --ss-topbar: #7a8494;
  --ss-artist: #a8b0c0;
  --ss-like: #6ee7b7;
  --ss-dislike: #fca5a5;
  --ss-like-bg: rgba(52, 211, 153, 0.12);
  --ss-like-border: rgba(52, 211, 153, 0.4);
  --ss-dislike-bg: rgba(248, 113, 113, 0.12);
  --ss-dislike-border: rgba(248, 113, 113, 0.35);
  --ss-pill-bg: rgba(110, 231, 183, 0.15);
  --ss-pill-fg: #6ee7b7;
  --ss-card-bg: rgba(255, 255, 255, 0.06);
  --ss-card-border: rgba(255, 255, 255, 0.12);
  --ss-user-bg: rgba(255, 255, 255, 0.06);
  --ss-user-border: rgba(255, 255, 255, 0.1);
  --ss-banner-bg: rgba(251, 191, 36, 0.12);
  --ss-banner-border: rgba(251, 191, 36, 0.35);
  --ss-banner-fg: #fcd34d;
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--ss-page-bg);
  color: var(--ss-fg);
  -webkit-tap-highlight-color: transparent;
}

.ss-app--light-bg {
  --ss-fg: #141820;
  --ss-muted: #3d4450;
  --ss-topbar: #2c3340;
  --ss-artist: #3d4450;
  --ss-like: #0a6b48;
  --ss-dislike: #9f1d14;
  --ss-like-bg: rgba(10, 107, 72, 0.12);
  --ss-like-border: rgba(10, 107, 72, 0.42);
  --ss-dislike-bg: rgba(159, 29, 20, 0.1);
  --ss-dislike-border: rgba(159, 29, 20, 0.4);
  --ss-pill-bg: rgba(10, 107, 72, 0.12);
  --ss-pill-fg: #0a6b48;
  --ss-card-bg: rgba(20, 24, 32, 0.08);
  --ss-card-border: rgba(20, 24, 32, 0.14);
  --ss-user-bg: rgba(20, 24, 32, 0.08);
  --ss-user-border: rgba(20, 24, 32, 0.14);
  --ss-banner-bg: rgba(161, 98, 7, 0.1);
  --ss-banner-border: rgba(161, 98, 7, 0.35);
  --ss-banner-fg: #854d0e;
}

.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. Layout is gated by #ss-root[data-ss-view="deck"]
 * so the deck never receives display:flex while voting UI is inactive (fixes stray hints / split layout).
 */
@media (max-width: 1023.98px) {
  #ss-root[data-ss-view="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[data-ss-view="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[data-ss-view="deck"] > #ss-deck-wrap {
    max-width: 26rem;
  }
}

/*
 * Session finished: fixed full-viewport layer so the deck (flex column, hints, actions)
 * cannot appear beside or under the thank-you card on wide viewports or after refresh.
 */
#ss-root[data-ss-view="complete"] #ss-deck-wrap {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#ss-root[data-ss-view="complete"] #ss-empty:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none !important;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  margin: 0;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ss-page-bg);
}

#ss-root[data-ss-view="home"] #ss-deck-wrap {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#ss-root[data-ss-view="home"] #ss-home:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none !important;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  margin: 0;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--ss-page-bg);
}

#ss-root[data-ss-view="home"] .ss-limits-strip--root {
  display: none !important;
}

.ss-home-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 22rem;
  gap: 1.35rem;
}

.ss-home-logo {
  display: block;
  max-width: min(16rem, 72vw);
  max-height: 8.75rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.ss-home-logo[hidden] {
  display: none !important;
}

.ss-home-text {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-line;
  color: var(--ss-fg);
}

.ss-home-text[hidden] {
  display: none !important;
}

.ss-home-btn {
  appearance: none;
  border: 0;
  margin-top: 0.35rem;
  padding: 0.95rem 2.1rem;
  min-width: 10.5rem;
  border-radius: 999px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #0c0f14;
  background: #6ee7b7;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.ss-home-btn:hover {
  filter: brightness(1.06);
}
.ss-home-btn:active {
  transform: scale(0.97);
}
.ss-home-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.ss-end-inner {
  gap: 1.15rem;
}

.ss-end-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ss-fg);
}

.ss-end-msg {
  font-weight: 500;
}

.ss-end-btns {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  width: 100%;
  margin-top: 0.35rem;
}

.ss-end-btns[hidden] {
  display: none !important;
}

a.ss-end-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-decoration: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

a.ss-end-btn i {
  font-size: 1.05em;
  line-height: 1;
}

.ss-share {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  width: 100%;
}
.ss-share[hidden] {
  display: none !important;
}
.ss-share-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
}
.ss-share-main i {
  font-size: 1.05em;
  line-height: 1;
}
.ss-share-channels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}
.ss-share-channels[hidden] {
  display: none !important;
}
.ss-share-ch[hidden] {
  display: none !important;
}
.ss-share-ch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--ss-card-border);
  background: var(--ss-card-bg);
  color: var(--ss-fg);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.ss-share-ch i {
  font-size: 0.95em;
}
.ss-share-err[hidden] {
  display: none !important;
}

#ss-root:not([data-ss-view="home"]) #ss-home {
  display: none !important;
}

/* 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: var(--ss-like);
  border-radius: 50%;
  animation: ss-spin 0.75s linear infinite;
  margin-bottom: 1rem;
}
.ss-app--light-bg .ss-spinner {
  border-color: rgba(20, 24, 32, 0.14);
  border-top-color: var(--ss-like);
}
@keyframes ss-spin {
  to {
    transform: rotate(360deg);
  }
}

.ss-muted {
  color: var(--ss-muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0;
}

.ss-card {
  background: var(--ss-card-bg);
  border: 1px solid var(--ss-card-border);
  border-radius: 1.25rem;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  color: var(--ss-fg);
}

.ss-card--message {
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Session complete: same footprint as the main card (cover + copy), uses round default or app placeholder via JS */
.ss-card--message.ss-card--complete {
  padding: 0;
  text-align: center;
}
.ss-empty-cover-wrap {
  width: min(15.5rem, 72vw);
  aspect-ratio: 1;
  margin: 0 auto;
  background: linear-gradient(145deg, #2a3548, #1a2230);
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
}
.ss-empty-cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.ss-card--complete .ss-complete-copy {
  padding: 1.25rem 1.5rem 1.65rem;
}
.ss-card--complete .ss-title {
  text-align: center;
}

@media (max-width: 1023.98px) {
  .ss-card.ss-card--complete {
    width: 100%;
    max-width: min(20rem, 100%);
  }
}

/* Finished round: hide vote tally above the card */
#ss-root[data-ss-view="complete"] .ss-limits-strip--root {
  display: none !important;
}

.ss-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--ss-fg);
}

/*
 * Deck: no default display:flex — only while data-ss-view=deck. Prevents [hidden] vs author display fights.
 */
#ss-root:not([data-ss-view="deck"]) #ss-deck-wrap {
  display: none !important;
}

#ss-root[data-ss-view="deck"] #ss-deck-wrap {
  display: flex !important;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 22rem;
}

@media (min-width: 900px) {
  #ss-root[data-ss-view="deck"] #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: var(--ss-topbar);
  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: var(--ss-muted);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  background: var(--ss-user-bg);
  border: 1px solid var(--ss-user-border);
}

.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: var(--ss-pill-bg);
  border: 1px solid var(--ss-like-border);
  color: var(--ss-like);
  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: var(--ss-pill-bg);
  color: var(--ss-pill-fg);
  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: var(--ss-banner-bg);
  border: 1px solid var(--ss-banner-border);
  color: var(--ss-banner-fg);
  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;
  color: var(--ss-fg);
}

.ss-track-artist {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ss-artist);
  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: var(--ss-dislike-bg);
  border-color: var(--ss-dislike-border);
  color: var(--ss-dislike);
}

.ss-btn--like {
  background: var(--ss-like-bg);
  border-color: var(--ss-like-border);
  color: var(--ss-like);
}

.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;
}
