/* music-bridge — mobile-first, no framework. Dark, big tap targets. */

:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-2: #232733;
  --text: #e8eaed;
  --muted: #9aa0ab;
  --accent: #4f9dff;
  --spotify: #1db954;
  --yandex: #ffcc00;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  position: sticky;
  top: 0;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(8px);
  z-index: 5;
}

header h1 { font-size: 1.25rem; margin: 0; letter-spacing: 0.3px; }

.whoami {
  background: var(--card-2);
  color: var(--text);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

main { padding: 0 16px 32px; max-width: 640px; margin: 0 auto; }

/* --- add box --- */
.add { display: flex; gap: 8px; margin: 12px 0 16px; }

.add input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid #2c3140;
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1rem;
}
.add input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.add button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.add button:disabled { opacity: 0.5; cursor: default; }

.status { min-height: 1.2em; margin: 0 4px 12px; font-size: 0.9rem; color: var(--muted); }
.status.error { color: #ff6b6b; }
.status.ok { color: #5ad17a; }

/* --- song list --- */
.songs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.song {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
}
.song-main { display: flex; gap: 12px; align-items: center; width: 100%; }

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

.song .meta { flex: 1; min-width: 0; }
.song .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .artist { color: var(--muted); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .by { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }

.links { display: flex; gap: 8px; flex-shrink: 0; }
.svc {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  text-decoration: none;
}
.svc svg { width: 100%; height: 100%; display: block; }
.svc.disabled { opacity: 0.28; filter: grayscale(1); pointer-events: none; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* --- manual completion rows (for songs missing a service link) --- */
.fix {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #2c3140;
}
.fix-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.fix-note { font-size: 0.8rem; color: var(--muted); margin-right: auto; }
.fix .find,
.fix .fix-toggle {
  font-size: 0.8rem;
  padding: 7px 11px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.fix .find { background: var(--card-2); color: var(--text); }
.fix .fix-toggle { background: var(--accent); color: #fff; }
.fix-form { display: flex; gap: 6px; width: 100%; }
.fix-form.hidden { display: none; }
.fix-form input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid #2c3140;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.9rem;
}
.fix-form button {
  background: var(--spotify);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}

/* --- setup overlay --- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(8, 9, 12, 0.96);
  display: grid; place-items: center;
  z-index: 10; padding: 24px;
}
.overlay.hidden { display: none; }
.setup-card { text-align: center; max-width: 360px; }
.setup-card h1 { margin: 0 0 8px; }
.setup-card p { color: var(--muted); margin: 0 0 20px; }
.who-buttons { display: flex; gap: 12px; justify-content: center; margin-bottom: 16px; }
.who {
  flex: 1;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid #2c3140;
  border-radius: var(--radius);
  padding: 18px 0;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}
.who:active { background: var(--accent); }
.setup-card small { color: var(--muted); }
.setup-card input {
  width: 100%;
  background: var(--card);
  border: 1px solid #2c3140;
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1rem;
  margin-bottom: 12px;
}
.setup-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
#key-error { color: #ff6b6b; display: block; margin-top: 8px; }
