:root {
  --bg: #000;
  --panel: #121212;
  --panel-2: #1a1a1a;
  --hover: #2a2a2a;
  --text: #fff;
  --muted: #b3b3b3;
  --dim: #6a6a6a;
  --accent: #1ed760;
  --accent-2: #1db954;
  --danger: #f15e6c;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 24px; height: 24px; fill: currentColor; flex: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.app {
  display: grid;
  grid-template: "side main" 1fr "player player" auto / 300px 1fr;
  gap: 8px; height: 100vh; padding: 8px 8px 0;
}
.panel { background: var(--panel); border-radius: var(--radius); }

/* ---------- Sidebar ---------- */
.sidebar { grid-area: side; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.nav { padding: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; padding: 6px 12px 14px; letter-spacing: -.3px; }
.logo-dot { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6fffa5, var(--accent-2)); }
.nav a, .lib-title { display: flex; align-items: center; gap: 16px; padding: 8px 12px; font-weight: 700; color: var(--muted); transition: color .15s; }
.nav a:hover, .nav a.active, .lib-title:hover, .lib-title.active { color: var(--text); }
.library { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 8px; }
.library-head { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.icon-btn { background: none; border: 0; color: var(--muted); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn svg { width: 18px; height: 18px; }
.import-btn { margin: 8px 4px; display: flex; align-items: center; gap: 10px; justify-content: center; padding: 10px; border: 0; border-radius: 999px; background: var(--accent); color: #000; font-weight: 700; transition: transform .1s, background .15s; }
.import-btn:hover { background: #3be477; transform: scale(1.02); }
.import-btn svg { width: 18px; height: 18px; }
.pl-list { list-style: none; margin: 4px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.pl-item { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 6px; cursor: pointer; }
.pl-item:hover { background: var(--panel-2); }
.pl-item.active { background: var(--hover); }
.pl-item .cover { width: 48px; height: 48px; border-radius: 4px; }
.pl-item .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item .sub { color: var(--muted); font-size: 13px; }
.pl-item.playing .name { color: var(--accent); }

.cover { background: var(--surface) center/cover no-repeat; display: grid; place-items: center; color: var(--dim); flex: none; overflow: hidden; }
.cover svg { width: 40%; height: 40%; }

/* ---------- Main ---------- */
.main { grid-area: main; overflow-y: auto; min-height: 0; position: relative; }
.view { padding: 24px; }
.hero { padding: 72px 24px 24px; display: flex; gap: 24px; align-items: flex-end; background: linear-gradient(var(--hero, #3a3a5a), rgba(18,18,18,.6)); border-radius: var(--radius) var(--radius) 0 0; }
.hero .cover { width: 220px; height: 220px; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.hero .kind { font-size: 13px; font-weight: 600; }
.hero h1 { font-size: clamp(32px, 6vw, 84px); margin: 6px 0 12px; line-height: 1; letter-spacing: -2px; word-break: break-word; cursor: text; }
.hero .meta { color: #ddd; font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.35); }
.badge.spotify { color: #1ed760; } .badge.yandex { color: #ffcc00; } .badge.soundcloud { color: #ff7700; } .badge.youtube { color: #ff4e45; } .badge.vk { color: #4a9eff; }
.actions { display: flex; align-items: center; gap: 20px; padding: 24px; background: linear-gradient(rgba(0,0,0,.25), transparent 120px); }
.big-play { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #000; display: grid; place-items: center; transition: transform .1s; }
.big-play:hover { transform: scale(1.05); background: #3be477; }
.big-play svg { width: 28px; height: 28px; }
.btn { border: 0; border-radius: 999px; padding: 8px 18px; font-weight: 700; background: transparent; color: var(--text); }
.btn.primary { background: var(--accent); color: #000; }
.btn.primary:hover { background: #3be477; }
.btn.primary:disabled { opacity: .5; cursor: progress; }
.btn.ghost { border: 1px solid #727272; }
.btn.ghost:hover { border-color: #fff; }
.btn.small { padding: 4px 12px; font-size: 12px; }
.btn.danger:hover { color: var(--danger); border-color: var(--danger); }

h2.section { font-size: 24px; margin: 8px 0 16px; letter-spacing: -.5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.card { padding: 12px; border-radius: var(--radius); background: var(--panel-2); cursor: pointer; transition: background .2s; position: relative; }
.card:hover { background: var(--hover); }
.card .cover { width: 100%; aspect-ratio: 1; border-radius: 6px; margin-bottom: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.card .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card .fab { position: absolute; right: 20px; top: calc(100% - 128px); opacity: 0; transform: translateY(8px); transition: .2s; width: 48px; height: 48px; box-shadow: 0 8px 8px rgba(0,0,0,.3); }
.card:hover .fab { opacity: 1; transform: none; }

.welcome { padding: 32px; border-radius: var(--radius); background: linear-gradient(135deg, #1f5f3a, #1a1a1a 70%); margin-bottom: 32px; }
.welcome h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -1px; }
.welcome p { color: #ddd; max-width: 640px; }

/* ---------- Track table ---------- */
.tracks { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tracks th { text-align: left; color: var(--muted); font-weight: 400; font-size: 13px; padding: 8px; border-bottom: 1px solid #2a2a2a; }
.tracks td { padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tracks tr.row:hover td { background: var(--panel-2); }
.tracks tr.row td:first-child { border-radius: 4px 0 0 4px; }
.tracks tr.row td:last-child { border-radius: 0 4px 4px 0; }
.tracks .c-num { width: 48px; text-align: right; }
.tracks .c-dur { width: 70px; text-align: right; }
.tracks .c-act { width: 230px; text-align: right; }
.tracks .c-album { width: 28%; }
.t-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.t-cell .cover { width: 40px; height: 40px; border-radius: 4px; }
.t-cell .cover svg { width: 18px; height: 18px; }
.t-text { min-width: 0; }
.t-title { color: var(--text); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.t-artist { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
tr.playing .t-title, tr.playing .c-num { color: var(--accent); }
tr.missing .t-title, tr.missing .t-artist, tr.missing .c-num { color: var(--dim); }
tr.missing .cover { opacity: .5; }
tr.row { cursor: default; }
tr.row:not(.missing) { cursor: pointer; }
.row .hover-only { visibility: hidden; }
.row:hover .hover-only { visibility: visible; }
.miss-tag { color: var(--danger); font-size: 12px; margin-left: 8px; }
.eq { display: inline-flex; gap: 2px; height: 14px; align-items: flex-end; }
.eq i { width: 3px; background: var(--accent); animation: eq .9s infinite ease-in-out; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
.paused .eq i { animation-play-state: paused; }
@keyframes eq { 0%,100% { height: 3px } 50% { height: 14px } }

.stat-bar { height: 4px; background: #333; border-radius: 2px; overflow: hidden; width: 160px; display: inline-block; vertical-align: middle; }
.stat-bar > i { display: block; height: 100%; background: var(--accent); }
.note { margin: 0 24px 16px; padding: 12px 16px; border-radius: 6px; background: #2a2412; color: #f0d58c; font-size: 13px; }

.search-box { position: relative; max-width: 420px; margin-bottom: 24px; }
.search-box input { width: 100%; padding: 12px 16px 12px 44px; border-radius: 999px; border: 0; background: var(--field); color: var(--text); font-size: 15px; outline: 2px solid transparent; }
.search-box input:focus { outline-color: #fff; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; color: var(--muted); }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.dropzone { border: 2px dashed #3a3a3a; border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); margin-bottom: 24px; transition: .2s; }
.dropzone.over { border-color: var(--accent); color: var(--text); background: rgba(30,215,96,.06); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- Player ---------- */
.player { grid-area: player; display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; height: 80px; padding: 0 8px; }
.now { display: flex; align-items: center; gap: 14px; min-width: 0; }
.now-cover { width: 56px; height: 56px; border-radius: 4px; background: var(--surface) center/cover; flex: none; }
.now-meta { min-width: 0; }
.now-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 720px; width: 100%; justify-self: center; }
.buttons { display: flex; align-items: center; gap: 18px; }
.ctl { background: none; border: 0; color: var(--muted); padding: 4px; position: relative; display: grid; place-items: center; }
.ctl:hover { color: var(--text); }
.ctl svg { width: 18px; height: 18px; }
.ctl.on { color: var(--accent); }
.ctl.on::after { content: ""; position: absolute; bottom: -4px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.repeat-one { display: none; position: absolute; font-size: 8px; font-weight: 800; top: 0; right: 0; }
.ctl.one .repeat-one { display: block; }
.play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; color: #000; display: grid; place-items: center; transition: transform .1s; }
.play:hover { transform: scale(1.06); }
.play svg { width: 20px; height: 20px; }
.progress { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 12px; color: var(--muted); }
.progress span { width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.extra { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
#volume { width: 100px; }

input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--fill-color, #fff) var(--fill, 0%), #4d4d4d var(--fill, 0%)); cursor: pointer; margin: 0; }
input[type=range]:hover { --fill-color: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; opacity: 0; }
input[type=range]:hover::-webkit-slider-thumb { opacity: 1; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }

/* ---------- Queue ---------- */
.queue-panel { position: fixed; right: 8px; top: 8px; bottom: 96px; width: 340px; background: var(--panel); border-radius: var(--radius); padding: 16px; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.5); z-index: 5; }
.queue-head { display: flex; justify-content: space-between; align-items: center; }
.queue-head h3 { margin: 0; }
#queue-list { padding-left: 24px; color: var(--muted); }
#queue-list li { padding: 6px 0; cursor: pointer; }
#queue-list li.cur { color: var(--accent); }
#queue-list li b { display: block; color: var(--text); font-weight: 500; }
#queue-list li.cur b { color: var(--accent); }

/* ---------- Dialogs ---------- */
.dialog { background: var(--surface); color: var(--text); border: 0; border-radius: 12px; padding: 24px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 16px 48px rgba(0,0,0,.6); }
.dialog::backdrop { background: rgba(0,0,0,.7); }
.dialog h2 { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.dialog input, .dialog textarea { width: 100%; padding: 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--line); color: var(--text); font: inherit; margin-top: 8px; outline: none; }
.dialog input:focus, .dialog textarea:focus { border-color: #fff; }
.dialog details { margin-top: 12px; color: var(--muted); }
.dialog summary { cursor: pointer; font-size: 13px; }
.services { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.svc { padding: 4px 12px; border-radius: 999px; background: var(--line); font-size: 12px; font-weight: 600; color: var(--muted); transition: .2s; }
.svc.active[data-svc=spotify] { background: #1ed760; color: #000; }
.svc.active[data-svc=yandex] { background: #ffcc00; color: #000; }
.svc.active[data-svc=soundcloud] { background: #ff7700; color: #000; }
.svc.active[data-svc=youtube] { background: #ff0033; color: #fff; }
.svc.active[data-svc=vk] { background: #0077ff; color: #fff; }
.import-hint:empty { display: none; }
.import-hint { margin: 6px 0 0; font-size: 13px; color: #ffb454; }
.bm-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; font-size: 12.5px; line-height: 1.45; }
.bm-box .bm-link { flex: none; cursor: grab; white-space: nowrap; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.dlg-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 1em; }
.link-results { list-style: none; padding: 0; margin: 12px 0 0; max-height: 320px; overflow-y: auto; }
.link-results li { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 4px; cursor: pointer; }
.link-results li:hover { background: var(--line); }
.link-results .cover { width: 36px; height: 36px; border-radius: 3px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.3); border-top-color: #000; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); background: #fff; color: #000; padding: 10px 18px; border-radius: 8px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 10; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border: 3px solid transparent; background-clip: content-box; border-radius: 6px; }

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  .app { grid-template: "main" 1fr "side" auto "player" auto / 1fr; padding: 0; gap: 0; }
  .sidebar { flex-direction: row; }
  .nav { display: flex; flex: 1; justify-content: space-around; border-radius: 0; padding: 4px; }
  .nav .logo { display: none; }
  .library { display: none; }
  .main { border-radius: 0; }
  .view { padding: 16px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 24px 16px 16px; }
  .hero .cover { width: 160px; height: 160px; }
  .actions { padding: 16px; flex-wrap: wrap; }
  .tracks .c-album, .tracks .c-dur { display: none; }
  .tracks .c-act { width: 110px; }
  .player { grid-template-columns: 1fr auto; height: auto; padding: 8px 12px; gap: 8px; }
  .extra { display: none; }
  .controls { grid-column: 1 / -1; }
  .now { grid-column: 1; }
  .queue-panel { left: 8px; width: auto; }
}

/* ================= Аккаунты, источники, устройства ================= */
.nav a { position: relative; }
.mobile-only { display: none !important; }
.dev-count { background: var(--accent); color: #000; border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: -8px; font-weight: 800; }
.player { position: relative; }
.ctl.dev-btn.on { color: var(--accent); }

/* Экран входа */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #1f5f3a, #000 60%); z-index: 20; overflow-y: auto; }
.auth-card { width: min(400px, 100%); background: var(--panel); border-radius: 12px; padding: 28px; box-shadow: 0 16px 48px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 12px; }
.auth-card .logo { padding: 0 0 4px; justify-content: center; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--field); border-radius: 999px; padding: 4px; }
.auth-tabs button { border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 999px; font-weight: 700; }
.auth-tabs button.on { background: #fff; color: #000; }
.auth-card label, .form-row label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field, .auth-card input, .form-row input, .form-row select { width: 100%; padding: 11px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--field); color: var(--text); font: inherit; outline: none; }
.field:focus, .auth-card input:focus, .form-row input:focus { border-color: #fff; }
.auth-card [data-reg] { display: none; }
.auth-card.register [data-reg] { display: flex; }
.btn.wide { width: 100%; padding: 12px; font-size: 15px; }

/* Панель «играет на другом устройстве» */
.remote-bar { position: absolute; left: 0; right: 0; bottom: 100%; display: flex; align-items: center; gap: 10px; padding: 4px 12px; background: var(--accent); color: #000; font-size: 13px; font-weight: 600; border-radius: 6px 6px 0 0; }
.remote-bar svg { width: 18px; height: 18px; }
.remote-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remote-bar .btn.ghost { border-color: rgba(0,0,0,.5); color: #000; padding: 2px 10px; }
.remote-bar .btn.ghost:hover { border-color: #000; }
body.remote .now-cover { box-shadow: 0 0 0 2px var(--accent); }

/* Список устройств */
.dev { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 8px; background: var(--panel-2); margin-top: 8px; }
.dev.cur { outline: 1px solid #333; }
.dev.target { outline: 2px solid var(--accent); }
.dev-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #2a2a2a; color: var(--muted); flex: none; }
.dev.playing .dev-ico { color: var(--accent); }
.dev-ico svg { width: 22px; height: 22px; }
.dev-body { flex: 1; min-width: 0; }
.dev-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-name small { color: var(--accent); font-weight: 600; margin-left: 6px; }
.dev-now { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dev-acts .ctl svg { width: 20px; height: 20px; }
#devices-list .dev { flex-wrap: wrap; }
#devices-list .dev-acts { width: 100%; justify-content: flex-start; }

.tap-to-play { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; cursor: pointer; }
.tap-to-play .big-play { width: 88px; height: 88px; }
.tap-to-play .big-play svg { width: 44px; height: 44px; }

/* Источники */
.add-source { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.add-source input { flex: 1 1 320px; padding: 13px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); color: var(--text); font: inherit; font-size: 15px; outline: none; }
.add-source input:focus { border-color: #fff; }
.add-source select { padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); color: var(--text); font: inherit; }
.src-list { display: grid; gap: 10px; margin-top: 16px; }
.src { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 8px; background: var(--panel-2); cursor: pointer; }
.src:hover { background: var(--hover); }
.src-ico { width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; background: #2a2a2a; color: var(--muted); }
.src-ico.yadisk { background: #ffcc00; color: #000; }
.src-ico.folder { background: #2d4a7a; color: #cfe0ff; }
.src-ico.playlist, .src-ico.json { background: #5a2d7a; color: #ecd4ff; }
.src-ico.file { background: #1f5f3a; color: #c7f5d8; }
.src-body { flex: 1; min-width: 0; }
.src-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-url { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-stat { color: var(--muted); font-size: 13px; margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.src-err { color: var(--danger); font-size: 12px; }
.src-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.preview { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: #1d2430; color: #cfe0ff; font-size: 13px; }
.preview ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); max-height: 160px; overflow-y: auto; }

.help { margin-top: 32px; color: var(--muted); max-width: 860px; }
.help h3 { color: var(--text); margin: 24px 0 8px; font-size: 16px; }
.help table { border-collapse: collapse; width: 100%; font-size: 13px; }
.help td, .help th { text-align: left; padding: 8px; border-bottom: 1px solid #2a2a2a; vertical-align: top; }
.help th { color: var(--text); }
.help code, .note code, .muted code { background: #2a2a2a; padding: 1px 6px; border-radius: 4px; color: #ddd; word-break: break-all; }
.help ol, .help ul { padding-left: 20px; }
.help li { margin: 4px 0; }

.cardbox { background: var(--panel-2); border-radius: 8px; padding: 18px; margin-bottom: 16px; max-width: 720px; }
.cardbox h3 { margin: 0 0 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; }
.form-row label { flex: 1 1 200px; }
.sess { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #2a2a2a; }
.sess:last-child { border: 0; }
.ok-tag { color: var(--accent); font-size: 12px; margin-left: 8px; }

@media (max-width: 800px) {
  .mobile-only { display: flex !important; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 4px; font-weight: 600; }
  .nav a svg { width: 22px; height: 22px; }
  .dev-count { position: absolute; top: 0; right: 4px; margin: 0; }
  .extra { display: flex; grid-column: 2; }
  .extra > :not(.dev-btn) { display: none; }
  .player { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .remote-bar { position: static; grid-column: 1 / -1; grid-row: 1; margin: -8px -12px 0; border-radius: 0; padding: 6px 12px; }
  .now { grid-row: 2; }
  .extra { grid-row: 2; }
  .controls { grid-row: 3; }
  .dev { flex-wrap: wrap; }
  .dev-acts { width: 100%; justify-content: flex-start; }
  .src { flex-wrap: wrap; }
  .src-acts { width: 100%; justify-content: flex-start; }
}
.src-ico.soundcloud { background: #ff5500; color: #fff; }
.src-ico.archive { background: #e8e8e8; color: #222; }
.src-ico.jamendo { background: #d33a63; color: #fff; }

/* ================= Роли и админ-панель ================= */
body:not(.role-admin) .admin-only { display: none !important; }
@media (max-width: 800px) { .desktop-only { display: none !important; } }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 20px; }
.tabs button { border: 0; border-radius: 999px; padding: 7px 14px; background: var(--field); color: var(--muted); font-weight: 700; }
.tabs button.on { background: #fff; color: #000; }
.tabs button .dev-count { margin-left: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 14px; }
.stat b { display: block; font-size: 26px; letter-spacing: -.5px; }
.stat span { color: var(--muted); font-size: 12px; }
.atable { width: 100%; border-collapse: collapse; font-size: 13px; }
.atable th { text-align: left; color: var(--muted); font-weight: 400; padding: 8px; border-bottom: 1px solid #2a2a2a; }
.atable td { padding: 8px; border-bottom: 1px solid #1f1f1f; vertical-align: middle; }
.atable tr.blocked td { opacity: .5; }
.atable select, .atable input { background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font: inherit; }
.atable input { width: 100%; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.role-tag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #2a2a2a; color: var(--muted); }
.role-tag.admin { background: var(--accent); color: #000; }
.role-tag.author { background: #ff7a3d; color: #000; }
/* Админ-панель → Чистка */
.cl-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cl-all { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.cl-table td:first-child, .cl-table td:nth-child(2) { width: 1%; }
.cl-file { font-size: 11px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-tag.cl-bad { background: #ff5a5a; color: #000; }
.cl-bad-text { color: #ff7a7a; }
/* Админ-панель → Обновление */
.upd-new { color: var(--accent); }
.upd-notes { margin: 10px 0; }
.upd-notes summary { cursor: pointer; color: var(--muted); }
.upd-notes pre { white-space: pre-wrap; font: 12px/1.5 ui-monospace, Consolas, monospace; background: var(--field); border-radius: 6px; padding: 10px; max-height: 280px; overflow: auto; }
.scroll-x { overflow-x: auto; }
.invite-link { font-family: Consolas, monospace; font-size: 12px; background: var(--field); padding: 4px 8px; border-radius: 4px; word-break: break-all; }
.dup { background: var(--panel-2); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }

/* ================= Этап 1: лайки, плейлисты, альбомы, офлайн ================= */
.heart { background: none; border: 0; color: var(--muted); padding: 4px; display: inline-grid; place-items: center; vertical-align: middle; }
.heart svg { width: 18px; height: 18px; }
.heart:hover { color: var(--text); }
.heart.on { color: var(--accent); }
.row .heart:not(.on) { visibility: hidden; }
.row:hover .heart { visibility: visible; }
.now-heart, .now-add { flex: none; }
.now-heart svg { width: 20px; height: 20px; }
.liked-cover { background: linear-gradient(135deg, #4b2bd1, #a6c5d8) !important; color: #fff !important; }
.liked-cover svg { width: 45% !important; height: 45% !important; }
.pl-item .liked-cover { border-radius: 4px; }
.hero .cover.big svg { width: 40%; height: 40%; }
.cover.round { border-radius: 50% !important; }
.artist-card .cover { border-radius: 50%; }
a.lnk:hover { text-decoration: underline; color: var(--text); }
.t-artist a.lnk, .c-album a.lnk { color: inherit; }

.pl-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; }
.pl-tools select { background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font: inherit; margin-left: 6px; }
.sel-bar { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px; background: #1d2430; border-radius: 8px; }
.sel-bar label { display: flex; gap: 6px; align-items: center; margin-right: 8px; font-weight: 600; }
.sel-bar .btn:disabled { opacity: .4; cursor: default; }
.tracks input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
tr.row.sel td { background: rgba(30, 215, 96, .08); }
.grip { color: var(--dim); cursor: grab; font-size: 13px; letter-spacing: -2px; user-select: none; padding: 0 2px; }
tr.row[draggable] .grip { visibility: hidden; }
tr.row[draggable]:hover .grip { visibility: visible; }
tr.row.dragging { opacity: .4; }
tr.row.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
tr.row.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }

body.offline .nav a:not([data-nav=account]) { opacity: .4; pointer-events: none; }

@media (max-width: 800px) {
  .hide-mobile { display: none; }
  .row .heart { visibility: visible; }
  .now-add { display: none; }
  .grip { visibility: visible !important; }
}
