:root {
  --bg: #121418;
  --panel: #1b1e24;
  --panel-2: #242832;
  --text: #eef0f4;
  --muted: #9aa3b2;
  --accent: #5ad19b;
  --accent-text: #08130e;
  --danger: #ff6b6b;
  --border: #2d323d;
  --radius: 12px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel-2: #eceef2;
    --text: #15181d;
    --muted: #5d6573;
    --accent: #1f9d68;
    --accent-text: #ffffff;
    --border: #dde0e6;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}
body.plain main { padding: 48px 0; }
button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  min-height: 40px;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
button.big { font-size: 1.2rem; padding: 16px 28px; }
button.round { width: 64px; height: 64px; font-size: 1.6rem; padding: 0; }
button.icon { min-height: 36px; padding: 4px 10px; }
input {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: .9rem; }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 380px;
  display: grid; gap: 10px;
}
.card h1 { margin: 0; font-size: 1.4rem; }
.card p { margin: 0; color: var(--muted); }

.top {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; justify-content: space-between;
  padding: 14px 0 8px;
}
.title { display: grid; min-width: 0; }
.title strong { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people { color: var(--muted); font-size: .85rem; }
.modes { display: flex; gap: 4px; background: var(--panel); border-radius: 999px; padding: 3px; border: 1px solid var(--border); }
.modes button { border: 0; background: transparent; min-height: 34px; padding: 4px 12px; font-size: .9rem; }
.modes button.active { background: var(--accent); color: var(--accent-text); }

.now {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
}
#np-cover { width: 96px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.np-info { min-width: 0; }
.np-title { font-weight: 600; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-artist { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-output { font-size: .85rem; margin-top: 4px; color: var(--muted); }
.np-bar { grid-column: 1 / -1; display: grid; grid-template-columns: 3.2em 1fr 3.2em; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); }
.np-bar span:last-child { text-align: right; }
#np-seek { padding: 0; accent-color: var(--accent); background: none; border: 0; }
.controls { grid-column: 1 / -1; display: flex; justify-content: center; gap: 18px; align-items: center; }
.controls button:not(.round) { width: 48px; height: 48px; padding: 0; font-size: 1.2rem; }
.device { grid-column: 1 / -1; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 8px; scrollbar-width: none; }
.tabs button { white-space: nowrap; }
.tabs button.active { background: var(--accent); color: var(--accent-text); border-color: transparent; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 6px; }
.section-title h2 { font-size: 1rem; margin: 0; color: var(--muted); font-weight: 600; }
.back { margin: 6px 0; }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
ul.list li.clickable { cursor: pointer; }
ul.list li.clickable:hover { background: var(--panel); }
ul.list img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
.li-text { min-width: 0; }
.li-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-actions { display: flex; gap: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tile { cursor: pointer; min-width: 0; }
.tile img { width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.tile .li-title { font-size: .95rem; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 18px; z-index: 20; max-width: calc(100% - 32px);
}
.toast.error { border-color: var(--danger); }

@media (max-width: 480px) {
  .now { grid-template-columns: 72px 1fr; }
  #np-cover { width: 72px; height: 72px; }
  .modes button { padding: 4px 9px; font-size: .85rem; }
}
