:root {
  color-scheme: dark;
  --bg: #0e1015;
  --surface: #151922;
  --surface-2: #1b2029;
  --surface-3: #232a36;
  --border: #262d3a;
  --border-soft: #1f2531;
  --text: #e9edf5;
  --text-2: #c3cad8;
  --muted: #8a94a6;
  --accent: #8b7bff;
  --accent-hover: #9c8fff;
  --accent-soft: rgba(139, 123, 255, .14);
  --teal: #3ecfc0;
  --teal-soft: rgba(62, 207, 192, .13);
  --orange: #ffab5e;
  --orange-soft: rgba(255, 171, 94, .12);
  --danger: #ff6b6b;
  --ok: #4ade80;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .45);
  --player-h: 100px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(139, 123, 255, .11), transparent 60%),
    radial-gradient(900px 600px at 92% 4%, rgba(56, 189, 248, .1), transparent 58%),
    radial-gradient(700px 500px at 70% 105%, rgba(255, 171, 94, .05), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { display: block; }
.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.i.big { width: 34px; height: 34px; stroke-width: 1.4; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 16px; background: transparent; color: var(--text-2);
  font-size: .9rem; font-weight: 500; line-height: 1;
  transition: background .15s, color .15s, border-color .15s, transform .08s;
  white-space: nowrap;
}
.btn:hover { color: var(--text); background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: #0e1015; font-weight: 650; }
.btn-primary:hover { background: var(--accent-hover); color: #0e1015; }
.btn-soft { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.btn-soft:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; padding: 12px 16px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ---------- Login ---------- */
.login-view { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, rgba(27, 32, 41, .95), rgba(21, 25, 34, .95));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px 30px 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { margin: 14px 0 6px; font-size: 1.55rem; letter-spacing: -.02em; }
.login-brand p { margin: 0; font-size: .88rem; }
.logo {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), var(--teal));
  color: #0e1015;
  box-shadow: 0 10px 30px rgba(112, 160, 255, .32);
}
.logo svg { width: 26px; height: 26px; fill: currentColor; }
.logo.small { width: 32px; height: 32px; border-radius: 10px; box-shadow: none; }
.logo.small svg { width: 17px; height: 17px; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 11px 14px;
  background: rgba(10, 12, 17, .55);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.field input:focus { outline: none; border-color: var(--accent); background: rgba(10, 12, 17, .8); }
.field input:focus-visible { outline: none; }
.form-error {
  margin: 0 0 14px; padding: 10px 12px; font-size: .84rem;
  color: #ffb4b4; background: rgba(255, 107, 107, .1);
  border: 1px solid rgba(255, 107, 107, .25); border-radius: var(--radius-sm);
}

/* ---------- App shell ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; padding-bottom: var(--player-h); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 24px;
  background: rgba(14, 16, 21, .82);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-name { font-weight: 700; letter-spacing: -.01em; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; flex: 1; }
.crumbs button {
  border: 0; background: none; padding: 5px 7px; border-radius: 7px;
  color: var(--muted); font-size: .88rem;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumbs button:hover { color: var(--text); background: var(--surface-2); }
.crumbs .sep { color: #4a5264; font-size: .8rem; }
.crumbs .here { color: var(--text); font-weight: 550; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.top-actions .icon-btn:hover .i, .top-actions .btn:hover .i { color: var(--orange); }
#upload-files-button .i { color: var(--orange); }
.toolbar-actions .btn:hover .i { color: var(--orange); }

.layout {
  flex: 1; display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  width: 100%; max-width: 1440px; margin: 0 auto;
}

.segmented {
  display: flex; padding: 3px; gap: 3px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
}
.seg {
  flex: 1; padding: 7px 10px; border: none; border-radius: 9px;
  background: none; color: var(--muted); font-size: .82rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--teal), 0 1px 3px rgba(0,0,0,.35); }
/* ---------- Content ---------- */
.content { position: relative; padding: 14px 28px 40px; min-width: 0; }
.library-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.library-tabs { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; }
.library-tabs .seg { flex: none; }
.playlist-result { white-space: pre-line; overflow-wrap: anywhere; color: var(--orange); font-size: .85rem; }
.danger-text { color: #ff8e8e; }
.content-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.content-head > div:first-child { min-width: 0; flex: 1 1 180px; }
.content-head h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.02em; overflow-wrap: anywhere; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 180px; max-width: 380px;
  padding: 0 12px; height: 38px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 999px;
  color: var(--muted);
  transition: border-color .15s, background .15s;
}
.top-search { min-width: 0; }
.search:focus-within { border-color: #3d475c; background: var(--surface-2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: .88rem; }
.search input::placeholder { color: #6f798c; }
.search input::-webkit-search-cancel-button { filter: invert(.6); }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- Entries ---------- */
.library-section { margin-top: 14px; }
.section-heading { display: flex; align-items: baseline; gap: 9px; margin: 0 0 12px; font-size: 1rem; }
.section-count { color: var(--muted); font-size: .8rem; font-weight: 400; }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.folder-grid .entry { background: var(--surface); border-color: var(--border-soft); }
.folder-grid .entry:hover { background: var(--surface-2); border-color: var(--border); }
.track-list { border-top: 1px solid var(--border-soft); padding-top: 6px; }
.track-group { display: flex; align-items: center; gap: 6px; padding: 10px 12px 3px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.track-group:focus-within { position: relative; z-index: 4; }
.track-group-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.track-group .icon-btn { width: 34px; height: 34px; }
.track-group .btn { padding: 6px 10px; font-size: .78rem; }
.sort-controls { display: flex; flex: none; gap: 2px; }
.sort-controls .icon-btn { width: 34px; height: 34px; font-size: 1.15rem; }
.sort-handle { flex: none; color: var(--muted); cursor: grab; font-size: 1.35rem; }
.entry.dragging { opacity: .4; }
.entry {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 11px;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  cursor: pointer;
  animation: entry-in .18s ease-out;
}
@keyframes entry-in { from { opacity: 0; transform: translateY(3px); } }
.entry:hover { background: var(--surface); border-color: var(--border-soft); }
.entry.active { background: var(--accent-soft); border-color: rgba(139, 123, 255, .35); }
.entry-icon {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted);
}
.entry-icon { position: relative; overflow: hidden; }
.entry-icon img, .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.entry-icon .track-cover { opacity: 0; }
.entry-icon .track-cover.loaded { opacity: 1; }
.cover img[hidden] { display: none; }
.entry.folder .entry-icon { color: var(--orange); background: var(--orange-soft); }
.entry.folder .entry-icon.book-icon { color: var(--teal); background: var(--teal-soft); }
.entry.file .entry-icon { color: #9bb8ff; background: rgba(143, 180, 255, .1); }
.entry.active .entry-icon { color: var(--teal); background: var(--teal-soft); }
.entry.active { box-shadow: inset 3px 0 0 var(--accent); }
.entry-text { min-width: 0; flex: 1; }
.entry-name { margin: 0; font-size: .92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-grid .entry-name { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.entry-meta { margin: 2px 0 0; font-size: .74rem; color: var(--muted); }
.entry-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.entry:hover .entry-actions, .entry:focus-within .entry-actions { opacity: 1; }
.entry-actions .icon-btn { width: 34px; height: 34px; }
.entry-actions .icon-btn:hover { background: var(--surface-3); }
.entry:focus-within { position: relative; z-index: 3; }
.entry-menu-wrap { position: relative; }
.entry-menu { position: absolute; z-index: 4; right: 0; top: 100%; min-width: 160px; padding: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.entry-menu button { display: block; width: 100%; padding: 9px 10px; text-align: left; border: 0; border-radius: 6px; background: transparent; color: var(--text); }
.entry-menu button:hover { background: var(--surface-3); }
.entry-menu button.danger { color: #ff8e8e; }
@media (hover: none) { .entry-actions { opacity: 1; } }

.playing-bars { display: flex; align-items: flex-end; gap: 2px; width: 16px; height: 14px; }
.playing-bars i { display: block; width: 3px; background: var(--teal); border-radius: 2px; height: 40%; animation: bars .9s ease-in-out infinite; }
.playing-bars i:nth-child(2) { animation-delay: -.3s; height: 90%; }
.playing-bars i:nth-child(3) { animation-delay: -.6s; height: 60%; }
@keyframes bars { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 64px 20px; color: var(--text-2); }
.empty-icon { width: 54px; height: 54px; fill: none; stroke: #6d7488; stroke-width: 1.3; margin-bottom: 16px; }
.empty p { margin: 0 0 6px; }
.empty p.muted { font-size: .86rem; max-width: 340px; }

/* ---------- Drop overlay ---------- */
.drop-overlay {
  position: absolute; inset: 8px; z-index: 15;
  display: grid; place-items: center;
  background: rgba(14, 16, 21, .86);
  border: 2px dashed var(--accent); border-radius: 18px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.drop-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-2); font-weight: 500; }
.drop-overlay .i { color: var(--accent); }

/* ---------- Queue ---------- */
.queue-panel {
  width: 320px; flex: none;
  border-left: 1px solid var(--border-soft);
  padding: 20px 16px 28px;
  background: rgba(17, 20, 27, .6);
  display: flex; flex-direction: column;
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } }
.queue-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 6px; }
.queue-head h3 { margin: 0; font-size: .95rem; }
.queue-empty { padding: 6px; font-size: .84rem; }
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: calc(100vh - 260px); }
.queue li button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; border-radius: 9px;
  background: none; text-align: left; color: var(--text-2);
  font-size: .84rem;
}
.queue li button:hover { background: var(--surface-2); color: var(--text); }
.queue li.active button { background: var(--accent-soft); color: var(--text); }
.queue .num { width: 20px; flex: none; color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; text-align: right; }
.queue li.active .num { color: var(--teal); }
.queue .q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Player ---------- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) minmax(180px, 1fr);
  align-items: center; gap: 20px;
  height: var(--player-h);
  padding: 0 22px;
  background: rgba(19, 22, 30, .9);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cover {
  display: grid; place-items: center; flex: none;
  position: relative; width: 64px; height: 64px; border-radius: 12px;
  background: linear-gradient(145deg, var(--surface-3), var(--surface-2));
  color: #5f6a7e; overflow: hidden;
  border: 1px solid var(--border-soft);
}
.cover svg { width: 24px; height: 24px; fill: currentColor; }
.cover.has-track { background: linear-gradient(145deg, rgba(139, 123, 255, .34), rgba(62, 207, 192, .2)); color: var(--teal); }
.now-text { min-width: 0; }
.now-title { margin: 0; font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-path { margin: 3px 0 0; font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.transport { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.transport-buttons { display: flex; align-items: center; gap: 12px; }
.play-btn {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: var(--text); color: #101218;
  transition: transform .1s, background .15s, opacity .15s;
}
.play-btn:hover:not(:disabled) { transform: scale(1.05); background: #fff; }
.play-btn:active:not(:disabled) { transform: scale(.97); }
.play-btn:disabled { opacity: .35; cursor: default; }
.play-btn .i { width: 21px; height: 21px; }
.play-btn .pause-icon { display: none; }
body.playing .play-btn .pause-icon { display: block; }
body.playing .play-btn .play-icon { display: none; }

.timeline { display: flex; align-items: center; gap: 10px; width: 100%; }
.time { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; width: 34px; flex: none; }
.time:last-child { text-align: right; }
.seek, .range { -webkit-appearance: none; appearance: none; background: transparent; height: 18px; border: none; padding: 0; }
.seek { flex: 1; min-width: 0; }
.seek::-webkit-slider-runnable-track, .range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0%, var(--teal) var(--fill, 0%), #39414f var(--fill, 0%));
}
.seek::-moz-range-track, .range::-moz-range-track { height: 4px; border-radius: 999px; background: #39414f; }
.seek::-moz-range-progress, .range::-moz-range-progress { height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--teal)); }
.seek::-webkit-slider-thumb, .range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; margin-top: -4px; border-radius: 50%;
  background: var(--text); border: none; opacity: 0;
  transition: opacity .15s;
}
.seek:hover::-webkit-slider-thumb, .seek:focus-visible::-webkit-slider-thumb,
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { opacity: 1; }
.seek::-moz-range-thumb, .range::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: var(--text); }
.seek:disabled, .range:disabled { opacity: .45; }

.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.player-mode { position: relative; color: var(--muted); }
.icon-btn.player-mode.active, .icon-btn.rating.active { color: var(--teal); }
.rating.dislike.active { color: var(--danger); }
.rating.active .i { fill: currentColor; fill-opacity: .18; }
.repeat-one { display: none; position: absolute; top: 3px; right: 3px; color: var(--teal); font-size: .65rem; font-weight: 700; }
.player-mode.one .repeat-one { display: block; }
.volume { display: flex; align-items: center; gap: 6px; }
.volume .range { width: 78px; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--teal-soft); color: var(--teal);
  font-size: .7rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
audio { display: none; }

/* ---------- Uploads ---------- */
.uploads:empty { display: none; }
.uploads {
  position: fixed; right: 18px; bottom: calc(var(--player-h) + 16px); z-index: 40;
  width: min(380px, calc(100vw - 36px));
  max-height: min(50vh, 480px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.upload-item {
  padding: 12px 14px;
  background: rgba(23, 27, 37, .97);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
  animation: slide-up .18s ease-out;
}
@keyframes slide-up { from { opacity: 0; transform: translateY(10px); } }
.upload-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.upload-name { flex: 1; min-width: 0; font-size: .82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { flex: none; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.upload-status.done { color: var(--teal); }
.upload-status.error { color: var(--danger); }
.upload-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--teal)); transition: width .2s ease; }
.upload-item.error .upload-bar span { background: var(--danger); }
.upload-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px; font-size: .78rem; color: var(--text-2);
}
.upload-head button { border: none; background: none; color: var(--muted); font-size: .78rem; text-decoration: underline; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(460px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 11px 16px; border-radius: 11px;
  background: rgba(28, 33, 44, .98); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: .84rem; text-align: center;
  animation: toast-in .18s ease-out;
}
.toast.error { border-color: rgba(255, 107, 107, .4); color: #ffc4c4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Dialog ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text);
  padding: 0; width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(5, 7, 10, .7); backdrop-filter: blur(3px); }
.dialog-body { padding: 24px; }
.dialog-body h3 { margin: 0 0 10px; font-size: 1.06rem; }
.dialog-body p { margin: 0 0 16px; color: var(--text-2); font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .82rem; color: var(--muted); margin-bottom: 20px; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.entry-name-label { display: block; margin-bottom: 18px; color: var(--text-2); font-size: .85rem; }
.entry-name-label[hidden] { display: none; }
.entry-name-label input { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.entry-name-label input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.entry-name-label select { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.btn-danger { background: #ad3f50; color: white; }
.cover-file-label { display: block; margin-bottom: 16px; color: var(--text-2); font-size: .85rem; }
.cover-file-label input { display: block; max-width: 100%; margin-top: 8px; color: var(--text); }
.cover-dialog-status { margin-top: 14px; white-space: pre-line; }
#cover-recursive-label[hidden] { display: none; }

.stats-dialog { width: min(850px, calc(100vw - 32px)); max-height: min(80vh, 850px); padding: 22px; }
.stats-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats-header h2 { margin: 0 0 16px; font-size: 1.2rem; }
.stats-header .icon-btn { align-self: flex-start; flex: none; }
.stats-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.stats-controls select { margin-left: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.stats-duration { color: var(--teal); font-weight: 600; }
.stats-note { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.stats-table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; text-align: left; }
.stats-table th, .stats-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.stats-table th:not(:first-child), .stats-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.stats-table td:first-child { overflow-wrap: anywhere; }
.stats-track-title, .stats-track-artist, .stats-track-filename { display: block; }
.stats-track-artist, .stats-track-filename { margin-top: 3px; color: var(--muted); font-size: .82rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .queue-panel { position: fixed; right: 0; top: 0; bottom: var(--player-h); z-index: 25; width: min(340px, 92vw); background: #12151d; box-shadow: -20px 0 50px rgba(0,0,0,.4); }
}
@media (max-width: 820px) {
  :root { --player-h: 158px; }
  .layout { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand-name { display: none; }
  .crumbs { flex: 1; }
  .crumbs button { max-width: 130px; padding: 5px 4px; }
  .player { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px 12px; padding: 10px 14px; height: var(--player-h); }
  .now { grid-column: 1; grid-row: 1; }
  .player-right { grid-column: 2; grid-row: 1; }
  .transport { grid-column: 1 / -1; grid-row: 2; }
  .transport-buttons { gap: 8px; }
  .timeline { padding: 0; }
  .volume { display: none; }
  .hide-sm { display: none; }
  .uploads { bottom: calc(var(--player-h) + 10px); right: 10px; }
  .toasts { top: 10px; }
}
@media (max-width: 520px) {
  .stats-table thead { display: none; }
  .stats-table tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border-soft); padding: 8px 0; }
  .stats-table td { border: 0; padding: 4px 8px; }
  .stats-table td:first-child { grid-column: 1 / -1; }
  .stats-table td:not(:first-child) { text-align: left; }
  .stats-table td:nth-child(2)::before { content: 'Полностью: '; color: var(--muted); }
  .stats-table td:nth-child(3)::before { content: 'Частично: '; color: var(--muted); }
  .toolbar-actions .btn { padding: 8px 12px; }
  .toolbar-actions .btn .i { width: 16px; height: 16px; }
  .entry { padding: 8px 8px; gap: 10px; }
  .entry-icon { width: 34px; height: 34px; border-radius: 9px; }
  .search { max-width: none; }
  .content-head h2 { font-size: 1.2rem; }
  .top-actions .btn { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
