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

:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface-hover: #1f1f23;
  --border: #2d2d33;
  --text: #efeff1;
  --text-dim: #adadb8;
  --accent: #f45d22;
  --accent-hover: #ff7a3d;
  --cool: #5ea8ff;
  --danger: #eb4034;
  --success: #00c853;
  --cool-soft: rgba(94, 168, 255, 0.18);
  --warm-soft: rgba(244, 93, 34, 0.18);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.header {
  width: 100%;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header h1 span {
  color: var(--accent);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
  background: var(--danger);
}

.status-dot.connected {
  background: var(--success);
}

.status-bar {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Main container */
.container {
  width: 100%;
  max-width: 600px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Join screen */
.join-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 1rem;
}

.join-screen h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.join-screen p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Inputs & buttons */
input[type="text"],
input[type="url"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

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

button {
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

button:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

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

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* Now playing card */
.now-playing {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.now-playing .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.track-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.track-artwork {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--border);
}

.track-details h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.track-details .dj-name {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* Autoplay prompt */
.autoplay-prompt {
  text-align: center;
  padding: 1.5rem 0;
}

.no-track {
  color: var(--text-dim);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem 0;
}

/* Volume control */
.listener-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.listener-control-card {
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.control-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.control-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}

.control-copy {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-dim);
}

.control-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.1rem;
}

.volume-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  cursor: pointer;
}

.volume-control input[type="range"] {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* Seek bar */
.seek-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.seek-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
}

.seek-control input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.seek-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

.seek-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  border: none;
  cursor: pointer;
}

/* AirPlay button */
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-icon.active {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* DJ controls */
.dj-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dj-controls .url-row {
  display: flex;
  gap: 0.5rem;
}

.dj-controls .url-row input {
  flex: 1;
}

.dj-controls .playback-row {
  display: flex;
  gap: 0.5rem;
}

/* Vibez control (DJ) */
.vibez-control {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(244, 93, 34, 0.08), rgba(244, 93, 34, 0.03));
  border-radius: 8px;
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px rgba(244, 93, 34, 0.15);
}

.vibez-title {
  color: var(--accent);
}

.vibez-value {
  min-width: 6.5rem;
  text-align: right;
}

.vibez-value[data-tone="lower"] {
  color: var(--cool);
}

.vibez-value[data-tone="lift"] {
  color: var(--accent);
}

.vibez-value[data-tone="neutral"] {
  color: var(--text);
}

.vibez-control input[type="range"] {
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.vibez-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.vibez-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.vibez-scale {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.vibez-range-control {
  background: linear-gradient(180deg, rgba(94, 168, 255, 0.08), rgba(244, 93, 34, 0.04));
}

.vibez-range-control input[type="range"] {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.vibez-range-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.vibez-range-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.vibez-window {
  margin-top: 0.85rem;
}

.vibez-window-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
}

.vibez-window-band {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cool-soft), rgba(239, 239, 241, 0.2), var(--warm-soft));
}

.vibez-window-base,
.vibez-window-live {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px rgba(14, 14, 16, 0.35);
}

.vibez-window-base {
  background: var(--text);
  z-index: 2;
}

.vibez-window-live {
  background: var(--text);
  z-index: 3;
}

.vibez-window-live[data-tone="lower"] {
  background: var(--cool);
}

.vibez-window-live[data-tone="lift"] {
  background: var(--accent);
}

.vibez-window-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

#vibezLive {
  flex: 1;
  text-align: center;
}

#vibezLive[data-tone="lower"] {
  color: var(--cool);
}

#vibezLive[data-tone="lift"] {
  color: var(--accent);
}

#vibezLive[data-tone="neutral"] {
  color: var(--text);
}

/* Queue */
.queue-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.queue-header .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.queue-dj-controls {
  display: flex;
  gap: 0.4rem;
}

.btn-small {
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

.queue-add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.queue-add-row input {
  flex: 1;
}

.queue-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.queue-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 0;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.queue-item-pos {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  min-width: 1.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

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

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

.queue-item-added {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}

.queue-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.queue-item-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  line-height: 1;
}

.queue-item-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.queue-item-btn.remove-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Listeners */
.listeners {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
}

.listeners .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.listener-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.listener-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: var(--surface-hover);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.listener-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.listener-chip.dj-chip {
  background: var(--accent);
  color: #fff;
}

.listener-chip .dot.dj {
  background: #fff;
}

.dj-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  .control-head {
    flex-direction: column;
    gap: 0.5rem;
  }

  .control-value {
    align-self: flex-start;
  }

  .dj-controls .url-row {
    flex-direction: column;
  }
}

.auth-area { display: flex; align-items: center; gap: 0.5rem; }
.user-chip { display: flex; align-items: center; gap: 0.5rem; color: var(--text-dim); font-size: 0.85rem; }
.user-avatar { width: 24px; height: 24px; border-radius: 50%; }
.notice { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-radius: 8px; font-size: 0.85rem; }
.notice-error { background: var(--warm-soft); color: var(--danger); }
.hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.25rem; }
button:disabled, input:disabled { opacity: 0.5; cursor: not-allowed; }

.directory-head, .channel-head { display: flex; align-items: center; gap: 0.75rem; justify-content: space-between; flex-wrap: wrap; }
.channel-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.back-link { color: var(--text-dim); text-decoration: none; }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.channel-card { position: relative; display: flex; flex-direction: column; gap: 0.35rem; padding: 0.75rem; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); cursor: pointer; }
.channel-card:hover { background: var(--surface-hover); }
.channel-art { aspect-ratio: 1; border-radius: 8px; background: var(--border) center / cover no-repeat; }
.channel-track { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-owner { display: flex; align-items: center; gap: 0.4rem; }
.channel-owner-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.admin-end { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 0.75rem; color: var(--danger); background: var(--surface); padding: 0 0.4rem; border-radius: 6px; }
.go-live { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.queue-access { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-dim); }
.trust-panel ul { list-style: none; padding: 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.35rem; }
.notice:not(.notice-error) { background: var(--cool-soft); color: var(--text); }

.legal { text-align: left; line-height: 1.6; }
.legal h2 { margin-top: 1rem; font-size: 1.1rem; }
.legal a, .site-footer a { color: var(--accent); }
.legal pre { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; overflow-x: auto; }
.site-footer { margin: 2rem 0 1rem; font-size: 0.8rem; color: var(--text-dim); text-align: center; }

/* YouTube player (replaces the artwork while a video plays; must stay visible per YouTube's terms) */
.yt-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  margin-bottom: 1rem;
}

.yt-player iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}
