:root {
  color-scheme: light;
  --bg: #0b1220;
  --panel: #0f1b33;
  --border: rgba(255, 255, 255, 0.12);
  --text: #e7eefc;
  --muted: rgba(231, 238, 252, 0.72);
  --accent: #61dafb;
  --danger: #ff6b6b;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 20% 10%, #16264a 0%, var(--bg) 55%);
  color: var(--text);
}

a {
  color: inherit;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: rgba(15, 27, 51, 0.7);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.btn.sm {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn.primary {
  border-color: rgba(97, 218, 251, 0.5);
  background: rgba(97, 218, 251, 0.12);
}

.btn.danger {
  border-color: rgba(255, 107, 107, 0.6);
  background: rgba(255, 107, 107, 0.12);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  border: 1px solid var(--border);
  background: rgba(15, 27, 51, 0.6);
  border-radius: 14px;
  padding: 12px;
  min-height: 240px;
}

.panel h2 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 650;
}

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

.subheader .title {
  font-size: 16px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.list.small {
  max-height: 260px;
}

.item {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
}

.item:hover {
  border-color: rgba(97, 218, 251, 0.35);
}

.item.active {
  border-color: rgba(97, 218, 251, 0.6);
  background: rgba(97, 218, 251, 0.12);
}

.item.playing {
  border-color: rgba(97, 218, 251, 0.55);
  box-shadow: 0 0 0 2px rgba(97, 218, 251, 0.12) inset;
}

.item.now-playing {
  border-color: rgba(97, 218, 251, 0.7);
}

.item.dragging {
  opacity: 0.6;
}

.item.drop-target {
  border-color: rgba(97, 218, 251, 0.9);
  box-shadow: 0 0 0 2px rgba(97, 218, 251, 0.15) inset;
}

.empty-state {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.empty-state .title {
  font-size: 16px;
}

.drag-handle {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

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

.row.top {
  align-items: flex-start;
}

.grow {
  flex: 1;
}

.thumb {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.thumb.lg {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.thumb.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  letter-spacing: 0.3px;
  color: rgba(231, 238, 252, 0.9);
  background: radial-gradient(120px 90px at 30% 20%, rgba(97, 218, 251, 0.22), rgba(255, 255, 255, 0.04));
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.card {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
}

.card:hover {
  border-color: rgba(97, 218, 251, 0.35);
}

.card.active {
  border-color: rgba(97, 218, 251, 0.6);
  background: rgba(97, 218, 251, 0.12);
}

.card.now-playing {
  border-color: rgba(97, 218, 251, 0.7);
}

.card .thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
}

.thumb.collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1 / 1;
  gap: 2px;
  padding: 2px;
  overflow: hidden;
}

.thumb.collage > * {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.thumb.collage img {
  object-fit: cover;
  border: 0;
}

.thumb.collage .thumb.placeholder {
  border-radius: 8px;
  border: 0;
}

.card .label {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.25;
}

.progress {
  margin-top: 10px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(97, 218, 251, 0.9);
}

.now-playing .progress {
  display: block;
}

.now-playing.paused .progress-fill {
  background: rgba(231, 238, 252, 0.65);
}

.card .meta {
  margin-top: 4px;
  font-size: 12px;
}

.card .action {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

.card .action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card .resume {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

.item .resume {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

button.pill {
  appearance: none;
  cursor: pointer;
}

button.pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.resume-time {
  opacity: 0.85;
}

.skeleton {
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.02) 80%
  );
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.card.skeleton {
  border-color: rgba(255, 255, 255, 0.06);
  min-height: 168px;
}

.card.skeleton .thumb {
  background: rgba(255, 255, 255, 0.06);
}

.skeleton-line {
  height: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 10px;
}

.skeleton-line.sm {
  height: 10px;
  width: 65%;
  margin-top: 8px;
}

.item.skeleton {
  border-color: rgba(255, 255, 255, 0.06);
}

.toast {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 27, 51, 0.85);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.toast.ok {
  border-color: rgba(97, 218, 251, 0.5);
  background: rgba(97, 218, 251, 0.12);
}

.toast.warn {
  border-color: rgba(255, 255, 255, 0.2);
}

.toast.bad {
  border-color: rgba(255, 107, 107, 0.6);
  background: rgba(255, 107, 107, 0.12);
}

.toast .action {
  margin-left: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(231, 238, 252, 0.95);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.toast .action:hover {
  border-color: rgba(97, 218, 251, 0.35);
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.input-wrap {
  position: relative;
}

.search-bar {
  margin-top: 12px;
}

.search-spacer {
  height: 1px;
}

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form {
  max-width: 420px;
  margin: 40px auto;
  border: 1px solid var(--border);
  background: rgba(15, 27, 51, 0.7);
  border-radius: 16px;
  padding: 16px;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .container {
    padding: 14px;
  }

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

  .panel {
    min-height: 0;
  }

  /* Avoid nested scroll areas on mobile: let the page scroll. */
  .list,
  .cards {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .cards {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .card .thumb {
    height: 120px;
  }
}

.error {
  color: var(--danger);
  margin-top: 8px;
}

.player {
  margin-top: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 27, 51, 0.6);
  border-radius: 14px;
  padding: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
}

.pill.ok {
  border-color: rgba(97, 218, 251, 0.45);
  color: rgba(97, 218, 251, 0.95);
}

.pill.bad {
  border-color: rgba(255, 107, 107, 0.55);
  color: rgba(255, 107, 107, 0.95);
}

.player audio {
  width: 100%;
}

.queue {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.queue-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.queue-item:hover {
  border-color: rgba(97, 218, 251, 0.35);
}

.queue-item .title {
  font-size: 13px;
}

.queue-item .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
