:root {
  --bg: var(--tg-theme-bg-color, #111114);
  --bg2: var(--tg-theme-secondary-bg-color, #1c1c22);
  --text: var(--tg-theme-text-color, #f2f2f5);
  --hint: var(--tg-theme-hint-color, #8b8b96);
  --accent: var(--tg-theme-button-color, #7c5cff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --heart: #ff4d6d;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 190px; overscroll-behavior-y: contain;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: currentColor; display: block; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 16px 8px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 12px; padding: 0 12px; }
.search svg { width: 18px; height: 18px; fill: var(--hint); flex: none; }
#q { flex: 1; min-width: 0; padding: 11px 0; border: 0; background: none; color: var(--text); font-size: 16px; outline: none; }
#q::-webkit-search-cancel-button { filter: grayscale(1); }
.tabs { display: flex; gap: 8px; padding-top: 10px; }
.tabs button { border: 0; background: var(--bg2); padding: 7px 14px; border-radius: 999px; font-size: 14px; }
.tabs button.active { background: var(--accent); color: var(--accent-text); }

h2 { font-size: 17px; font-weight: 650; padding: 18px 16px 6px; }
.empty { color: var(--hint); padding: 32px 24px; text-align: center; }

.track { display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 16px; cursor: pointer; }
.track:active { background: var(--bg2); }
.cover {
  flex: none; width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 700; font-size: 18px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h, 260) 70% 55%), hsl(calc(var(--h, 260) + 50) 65% 32%));
}
.meta { flex: 1; min-width: 0; }
.title, .artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist { color: var(--hint); font-size: 13px; margin-top: 1px; }
.track.playing .title { color: var(--accent); font-weight: 600; }
.dur { color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }
.like { border: 0; background: none; color: var(--hint); width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
.like svg { fill: none; stroke: currentColor; stroke-width: 2; width: 20px; height: 20px; }
.like.on { color: var(--heart); }
.like.on svg { fill: currentColor; }

.player {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 10;
  background: var(--bg2); border-radius: 18px; padding: 10px 12px 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.player.hidden { display: none; }
#seek { width: 100%; accent-color: var(--accent); height: 18px; margin-bottom: 6px; }
.prow { display: flex; align-items: center; gap: 12px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 6px; }
.time { color: var(--hint); font-size: 12px; font-variant-numeric: tabular-nums; width: 40px; text-align: center; }
.icon { border: 0; background: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.icon svg { width: 26px; height: 26px; }
.icon.big { background: var(--accent); color: var(--accent-text); width: 52px; height: 52px; }
.icon.big svg { width: 28px; height: 28px; }
.chip {
  display: block; margin: 8px auto 0; border: 0; background: none; color: var(--hint);
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
}
.chip.on { color: var(--accent); }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translate(-50%, -80px); transition: transform .25s;
  background: rgba(20, 20, 24, .92); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 20;
  font-size: 14px; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }
