:root {
  color-scheme: dark;
  --bg: #070707;
  --ink: #f7f3ec;
  --muted: #a7a09a;
  --soft: #746b64;
  --panel: #121110;
  --panel-2: #191715;
  --panel-3: #24211e;
  --line: #2f2a26;
  --line-soft: rgba(255, 255, 255, 0.08);
  --accent: #b54127;
  --accent-2: #e0b15b;
  --good: #85c989;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  width: 1.1em;
  height: 1.1em;
  display: block;
  fill: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  width: 100%;
  height: 100dvh;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(190px, 26vh) minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(224, 177, 91, 0.1), transparent 240px),
    linear-gradient(180deg, #12100f 0, var(--bg) 56%);
}

.hero-actions,
.hero-transport,
.hero-tools,
.options,
.inline-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.round-button,
.icon-button,
.icon-submit {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(18, 17, 16, 0.84);
  color: var(--ink);
  cursor: pointer;
}

.round-button:not(:disabled):hover,
.icon-button:not(:disabled):hover,
.icon-submit:not(:disabled):hover,
.button:not(:disabled):hover,
.switch:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.round-button.primary,
.button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #111;
}

.round-button.danger,
.icon-button.danger {
  color: #ef957e;
}

.round-button:disabled,
.icon-button:disabled,
.icon-submit:disabled,
.button:disabled {
  opacity: 0.38;
  cursor: default;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(172px, 26vh) minmax(0, 1fr) minmax(164px, 270px);
  align-items: stretch;
  gap: clamp(14px, 3vw, 42px);
  padding: 0 clamp(8px, 1.5vw, 14px) 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.hero-bg {
  position: absolute;
  inset: -50%;
  background-position: center;
  background-size: cover;
  filter: blur(44px) saturate(1.25);
  opacity: 0.3;
  transform: scale(1.05);
  transition: opacity 180ms ease, filter 180ms ease;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 7, 7, 0.28), rgba(7, 7, 7, 0.78) 55%, rgba(7, 7, 7, 0.9)),
    linear-gradient(180deg, transparent, rgba(7, 7, 7, 0.66));
  pointer-events: none;
}

.cover-grid,
.hero-copy,
.hero-actions {
  position: relative;
  z-index: 1;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  height: 100%;
  width: auto;
  min-width: 172px;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  align-self: start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(7, 7, 7, 0.48);
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.55));
}

.cover-tile {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(224, 177, 91, 0.16), rgba(181, 65, 39, 0.22)),
    var(--panel-2);
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.72),
    0 0 22px rgba(0, 0, 0, 0.7);
}

.cover-tile::after {
  content: "";
  position: absolute;
  inset: -1px;
  box-shadow:
    inset 0 0 28px 7px rgba(0, 0, 0, 0.62),
    inset 0 0 7px rgba(0, 0, 0, 0.76);
  pointer-events: none;
}

.cover-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  animation: cover-fade 180ms ease;
}

.hero-copy {
  align-self: center;
  min-width: 0;
  text-align: center;
}

.eyebrow {
  color: var(--accent-2);
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  margin-top: 5px;
  font-size: clamp(1.05rem, 1.8vw, 1.55rem);
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero-subtitle {
  display: inline-block;
  max-width: min(100%, 740px);
  margin: 8px auto 0;
  color: var(--muted);
  font-size: clamp(0.84rem, 1.1vw, 0.96rem);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.hero-subtitle:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.hero-subtitle[aria-disabled="true"] {
  pointer-events: none;
}

.hero-transport {
  justify-content: center;
  margin-top: 22px;
}

/* Pinned to the hero's bottom-right corner. Absolute (not grid-aligned) so a
   long, wrapping song title can never push these out of the clipped hero band. */
.hero-actions {
  position: absolute;
  right: clamp(8px, 1.5vw, 14px);
  bottom: clamp(8px, 1.5vw, 14px);
  z-index: 2;
  display: grid;
  justify-items: end;
}

.hero-tools {
  justify-content: flex-end;
}

.hero-tool-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: rgba(18, 17, 16, 0.84);
  color: var(--ink);
  cursor: pointer;
}

.hero-tool-button:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.hero-play {
  width: 64px;
  height: 64px;
  font-size: 1.3rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.queue-panel {
  min-height: 0;
  overflow: auto;
}

.queue-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: #0b0b0b;
}

.queue-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 300px);
  gap: 14px;
  align-items: center;
  padding: 14px 14px 14px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid var(--line-soft);
}

/* input. prefix so these beat the shared `.field` radius regardless of order. */
input.search-field {
  border-radius: 0;
}

.queue-title {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.queue-kicker {
  color: var(--ink);
  letter-spacing: 0.02em;
}

/* Play-all mode: the kicker shouts in red so it is obvious the whole library is
   playing as one queue and the name beside it is the list actually sounding. */
.queue-kicker.all-mode {
  color: #ff4d3a;
  font-weight: 900;
}

.queue-name {
  color: var(--accent-2);
}

.queue-count,
.hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.add-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.add-form {
  position: relative;
  display: block;
  /* Equal space on every side around the input. */
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(18, 17, 16, 0.52);
}

/* Square left corners, fully rounded right side so the input visually wraps the
   circular submit button tucked into its trailing edge. The input. prefix lifts
   specificity above the shared `.field` radius defined later in the file. */
input.add-field {
  width: 100%;
  border-radius: 0 999px 999px 0;
  padding-right: 52px;
}

.field,
.import-text {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  outline: 0;
}

.field {
  height: 42px;
  padding: 9px 12px;
}

.field::placeholder,
.import-text::placeholder {
  color: #746f69;
}

.field:focus,
.import-text:focus {
  border-color: rgba(224, 177, 91, 0.58);
  box-shadow: 0 0 0 3px rgba(224, 177, 91, 0.14);
}

.icon-submit {
  width: 42px;
  height: 42px;
}

.add-submit {
  border-color: var(--line-soft);
  background: rgba(18, 17, 16, 0.84);
  color: var(--ink);
}

.add-form .add-submit {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
}

.import {
  align-self: start;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.032);
}

.import-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.import .hint {
  margin: 9px 0 0;
  line-height: 1.35;
}

.import code {
  display: block;
  margin-top: 5px;
  padding: 1px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--accent-2);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.import-text {
  display: block;
  margin: 11px 0;
  padding: 10px 11px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.import-action {
  min-height: 34px;
  border-color: rgba(224, 177, 91, 0.32);
}

/* Add to library / Import from file / status wrap onto new lines when narrow. */
.inline-actions {
  flex-wrap: wrap;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.export-actions .button {
  flex: 1 1 auto;
}

.import-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.info-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.34);
  color: var(--accent-2);
  cursor: pointer;
}

.info-button svg {
  width: 16px;
  height: 16px;
}

.info-button:hover {
  background: var(--accent);
  color: var(--ink);
}

.playlist-tabs {
  display: grid;
  gap: 10px;
}

.playlist-tab {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  min-height: 96px;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.018) 76%),
    rgba(255, 255, 255, 0.028);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.playlist-tab:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.playlist-tab.active {
  border-color: rgba(181, 65, 39, 0.62);
  background:
    linear-gradient(90deg, rgba(181, 65, 39, 0.46), rgba(181, 65, 39, 0.18) 76%),
    rgba(255, 255, 255, 0.04);
}

.playlist-thumb {
  width: 72px;
  height: 72px;
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(224, 177, 91, 0.2), rgba(181, 65, 39, 0.32)),
    var(--panel-2);
  background-position: center;
  background-size: cover;
}

.playlist-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.playlist-tab strong {
  font-size: 1.22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-tab span span {
  color: var(--muted);
  font-size: 0.9rem;
}

.playlist-tab:hover span span {
  color: rgba(255, 255, 255, 0.74);
}

.track-list {
  overflow: auto;
}

.track {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 74px;
  padding: 9px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background: transparent;
  cursor: pointer;
}

.track.active {
  background: linear-gradient(90deg, rgba(181, 65, 39, 0.76), rgba(181, 65, 39, 0.4));
}

.track.dragging {
  opacity: 0.4;
}

.track-thumb-button {
  width: 54px;
  height: 54px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
}

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

.track-info {
  min-width: 0;
}

.track-title-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 820;
  line-height: 1.18;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-source {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track.active .track-source {
  color: rgba(255, 245, 235, 0.78);
}

.track-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.74rem;
}

.track-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: min(62vw, 560px);
  color: #6fa8ff;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
}

.drawer-tab {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 36;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--ink);
  color: #111;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  box-shadow: none;
  cursor: pointer;
  transform: none;
}

.drawer-tab span {
  position: absolute;
  top: 30px;
  right: -6px;
  width: 94px;
  transform: rotate(45deg);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.drawer-tab[data-open="true"] {
  background: #fff;
}

.playlist-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 34;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(620px, calc(100vw - 34px));
  padding: 18px;
  border-left: 1px solid var(--line-soft);
  background:
    radial-gradient(circle at 84% 92%, rgba(255, 255, 255, 0.045), transparent 210px),
    linear-gradient(90deg, rgba(8, 8, 8, 0.98), rgba(11, 10, 9, 0.96));
  box-shadow: -26px 0 90px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(100%);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 0ms linear 140ms;
}

.playlist-drawer[data-open="true"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 0ms linear 0ms;
}

.drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding-right: 96px;
}

#drawer-close {
  display: none;
}

.drawer-title {
  color: var(--ink);
  font-size: 1.24rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  text-transform: none;
}

.drawer-summary {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.drawer-panel {
  min-width: 0;
  background: rgba(255, 255, 255, 0.045);
}

.drawer-add-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: inset 4px 0 0 rgba(224, 177, 91, 0.72);
}

.drawer-library-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 12px 0;
  background: rgba(255, 255, 255, 0.035);
}

/* Small label + note + icon-button widget (Remove = red, Import = yellow). */
.drawer-reset-panel,
.drawer-mini-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.drawer-reset-panel {
  background: rgba(181, 65, 39, 0.12);
  box-shadow: inset 4px 0 0 rgba(181, 65, 39, 0.76);
}

.import-mini {
  background: rgba(224, 177, 91, 0.12);
  box-shadow: inset 4px 0 0 rgba(224, 177, 91, 0.76);
}

.import-file-action {
  background: var(--accent-2);
  color: #111;
}

.drawer-section-title,
.drawer-list-title {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.drawer-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* The list below is edge-to-edge, but the head needs side padding so the title
     and the download button do not sit flush against the panel edges. */
  padding: 0 14px;
}

.drawer-list-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Download-every-playlist button sits at the head's right edge, next to Play all. */
.download-all-action {
  width: 36px;
  height: 36px;
  background: var(--accent-2);
  color: #111;
}

/* "Play all together" control: a labelled sliding on/off switch that sits over
   the playlist list. The knob slides and the track lights up accent when on. */
.playall-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.playall-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.playall-track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line-soft);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.playall-knob {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%);
  transition: transform 0.18s ease, background 0.18s ease;
}

.playall-switch:hover {
  color: var(--ink);
}

.playall-switch:hover .playall-track {
  border-color: var(--accent);
}

.playall-switch:has(input:checked) {
  color: var(--ink);
}

.playall-switch:has(input:checked) .playall-track {
  background: var(--accent);
  border-color: var(--accent);
}

.playall-switch:has(input:checked) .playall-knob {
  transform: translateY(-50%) translateX(16px);
  background: #111;
}

.playall-switch:has(input:focus-visible) .playall-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-button,
.playlist-drawer .button,
.drawer-submit-button,
.drawer-icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: rgba(18, 17, 16, 0.94);
  color: var(--ink);
  cursor: pointer;
}

.mode-button {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.84rem;
  font-weight: 900;
}

.mode-button:hover,
.playlist-drawer .button:hover,
.drawer-submit-button:hover,
.drawer-icon-button:hover {
  background: var(--accent);
  color: var(--ink);
}

.playlist-drawer .button {
  min-height: 42px;
  padding: 8px 14px;
}

.playlist-drawer .import-action {
  background: var(--accent-2);
  color: #111;
}

.playlist-drawer .import {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.playlist-drawer .import-title {
  font-size: 0.94rem;
}

.playlist-drawer .import .hint {
  margin: 7px 0 0;
}

.playlist-drawer .import code {
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.38);
  color: var(--accent-2);
  line-height: 1.4;
}

.playlist-drawer .field,
.playlist-drawer .import-text {
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.34);
}

.playlist-drawer .field:focus,
.playlist-drawer .import-text:focus {
  box-shadow: inset 0 -2px 0 var(--accent-2);
}

.drawer-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.drawer-note code {
  color: var(--accent-2);
  font-size: 0.95em;
}

.playlist-drawer .clean-action {
  background: rgba(181, 65, 39, 0.86);
  color: var(--ink);
}

.playlist-drawer .playlist-tabs {
  display: grid;
  gap: 0;
  align-content: start;
  min-height: 0;
  overflow-y: scroll; /* scrollbar always present, not just on overflow */
  padding: 0;
  background: rgba(0, 0, 0, 0.28);
}

.drawer-playlist-card {
  display: grid;
  min-width: 0;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--line-soft);
}

/* The header row carries the background, so the colour of a selected row spans
   the whole row, title and controls alike. */
.drawer-playlist-head {
  display: flex;
  align-items: stretch;
  min-width: 0;
  background: rgba(18, 17, 16, 0.94);
}

/* Rollover is a white row with black text (not the selected orange). */
.drawer-playlist-head:hover {
  background: #fff;
}

.drawer-playlist-head:hover .playlist-tab,
.drawer-playlist-head:hover .playlist-tab strong {
  color: #111;
}

.drawer-playlist-head:hover .playlist-tab span span {
  color: #333;
}

.drawer-playlist-card.selected .drawer-playlist-head {
  background:
    linear-gradient(90deg, rgba(181, 65, 39, 0.58), rgba(181, 65, 39, 0.22) 78%),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 4px 0 0 var(--accent);
}

.drawer-playlist-card.open .drawer-playlist-head {
  box-shadow: inset 4px 0 0 var(--accent-2);
}

/* White rollover wins over the orange selected background too. */
.drawer-playlist-card.selected .drawer-playlist-head:hover {
  background: #fff;
}

.drawer-playlist-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 0 8px;
}

.playlist-drawer .playlist-tab {
  flex: 1 1 auto;
  align-self: stretch;
  grid-template-columns: 70px minmax(0, 1fr);
  min-height: 88px;
  min-width: 0;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent; /* the head supplies the row colour */
}

/* The whole row is the hover/selection surface, so the tab itself stays flat. */
.playlist-drawer .playlist-tab:hover {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.playlist-drawer .playlist-thumb {
  width: 70px;
  height: 70px;
  border-radius: 0;
}

.playlist-drawer .playlist-tab strong {
  font-size: 1.08rem;
}

.drawer-playlist-detail {
  display: grid;
  gap: 10px;
  padding: 10px 10px 12px;
  background: rgba(0, 0, 0, 0.34);
}

.drawer-track-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.drawer-icon-button.danger {
  color: #ef957e;
}

/* Header controls sit on the selected row's orange, so give them a translucent
   dark chip and a darker hover (the default orange hover would vanish there). */
.drawer-playlist-controls .drawer-icon-button {
  background: rgba(0, 0, 0, 0.34);
}

.drawer-playlist-controls .drawer-icon-button:hover {
  background: rgba(0, 0, 0, 0.58);
  color: var(--ink);
}

.drawer-playlist-controls .drawer-icon-button.danger:hover {
  color: #ffb4a1;
}

.drawer-add-track-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.drawer-track-list {
  display: grid;
  gap: 1px;
  max-height: min(38vh, 330px);
  overflow-y: scroll; /* scrollbar always present */
  background: rgba(255, 255, 255, 0.06);
}

.drawer-track {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 52px;
  padding: 6px;
  background: #080808;
}

.drawer-track.active {
  background: rgba(181, 65, 39, 0.44);
}

.drawer-track-play {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

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

.drawer-track-copy {
  min-width: 0;
}

.drawer-track-title {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-track-link {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-empty {
  padding: 12px;
  color: var(--muted);
  background: #080808;
}

.empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
}

.player-dock {
  display: grid;
  /* Seek bar takes the lion's share of the slack; the options column stays
     flexible too so the volume slider stretches from the eye icon toward the
     status box with no dead gaps. Status is content-width. */
  grid-template-columns: minmax(190px, 280px) minmax(220px, 1fr) minmax(200px, 360px) auto;
  gap: 18px;
  align-items: center;
  padding: 12px clamp(14px, 3vw, 30px);
  border-top: 1px solid var(--line-soft);
  background: rgba(11, 11, 11, 0.94);
  backdrop-filter: blur(18px);
  z-index: 8;
}

.now-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.now-art {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.now-text {
  min-width: 0;
}

.now-label {
  font-size: 0.9rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-link {
  display: inline-block;
  max-width: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-link[aria-disabled="true"] {
  pointer-events: none;
}

.dock-center {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.seekbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.time {
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

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

.options {
  justify-content: flex-end;
  min-width: 0;
}

.switch {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch:has(input:checked) {
  color: #111;
  border-color: var(--ink);
  background: var(--ink);
}

.switch:has(input:checked):hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent);
}

.volume {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 90px;
}

.status-line {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 92px;
  color: var(--muted);
  font-size: 0.78rem;
}

.status-line strong {
  color: var(--ink);
}

.player-frame {
  position: fixed;
  right: 18px;
  bottom: 104px;
  width: min(380px, calc(100vw - 36px));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
  z-index: 20;
}

.player-frame[data-show="false"] {
  width: 1px;
  height: 1px;
  border: 0;
  clip: rect(0 0 0 0);
  opacity: 0;
  pointer-events: none;
}

#youtube-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
  z-index: 50;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px 18px 18px 22px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--panel);
  box-shadow: inset 4px 0 0 var(--accent-2), var(--shadow);
}

.modal-card h2,
.modal-card p {
  margin: 0;
}

.modal-card h2 {
  font-size: 1.05rem;
  padding-right: 36px;
}

.modal-card p {
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.modal-card .button {
  border-radius: 0;
}

.modal-actions {
  justify-content: flex-start;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.34);
  color: var(--ink);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--accent);
  color: var(--ink);
}

.help-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(480px, 100%);
  padding: 20px 22px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  box-shadow: inset 4px 0 0 var(--accent-2), var(--shadow);
}

.help-card h2 {
  margin: 0;
  padding-right: 36px;
  font-size: 1.1rem;
}

.help-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.help-intro strong {
  color: var(--ink);
}

.help-intro code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.42);
  color: var(--accent-2);
  font-size: 0.82rem;
}

/* Snippet box for copy-paste-ready examples in the bulk-import help modal. */
.help-snippet {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  color: var(--accent-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.help-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-steps li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.help-steps strong {
  color: var(--ink);
}

.help-step-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.help-keys-title {
  margin-bottom: -4px;
  color: var(--accent-2);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.help-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
}

.help-key {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
}

.key {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: linear-gradient(180deg, #2c2925, #161412);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.key-wide {
  min-width: 64px;
}

/* A share URL can be long (big playlist): cap and scroll it. */
#share-url {
  max-height: 28vh;
  overflow: auto;
}

.tooltip {
  position: fixed;
  z-index: 80;
  max-width: min(260px, calc(100vw - 28px));
  padding: 7px 9px;
  background: rgba(12, 12, 12, 0.94);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.44);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.tooltip[data-show="true"] {
  opacity: 1;
  transform: translateY(0);
}

.tooltip[hidden] {
  display: block;
  opacity: 0;
}

@keyframes cover-fade {
  from {
    opacity: 0.55;
    transform: scale(0.985);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app,
  .app-shell {
    min-height: 100dvh;
    height: auto;
  }

  .app-shell {
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 18px 16px;
    text-align: center;
  }

  .hero-actions {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

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

  .playlist-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .playlist-drawer {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    overflow: auto;
  }

  .drawer-head {
    padding-right: 96px;
  }

  .playlist-drawer .import,
  .drawer-list-title,
  .playlist-drawer .playlist-tabs {
    grid-column: 1;
    grid-row: auto;
  }

  .playlist-drawer .playlist-tabs {
    grid-template-columns: 1fr;
    overflow: visible;
    padding-right: 0;
  }

  .player-dock {
    grid-template-columns: minmax(0, 1fr);
  }

  .options,
  .status-line {
    justify-content: center;
    justify-items: center;
  }
}

@media (max-width: 620px) {
  .cover-grid {
    width: min(78vw, 280px);
    border-radius: 0;
  }

  .hero-title {
    font-size: clamp(1.45rem, 9vw, 2.4rem);
  }

  .eyebrow {
    font-size: clamp(0.95rem, 5vw, 1.2rem);
  }

  .queue-head,
  .track {
    grid-template-columns: 1fr;
  }

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

  .track-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .playlist-tabs {
    grid-template-columns: 1fr;
  }

  .add-form {
    align-items: stretch;
  }

  .volume {
    width: 100%;
  }

  .playlist-drawer {
    width: 100vw;
    padding: 14px;
  }
}
