:root {
  --green: #1db954;
  --green-dark: #17a348;
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface2: #242424;
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

.app {
  width: 100%;
  max-width: 640px;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--green);
  margin-bottom: 0.4rem;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
}

#auth-status {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */

.btn {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  border-radius: 500px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.1s, opacity 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-spotify {
  background: var(--green);
  color: #000;
}

.btn-spotify:hover {
  background: var(--green-dark);
}

.btn-primary {
  background: var(--green);
  color: #000;
  width: 100%;
  margin-top: 0.75rem;
  font-size: 1rem;
}

.btn-primary:hover {
  background: var(--green-dark);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mood input */

.mood-input-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid #2a2a2a;
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  font-family: inherit;
}

textarea::placeholder {
  color: var(--text-muted);
}

/* Loading */

#loading {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #2a2a2a;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}

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

/* Results */

#results {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border: 1px solid #2a2a2a;
  transition: border-color 0.2s;
  text-decoration: none;
  color: inherit;
}

.result-card:hover {
  border-color: var(--green);
}

.rank {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
  min-width: 2rem;
  line-height: 1;
  padding-top: 2px;
}

.playlist-art {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}

.playlist-art-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: var(--surface2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.playlist-info {
  flex: 1;
  min-width: 0;
}

.playlist-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-tracks {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.playlist-reason {
  font-size: 0.82rem;
  color: #c0c0c0;
  line-height: 1.4;
}

/* Footer */

footer {
  text-align: center;
  margin-top: 2rem;
}

#logout-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
}

#logout-link:hover {
  color: var(--text);
}

/* Utilities */

.hidden {
  display: none !important;
}

#login-section {
  text-align: center;
  padding: 3rem 0;
}
