:root {
  --bg: #0b0b0d; --panel: #141418; --panel2: #1c1c22; --line: #26262e;
  --text: #f1f1f4; --muted: #8d8d99; --accent: #c6ff3a; --accent-ink: #10130a;
  --warn: #ffb54a; --bad: #ff6b6b; --ok: #6fe39a;
  --nav-w: 220px; --player-h: 76px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 0; }
h4 { font-size: 13px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* каркас */
#app { min-height: 100%; }
#nav { position: fixed; inset: 0 auto 0 0; width: var(--nav-w); background: var(--panel); border-right: 1px solid var(--line);
  padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; z-index: 5; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.03em; padding: 4px 12px 18px; }
.logo span { color: var(--accent); }
.logo.big { font-size: 38px; padding: 0 0 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav-link:hover { color: var(--text); background: var(--panel2); }
.nav-link.on { color: var(--text); background: var(--panel2); }
.nav-link.on .ic { color: var(--accent); }
#jobs-badge { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 99px; font-size: 12px; padding: 0 7px; min-width: 20px; text-align: center; }
#main { margin-left: var(--nav-w); padding: 28px 32px 40px; max-width: 1180px; }
body.has-player #main { padding-bottom: calc(var(--player-h) + 40px); }

.page-head, .album-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div:first-of-type, .album-head > div:last-child { flex: 1; min-width: 200px; }
.page-head p, .album-head p { margin: 4px 0 0; }
.album-head { align-items: flex-end; }
.album-head .row-btns { margin-top: 12px; }
.back { margin-left: -8px; align-self: center; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel2); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #3a3a46; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.ib { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--muted); flex: none; position: relative; }
.ib:hover { color: var(--text); background: var(--panel2); }
.ib.on { color: var(--accent); }
.ib.busy { animation: pulse 1s infinite; color: var(--accent); }
.ib sup { position: absolute; right: 4px; top: 2px; font-size: 9px; font-weight: 700; }
@keyframes pulse { 50% { opacity: .3; } }
input[type=text], input[type=search], input[type=password], textarea, select { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select { width: auto; max-width: 220px; padding: 7px 10px; }
textarea { resize: vertical; font-size: 13px; }
.inline-form { display: flex; gap: 8px; margin: 0 0 14px; }
.inline-form input { flex: 1; min-width: 0; }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.field input { color: var(--text); font-size: 15px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.switch { display: inline-flex; gap: 8px; align-items: center; padding: 8px 4px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); background: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* подсказки поиска */
.suggest-wrap { position: relative; flex: 1; min-width: 0; }
.suggest-wrap input { width: 100%; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 14px; z-index: 8; box-shadow: 0 14px 40px rgba(0, 0, 0, .55); }
.suggest li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest li .ic { color: var(--muted); flex: none; }
.suggest li:hover, .suggest li.on { background: #2a2a33; }
.loading.inline { padding: 14px 4px; display: flex; justify-items: start; gap: 12px; }
.loading.inline .spin { width: 18px; height: 18px; border-width: 2px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }

/* строки треков */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; min-width: 0; }
.row:hover { background: var(--panel); }
.row.static, .row.job, .row.remote { cursor: default; }
.row.playing .row-title { color: var(--accent); }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-err { color: var(--bad); font-size: 13px; }
.row-no { width: 28px; text-align: center; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.row-state { flex: none; }
.time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.time i { font-style: normal; font-size: 12px; }
.time i.plus { color: var(--ok); } .time i.minus { color: var(--warn); }
.like.on { color: var(--accent); }
.tag { display: inline-flex; align-items: center; margin-left: 7px; padding: 0 6px; height: 18px; border-radius: 5px; font-size: 11px; font-weight: 700;
  background: var(--panel2); color: var(--muted); vertical-align: 2px; border: 0; }
.tag.e { background: #33333d; color: var(--text); }
.tag.ok { background: rgba(111, 227, 154, .16); color: var(--ok); }
.tag.warn { background: rgba(255, 181, 74, .16); color: var(--warn); }
button.tag { cursor: pointer; }
.art { width: 44px; height: 44px; border-radius: 7px; background: var(--panel2); flex: none; overflow: hidden; }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art.big { width: 180px; height: 180px; border-radius: 14px; }
.art.round, .card.round .art { border-radius: 50%; }
.row.job .dot, .status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.row.job.running .dot { background: var(--accent); animation: pulse 1s infinite; }
.row.job.done .dot, .status .good .dot { background: var(--ok); }
.row.job.error .dot, .status .bad .dot { background: var(--bad); }

/* сетка карточек */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card { display: grid; gap: 4px; padding: 10px; border-radius: 14px; background: var(--panel); }
.card:hover { background: var(--panel2); }
.card .art { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; }
.card b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.card span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.round { text-align: center; }

.notice { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-radius: 12px; background: rgba(255, 181, 74, .1); color: var(--warn); margin: 6px 0; }
.notice b { white-space: nowrap; }
.notice span { flex: 1; }
.notice .ic { margin-left: auto; transform: rotate(-90deg); flex: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.panel h2 { margin-top: 0; }
.status { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.status li { display: flex; align-items: center; gap: 10px; }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.loading { padding: 40px; display: grid; justify-items: center; gap: 12px; color: var(--muted); }
.spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; display: grid; gap: 12px; }
.login-card form { display: grid; gap: 10px; }
.who { display: grid; gap: 8px; }
.err { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 13px; }

/* плеер */
#player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); background: rgba(20, 20, 24, .96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); display: none; align-items: center; gap: 16px; padding: 0 18px; z-index: 10; }
body.has-player #player { display: flex; }
.now { display: flex; align-items: center; gap: 12px; width: 26%; min-width: 0; cursor: pointer; }
.now-text { min-width: 0; }
.now-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mid { flex: 1; display: grid; gap: 2px; justify-items: center; min-width: 0; }
.side { width: 26%; display: flex; justify-content: flex-end; }
.ctl { display: flex; align-items: center; gap: 6px; }
.ctl .play { background: var(--text); color: var(--bg); width: 38px; height: 38px; }
.ctl .play:hover { background: #fff; color: var(--bg); }
.ctl.big { gap: 14px; justify-content: center; }
.ctl.big .play { width: 68px; height: 68px; }
.ctl.big .ib { width: 48px; height: 48px; }
.seek-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 18px; background: none; min-width: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #3a3a46; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: #3a3a46; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); margin-top: -4.5px; }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--accent); }

#full { position: fixed; inset: 0; background: var(--bg); z-index: 20; overflow-y: auto; padding: 14px 22px calc(30px + env(safe-area-inset-bottom)); display: grid; gap: 10px; align-content: start; justify-items: center; }
.full-head { display: flex; align-items: center; justify-content: space-between; width: 100%; color: var(--muted); font-size: 13px; }
.full-head .ib .ic { transform: none; }
.full-art { width: min(74vw, 46vh, 420px) !important; height: auto !important; aspect-ratio: 1; border-radius: 18px; margin: 10px 0; }
.full-title { font-size: 22px; font-weight: 700; text-align: center; }
.full-artist { color: var(--muted); text-align: center; }
#full .seek-row { margin-top: 10px; }
.up-next { width: 100%; max-width: 620px; }
.up-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; background: none; border-radius: 10px; text-align: left; }
.up-row:hover { background: var(--panel); }
.up-text { flex: 1; min-width: 0; display: grid; }
.up-text b, .up-text i { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: normal; }
.up-text i { color: var(--muted); font-size: 13px; }

.preview-bar { position: fixed; left: calc(var(--nav-w) + 16px); right: 16px; bottom: 16px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 14px;
  padding: 10px 14px; z-index: 40; display: grid; gap: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
body.has-player .preview-bar { bottom: calc(var(--player-h) + 12px); }
.preview-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-ctl { display: flex; align-items: center; gap: 8px; }

/* листы и всплывашки */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 30; display: grid; place-items: center; padding: 20px; }
.sheet { width: 100%; min-width: 0; max-width: 440px; max-height: 86vh; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; }
.sheet.wide { max-width: 860px; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 10px 10px 18px; }
.sheet-head h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 4px 18px 18px; overflow-y: auto; overflow-x: hidden; min-width: 0; }
.menu { display: grid; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border: 0; background: none; text-align: left; border-radius: 10px; }
.menu-item:hover { background: var(--panel2); }
.menu-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item.danger { color: var(--bad); }
.ic-gap { width: 20px; flex: none; }
#toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 26px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px;
  border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: min(92vw, 520px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #1a0606; }

/* телефон */
@media (max-width: 760px) {
  :root { --player-h: 62px; --tab-h: calc(56px + env(safe-area-inset-bottom)); }
  #nav { inset: auto 0 0 0; width: auto; height: var(--tab-h); flex-direction: row; padding: 0 2px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); gap: 0; z-index: 12; }
  #nav .logo { display: none; }
  .nav-link { flex: 1; flex-direction: column; gap: 2px; padding: 7px 0 0; font-size: 10px; border-radius: 0; position: relative; min-width: 0; }
  .nav-link:hover, .nav-link.on { background: none; }
  .nav-link.on { color: var(--accent); }
  #jobs-badge { position: absolute; top: 3px; left: 54%; margin: 0; font-size: 10px; min-width: 16px; padding: 0 4px; }
  #main { margin-left: 0; padding: calc(18px + env(safe-area-inset-top)) 12px calc(var(--tab-h) + 24px); }
  body.has-player #main { padding-bottom: calc(var(--tab-h) + var(--player-h) + 24px); }
  #player { bottom: var(--tab-h); padding: 0 6px 0 10px; gap: 4px; }
  .now { width: auto; flex: 1; }
  .mid { flex: none; }
  .mid .seek-row, .side, #player .ctl .ib:first-child { display: none; }
  .preview-bar { left: 8px; right: 8px; bottom: calc(var(--tab-h) + 8px); }
  body.has-player .preview-bar { bottom: calc(var(--tab-h) + var(--player-h) + 8px); }
  #toast { bottom: calc(var(--tab-h) + var(--player-h) + 16px); }
  h1 { font-size: 22px; }
  .art.big { width: 112px; height: 112px; }
  .album-head { align-items: center; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
  .sheet-wrap { place-items: end stretch; grid-template-columns: minmax(0, 1fr); padding: 0; }
  .sheet, .sheet.wide { max-width: none; border-radius: 18px 18px 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .row { padding: 7px 2px; gap: 8px; }
  .row.remote .time, .row .time:not(.cur):not(.dur) { display: none; }
  .row.cand { flex-wrap: wrap; }
  .row.cand .row-text { flex-basis: calc(100% - 60px); }
  .row.cand .row-sub { white-space: normal; }
  .row.cand .time { display: inline !important; margin-left: 54px; flex: 1; }
  .inline-form .btn { padding-inline: 13px; }
  .search-form .btn span { display: none; }
  .nav-link { font-size: 9px; letter-spacing: -.02em; }
  .nav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .row.static { flex-wrap: wrap; }
  .row.static .row-text { flex-basis: 100%; }
  .row.static .row-title, .row.static .row-sub { white-space: normal; }
  .grid.small { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  select { max-width: 150px; }
}
