*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg-card: #14141f;
  --bg-input: #1a1a2e;
  --border: #2a2a3e;
  --text: #e4e4ef;
  --text-muted: #8888a0;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --spotify: #1db954;
  --youtube: #ff0000;
  --success: #22c55e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  text-align: center;
  padding: 48px 0 24px;
}
.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: 4px;
}

/* Main container */
.container {
  width: 100%;
  max-width: 480px;
  flex: 1;
}

/* Input area */
.input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.input-group input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.input-group input::placeholder { color: var(--text-muted); }
.input-group input:focus { border-color: var(--accent); }
.input-group button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 14px 20px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.input-group button:hover { background: var(--accent-hover); }
.input-group button:disabled { opacity: .5; cursor: not-allowed; }

/* Loading */
.loader {
  display: none;
  text-align: center;
  padding: 32px 0;
}
.loader.active { display: block; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader p { color: var(--text-muted); font-size: .875rem; }

/* Error */
.error {
  display: none;
  background: #1f1020;
  border: 1px solid #5b2040;
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #f87171;
  font-size: .875rem;
  margin-bottom: 16px;
}
.error.active { display: block; }

/* Results */
.results { display: none; }
.results.active { display: block; }

.track-header {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.track-thumb {
  width: 80px; height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-input);
  flex-shrink: 0;
}
.track-info h2 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}
.track-info .artist {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: 2px;
}
.track-info .album {
  color: var(--text-muted);
  font-size: .8rem;
  margin-top: 2px;
  font-style: italic;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}
.link-card:hover { border-color: var(--accent); }

.platform-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.platform-icon.spotify { background: rgba(29,185,84,.15); color: var(--spotify); }
.platform-icon.youtube_music { background: rgba(255,0,0,.12); color: var(--youtube); }

.link-info { flex: 1; min-width: 0; }
.link-info .platform-name {
  font-weight: 600;
  font-size: .9rem;
}
.link-info .link-title {
  color: var(--text-muted);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-size: 1rem;
  transition: background .2s, border-color .2s;
}
.btn-icon:hover { border-color: var(--accent); background: var(--bg-card); }
.btn-icon.copied { border-color: var(--success); color: var(--success); }

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: .75rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  opacity: 0;
  transition: transform .3s, opacity .3s;
  z-index: 100;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* PWA install banner */
.install-banner {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  text-align: center;
}
.install-banner.active { display: block; }
.install-banner button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.install-banner p { color: var(--text-muted); font-size: .8rem; }

@media (max-width: 360px) {
  .track-thumb { width: 60px; height: 60px; }
  .input-group { flex-direction: column; }
  .input-group button { width: 100%; }
}
