:root {
  color-scheme: dark;
  --accent: #ff6b35;
  --text: #e8e8ee;
  --muted: #a0a8b0;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--text);
  font-family: system-ui, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

#app-shell {
  width: 393px;
  max-width: 100vw;
  height: 852px;
  max-height: 100vh;
  max-height: 100dvh;
  background: linear-gradient(180deg, #0c2d3a 0%, #152535 30%, #1e1530 62%, #28101e 100%);
  position: relative;
  overflow: hidden;
}

#contentPanel {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.centered-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 852px;
  background: #000;
}

.auth-box {
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 2rem;
  width: 320px;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin: 0 0 1.5rem;
}

.auth-logo img {
  max-width: 220px;
  height: auto;
}

.auth-box h1 {
  margin: 0 0 1.5rem;
  color: #fff;
  font-size: 1.6rem;
  text-align: center;
}

.auth-box form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-box form label {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 0.5rem;
}

.auth-box form label input {
  width: 100%;
}

.auth-box .error-msg {
  color: #ff6b6b;
  font-size: 0.85rem;
}

.auth-box .notice-msg {
  color: #3cb371;
  font-size: 0.85rem;
}

/* "Check your email" screen shown after Create Account while the account awaits verification */
.auth-box .verify-email-text {
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0 0 1rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.auth-box .verify-email-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.password-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.form-group + .password-hint {
  margin: -0.5rem 0 1rem;
}

/* Live password checks: red until the rules are met (or the confirmation matches), then green */
input.pw-invalid,
input.pw-invalid:focus {
  border: 1px solid #e05252;
  box-shadow: 0 0 0 1px #e05252;
  outline: none;
}

input.pw-valid,
input.pw-valid:focus {
  border: 1px solid #3cb371;
  box-shadow: 0 0 0 1px #3cb371;
  outline: none;
}

/* Password input with an inline "peek" (show/hide) toggle on its right edge */
.password-peek-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.password-peek-wrap input {
  width: 100%;
  padding-right: 2.25rem;
}

.password-peek-btn {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.password-peek-btn:hover,
.password-peek-btn[aria-pressed="true"] {
  color: var(--accent);
}

/* Blue gradient button — matches JFC/Swing "Back" nav button palette */
.auth-btn {
  width: 100%;
  background: linear-gradient(to bottom, #00a0d2, #005082);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
}

.auth-btn:hover {
  background: linear-gradient(to bottom, #00bed0, #006496);
}

/* ── App frame ─────────────────────────────────────────────────────────── */

.app-frame {
  display: flex;
  flex-direction: column;
  min-height: 852px;
}

/* ── Top bar ────────────────────────────────────────────────────────────── */

.top-bar {
  display: flex;
  flex-direction: column;
  background: transparent;
  padding: 0.75rem 1rem 0.5rem;
  gap: 0.75rem;
}

/* Account panel row */
.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.location-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: default;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: 0.01em;
}

.location-btn .location-arrow {
  font-size: 1rem;
  color: var(--muted);
}

.location-btn--pickable {
  cursor: pointer;
}

.location-logo {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

.location-offline-badge {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}

.credits-value {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  padding-left: 0.05rem;
}

.account-logo-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.account-logo-btn img {
  height: 42px;
  width: 42px;
  object-fit: contain;
  border-radius: 50%;
}

/* Now playing panel row */
.now-playing-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding-bottom: 0.25rem;
}

.now-playing-bar img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.now-playing-idle {
  flex: 1;
  min-width: 0;
}

.now-playing-idle .idle-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.now-playing-idle .idle-sub {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.85;
}

.now-playing-text {
  flex: 1;
  min-width: 0;
}

/* Song name with the "View Queue" button aligned on the same line */
.now-playing-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.now-playing-title-row .song-name,
.now-playing-title-row .idle-title {
  flex: 1;
  min-width: 0;
}

/* Tapping the currently playing song opens its album */
.now-playing-album-link {
  cursor: pointer;
}

.now-playing-text .song-name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-crawl-wrap {
  overflow: hidden;
  white-space: nowrap;
}

.now-playing-crawl {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--muted);
  animation: song-popup-crawl 14s linear infinite;
}

.now-playing-view-queue {
  background: none;
  border: none;
  color: #3a9fc0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* ── Search bar ─────────────────────────────────────────────────────────── */

.search-bar-wrap {
  padding: 0 1rem 0.5rem;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 0.6rem 1rem;
}

.search-bar .search-icon {
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.search-bar input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  flex: 1;
  outline: none;
  padding: 0;
}

.search-bar input::placeholder {
  color: var(--muted);
}

/* ── Home content ───────────────────────────────────────────────────────── */

.home-content {
  flex: 1;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Bottom tabs ────────────────────────────────────────────────────────── */

.bottom-tabs {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(0,0,0,0.35);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0.36rem 1rem;
  position: sticky;
  bottom: 0;
  gap: 1rem;
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  /* Every tab is filled (not just the active one) so it stays legible over the content scrolling
     beneath the translucent tab bar; the active tab is marked with a white ring instead. */
  background: #3a9fc0;
  color: #fff;
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.3rem 0.75rem;
  border-radius: 24px;
  letter-spacing: 0.02em;
}

.bottom-tab .tab-icon {
  font-size: 1rem;
  color: #fff;
}

.bottom-tab.active {
  box-shadow: 0 0 0 2px #fff;
}

/* ── Stub ───────────────────────────────────────────────────────────────── */

.stub-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.05em;
  padding: 2rem;
}

/* ── Home sections ──────────────────────────────────────────────────────── */

.home-sections {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem 0;
}

.home-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
}

.home-section-title {
  margin: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.home-section .stub-placeholder {
  flex: unset;
  padding: 1rem;
  font-size: 0.85rem;
}

/* ── Home section header with View All ──────────────────────────────────── */

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.home-section-header .home-section-title {
  border-bottom: none;
}

.home-section-view-all {
  background: none;
  border: none;
  color: #3a9fc0;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.6rem 0.9rem;
  letter-spacing: 0.03em;
}

/* ── Recent Plays thumbnails (home 3-up view) ───────────────────────────── */

.rp-thumb-row {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 0.75rem 0.85rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rp-thumb-row::-webkit-scrollbar {
  display: none;
}

.rp-thumb-card {
  flex: 0 0 calc(30% - 0.2rem);
  min-width: 0;
  scroll-snap-align: start;
}

.rp-thumb-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  margin-bottom: 0.35rem;
}

.rp-thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rp-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.rp-thumb-song {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-thumb-artist {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Recent Plays "View All" sub-screen ─────────────────────────────────── */

.recent-plays-all {
  padding: 0.5rem 0;
}

/* ── Sub-screens ────────────────────────────────────────────────────────── */

.sub-screen {
  display: flex;
  flex-direction: column;
  min-height: 852px;
}

.sub-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
}

.back-btn {
  background: none;
  border: none;
  color: #4ab8d8;
  font-size: 1.5rem;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.sub-title {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.sub-content {
  flex: 1;
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
}

/* My Account */
.account-funds-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.funds-icon {
  font-size: 2rem;
  background: rgba(74,184,216,0.2);
  border-radius: 8px;
  padding: 0.5rem;
  line-height: 1;
}

.funds-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.funds-amount {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
}

.menu-section-label {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 0.25rem 0.4rem;
  margin-top: 0.25rem;
}

.menu-list {
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.menu-row {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 1rem;
  border-radius: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  gap: 0.75rem;
  cursor: pointer;
}

.menu-row:last-child {
  border-bottom: none;
}

.menu-row-icon {
  font-size: 1.1rem;
  background: rgba(74,184,216,0.2);
  border-radius: 6px;
  padding: 0.3rem;
  flex-shrink: 0;
  line-height: 1;
}

.menu-row.danger .menu-row-label {
  color: #ff6b6b;
}

.danger-icon {
  background: rgba(255,80,80,0.2) !important;
}

.menu-row-label { flex: 1; }
.menu-row-arrow { color: var(--muted); font-size: 1.2rem; }

.logout-row {
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  width: 100%;
  color: var(--text);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  text-align: center;
  cursor: pointer;
}

/* Forms */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
}

.form-input:read-only { opacity: 0.55; }

.form-error {
  color: #ff6b6b;
  font-size: 0.85rem;
  min-height: 1.2rem;
  margin-bottom: 0.5rem;
}

.form-spacer { height: 4rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 393px;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
}

.form-btn {
  flex: 1;
  padding: 0.85rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.form-btn.cancel {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}

.form-btn.save {
  background: #4ab8d8;
  color: #000;
}

.form-btn.delete-btn {
  background: rgba(255,80,80,0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255,80,80,0.3);
}

/* Delete Account */
.delete-confirm-box {
  background: rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  margin: 1.5rem 0 1rem;
}

.delete-warning-icon { font-size: 3rem; margin-bottom: 0.75rem; }

.delete-warning-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

/* Add Funds content */
.add-funds-content {
  padding: 0.5rem 0 1rem;
}

.package-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
}

.package-card.selected {
  background: rgba(74,184,216,0.18);
  border-color: #4ab8d8;
}

.package-radio {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #4ab8d8;
}

.package-coin-icon { font-size: 1.8rem; flex-shrink: 0; }

.package-details { flex: 1; }

.package-credits-amount {
  font-size: 1.1rem;
  color: var(--text);
}

.package-bonus-tag {
  display: inline-block;
  background: #d97706;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-top: 0.2rem;
  letter-spacing: 0.03em;
}

.package-price-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.package-badge-label {
  background: rgba(74,184,216,0.25);
  color: #4ab8d8;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.2rem;
  white-space: nowrap;
}

.package-price-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.add-funds-action-btn {
  width: 100%;
  background: linear-gradient(90deg, #c0392b, #8e44ad);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 1rem;
  border-radius: 12px;
  margin-top: 1.25rem;
  letter-spacing: 0.03em;
  cursor: pointer;
}

/* ── Misc shared ────────────────────────────────────────────────────────── */

button {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem;
}

#queueList {
  list-style: none;
  padding: 0;
}

/* ── Search screen ──────────────────────────────────────────────────────── */

.search-screen {
  display: flex;
  flex-direction: column;
  height: 852px;
  overflow: hidden;
}

.search-top-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem 0.5rem;
  flex-shrink: 0;
}

.search-back-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 2rem;
  padding: 0 0.25rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.search-input-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 0.55rem 1rem;
  flex: 1;
}

.search-input-bar .search-icon {
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.search-input-display {
  flex: 1;
  color: var(--text);
  font-size: 0.95rem;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-input-display.placeholder {
  color: var(--muted);
}

.search-input-field {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.search-input-field::placeholder {
  color: var(--muted);
}

.search-input-field::-webkit-search-cancel-button,
.search-input-field::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear-btn {
  background: var(--text);
  border: none;
  border-radius: 50%;
  color: #1a1d22;
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  min-width: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

/* Recent searches */
.search-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 0.5rem;
}

.search-history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}

.search-history-item:hover {
  background: rgba(255,255,255,0.05);
}

.search-history-clock {
  font-size: 1.1rem;
  color: var(--muted);
  flex-shrink: 0;
}

.search-history-text {
  flex: 1;
  color: var(--text);
  font-size: 0.95rem;
}

.search-history-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 50%;
}

.search-history-remove:hover {
  color: var(--text);
  background: rgba(255,255,255,0.1);
}

/* ── Search results (tabbed) ────────────────────────────────────────────── */

.search-results-screen {
  display: flex;
  flex-direction: column;
  /* Must match #contentPanel's actual (possibly viewport-clamped, see #app-shell's
     max-height:100vh/100dvh) height exactly, not a hardcoded reference value -- otherwise on any
     viewport shorter than 852px this becomes taller than #contentPanel, making #contentPanel
     itself scrollable too and creating two competing nested scroll regions, which starves
     .search-tab-panel of the scroll gestures its own infinite-scroll listener depends on. */
  height: 100%;
}

.search-tabs-bar {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.search-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 0.25rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  border-radius: 0;
}

.search-tab.active {
  color: #4ab8d8;
  border-bottom-color: #4ab8d8;
}

.search-tab-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.search-tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0 1rem;
}

.search-tab-panel.active {
  display: block;
}

/* Result rows */
.result-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.result-row:hover {
  background: rgba(255,255,255,0.06);
}

.result-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
}

.result-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--muted);
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-sub {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.result-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1rem 0.3rem;
}

.search-empty {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem 1rem;
}

.result-menu-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Artist detail screen ───────────────────────────────────────────────── */

.artist-detail-counts {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.artist-tabs-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.artist-tab {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem;
  cursor: pointer;
}

.artist-tab.active {
  background: #3a9fc0;
  color: #fff;
}

.artist-sort-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.1rem 0.6rem;
}

.artist-sort-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.artist-tab-panels {
  margin: 0 -1rem;
}

.artist-tab-panel {
  display: none;
}

.artist-tab-panel.active {
  display: block;
}

/* ── Popularity bars (mirrors JFC/Swing PopularityBarsPanel) ──────────────── */

.popularity-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 24px;
  flex-shrink: 0;
}

.popularity-bar {
  width: 5px;
  border-radius: 2px;
  background: rgba(60, 60, 70, 0.47);
}

.popularity-bar:nth-child(1) { height: 9px; }
.popularity-bar:nth-child(2) { height: 13px; }
.popularity-bar:nth-child(3) { height: 18px; }

.popularity-bar.active:nth-child(1) { background: rgba(60, 210, 80, 0.71); }
.popularity-bar.active:nth-child(2) { background: rgba(60, 210, 80, 0.80); }
.popularity-bar.active:nth-child(3) { background: rgba(60, 210, 80, 0.90); }

/* ── Album detail screen ───────────────────────────────────────────────── */

.album-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0 1rem;
}

.album-detail-cover {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
}

.album-detail-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--muted);
}

.album-detail-header-info {
  min-width: 0;
}

.album-detail-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-detail-artist {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.album-detail-artist-link {
  cursor: pointer;
  text-decoration: underline;
}

.album-detail-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.album-track-list {
  margin: 0 -1rem;
}

.album-track-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.album-track-row:hover {
  background: rgba(255,255,255,0.06);
}

.album-track-num {
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.album-track-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Song bottom-sheet popup ─────────────────────────────────────────────── */

.song-popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  transition: background 0.3s ease;
  pointer-events: none;
}

.song-popup-overlay.song-popup-visible {
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
}

.song-popup {
  width: 100%;
  background: #14202e;
  border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}

.song-popup-overlay.song-popup-visible .song-popup {
  transform: translateY(0);
}

.song-popup-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin: 10px auto 12px;
  cursor: pointer;
}

.song-popup-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.song-popup-thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.song-popup-thumb-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.song-popup-meta {
  flex: 1;
  min-width: 0;
}

.song-popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
}

.song-popup-crawl-wrap {
  overflow: hidden;
  white-space: nowrap;
}

.song-popup-crawl {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--muted);
  animation: song-popup-crawl 14s linear infinite;
}

@keyframes song-popup-crawl {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Action rows */
.song-popup-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  cursor: pointer;
  gap: 0.75rem;
}

.song-popup-action:hover {
  background: rgba(255,255,255,0.04);
}

.song-popup-geo-note {
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.song-popup-action--icon {
  justify-content: flex-start;
}

.spa-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.spa-icon {
  font-size: 1.25rem;
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
  color: #4ab8d8;
}

.spa-credits {
  font-size: 0.95rem;
  font-weight: 700;
  color: #4ab8d8;
  white-space: nowrap;
}

.spa-credits--warn {
  color: #e05555;
}

.song-popup-action--warn .spa-label {
  color: #e05555;
}

/* A song the queue's rules refuse right now: both play actions greyed out, not tappable. */
.song-popup-action--disabled {
  opacity: 0.4;
  cursor: default;
}

.song-popup-action--disabled:hover {
  background: none;
}

/* ── Playlist tiles ─────────────────────────────────────────────────────── */

.playlist-tile-create-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 0.35rem;
}

/* ── My Playlists "View All" grid ───────────────────────────────────────── */

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  padding: 0.25rem 0 1rem;
}

.playlist-grid .rp-thumb-card {
  flex: unset;
  min-width: unset;
  scroll-snap-align: unset;
}

/* ── Playlist screens (view / edit track order / multi-select) ──────────── */

.sub-title-credits {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.1rem;
}

.sub-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
}

.sub-footer .bottom-tabs {
  position: static;
}

.playlist-sort-band {
  margin: -0.75rem -1rem 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(0,0,0,0.25);
}

.playlist-sort-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.playlist-sort-count {
  font-size: 0.9rem;
  color: #4ab8d8;
  margin-top: 0.1rem;
}

.playlist-view-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.playlist-select-multiple-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.playlist-select-multiple-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.playlist-edit-anchor {
  position: relative;
}

.playlist-edit-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.playlist-edit-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 190px;
  background: #1c2731;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 0.35rem 0;
}

.playlist-edit-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
}

.playlist-edit-menu-item:hover {
  background: rgba(255,255,255,0.06);
}

.playlist-song-list {
  margin: 0 -1rem;
}

.playlist-song-row,
.playlist-order-row,
.multi-select-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
}

.playlist-song-row,
.multi-select-row {
  cursor: pointer;
}

.playlist-song-row:hover,
.multi-select-row:hover {
  background: rgba(255,255,255,0.04);
}

/* Edit Track Order */
.playlist-order-row {
  position: relative;
  transition: transform 150ms ease;
}

.playlist-order-row.dragging {
  z-index: 2;
  transition: none;
  background: #1c3343;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

.playlist-order-remove {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #e53935;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
}

.playlist-order-remove span {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
}

.playlist-order-handle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 9px;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
}

.playlist-order-row.dragging .playlist-order-handle {
  cursor: grabbing;
}

.playlist-order-handle span {
  height: 2px;
  border-radius: 1px;
  background: var(--text);
}

/* Multi-Select Mode */
.multi-select-all {
  margin: -0.75rem -1rem 0.5rem;
  padding: 1rem;
  background: rgba(0,0,0,0.25);
}

.multi-select-all-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.ms-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #d8dde4;
  flex-shrink: 0;
  margin-right: 0.35rem;
  box-sizing: border-box;
}

.multi-select-row.selected .ms-circle {
  border-width: 3px;
  background: radial-gradient(circle, #d8dde4 0 5px, transparent 6px);
}

.multi-select-row.checking .ms-circle {
  border-color: rgba(216,221,228,0.25);
  border-top-color: #4ab8d8;
  animation: ms-spin 0.8s linear infinite;
}

@keyframes ms-spin {
  to { transform: rotate(360deg); }
}

/* Bottom action bars (Cancel/Save, Play N songs) */
.playlist-bottom-bar {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.playlist-bottom-bar[hidden] {
  display: none;
}

.playlist-bar-btn {
  flex: 1;
  padding: 0.85rem;
  border-radius: 10px;
  border: none;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.playlist-bar-btn.cancel {
  background: none;
  color: #4ab8d8;
}

.playlist-bar-btn.primary {
  background: linear-gradient(180deg, #5a3f8e, #9a2c44);
  color: #fff;
}

.playlist-bar-btn.primary.warn {
  background: rgba(224,85,85,0.15);
  border: 2px solid #e05555;
  color: #ff8a8a;
}

.playlist-bar-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Select Playlist sheet ──────────────────────────────────────────────── */

.select-playlist-sheet {
  max-height: 70vh;
  overflow-y: auto;
}

.select-playlist-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.25rem 1.25rem 0.9rem;
}

.select-playlist-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.select-playlist-row:hover {
  background: rgba(255,255,255,0.05);
}

.select-playlist-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.select-playlist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.select-playlist-create-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
}

.select-playlist-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Select Payment Method sheet ──────────────────────────────────────────── */

.payment-method-sheet {
  max-height: 80vh;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.payment-sheet-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  padding: 0.25rem 1.25rem 0.9rem;
}

.payment-method-row {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.payment-method-row-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.pmr-mount { min-height: 1px; }

.card-field {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  height: 42px;
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.card-field-row {
  display: flex;
  gap: 0.5rem;
}

.card-field-row .card-field {
  flex: 1;
}

.payment-method-row-btn {
  width: 100%;
  background: rgba(74,184,216,0.18);
  border: 1px solid #4ab8d8;
  color: #4ab8d8;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

.payment-method-row-btn:hover {
  background: rgba(74,184,216,0.3);
}

/* ── Transaction Successful screen ──────────────────────────────────────── */

.tx-success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
  gap: 0.5rem;
}

.tx-success-icon {
  font-size: 3rem;
  color: #4ab8d8;
  margin-bottom: 0.5rem;
}

.tx-success-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.tx-success-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
}

.tx-success-row--muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.tx-success-screen .add-funds-action-btn {
  margin-top: 2rem;
}

/* ── Themed dialogs (alert / confirm / prompt) ──────────────────────────── */

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-dialog-box {
  background: #13203a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.25rem;
  width: 340px;
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 4rem);
  display: flex;
  flex-direction: column;
}

.app-dialog-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.75rem;
}

.app-dialog-message {
  font-size: 0.95rem;
  line-height: 1.4;
  color: #c9d3e6;
  text-align: center;
  white-space: pre-line;
  overflow-y: auto;
  margin-bottom: 1.25rem;
}

.app-dialog-input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.app-dialog-input::placeholder {
  color: var(--muted);
}

.app-dialog-error {
  min-height: 1.1rem;
  margin: 0.35rem 0 0.6rem;
  font-size: 0.8rem;
  color: #ff6b6b;
  text-align: center;
}

.app-dialog-actions {
  display: flex;
  gap: 0.75rem;
}

.app-dialog-btn {
  flex: 1;
  padding: 0.8rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.app-dialog-btn.cancel {
  background: none;
  color: #4ab8d8;
}

.app-dialog-btn.primary {
  background: linear-gradient(180deg, #5a3f8e, #9a2c44);
  color: #fff;
}

.app-dialog-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ── Song Queue screen ──────────────────────────────────────────────────── */

.queue-now-playing-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.queue-now-playing-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.queue-now-playing-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.queue-now-playing-song {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.queue-now-playing-artist {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.queue-section-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 1rem 0 0.25rem;
}

.queue-song-list {
  margin: 0 -1rem;
}

.queue-song-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}

.queue-song-row:hover {
  background: rgba(255,255,255,0.04);
}

.queue-song-row.selected {
  background: rgba(58,159,192,0.15);
}

.queue-action-buttons {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 0 0.75rem;
}

.queue-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 52px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 0.5rem 0.35rem;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.queue-action-btn:disabled {
  cursor: default;
}

.queue-action-btn.state-grey {
  opacity: 0.4;
}

.queue-action-btn.state-normal {
  border-color: #3a9fc0;
  background: rgba(58,159,192,0.12);
}

.queue-action-btn.state-warn {
  border-color: #e05555;
  background: rgba(224,85,85,0.1);
  opacity: 0.85;
}

.qab-label {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.15;
}

.qab-sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffc800;
}

.queue-action-btn.state-warn .qab-sub {
  color: #e05555;
}

.queue-order-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgba(58,159,192,0.08);
  border: 1px solid rgba(58,159,192,0.3);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font-size: 0.8rem;
  color: #7fc4de;
  margin-top: 0.5rem;
}

.queue-order-note-icon {
  flex-shrink: 0;
}
