:root {
  --bg: #070707;
  --bg2: #111111;
  --panel: #141414;
  --panel2: #1b1b1b;
  --text: #f5f5f5;
  --muted: #9b9b9b;
  --border: #2a2a2a;
  --chip: #1f1f1f;
  --chipOn: #8b1111;
  --accent: #c1121f;
  --accent2: #e01e2f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(193, 18, 31, 0.14) 0%, rgba(193, 18, 31, 0.04) 20%, transparent 45%),
    linear-gradient(180deg, #121212 0%, #090909 30%, #070707 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.iosInstallHint {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(193, 18, 31, 0.08);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.bgArt {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  filter: blur(40px) saturate(1.1);
  transform: scale(1.08);
  opacity: 0.22;
  transition: background-image 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7,7,7,0.35) 0%, rgba(7,7,7,0.72) 35%, rgba(7,7,7,0.92) 100%);
  pointer-events: none;
}

img {
  display: block;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #ffffff;
  flex: 0 0 auto;
}

.brandTitle {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

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

.ghost {
  border: 1px solid #be1e2d;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.hidden {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
  padding-bottom: 230px;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}

.panelHeader h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

#search {
  width: 48%;
  min-width: 150px;
  border: 1px solid var(--border);
  background: #0f0f0f;
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
}

#search::placeholder {
  color: #8e8e8e;
}

.albums {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.categoryBar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 14px 4px;
  scrollbar-width: none;
}

.categoryBar::-webkit-scrollbar {
  display: none;
}

.categoryChip {
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.categoryChip:hover {
  border-color: #444;
}

.categoryChip:active {
  transform: scale(0.98);
}

.categoryChip.active {
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  border-color: transparent;
  color: white;
}

@media (min-width: 560px) {
  .albums {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .albums {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

.waveform {
  display: flex;
  gap: 3px;
  height: 14px;
}

.waveform span {
  width: 3px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 0.9s infinite ease-in-out;
}

.waveform span:nth-child(2) {
  animation-delay: 0.2s;
}

.waveform span:nth-child(3) {
  animation-delay: 0.4s;
}

.waveform.paused span {
  animation: none;
  opacity: 0.5;
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.4); }
}

.album {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
  border-radius: 18px;
  overflow: hidden;
}

.album img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px;
  background: #111;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.album:active img {
  transform: scale(0.98);
}

.album:hover img {
  filter: brightness(1.05);
}

.album .aMeta {
  padding: 10px 2px 2px;
}

.album .aTitle {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.album .aSub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip.on {
  background: var(--chipOn);
}

.queue {
  margin: 0;
  padding: 12px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue li {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.queue li:hover {
  background: rgba(255,255,255,0.04);
}

.queue li:active {
  transform: scale(0.99);
}

.queue li.playing {
  border-color: rgba(193, 18, 31, 0.45);
  background: rgba(193, 18, 31, 0.12);
}

.queue .qTitle {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.queue .qSub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding:
    12px
    14px
    calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(73 73 73 / 37%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.now {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cover {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  object-fit: cover;
  background: #111;
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(0,0,0,0.28);
  transition: opacity 0.25s ease;
}

.meta {
  min-width: 0;
}

.title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist {
  margin-top: 4px;
  color: #c9c9c9;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: bold;
  font-style: italic;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 14px 0 10px;
}

.btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
}

.btn:hover {
 background-color: #6d6a6b;
}

.btn.big {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(193, 18, 31, 0.35);
  transition: color 0.3s ease-in-out;
}

.btn.big:hover {
  color: #f1f1f1;
}

.timeline {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
}

.time {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

#seek,
#volume {
  width: 100%;
  accent-color: #be1e2d;
}

.bottomRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.vol {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  min-width: 0;
}

.vol input {
  width: 150px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

@media (max-width: 480px) {
  .layout {
    padding: 12px;
    gap: 12px;
    padding-bottom: 235px;
  }

  .albums {
    gap: 10px;
    padding: 12px;
  }

  .panelHeader {
    flex-direction: column;
    align-items: stretch;
  }

  #search {
    width: 100%;
  }

  .bottomRow {
    flex-direction: column;
    align-items: stretch;
  }

  .vol input {
    width: 100%;
  }

  .hint {
    text-align: left;
  }
}