
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0b0712; --panel: rgba(255,255,255,.045); --panel-2: rgba(255,255,255,.06);
  --text: #f5f0f7; --muted: #a89fb0;
  --accent: #ff4dd8; --accent-2: #ff8ae0; --accent-dim: rgba(255,77,216,.16);
  --danger: #ff4d7d; --border: rgba(255,255,255,.09);
  --radius: 16px; --shadow: 0 12px 40px rgba(0,0,0,.45);
}
html { color-scheme: dark; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden;
}
.bg-glow { position: fixed; border-radius: 50%; filter: blur(100px); z-index: -1; pointer-events: none; }
.bg-glow--a { width: 560px; height: 560px; top: -240px; right: -140px; background: rgba(255,77,216,.17); }
.bg-glow--b { width: 460px; height: 460px; bottom: -220px; left: -160px; background: rgba(255,77,216,.09); }

.accent { color: var(--accent); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(11,7,18,.72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.site-header__inner { max-width: 760px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; }
.site-header__brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.site-header__logo {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff;
  border-radius: 10px; width: 32px; height: 32px; display: grid; place-items: center; font-size: 15px;
  box-shadow: 0 4px 18px rgba(255,77,216,.45);
}
.site-header__tag { display: none; }
.mono { font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace; }

.site-header__sys { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.site-header__sys .sys-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 2s steps(1) infinite; }

.hud {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 11px; letter-spacing: .14em; color: var(--muted);
  margin-bottom: 22px; text-transform: uppercase;
}
.hud-cursor { color: var(--accent); animation: blink 1.2s steps(1) infinite; font-size: 9px; }

.panel.frame { position: relative; }
.frame-corner { position: absolute; width: 14px; height: 14px; border-color: var(--accent); border-style: solid; opacity: .7; pointer-events: none; }
.frame-corner--tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: 12px; }
.frame-corner--tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; border-top-right-radius: 12px; }
.frame-corner--bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; border-bottom-left-radius: 12px; }
.frame-corner--br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: 12px; }

.panel__titlebar {
  display: flex; align-items: center; gap: 6px;
  margin: -22px -22px 18px; padding: 9px 14px;
  border-bottom: 1px solid var(--border); border-radius: 16px 16px 0 0;
  background: rgba(0,0,0,.25); font-size: 10px; letter-spacing: .16em; color: var(--muted); text-transform: uppercase;
}
.titlebar-dot { width: 9px; height: 9px; border-radius: 50%; }
.titlebar-dot--a { background: #ff5f7a; }
.titlebar-dot--b { background: #ffb84d; }
.titlebar-dot--c { background: var(--accent); }
.titlebar-t { margin-left: 8px; }

.scanlines {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

.app { max-width: 760px; margin: 0 auto; padding: 48px 20px 70px; }
.hero { text-align: center; margin-bottom: 30px; }
.hero__kicker { color: var(--muted); font-size: 13px; margin-bottom: 12px; letter-spacing: .02em; }
.hero__kicker::before { content: "> "; color: var(--accent); }
.hero h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin-bottom: 10px; }
.grad {
  background: linear-gradient(90deg, #ff8ae0, #ffc9f0, #ff4dd8); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradShift 6s ease infinite;
}
@keyframes gradShift { 0%, 100% { background-position: 0% center; } 50% { background-position: 100% center; } }
.hero__sub { color: var(--muted); font-size: 16px; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.panel__title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.panel__subtitle { font-size: 16px; margin: 20px 0 10px; color: var(--muted); }
.panel--guide p { color: var(--muted); line-height: 1.6; }
.note-list { list-style: none; color: var(--muted); font-size: 14px; }
.note-list li { padding: 6px 0; line-height: 1.5; }
.panel--guide { display: none; }

.form-row { display: flex; gap: 12px; }
.input-wrap { flex: 1; }
#spotify-url {
  width: 100%; padding: 15px 18px; font-size: 15px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#spotify-url:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
#spotify-url::placeholder { color: #6b6b76; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.btn {
  border: none; border-radius: 12px; padding: 14px 22px; font-size: 15px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform .12s, box-shadow .2s, background .2s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #26001b;
  box-shadow: 0 6px 24px rgba(255,77,216,.35);
}
.btn--primary:not(:disabled):hover { filter: brightness(1.06); box-shadow: 0 8px 30px rgba(255,77,216,.5); }
.btn--back { background: transparent; color: var(--muted); border: 1px solid var(--border); margin-bottom: 16px; }
.btn--back:hover { border-color: var(--accent); color: var(--accent); }
.btn--download {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #26001b;
  display: inline-block; margin-top: 16px; text-decoration: none; font-weight: 700;
  box-shadow: 0 6px 22px rgba(255,77,216,.32);
}
.btn--download:hover { filter: brightness(1.06); text-decoration: none; box-shadow: 0 8px 28px rgba(255,77,216,.5); }
.btn.is-disabled { opacity: .4; pointer-events: none; }

.error-banner {
  display: none; margin-top: 14px; padding: 12px 16px;
  background: rgba(255,77,94,.1); border: 1px solid rgba(255,77,94,.4); border-radius: 10px;
  color: #ff9aa5; font-size: 14px;
}
.error-banner.is-visible { display: block; }

.term-log {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: rgba(0,0,0,.35); border: 1px solid var(--border);
  font-size: 12px; line-height: 1.7; color: var(--muted);
  max-height: 180px; overflow-y: auto;
}
.term-log[hidden] { display: none; }
.term-log__line { white-space: pre-wrap; word-break: break-word; }
.term-log__line::before { content: "> "; color: var(--accent); }
.term-log__line--ok { color: var(--accent); }
.term-log__line--err { color: #ff8fb0; }
.term-log__cursor { display: inline-block; width: 7px; height: 13px; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.results { display: none; }
.results.is-visible { display: block; }
.btn__spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(38,0,27,.25); border-top-color: #26001b; border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-inner { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.result-head { display: flex; gap: 20px; align-items: flex-start; }
.result-art img { width: 120px; height: 120px; border-radius: 14px; object-fit: cover; display: block; background: var(--panel-2); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.result-meta h2 { font-size: 22px; margin-bottom: 6px; line-height: 1.25; letter-spacing: -.01em; }
.artist { color: var(--muted); margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.chip--accent { color: var(--accent); border-color: rgba(255,77,216,.45); background: var(--accent-dim); }
.result-description { margin-top: 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.preview-bar { margin-top: 18px; }
.preview-bar label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.preview-bar audio { width: 100%; }
.preview-bar audio::-webkit-media-controls-panel { background: rgba(255,255,255,.06); }

.playlist-tracks { margin-top: 20px; border: 1px solid var(--border); border-radius: 12px; padding: 6px 14px; }
.playlist-tracks__head, .playlist-track { display: grid; grid-template-columns: 32px 48px 1fr 56px auto; gap: 12px; align-items: center; padding: 10px 0; font-size: 14px; }
.playlist-tracks__head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.playlist-track { border-radius: 10px; padding-left: 10px; padding-right: 10px; margin: 0 -10px; transition: background .15s; }
.playlist-track:hover { background: rgba(255,255,255,.05); }
.playlist-track__index { color: var(--muted); text-align: right; font-size: 13px; }
.playlist-track__cover img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--panel-2); }
.playlist-track__cover { position: relative; }
.playlist-track__cover--fallback { width: 48px; height: 48px; border-radius: 10px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 18px; }
.playlist-track__name { font-weight: 500; display: block; }
.playlist-track__artist { color: var(--muted); font-size: 12px; }
.playlist-track__duration { color: var(--muted); font-size: 13px; text-align: right; }
.btn--track-dl { padding: 8px 14px; font-size: 13px; margin-top: 0; }
.btn--track-dl.is-disabled { opacity: .4; pointer-events: none; background: var(--panel-2); color: var(--muted); box-shadow: none; }

.result-download-hint { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.site-footer { border-top: 1px solid var(--border); padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 560px) {
  .app { padding: 28px 14px 40px; }
  .form-row { flex-direction: column; }
  .btn--primary { width: 100%; }
  .result-head { flex-direction: column; }
  .result-art img { width: 96px; height: 96px; }
  .playlist-tracks__head, .playlist-track { grid-template-columns: 24px 40px 1fr auto; }
  .playlist-track__duration { display: none; }
  .playlist-tracks__head .playlist-tracks__col--duration { display: none; }
}
