/* LetItSync styles.
   Visual design adapted from SYNCMYASS (github.com/freeman-jiang, MIT licence, see
   THIRD_PARTY_NOTICES.md): neutral dark theme, Inter + Geist Mono, white primary
   buttons, cyan highlights, green "now playing" accents, docked bottom player. */

/* ------------------------------------------------------------------ theme */
:root {
  --bg: #0a0a0a;             /* neutral-950 */
  --bg-2: #171717;           /* neutral-900 */
  --bg-3: #262626;           /* neutral-800 */
  --bg-4: #404040;           /* neutral-700 */
  --line: #262626;
  --line-soft: rgba(255, 255, 255, .08);
  --card: rgba(23, 23, 23, .85);
  --field: rgba(10, 10, 10, .7);
  --text: #fafafa;
  --text-2: #a3a3a3;         /* neutral-400 */
  --text-3: #737373;         /* neutral-500 */
  --primary: #ffffff;        /* white buttons */
  --on-primary: #0a0a0a;
  --accent: #22d3ee;         /* cyan-400 */
  --accent-2: #67e8f9;       /* cyan-300 */
  --accent-soft: rgba(34, 211, 238, .12);
  --on-accent: #0a0a0a;
  --play: #4ade80;           /* green: now playing */
  --good: #4ade80;
  --warn: #eab308;
  --bad: #f87171;
  --bad-strong: #dc2626;
  --scrim: rgba(0, 0, 0, .7);
  --topbar: rgba(0, 0, 0, .9);
  --mini-bg: rgba(23, 23, 23, .92);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, .55);
  --mini-h: 132px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff; --bg-2: #f5f5f5; --bg-3: #e5e5e5; --bg-4: #d4d4d4; --line: #e5e5e5; --line-soft: rgba(0, 0, 0, .08);
    --card: rgba(255, 255, 255, .9); --field: #fafafa;
    --text: #0a0a0a; --text-2: #525252; --text-3: #737373;
    --primary: #171717; --on-primary: #ffffff;
    --accent: #0891b2; --accent-2: #0e7490; --accent-soft: rgba(8, 145, 178, .1); --on-accent: #ffffff;
    --play: #16a34a; --good: #16a34a; --warn: #a16207; --bad: #dc2626; --bad-strong: #dc2626;
    --scrim: rgba(0, 0, 0, .35); --topbar: rgba(255, 255, 255, .9); --mini-bg: rgba(250, 250, 250, .94);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, .18);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ffffff; --bg-2: #f5f5f5; --bg-3: #e5e5e5; --bg-4: #d4d4d4; --line: #e5e5e5; --line-soft: rgba(0, 0, 0, .08);
  --card: rgba(255, 255, 255, .9); --field: #fafafa;
  --text: #0a0a0a; --text-2: #525252; --text-3: #737373;
  --primary: #171717; --on-primary: #ffffff;
  --accent: #0891b2; --accent-2: #0e7490; --accent-soft: rgba(8, 145, 178, .1); --on-accent: #ffffff;
  --play: #16a34a; --good: #16a34a; --warn: #a16207; --bad: #dc2626; --bad-strong: #dc2626;
  --scrim: rgba(0, 0, 0, .35); --topbar: rgba(255, 255, 255, .9); --mini-bg: rgba(250, 250, 250, .94);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, .18);
  color-scheme: light;
}

/* ------------------------------------------------------------------- base */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 400 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
::selection { background: #0e7490; color: #fff; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.error { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; font-size: 12px; }
.error:empty { display: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.ico { display: inline-grid; place-items: center; }
.ico svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 6px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--bg-4);
  font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--bg-4); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; font-weight: 600; }
.btn.primary:hover { opacity: .9; }
.btn.create { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.btn.create:hover { background: var(--accent-2); }
.btn.danger { background: var(--bad-strong); border-color: transparent; color: #fff; font-weight: 600; }
.btn.danger:hover { background: #ef4444; }
.btn.block { width: 100%; height: 48px; border-radius: 12px; }
.btn.small { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn svg, .btn .ico svg { width: 17px; height: 17px; }

.icon-btn { width: 40px; height: 40px; border-radius: 8px; flex: none; display: inline-grid; place-items: center; color: var(--text-2); transition: color .15s, background .15s; }
.icon-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.lg { width: 52px; height: 52px; }
.icon-btn.lg svg { width: 28px; height: 28px; }
.icon-btn:disabled { opacity: .4; pointer-events: none; }

.text-btn { font-size: 11px; font-weight: 500; color: var(--text-2); padding: 6px 10px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; }
.text-btn:hover { color: var(--text); background: var(--bg-3); }
.text-btn svg { width: 14px; height: 14px; }
.text-btn:disabled { opacity: .4; pointer-events: none; }
.text-btn.danger-text { color: var(--bad); }
.text-btn.danger-text:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }

.play-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; transition: transform .2s; }
.play-btn:hover { transform: scale(1.05); }
.play-btn svg { width: 18px; height: 18px; }
.play-btn.xl { width: 68px; height: 68px; }
.play-btn.xl svg { width: 28px; height: 28px; }

/* ------------------------------------------------------------------- home */
.screen { min-height: 100%; }
#home { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 100dvh; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); background: var(--bg); }
.home-top { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; }
.home-wrap { width: 100%; max-width: 384px; margin: 0 auto; animation: rise .35s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 14px; }
.brand-logo { width: 84px; height: 84px; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }

.join-card {
  border: 1px solid var(--line-soft); border-radius: 16px; padding: 20px;
  background: var(--card); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow);
}
.join-head { text-align: center; margin-bottom: 16px; }
.join-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.join-head p { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--text-2); }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 16px; border-radius: 12px; background: var(--field); border: 1px solid var(--line-soft); }
.seg-btn { height: 36px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); transition: background .15s, color .15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active[data-mode="join"] { background: var(--primary); color: var(--on-primary); }
.seg-btn.active[data-mode="create"] { background: var(--accent); color: var(--on-accent); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.field input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px;
  background: var(--field); border: 1px solid var(--bg-4); outline: none; font-size: 16px;
}
.field input::placeholder { color: var(--text-3); opacity: .7; }
.field input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--bg-4); }
.code-input { height: 56px !important; text-align: center; font: 700 20px var(--mono) !important; letter-spacing: .22em; padding-left: calc(14px + .22em) !important; text-transform: uppercase; }
.code-input::placeholder { letter-spacing: .14em; opacity: .45 !important; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.choice label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--field); border: 1px solid var(--line-soft); cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text-2); }
.choice label:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--text); }
.choice input { accent-color: var(--accent); margin: 0; }

.join-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--text) 3.5%, transparent); font-size: 11px; line-height: 1.6; color: var(--text-3); }
.join-note .ico { margin-top: 1px; color: var(--text-2); }
.join-note .ico svg { width: 14px; height: 14px; }

.recent { margin-top: 12px; padding: 12px; border-radius: 16px; border: 1px solid var(--line-soft); background: var(--card); }
.recent-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.recent-head .ico svg { width: 13px; height: 13px; }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent-row { display: flex; align-items: center; flex-wrap: wrap; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--field); padding-right: 4px; transition: background .15s; }
.recent-row:hover, .recent-row.open { background: color-mix(in srgb, var(--bg-3) 70%, transparent); }
.recent-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 6px 10px 12px; text-align: left; }
.recent-code { font: 600 14px var(--mono); letter-spacing: .1em; color: var(--text); min-width: 68px; }
.recent-meta { flex: 1; min-width: 0; color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-go { color: var(--text-3); transform: rotate(-90deg); display: grid; }
.recent-go svg { width: 16px; height: 16px; }
.recent-more { color: var(--text-3); }
.recent-actions { flex-basis: 100%; display: none; gap: 6px; padding: 0 8px 10px 12px; }
.recent-row.open .recent-actions { display: flex; }
.recent-actions .act { flex: 1; justify-content: center; }
.recent-actions .act.danger { margin-left: 0; }

/* ------------------------------------------------------------------- room */
#room { display: flex; flex-direction: column; height: 100%; height: 100dvh; background: var(--bg); }
.topbar {
  display: flex; align-items: center; gap: 6px; min-height: 52px; padding: calc(4px + var(--safe-t)) 8px 4px; flex: none;
  background: var(--topbar); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid #27272a; z-index: 5;
}
:root[data-theme="light"] .topbar { border-bottom-color: var(--line); }
.room-code { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px; border-radius: 8px; }
.room-code:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.room-code .label { font-size: 10px; }
.room-code b { font: 600 16px/1 var(--mono); letter-spacing: .14em; }
.share-ico svg { width: 14px; height: 14px; color: var(--text-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.status-btn { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--text) 4%, transparent); font: 500 11px var(--mono); color: var(--text-2); }
.status-btn:hover { color: var(--text); }
.status-btn svg { width: 13px; height: 13px; }
.status-sep { width: 1px; height: 12px; background: var(--bg-4); }
.listen-count { display: flex; align-items: center; gap: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.ok { background: var(--play); box-shadow: 0 0 0 3px color-mix(in srgb, var(--play) 20%, transparent); }
.dot.bad { background: var(--bad); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

.volume-row { display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 10px; flex: none; color: var(--text-2); max-width: 760px; width: 100%; margin: 0 auto; }
.vol-range { flex: 1; }
.vol-val { width: 40px; text-align: right; font: 400 11px var(--mono); color: var(--text-3); }
.vol-note { font-size: 12px; }

/* Full-width tab bar with icons */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); height: 48px; flex: none; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.tabs .tab { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); transition: background .2s, color .2s; }
.tabs .tab .ico svg { width: 16px; height: 16px; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); box-shadow: inset 0 -2px 0 var(--text); }

main { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; position: relative;
  padding-bottom: calc(var(--mini-h) + var(--safe-b) + 24px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg-2) 90%, transparent), var(--bg) 420px);
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 12%, transparent) transparent; }
.tab-page { display: none; padding: 16px 16px 0; max-width: 760px; margin: 0 auto; }
.tab-page.active { display: block; animation: tabIn .3s ease both; }
@keyframes tabIn { from { opacity: 0; transform: translateY(10px); } }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.section-head h3 { margin: 0; font-size: 12px; font-weight: 500; color: var(--text); }
.section-head .count { color: var(--text-3); font-weight: 400; margin-left: 4px; }
.head-actions { display: flex; gap: 4px; align-items: center; }
.empty { color: var(--text-2); font-size: 13px; padding: 20px 4px; margin: 0; text-align: center; }

/* ---------------------------------------------------------------- covers (song pictures) */
.cover {
  width: 44px; height: 44px; border-radius: 6px; flex: none; overflow: hidden; position: relative;
  border: 1px solid rgba(255, 255, 255, .05); background: hsl(var(--h, 20) 12% 22%); color: rgba(255,255,255,.75);
  display: grid; place-items: center; font-weight: 600; font-size: 16px;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.logo { background: var(--bg-3); }
.cover.logo img { object-fit: contain; }
.cover.sm { width: 44px; height: 44px; }
.cover.md { width: 64px; height: 64px; border-radius: 8px; font-size: 22px; }

/* ---------------------------------------------------------------- now card */
.now-card { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg-2) 70%, transparent); cursor: pointer; transition: background .15s; }
.now-card:hover { background: color-mix(in srgb, var(--bg-3) 60%, transparent); }
.now-card .info { flex: 1; min-width: 0; }
.now-card .t { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.now-card .a { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.now-card .by { color: var(--text-3); font-size: 11px; }
.now-card .open-hint { color: var(--text-3); }
.now-card .open-hint svg { width: 18px; height: 18px; }
.now-empty { padding: 4px 2px; color: var(--text-2); font-size: 13px; }
.now-empty b { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.state-label { display: flex; align-items: center; gap: 6px; color: var(--play); }

/* Green sound-wave bars for the playing song */
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; width: 12px; color: var(--play); vertical-align: -2px; }
.eq i { width: 2px; background: currentColor; height: 40%; }
.eq i:nth-child(1) { animation: wave1 1.2s ease-in-out infinite; }
.eq i:nth-child(2) { animation: wave2 1.4s ease-in-out infinite; height: 80%; }
.eq i:nth-child(3) { animation: wave3 1s ease-in-out infinite; height: 60%; }
.eq.paused i { animation: none; }
@keyframes wave1 { 0%,100% { height: 40%; } 50% { height: 70%; } }
@keyframes wave2 { 0%,100% { height: 80%; } 50% { height: 40%; } }
@keyframes wave3 { 0%,100% { height: 60%; } 33% { height: 80%; } 66% { height: 30%; } }

/* ---------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 8px; border-radius: 8px;
  background: transparent; position: relative; user-select: none; -webkit-user-select: none; transition: background .15s;
}
.row:hover { background: color-mix(in srgb, var(--bg-3) 45%, transparent); }
.row .txt { flex: 1; min-width: 0; cursor: pointer; }
.row .t { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .a { color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row .acts { display: flex; align-items: center; }
.row .acts .icon-btn { width: 32px; height: 32px; border-radius: 50%; color: var(--text-3); }
.row .acts .icon-btn:hover { color: var(--text); background: transparent; transform: scale(1.1); }
.row .acts .icon-btn[data-act="removeQueue"]:hover { color: var(--bad); }
.row .acts .icon-btn svg { width: 17px; height: 17px; }
.row .acts .icon-btn.on { color: var(--play); }
.row.playing { background: color-mix(in srgb, var(--play) 7%, transparent); }
.row.playing .t { color: var(--play); }
.history .row .t { color: var(--text-2); }
.tag { display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid color-mix(in srgb, #10b981 25%, transparent); background: color-mix(in srgb, #10b981 12%, transparent); padding: 0 6px; margin-left: 6px; font-size: 10px; font-weight: 500; color: #6ee7b7; vertical-align: 1px; }
:root[data-theme="light"] .tag { color: #047857; }

.handle { width: 32px; height: 40px; display: grid; place-items: center; color: var(--bg-4); touch-action: none; cursor: grab; flex: none; }
.handle svg { width: 18px; height: 18px; }
.handle:hover { color: var(--text-2); }

.drop-list.dragging-into { min-height: 60px; border-radius: 10px; outline: 1px dashed var(--accent); outline-offset: 2px; }
.placeholder { height: 60px; border-radius: 8px; background: var(--accent-soft); border: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); list-style: none; }
.row.drag-src { opacity: .3; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; margin: 0; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: var(--shadow); list-style: none; }
.drag-ghost .row { background: transparent; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; }

/* Placeholder rows while a room loads */
.skel { pointer-events: none; }
.skel .cover, .cover.skel, .skel .sk { background: var(--bg-3); border-color: transparent; animation: skel 1.2s ease-in-out infinite alternate; }
.skel .sk { display: block; height: 10px; border-radius: 4px; margin: 5px 0; }
.skel .sk.w1 { width: 58%; } .skel .sk.w2 { width: 34%; } .skel .sk.w3 { width: 72%; height: 14px; }
@keyframes skel { from { opacity: .4; } to { opacity: .9; } }

/* ---------------------------------------------------------------- library */
.lib-top { display: flex; gap: 8px; }
.search { flex: 1; position: relative; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border-radius: 8px; background: var(--field); border: 1px solid var(--bg-3); outline: none; font-size: 14px; }
.search input::placeholder { color: var(--text-3); }
.search input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.search-ico { position: absolute; left: 11px; top: 11px; color: var(--text-3); }
.search-ico svg { width: 17px; height: 17px; }
.lib-bar { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 8px; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.lib-bar .muted { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; }
/* Narrow phones: labels stay on one line; the buttons move under the count instead of squashing. */
.lib-bar { flex-wrap: wrap; }
.lib-bar .head-actions { margin-left: auto; }
.head-actions .text-btn { white-space: nowrap; }
.select { height: 30px; border-radius: 6px; background: transparent; border: 0; padding: 0 4px; font-size: 11px; font-weight: 500; color: var(--text-2); outline: none; cursor: pointer; }
.select option { background: var(--bg-2); color: var(--text); }

.lib .row { flex-wrap: wrap; }
.lib .row .dur { color: var(--text-3); font: 400 11px var(--mono); }
.lib .row.open { background: color-mix(in srgb, var(--bg-3) 45%, transparent); }
.lib-actions { flex-basis: 100%; display: none; gap: 6px; padding: 8px 0 4px 56px; }
.lib .row.open .lib-actions { display: flex; flex-wrap: wrap; }
.act { height: 32px; padding: 0 12px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--bg-4); font-size: 11px; font-weight: 500; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.act:hover { background: var(--bg-4); }
.act svg { width: 14px; height: 14px; }
.act.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); font-weight: 600; }
.act.danger { margin-left: auto; border-color: color-mix(in srgb, #ef4444 25%, transparent); background: color-mix(in srgb, #ef4444 10%, transparent); color: #fca5a5; }
:root[data-theme="light"] .act.danger { color: #b91c1c; }
.act.danger:hover { background: color-mix(in srgb, #ef4444 16%, transparent); }
.chev { transition: transform .2s; }
.row.open .chev { transform: rotate(180deg); }
@media (max-width: 480px) { .lib-actions { padding-left: 0; } .act { flex: 1 1 40%; justify-content: center; } .act.danger { margin-left: 0; } }

.uploads { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.upload-item { background: color-mix(in srgb, var(--bg-2) 70%, transparent); border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px 12px; font-size: 12px; }
.upload-item .bar { height: 4px; background: var(--bg-3); border-radius: 999px; margin-top: 7px; overflow: hidden; }
.upload-item .bar i { display: block; height: 100%; width: 0; background: var(--text); border-radius: 999px; transition: width .2s; }
.upload-item.done .bar i { background: var(--play); }
.upload-item.fail { color: var(--bad); }

.empty-lib { padding: 40px 8px; text-align: center; }
.empty-lib h4 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.empty-lib p { margin: 0 auto 16px; max-width: 360px; font-size: 13px; }
.drop-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); color: #fff; font-size: 18px; font-weight: 600; pointer-events: none; }

/* ---------------------------------------------------------------- sliders */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 20px; margin: 0; cursor: pointer; touch-action: none; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--fill, var(--text)) var(--p), var(--bg-3) var(--p)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--fill, var(--text)) var(--p), var(--bg-3) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); margin-top: -3px; border: 0; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; }
input[type=range]:disabled { opacity: .5; cursor: default; }
.range { width: 100%; height: 28px; --fill: var(--accent); }
.range::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -5px; background: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.range::-moz-range-thumb { width: 16px; height: 16px; background: var(--text); }

/* ---------------------------------------------------------------- tune */
.card { background: color-mix(in srgb, var(--bg-2) 70%, transparent); border: 1px solid var(--line-soft); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card h4 { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.card p { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h4 { margin: 0; }
.sync-card { display: flex; gap: 16px; align-items: center; }
.sync-num { display: flex; align-items: baseline; gap: 3px; min-width: 76px; }
.sync-num span { font: 600 34px/1 var(--mono); letter-spacing: -.03em; }
.sync-num small { color: var(--text-3); font: 400 12px var(--mono); }
.sync-text h4 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); margin: 0 0 3px; }
.dot.good { background: var(--play); } .dot.ok-c { background: var(--warn); } .dot.bad-c { background: var(--bad); }

.offset-value { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin: 8px 0 4px; }
.offset-value span { font: 600 32px var(--mono); letter-spacing: -.03em; }
.offset-value small { color: var(--text-3); font: 400 12px var(--mono); }
.range-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row b { font-size: 13px; font-weight: 500; }
.switch-row small { font-size: 12px; }
.switch { -webkit-appearance: none; appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--bg-4); position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); transition: transform .2s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(16px); background: var(--on-primary); }
#lastTune { margin-top: 6px; font: 400 11px var(--mono); }

.sync-list { list-style: none; margin: 4px 0 0; padding: 0; }
.sync-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13px; }
.sync-list li + li { border-top: 1px solid var(--line); }
.sync-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sync-list .name span { font-weight: 400; color: var(--text-3); }
.ms { text-align: right; font: 500 11px var(--mono); }
.good-t { color: var(--play); } .ok-t { color: var(--warn); } .bad-t { color: var(--bad); } .dim-t { color: var(--text-3); }

/* ---------------------------------------------------------------- bottom player bar */
.mini {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; cursor: pointer;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--mini-bg); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent); box-shadow: 0 -5px 15px rgba(0, 0, 0, .1);
}
.mini-row { display: flex; align-items: center; gap: 12px; max-width: 592px; margin: 0 auto; }
.mini-text { flex: 1; min-width: 0; }
.mini-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-artist { color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.mini .icon-btn { color: var(--text-2); }
.mini .icon-btn:hover { color: var(--text); background: transparent; transform: scale(1.05); }
.mini .icon-btn svg { width: 24px; height: 24px; }
.mini-progress { max-width: 592px; height: 4px; margin: 0 auto 12px; border-radius: 999px; background: var(--bg-3); pointer-events: none; overflow: hidden; }
.mini-bar { height: 100%; width: 0; border-radius: 999px; background: var(--text); }

.listen-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--mini-h) + 12px + var(--safe-b)); z-index: 41;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px; padding: 10px 16px; border-radius: 12px; white-space: nowrap; box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- full screen player */
.np {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; overflow-y: auto;
  background: var(--bg); color: var(--text);
  transform: translateY(100%); visibility: hidden;
  transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s linear .32s;
  --np-color: #262626;
}
.np.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility 0s; }
.np-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--np-color) 75%, var(--bg)) 0%, var(--bg) 70%); transition: background .6s; }
.np-top { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 12px 6px; flex: none; }
.np-ctx { flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.np-ctx .label { font-size: 10px; }
.np-ctx b { font: 600 13px var(--mono); letter-spacing: .14em; }
.np-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 12px 24px calc(28px + var(--safe-b)); width: 100%; max-width: 520px; margin: 0 auto; }
.np-art { width: min(100%, 44vh, 440px); aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.06); box-shadow: var(--shadow);
  background: hsl(var(--h, 20) 12% 22%); display: grid; place-items: center; color: rgba(255,255,255,.75); font-size: 96px; font-weight: 600; }
.np-art.logo { background: var(--bg-2); padding: 18%; }
.np-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-art.logo img { object-fit: contain; }
.np-info { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.np-meta h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-meta p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seek-range { width: 100%; }
.np-times { display: flex; justify-content: space-between; font: 400 11px var(--mono); color: var(--text-3); margin-top: -2px; }
.np-controls { display: flex; align-items: center; justify-content: space-between; }
.np-controls .icon-btn { color: var(--text-2); }
.np-controls .icon-btn:hover { color: var(--text); background: transparent; transform: scale(1.05); }
.np-vol { padding: 0; }
.np-next { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg-2) 70%, transparent); cursor: pointer; }
.np-next:hover { background: color-mix(in srgb, var(--bg-3) 60%, transparent); }
.np-next .txt { flex: 1; min-width: 0; }
.np-next .t { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-next .a { color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) and (min-height: 600px) {
  .np-body { flex-direction: row; max-width: 1040px; gap: 56px; }
  .np-art { width: min(52vh, 460px); flex: none; }
  .np-info { max-width: 420px; }
  .np-meta h2 { font-size: 28px; white-space: normal; }
}

/* ---------------------------------------------------------------- people sheet */
.sheet-backdrop, .dialog-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--bg-2); max-width: 520px; margin: 0 auto;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 8px 18px calc(20px + var(--safe-b)); max-height: 75vh; overflow-y: auto;
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow);
}
.sheet.open { transform: none; }
.sheet-grip { position: relative; width: 100%; height: 26px; margin: -4px 0 4px; touch-action: none; cursor: grab; }
.sheet-grip::after { content: ""; position: absolute; left: 50%; top: 11px; width: 40px; height: 5px; margin-left: -20px; border-radius: 999px; background: var(--bg-4); }
.sheet-grip:active::after { background: var(--text-3); }
.sheet-head { touch-action: none; cursor: grab; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.sheet-head .small { font: 400 11px var(--mono); color: var(--text-3); }
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.people li + li { border-top: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; flex: none; background: hsl(var(--h) 20% 32%); color: #fff; font-size: 13px; }
.people .who { flex: 1; min-width: 0; }
.people .who b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .who span { font-size: 11px; color: var(--text-3); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 500; white-space: nowrap; color: var(--text-3); border: 1px solid var(--line); }
.badge svg { width: 12px; height: 12px; }
.badge.on { color: #6ee7b7; border-color: color-mix(in srgb, #10b981 25%, transparent); background: color-mix(in srgb, #10b981 12%, transparent); }
:root[data-theme="light"] .badge.on { color: #047857; }

/* ---------------------------------------------------------------- dialog */
.dialog-backdrop { display: grid; place-items: center; padding: 12px; z-index: 70; }
.dialog { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: 100%; max-width: 384px; box-shadow: var(--shadow); }
.dialog h4 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.dialog p { margin: 0 0 20px; font-size: 13px; color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .btn { height: 40px; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--mini-h) + 16px + var(--safe-b)); z-index: 95; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); padding: 12px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); max-width: 100%; transition: opacity .25s, transform .25s; }
.toast.err { color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------------------------------------------------------------- queue search */
.queue-search { margin-bottom: 12px; }
#tab-queue.searching .handle { display: none; }
