/* Theme follows Telegram's CSS vars so the app adapts to user's color scheme. */
:root {
  --bg:        var(--tg-theme-bg-color, #0f0f10);
  --bg2:       var(--tg-theme-secondary-bg-color, #1a1a1c);
  --text:      var(--tg-theme-text-color, #f5f5f7);
  --hint:      var(--tg-theme-hint-color, #8e8e93);
  --link:      var(--tg-theme-link-color, #4fa3ff);
  --accent:    var(--tg-theme-button-color, #4fa3ff);
  --accent-fg: var(--tg-theme-button-text-color, #fff);
  --border:    rgba(127,127,127,.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,system-ui,sans-serif;
  overscroll-behavior-y: contain;
}
body {
  padding-bottom: calc(180px + env(safe-area-inset-bottom));
}

/* search bar */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px env(safe-area-inset-top, 10px);
  padding-top: calc(10px + env(safe-area-inset-top, 0));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.bar input[type=search] {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 15px; outline: none;
}
.bar input[type=search]::placeholder { color: var(--hint); }
.icon {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  width: 42px; height: 42px;
  font-size: 18px; cursor: pointer;
}
.icon.active { background: var(--accent); color: var(--accent-fg); border-color: transparent; }

/* track list */
#list { padding: 6px 8px 12px; }
.hint { padding: 32px 12px; color: var(--hint); text-align: center; }
.row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer; user-select: none;
}
.row:active { background: var(--bg2); }
.row.playing { background: var(--bg2); }
.cover {
  width: 48px; height: 48px; border-radius: 8px;
  background: var(--bg2) center / cover no-repeat;
  flex: 0 0 48px;
}
.txt { flex: 1; min-width: 0; }
.txt .t, .txt .a {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.txt .t { font-weight: 500; }
.txt .a { color: var(--hint); font-size: 13px; margin-top: 2px; }
.dur { color: var(--hint); font-size: 13px; flex: 0 0 auto; }

/* player */
footer#player {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}
footer#player.hidden { display: none; }
.meta { display: flex; flex-direction: column; min-width: 0; margin-bottom: 6px; }
.meta .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .artist { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

input#seek {
  width: 100%; margin: 4px 0 0;
  appearance: none; height: 4px; background: var(--border); border-radius: 2px; outline: none;
}
input#seek::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
}
input#seek::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: none;
}

.time {
  display: flex; justify-content: space-between;
  color: var(--hint); font-size: 12px; margin: 4px 2px 8px;
}

.controls {
  display: flex; gap: 4px; justify-content: center; align-items: center;
}
button.ctl {
  background: transparent; color: var(--text);
  border: none; cursor: pointer;
  font-size: 24px; line-height: 1; padding: 8px 12px;
  border-radius: 999px;
}
button.ctl:active { background: var(--border); }
button.ctl.play {
  background: var(--accent); color: var(--accent-fg);
  width: 56px; height: 56px; font-size: 24px;
  margin: 0 8px;
}
button.ctl.fav.on { color: #e6584b; }
