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

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-hover: #222240;
  --border: #2a2a45;
  --accent: #e94560;
  --accent-hover: #ff5a75;
  --accent-soft: rgba(233, 69, 96, 0.15);
  --text: #f0f0f0;
  --text-muted: #8888aa;
  --text-dim: #555570;
  --success: #4ecdc4;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
}

.page.wide { max-width: 600px; }

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Typography */
h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Logo */
.logo {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.how-it-works {
  margin-top: -4px;
  margin-bottom: 16px;
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.how-it-row {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

.how-it-row strong {
  color: var(--text-muted);
  font-weight: 600;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

/* Inputs */
input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 12px;
}

input:focus {
  border-color: var(--accent);
}

input::placeholder {
  color: var(--text-dim);
}

label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* Buttons */
button, .btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-ghost {
  background: none;
  color: var(--text-muted);
  padding: 10px;
  font-size: 14px;
}
.btn-ghost:hover { color: var(--text); }

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

/* Now Playing */
.now-playing {
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
  transition: border-color 0.4s, background 0.4s;
}

.now-playing--idle {
  background: var(--surface);
  border: 1px solid var(--border);
}

.now-playing--active {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid var(--accent);
}

.now-playing .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 10px;
  transition: color 0.4s;
}

.now-playing--idle .label { color: var(--text-dim); }
.now-playing--active .label { color: var(--accent); }

/* Idle state */
.np-idle { padding: 6px 0; }
.np-idle-icon { font-size: 28px; opacity: 0.2; margin-bottom: 6px; }
.np-idle-text { font-size: 14px; color: var(--text-dim); }

/* Active state */
.now-playing .song-name {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.now-playing .artist-name {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}

/* Animated playing bars */
.np-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 18px;
  margin-bottom: 10px;
}

.np-bars span {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
  animation: np-bar 0.9s ease-in-out infinite;
}

.np-bars span:nth-child(1) { animation-delay: 0s;    height: 8px; }
.np-bars span:nth-child(2) { animation-delay: 0.15s; height: 14px; }
.np-bars span:nth-child(3) { animation-delay: 0.3s;  height: 10px; }
.np-bars span:nth-child(4) { animation-delay: 0.45s; height: 6px; }

@keyframes np-bar {
  0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
  50%       { transform: scaleY(1.2); opacity: 1; }
}

/* DJ Now Playing */
.dj-now-playing {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.dj-np-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.dj-np-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
}

.dj-np-song {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}

.dj-np-artist {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.dj-np-stat {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.dj-np-stat strong { color: var(--accent); }

.dj-np-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dj-np-actions .btn {
  flex: 1;
  min-width: 120px;
  white-space: nowrap;
}

/* Queue */
.queue-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  transition: background 0.15s;
}

.queue-item:last-child { border-bottom: none; }
.queue-item:hover { background: var(--surface-hover); }

.queue-item .vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}

.vote-btn {
  width: 44px !important;
  height: 44px;
  border-radius: 50% !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
  font-size: 13px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  cursor: pointer;
  transition: all 0.2s;
  flex-direction: column;
  line-height: 1;
}

.vote-btn:hover:not(.voted) {
  opacity: 0.8;
}

.vote-btn.voted {
  cursor: default;
  pointer-events: none;
}

@keyframes vote-bounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.55); }
  70%  { transform: scale(0.85); }
  100% { transform: scale(1); }
}

.vote-btn.vote-bouncing {
  animation: vote-bounce 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes vote-particle {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

@keyframes count-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(2.1); }
  100% { transform: scale(1); }
}

.vote-count.count-popping {
  animation: count-pop 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
  display: inline-block;
}

.requester-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.85;
  transition: transform 0.15s, opacity 0.15s;
}

.requester-dot:hover {
  transform: scale(1.4);
  opacity: 1;
}

.queue-item.requester-dimmed {
  opacity: 0.3;
}

.queue-item.requester-highlighted {
  outline: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
}

.hot-badge {
  font-size: 13px;
  margin-left: 6px;
  animation: hot-pulse 1.2s ease-in-out infinite;
  display: inline-block;
}

@keyframes hot-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.25); }
}

/* Vote count color tiers — same votes = same color for everyone */
.vote-btn[data-votes="1"]  { background: rgba(99,102,241,0.15)  !important; border-color: #6366f1 !important; color: #6366f1 !important; }
.vote-btn[data-votes="2"]  { background: rgba(6,182,212,0.15)   !important; border-color: #06b6d4 !important; color: #06b6d4 !important; }
.vote-btn[data-votes="3"]  { background: rgba(245,158,11,0.15)  !important; border-color: #f59e0b !important; color: #f59e0b !important; }
.vote-btn[data-votes="4"]  { background: rgba(249,115,22,0.15)  !important; border-color: #f97316 !important; color: #f97316 !important; }
.vote-btn[data-votes="5"]  { background: rgba(239,68,68,0.15)   !important; border-color: #ef4444 !important; color: #ef4444 !important; }
.vote-btn[data-votes="6"]  { background: rgba(244,63,94,0.15)   !important; border-color: #f43f5e !important; color: #f43f5e !important; }
.vote-btn[data-votes="7"]  { background: rgba(236,72,153,0.15)  !important; border-color: #ec4899 !important; color: #ec4899 !important; }
.vote-btn[data-votes="8"]  { background: rgba(217,70,239,0.15)  !important; border-color: #d946ef !important; color: #d946ef !important; }
.vote-btn[data-votes="9"]  { background: rgba(168,85,247,0.15)  !important; border-color: #a855f7 !important; color: #a855f7 !important; }
.vote-btn[data-votes="10"] { background: rgba(139,92,246,0.15)  !important; border-color: #8b5cf6 !important; color: #8b5cf6 !important; }

.vote-count {
  font-size: 11px;
  margin-top: 2px;
}

.queue-item .song-info {
  flex: 1;
  min-width: 0;
}

.queue-item .song-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .song-artist {
  font-size: 13px;
  color: var(--text-muted);
}

.queue-item .song-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .song-requester {
  font-style: normal;
  color: var(--text-muted);
}

.queue-item .actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.queue-item .actions button {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.dj-song-stat { text-align: right; flex-shrink: 0; margin-right: 4px; }
.dj-stat-count { display: block; font-size: 13px; font-weight: 700; color: var(--accent); }
.dj-stat-date { display: block; font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.section-header h3 { margin-bottom: 0; }

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
}

/* QR Code */
.qr-container {
  background: white;
  padding: 16px;
  border-radius: var(--radius);
  display: inline-block;
  margin: 16px 0;
}

/* Session code display */
.session-code {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
  margin: 8px 0 4px;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  appearance: none;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  outline: none;
}

.toggle:checked { background: var(--success); }

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle:checked::after { transform: translateX(22px); }

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Autocomplete */
.autocomplete {
  position: absolute;
  top: calc(100% - 12px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.ac-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.ac-item:hover { background: var(--surface-hover); }
.ac-item:last-child { border-bottom: none; }
.ac-item .ac-song { font-size: 14px; }
.ac-item .ac-artist { font-size: 12px; color: var(--text-muted); }

/* Flash messages */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.flash-info {
  background: rgba(78, 205, 196, 0.1);
  border: 1px solid rgba(78, 205, 196, 0.3);
  color: var(--success);
}

.flash-error {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  color: var(--accent);
}

.flash-success {
  background: rgba(78, 205, 196, 0.1);
  border: 1px solid rgba(78, 205, 196, 0.3);
  color: var(--success);
}

/* Played section */
.played-section {
  margin-top: 8px;
}

.played-toggle {
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 10px 16px;
  display: block;
  transition: color 0.2s;
}

.played-toggle:hover { color: var(--text-muted); }

.played-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  opacity: 0.5;
}

.played-item .song-title {
  font-size: 14px;
  text-decoration: line-through;
}

/* History table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th {
  text-align: left;
  padding: 10px 16px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.history-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.history-table tr:hover td { background: var(--surface-hover); }

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

/* Stats */
.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.stat-item:last-child { border-bottom: none; }
.stat-rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.stat-info { flex: 1; min-width: 0; }
.stat-song { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-artist { font-weight: 400; color: var(--text-muted); }
.stat-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; }
.stat-bar { height: 4px; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }
.stat-count { text-align: right; flex-shrink: 0; }
.stat-plays { font-size: 15px; font-weight: 700; color: var(--accent); }
.stat-date { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.stat-fav-btn { background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 6px; padding: 4px 8px; font-size: 13px; cursor: pointer; flex-shrink: 0; width: auto; transition: all 0.2s; }
.stat-fav-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.stat-fav-btn.stat-fav-saved { border-color: var(--accent); color: var(--accent); font-size: 11px; }
.stat-fav-btn:disabled { cursor: default; }

/* Favorites list */
.fav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.fav-item:last-child { border-bottom: none; }
.fav-info { flex: 1; min-width: 0; }
.fav-song { font-weight: 600; font-size: 15px; }
.fav-artist { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.fav-remove {
  font-size: 16px;
  color: var(--text-dim);
  padding: 4px 8px;
  flex-shrink: 0;
}
.fav-remove:hover { color: var(--text); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state .icon { font-size: 32px; margin-bottom: 12px; display: block; }

/* Auth page tabs */
.auth-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.auth-tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface-hover);
}

/* Slug input with /m/ prefix */
.slug-input-wrap {
  position: relative;
  margin-bottom: 12px;
}

.slug-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 15px;
  pointer-events: none;
}

.slug-input {
  padding-left: 38px !important;
  margin-bottom: 0 !important;
}

/* Musician info strip on dashboard */
.musician-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.musician-strip-left {
  min-width: 0;
  flex: 1;
}

.permanent-url {
  font-size: 13px;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
  word-break: break-all;
}

/* Settings page */
.settings-header {
  margin-bottom: 24px;
}

.settings-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  gap: 3px;
}

.settings-tab {
  flex: 1;
  padding: 9px 6px;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.settings-tab.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.settings-tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface-hover);
}

/* Color swatches */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch--active { border-color: white; transform: scale(1.1); }

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Song textarea */
.song-textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
  line-height: 1.6;
}

.song-textarea:focus { border-color: var(--accent); }

/* File input */
.file-input {
  width: 100%;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.file-input::file-selector-button {
  padding: 8px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  margin-right: 10px;
}

/* Link variants */
.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 0;
  width: auto;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:hover { color: var(--text); }

.btn-danger { background: #c0392b; color: white; border: none; }
.btn-danger:hover { background: #a93226; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  width: 320px;
  max-width: calc(100vw - 40px);
}
.modal-card h3 { margin: 0 0 4px; font-size: 18px; }

.link-accent {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.link-accent:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 520px) {
  .page { padding: 16px; }
  h1 { font-size: 24px; }
  .session-code { font-size: 26px; }
  .settings-tab { font-size: 11px; padding: 8px 4px; }
}

/* Utility */
.hidden { display: none !important; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 13px; }
