* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a0f;
  color: #e0e0e0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ============================================================
   Lobby
   ============================================================ */
.lobby {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 20%, #0d1a2e 0%, #0a0a0f 60%);
}
.lobby-content {
  background: #12122080;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid #ffffff10;
  border-radius: 20px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
}
.lobby-title {
  font-size: 36px;
  text-align: center;
  background: linear-gradient(135deg, #00d4ff, #00ff88);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.lobby-subtitle {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-bottom: 28px;
}
.lobby-field {
  margin-bottom: 16px;
}
.lobby-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.lobby-field input {
  width: 100%;
  padding: 12px 14px;
  background: #0a0a0f;
  border: 1px solid #ffffff15;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  transition: border-color 0.2s;
}
.lobby-field input:focus {
  outline: none;
  border-color: #00d4ff;
}
.lobby-section {
  margin-top: 8px;
}
.lobby-section h3 {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 12px;
  font-weight: 500;
}
.lobby-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  margin-top: 4px;
  border-radius: 10px;
}
.lobby-divider {
  text-align: center;
  position: relative;
  margin: 24px 0;
  color: #555;
  font-size: 13px;
}
.lobby-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #ffffff10;
}
.lobby-divider span {
  position: relative;
  background: #121220;
  padding: 0 16px;
}
.lobby-back {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  background: transparent;
  border: none;
  color: #00d4ff;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: color 0.2s;
}
.lobby-back:hover {
  color: #00ff88;
}

/* My Rooms */
.my-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.my-room-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #0a0a14;
  border: 1px solid #ffffff08;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.my-room-card:hover {
  background: #13132a;
  border-color: #00d4ff20;
}
.my-room-card .room-dot {
  width: 8px;
  height: 8px;
  background: #00ff88;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px #00ff8866;
}
.my-room-card .room-details {
  flex: 1;
  min-width: 0;
}
.my-room-card .room-name {
  font-size: 14px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.my-room-card .room-meta {
  font-size: 11px;
  color: #555;
  margin-top: 2px;
}
.my-room-card .room-pin {
  font-size: 13px;
  color: #00d4ff;
  font-weight: 600;
  letter-spacing: 2px;
  flex-shrink: 0;
}
.my-room-card .rejoin-label {
  font-size: 11px;
  color: #00ff88;
  font-weight: 500;
  flex-shrink: 0;
}
.lobby-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #ff444415;
  border: 1px solid #ff444430;
  border-radius: 10px;
  color: #ff6666;
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   Modal (shared)
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-content {
  background: #1a1a2e;
  border: 1px solid #ffffff10;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.modal-content h2 {
  color: #00d4ff;
  margin-bottom: 8px;
}
.modal-content p {
  color: #888;
  margin-bottom: 20px;
}
.modal-content input {
  width: 100%;
  padding: 12px;
  background: #0a0a0f;
  border: 1px solid #ffffff15;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  margin-bottom: 16px;
  text-align: center;
}
.modal-content input:focus {
  outline: none;
  border-color: #00d4ff;
}

/* ============================================================
   Settings Modal
   ============================================================ */
.settings-modal {
  max-width: 440px;
  text-align: left;
  max-height: 90vh;
  overflow-y: auto;
}
.settings-modal h2 {
  text-align: center;
  margin-bottom: 20px;
}
.settings-field {
  margin-bottom: 16px;
}
.settings-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.settings-field select,
.settings-field input {
  width: 100%;
  padding: 10px 12px;
  background: #0a0a0f;
  border: 1px solid #ffffff15;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  text-align: left;
}
.settings-field select:focus,
.settings-field input:focus {
  outline: none;
  border-color: #00d4ff;
}
.settings-users {
  margin-top: 20px;
  margin-bottom: 20px;
}
.settings-users h3 {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.settings-user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #0d0d18;
  border-radius: 8px;
  font-size: 13px;
}
.settings-user-item .user-name {
  flex: 1;
}
.settings-user-item .host-badge {
  color: #00d4ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-left: 8px;
  padding: 2px 6px;
  background: #00d4ff15;
  border-radius: 4px;
}
.settings-user-item .kick-btn {
  padding: 4px 10px;
  font-size: 11px;
  background: transparent;
  border: 1px solid #ff444440;
  color: #ff4444;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.settings-user-item .kick-btn:hover {
  background: #ff444420;
  border-color: #ff4444;
}
.settings-modal .btn-primary {
  width: 100%;
  margin-top: 8px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  padding: 10px 20px;
  border: 1px solid #ffffff15;
  border-radius: 10px;
  background: #1a1a2e;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.btn:hover { background: #252545; border-color: #ffffff25; }
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, #00d4ff, #00b8e6);
  color: #000;
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(135deg, #00b8e6, #009acc); }
.btn-play {
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  color: #000;
  border-color: transparent;
  font-weight: 700;
  font-size: 16px;
  padding: 12px 28px;
}
.btn-play:hover { background: linear-gradient(135deg, #00e07a, #00b85e); }
.btn-play.playing {
  background: linear-gradient(135deg, #ff4444, #cc3333);
  border-color: transparent;
}

/* ============================================================
   Header
   ============================================================ */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid #ffffff08;
  background: #0d0d15;
  gap: 12px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
header h1 {
  font-size: 20px;
  background: linear-gradient(135deg, #00d4ff, #00ff88);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.room-info {
  color: #888;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-info::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #00ff88;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.user-count {
  color: #555;
  font-size: 12px;
  white-space: nowrap;
}
.btn-share {
  padding: 6px 14px;
  font-size: 12px;
  background: transparent;
  border: 1px solid #00d4ff30;
  color: #00d4ff;
}
.btn-share:hover {
  background: #00d4ff15;
  border-color: #00d4ff;
}
.btn-settings {
  padding: 6px 14px;
  font-size: 12px;
  background: transparent;
  border: 1px solid #ff88ff30;
  color: #ff88ff;
}
.btn-settings:hover {
  background: #ff88ff15;
  border-color: #ff88ff;
}
.btn-leave {
  padding: 6px 14px;
  font-size: 12px;
  background: transparent;
  border: 1px solid #ff444430;
  color: #ff4444;
}
.btn-leave:hover {
  background: #ff444415;
  border-color: #ff4444;
}

/* ============================================================
   QR Modal
   ============================================================ */
.qr-modal {
  max-width: 300px;
}
.qr-modal h2 {
  margin-bottom: 16px;
}
#qrImage {
  display: block;
  margin: 0 auto 12px;
  border-radius: 8px;
  width: 200px;
  height: 200px;
}
.qr-url {
  font-size: 13px;
  color: #00d4ff;
  word-break: break-all;
  margin-bottom: 8px;
  user-select: all;
  -webkit-user-select: all;
}
.qr-pin {
  font-size: 22px;
  font-weight: 700;
  color: #00ff88;
  letter-spacing: 6px;
  margin-bottom: 16px;
}

/* ============================================================
   Main Layout
   ============================================================ */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================================
   Now Playing
   ============================================================ */
.now-playing {
  background: #111120;
  border: 1px solid #ffffff08;
  border-radius: 16px;
  padding: 24px;
}
.now-playing-info {
  margin-bottom: 16px;
}
.now-playing-info .label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #00d4ff;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.now-playing-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.now-playing-thumb {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.track-title {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}
.track-meta {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

#waveform {
  width: 100%;
  height: 120px;
  background: #08080e;
  border-radius: 10px;
  margin-bottom: 16px;
}

/* ============================================================
   Progress Bar
   ============================================================ */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #1a1a2e;
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 4px;
  position: relative;
  transition: height 0.15s;
}
.progress-bar:hover,
.progress-bar.dragging {
  height: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #00ff88);
  border-radius: 3px;
  width: 0%;
  pointer-events: none;
  transition: height 0.15s;
}
.progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #00d4ff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}
.progress-bar:hover .progress-thumb,
.progress-bar.dragging .progress-thumb {
  opacity: 1;
}
.progress-bar.dragging .progress-thumb {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.6);
}
.progress-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #555;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
}
.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #555;
  font-size: 12px;
}
.volume-control input[type="range"] {
  width: 100px;
  accent-color: #00d4ff;
}

.dj-status {
  margin-top: 12px;
  font-size: 13px;
  color: #00ff88;
  min-height: 20px;
}

/* ============================================================
   Add Song
   ============================================================ */
.add-song {
  background: #111120;
  border: 1px solid #ffffff08;
  border-radius: 16px;
  padding: 24px;
}
.add-song h2 {
  font-size: 15px;
  margin-bottom: 16px;
  color: #ccc;
}
.smart-form {
  display: flex;
  gap: 12px;
  align-items: center;
}
.smart-form input[type="text"] {
  flex: 1;
  padding: 12px 14px;
  background: #08080e;
  border: 1px solid #ffffff10;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 14px;
  transition: border-color 0.2s;
}
.smart-form input:focus {
  outline: none;
  border-color: #00d4ff;
}

/* Suggestions Button */
.btn-suggest {
  margin-top: 12px;
  padding: 10px 20px;
  font-size: 13px;
  background: transparent;
  border: 1px solid #ff88ff30;
  color: #ff88ff;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.btn-suggest:hover:not(:disabled) {
  background: #ff88ff15;
  border-color: #ff88ff;
}
.btn-suggest:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-suggest.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================================
   Search Results
   ============================================================ */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #0a0a14;
  border: 1px solid #ffffff06;
  border-radius: 10px;
  transition: all 0.2s;
}
.search-result:hover {
  background: #13132a;
  border-color: #ffffff10;
}
.search-result img {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.search-result .result-info {
  flex: 1;
  min-width: 0;
}
.search-result .result-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result .result-meta {
  font-size: 12px;
  color: #555;
  margin-top: 2px;
}
.search-result .btn-add {
  padding: 8px 16px;
  font-size: 12px;
  background: #00d4ff10;
  border: 1px solid #00d4ff40;
  color: #00d4ff;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}
.search-result .btn-add:hover {
  background: #00d4ff25;
  border-color: #00d4ff;
}
.search-close {
  display: block;
  margin-left: auto;
  background: transparent;
  border: 1px solid #333;
  color: #888;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.search-close:hover {
  border-color: #ff4444;
  color: #ff4444;
}
.search-loading {
  text-align: center;
  padding: 20px;
  color: #555;
  font-size: 13px;
}
.search-loading-typeahead {
  padding: 10px;
  font-size: 12px;
  color: #444;
}

/* ============================================================
   Queue
   ============================================================ */
.queue-section {
  background: #111120;
  border: 1px solid #ffffff08;
  border-radius: 16px;
  padding: 24px;
}
.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.queue-header h2 { font-size: 15px; color: #ccc; }
#queueCount { color: #555; font-size: 12px; }

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.queue-empty {
  text-align: center;
  padding: 32px;
  color: #333;
  font-size: 14px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #0a0a14;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all 0.2s;
}
.queue-item:hover {
  background: #13132a;
  border-color: #ffffff08;
}
.queue-item.now-playing-item {
  background: #0a1a2e;
  border-color: #00d4ff20;
}
.queue-item.downloading {
  opacity: 0.55;
}

.queue-item .position {
  font-size: 13px;
  color: #444;
  min-width: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.queue-thumb {
  width: 52px;
  height: 39px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.queue-item .song-info {
  flex: 1;
  min-width: 0;
}
.queue-item .song-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item .song-detail {
  font-size: 11px;
  color: #555;
  margin-top: 2px;
}
.queue-item .song-tags {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #1a1a2e;
  color: #666;
}
.tag.bpm { color: #00d4ff; border: 1px solid #00d4ff20; background: #00d4ff08; }
.tag.key { color: #ff88ff; border: 1px solid #ff88ff20; background: #ff88ff08; }
.tag.energy { color: #00ff88; border: 1px solid #00ff8820; background: #00ff8808; }

.queue-item .actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.queue-item .actions button {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid #ffffff12;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}
.queue-item .actions .vote-btn:hover {
  border-color: #00ff88;
  color: #00ff88;
  background: #00ff8810;
}
.queue-item .actions .remove-btn:hover,
.queue-item .actions .cancel-btn:hover {
  border-color: #ff4444;
  color: #ff4444;
  background: #ff444410;
}
.queue-item .actions .cancel-btn {
  border-color: #ff444440;
  color: #ff4444;
}

/* ============================================================
   History
   ============================================================ */
.history-section {
  opacity: 0.7;
  border-color: #ffffff05;
}
.history-section h2 { color: #777; }
#historyCount { color: #444; font-size: 12px; }
.history-item {
  background: #08080e !important;
}
.history-item .song-title {
  color: #888;
}
.history-item .position {
  color: #444;
  font-size: 10px;
}
.queue-item .actions .requeue-btn:hover {
  border-color: #00d4ff;
  color: #00d4ff;
  background: #00d4ff10;
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ============================================================
   Responsive — Desktop (1024px+)
   ============================================================ */
@media (min-width: 1024px) {
  header {
    padding: 14px calc((100% - 1400px) / 2 + 24px);
  }

  main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 20px;
    align-items: start;
  }

  .now-playing {
    grid-column: 1;
    grid-row: 1 / -1;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }

  .add-song {
    grid-column: 2;
    grid-row: 1;
  }

  .queue-section {
    grid-column: 2;
    grid-row: 2;
  }

  .queue-section.history-section {
    grid-column: 2;
    grid-row: 3;
  }

  .queue-section.favorites-section {
    grid-column: 2;
    grid-row: 4;
  }

  .queue-list {
    max-height: 400px;
    overflow-y: auto;
  }

  #waveform {
    height: 150px;
  }

  .now-playing-thumb {
    width: 140px;
    height: 105px;
  }

  .track-title {
    font-size: 24px;
  }
}

/* ============================================================
   Responsive — Tablet (601px – 1023px)
   ============================================================ */
@media (min-width: 601px) and (max-width: 1023px) {
  main {
    max-width: 700px;
  }
}

/* ============================================================
   Responsive — Mobile (600px and below)
   ============================================================ */
@media (max-width: 600px) {
  /* Header */
  header {
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-left {
    gap: 10px;
    flex: 1;
    min-width: 0;
  }
  header h1 { font-size: 16px; }
  .room-info {
    font-size: 11px;
    max-width: 120px;
  }
  .header-right {
    gap: 6px;
  }
  .user-count { display: none; }
  .btn-share, .btn-settings, .btn-leave {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 8px;
  }

  main {
    padding: 12px;
    gap: 12px;
  }

  /* Lobby */
  .lobby { padding: 16px; }
  .lobby-content { padding: 24px 20px; }
  .lobby-title { font-size: 28px; }

  /* Now Playing */
  .now-playing {
    padding: 16px;
    border-radius: 12px;
  }
  .now-playing-thumb {
    width: 64px;
    height: 48px;
  }
  .now-playing-row {
    gap: 12px;
  }
  .track-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .track-meta {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #waveform {
    height: 80px;
    margin-bottom: 12px;
  }
  .progress-bar {
    height: 10px;
  }
  .progress-bar:hover, .progress-bar.dragging {
    height: 12px;
  }
  .progress-thumb {
    width: 20px;
    height: 20px;
    opacity: 1;
  }
  .transport {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .btn-play {
    font-size: 15px;
    padding: 12px 16px;
  }
  .volume-control {
    grid-column: 1 / -1;
    margin-left: 0;
    justify-content: center;
  }
  .volume-control input[type="range"] {
    width: 100%;
    flex: 1;
  }
  .dj-status {
    font-size: 12px;
    margin-top: 8px;
  }

  /* Add Song */
  .add-song {
    padding: 16px;
    border-radius: 12px;
  }
  .add-song h2 {
    font-size: 14px;
    margin-bottom: 12px;
  }
  .smart-form {
    flex-direction: column;
    gap: 10px;
  }
  .smart-form input[type="text"] {
    width: 100%;
    font-size: 16px; /* prevents iOS zoom */
    padding: 12px 14px;
  }
  .smart-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
  }
  .btn-suggest {
    font-size: 14px;
    padding: 12px;
  }
  .search-result {
    gap: 8px;
    padding: 8px 10px;
  }
  .search-result img {
    width: 56px;
    height: 42px;
  }
  .search-result .result-title {
    font-size: 13px;
  }
  .search-result .result-meta {
    font-size: 11px;
  }
  .search-result .btn-add {
    padding: 8px 12px;
  }

  /* Queue */
  .queue-section {
    padding: 16px;
    border-radius: 12px;
  }
  .queue-item {
    padding: 10px 10px;
    gap: 8px;
  }
  .queue-item .position {
    min-width: 20px;
    font-size: 12px;
  }
  .queue-thumb {
    width: 44px;
    height: 33px;
  }
  .queue-item .song-title {
    font-size: 13px;
  }
  .queue-item .song-detail {
    font-size: 10px;
  }
  .queue-item .song-tags {
    gap: 4px;
  }
  .queue-item .actions {
    flex-direction: column;
    gap: 4px;
  }
  .queue-item .actions button {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* History */
  .history-section {
    padding: 16px;
    border-radius: 12px;
  }

  /* Settings modal */
  .settings-modal {
    padding: 24px 20px;
  }
}

/* ============================================================
   Sync Debug Panel
   ============================================================ */
.sync-debug-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: #ccc;
  z-index: 9999;
  min-width: 240px;
  backdrop-filter: blur(8px);
}

.sync-debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: #00d4ff;
  font-weight: bold;
  font-size: 13px;
}

.sync-debug-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.sync-debug-close:hover {
  color: #fff;
}

.sync-debug-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
}

.sync-debug-label {
  color: #888;
}

.sync-debug-value {
  color: #ddd;
  text-align: right;
}

.sync-debug-value.sync-ok { color: #7fff7f; }
.sync-debug-value.sync-warn { color: #ffcc00; }
.sync-debug-value.sync-bad { color: #ff5555; }

.btn-debug {
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #00d4ff;
}

.btn-debug:hover {
  background: rgba(0, 212, 255, 0.2);
}

/* ============================================================
   Auth Styles
   ============================================================ */

.lobby-auth-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-auth {
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-auth:hover {
  background: linear-gradient(135deg, #00e5ff, #00aadd);
}

.btn-auth-small {
  background: transparent;
  color: #888;
  border: 1px solid #444;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.btn-auth-small:hover {
  color: #ff4444;
  border-color: #ff4444;
}

.lobby-user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-user-name {
  color: #00d4ff;
  font-weight: 600;
  font-size: 14px;
}

.auth-modal {
  max-width: 380px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.auth-field {
  text-align: left;
}

.auth-field label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-field input {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  box-sizing: border-box;
}

.auth-field input:focus {
  border-color: #00d4ff;
  outline: none;
}

.auth-submit {
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
}

.auth-switch {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
}

.auth-switch a {
  color: #00d4ff;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-instructions {
  font-size: 13px;
  color: #aaa;
  margin: 8px 0 12px;
}

.auth-qr {
  margin: 16px 0;
}

.auth-qr img {
  border-radius: 8px;
}

.auth-secret-label {
  font-size: 12px;
  color: #888;
  margin: 8px 0 4px;
}

.auth-secret {
  display: block;
  background: #1a1a2e;
  padding: 8px 12px;
  border-radius: 6px;
  color: #00d4ff;
  font-size: 13px;
  word-break: break-all;
  margin-bottom: 12px;
}

.auth-error {
  color: #ff4444;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

.btn-header-user {
  background: transparent;
  border: 1px solid #00d4ff;
  color: #00d4ff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-header-user:hover {
  background: rgba(0, 212, 255, 0.15);
}

/* ============================================================
   Favorite Styles
   ============================================================ */

.fav-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.2s, transform 0.15s;
}

.fav-btn:hover {
  color: #ff4466;
  transform: scale(1.2);
}

.fav-btn.favorited {
  color: #ff4466;
}

.fav-btn-large {
  font-size: 24px;
  padding: 4px 8px;
  margin-left: auto;
}

.playlist-add-btn {
  background: none;
  border: 1px solid #9c27b020;
  color: #777;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.4;
  transition: all 0.2s;
}

.playlist-add-btn:hover {
  border-color: #9c27b0;
  color: #ce93d8;
  background: #9c27b015;
}

.favorites-section .queue-item {
  opacity: 0.85;
}

.fav-item .queue-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.fav-item .queue-item-info {
  flex: 1;
  min-width: 0;
}

.fav-item .queue-item-title {
  font-size: 13px;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item .queue-item-meta {
  font-size: 11px;
  color: #666;
}

.fav-queue-btn {
  font-size: 11px !important;
  padding: 3px 8px !important;
}

/* ============================================================
   Playlist Styles
   ============================================================ */

.btn-playlists {
  background: linear-gradient(135deg, #9c27b0, #7b1fa2);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.btn-playlists:hover {
  background: linear-gradient(135deg, #ab47bc, #8e24aa);
}

.playlists-modal {
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}

.playlist-create-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.playlist-create-row input {
  flex: 1;
  padding: 8px 12px;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
}

.playlist-create-row input:focus {
  border-color: #9c27b0;
  outline: none;
}

.playlists-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playlist-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.playlist-card:hover {
  border-color: #9c27b0;
  background: #1f1a30;
  transform: translateX(2px);
}

.playlist-card-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #9c27b020, #7b1fa220);
  border-radius: 8px;
  color: #ce93d8;
}

.playlist-card-info {
  flex: 1;
  min-width: 0;
}

.playlist-card-name {
  color: #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-card-meta {
  color: #666;
  font-size: 12px;
  margin-top: 2px;
}

.playlist-card-arrow {
  color: #555;
  font-size: 16px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.playlist-card:hover .playlist-card-arrow {
  color: #ce93d8;
}

.btn-back {
  background: none;
  border: none;
  color: #ce93d8;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-bottom: 12px;
  transition: color 0.2s;
}

.btn-back:hover {
  color: #e1bee7;
  text-decoration: underline;
}

.playlist-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.playlist-detail-header h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-song-count-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #9c27b020;
  color: #ce93d8;
  border: 1px solid #9c27b030;
  white-space: nowrap;
  flex-shrink: 0;
}

.playlist-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-danger {
  background: transparent;
  border: 1px solid #ff4444;
  color: #ff4444;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(255, 68, 68, 0.15);
}

.btn-small {
  font-size: 12px;
  padding: 4px 10px;
}

/* Picker Popup */
.picker-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.picker-content {
  background: #16213e;
  border: 1px solid #2a2a3e;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 320px;
  text-align: center;
}

.picker-content h3 {
  margin: 0 0 12px;
  color: #e0e0e0;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.2s;
}

.picker-item:hover {
  border-color: #9c27b0;
  background: #1f1a30;
}

.picker-item .picker-icon {
  font-size: 16px;
  color: #ce93d8;
  flex-shrink: 0;
}

.picker-item .picker-check {
  margin-left: auto;
  color: #00ff88;
  font-size: 14px;
  flex-shrink: 0;
}

.now-playing-row {
  position: relative;
}
