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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a2e;
  --surface-2: #16213e;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --text: #eee;
  --text-muted: #888;
  --border: #333;
  --green: #2ecc71;
  --radius: 10px;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
}

input, select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

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

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

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

.btn-icon {
  background: transparent;
  color: var(--text);
  padding: 8px;
  font-size: 18px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--surface-2); }

/* --- Home page --- */
.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  text-align: center;
}

.home-container h1 {
  font-size: 3rem;
  margin-bottom: 8px;
}

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

.home-container p.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 40px;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 360px;
}

.home-actions .btn-primary {
  padding: 14px;
  font-size: 17px;
}

.join-group {
  display: flex;
  gap: 8px;
}

.join-group input {
  flex: 1;
  text-align: center;
  font-size: 17px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.create-group {
  display: flex;
  gap: 8px;
}

.create-group input {
  flex: 1;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Layout --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header h2 {
  font-size: 1.1rem;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions .btn-secondary {
  text-decoration: none;
  font-size: 13px;
}

.jam-code {
  font-family: monospace;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 14px;
  letter-spacing: 1px;
}

/* --- Queue list --- */
.page-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search-box input { flex: 1; }

.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  transition: background 0.2s;
}

.queue-item.playing {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}

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

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

.queue-item-info .title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-info .added-by {
  font-size: 12px;
  color: var(--text-muted);
}

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

.queue-item-index {
  width: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.queue-item.playing .queue-item-index {
  color: var(--accent);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* --- Search results --- */
.search-results {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: var(--surface-2);
}

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

.search-result-item .title {
  flex: 1;
  font-size: 14px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Player page --- */
.player-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #000;
}

.player-page:fullscreen {
  height: 100%;
}

.player-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#yt-player {
  width: 100%;
  height: 100%;
}

.player-bar {
  background: var(--surface);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--border);
}

.player-bar-qr {
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

.player-bar .now-playing {
  flex-shrink: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30%;
}

.player-bar .now-playing span {
  color: var(--text-muted);
  font-size: 12px;
}

.next-up {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.next-up strong {
  color: var(--text);
  font-weight: 500;
}

.btn-fullscreen {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-fullscreen:hover {
  background: var(--border);
}

/* --- Admin controls --- */
.admin-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.admin-controls .btn-icon {
  width: 48px;
  height: 48px;
  font-size: 22px;
}

.admin-controls .btn-play {
  background: var(--accent);
  width: 56px;
  height: 56px;
  font-size: 24px;
}

.admin-controls .btn-play:hover {
  background: var(--accent-hover);
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 20px;
}

.section-title:first-child { margin-top: 0; }

/* --- Name modal --- */
.modal-overlay {
  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: 100;
}

.modal {
  background: var(--surface);
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 360px;
  text-align: center;
}

.modal h3 { margin-bottom: 16px; }

.modal input {
  width: 100%;
  margin-bottom: 12px;
}

.modal .btn-primary {
  width: 100%;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green);
  color: #000;
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.3s ease;
  z-index: 200;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* --- Responsive --- */
@media (max-width: 500px) {
  .home-container h1 { font-size: 2.2rem; }
  .page-content { padding: 14px; }
  .queue-item img { width: 64px; height: 36px; }
}

/* --- Link sharing bar --- */
.share-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.share-bar code {
  background: var(--surface);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: monospace;
  user-select: all;
}

.share-bar .btn-secondary {
  padding: 6px 12px;
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.url-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.url-input-group input { flex: 1; }
