:root {
  --bg: #121016; --panel: #1c1922; --panel2: #262230; --line: #322d3d;
  --text: #f3eff7; --muted: #9a93a8; --accent: #ff6b4a; --accent-ink: #1a0c07; --bad: #ff8f8f;
  --nav-h: 62px; --mini-h: 60px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; width: 100%; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 130px; resize: vertical; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.4em; }
.link { color: var(--accent); padding: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 0 18px; border-radius: 12px; background: var(--panel2); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; }
svg { width: 24px; height: 24px; fill: currentColor; display: block; }

/* вход */
#auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 340px; text-align: center; display: grid; gap: 12px; }
.auth-box img { margin: 0 auto; border-radius: 20px; }
.auth-box h1 { font-size: 34px; letter-spacing: -.5px; }
#authForm { display: grid; gap: 10px; margin-top: 8px; }

/* каркас */
#app { max-width: 720px; margin: 0 auto; min-height: 100%;
  padding-bottom: calc(var(--nav-h) + var(--mini-h) + env(safe-area-inset-bottom) + 16px); }
header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 14px 16px 10px; display: grid; gap: 10px; }
header h2 { font-size: 26px; letter-spacing: -.4px; }
#view { padding: 0 16px; }
nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line);
  display: flex; justify-content: center; }
nav button { flex: 1; max-width: 144px; display: grid; justify-items: center; align-content: center; gap: 3px;
  font-size: 11px; color: var(--muted); }
nav button.on { color: var(--accent); }

/* списки */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 13px; }
.chip.on { background: var(--text); color: var(--bg); font-weight: 600; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-height: 60px; }
.row .txt { flex: 1; min-width: 0; text-align: left; display: grid; }
.row b, .row span, .mini-text b, .mini-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row b { font-weight: 600; }
.row span { color: var(--muted); font-size: 13px; }
.row.now b { color: var(--accent); }
.row.miss .cover, .row.miss b { opacity: .45; }
.tag { color: var(--accent); }
.ic { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.ic.heart.on { color: var(--accent); }
.cover { flex: none; width: 46px; height: 46px; border-radius: 8px; background: var(--panel2); overflow: hidden;
  display: grid; place-items: center; color: var(--muted); position: relative; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover svg { width: 45%; height: 45%; }
.cover.sm { width: 42px; height: 42px; }
.cover.big { width: min(78vw, 340px); height: min(78vw, 340px); border-radius: 18px; margin: 0 auto; }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; display: grid; gap: 14px; justify-items: center; }
.head-line { display: flex; align-items: center; gap: 10px; padding: 4px 0 12px; }
.head-line .grow { flex: 1; min-width: 0; }

/* карточки на экране «Добавить» и «Профиль» */
.card { background: var(--panel); border-radius: 16px; padding: 16px; display: grid; gap: 10px; margin-bottom: 14px; }
.card h3 { font-size: 17px; }
.card p { color: var(--muted); font-size: 13.5px; }
.card code { background: var(--panel2); padding: 2px 7px; border-radius: 6px; color: var(--text); font-size: 14px; }
.card a { color: var(--accent); }
details summary { color: var(--accent); cursor: pointer; font-size: 13.5px; }
details > * + * { margin-top: 10px; }

/* мини-плеер */
#mini { position: fixed; left: 8px; right: 8px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 9;
  max-width: 704px; margin: 0 auto; height: var(--mini-h); background: var(--panel2); border-radius: 14px;
  display: flex; align-items: center; gap: 10px; padding: 0 6px 0 9px; overflow: hidden; }
.mini-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.mini-text { flex: 1; min-width: 0; display: grid; cursor: pointer; }
.mini-text span { color: var(--muted); font-size: 13px; }
#mini .ic { color: var(--text); }

/* большой плеер */
#player { position: fixed; inset: 0; z-index: 20; background: linear-gradient(#2a2130, var(--bg) 62%);
  padding: calc(env(safe-area-inset-top) + 12px) 24px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
#player .close { color: var(--text); margin-left: -8px; }
.p-head { display: flex; align-items: center; gap: 12px; max-width: 420px; width: 100%; margin: auto auto 0; }
.p-head > div { flex: 1; min-width: 0; display: grid; }
.p-head b { font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-head span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#seek { max-width: 420px; margin: 0 auto; padding: 0; border: 0; background: none; accent-color: var(--accent); height: 24px; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px;
  max-width: 420px; width: 100%; margin: -14px auto 0; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: space-between; max-width: 420px; width: 100%; margin: 0 auto auto; }
.controls .ic { color: var(--text); width: 52px; height: 52px; position: relative; }
.controls .ic svg { width: 30px; height: 30px; }
.controls .ic.small { color: var(--muted); }
.controls .ic.small svg { width: 22px; height: 22px; }
.controls .ic.small.on { color: var(--accent); }
.controls .ic.small em { position: absolute; right: 8px; top: 6px; font: 700 10px system-ui; color: var(--accent); }
.controls .play { width: 68px; height: 68px; background: var(--accent); color: var(--accent-ink); }

/* нижняя шторка и уведомление */
#sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; }
.sheet-body { width: 100%; max-width: 720px; margin: 0 auto; max-height: 80vh; overflow-y: auto; background: var(--panel);
  border-radius: 20px 20px 0 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 18px); display: grid; gap: 4px; }
.sheet-body h3 { padding: 6px 4px 10px; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body .item { text-align: left; padding: 13px 4px; border-radius: 10px; min-height: 46px; }
.sheet-body .item.bad { color: var(--bad); }
#toast { position: fixed; left: 16px; right: 16px; z-index: 40; bottom: calc(var(--nav-h) + var(--mini-h) + env(safe-area-inset-bottom) + 20px);
  max-width: 520px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px;
  font-weight: 500; white-space: pre-line; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }

/* волна */
.wave { background: linear-gradient(120deg, #3a2030, #2a2440 60%, #1f2a44); border-radius: 18px; padding: 16px 16px 4px; margin-bottom: 14px; }
.wave.on { background: linear-gradient(120deg, #6b2b22, #47264a 60%, #24305a); }
.wave-top { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
.wave-top .grow { flex: 1; min-width: 0; display: grid; }
.wave-top b { font-size: 22px; letter-spacing: -.3px; }
.wave-top span { color: #cfc6dc; font-size: 13px; }
.wave .play { width: 54px; height: 54px; background: var(--accent); color: var(--accent-ink); }
.wave .chip { background: rgba(255, 255, 255, .1); color: #e6dff0; }
.wave .chip.on { background: var(--text); color: var(--bg); }
.note { font-size: 12.5px; padding-bottom: 8px; }
.sheet-body a.item { display: block; color: var(--text); text-decoration: none; }
