/* ============================================================
   Music Panel — flat streaming-app theme
   black canvas, compact rows, Spotify/Yandex-like density
   ============================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
                 U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #121212;
  --bg-deep: #000000;
  --surface: #181818;
  --surface-hover: #282828;
  --surface-2: #1f1f1f;
  --surface-3: #242424;
  --line: #2a2a2a;
  --line-soft: #222222;
  --text: #ffffff;
  --text-sub: #b3b3b3;
  --muted: #8f8f8f;
  --accent: #1ed760;
  --accent-hover: #3be477;
  --accent-ink: #000000;
  --good: #1ed760;
  --warn: #ffa42b;
  --bad: #f15e6c;
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar: 232px;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--text); text-decoration: underline; }

h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin: 26px 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
p { margin: 8px 0; }

.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-sub); }
.small { font-size: 12px; color: var(--text-sub); }
.big { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }

/* ---------------- layout ---------------- */

.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-deep);
  border-right: 0;
  padding: 10px 0 12px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 14px; margin: 0; font-size: 15px; font-weight: 700;
  letter-spacing: -0.01em; color: var(--text);
}
.brand .mark {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-size: 15px; font-weight: 700;
}
.brand:hover { text-decoration: none; }

nav { display: flex; flex-direction: column; gap: 0; overflow: auto; padding: 0 8px; }
nav .nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-sub); padding: 14px 12px 6px;
}
nav a {
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-sub);
  font-size: 14px; font-weight: 500; display: block;
}
nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
nav a.active { background: var(--surface-2); color: var(--text); font-weight: 700; }

.me {
  margin-top: auto; padding: 12px 16px 0; border-top: 1px solid var(--line-soft);
  margin-left: 8px; margin-right: 8px; display: flex; flex-direction: column; gap: 3px;
}
.me .who { font-size: 13px; font-weight: 600; word-break: break-word; }
.me .role { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); font-weight: 600; }
.me .links { display: flex; gap: 14px; margin-top: 6px; font-size: 12px; }
.me a { color: var(--text-sub); }
.me a:hover { color: var(--text); text-decoration: none; }

.content { min-width: 0; padding: 26px clamp(18px, 4vw, 44px) 64px; }
main { max-width: 1120px; }

/* ---------------- cards ---------------- */

.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 12px 0;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.narrow { max-width: 420px; margin: 48px auto; background: var(--bg-deep); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.grid.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 16px 0; }
.stat {
  background: var(--surface); border-radius: var(--radius); padding: 16px 18px;
}
.stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat span { display: block; margin-top: 3px; font-size: 11px; font-weight: 600;
             letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-sub); }
.stat.good b { color: var(--accent); }
.stat.bad b { color: var(--bad); }

/* ---------------- buttons ---------------- */

button, .btn {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  background: transparent; border: 1px solid #7a7a7a;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
button:hover, .btn:hover { border-color: var(--text); transform: scale(1.02); text-decoration: none; }
button:active, .btn:active { transform: scale(.99); }
button[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary, button.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  font-weight: 700;
}
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { padding: 5px 12px; font-size: 12px; }
button.tiny { padding: 3px 10px; font-size: 11.5px; border-radius: var(--radius-sm); }
form.inline { display: inline; }
form.stack { display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- forms ---------------- */

input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 11px; width: 100%;
}
input::placeholder, textarea::placeholder { color: #7a7a7a; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #fff;
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px;
        font-weight: 600; color: var(--text-sub); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.searchbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.ph { color: var(--muted); }

/* ---------------- tables (track-list like) ---------------- */

table.list { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13.5px; }
table.list th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-sub); white-space: nowrap;
}
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list tr:hover td { background: var(--surface-2); }
table.list tr.have td { opacity: .55; }

/* ---------------- tags, flashes ---------------- */

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 999px;
  color: var(--text-sub); background: var(--surface-3);
}
.tag.good { color: var(--accent); background: #12351f; }
.tag.warn { color: var(--warn); background: #352812; }
.tag.bad { color: var(--bad); background: #351a1d; }

.flash {
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 16px;
  font-size: 13.5px; background: var(--surface-3); color: var(--text);
}
.flash.ok { background: #12351f; color: #b7f0c8; }
.flash.err { background: #351a1d; color: #ffc2c2; }

/* ---------------- lists ---------------- */

ul.tracks { list-style: none; margin: 8px 0; padding: 0; }
ul.tracks li {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
}
ul.tracks li:hover { background: var(--surface-2); }
ul.tracks li span { color: var(--text-sub); }

/* ---------------- misc ---------------- */

.tile { background: var(--surface); border-radius: var(--radius); padding: 14px; }
.artist-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin: 8px 0 4px; }
.artist-head img { border-radius: 50%; }
.warnbox { background: #352812; color: #ffd9a3; border-radius: var(--radius-sm);
           padding: 10px 14px; font-size: 13px; }
.drop { border: 1px dashed #4d4d4d; border-radius: var(--radius); padding: 28px;
        text-align: center; color: var(--text-sub); }
.drop-sub { font-size: 12px; margin-top: 6px; }
.drop-list { list-style: none; padding: 0; margin: 8px 0; }
.drop-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.arrow { color: var(--muted); font-size: 16px; padding: 0 4px; }
.bar { height: 4px; background: #4d4d4d; border-radius: 2px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--text); border-radius: 2px; }
.req { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.path { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }
.info { color: var(--text-sub); }
.lidarr_ok { color: var(--accent); font-weight: 600; }
.lidarr_bad, .lidarr_off { color: var(--bad); font-weight: 600; }
main > h1 { margin-bottom: 2px; }
main > h1 + p { margin-top: 8px; }

/* flow (admin) */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin: 10px 0 18px; }
.flow .box { flex: 1 1 150px; min-width: 150px; background: var(--surface);
             border-radius: var(--radius); padding: 12px 14px; }
.flow .box b { display: block; margin-bottom: 4px; font-size: 13px; }
.flow .box span { font-size: 12px; color: var(--text-sub); }
.flow .arrow { align-self: center; color: #6a6a6a; font-size: 15px; padding: 0 2px; }

/* processes (admin) */
.proc { display: grid; grid-template-columns: 1.2fr .5fr .5fr 2fr; gap: 10px; align-items: center;
        padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.proc:last-child { border-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.dot.on { background: var(--accent); }
.dot.off { background: #555; }

details.logs { background: var(--surface); border-radius: var(--radius);
               padding: 10px 14px; margin-bottom: 8px; }
details.logs summary { cursor: pointer; font-size: 13px; font-weight: 600; }
details.logs pre {
  max-height: 300px; overflow: auto; margin: 10px 0 0; padding: 12px;
  background: #0a0a0a; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11.5px; color: #cfcfcf;
  white-space: pre-wrap; line-height: 1.5;
}

/* guest */
.guest { max-width: 400px; margin: 14vh auto; padding: 0 18px; }

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 8px 0 6px; border-bottom: 1px solid var(--line-soft); }
  .brand { padding: 6px 14px 8px; }
  nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 0 10px; }
  nav .nav-label { display: none; }
  nav a { white-space: nowrap; padding: 8px 12px; }
  .me { flex-direction: row; align-items: center; justify-content: space-between;
        margin: 8px 14px 0; padding: 8px 0 0; gap: 10px; }
  .me .links { margin-top: 0; }
  .content { padding: 18px 14px 48px; }
  .row2 { grid-template-columns: 1fr; }
  .proc { grid-template-columns: 1fr; gap: 4px; }
  .flow .arrow { display: none; }
}

/* ---------------- login: laconic scene ---------------- */

.guest.auth { max-width: none; margin: 0; padding: 0; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 430px) 1fr;
  background: #000;
}

.auth-card {
  align-self: center;
  padding: 44px 48px 52px;
  border-right: 1px solid #171717;
  background: #050505;
}
.auth-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--text);
  margin-bottom: 42px;
}
.auth-brand .mark {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #000; font-size: 14px;
}
.auth-card h1 { font-size: 30px; margin-bottom: 26px; letter-spacing: -0.02em; }
.auth-form { display: flex; flex-direction: column; gap: 14px; max-width: 320px; }
.auth-form input { background: #101010; border-color: #232323; padding: 11px 12px; }
.auth-form input:focus { border-color: #4d4d4d; }
.auth-form button { margin-top: 8px; justify-content: center; padding: 11px 16px; }

.auth-art {
  position: relative; overflow: hidden; background: #000;
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.rings { position: absolute; inset: 0; display: grid; place-items: center; }
.rings i {
  position: absolute; border-radius: 50%; border: 1px solid #1e2a22;
  animation: auth-spin 120s linear infinite;
}
.rings i:nth-child(1) { width: 34vmax; height: 34vmax; border-style: dashed; border-color: #223027; }
.rings i:nth-child(2) { width: 52vmax; height: 52vmax; border-color: #18211b; }
.rings i:nth-child(3) { width: 70vmax; height: 70vmax; border-color: #121814; animation-duration: 200s; }
.rings i:nth-child(4) { width: 22vmax; height: 22vmax; border-color: #2a3a2f; animation-duration: 80s; }
.disc {
  position: absolute; left: 50%; top: 50%; width: 30vmax; height: 30vmax;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, #0e0e0e 0 2px, #0a0a0a 2px 4px);
  box-shadow: 0 0 0 1px #141414, 0 40px 120px rgba(0,0,0,.9);
  animation: auth-spin 18s linear infinite;
}
.disc span {
  position: absolute; left: 50%; top: 50%; width: 9vmax; height: 9vmax;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--accent); opacity: .9;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}
.disc span::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 1vmax; height: 1vmax;
  transform: translate(-50%, -50%); border-radius: 50%; background: #000;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-card { border-right: 0; padding: 40px 24px; }
  .auth-art { min-height: 42vh; order: 2; }
  .auth-form { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rings i, .disc { animation: none; }
}

/* ---------------- browser player ---------------- */

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 2fr) minmax(120px, 1fr);
  gap: 18px; align-items: center;
  padding: 10px 18px;
  background: #0a0a0a;
  border-top: 1px solid #1c1c1c;
}
.player[hidden] { display: none; }
.has-player .content { padding-bottom: 104px; }

.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-cover {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 4px; overflow: hidden;
  background: #161616;
}
.player-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player-meta { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.player-meta #mp-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-meta #mp-artist { color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-center { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pbtn {
  width: 34px; height: 34px; padding: 0; border: 1px solid transparent; background: transparent;
  border-radius: 50%; color: var(--text-sub); font-size: 14px; display: grid; place-items: center;
}
.pbtn:hover { color: var(--text); border-color: #333; transform: none; }
.pbtn.play {
  width: 40px; height: 40px; background: var(--text); color: #000; border-color: var(--text);
  font-size: 15px;
}
.pbtn.play:hover { background: var(--accent); border-color: var(--accent); }
.player-progress { display: flex; align-items: center; gap: 10px; }
.player-progress .mono { color: var(--text-sub); min-width: 34px; text-align: center; }
.player-progress input[type="range"] { flex: 1; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; padding: 0;
  background: #3a3a3a; border: 0; border-radius: 2px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--text); border: 0;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0;
}
.player-right { display: flex; justify-content: flex-end; }
.player-right input[type="range"] { max-width: 120px; }

@media (max-width: 760px) {
  .player { grid-template-columns: 1fr auto; grid-template-areas: "track right" "center center"; gap: 8px; padding: 8px 12px; }
  .player-track { grid-area: track; }
  .player-right { grid-area: right; }
  .player-center { grid-area: center; }
  .player-right input[type="range"] { display: none; }
}

/* кнопки проигрывания в списках */
.play-btn {
  border: 0; background: transparent; color: var(--text-sub); padding: 2px 6px;
  border-radius: 50%; font-size: 13px; width: 28px; height: 28px; display: grid; place-items: center;
}
.play-btn:hover { color: var(--accent); background: #1d1d1d; transform: none; }
.row-play { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }

/* ---------------- home (Navidrome-like) ---------------- */

.home-head { margin-bottom: 8px; }
.home-head h1 { margin-bottom: 4px; }

.home-section { margin: 26px 0 8px; }
.home-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.home-title h2 { margin: 0; }

.cards-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr);
  gap: 14px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin;
}
.album-card { display: block; min-width: 0; color: var(--text); border: 0; }
.album-card:hover { text-decoration: none; }
.album-card:hover .album-cover { transform: scale(1.02); }
.album-cover {
  aspect-ratio: 1 / 1; border-radius: 4px; overflow: hidden; background: #1a1a1a;
  transition: transform .15s ease;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-name {
  margin-top: 8px; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.album-artist { color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card:hover .album-name { color: var(--accent); }

.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.genre-tile {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px 11px 18px; border-radius: 4px; background: var(--surface);
  color: var(--text); position: relative; overflow: hidden; border: 0;
}
.genre-tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--g);
}
.genre-tile:hover { background: var(--surface-hover); text-decoration: none; }
.genre-name { font-size: 13.5px; font-weight: 600; }
.genre-count { color: var(--text-sub); font-size: 11.5px; }
.g0 { --g: #1ed760; } .g1 { --g: #3b82f6; } .g2 { --g: #f59e0b; }
.g3 { --g: #ec4899; } .g4 { --g: #8b5cf6; } .g5 { --g: #14b8a6; }
.g6 { --g: #ef4444; } .g7 { --g: #a3e635; }

.pl-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pl-card {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  background: var(--surface); border-radius: 4px; color: var(--text);
}
.pl-card:hover { background: var(--surface-hover); text-decoration: none; }
.pl-name { font-size: 13.5px; font-weight: 600; }

/* страница альбома */
.album-head { display: flex; gap: 22px; align-items: flex-end; margin: 6px 0 18px; flex-wrap: wrap; }
.album-big-cover {
  width: 190px; height: 190px; flex: 0 0 190px; border-radius: 6px; overflow: hidden; background: #1a1a1a;
}
.album-big-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-head-info { min-width: 240px; }
.album-head-info h1 { font-size: 34px; letter-spacing: -0.03em; }

/* крестик закрытия плеера */
.player-right { gap: 12px; align-items: center; }
.pbtn.close { font-size: 12px; color: var(--text-sub); }
.pbtn.close:hover { color: var(--bad); border-color: #4a2424; }

@media (max-width: 760px) {
  .cards-row { grid-auto-columns: 130px; }
  .album-big-cover { width: 130px; height: 130px; flex-basis: 130px; }
  .album-head-info h1 { font-size: 24px; }
}
