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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #161618;
  color: #f6f7f8;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 700px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 8px;
  color: #f6f7f8;
}

/* Page Header with nav */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.page-header h1 {
  margin-bottom: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-link {
  color: #8a96a3;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 1000px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-link:hover {
  color: #f6f7f8;
  border-color: rgba(255, 255, 255, 0.2);
  background: #222527;
}

.title-link {
  color: #f6f7f8;
  text-decoration: none;
  transition: color 0.2s;
}

.title-link:hover {
  color: #00aff0;
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0 12px;
  font-size: 0.8rem;
}

.footer a {
  color: #4a4e54;
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: #8a96a3;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: #f6f7f8;
}

.subtitle {
  text-align: center;
  color: #8a96a3;
  margin-bottom: 24px;
}

.card {
  background: #1a1d21;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  color: #8a96a3;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #222527;
  color: #f6f7f8;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #00aff0;
  box-shadow: 0 0 0 3px rgba(0, 175, 240, 0.15);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="password"]::placeholder {
  color: #5a5e64;
}

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 1000px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: #00aff0;
  color: #fff;
}

.btn-primary:hover {
  background: #009ad6;
  box-shadow: 0 4px 16px rgba(0, 175, 240, 0.3);
}

.btn-secondary {
  background: #2c2f33;
  color: #f6f7f8;
}

.btn-secondary:hover {
  background: #3a3e44;
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-danger {
  background: #ff4757;
  color: #fff;
}

.btn-danger:hover {
  background: #e8414f;
}

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 1.2rem;
}

.btn-vote {
  background: #2c2f33;
  color: #f6f7f8;
  margin: 4px;
  padding: 12px 20px;
  font-size: 1rem;
  border-radius: 1000px;
}

.btn-vote:hover:not(:disabled) {
  background: #00aff0;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 175, 240, 0.3);
}

.btn-vote:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-add {
  background: #1db954;
  color: #fff;
  white-space: nowrap;
  border-radius: 1000px;
}

.btn-add:hover {
  background: #1ed760;
  box-shadow: 0 4px 16px rgba(29, 185, 84, 0.3);
}

.hint {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 8px;
}

.center {
  text-align: center;
}

.error {
  color: #ff4757;
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Share link */
.share-link {
  margin-top: 12px;
}

.share-link label {
  font-size: 0.9rem;
  color: #8a96a3;
  margin-bottom: 6px;
  display: block;
}

.link-box {
  display: flex;
  gap: 8px;
}

.link-box input {
  flex: 1;
}

/* Contestants */
.contestants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contestant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #222527;
  border-radius: 12px;
  transition: background 0.2s;
}

.contestant-item:hover {
  background: #2c2f33;
}

.contestant-name {
  font-weight: 500;
}

.song-badge {
  background: rgba(0, 175, 240, 0.15);
  color: #00aff0;
  padding: 3px 12px;
  border-radius: 1000px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Search results */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box input {
  flex: 1;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #222527;
  border-radius: 12px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.search-result:hover {
  background: #2c2f33;
}

.result-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

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

.result-title {
  font-size: 0.85rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #f6f7f8;
}

.result-duration {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
}

.result-artist {
  font-size: 0.8rem;
  color: #8a96a3;
  margin-top: 2px;
}

/* Song list */
.song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #222527;
  border-radius: 12px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.song-item:hover {
  background: #2c2f33;
}

.song-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.song-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.song-title {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f6f7f8;
}

.song-artist {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Player */
#player-container {
  margin: 12px 0;
  border-radius: 16px;
}

/* Spotify Auth Banner */
.spotify-banner {
  border: 1px solid rgba(29, 185, 84, 0.3);
  background: #1a1d21;
}

.spotify-banner.connected {
  border-color: rgba(29, 185, 84, 0.5);
  background: rgba(29, 185, 84, 0.05);
}

.spotify-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#spotify-status-text {
  font-size: 0.9rem;
  color: #8a96a3;
}

.connected #spotify-status-text {
  color: #1db954;
}

.btn-spotify {
  background: #1db954;
  color: #fff;
  font-weight: 600;
  border-radius: 1000px;
}

.btn-spotify:hover {
  background: #1ed760;
  box-shadow: 0 4px 16px rgba(29, 185, 84, 0.3);
}

/* SDK Player */
.sdk-player {
  background: #1a1d21;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sdk-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sdk-album-art {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.sdk-track-details {
  flex: 1;
  min-width: 0;
}

.sdk-track-name {
  font-size: 1rem;
  font-weight: 500;
  color: #f6f7f8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sdk-track-artist {
  font-size: 0.85rem;
  color: #8a96a3;
  margin-top: 3px;
}

.sdk-controls {
  margin-bottom: 12px;
}

.sdk-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #6b7280;
}

.sdk-progress-bar {
  flex: 1;
  height: 4px;
  background: #2c2f33;
  border-radius: 2px;
  overflow: hidden;
}

.sdk-progress-fill {
  height: 100%;
  background: #00aff0;
  border-radius: 2px;
  transition: width 1s linear;
  width: 0%;
}

/* Answer song info */
.answer-song-info {
  margin-bottom: 12px;
  padding: 12px;
  background: #222527;
  border-radius: 12px;
}

.answer-song-title {
  font-size: 1rem;
  color: #f6f7f8;
}

.answer-song-title a {
  color: #00aff0;
  text-decoration: none;
  transition: color 0.2s;
}

.answer-song-title a:hover {
  text-decoration: underline;
  color: #33c3ff;
}

.answer-song-artist {
  font-size: 0.85rem;
  color: #8a96a3;
  margin-top: 3px;
}

.song-counter {
  font-size: 1rem;
  color: #8a96a3;
  margin-bottom: 8px;
}

.playback-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Mute */
.mute-control {
  margin-top: 12px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #8a96a3;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #00aff0;
}

/* Voting */
#vote-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vote-result {
  padding: 6px 0;
  font-size: 0.9rem;
}

.answer-reveal {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

/* Album art reveal */
.answer-album-art {
  text-align: center;
  margin-bottom: 16px;
}

.answer-album-art img {
  width: 240px;
  height: 240px;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 175, 240, 0.35);
  animation: coverPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-animate {
  animation: cardReveal 0.4s ease-out;
}

@keyframes coverPop {
  0% {
    transform: scale(0.3) rotate(-5deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.05) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes cardReveal {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Scoreboard */
.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #222527;
  border-radius: 12px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.score-row:hover {
  background: #2c2f33;
}

.score-row.winner {
  background: rgba(29, 185, 84, 0.1);
  border: 1px solid rgba(29, 185, 84, 0.4);
}

.score-row.highlight {
  border: 1px solid rgba(0, 175, 240, 0.5);
  background: rgba(0, 175, 240, 0.05);
}

.rank {
  font-size: 1.1rem;
  min-width: 60px;
}

.score-name {
  flex: 1;
  font-weight: 500;
}

.score-value {
  font-size: 0.9rem;
  color: #8a96a3;
}

/* Previous Songs */
.previous-song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #222527;
  border-radius: 12px;
  margin-bottom: 6px;
  transition: background 0.2s;
}

.previous-song-item:hover {
  background: #2c2f33;
}

.previous-song-num {
  font-size: 0.8rem;
  color: #4a4e54;
  min-width: 28px;
}

.previous-song-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.previous-song-title {
  font-size: 0.85rem;
  color: #00aff0;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s;
}

.previous-song-title:hover {
  text-decoration: underline;
  color: #33c3ff;
}

.previous-song-artist {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Quiz History */
.quiz-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: #222527;
  border-radius: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
  cursor: pointer;
}

.quiz-history-item:hover {
  background: #2c2f33;
}

.quiz-history-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quiz-history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-resume {
  background: #1db954;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  border-radius: 1000px;
}

.btn-resume:hover {
  background: #1ed760;
}

.btn-delete {
  background: rgba(255, 71, 87, 0.1);
  color: #ff4757;
  border: 1px solid rgba(255, 71, 87, 0.3);
  font-weight: 600;
  border-radius: 1000px;
}

.btn-delete:hover {
  background: #ff4757;
  color: #fff;
}

.quiz-history-name {
  font-weight: 500;
  color: #f6f7f8;
}

.quiz-history-meta {
  font-size: 0.8rem;
  color: #6b7280;
}

.quiz-state {
  padding: 4px 12px;
  border-radius: 1000px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.state-lobby {
  background: rgba(0, 175, 240, 0.12);
  color: #00aff0;
}

.state-playing {
  background: rgba(240, 160, 48, 0.12);
  color: #f0a030;
}

.state-finished {
  background: rgba(29, 185, 84, 0.12);
  color: #1db954;
}

/* Quiz History Song List */
.quiz-history-entry {
  margin-bottom: 8px;
}

.quiz-songs-list {
  padding: 10px 14px;
  background: #1a1d21;
  border-radius: 0 0 12px 12px;
  margin-top: -4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top: none;
}

.quiz-song-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.quiz-song-row:last-child {
  border-bottom: none;
}

.quiz-song-cover {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.quiz-song-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.quiz-song-title {
  color: #f6f7f8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.quiz-song-title:hover {
  color: #00aff0;
}

.quiz-song-artist {
  color: #6b7280;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-song-added-by {
  color: #00aff0;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 500px) {
  body {
    padding: 12px;
  }
  
  h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .search-result {
    flex-wrap: wrap;
  }

  .result-thumb {
    width: 60px;
    height: 34px;
  }
}
