/* Фонотека — слой поверх Material 3 (md3.css перенесён из Resonance).
   Здесь только токены тёмной темы, иконки-SVG вместо шрифта Material Symbols,
   кнопки, слайдеры, сгенерированные обложки и мобильная адаптация. */

/* ---------- тёмная тема (Material 3, сид — лаванда) ---------- */

:root[data-theme='dark'] {
  color-scheme: dark;
  --md-sys-color-primary: #cfbcff;
  --md-sys-color-on-primary: #381e72;
  --md-sys-color-primary-container: #4f378b;
  --md-sys-color-on-primary-container: #eaddff;
  --md-sys-color-secondary: #cbc2db;
  --md-sys-color-on-secondary: #332d41;
  --md-sys-color-secondary-container: #4a4458;
  --md-sys-color-on-secondary-container: #e8def8;
  --md-sys-color-tertiary: #efb8c8;
  --md-sys-color-on-tertiary: #492532;
  --md-sys-color-tertiary-container: #633b48;
  --md-sys-color-on-tertiary-container: #ffd8e4;
  --md-sys-color-error: #f2b8b5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8c1d18;
  --md-sys-color-on-error-container: #f9dedc;
  --md-sys-color-surface: #141218;
  --md-sys-color-surface-dim: #141218;
  --md-sys-color-surface-bright: #3b383e;
  --md-sys-color-surface-container-lowest: #0f0d13;
  --md-sys-color-surface-container-low: #1d1b20;
  --md-sys-color-surface-container: #211f26;
  --md-sys-color-surface-container-high: #2b2930;
  --md-sys-color-surface-container-highest: #36343b;
  --md-sys-color-on-surface: #e6e0e9;
  --md-sys-color-on-surface-variant: #cac4d0;
  --md-sys-color-outline: #938f99;
  --md-sys-color-outline-variant: #49454f;
  --md-sys-color-inverse-surface: #e6e0e9;
  --md-sys-color-inverse-on-surface: #322f35;
  --md-sys-color-inverse-primary: #6750a4;
  --md-sys-color-shadow: #000000;
  --md-sys-color-scrim: #000000;
  --md-sys-color-surface-tint: #cfbcff;
}

/* ---------- база ---------- */

html,
body {
  height: 100%;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}

a {
  color: inherit;
  text-decoration: none;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* SVG-иконки вместо Material Symbols */

.ic {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: block;
  overflow: visible;
  fill: none;
  stroke: none;
}

.rail-brand .ic { width: 26px; height: 26px; }
.rail-item .ic { width: 22px; height: 22px; }
.topbar .icon-button .ic { width: 23px; height: 23px; }
.searchbar .ic { width: 20px; height: 20px; }
.cmd-pill .ic { width: 18px; height: 18px; }
.icon-button .ic { width: 22px; height: 22px; }
.play-button .ic { width: 26px; height: 26px; }
.transport .icon-button .ic { width: 22px; height: 22px; }
.track-actions .ic { width: 20px; height: 20px; }
.album-art .placeholder .ic { width: 40px; height: 40px; }
.hero-art .ic,
.np-art .ic { width: 64px; height: 64px; }
.empty-badge .ic { width: 40px; height: 40px; }
.player-cover .ic { width: 24px; height: 24px; }
.queue-art .ic { width: 18px; height: 18px; }
.np-transport .play-button .ic { width: 32px; height: 32px; }
.np-transport .icon-button .ic { width: 25px; height: 25px; }
.panel-head .ic { width: 22px; height: 22px; }
.segmented button .ic { width: 18px; height: 18px; }
.menu-item .ic { width: 20px; height: 20px; }
.palette-thumb .ic { width: 18px; height: 18px; }
.np-meta-actions .ic { width: 24px; height: 24px; }

/* ---------- кнопки (замена @material/web) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  font: inherit;
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.1px;
  cursor: pointer;
  white-space: nowrap;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  transition:
    background-color var(--dur-short) var(--ease-standard),
    box-shadow var(--dur-short) var(--ease-standard),
    transform var(--dur-short) var(--ease-emphasized);
}

.btn .ic { width: 18px; height: 18px; }

.btn:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-primary) 12%, var(--md-sys-color-primary));
}

.btn:active { transform: scale(0.97); }

.btn.tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.btn.tonal:hover {
  background: color-mix(
    in srgb,
    var(--md-sys-color-on-secondary-container) 10%,
    var(--md-sys-color-secondary-container)
  );
}

.btn.outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
}

.btn.outlined:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
}

.btn.text {
  background: transparent;
  color: var(--md-sys-color-primary);
  padding: 0 12px;
}

.btn.text:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
}

.btn.danger {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

.btn.small { height: 34px; padding: 0 16px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- слайдеры ---------- */

.slider {
  --value: 0%;
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  min-width: 60px;
  cursor: pointer;
  touch-action: none;
  border-radius: 99px;
}

.slider-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 26%, transparent);
}

.slider-active {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  border-radius: inherit;
  background: var(--md-sys-color-primary);
}

.slider-thumb {
  position: absolute;
  top: 50%;
  left: var(--value);
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  transform: translateY(-50%);
  transition: transform var(--dur-short) var(--ease-standard);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.28);
}

.slider:hover .slider-thumb,
.slider.dragging .slider-thumb {
  transform: translateY(-50%) scale(1.25);
}

.slider:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 3px;
}

.volume .slider {
  width: 108px;
  min-width: 72px;
}

/* ---------- обложки-заглушки в стиле Resonance ---------- */

.art-gen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  padding: 12px;
  overflow: hidden;
  background:
    repeating-radial-gradient(
      circle at 74% 22%,
      rgb(255 255 255 / 0.13) 0 1px,
      transparent 1px 22px
    ),
    linear-gradient(
      158deg,
      hsl(var(--h, 265) 78% 44%),
      hsl(calc(var(--h, 265) + 34) 82% 62%)
    );
  color: #fff;
}

.art-gen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 15% 0%, rgb(255 255 255 / 0.16), transparent 60%);
  pointer-events: none;
}

.art-gen b {
  position: relative;
  z-index: 1;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 6px rgb(0 0 0 / 0.28);
}

.art-gen i {
  position: relative;
  z-index: 1;
  font-style: normal;
  font-size: 9.5px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-gen.big b { font-size: 19px; }
.art-gen.big i { font-size: 12px; }

/* ---------- мелкие правки компонентов ---------- */

.rail-item { text-decoration: none; }

.rail-item.active .pill {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.topbar-title-wrap { margin-right: auto; }

.topbar-actions { margin-left: 4px; }

.searchbar input { user-select: text; }

.searchbar input::-webkit-search-cancel-button { display: none; }

.album-card { animation: card-in var(--dur-medium) var(--ease-emphasized-decelerate) both; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
}

.album-card:active .album-art { transform: scale(0.985); }

.album-art { transition: box-shadow var(--dur-short) var(--ease-standard); }

.album-art img { width: 100%; height: 100%; }

.hero-card-art { position: relative; }

.hero-card-art .art-gen b { font-size: 15px; }

.hero-art .art-gen b { font-size: 17px; }

.np-art .art-gen b { font-size: 24px; }
.np-art .art-gen i { font-size: 13px; }

.player-cover .art-gen,
.track-thumb .art-gen,
.queue-art .art-gen { padding: 5px; }
.player-cover .art-gen b,
.track-thumb .art-gen b,
.queue-art .art-gen b { font-size: 7px; -webkit-line-clamp: 3; }
.player-cover .art-gen i,
.track-thumb .art-gen i,
.queue-art .art-gen i { display: none; }

.track-thumb { position: relative; overflow: hidden; }

.track-row:active { background: var(--surface-active); }

.link-text { color: inherit; }
.link-text:hover { color: var(--md-sys-color-primary); text-decoration: underline; }

/* Прогресс-полоска в мини-плеере на телефоне */

.player-progress {
  display: none;
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 99px;
  overflow: hidden;
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 16%, transparent);
}

.player-progress i {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: var(--md-sys-color-primary);
}

/* Now playing — очередь и действия */

.np-queue-title {
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 66%, transparent);
}

.np-empty-queue {
  padding: 24px 8px;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 60%, transparent);
}

.queue-item .qs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.np-close {
  display: grid;
  place-items: center;
}

/* ---------- мобильная версия ---------- */

.mobile-tabs {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--md-sys-color-surface-container);
  box-shadow: inset 0 1px 0 var(--hairline);
}

.mtab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.mtab .ic { width: 22px; height: 22px; }

.mtab.active { color: var(--md-sys-color-primary); }

.mtab.active .ic { stroke-width: 2; }

@media (max-width: 1040px) {
  .cmd-pill { display: none; }
}

@media (max-width: 820px) {
  :root { --rail-width: 0px; --gutter: 16px; }

  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .mobile-tabs { display: flex; }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 8px;
  }

  .topbar-title-wrap { margin-right: 0; }
  .topbar-title { font-size: 19px; line-height: 24px; }
  .topbar-subtitle { display: none; }
  .topbar-actions { margin-left: auto; }

  .searchbar {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    height: 42px;
    min-width: 0;
  }

  .view { padding: 6px 14px 20px; }

  .page-title { font-size: 26px; line-height: 32px; }

  .player {
    height: 66px;
    margin: 0 8px calc(70px + env(safe-area-inset-bottom));
    padding: 0 10px 0 8px;
    border-radius: 20px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
  }

  .player-center { display: flex; flex-direction: row; }
  .player-progress { display: block; }
  .player-right .volume,
  .player-right .queue-btn { display: none; }
  .player-cover { width: 44px; height: 44px; border-radius: 10px; }
  .player-artist { display: block; }
  .player-now .icon-button { width: 36px; height: 36px; }
  .player-now .icon-button .ic { width: 20px; height: 20px; }

  .player .transport { gap: 0; }
  .player .transport [data-act='shuffle'],
  .player .transport [data-act='prev'],
  .player .transport [data-act='repeat'] { display: none; }
  .player .seek-row { display: none; }
  .player .play-button { width: 42px; height: 42px; margin: 0; }
  .player .expand-btn { width: 34px; height: 34px; }

  .np {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  }

  .np-queue { display: none; }
  .np-art { width: min(72vw, 300px); }
  .np-info { width: 100%; }
  .np-title { font-size: 21px; }
  .np-close { top: calc(10px + env(safe-area-inset-top)); right: 12px; }

  .hero-card { gap: 14px; padding: 16px; }
  .hero-card-art { width: 96px; height: 96px; }
  .hero-card-title { font-size: 21px; }
  .hero-card-deco { display: none; }

  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-art { width: 150px; height: 150px; }

  .track-row { padding: 6px 8px; }
}

/* ---------- страница админки ---------- */

.admin-page {
  overflow: auto;
  user-select: auto;
  cursor: auto;
  min-height: 100vh;
  background: var(--md-sys-color-surface);
}

.admin-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0 12px;
  background: linear-gradient(var(--md-sys-color-surface) 70%, transparent);
  backdrop-filter: blur(12px);
}

.admin-top .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.2px;
  margin-right: auto;
}

.admin-top .brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--md-sys-color-on-primary);
  background: linear-gradient(145deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
}

.admin-top .brand-mark .ic { width: 20px; height: 20px; }

.panel.form-panel { gap: 14px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0.2px;
}

.input {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--md-sys-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 14px;
  outline: none;
  min-width: 0;
  user-select: text;
}

.input:focus { border-color: var(--md-sys-color-primary); }

.input.small { height: 38px; font-size: 13px; padding: 0 10px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px 18px;
  border-radius: var(--md-sys-shape-corner-large);
  border: 1.5px dashed var(--md-sys-color-outline);
  background: color-mix(in srgb, var(--md-sys-color-primary) 5%, transparent);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-standard);
}

.dropzone:hover,
.dropzone.over {
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
  border-color: var(--md-sys-color-primary);
}

.dropzone .ic { width: 30px; height: 30px; color: var(--md-sys-color-primary); }

.upload-list { display: flex; flex-direction: column; gap: 8px; }

.upl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 12px;
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-high);
}

.upl-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-pct { font-size: 12px; color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }
.upl .scanbar { grid-column: 1 / -1; margin: 2px 0 0; }

.admin-table { display: flex; flex-direction: column; gap: 2px; }

.atrow {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1.2fr) 64px 118px;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--md-sys-shape-corner-small);
}

.atrow:hover { background: var(--surface-hover); }

.atrow.head {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  padding-bottom: 8px;
}

.atrow .t { min-width: 0; }
.atrow .t b { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atrow .t span { display: block; font-size: 12px; color: var(--md-sys-color-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.atrow .acts { display: flex; justify-content: flex-end; gap: 0; }
.atrow .acts .icon-button { width: 34px; height: 34px; }

.tracks-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.tracks-filter .input { flex: 1; }

.login-card {
  max-width: 400px;
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-low);
  box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-2);
}

.login-card h1 { margin: 0; font-size: 24px; font-weight: 500; }
.login-card p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: 13.5px; }

.err-note {
  color: var(--md-sys-color-error);
  font-size: 13px;
  margin: 0;
}

.cover-drop {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cover-drop img {
  width: 74px;
  height: 74px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--md-sys-color-surface-container-highest);
}

.hint {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 820px) {
  .admin-wrap { padding: 0 14px 40px; }
  .atrow { grid-template-columns: minmax(0, 1fr) 96px; }
  .atrow .album,
  .atrow .dur,
  .atrow.head .album,
  .atrow.head .dur { display: none; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .row-2 { grid-template-columns: 1fr; }
}

/* ---------- чипы и таблицы без колонки альбома ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--hairline);
  transition:
    background-color var(--dur-short) var(--ease-standard),
    color var(--dur-short) var(--ease-standard);
}

.chip:hover { background: var(--surface-hover); color: var(--md-sys-color-on-surface); }

.chip.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  box-shadow: none;
}

.tracklist.no-album .tracklist-head,
.tracklist.no-album .track-row {
  grid-template-columns: 34px minmax(0, 1fr) 84px 92px;
}

@media (max-width: 820px) {
  .tracklist.no-album .track-row {
    grid-template-columns: 30px minmax(0, 1fr) 76px;
  }
  .tracklist.no-album .tracklist-head { display: none; }
}

/* ---------- позиционирование сгенерированных обложек ---------- */

.album-art,
.hero-art,
.hero-card-art,
.player-cover,
.track-thumb,
.queue-art,
.np-art,
.palette-thumb {
  position: relative;
}

.album-art .play-fab .ic { width: 22px; height: 22px; }
.searchbar .clear .ic { width: 18px; height: 18px; }
.np-meta-actions .icon-button { width: 40px; height: 40px; }

.chip-row { margin: 4px 0 16px; }

@media (max-width: 820px) {
  .chip-row { margin: 2px 0 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
}

.seek-row .slider { flex: 1 1 auto; min-width: 80px; }
.np-progress .slider { width: 100%; }

/* ---------- админка: статистика, таблица, очередь загрузки ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 18px;
}

.stat {
  padding: 16px 18px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-low);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.stat b {
  display: block;
  font-size: 26px;
  line-height: 32px;
  font-weight: 500;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--md-sys-color-on-surface-variant);
}

.atrow {
  grid-template-columns: 40px minmax(0, 1.9fr) minmax(0, 1.3fr) minmax(0, 1.1fr) 48px 92px;
  gap: 8px;
}

.atrow.head {
  padding-bottom: 8px;
  align-items: end;
}

.atrow.head span {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.atcover {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  overflow: hidden;
  background: var(--md-sys-color-surface-container-highest);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.atcover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atcover-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgb(255 255 255 / 0.8);
  background: linear-gradient(
    150deg,
    hsl(var(--h, 265) 62% 42%),
    hsl(calc(var(--h, 265) + 36) 70% 58%)
  );
}

.atcover-ph .ic {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.atrow .plays {
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--md-sys-color-on-surface-variant);
  padding-right: 6px;
}

.atrow .acts {
  display: flex;
  justify-content: flex-end;
  gap: 0;
}

.atrow .acts .icon-button {
  width: 36px;
  height: 36px;
}

.atrow .acts .icon-button .ic {
  width: 18px;
  height: 18px;
}

.atrow .acts [data-del]:hover {
  color: var(--md-sys-color-error);
}

.atrow .input.small {
  height: 36px;
  border-color: transparent;
  background: transparent;
  padding: 0 10px;
}

.atrow:hover .input.small {
  background: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-outline-variant);
}

.atrow .input.small:focus {
  background: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-primary);
}

.top-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 96px 32px;
  gap: 10px;
  align-items: center;
}

.top-num {
  font-size: 12.5px;
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
}

.top-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.top-text b {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-text i {
  font-style: normal;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar {
  display: block;
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);
}

.top-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--md-sys-color-primary),
    var(--md-sys-color-tertiary)
  );
}

.top-plays {
  font-size: 12.5px;
  text-align: right;
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
}

.upl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding: 10px 12px;
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-high);
}

.upl-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upl-pct {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
}

.upl-bar {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 99px;
  overflow: hidden;
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
}

.upl-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--md-sys-color-primary);
  transition: width 180ms linear;
}

.upl.ok .upl-pct { color: var(--md-sys-color-primary); }
.upl.err .upl-pct { color: var(--md-sys-color-error); }

.dropzone.busy { opacity: 0.65; pointer-events: none; }

.snackbar .ic { width: 18px; height: 18px; }

.tracks-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tracks-filter .input { flex: 1; }

.panel .hint { margin: 0; }
.panel.form-panel .dropzone { margin: 2px 0; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .atrow {
    grid-template-columns: 36px minmax(0, 1fr) 44px 76px;
  }

  .atrow .album,
  .atrow .atrow-artist,
  .atrow [data-field='artist'],
  .atrow.head .album,
  .atrow.head span:nth-child(3) { display: none; }

  .atrow.head { grid-template-columns: 36px minmax(0, 1fr) 44px 76px; }
}

.settings-grid { align-items: start; }

@media (max-width: 820px) {
  .hero {
    align-items: center;
    text-align: center;
  }

  .hero-art {
    width: min(58vw, 230px);
    height: min(58vw, 230px);
  }

  .hero-actions {
    justify-content: center;
    width: 100%;
  }

  .hero-sub { justify-content: center; }
}

@media (max-width: 700px) {
  .admin-top {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: calc(12px + env(safe-area-inset-top)) 0 8px;
  }

  .admin-top .brand {
    font-size: 15px;
    gap: 8px;
    margin-right: auto;
  }

  .admin-top .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .admin-top > .ts-body-small { display: none; }
  .admin-top .btn.text { padding: 0 6px; }
  .admin-top .btn.text .lbl { display: none; }
  .admin-top .icon-button { width: 38px; height: 38px; }
}

/* ---------- редактор обложки ---------- */

.coverdlg {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(0 0 0 / 0.56);
  backdrop-filter: blur(6px);
}

.coverdlg[hidden] { display: none; }

.coverdlg-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 28px;
  background: var(--md-sys-color-surface-container-high);
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    0 24px 64px rgb(0 0 0 / 0.45);
  animation: dlg-in 180ms var(--ease-emphasized-decelerate);
}

@keyframes dlg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
}

.coverdlg-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coverdlg-head h2 {
  margin: 0;
  margin-right: auto;
  font-size: 19px;
  font-weight: 500;
}

.coverdlg-sub {
  margin-top: -6px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coverdlg-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background: var(--md-sys-color-surface-container-highest);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.coverdlg-stage.grabbing { cursor: grabbing; }

.coverdlg-stage img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  will-change: transform;
}

.coverdlg-frame {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
  pointer-events: none;
}

.coverdlg-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
}

.coverdlg-stage:has(.coverdlg-empty:not([hidden])) { cursor: pointer; }

.coverdlg-zoom input[type='range']:disabled { opacity: 0.4; }

.coverdlg-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.coverdlg-zoom-ico {
  width: 18px;
  text-align: center;
  font-size: 16px;
}

.coverdlg-zoom input[type='range'] {
  flex: 1;
  accent-color: var(--md-sys-color-primary);
  height: 24px;
}

.coverdlg-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.coverdlg-actions .spacer { margin-left: auto; }
.coverdlg-actions .btn { height: 38px; padding: 0 16px; font-size: 13px; }

@media (max-width: 520px) {
  .coverdlg-card { padding: 14px; border-radius: 24px; }
  .coverdlg-actions .btn { flex: 1 1 auto; }
  .coverdlg-actions .spacer { display: none; }
}

/* ---------- офлайн ---------- */

.offline-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 24px 10px;
  padding: 9px 14px;
  border-radius: 14px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.offline-bar[hidden] { display: none; }
.offline-bar .ic { width: 18px; height: 18px; opacity: 0.8; }

.track-time {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.dl-badge {
  display: inline-flex;
  color: var(--md-sys-color-primary);
  opacity: 0.85;
}

.dl-badge .ic { width: 14px; height: 14px; }

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.offline-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  margin: 14px 0 22px;
  border-radius: 20px;
  background: var(--md-sys-color-surface-container-low);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.offline-card .ic {
  width: 22px;
  height: 22px;
  color: var(--md-sys-color-primary);
}

.offline-card b {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.offline-card span {
  display: block;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--md-sys-color-on-surface-variant);
}

.dl-dock {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(430px, calc(100vw - 28px));
  padding: 10px 10px 12px 16px;
  border-radius: 18px;
  background: var(--md-sys-color-surface-container-high);
  box-shadow:
    inset 0 0 0 1px var(--hairline),
    0 14px 44px rgb(0 0 0 / 0.45);
  animation: dlg-in 200ms var(--ease-emphasized-decelerate);
}

.dl-dock[hidden] { display: none; }

.dl-dock-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dl-dock-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-sys-color-primary);
}

.dl-dock-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-dock-track {
  width: 84px;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--md-sys-color-surface-container-highest);
}

.dl-dock-track i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--md-sys-color-primary);
  transition: width 0.25s;
}

@media (max-width: 900px) {
  .offline-bar { margin: 0 14px 8px; }
  .dl-dock { bottom: calc(env(safe-area-inset-bottom, 0px) + 152px); }
}
