/* =====================================================================
   MY VIBES — iOS-style Glass UI
   ===================================================================== */

/* ============ TOKENS ============ */
:root {
  --bg: #05060a;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text: #f2f4f7;
  --dim: #9aa3b0;
  --accent: #34e08c;
  --accent-ink: #04281a;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --blur: 24px;
  --sat: 180%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* top safe-area strip */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--safe-t);
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 40;
}

/* ============ AMBIENT BACKGROUND BLOBS ============ */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  will-change: transform;
}
.b1 {
  width: 420px; height: 420px;
  background: #34e08c;
  top: -120px; left: -80px;
  animation: drift1 22s ease-in-out infinite alternate;
}
.b2 {
  width: 380px; height: 380px;
  background: #7c8cff;
  bottom: -100px; right: -60px;
  animation: drift2 26s ease-in-out infinite alternate;
}
.b3 {
  width: 300px; height: 300px;
  background: #ff7a59;
  top: 40%; left: 60%;
  animation: drift3 30s ease-in-out infinite alternate;
}
.b4 {
  width: 260px; height: 260px;
  background: #22c3d6;
  bottom: 20%; left: 10%;
  animation: drift4 28s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(60px, 40px) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-50px, -30px) scale(1.15); } }
@keyframes drift3 { to { transform: translate(-40px, 50px) scale(0.9); } }
@keyframes drift4 { to { transform: translate(30px, -40px) scale(1.05); } }

/* keep UI above blobs */
.sidebar, .main, .player, .toast { position: relative; z-index: 1; }

/* ============ RESET / BASE ============ */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ============ LOGO ============ */
.logo, .mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  background: linear-gradient(140deg, var(--accent), #1aa8a0);
  color: var(--accent-ink);
  box-shadow: 0 4px 16px rgba(52, 224, 140, 0.3);
}

/* ============ MOBILE LAYOUT (base) ============ */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tab-h) + var(--safe-b) + 160px);
}
.mobile-brand { padding: 4px 0 14px; }

/* ============ TOPBAR / SEARCH ============ */
.topbar {
  position: sticky;
  top: var(--safe-t);
  z-index: 10;
  margin: 0 -16px 14px;
  padding: 6px 16px 10px;
  background: rgba(5, 6, 10, 0.55);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(52, 224, 140, 0.15), 0 8px 24px rgba(0, 0, 0, 0.3);
}
.search-box i { color: var(--dim); }
.search-box input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.search-box input::placeholder { color: var(--dim); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ============ HERO ============ */
.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.hero-cover {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: linear-gradient(140deg, var(--accent), #1aa8a0);
  color: var(--accent-ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}
.hero-info { min-width: 0; }
.hero-info h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.hero-meta {
  color: var(--dim);
  font-size: 0.88rem;
  margin-top: 4px;
}

/* ============ ACTION BUTTONS ============ */
.actions { display: flex; gap: 10px; margin: 16px 0 10px; }
.btn {
  flex: 1;
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.12s, background 0.2s, box-shadow 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(52, 224, 140, 0.3);
  border-color: transparent;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ============ SONG LIST ============ */
.list-head { display: none; }
.song-list { display: flex; flex-direction: column; gap: 2px; }
.song-row {
  display: flex;
  align-items: center;
  border-radius: 16px;
  transition: background 0.15s, box-shadow 0.15s;
}
.song-row:active { background: rgba(255, 255, 255, 0.06); }
.song-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px;
  text-align: left;
  border-radius: 14px;
}
.s-idx, .s-album { display: none; }
.s-cover-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.s-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-eq {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 14px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.song-row.current .s-eq { display: flex; }
.s-eq i {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: bottom;
  transform: scaleY(0.35);
}
.song-row.playing .s-eq i { animation: eq 0.9s ease-in-out infinite; }
.s-eq i:nth-child(2) { animation-delay: 0.2s; }
.s-eq i:nth-child(3) { animation-delay: 0.4s; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}
.s-titlebox { display: flex; flex-direction: column; min-width: 0; }
.s-title, .s-artist, .p-title, .p-artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s-title { font-weight: 700; font-size: 0.97rem; }
.s-artist { color: var(--dim); font-size: 0.85rem; }
.song-row.current .s-title { color: var(--accent); }

.s-like, .p-like {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--dim);
  font-size: 1.05rem;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
.s-like.liked, .p-like.liked { color: var(--accent); }

/* ============ EMPTY STATE ============ */
.empty-msg {
  text-align: center;
  color: var(--dim);
  padding: 56px 24px;
}
.empty-msg i { font-size: 2.2rem; margin-bottom: 12px; }
.empty-msg h3 { color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

/* ============ ABOUT ============ */
.about h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 8px 0 10px;
}
.about h2 { font-size: 1.05rem; margin: 24px 0 10px; }
.about p, .about li { color: var(--dim); line-height: 1.6; }
.about ol { padding-left: 20px; display: grid; gap: 8px; }
.about code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85em;
}

/* ============ SIDEBAR / TAB BAR (mobile) ============ */
.sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(5, 6, 10, 0.6);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar .logo, .sidebar-footer { display: none; }
.nav { display: flex; height: 100%; }
.nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  transition: color 0.2s;
}
.nav-link i { font-size: 1.15rem; }
.nav-link.active { color: var(--text); }
.nav-link.active i { color: var(--accent); }

/* ============ PLAYER ============ */
.player {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "left btns" "seek seek";
  align-items: center;
  gap: 0 4px;
  padding: 10px 10px 12px 12px;
  border-radius: 24px;
  background: rgba(20, 24, 32, 0.65);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}
.p-center { display: contents; }
.p-left {
  grid-area: left;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.p-left img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.p-meta { min-width: 0; flex: 1; }
.p-title { font-size: 0.92rem; font-weight: 700; }
.p-artist { font-size: 0.78rem; color: var(--dim); }

.p-btns { grid-area: btns; display: flex; align-items: center; }
.p-btns button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 1rem;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
#shuffleBtn, #repeatBtn, .p-right { display: none; }
.p-btns button.on, .p-like:hover { color: var(--accent); }
.p-btns .play-btn {
  background: var(--text);
  color: #0a0c10;
  width: 46px;
  height: 46px;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

.seek-row {
  grid-area: seek;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.seekbar, .volbar {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  touch-action: none;
  cursor: pointer;
}
.seekbar::before, .volbar::before {
  content: '';
  position: absolute;
  inset: -14px 0;
}
.seek-fill, .vol-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--text);
}
.seek-fill { background: var(--accent); }
.seek-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 150px);
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 32px);
  background: rgba(30, 35, 45, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 20px;
  border-radius: 18px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ HOVER STATES (desktop) ============ */
@media (hover: hover) {
  .song-row:hover { background: rgba(255, 255, 255, 0.05); }
  .s-like:hover, .p-btns button:hover, .nav-link:hover { color: var(--text); }
  .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
}

/* ============ DESKTOP (>= 900px) ============ */
@media (min-width: 900px) {
  :root { --dock-h: 92px; }

  body { display: grid; grid-template-columns: 260px 1fr; }
  .mobile-brand { display: none; }

  .sidebar {
    position: sticky;
    top: 0;
    height: calc(100dvh - var(--dock-h));
    display: flex;
    flex-direction: column;
    padding: 28px 16px 16px;
    background: rgba(5, 6, 10, 0.4);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 0;
  }
  .sidebar .logo, .sidebar-footer { display: flex; }
  .logo { margin: 0 8px 28px; }

  .nav { flex-direction: column; height: auto; gap: 4px; }
  .nav-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
  }
  .nav-link i { width: 20px; text-align: center; font-size: 1rem; }
  .nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .sidebar-footer {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--dim);
    padding: 0 8px;
  }

  .main {
    width: 100%;
    max-width: 1040px;
    padding: 28px 40px calc(var(--dock-h) + 32px);
  }
  .topbar {
    margin: 0 -40px 20px;
    padding: 8px 40px;
    background: rgba(5, 6, 10, 0.45);
  }
  .search-box { max-width: 440px; }

  .hero { padding: 28px; gap: 24px; border-radius: 28px; }
  .hero-cover { width: 160px; height: 160px; font-size: 3.6rem; border-radius: 24px; }
  .hero-info h1 { font-size: clamp(2rem, 4vw, 3rem); }
  .btn { flex: none; padding: 0 28px; }
  .actions { margin: 20px 0 14px; }

  .list-head {
    display: grid;
    grid-template-columns: 32px 48px minmax(0, 1fr) minmax(120px, 0.7fr) 32px;
    gap: 12px;
    padding: 0 8px 10px;
    color: var(--dim);
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 6px;
  }
  .song-main {
    grid-template-columns: 32px 48px minmax(0, 1fr) minmax(120px, 0.7fr);
  }
  .s-idx {
    display: block;
    text-align: center;
    color: var(--dim);
    font-size: 0.9rem;
  }
  .s-album {
    display: block;
    color: var(--dim);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .song-row.current .s-idx { color: var(--accent); }

  .player {
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--dock-h);
    border-radius: 0;
    border-width: 1px 0 0;
    padding: 0 28px;
    gap: 24px;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 640px) minmax(160px, 1fr);
    grid-template-areas: none;
    background: rgba(10, 12, 16, 0.7);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  }
  .p-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .p-left, .p-btns, .seek-row { grid-area: auto; }
  .p-btns { gap: 12px; }
  #shuffleBtn, #repeatBtn { display: grid; }
  .p-btns .play-btn { width: 42px; height: 42px; }
  .seek-row { width: 100%; margin: 0; }
  .seek-dot { opacity: 0; transition: opacity 0.2s; }
  .seekbar:hover .seek-dot { opacity: 1; }
  .p-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
  }
  .p-right button { width: 40px; height: 40px; color: var(--dim); }
  .volbar { flex: none; width: 110px; }
  .toast { bottom: calc(var(--dock-h) + 16px); }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .blob { animation: none !important; }
}

.custom-logo-img {
  height: 1.2em; /* Adjust to match text height */
  width: auto;
  vertical-align: middle;
}
