:root {
  --bg: #0b0b12;
  --surface: #151523;
  --surface-2: #1d1d2e;
  --border: #2a2a40;
  --text: #f2f2f7;
  --muted: #9a9ab4;
  --accent: #7c5cff;
  --accent-2: #26d9c4;
  --danger: #ff6b81;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.glow {
  position: fixed;
  inset: -30% -20% auto -20%;
  height: 60vh;
  background:
    radial-gradient(50% 60% at 30% 40%, rgba(124, 92, 255, 0.35), transparent 70%),
    radial-gradient(45% 55% at 75% 30%, rgba(38, 217, 196, 0.22), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
}

body > *:not(.glow) {
  position: relative;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand img {
  border-radius: 9px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

/* -------------------------------------------------------------------- main */

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-block: 24px 8px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  color: var(--muted);
}

/* ------------------------------------------------------------------ search */

.search {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 14px;
  transition: border-color 0.15s;
}

.field:focus-within {
  border-color: var(--accent);
}

.field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--text);
  font-size: 16px;
  padding: 10px 0;
  outline: none;
}

.field input::placeholder {
  color: #6a6a88;
}

.ghost-button {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 11px;
  padding: 9px 13px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: var(--accent);
}

.primary-button {
  position: relative;
  border: 0;
  border-radius: var(--radius);
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), #a45cff 60%, var(--accent-2));
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.32);
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s;
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button[disabled] {
  opacity: 0.65;
  cursor: progress;
}

.spinner {
  display: none;
  width: 17px;
  height: 17px;
  margin-left: 9px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.primary-button.is-busy .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
  .primary-button {
    transition: none;
  }
}

/* ------------------------------------------------------------------ status */

.status {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.94rem;
}

.status.is-error {
  color: var(--danger);
}

.status-detail {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  opacity: 0.75;
}

/* ------------------------------------------------------------------ result */

.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.song {
  display: flex;
  gap: 15px;
  align-items: center;
}

.song img {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
}

.song-text {
  min-width: 0;
}

.song-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.song-artist {
  margin: 3px 0 0;
  color: var(--accent-2);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.song-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

audio {
  width: 100%;
  height: 36px;
}

.group-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.link-button {
  display: block;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color 0.15s, transform 0.12s;
}

.link-button:hover,
.link-button:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}

.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------- settings */

.settings {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.settings summary {
  cursor: pointer;
  font-weight: 600;
}

.settings .field {
  margin-top: 12px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

code {
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.86em;
}

/* ------------------------------------------------------------------ footer */

.site-footer {
  width: 100%;
  max-width: 560px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
}
