html, body {
  width: 100%;
  overflow-x: hidden;          /* prevent sideways scroll */
  overscroll-behavior-x: none; /* stop sideways bounce on supported browsers */
}

* {
  box-sizing: border-box;
}

.app, .header, .main, .tracklist {
  max-width: 100%;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 0;
  /* Reserve space for fixed header */
  padding-top: calc(118px + env(safe-area-inset-top));
  background: #0b0b0c;
  color: #e9e9ea;
}

header {
  position: fixed;
  top: 0;
  z-index: 1000;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  margin: 0;

  /* Keep the header readable in iOS standalone mode (safe area / status bar). */
  padding: 16px 18px;
  padding-top: calc(16px + env(safe-area-inset-top));

  background: #0b0b0b;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0px;
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.controls {
    flex: 1 1 auto;
display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.controls-row {
    flex: 1 1 auto;
  width: 100%;
display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.controls-row1 {
  flex: 1 1 auto;
}

.controls-row2 {
  flex: 0 0 auto;
}

input[type="search"] {
  /* Let the search box take remaining space, but shrink gracefully on small screens */
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

/* -------- One-line mobile header: Library chip inside the search bar -------- */
.controls-row-compact {
  flex: 1 1 auto;
}

/* "Search bar" container that also holds the library selector chip */
.search-combo {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;

  /* Match the dark search styling */
  border: 1px solid #2a2a2a;
  background: #0f0f12;
  border-radius: 999px;
  padding: 4px 10px;
}


/* Prevent iOS focus-zoom */
.search-combo input,
input[type="search"] {
  font-size: 16px;
}

/* Library chip that lives inside the search bar */
.library-chip {
  flex: 0 0 auto;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: #16161a;
  font-size: 13px;
}

/* Make the actual search input visually merge with the search-combo container */
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  padding: 6px 2px;
}
.search-input:focus {
  outline: 0;
}

.clear-search {
  flex: 0 0 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.clear-search[hidden] { display: none; }
.clear-search svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Keep long library names from shifting the Menu button. */
#libraryBtn {
  flex: 0 0 auto;
}

.app-menu-anchor {
  flex: 0 0 auto;
  position: relative;
}

#appMenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: max-content;
}

button {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #17171a;
  color: #e9e9ea;
  cursor: pointer;
}
button:hover { background: #1e1e22; }

main { 
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 18px;
}

.status {
  opacity: 0.8;
  margin-bottom: 10px;
}

.player {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #222;
  border-radius: 14px;
  background: #101013;
}

.nowplaying {
  font-size: 14px;
  opacity: 0.9;
}

audio { width: 100%; }

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #222;
  border-radius: 14px;
  overflow: hidden;
}

thead th {
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  padding: 10px;
  background: #101013;
  border-bottom: 1px solid #222;
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid #1c1c1c;
  font-size: 13px;
  vertical-align: top;
}

tbody tr:hover {
  background: #15151a;
  cursor: pointer;
}

/* Track row: mobile summary (hidden on desktop) */
.desktop-title { display: inline; }
.mobile-summary { display: none; }
.ms-line1, .ms-line2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-line2 { opacity: 0.8; font-size: 12px; margin-top: 2px; }

td.path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  opacity: 0.85;
}

td.title { font-weight: 600; }

td.dur {   
  white-space: nowrap;
  width: 1%;
  opacity: 0.9;
}

.queue {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #222;
  border-radius: 14px;
  background: #101013;

  display: none;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.queue-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  opacity: 0.95;
  user-select: none;
}

.toggle input {
  transform: scale(1.1);
}

/* iOS-style switch (used for mini-player auto-next) */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #2a2a2a;
  border-radius: 999px;
  transition: background 120ms ease;
}

.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: #e9e9ea;
  border-radius: 50%;
  transition: transform 120ms ease;
}

.switch input:checked + .slider {
  background: #b0001a;
}

.switch input:checked + .slider::before {
  transform: translateX(16px);
}

.mini-auto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
}

.mini-auto-label {
  font-size: 12px;
  opacity: 0.85;
  user-select: none;
}

.queue-title {
  font-size: 14px;
  font-weight: 650;
  opacity: 0.95;
}

.queue-list {
  margin: 0;
  padding-left: 18px;
}

.queue-list li {
  padding: 6px 0;
  border-bottom: 1px solid #1c1c1c;
  font-size: 13px;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

.queue-list li:last-child {
  border-bottom: none;
}

.queue-item-meta {
  opacity: 0.9;
}

.queue-empty {
  opacity: 0.7;
  font-size: 13px;
  display: none;
}

/* popup menu */
.menu {
  position: fixed;
  z-index: 1000;
  min-width: 160px;
  border: 1px solid #2a2a2a;
  background: #0f0f12;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  padding: 6px;
}

.menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 10px;
  border-radius: 10px;
}

.menu button:hover {
  background: #1b1b20;
}


/* Reuse "menu" styling for the library dropdown */
#libraryMenu {
  position: fixed;
  z-index: 1300;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: #101013;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #e9e9ea;
  cursor: pointer;
}

.menu-item:hover {
  background: #17171a;
}

.menu-item.active {
  border-color: #3a3a3a;
  background: #17171a;
}

.menu-item .count {
  opacity: 0.7;
  margin-left: 6px;
}

.menu-sep {
  height: 1px;
  background: #222;
  margin: 8px 0;
}

.menu-item.danger {
  color: #ffb4b4;
}

/* Library sheet list */
.sheet-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

/* Mobile: prefer sheet over dropdown */
@media (max-width: 600px) {
  #libraryMenu { display: none !important; }
}


.sections {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #222;
  border-radius: 14px;
  background: #101013;
}

.sections-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.sections-title {
  font-size: 14px;
  font-weight: 650;
  opacity: 0.95;
}

.sections-buttons {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 4px;
}

.section-btn {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #2a2a2a;
  background: #17171a;
  color: #e9e9ea;
  cursor: pointer;
  font-size: 13px;
}

.section-btn:hover {
  background: #1e1e22;
}

.section-btn.active {
  border-color: #4a4a4a;
  background: #222228;
}

.sections-hint {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.75;
}

/* -------- MOBILE LAYOUT -------- */
@media (max-width: 600px) {

  /* Hide table header */
  table thead {
    display: none;
  }

  table, tbody, tr, td {
    display: block;
    width: 100%;
  }

  tr {
    border-bottom: 1px solid #222;
    padding: 1px 0;
  }

  tbody tr:last-child {
    border-bottom: none;
  }

  td {
    border: none;
    padding: 0;
    margin: 0;
  }

  tbody td {
    /* Prevent double separators (desktop tbody td border + mobile tr border) */
    border-bottom: none;
    font-weight: 650;
    font-size: 14px;
    line-height: 1.15;
  }

  td.title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.15;
  }

  td.dur {
    font-size: 10px;
    line-height: 1.2;
    opacity: 0.8;
    margin-top: 2px;
  }

  td.path {
    display: none; /* hide noisy path on mobile */
  }

  td:nth-child(1),
  td:nth-child(2) {
    font-size: 13px;
    opacity: 0.85;
  }

  /* Make buttons wrap nicely */
  .sections-buttons {
    gap: 6px;
  }

  .section-btn {
    font-size: 12px;
    padding: 6px 8px;
  }

  /* Make queue compact */
  .queue {
    padding: 8px;
  
  display: none;
}

  .queue-list li {
    font-size: 12px;
  }

}

tr {
  cursor: pointer;
}


/* --- Mini player (collapsed) --- */
.mini-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid #222;
  background: rgba(16, 16, 19, 0.98);
  backdrop-filter: blur(6px);

  position: fixed;
}

/* Thin red progress bar */
.mini-progress-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;           /* 2–4px feels good */
  width: 0%;
  background: #e53935;   /* subtle red */
  transition: width 0.15s linear;
}

.mini-left {
  flex: 1 1 auto;
  min-width: 0; /* critical for ellipsis */
}

.mini-now {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-times {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
}

.mini-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Player sheet --- */
.player-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  border-top: 1px solid #222;
  background: #101013;
  padding: 14px;

  border-top-left-radius: 16px;
  border-top-right-radius: 16px;

  max-height: 75vh;
  overflow: auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.sheet-title {
  font-size: 14px;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-done {
  border: 1px solid #2a2a2a;
  background: #17171a;
  color: #e9e9ea;
  border-radius: 12px;
  padding: 8px 10px;
}

.dial-wrap {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 10px 0 14px;
}

#seekDial {
  width: 260px;
  height: 260px;
  touch-action: none; /* important for dial dragging */
}

.dial-time {
  font-size: 12px;
  opacity: 0.8;
}

.dial-time-sep {
  margin: 0 6px;
  opacity: 0.8;
}

.sheet-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.sheet-jumps, .sheet-main-controls {
  display: flex;
  gap: 8px;
}

.sheet-controls button {
  border: 1px solid #2a2a2a;
  background: #17171a;
  color: #e9e9ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}


@media (max-width: 600px) {
  }


/* Fully reset native iOS button appearance */
button,
.icon-btn {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
}


.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #111;
  border: 1px solid #2a2a2a;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: #fff;
  font-size: 18px;

  transition: background 120ms ease, transform 80ms ease;
}

.icon-btn:active {
  transform: scale(0.95);
  background: #1a1a1a;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.icon {
  font-size: 18px;
  line-height: 1;
}

/* Slightly smaller on tiny screens */
@media (max-width: 600px) {
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .icon {
    font-size: 17px;
  }
}


/* Queue sheet layout */
.queue-sheet-controls {
  display: grid;
  gap: 10px;
  margin: 8px 0 12px;
}

.queue-sheet-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-empty {
  opacity: 0.75;
  font-size: 13px;
  margin: 6px 0 10px;
}

.queue-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.queue-list li {
  padding: 10px 8px;
  border-top: 1px solid #222;
}

.queue-item-meta {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================
   Mobile Layout (iPhone-first, safe-area aware)
   ========================================= */

@media (max-width: 600px) {

  /* Hide desktop queue section */
  section.queue {
    display: none;
  
  display: none;
}

  /* Hide any legacy big player if still present */
  .big-player {
    display: none;
  }

  /* Prevent content from being hidden behind mini-player */
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  /* Mini player sits above home indicator */
  .mini-player {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  /* Bottom sheets respect safe area */
  .sheet-panel {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
}


/* Global: avoid content under the mini-player + home indicator */
@media (max-width: 600px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }


  /* One-row header controls on mobile */
  .controls {
      flex: 1 1 auto;
flex-direction: row;
    align-items: center;
  }

  header {
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .search-combo {
    min-height: 36px;
    padding: 3px 8px;
  }

  .library-chip {
    max-width: 38vw;
    padding: 6px 9px;
  }

  /* Tracks list: compact 2-line rows on mobile */
  thead { display: none; }
  table { table-layout: fixed; }

  /* Hide desktop columns except the Title cell */
  tbody td:nth-child(1),
  tbody td:nth-child(2),
  tbody td.dur,
  tbody td.path {
    display: none;
  }

  /* Make the title cell span full width */
  tbody td.title {
    display: block;
    width: 100%;
  }

  .desktop-title { display: none; }
  .mobile-summary { display: block; }
}

/* Mini-player: keep controls above home indicator */
.mini-player {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* Bottom-sheet panel: keep content above home indicator */
.sheet-panel {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}



/* On wider screens, keep the search field from becoming excessively wide */
@media (min-width: 601px) {
  .controls-row1 {
    width: min(520px, 60vw);
  }

  /*
   * The mini-player is fixed to the viewport, so it does not occupy space in
   * the normal document flow. Reserve room at the end of the scrolling track
   * list so the final rows can be scrolled completely above it.
   */
  main {
    padding-bottom: 88px;
  }
}


/* SVG icons */

.svg-icon {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

/* Make primary Play/Pause icon larger than Next */
#miniPlayPause .svg-icon,
#sheetPlayPause .svg-icon {
  width: 24px;
  height: 24px;
}

#miniNext .svg-icon,
#sheetNext .svg-icon {
  width: 18px;
  height: 18px;
}

#miniPlayPause,
#sheetPlayPause {
  width: 48px;
  height: 48px;
}


/* Fully reset iOS search input appearance */
input[type="search"] {
  -webkit-appearance: none;
  appearance: none;

  background: #121212;
  color: #fff;

  border: 1px solid #2a2a2a;
  border-radius: 12px;

  padding: 10px 14px;

  outline: none;
}

/* Remove iOS inner shadow */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

/* Placeholder color */
input[type="search"]::placeholder {
  color: #888;
  opacity: 1;
}

/* Subtle focus state */
input[type="search"]:focus {
  border-color: #b0001a;
  box-shadow: 0 0 0 1px #b0001a;
}

/* List actions beneath the filter and search row. */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

#searchControls[hidden] { display: none; }

#expandLibrary {
  margin-left: auto;
  flex: 0 0 auto;
}

#expandLibrary .restore-icon,
.library-expanded #expandLibrary .expand-icon { display: none; }
.library-expanded #expandLibrary .restore-icon { display: block; }

/* Keep only the safe-area inset in the header while the restore button floats. */
.library-expanded #libraryHeader {
  padding: env(safe-area-inset-top) 0 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.library-expanded #expandLibrary {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  right: calc(env(safe-area-inset-right) + 12px);
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border-color: #505058;
  background: rgba(22, 22, 26, .9);
  pointer-events: auto;
}


#noFavorites:not([hidden]) ~ table { display: none; }

#noFavorites {
  color: #aaa;
  padding: 0 8px;
}
.list-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.list-controls[hidden] { display: none; }
.list-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  background: #16161a;
  font-size: 13px;
}
.list-control[aria-pressed="true"] {
  border-color: #9bb8ef;
  background: #263551;
}
#favoritesFilter[aria-pressed="true"] svg { fill: currentColor; }
.list-control svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 600px) {
  .list-controls { gap: 6px; }
  .list-control { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .list-control span { display: none; }
  .list-control svg { width: 18px; height: 18px; flex: none; }
}

.controls {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 1164px; /* main's 1200px outer width minus its 18px side padding */
  margin-inline: auto;
}
@media (max-width: 600px) {
  .controls { flex-direction: column; align-items: stretch; }
}

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .7);
  padding: 20px;
}
.about-overlay[hidden] { display: none; }
.about-card {
  width: min(100%, 420px);
  padding: 22px;
  border: 1px solid #444;
  border-radius: 14px;
  background: #1b1b20;
  overflow-wrap: anywhere;
}
.about-card h2 { margin-top: 0; font-size: 20px; }
.about-card code { font-size: 12px; user-select: all; }
.about-card button { margin-top: 10px; }

/* Queue count stays visible even when its sheet is closed. */
#appMenuBtn { position: relative; }
.queue-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: #b72d34;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.queue-badge[hidden] { display: none; }

/* Editable up-next list, shared by desktop and the mobile queue sheet. */
section.queue {
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid #303038;
  border-radius: 14px;
  background: #111116;
}
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.queue-title { font-size: 15px; }
.queue-clear {
  border: 1px solid #3a3a42;
  border-radius: 999px;
  background: transparent;
  color: #ddd;
  font-size: 12px;
  padding: 6px 10px;
}
.queue-clear:disabled { opacity: .4; cursor: default; }
.queue-sheet-controls { display: flex; justify-content: flex-end; }
.queue-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.queue-list li.queue-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #292931;
}
.queue-list li.queue-row:first-child {
  background: #202029;
  border-radius: 9px;
  padding-inline: 8px;
  border-bottom-color: transparent;
}
.queue-position {
  color: #aaa;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.queue-row:first-child .queue-position {
  color: #ffb5b5;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
}
.queue-item-meta { display: block; min-width: 0; opacity: 1; }
.queue-item-meta strong, .queue-item-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue-item-meta strong { font-size: 13px; font-weight: 600; }
.queue-item-meta small { font-size: 11px; color: #aaa; margin-top: 3px; }
.queue-remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #bbb;
  font-size: 22px;
  line-height: 1;
}
.queue-remove:hover, .queue-remove:focus-visible { color: #fff; background: #4b272b; }
.queue-empty { display: block; line-height: 1.4; padding: 6px 2px; }
.queue-empty[hidden] { display: none; }

/* Direct queue action keeps tapping the rest of a track row as Play. */
.track-enqueue {
  float: right;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -5px 0 -5px 10px;
  padding: 0;
  border: 1px solid #4c4c55;
  border-radius: 50%;
  background: #202027;
  color: #eee;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}
.track-enqueue:hover, .track-enqueue:focus-visible {
  background: #34415a;
  border-color: #819fd0;
}
.queue-list li.queue-row {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}
.queue-row-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.queue-row-controls button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #bbb;
  font-size: 17px;
  line-height: 1;
}
.queue-row-controls button:hover:not(:disabled),
.queue-row-controls button:focus-visible {
  color: #fff;
  background: #383842;
}
.queue-row-controls button:disabled { opacity: .28; cursor: default; }
.queue-row-controls .queue-drag { cursor: grab; font-size: 20px; }
.queue-row-controls .queue-drag:active { cursor: grabbing; }
.queue-row-controls .queue-remove { font-size: 22px; }
.queue-row.queue-drop-target { outline: 2px solid #819fd0; outline-offset: -2px; }
@media (max-width: 600px) {
  .queue-row-controls .queue-drag { display: none; }
  .track-enqueue { width: 32px; height: 32px; margin: -6px 0 -6px 8px; }
}

/* Queue building is optional; track rows stay compact by default. */
.track-enqueue { display: none; }
.show-queue-add .track-enqueue { display: grid; }
.queue-add-setting {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #ddd;
  cursor: pointer;
}
.queue-add-setting input { width: 16px; height: 16px; accent-color: #b72d34; }
.queue-sheet-controls { align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* Let long now-playing titles wrap while Done keeps its own space. */
#playerSheet .sheet-header { align-items: flex-start; }
#playerSheet .sheet-title {
  flex: 1 1 auto;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
#playerSheet .sheet-done { flex: 0 0 auto; margin-left: auto; }
.track-details { margin: 8px 0 4px; }
.track-details > div { padding: 10px 0; border-top: 1px solid #2a2a30; }
.track-details dt { color: #aaa; font-size: 12px; margin-bottom: 4px; }
.track-details dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.details-panel { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
/* Track rows are long-press targets; suppress iOS text selection on their
   descendants as well as the row, without affecting selectable details. */
#tracks tr, #tracks tr * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.favorite-button { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 6px; border: 1px solid #414147; border-radius: 10px; background: #17171a; color: #e6c65d; cursor: pointer; }
.favorite-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.favorite-button[aria-pressed="true"] svg { fill: currentColor; }
.favorite-button:disabled { opacity: .55; cursor: wait; }
.favorite-button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#trackDetailsHeading { flex: 1; }

/* Expanded player's progress echoes the compact player at the screen edge. */
#playerSheet .sheet-progress-track { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #2a2a2a; pointer-events: none; z-index: 1; }
#playerSheet .sheet-progress-bar { height: 100%; width: 0; background: #e53935; transition: width .15s linear; }
