:root {
  color-scheme: dark;
  --bg: #151726;
  --card: #1f2236;
  --accent: #6c8cff;
  --accent-hover: #85a1ff;
  --text: #eef0fb;
  --text-dim: #9aa0c3;
  --error: #ff6c7c;
  --border: #2c2f4a;
}

* {
  box-sizing: border-box;
}

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

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.tagline {
  color: var(--text-dim);
  margin: 0;
  font-size: 0.9rem;
}

.view[hidden] {
  display: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--accent);
  color: #0c0e1a;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.file-label {
  display: inline-block;
  text-align: center;
}

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

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

.pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.invite-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

#qr-image {
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.invite-link-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.invite-link-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.8rem;
}

.track-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-name {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  word-break: break-all;
}

.playlist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 4px 4px 10px;
}

.playlist-item.active {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.12);
}

.playlist-item-move {
  display: flex;
  flex-direction: column;
}

.playlist-item-move-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.6rem;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
}

.playlist-item-move-btn:hover:not(:disabled) {
  color: var(--accent-hover);
  background: rgba(255, 255, 255, 0.06);
}

.playlist-item-move-btn:disabled {
  color: var(--text-dim);
  opacity: 0.3;
  cursor: default;
}

.playlist-item-name {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  padding: 6px 0;
  cursor: pointer;
  word-break: break-all;
}

.playlist-item.active .playlist-item-name {
  color: var(--accent-hover);
  font-weight: 600;
}

.playlist-item-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 6px;
}

.playlist-item-download:hover {
  color: var(--accent-hover);
  background: rgba(255, 255, 255, 0.06);
}

.playlist-item-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 6px;
}

.playlist-item-remove:hover {
  color: var(--error);
  background: rgba(255, 255, 255, 0.06);
}

.progress-wrap {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  background: var(--accent);
  height: 100%;
  width: 0%;
  transition: width 0.15s ease;
}

.seek-row {
  display: flex;
  align-items: center;
}

.seek-bar {
  width: 100%;
  height: 20px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.seek-bar:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.seek-bar::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.seek-bar::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.seek-bar::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.seek-bar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.playback-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.position-readout {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
