:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: var(--page);
  color: var(--text);
  --page: #fff6f3;
  --text: #32151e;
  --muted: #684650;
  --surface: #fffdfa;
  --accent: #821c32;
  --ink: #fff7f3;
  --line: #d6b9bf;
  --veil: #32151e88;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #200e13;
  --text: #fff7f3;
  --muted: #dfc6c8;
  --surface: #321920;
  --accent: #ffc5b9;
  --ink: #391820;
  --line: #65414b;
  --veil: #14090dcc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 1220px; margin: auto; padding: 24px clamp(16px, 4vw, 56px) 36px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.theme-buttons { display: flex; gap: 5px; }
.theme-buttons button { min-width: 46px; padding-inline: 8px; font-size: 23px; }
h1, h2, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(28px, 5vw, 40px); }
h2 { font-size: clamp(20px, 3vw, 27px); }
p { color: var(--muted); line-height: 1.55; }
button { font: inherit; font-weight: 650; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 10px 17px; min-height: 52px; cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button[aria-pressed="true"], #toggle { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.transport { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 19px 22px; }
.now { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; flex: 1 1 330px; }
.now-copy { min-width: 0; flex: 1 1 110px; }
.now-copy > span { color: var(--muted); font-size: .85rem; }
#now-art .track-art { width: 64px; height: 64px; font-size: 30px; }
#now-lyrics, #now-favorite { min-height: 44px; padding: 7px 12px; }
#now-favorite, .track-heart { font-size: 23px; line-height: 1; }
.controls { display: flex; gap: 10px; }
.controls button { min-width: 68px; min-height: 62px; font-size: 26px; }
.seek-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; flex: 1 0 100%; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; color: var(--muted); }
#seek { margin: 0; padding: 0; height: 30px; accent-color: var(--accent); cursor: pointer; }
#seek:disabled { cursor: default; opacity: .55; }
.play-options { display: flex; flex-wrap: wrap; gap: 8px; }
.play-options button { min-height: 44px; padding: 6px 14px; font-size: .92rem; }
#play-status:empty, #favorite-sync-status:empty, #list-status:empty { display: none; }
#play-status:not(:empty), #favorite-sync-status:not(:empty) { width: 100%; }
.library { display: grid; grid-template-columns: minmax(180px, 1fr) 2.4fr; gap: 25px; padding-top: 23px; }
nav { display: grid; gap: 8px; align-content: start; }
nav h2 { font-size: 17px; color: var(--muted); margin-top: 14px; }
nav button { text-align: left; overflow-wrap: anywhere; }
.folder-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; align-items: stretch; padding: 5px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.folder-row > button:first-child { border-color: transparent; min-height: 48px; padding-inline: 10px; }
.folder-row.is-inactive { background: transparent; border-style: dashed; }
.folder-row.is-inactive > button:first-child { background: transparent; }
.folder-toggle { font-size: .83rem; padding-inline: 8px; min-height: 48px; }
.folder-row.is-inactive .folder-toggle { border-color: var(--accent); color: var(--accent); }
ul { list-style: none; margin: 12px 0 0; padding: 0; }
li { border-bottom: 1px solid var(--line); }
.track-row { display: flex; align-items: center; gap: 6px; }
.track-main { flex: 1; min-width: 0; background: transparent; border: none; text-align: left; padding: 8px 6px; display: flex; gap: 12px; align-items: center; overflow-wrap: anywhere; }
.track-main[aria-current="true"] { color: var(--accent); }
.track-main.unavailable { color: var(--muted); }
.track-art { position: relative; flex: 0 0 46px; height: 46px; display: grid; place-items: center; border-radius: 9px; overflow: hidden; background: #821c32; color: #fff5e3; font-size: 24px; }
.track-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.track-lyrics { flex-shrink: 0; min-height: 44px; font-size: .9rem; padding-inline: 10px; }
.track-heart { flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 4px 8px; }
small { display: block; margin-top: 3px; }
dialog, #phone { color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; max-width: min(500px, calc(100vw - 32px)); }
dialog::backdrop { background: var(--veil); }
dialog p, #phone p { margin: 9px 0 14px; }
#lyrics-dialog { width: min(660px, calc(100vw - 32px)); max-width: none; }
#lyrics-text { max-height: 55vh; overflow: auto; white-space: pre-wrap; font-size: clamp(18px, 2.5vw, 24px); color: inherit; }
#qr { width: min(280px, 100%); margin: auto; }
#pair-status { white-space: pre-line; }
#qr svg { display: block; width: 100%; height: auto; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
input { font: inherit; width: 100%; padding: 12px; margin-top: 12px; background: var(--page); color: inherit; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 660px) {
  .library { grid-template-columns: 1fr; gap: 15px; }
  nav { display: flex; flex-wrap: wrap; }
  nav h2 { flex: 1 0 100%; }
  .folder-row { flex: 1 1 225px; }
  .transport { padding: 13px; }
}
