.playlist {
  margin-top: 14px;
  text-align: left;
}

.playlist[hidden] { display: none; }

.playlist-open {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

/* dialog:modal sets overflow:auto in the browser, which scrolled the title away.
   The element selector keeps this rule ahead of that. */
dialog.playlist-dialog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: min(440px, calc(100vw - 32px));
  max-height: min(72vh, 560px);
  max-height: min(72dvh, 560px);
  margin: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--dialog);
  color: var(--ink);
}

/* display:flex on the dialog beats the user agent's
   dialog:not([open]) { display: none }, so close() left the dialog on screen. */
dialog.playlist-dialog:not([open]) {
  display: none;
}

.playlist-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

.playlist-head { flex: none; }

.playlist-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.playlist-title {
  margin: 0;
  min-width: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px;
  font-weight: 560;
}

.playlist-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.playlist-actions button,
.playlist-export-panel button {
  min-height: 44px;
}

.playlist-export,
.playlist-close,
.playlist-export-panel button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.playlist-export-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

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

.playlist-export-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.playlist-export-status:empty { display: none; }

.playlist-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.playlist-show-title {
  margin: 16px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.playlist-on-air {
  margin-left: 8px;
  color: var(--accent);
  font-weight: 600;
}

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

.playlist-empty {
  margin: 12px 0 0;
  color: var(--muted);
}

.playlist-empty[hidden] { display: none; }

.playlist-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.playlist-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.playlist-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cover);
  display: grid;
  place-items: center;
}

.playlist-cover img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  display: block;
}

.playlist-disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--amber) 0 16%, #1a140c 17% 22%, transparent 23%),
    repeating-radial-gradient(circle at 50% 50%, #3a3228 0 2px, #14110e 3px 6px);
}

.playlist-when,
.playlist-artist,
.playlist-title { margin: 0; }

.playlist-when {
  color: var(--muted);
  font-size: 12px;
}

.playlist-artist {
  color: var(--ink);
  font-weight: 600;
}

.playlist-copy a { color: var(--accent); }
