/* Layout: one phone-width column; content scrolls, a dock (mini player + tabs) is pinned to the bottom, full player slides up over everything. */
:root {
  --bg: #16112a;
  --surface: #211a39;
  --surface-2: #2d2450;
  --line: #3a3060;
  --fg: #f6f1ff;
  --muted: #ab9fc9;
  --accent: #ffb547;      /* marigold */
  --accent-ink: #2a1600;
  --rose: #ff6b8b;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --dock-h: 132px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { width: 24px; height: 24px; flex: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }

.app { max-width: 760px; margin: 0 auto; min-height: 100%; }
.view {
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px) + 24px);
  display: flex; flex-direction: column; gap: 28px;
}

/* ---------- headers & chips ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 28px; flex: 1; min-width: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font: 800 18px var(--font-display);
  background: linear-gradient(135deg, var(--accent), var(--rose)); color: var(--accent-ink);
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 16px; border-radius: 999px; background: var(--surface-2); white-space: nowrap;
  font-weight: 600; font-size: 14px;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--fg); flex: none; }
.icon-btn.on { color: var(--accent); }
.icon-btn.big svg { width: 30px; height: 30px; }
.icon-btn:active { transform: scale(.92); }

.section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section h2 { font-size: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link-btn { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- covers ---------- */
.cover {
  aspect-ratio: 1; width: 100%; max-width: 100%; border-radius: 6px; overflow: hidden; flex: none;
  display: grid; place-items: center; position: relative;
  font: 800 1.4em var(--font-display); color: rgba(255,255,255,.92); text-shadow: 0 1px 8px rgba(0,0,0,.25);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.round { border-radius: 50%; }
.cover svg { width: 42%; height: 42%; }

/* ---------- home quick grid ---------- */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 6px;
  overflow: hidden; text-align: left; min-width: 0; height: 56px;
}
.quick .cover { width: 56px; height: 56px; border-radius: 0; font-size: 18px; }
.quick b { font-size: 13px; font-weight: 700; line-height: 1.25; padding-right: 8px; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- picked card ---------- */
.picked { display: grid; grid-template-columns: 42% 1fr; background: var(--surface); border-radius: 10px; overflow: hidden; }
.picked .cover { border-radius: 0; font-size: 34px; }
.picked-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.picked-body small { color: var(--muted); }
.picked-body b { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.picked-actions { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 12px; }
.fab {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; flex: none; box-shadow: 0 6px 18px rgba(255,181,71,.25);
}
.fab svg { width: 24px; height: 24px; }
.fab.lg { width: 56px; height: 56px; }

/* ---------- horizontal shelves ---------- */
.shelf { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.shelf::-webkit-scrollbar { display: none; }
.card { width: 140px; flex: none; text-align: left; display: flex; flex-direction: column; gap: 8px; scroll-snap-align: start; }
.card .cover { font-size: 30px; }
.card b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -6px; }
.card.artist { align-items: center; text-align: center; }
.card.artist b { max-width: 100%; }

/* ---------- grids ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 14px; }
.tile-grid .card { width: auto; min-width: 0; }
.browse-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.browse {
  height: 96px; border-radius: 8px; padding: 12px; text-align: left; position: relative; overflow: hidden;
  font: 700 16px/1.2 var(--font-display); color: #fff; min-width: 0;
}
.browse span { position: relative; z-index: 1; display: block; max-width: 70%; overflow-wrap: anywhere; }
.browse i {
  position: absolute; right: -14px; bottom: -10px; width: 64px; height: 64px; border-radius: 6px;
  transform: rotate(24deg); box-shadow: 0 4px 14px rgba(0,0,0,.35); display: grid; place-items: center;
  background: rgba(255,255,255,.18);
}
.browse i svg { width: 28px; height: 28px; transform: rotate(-24deg); }

/* ---------- search ---------- */
.search-box {
  display: flex; align-items: center; gap: 10px; background: var(--fg); color: #1d1730;
  border-radius: 8px; padding: 0 14px; height: 48px;
}
.search-box input { flex: 1; border: 0; outline: 0; background: none; color: #1d1730; font-size: 16px; min-width: 0; }
.search-box input::placeholder { color: #6b6185; }
.seg { display: flex; gap: 8px; }
.note { color: var(--muted); font-size: 13px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 4px; }
.row {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
  padding: 6px 0; border-radius: 6px; cursor: pointer; min-width: 0;
}
.row .cover { width: 52px; height: 52px; font-size: 18px; border-radius: 4px; }
.row.big { grid-template-columns: 64px 1fr auto; }
.row.big .cover { width: 64px; height: 64px; }
.row-text { min-width: 0; display: flex; flex-direction: column; }
.row-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.playing .row-text b { color: var(--accent); }
.row:active { background: var(--surface); }
.row-text span.badge, .badge { display: inline-block; overflow: visible; line-height: 1.5; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); margin-right: 6px; vertical-align: 1px; }

/* ---------- library tools ---------- */
.lib-tools { display: flex; justify-content: space-between; align-items: center; margin-top: -12px; }
.sort-btn { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.sort-btn svg { width: 18px; height: 18px; }

/* ---------- detail ---------- */
.detail-head {
  margin: calc(-12px - env(safe-area-inset-top, 0px)) calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l));
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--gutter-r) 8px var(--gutter-l);
  background: linear-gradient(180deg, var(--tint) 0%, var(--bg) 100%);
  display: flex; flex-direction: column; gap: 14px;
}
.detail-head .big-cover { width: min(220px, 62vw); align-self: center; box-shadow: 0 14px 40px rgba(0,0,0,.45); font-size: 64px; }
.detail-head h1 { font-size: 26px; overflow-wrap: anywhere; }
.detail-meta { color: var(--muted); font-size: 13px; }
.detail-actions { display: flex; align-items: center; gap: 6px; }
.detail-actions .grow { flex: 1; }
.empty {
  background: var(--surface); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.empty h3 { font-size: 19px; }
.empty p { margin: 0; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: var(--rose); color: #2b0010; }
.btn svg { width: 20px; height: 20px; }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  background: linear-gradient(180deg, transparent 0, color-mix(in srgb, var(--bg) 92%, transparent) 40px, var(--bg) 100%);
}
.mini, .tabs { max-width: 760px; margin: 0 auto; }
.mini {
  margin: 0 8px; position: relative; display: flex; align-items: center; gap: 4px;
  background: var(--mini-bg, var(--surface-2)); border-radius: 8px; padding: 7px 6px 9px 7px; overflow: hidden;
  transition: background .4s;
}
@media (min-width: 776px) { .mini { margin: 0 auto; } }
.mini-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.mini-art { width: 42px; height: 42px; flex: none; }
.mini-art .cover { border-radius: 4px; font-size: 15px; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-text span { font-size: 12.5px; color: rgba(255,255,255,.72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 2px; background: rgba(255,255,255,.2); border-radius: 2px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--fg); }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 0 4px; }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); padding: 4px 0; }
.tabs button.on { color: var(--fg); font-weight: 600; }
.tabs button.on svg { stroke-width: 2.4; }

/* ---------- full player ---------- */
.fp {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  background: linear-gradient(180deg, var(--fp-tint, var(--surface-2)) 0%, var(--bg) 78%);
  transform: translateY(100%); visibility: hidden; transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s .32s;
}
.fp.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.fp-inner {
  max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 18px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(22px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) max(22px, env(safe-area-inset-left, 0px));
}
.fp-top { display: flex; align-items: center; gap: 8px; }
.fp-ctx { flex: 1; text-align: center; min-width: 0; display: flex; flex-direction: column; }
.fp-ctx small { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.7); }
.fp-ctx b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-art { margin: 18px 0 8px; }
.fp-art .cover { border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.5); font-size: 88px; }
.fp-meta { display: flex; align-items: center; gap: 12px; }
.fp-names { flex: 1; min-width: 0; }
.fp-names h2 { font-size: 23px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-names p { margin: 2px 0 0; color: rgba(255,255,255,.72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; margin: 8px 0 0;
  background: linear-gradient(90deg, var(--fg) var(--p, 0%), rgba(255,255,255,.22) var(--p, 0%));
}
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); border: 0; }
#seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--fg); border: 0; }
.fp-times { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.7); margin-top: -10px; font-variant-numeric: tabular-nums; }
.fp-ctrl { display: flex; align-items: center; justify-content: space-between; }
.play-big { width: 68px; height: 68px; border-radius: 50%; background: var(--fg); color: var(--bg); display: grid; place-items: center; }
.play-big svg { width: 30px; height: 30px; }
.play-big:active { transform: scale(.94); }
.fp-foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 10px; }
.pill-btn { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 13px; font-weight: 600; }
.pill-btn svg { width: 18px; height: 18px; }
.pill-btn.on { color: var(--accent); }
.dot-on { position: relative; }
.dot-on::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8,5,18,.66); }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 10px max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 18px) max(18px, env(safe-area-inset-left, 0px));
  animation: up .24s cubic-bezier(.2,.8,.2,1);
}
.sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.sheet-head .cover { width: 48px; height: 48px; font-size: 16px; }
.sheet-head > div:last-child { min-width: 0; }
.sheet-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head span { color: var(--muted); font-size: 13px; }
.sheet h3 { font-size: 20px; margin-bottom: 8px; }
.opt { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 2px; text-align: left; font-weight: 500; }
.opt .opt-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.opt small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.opt.plain { padding: 13px 2px; }
.opt.plain svg { color: var(--muted); }
.opt.on { color: var(--accent); }
.field { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 16px; outline: none; }
.field:focus { border-color: var(--accent); }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.sheet p { color: var(--muted); margin: 6px 0; }
.sheet .stat { color: var(--fg); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 70;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .25s;
  background: var(--fg); color: var(--bg); font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 8px;
  max-width: calc(100% - 32px); width: max-content; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
