:root {
  color-scheme: dark;
  --bg: #030815;
  --surface: #071123;
  --surface-2: #0b1933;
  --surface-3: #10264a;
  --text: #f4f8ff;
  --muted: #9fb4d4;
  --line: rgba(172, 204, 255, 0.18);
  --gold: #58a6ff;
  --rose: #1f6feb;
  --jade: #7dd3fc;
  --button-bg: rgba(123, 181, 255, 0.09);
  --sidebar-bg: rgba(2, 8, 21, 0.78);
  --player-bg: rgba(2, 8, 21, 0.9);
  --input-bg: rgba(0, 7, 20, 0.34);
  --hero-bg:
    linear-gradient(110deg, rgba(5, 14, 32, 0.97), rgba(9, 31, 69, 0.84)),
    linear-gradient(135deg, rgba(31, 111, 235, 0.2), rgba(0, 0, 0, 0.16));
  --page-bg:
    radial-gradient(circle at 16% 8%, rgba(31, 111, 235, 0.28), transparent 32%),
    radial-gradient(circle at 86% 12%, rgba(88, 166, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #030815, #071123 52%, #000205);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.46);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f7fcff;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-2: rgba(241, 249, 255, 0.78);
  --surface-3: rgba(218, 240, 255, 0.72);
  --text: #082b4f;
  --muted: #5b7894;
  --line: rgba(33, 129, 199, 0.16);
  --gold: #27a7f5;
  --rose: #ffffff;
  --jade: #8bdcff;
  --button-bg: rgba(255, 255, 255, 0.42);
  --sidebar-bg: rgba(255, 255, 255, 0.36);
  --player-bg: rgba(248, 253, 255, 0.74);
  --input-bg: rgba(255, 255, 255, 0.58);
  --hero-bg:
    linear-gradient(90deg, rgba(255, 255, 255, 0.76), rgba(216, 222, 242, 0.46) 42%, rgba(22, 57, 169, 0.22)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.22));
  --page-bg:
    linear-gradient(90deg, #ffffff 0%, #fbfbff 18%, #d5d9eb 43%, #8796cb 66%, #233ea0 86%, #001384 100%);
  --shadow: 0 24px 70px rgba(15, 38, 143, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.import-button,
.import-backup,
.server-upload,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--text);
  cursor: pointer;
  min-height: 42px;
  padding: 0 14px;
}

button:hover,
.import-button:hover,
.import-backup:hover,
.server-upload:hover,
select:hover {
  border-color: color-mix(in srgb, var(--gold) 72%, transparent);
}

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 124px;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  padding: 22px 16px;
  overflow: auto;
}

.mobile-menu,
.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border: 1px solid color-mix(in srgb, var(--gold) 34%, transparent);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

.brand strong {
  display: block;
  letter-spacing: 0;
  font-size: 18px;
}

.brand span,
.now-playing span,
.hero p,
.topbar p,
.time-row,
.track-title span,
.panel-title,
.chip {
  color: var(--muted);
  font-size: 13px;
}

.nav-stack {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  text-align: left;
}

.nav-button.active {
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: #130f12;
  border-color: transparent;
  font-weight: 800;
}

.playlist-panel,
.server-box {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.playlist-list {
  display: grid;
  gap: 8px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  overflow: hidden;
}

.playlist-item.active {
  border-color: color-mix(in srgb, var(--gold) 62%, transparent);
}

.playlist-open {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: transparent;
  text-align: left;
}

.playlist-open span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-delete {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.playlist-delete:hover {
  color: #fff;
  background: #d64242;
}

.playlist-count {
  color: var(--gold);
  font-size: 12px;
}

.server-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.server-row {
  display: grid;
  gap: 8px;
}

input[type="url"],
input[type="search"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 12px;
}

.content {
  overflow: auto;
  padding: 28px;
}

.topbar,
.controls-row,
.player {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar {
  justify-content: space-between;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 54px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--button-bg);
  cursor: pointer;
}

.switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease;
}

.theme-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(24px);
}

.topbar h1,
.topbar p,
.hero h2,
.hero p {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.import-button,
.import-backup,
.server-upload {
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.import-button {
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: #100d10;
  font-weight: 900;
}

.import-button input,
.import-backup input,
.server-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  gap: 18px;
  min-height: 230px;
  margin: 24px 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hero-bg);
  box-shadow: var(--shadow);
}

.hero h2 {
  max-width: 700px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
}

.gramophone {
  position: relative;
  width: 210px;
  height: 190px;
}

.horn {
  position: absolute;
  right: 6px;
  top: 0;
  width: 112px;
  height: 92px;
  border-radius: 8px 8px 72px 72px;
  background: linear-gradient(135deg, #efe2c7, #a06b50 52%, #2b2020);
  transform: rotate(-18deg);
  box-shadow: inset -16px -18px 22px rgba(0, 0, 0, 0.28);
}

.record {
  position: absolute;
  left: 12px;
  bottom: 20px;
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, #1a171a 0 7px, #282329 8px 10px),
    #171318;
  border: 8px solid #30252a;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.5);
}

.record img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.tone-arm {
  position: absolute;
  right: 72px;
  bottom: 72px;
  width: 84px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ead8b8, #6e5b4b);
  transform: rotate(24deg);
  transform-origin: right center;
  z-index: 2;
}

.base {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2d2228, #171217);
  border: 1px solid var(--line);
}

.is-playing .record,
.is-loading .record {
  animation: spin 2.2s linear infinite;
}

.is-loading .tone-arm {
  animation: cue 0.9s ease-in-out infinite alternate;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cue {
  to {
    transform: rotate(31deg);
  }
}

.controls-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px 140px 140px 130px auto auto auto;
  margin-bottom: 16px;
}

.icon-button.wide {
  min-width: 96px;
}

.mix-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 0 14px;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  min-height: 36px;
  padding: 0 12px;
}

.chip.active {
  color: #140f12;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 800;
}

.library-shelves {
  display: grid;
  gap: 24px;
  margin: 6px 0 22px;
}

.library-shelves[hidden] {
  display: none;
}

.shelf {
  display: grid;
  gap: 10px;
}

.shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shelf-header h2 {
  margin: 0;
  font-size: 19px;
}

.see-more {
  min-height: 30px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.collection-row {
  display: grid;
  grid-auto-columns: minmax(142px, 172px);
  grid-auto-flow: column;
  gap: 16px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
}

.collection-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 220px;
  padding: 10px;
  border: 1px solid rgba(232, 215, 184, 0.09);
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  scroll-snap-align: start;
}

.collection-card:hover {
  background: rgba(255, 255, 255, 0.075);
  transform: translateY(-2px);
}

body[data-theme="light"] .hero,
body[data-theme="light"] .track,
body[data-theme="light"] .collection-card,
body[data-theme="light"] .chip,
body[data-theme="light"] button,
body[data-theme="light"] select,
body[data-theme="light"] input[type="search"],
body[data-theme="light"] input[type="url"] {
  box-shadow: 0 12px 34px rgba(0, 65, 110, 0.12);
}

body[data-theme="light"] .collection-card,
body[data-theme="light"] .track {
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(18px);
}

body[data-theme="light"] .collection-card:hover,
body[data-theme="light"] .track:hover {
  background: rgba(255, 255, 255, 0.52);
}

body[data-theme="light"] .sidebar,
body[data-theme="light"] .player,
body[data-theme="light"] .hero {
  box-shadow: 0 22px 70px rgba(0, 58, 102, 0.16);
}

.collection-card strong,
.collection-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-card strong {
  font-size: 14px;
}

.collection-card small {
  color: var(--muted);
  font-size: 12px;
}

.collection-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
}

.collection-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.2;
  mix-blend-mode: screen;
}

.collection-art span {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  font-size: 30px;
  font-weight: 900;
}

.art-1 {
  background: linear-gradient(145deg, #7f0f22, #e23d53);
}

.art-2 {
  background: linear-gradient(145deg, #073845, #2ab7ca);
}

.art-3 {
  background: linear-gradient(145deg, #251144, #b76e79);
}

.art-4 {
  background: linear-gradient(145deg, #203b25, #66d0b1);
}

.art-5 {
  background: linear-gradient(145deg, #322511, #d8b56d);
}

.art-6 {
  background: linear-gradient(145deg, #151515, #6d6b74);
}

.track-list {
  display: grid;
  gap: 8px;
  padding-bottom: 20px;
}

.track {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto repeat(9, 40px);
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.track button:not(.track-play) {
  min-width: 38px;
  padding: 0 8px;
}

.insight-panel {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-bg);
  backdrop-filter: blur(16px);
}

.insight-panel[hidden] {
  display: none;
}

.insight-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.stats-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stats-grid strong {
  font-size: 26px;
}

.stats-grid span,
.insight-grid span {
  color: var(--muted);
  font-size: 13px;
}

.mini-player .sidebar,
.mini-player .content {
  display: none;
}

.mini-player .shell {
  display: block;
  min-height: auto;
}

.mini-player .player {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.app-dialog {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--player-bg);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.app-dialog::backdrop {
  background: rgba(0, 6, 18, 0.58);
  backdrop-filter: blur(5px);
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-body {
  display: grid;
  gap: 12px;
  max-height: min(62vh, 520px);
  overflow: auto;
  padding: 16px 0;
}

.dialog-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-actions {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 12px;
}

.field textarea {
  resize: vertical;
}

.primary-action {
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: #061326;
  font-weight: 900;
}

.danger-action {
  background: #d64242;
  border-color: #d64242;
  color: #fff;
}

.track.playing {
  border-color: color-mix(in srgb, var(--gold) 78%, transparent);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}

.track-play {
  width: 42px;
  padding: 0;
}

.track-title {
  overflow: hidden;
}

.track-title strong,
.track-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 3px 8px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.player {
  grid-column: 1 / -1;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  background: var(--player-bg);
  backdrop-filter: blur(20px);
  padding: 14px 18px;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  max-width: 32vw;
}

.cover {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  border-radius: 8px;
  background: #111;
  overflow: hidden;
}

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

.now-playing div:last-child {
  min-width: 0;
}

.now-playing strong,
.now-playing span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transport {
  display: grid;
  gap: 8px;
  min-width: 320px;
  width: min(46vw, 620px);
}

.transport-buttons,
.time-row,
.volume-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.round-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}

.round-button.primary {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  border-color: transparent;
  color: #100d10;
  font-weight: 900;
}

.time-row {
  justify-content: space-between;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.volume-row {
  min-width: 240px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
    max-height: none;
  }

  .nav-stack {
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    overflow-x: auto;
  }

  .playlist-panel,
  .server-box {
    margin-top: 0;
  }

  .content {
    padding: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .gramophone {
    margin: 0 auto;
  }

  .controls-row {
    grid-template-columns: 1fr 1fr;
  }

  .controls-row input {
    grid-column: 1 / -1;
  }

  .player {
    align-items: stretch;
    flex-direction: column;
  }

  .now-playing,
  .transport,
  .volume-row {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .nav-stack,
  .controls-row {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    padding: 20px;
  }

  .track {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .track .tag-row,
  .track button[data-action="download"],
  .track button[data-action="edit"],
  .track button[data-action="art"],
  .track button[data-action="lyrics"],
  .track button[data-action="queue"],
  .track button[data-action="offline"],
  .track button[data-action="remove"],
  .track button[data-action="queue"],
  .track button[data-action="playlist"] {
    display: none;
  }

  .insight-grid,
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 980px) {
  body.drawer-open {
    overflow: hidden;
  }

  .shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .mobile-menu {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    padding: 0;
    font-size: 22px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: block;
    width: min(84vw, 340px);
    max-height: none;
    padding: 18px 14px 28px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-104%);
    transition: transform 220ms ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: none;
    border: 0;
    border-radius: 0;
    background: rgba(0, 8, 24, 0.58);
    min-height: 0;
    padding: 0;
  }

  body.drawer-open .sidebar-backdrop {
    display: block;
  }

  .brand {
    margin-bottom: 18px;
  }

  .nav-stack {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .playlist-panel,
  .server-box {
    margin-top: 20px;
  }

  .content {
    min-width: 0;
    padding: 14px 12px 18px;
  }

  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .theme-switch {
    order: 10;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    margin: 16px 0;
    padding: 18px;
  }

  .hero h2 {
    font-size: 30px;
  }

  .gramophone {
    width: 158px;
    height: 142px;
  }

  .horn {
    width: 86px;
    height: 70px;
  }

  .record {
    width: 96px;
    height: 96px;
    border-width: 6px;
  }

  .record img {
    width: 42px;
    height: 42px;
  }

  .tone-arm {
    right: 52px;
    bottom: 58px;
    width: 64px;
  }

  .controls-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .controls-row input {
    grid-column: 1 / -1;
  }

  .controls-row select,
  .controls-row button {
    width: 100%;
    min-width: 0;
  }

  .collection-row {
    grid-auto-columns: minmax(132px, 42vw);
    gap: 12px;
  }

  .collection-card {
    min-height: 192px;
  }

  .track {
    grid-template-columns: 42px minmax(0, 1fr) 40px;
    gap: 8px;
    min-height: 60px;
    padding: 8px;
  }

  .track .tag-row,
  .track button[data-action="download"],
  .track button[data-action="edit"],
  .track button[data-action="art"],
  .track button[data-action="lyrics"],
  .track button[data-action="queue"],
  .track button[data-action="offline"],
  .track button[data-action="remove"],
  .track button[data-action="playlist"] {
    display: none;
  }

  .player {
    position: sticky;
    bottom: 0;
    z-index: 25;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
  }

  .now-playing {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .cover {
    width: 48px;
    height: 48px;
  }

  .transport {
    width: 100%;
    min-width: 0;
  }

  .transport-buttons {
    justify-content: center;
  }

  .round-button {
    width: 40px;
    height: 40px;
  }

  .round-button.primary {
    width: 48px;
    height: 48px;
  }

  .volume-row {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
  }

  .top-actions > button,
  .top-actions > label {
    flex: 1 1 calc(50% - 8px);
  }

  .theme-switch {
    flex-basis: 100%;
  }

  .insight-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
