:root {
  color-scheme: dark;
  font-family: 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bg: #06060c;
  --surface: rgba(16, 16, 32, 0.65);
  --surface-strong: rgba(35, 35, 58, 0.8);
  --primary: #5de0e6;
  --secondary: #3a7bd5;
  --accent: #f9a826;
  --text: #f5f7ff;
  --text-muted: rgba(245, 247, 255, 0.65);
  --border: rgba(255, 255, 255, 0.08);
  --blur: 18px;
}

body.light {
  color-scheme: light;
  --bg: #f0f4ff;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --text: #0e132c;
  --text-muted: rgba(14, 19, 44, 0.6);
  --border: rgba(14, 19, 44, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #101018, #05050a 70%);
  color: var(--text);
  accent-color: var(--primary);
}

.background-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.orb {
  position: absolute;
  width: 35vw;
  height: 35vw;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.65;
  background: radial-gradient(circle, var(--primary), transparent 70%);
}

.orb-1 {
  top: -10%;
  left: -5%;
}

.orb-2 {
  bottom: -15%;
  right: -5%;
  background: radial-gradient(circle, #9b66ff, transparent 70%);
}

.orb-3 {
  bottom: 20%;
  left: 30%;
  width: 20vw;
  height: 20vw;
  background: radial-gradient(circle, var(--accent), transparent 70%);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(380px, 1fr);
  gap: 32px;
  padding: 48px clamp(24px, 6vw, 96px);
  max-width: 1280px;
  margin: 0 auto;
}

.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  backdrop-filter: blur(var(--blur));
  padding: 32px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}

.now-playing {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 8px;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
  margin: 4px 0 0;
}

.icon-btn {
  border: none;
  background: var(--surface-strong);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
}

.cover-wrapper {
  position: relative;
}

.cover-wrapper img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
}

.cover-shadow {
  position: absolute;
  inset: 10% 5% auto;
  height: 40%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4));
  border-radius: 24px;
  z-index: -1;
  filter: blur(24px);
}

.spectrum {
  position: absolute;
  bottom: -28px;
  left: 50%;
  translate: -50%;
  display: flex;
  gap: 6px;
}

.spectrum span {
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  animation: pulse 1s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.05s);
}

.spectrum span:nth-child(n) {
  --i: calc(var(--n));
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.progress-shell {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-shell input[type='range'] {
  position: absolute;
  inset: -6px 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.progress-buffer,
.progress-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.progress-buffer {
  background: rgba(255, 255, 255, 0.15);
  width: 0;
}

.progress-fill {
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  width: 0%;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.play-btn {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(145deg, var(--secondary), var(--primary));
  color: var(--bg);
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.play-btn:hover {
  transform: scale(1.05);
}

.extra-controls {
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.extra-controls label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.extra-controls input,
.extra-controls select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 6px 12px;
  font-size: 0.95rem;
}

.playlist {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.library {
  display: grid;
  grid-template-columns: minmax(220px, 260px) 1fr;
  gap: 20px;
}

.folder-tree {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  max-height: 70vh;
  overflow: auto;
}

.folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.folder-header h3 {
  margin: 0;
  font-size: 1rem;
}

.folder-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-toggle {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.folder-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.folder-toggle.placeholder {
  visibility: hidden;
  pointer-events: none;
}

.folder-select {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  text-align: right;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  transition: background 0.2s ease, color 0.2s ease;
}

.folder-select:hover {
  background: rgba(255, 255, 255, 0.06);
}

.folder-select.active {
  background: rgba(93, 224, 230, 0.15);
  color: var(--primary);
}

.folder-sublist {
  list-style: none;
  margin: 0;
  padding: 0 12px 0 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.playlist-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.upload-btn {
  border-radius: 999px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed var(--border);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.upload-btn input {
  display: none;
}

.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 14px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
  font-size: 1rem;
}

.shortcut {
  position: absolute;
  left: 16px;
  top: 50%;
  translate: 0 -50%;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.playlist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow: auto;
  padding-left: 4px;
}

.playlist-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: border 0.2s ease, background 0.2s ease;
}

.playlist-item[aria-selected='true'] {
  border-color: rgba(93, 224, 230, 0.6);
  background: rgba(93, 224, 230, 0.08);
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.play-indicator {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.playlist-item[aria-selected='true'] .play-indicator {
  background: linear-gradient(145deg, var(--secondary), var(--primary));
  border-color: transparent;
  color: var(--bg);
}

.playlist-item.empty-state {
  justify-content: center;
  grid-template-columns: 1fr;
  color: var(--text-muted);
  text-align: center;
}

.track-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.track-title {
  font-weight: 600;
}

.track-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.track-duration {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .library {
    grid-template-columns: 1fr;
  }
  .playlist-list {
    max-height: none;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

