:root {
  --bg: #050a0d;
  --surface: rgba(12, 16, 22, 0.92);
  --surface-2: rgba(15, 20, 28, 0.88);
  --surface-3: rgba(20, 25, 35, 0.85);
  --text: #f4f7fb;
  --muted: #9bb2c5;
  --muted-2: #5d6f81;
  --accent: #af2896;
  --accent-2: #d86df0;
  --accent-press: #861f70;
  --accent-glow: rgba(175, 40, 150, 0.35);
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.12);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  /* Dot grid — SVG solid circles, NO CSS gradient */
  --dot-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Ccircle cx='2' cy='2' r='1.5' fill='%231db954' fill-opacity='0.12'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 15, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9999;
}

.content-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
  z-index: 9996;
}

.content-overlay.is-hide,
body.content-visible .content-overlay {
  opacity: 0;
  pointer-events: none;
}

.pwa-tip {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translate(-50%, -40px);
  background: rgba(10, 14, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 18px;
  width: min(520px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  opacity: 0;
  z-index: 9000;
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.pwa-tip.is-visible { opacity: 1; transform: translate(-50%, 0); top: 20px; }

.pwa-tip.is-hiding {
  opacity: 0;
  transform: translate(-50%, -40px);
}

.pwa-tip button {
  margin-top: 10px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  font-size: 12px;
  padding: 6px;
}

.pwa-tip button:focus-visible { outline: 2px solid var(--accent); }

.pwa-tip-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-inline-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  align-items: center;
  justify-content: center;
  margin: 0 4px;
  color: var(--accent-2);
}

.pwa-splash {
  position: fixed;
  inset: 0;
  background: #04050d;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  overflow: hidden;
}


.pwa-splash.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pwa-splash.is-hide {
  opacity: 0;
  pointer-events: none;
}

.pwa-splash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 1);
  z-index: 1;
  animation: splashOverlayFade 0.5s ease forwards;
}

body.splash-active {
  overflow: hidden;
}

body.splash-active .app-shell,
body.splash-active #player {
  opacity: 0;
  pointer-events: none;
}

body.splash-active .pwa-splash {
  opacity: 1;
  pointer-events: auto;
}

.pwa-splash__icon {
  width: 78px;
  height: 78px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: floatIcon 2.6s ease-in-out infinite;
}

.pwa-splash__icon img { width: 46px; height: 46px; }

.pwa-splash__title {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fadeUp 1.2s ease forwards;
}

.pwa-splash__subtitle {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-family: 'Damion', cursive;
  opacity: 0;
  animation: fadeUp 1.4s ease forwards;
}

.pwa-splash__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: brightness(0.4);
}

.pwa-splash__icon,
.pwa-splash__title,
.pwa-splash__subtitle {
  position: relative;
  z-index: 2;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashOverlayFade {
  from { background: rgba(0, 0, 0, 1); }
  to { background: rgba(0, 0, 0, 0.4); }
}

.loading-overlay[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.loading-spinner {
  width: 54px;
  height: 54px;
  border: 5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-overlay p {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

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

a { color: inherit; text-decoration: none; }

/* ================================================================
   LOGIN
   ================================================================ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px 16px;
  background-color: #050a0d;
  background-image:
    linear-gradient(90deg, rgba(175, 40, 150, 0.4), rgba(80, 155, 245, 0.35)),
    linear-gradient(140deg, rgba(5, 10, 13, 0.7), rgba(7, 16, 21, 0.5)),
    var(--dot-grid),
    url('../bg-sp.jpg');
  background-size: cover, auto, cover;
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: center top, 0 0, center top;
  background-attachment: fixed, scroll, fixed;
  position: relative;
  overflow: hidden;
}

/* Decorative large solid circles — NO gradient */


.login-card {
  position: relative;
  z-index: 1;
  background: rgba(12, 14, 30, 0.6);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(175, 40, 150, 0.12) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  justify-content: center;
}

.login-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.login-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.login-logo h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

.login-subtitle {
  margin: 6px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 360px;
  align-items: center;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.input-wrap { position: relative; }

.input-wrap > svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  /* 16px prevents iOS auto-zoom */
  padding: 13px 44px 13px 40px;
  color: var(--text);
  font-size: 16px !important;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  display: block;
}

.input-wrap input::placeholder { color: var(--muted-2); }

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 10px 8px;
  cursor: pointer;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s;
}

.toggle-pass svg { width: 18px; height: 18px; display: block; }
.toggle-pass .icon-eye-off { display: none; }

.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 70, 90, 0.08);
  border: 1px solid rgba(255, 70, 90, 0.25);
  color: #ff7088;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 4px;
}

.login-error svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Spotify-style gradient CTA */
.submit-btn {
  margin-top: 8px;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #af2896, #509bf5);
  border: none;
  color: #000;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
  width: 100%;
}

.submit-btn:hover { filter: brightness(1.08); }
.submit-btn:active { transform: scale(0.99); }

/* Login — tablet+ */
@media (min-width: 480px) {
  .login-card { padding: 44px 40px; max-width: 400px; border-radius: 22px; }
  .login-logo h1 { font-size: 23px; }
  .login-logo-icon { width: 48px; height: 48px; }
  .input-wrap input { font-size: 15px; padding: 12px 44px 12px 40px; }
  .submit-btn { padding: 13px 20px; font-size: 15px; width: auto; }
}

/* ================================================================
   APP LAYOUT
   ================================================================ */

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 0 155px;
  background-color: #050a0d;
  background-image:
    linear-gradient(90deg, rgba(175, 40, 150, 0.4), rgba(80, 155, 245, 0.35)),
    radial-gradient(circle at top, rgba(10, 20, 24, 0.78), rgba(5, 10, 13, 0.85) 55%),
    var(--dot-grid),
    url('../bg-sp.jpg');
  background-size: cover, auto, cover;
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: center top, 0 0, center top;
  background-attachment: fixed, scroll, fixed;
}


.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) clamp(12px, 3vw, 32px) clamp(24px, 4vw, 40px);
  opacity: 1;
  transition: opacity 0.8s ease;
}

.app-shell > .app-header {
  margin-bottom: 18px;
}

.app-shell main {
  width: 100%;
  margin-top: 12px;
}

.app-shell main section {
  background: rgba(6, 10, 15, 0.78);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: clamp(10px, 2vw, 20px) clamp(20px, 4vw, 40px) clamp(20px, 4vw, 40px);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}

@media (min-width: 640px)  { .app-body { padding: 0 clamp(24px, 4vw, 64px) 185px; } }
@media (min-width: 1024px) { .app-body { padding: 0 clamp(40px, 5vw, 72px) 205px; } }

/* ================================================================
   HEADER
   ================================================================ */

.app-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 22px clamp(12px, 3vw, 32px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 10, 15, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

@media (min-width: 640px) { .app-header { padding: clamp(18px, 3vw, 28px) clamp(24px, 5vw, 48px); } }

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.header-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
  padding: 1px;
  background: #ffffff4d;
}

.brand-icon img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 10px; }

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--text);
}

@media (min-width: 640px) {
  .brand { gap: 12px; }
  .brand-icon { width: 48px; height: 48px; border-radius: 10px; }
  .brand-title { font-size: 20px; }
}

/* Logout btn — icon-only on mobile */
.reload-btn,
.notice-btn,
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  text-decoration: none;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.04);
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.reload-btn svg,
.logout-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.logout-label { display: none; }
.notice-btn {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.menu-btn {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn span {
  display: block;
  width: 16px;
  height: 1.8px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5.8px) rotate(45deg);
}
.menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5.8px) rotate(-45deg);
}
.mobile-header-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 180px;
  border-radius: 14px;
  border: 1px solid var(--border-light);
  background: rgba(10, 14, 24, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.mobile-header-menu[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  padding: 10px 12px;
  font-family: inherit;
  cursor: pointer;
  transform: translateY(6px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.mobile-menu-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.mobile-header-menu[aria-hidden="false"] .mobile-menu-item {
  transform: translateY(0);
  opacity: 1;
}
.mobile-header-menu[aria-hidden="false"] .mobile-menu-item:nth-child(1) { transition-delay: 0.03s; }
.mobile-header-menu[aria-hidden="false"] .mobile-menu-item:nth-child(2) { transition-delay: 0.06s; }
.mobile-header-menu[aria-hidden="false"] .mobile-menu-item:nth-child(3) { transition-delay: 0.09s; }

.notice-inline-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  vertical-align: text-bottom;
  margin: 0 4px;
}
.notice-inline-icon svg {
  width: 16px;
  height: 16px;
}
.mobile-menu-item--reload,
.mobile-menu-item--logout { text-align: left; }

@media (min-width: 480px) {
  .notice-btn { width: 32px; height: 32px; font-size: 14px; }
  .reload-btn { padding: 8px 12px; }
  .logout-btn { gap: 7px; padding: 8px 14px 8px 12px; }
  .reload-btn,
  .logout-btn {
    width: auto;
    height: auto;
  }
  .reload-btn svg,
  .logout-btn svg { width: 14px; height: 14px; }
  .logout-label { display: inline; }
  .menu-btn,
  .mobile-header-menu {
    display: none;
  }
}

@media (max-width: 479.98px) {
  .notice-btn,
  .logout-btn {
    display: none;
  }
  .header-actions { gap: 8px; }
  .reload-btn { display: inline-flex; order: 1; }
  .menu-btn { order: 2; }
}

@media (hover: hover) {
  .menu-btn:hover,
  .mobile-menu-item:hover,
  .notice-btn:hover,
  .reload-btn:hover,
  .logout-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(175, 40, 150, 0.16);
  }
}

.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 9997;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.notice-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.notice-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 3, 8, 0.78);
}

.notice-modal__panel {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  border-radius: 18px;
  border: 1px solid var(--border-light);
  background: rgba(10, 14, 24, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  padding: 20px 18px;
}

.notice-modal__panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.notice-modal__list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.notice-modal__close {
  margin-top: 14px;
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.notice-modal__close:focus-visible,
.notice-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ================================================================
   LIBRARY HEADER
   ================================================================ */

.library-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0 16px;
}

@media (min-width: 640px) { .library-header { margin: 0 0 20px; } }

.library-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* Solid accent pill badge — NO gradient */
.library-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  line-height: 18px;
}

/* ================================================================
   TRACK GRID
   ================================================================ */

.track-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 480px) { .track-grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); } }
@media (min-width: 640px) { .track-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; } }

/* ================================================================
   TRACK CARD
   ================================================================ */

.track-card {
  position: relative;
  --track-bg-img: none;
  --track-overlay: linear-gradient(145deg, rgba(5, 8, 12, 0.65), rgba(8, 12, 20, 0.35));
  background-color: var(--surface-2);
  background-image: var(--track-bg-img, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s;
  text-align: left;
  overflow: hidden;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}

.track-card > * {
  position: relative;
  z-index: 1;
}

/* Solid accent top stripe — NO gradient, shown on active/hover */
.track-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #af2896, #509bf5);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 2;
}

.track-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  background: var(--track-overlay);
  border-radius: inherit;
  transition: background 0.2s;
  pointer-events: none;
  z-index: 0;
}

@media (hover: hover) {
  .track-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35);
    --track-overlay: linear-gradient(145deg, rgba(5, 8, 12, 0.55), rgba(8, 12, 20, 0.28));
  }
  .track-card:hover::before { opacity: 0.55; }
  .track-card:hover .track-card-icon { color: var(--muted); }
}

.track-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.track-card.active {
  --track-overlay: linear-gradient(145deg, rgba(8, 14, 24, 0.6), rgba(10, 20, 32, 0.25));
  /* Solid double-border effect, NO gradient */
  box-shadow: 0 0 0 1px var(--accent), 0 12px 42px var(--accent-glow);
}

.track-card.active::before { opacity: 1; }

@media (min-width: 640px) {
  .track-card { padding: 18px; border-radius: 16px; }
}

.track-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.track-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
}

.track-card.active .track-tag { color: var(--accent-2); }

.track-card-icon {
  width: 18px;
  height: 18px;
  color: #fff;
  transition: color 0.2s;
  flex-shrink: 0;
}

.track-card.active .track-card-icon { color: var(--accent); }

@media (min-width: 640px) { .track-card-icon { width: 20px; height: 20px; } }

.track-card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  gap: 12px;
}

/* Big bold numbers — the main visual statement of each card */
.track-num {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}

.track-card.active .track-num { color: var(--accent-2); }

@media (min-width: 640px) { .track-num { font-size: 50px; } }

/* Playing bars */
.playing-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 22px;
  opacity: 0;
  transition: opacity 0.3s;
  padding-bottom: 2px;
  margin-left: auto;
}

.track-card.active .playing-bars { opacity: 1; }

.playing-bars span {
  display: block;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  height: 5px;
}

.audio-playing .track-card.active .playing-bars span:nth-child(1) { animation: bar-anim 0.65s ease-in-out infinite alternate; }
.audio-playing .track-card.active .playing-bars span:nth-child(2) { animation: bar-anim 0.65s ease-in-out 0.12s infinite alternate; }
.audio-playing .track-card.active .playing-bars span:nth-child(3) { animation: bar-anim 0.65s ease-in-out 0.24s infinite alternate; }
.audio-playing .track-card.active .playing-bars span:nth-child(4) { animation: bar-anim 0.65s ease-in-out 0.08s infinite alternate; }

@keyframes bar-anim {
  from { height: 4px; }
  to { height: 20px; }
}

/* ================================================================
   PLAYER
   ================================================================ */

.player {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 50px;
  background: rgba(12, 15, 24, 0.3);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.3), 0 20px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(60px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  overflow: hidden;
  padding-top: 6px;
}

.player.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (min-width: 640px) { .player { left: 16px; right: 16px; bottom: 16px; padding-top: 10px; } }

/* ── Seek bar — custom fill element, NO gradient ── */
.seek-wrap {
  position: relative;
  cursor: pointer;
  margin: 11px 14px 7px;
}

/* Visual track: plain solid dark bar */
.seek-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(124, 132, 210, 0.35);
  overflow: hidden;
}

/* Filled portion: solid accent color, width updated by JS */
.seek-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f472b6, #60a5fa);
  border-radius: inherit;
}

/* Range input overlays the track for interaction, fully transparent */
#seekBar {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + -2px);
  transform: translateY(-50%);
  width: 100%;
  height: 32px; /* extended touch area */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  border: none;
  margin: 0;
  padding: 0;
}

/* Thumb: always visible on touch, appears on hover on desktop */
#seekBar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffe29a;
  border: 2px solid rgba(17, 25, 58, 0.8);
  box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.3);
  cursor: pointer;
  margin-top: 11px;
}

#seekBar::-webkit-slider-runnable-track {
  height: 32px;
  background: transparent;
}

.seek-wrap:hover .seek-fill { background: linear-gradient(90deg, #f687b3, #7dd3fc); }

/* ── Player body — mobile: 2-col + speed row ── */
.player-body {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 12px 10px;
}

.player-info  { grid-column: 1 / 2; display: flex; align-items: center; gap: 8px; min-width: 0; }
.player-controls { grid-column: 2 / 3; display: flex; justify-content: center; align-items: center; gap: 4px; }
.player-right { grid-column: 3 / 4; display: flex; justify-content: flex-end; align-items: center; }

.player-thumb { display: none; }
.now-playing-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 1px;
}

/* Player body — tablet+: 3-column */
@media (min-width: 640px) {
  .player-body {
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    padding: 14px 20px 16px;
  }
  .player-info     { grid-column: auto; gap: 12px; }
  .player-controls { grid-column: auto; gap: 6px; }
  .player-right    { grid-column: auto; justify-content: flex-end; }

  .player-thumb {
    display: flex;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgb(175 40 150);
    border: 1.5px solid var(--border-light);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
  }
  .player-thumb svg { width: 18px; height: 18px; }

  .now-playing-label {
    font-size: 10px;
    margin: 0 0 2px;
  }
}

.player-meta { min-width: 0; }

.current-track {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-info {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

@media (min-width: 640px) {
  .current-track { font-size: 14px; }
  .time-info { font-size: 12px; }
}

/* Controls */
.ctrl-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.1s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .ctrl-btn:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
}

.ctrl-btn:active { transform: scale(0.9); }
.ctrl-btn svg { width: 18px; height: 18px; display: block; }

/* Solid accent play button — NO gradient */
#playPause {
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 18px var(--accent-glow);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

@media (min-width: 640px) { #playPause { width: 44px; height: 44px; } }

@media (hover: hover) {
  #playPause:hover { background: var(--accent-2); box-shadow: 0 6px 24px rgba(175, 40, 150, 0.45); }
}

#playPause:active { transform: scale(0.94); }
#playPause svg { width: 18px; height: 18px; display: block; }

#playPause .icon-pause { display: none; }
#playPause.is-playing .icon-play  { display: none; }
#playPause.is-playing .icon-pause { display: block; }
#playPause.is-loading { cursor: wait; }
#playPause.is-loading .icon-play,
#playPause.is-loading .icon-pause { opacity: 0; }
#playPause.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

/* Speed */
.speed-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  width: max-content;
}

@media (min-width: 640px) { .speed-control { align-items: center; } }

.player-right {
  align-items: center;
}

.speed-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

#speedControl {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border-light);
  border-radius: 999px;
  padding: 7px 26px 7px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238888a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
}

#speedControl:focus {
  border-color: var(--accent);
}

@media (max-width: 639px) {
  #speedControl {
    width: 100%;
    -webkit-appearance: menulist;
    appearance: menulist;
    background-image: none;
  }
}

