:root {
  color-scheme: dark;
  --bg: var(--tg-theme-bg-color, #101a20);
  --panel: var(--tg-theme-secondary-bg-color, #1b2930);
  --ink: var(--tg-theme-text-color, #f5f8f5);
  --muted: var(--tg-theme-hint-color, #9caeae);
  --line: color-mix(in srgb, var(--ink) 11%, transparent);
  --accent: #dbf77d;
  --accent-ink: #1a2911;
  --heart: #fb6584;
}
@media (prefers-color-scheme: light) {
  :root { color-scheme: light; --bg: var(--tg-theme-bg-color, #f7f8f5); --panel: var(--tg-theme-secondary-bg-color, #fff); --ink: var(--tg-theme-text-color, #17252a); --muted: var(--tg-theme-hint-color, #64747a); }
}
html[data-theme="dark"] { color-scheme: dark; --bg: #101a20; --panel: #1b2930; --ink: #f5f8f5; --muted: #9caeae; }
html[data-theme="light"] { color-scheme: light; --bg: #f7f8f5; --panel: #fff; --ink: #17252a; --muted: #64747a; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body { min-width: 280px; margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app { width: min(100%, 540px); margin: 0 auto; padding: env(safe-area-inset-top) 12px calc(20px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 8px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 22px; font-weight: 800; }
h1 { margin: 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 18px; letter-spacing: -.035em; font-weight: 760; }
.top-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.icon-button, .add-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 11px; }
.icon-button { background: transparent; color: var(--muted); font-size: 25px; }
.add-button { background: var(--accent); color: var(--accent-ink); font-size: 29px; line-height: 1; }
.sections { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 4px; border-bottom: 1px solid var(--line); }
.section-tab { display: flex; justify-content: center; align-items: center; gap: 5px; min-width: 0; min-height: 44px; padding: 6px 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 690; white-space: nowrap; }
.section-tab.active { border-bottom-color: var(--accent); color: var(--ink); }
.section-tab span { min-width: 20px; padding: 2px 5px; border-radius: 7px; background: var(--panel); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.section-tab.active span { background: var(--accent); color: var(--accent-ink); }
.list-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; color: var(--muted); font-size: 11px; }
.list-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-button { flex: 0 0 auto; min-height: 28px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.filter-button.active { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.demo-banner { margin: 0 0 7px; color: var(--muted); font-size: 10px; }
.tracks { border-top: 1px solid var(--line); }
.track-row { border-bottom: 1px solid var(--line); }
.row-line { display: grid; grid-template-columns: 42px minmax(0,1fr) 44px 28px; gap: 6px; align-items: center; min-height: 63px; padding: 7px 0; }
.cover-play { position: relative; display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; padding: 0; border: 0; border-radius: 8px; background: #334640; color: #fff; font-size: 18px; }
.cover-play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-play .play-glyph { z-index: 1; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: rgba(8,18,22,.67); text-shadow: 0 1px 2px #000; font-size: 12px; }
.song-copy { min-width: 0; overflow: hidden; }
.song-title, .song-artist, .song-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-title { font-size: 13.5px; font-weight: 720; line-height: 17px; }
.song-artist { margin-top: 1px; color: var(--muted); font-size: 11px; line-height: 14px; }
.song-meta { margin-top: 1px; color: var(--muted); font-size: 10px; line-height: 12px; }
.hot { color: #ffaf67; font-weight: 700; }
.like { display: flex; align-items: center; justify-content: center; gap: 2px; width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.like .heart { font-size: 23px; line-height: 1; }
.like.liked { color: var(--heart); }
.more { display: grid; place-items: center; width: 28px; min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.inline-player { padding: 0 0 10px 48px; }
.player { display: block; width: 100%; height: 188px; border: 0; border-radius: 9px; background: var(--panel); }
.player-link { display: inline-block; min-height: 30px; padding-top: 7px; color: var(--accent); font-size: 11px; text-decoration: none; }
.empty { margin: 0; padding: 30px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.archive-link { display: block; margin: 14px 0 0; padding: 5px 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; text-decoration: underline; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 10; background: rgba(2,9,11,.61); }
.sheet { position: fixed; z-index: 11; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%,540px); max-height: calc(90vh - env(safe-area-inset-top)); overflow: auto; padding: 8px 17px calc(20px + env(safe-area-inset-bottom)); border-radius: 19px 19px 0 0; background: var(--panel); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet-handle { width: 34px; height: 4px; margin: 0 auto 8px; border-radius: 3px; background: var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.sheet h2 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.close-button { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 26px; }
#suggest-form { display: grid; gap: 9px; margin: 10px 0 0; }
#track-url { width: 100%; height: 46px; min-width: 0; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--bg); color: var(--ink); font-size: 13px; }
#track-url:focus { border-color: var(--accent); }
#track-url::placeholder { color: var(--muted); opacity: 1; }
.submit-button { height: 46px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 760; }
.search-results { display: grid; gap: 7px; margin-top: 15px; }
.search-results[hidden] { display: none; }
.search-hint { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.search-result { display: grid; grid-template-columns: 42px minmax(0,1fr) 36px 42px; align-items: center; gap: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.search-cover { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 7px; object-fit: cover; background: #334640; color: var(--ink); }
.search-text { min-width: 0; }
.search-text strong, .search-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-text strong { font-size: 12px; }
.search-text span { color: var(--muted); font-size: 11px; }
.search-result a, .search-result button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--panel); color: var(--ink); text-decoration: none; font-size: 15px; }
.search-result button { width: 40px; height: 40px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.action-subtitle { margin: 0 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.action-list { display: grid; gap: 5px; }
.action-list button, .action-list a { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); font-size: 13px; text-align: left; text-decoration: none; }
.action-list .danger { color: #ff8c9c; }
.notice { position: fixed; z-index: 20; left: 50%; bottom: calc(17px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 24px), 420px); margin: 0; padding: 8px 11px; border-radius: 9px; background: var(--panel); color: var(--ink); box-shadow: 0 4px 22px rgba(0,0,0,.2); font-size: 12px; text-align: center; }
.notice.error { color: #ff9aa9; }
body.sheet-open { overflow: hidden; }
@media (max-width: 340px) { .app { padding-left: 9px; padding-right: 9px; } h1 { font-size: 16px; } .section-tab { font-size: 11.5px; } .row-line { gap: 5px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
