:root {
  --bg-1: #edf6f9;
  --bg-2: #fefae0;
  --ink: #1d3557;
  --accent: #e76f51;
  --accent-deep: #d1492e;
  --card: rgba(255, 255, 255, 0.78);
  --muted: #536271;
  --shadow: 0 24px 50px rgba(29, 53, 87, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(231, 111, 81, 0.28) 0, rgba(231, 111, 81, 0) 30%),
    radial-gradient(circle at 85% 12%, rgba(29, 53, 87, 0.25) 0, rgba(29, 53, 87, 0) 28%),
    linear-gradient(125deg, var(--bg-1), var(--bg-2));
}

.page {
  width: min(900px, 92vw);
  margin: 56px auto;
}

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  animation: fade-up 450ms ease;
}

h1 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
}

.subtitle {
  margin-top: 0;
  color: var(--muted);
}

.url-form label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  width: 100%;
  border: 1px solid rgba(29, 53, 87, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-family: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

button:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#preview-btn {
  position: relative;
}

#preview-btn.is-loading {
  color: transparent;
}

#preview-btn.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 14px;
  height: 14px;
  margin: auto;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.status {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
}

.preview {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(29, 53, 87, 0.15);
  background: rgba(255, 255, 255, 0.66);
  animation: fade-up 350ms ease;
}

.hidden {
  display: none;
}

#cover {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  background: #f0f4f8;
}

#cover-link {
  display: inline-block;
  border-radius: 12px;
}

#cover-link:hover #cover {
  transform: scale(1.02);
}

.artist {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta h2 {
  margin: 0 0 8px;
}

#title-link {
  color: var(--ink);
  text-decoration: none;
}

#title-link:hover {
  text-decoration: underline;
}
.recent-downloads {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(29, 53, 87, 0.15);
}

.recent-downloads h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.downloads-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.download-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(29, 53, 87, 0.08);
}

.download-item:last-child {
  border-bottom: 0;
}

.download-item-cover {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0f4f8;
}

.download-item-text {
  min-width: 0;
}

.download-item-title,
.download-item-artist {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-item-title {
  font-weight: 600;
}

.download-item-artist {
  color: var(--muted);
  font-size: 0.85rem;
}

.download-item-status {
  color: #138a36;
  font-size: 1.15rem;
  font-weight: 700;
  width: 20px;
  text-align: right;
}

.download-item-status.is-pending {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(83, 98, 113, 0.25);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.download-item-status.is-error {
  color: #b00020;
}

.downloads-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.fine-print {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .page {
    margin: 22px auto;
  }

  .card {
    padding: 20px;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .preview {
    grid-template-columns: 1fr;
  }

  #cover {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
