:root {
  --bg: #0b0b10;
  --surface: #14141b;
  --surface-2: #1c1c26;
  --line: #262633;
  --text: #f3f3f7;
  --muted: #9b9bad;
  --accent: #ff6a3d;
  --accent-2: #ff3d7f;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --player-h: 92px;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--player-h) + env(safe-area-inset-bottom) + 24px);
}

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.25rem; letter-spacing: -0.01em; }
.logo {
  width: 28px; height: 28px; border-radius: 9px; background: var(--grad); position: relative; flex: none;
}
.logo::after {
  content: ""; position: absolute; left: 5px; top: 6px; width: 18px; height: 16px;
  background:
    linear-gradient(#fff, #fff) 0 100% / 4px 9px no-repeat,
    linear-gradient(#fff, #fff) 7px 100% / 4px 16px no-repeat,
    linear-gradient(#fff, #fff) 14px 100% / 4px 6px no-repeat;
  border-radius: 2px;
}
.logo.big { width: 56px; height: 56px; border-radius: 17px; }
.logo.big::after { left: 19px; top: 20px; transform: scale(2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  padding: 7px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 0.875rem; font-weight: 600;
}
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { width: 32px; height: 32px; }
svg { width: 22px; height: 22px; display: block; }
.stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--text); border-color: var(--accent); }

/* search + chips */
.search {
  display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 4px 2px 16px; margin-bottom: 12px;
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 10px 0; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 0.9rem; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }

.hint {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 6px 10px 14px; margin-bottom: 12px;
  font-size: 0.9rem; color: var(--muted);
}
.hint b { color: var(--text); }

.pill[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; }
.resume-btn { flex: 1; min-width: 0; text-align: left; padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* list */
.list { display: flex; flex-direction: column; gap: 4px; min-height: 40vh; }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; }
.row { display: flex; align-items: center; border-radius: var(--radius); }
.row:hover { background: var(--surface); }
.row .main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; text-align: left; border-radius: var(--radius); }
.row.current .title { color: var(--accent); }
.art {
  width: 48px; height: 48px; flex: none; border-radius: 10px; background: var(--surface-2); position: relative; overflow: hidden;
  display: grid; place-items: center; color: var(--muted); font-weight: 700;
}
.art::before { content: attr(data-ph); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.meta { min-width: 0; flex: 1; }
.title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { flex: none; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.badge.live { background: rgba(255, 61, 127, 0.16); color: var(--accent-2); letter-spacing: 0.04em; }
.heart { flex: none; }
.heart svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.heart.on { color: var(--accent-2); }
.heart.on svg { fill: var(--accent-2); }

/* player */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(20, 20, 27, 0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.progress { height: 3px; background: var(--line); position: relative; }
.seek { position: absolute; left: 0; right: 0; top: -12px; width: 100%; height: 26px; margin: 0; opacity: 0; cursor: pointer; touch-action: none; }
.fill { height: 100%; width: 0; background: var(--grad); transition: width 0.4s linear; }
.player-row {
  max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 76px;
}
.now { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.status { color: var(--accent); font-weight: 600; margin-right: 6px; }
.status:empty { display: none; }
.ctrls { display: flex; align-items: center; gap: 2px; }
.ctl { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.ctl svg { fill: currentColor; }
.ctl:hover { background: var(--surface-2); }
.ctl.main { background: var(--grad); color: #fff; width: 48px; height: 48px; margin: 0 4px; }
.vol { display: none; width: 90px; accent-color: var(--accent); }

/* login */
.login {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(255, 106, 61, 0.18), transparent), var(--bg);
}
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.login-card .logo { align-self: center; }
.login-card h2 { text-align: center; margin-bottom: 8px; }
.login-card label { color: var(--muted); font-size: 0.875rem; }
.login-card input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: 0;
}
.login-card input:focus { border-color: var(--accent); }
.err { color: var(--accent-2); min-height: 1.2em; font-size: 0.9rem; }
.primary { background: var(--grad); color: #fff; font-weight: 700; padding: 12px; border-radius: 12px; }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 40;
  bottom: calc(var(--player-h) + env(safe-area-inset-bottom) + 12px);
  max-width: min(92vw, 460px); background: var(--surface-2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; font-size: 0.9rem; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 720px) {
  .vol { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .fill, .toast { transition: none; }
}
