/* muz — треки из стримов. Темы: тёмная (по умолч.) и светлая, через токены. */
:root {
  color-scheme: dark;
  --bg: #08080d;
  --bg-soft: #0e0e17;
  --glow-1: rgba(139, 92, 246, 0.22);
  --glow-2: rgba(34, 211, 238, 0.13);
  --glow-3: rgba(236, 72, 153, 0.11);
  --surface: rgba(255, 255, 255, 0.038);
  --surface-2: rgba(255, 255, 255, 0.07);
  --surface-3: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.17);
  --text: #eceaf6;
  --muted: #aaa4c6;
  --faint: #837ea0;
  --field-bg: rgba(0, 0, 0, 0.28);
  --shadow: 0 22px 60px -22px rgba(0, 0, 0, 0.72);
  --shadow-sm: 0 8px 24px -14px rgba(0, 0, 0, 0.6);
  --track-bg: rgba(255, 255, 255, 0.07);
  --violet: #8b5cf6;
  --pink: #ec4899;
  --cyan: #22d3ee;
  --cyan-ink: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --grad: linear-gradient(100deg, #8b5cf6 0%, #ec4899 50%, #22d3ee 100%);
  --r: 18px;
  --r-sm: 12px;
  --maxw: 1120px;
  font-synthesis: none;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5fb;
  --bg-soft: #ffffff;
  --glow-1: rgba(139, 92, 246, 0.14);
  --glow-2: rgba(6, 182, 212, 0.10);
  --glow-3: rgba(236, 72, 153, 0.10);
  --surface: #ffffff;
  --surface-2: #f1eefb;
  --surface-3: #e9e5f7;
  --border: rgba(28, 22, 54, 0.10);
  --border-2: rgba(28, 22, 54, 0.20);
  --text: #181527;
  --muted: #57516e;
  --faint: #837e98;
  --field-bg: #ffffff;
  --shadow: 0 24px 60px -28px rgba(60, 40, 110, 0.30);
  --shadow-sm: 0 10px 28px -18px rgba(60, 40, 110, 0.30);
  --track-bg: rgba(28, 22, 54, 0.05);
  --cyan-ink: #0a8aa3;
  --grad: linear-gradient(100deg, #7c3aed 0%, #db2777 50%, #0891b2 100%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  transition: background-color .3s ease, color .3s ease;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 78% -8%, var(--glow-1), transparent 60%),
    radial-gradient(720px 460px at 6% 2%, var(--glow-2), transparent 55%),
    radial-gradient(820px 600px at 50% 112%, var(--glow-3), transparent 60%);
}
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- header / nav ---------- */
header.top {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.top-in { display: flex; align-items: center; gap: 14px; height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; cursor: pointer; font-weight: 800; font-size: 21px; letter-spacing: -0.02em; background: none; border: none; padding: 0; }
.brand small { font-weight: 600; color: var(--faint); font-size: 12px; }
.eq { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 20px; }
.eq i { width: 3px; border-radius: 2px; background: var(--grad); animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(1){animation-delay:-.9s} .eq i:nth-child(2){animation-delay:-.4s}
.eq i:nth-child(3){animation-delay:-.7s} .eq i:nth-child(4){animation-delay:-.2s}
@keyframes eq { 0%,100%{height:5px} 50%{height:20px} }
.spacer { flex: 1; }

nav.menu { display: flex; gap: 4px; }
nav.menu a { padding: 9px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14.5px; cursor: pointer; transition: background-color .15s, color .15s; }
nav.menu a:hover { color: var(--text); background: var(--surface-2); }
nav.menu a.active { color: var(--text); background: var(--surface-2); }

.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); cursor: pointer; transition: .15s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill.on .dot { background: var(--green); box-shadow: 0 0 10px 1px color-mix(in srgb, var(--green) 70%, transparent); animation: pulse 2s infinite; }
.pill.off .dot { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ---------- hero / submit ---------- */
.hero { padding: 54px 0 26px; }
.hero h1 { font-size: clamp(30px, 5vw, 50px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 800; }
.hero p { color: var(--muted); font-size: 17px; max-width: 600px; margin: 0 0 26px; }

.submit { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow-sm); }
.submit-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { flex: 1 1 320px; display: flex; align-items: center; gap: 10px; background: var(--field-bg);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 14px; transition: border-color .2s, box-shadow .2s; }
.field:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 22%, transparent); }
.field svg { color: var(--faint); flex: none; }
.field input { flex: 1; background: none; border: none; outline: none; padding: 15px 0; font-size: 15px; min-width: 0; }
.field input::placeholder { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
select.step { background: var(--field-bg); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 0 12px; height: 52px; color: var(--muted); cursor: pointer; }
.btn { border: none; cursor: pointer; border-radius: var(--r-sm); padding: 0 22px; height: 52px; font-weight: 700; font-size: 15px;
  background: var(--grad); color: #fff; display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--pink) 50%, transparent); transition: transform .15s, box-shadow .2s, filter .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.hint { color: var(--faint); font-size: 13.5px; margin: 11px 4px 0; }
.hint b { color: var(--muted); font-weight: 700; }
.err { color: var(--red); font-size: 14px; margin: 10px 4px 0; }

/* ---------- sections ---------- */
.section { padding: 26px 0; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px; }
.section-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.section-head .count { color: var(--faint); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.section-head .sub { color: var(--faint); font-size: 14px; margin-left: auto; }

/* ---------- job / progress ---------- */
.job { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.job-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.job-stage { font-weight: 700; font-size: 16px; }
.job-pct { color: var(--faint); font-weight: 700; font-variant-numeric: tabular-nums; }
.job-url { color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; margin-left: auto; }
.listening { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.listening i { width: 3px; border-radius: 2px; background: var(--cyan); animation: eq 0.9s ease-in-out infinite; }
.listening i:nth-child(2){animation-delay:-.3s} .listening i:nth-child(3){animation-delay:-.6s} .listening i:nth-child(4){animation-delay:-.15s}
.bar { height: 12px; border-radius: 999px; background: var(--track-bg); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--grad);
  transition: width .5s cubic-bezier(.4,0,.2,1); position: relative; }
.bar > span::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent); animation: shimmer 1.6s infinite; }
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }
.bar.indet > span { width: 35% !important; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0%{margin-left:-35%} 100%{margin-left:100%} }
.job-meta { display: flex; gap: 22px; margin-top: 13px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.job-meta b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.job-last { margin-top: 12px; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 9px; min-height: 20px; }
.job-last .tk { color: var(--text); font-weight: 600; }

/* ---------- catalog / history ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; cursor: pointer;
  transition: transform .18s, border-color .2s, box-shadow .2s; display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit; font: inherit; }
.card:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow); }
.card .cover { height: 92px; background: var(--grad); position: relative; }
.card .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.45)); }
.card .cover .badge { position: absolute; right: 12px; bottom: 10px; z-index: 1; background: rgba(8,8,13,0.5);
  backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.22); color: #fff; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.card .body { padding: 15px 16px 17px; }
.card .body h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .by { color: var(--muted); font-size: 13px; }
.card .row { display: flex; gap: 14px; margin-top: 11px; color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; align-items: center; }
.card .row span { display: inline-flex; gap: 5px; align-items: center; }
.empty { color: var(--faint); text-align: center; padding: 44px 20px; border: 1px dashed var(--border-2); border-radius: var(--r); }
.empty svg { color: var(--faint); margin-bottom: 10px; opacity: .8; }
.skeleton { height: 192px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--border); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent); animation: shimmer 1.4s infinite; }

/* ---------- tracklist view ---------- */
.back { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; margin: 8px 0 18px; background: none; border: none; padding: 8px 2px; }
.back:hover { color: var(--text); }
.tl-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.tl-head h1 { margin: 0 0 10px; font-size: clamp(22px, 3.6vw, 32px); letter-spacing: -0.02em; }
.tl-head .sub { color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.tl-head .sub a { color: var(--cyan-ink); font-weight: 600; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 14px; }
.stat b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { color: var(--faint); font-size: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px; width: fit-content; }
.tabs button { border: none; background: none; cursor: pointer; padding: 9px 18px; border-radius: 999px; color: var(--muted); font-weight: 600; transition: .15s; min-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.ghost { background: var(--surface); border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  border-radius: var(--r-sm); padding: 10px 14px; font-weight: 600; font-size: 13px; display: inline-flex; gap: 7px; align-items: center; transition: .15s; min-height: 40px; }
.ghost:hover { color: var(--text); border-color: var(--border-2); }
.tracks-list { display: flex; flex-direction: column; gap: 2px; }
.trk { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-sm); transition: background .15s; }
.trk:hover { background: var(--surface); }
.trk .tc { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--cyan-ink);
  background: color-mix(in srgb, var(--cyan-ink) 13%, transparent); border-radius: 7px; padding: 4px 8px; flex: none; min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.trk .n { color: var(--faint); width: 26px; text-align: right; flex: none; font-variant-numeric: tabular-nums; font-size: 13px; }
.trk .ti { flex: 1; min-width: 0; }
.trk .ti .t { font-weight: 600; }
.trk .ti .a { color: var(--muted); font-size: 13px; }
.trk .cnt { color: var(--faint); font-size: 12.5px; flex: none; font-variant-numeric: tabular-nums; }
.trk .warn { color: var(--amber); flex: none; display: inline-flex; }

.card .rec { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--faint); margin-bottom: 7px; }
.sub .rec { background: color-mix(in srgb, var(--violet) 18%, transparent); color: var(--text); border-radius: 999px; padding: 3px 11px; font-weight: 700; font-size: 13px; }
.trk .links { display: flex; gap: 6px; flex: none; margin-left: 4px; }
.trk .links a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--faint); border: 1px solid var(--border); transition: color .15s, border-color .15s, background-color .15s; }
.trk .links a:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--bg-soft); border: 1px solid var(--border-2); color: var(--text); border-radius: var(--r-sm); padding: 12px 18px; font-size: 14px;
  box-shadow: var(--shadow); transition: .25s; z-index: 100; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
/* ---------- login ---------- */
body.locked nav.menu, body.locked #worker-pill { display: none; }
.login { min-height: calc(100dvh - 220px); display: grid; place-items: center; padding: 40px 0; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 28px 28px 30px; box-shadow: var(--shadow); }
.login-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.login-card h1 { font-size: 19px; margin: 14px 0 20px; color: var(--muted); font-weight: 700; }
.login-card .field { margin-bottom: 11px; }
.login-card .field input { padding: 14px 0; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.login-card .err { margin-top: 12px; text-align: center; }

footer { color: var(--faint); font-size: 13px; text-align: center; padding: 40px 0 30px; }

@media (max-width: 680px) {
  .top-in { gap: 8px; }
  .brand small { display: none; }
  nav.menu a { padding: 9px 10px; }
  .pill .txt { display: none; }
  .hero { padding: 34px 0 18px; }
  .submit-row { flex-direction: column; }
  .field, select.step, .btn { width: 100%; }
  select.step, .btn { height: 50px; }
  .trk .n { display: none; }
  .job-url { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
