:root {
  --bg: #0b0d12;
  --bg-elev: #151823;
  --bg-elev-2: #1d2130;
  --text: #f4f6fb;
  --text-dim: #9aa3b8;
  --accent: #1db954;
  --accent-hover: #1ed760;
  --danger: #ff5470;
  --border: rgba(255, 255, 255, 0.07);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at top, #1a1f33 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.container.narrow {
  max-width: 420px;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}
.hero h1 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 4px 0 0;
  color: var(--text-dim);
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.admin-hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

button[disabled],
button.is-busy {
  opacity: 0.65;
  cursor: progress;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.toast.show {
  opacity: 1;
}
.toast.error {
  border-color: var(--danger);
  color: #ffd6dc;
}

.queue li.is-busy {
  opacity: 0.5;
  pointer-events: none;
}

input[type="text"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(29, 185, 84, 0.15);
}

button,
a.primary {
  cursor: pointer;
  border: 0;
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--bg-elev-2);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.05s ease;
}

button.primary,
a.primary {
  background: var(--accent);
  color: #06210f;
}
button.primary:hover,
a.primary:hover {
  background: var(--accent-hover);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
}
button.ghost:hover {
  background: var(--bg-elev);
}

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

button:active {
  transform: translateY(1px);
}

.banner {
  background: rgba(255, 184, 0, 0.1);
  border: 1px solid rgba(255, 184, 0, 0.3);
  color: #ffd166;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  text-align: center;
  font-size: 0.92rem;
}

.error {
  background: rgba(255, 84, 112, 0.12);
  border: 1px solid rgba(255, 84, 112, 0.4);
  color: #ff97a8;
  padding: 10px 12px;
  border-radius: 10px;
}

/* Search results */
.search-section {
  margin-bottom: 28px;
}
.results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.results li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  transition: background 0.12s ease;
}
.results li:hover {
  background: var(--bg-elev);
}
.results img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-elev-2);
}
.results .meta {
  flex: 1;
  min-width: 0;
}
.results .title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results .artist {
  color: var(--text-dim);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Queue */
.queue-section h2,
.card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.queue li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.queue img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
}
.queue .meta {
  flex: 1;
  min-width: 0;
}
.queue .title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue .artist {
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue .mine-tag {
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid currentColor;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.queue .pushed-tag {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  user-select: none;
  cursor: default;
}
.admin-queue li {
  cursor: grab;
}
.admin-queue li.dragging {
  opacity: 0.6;
}
.empty {
  color: var(--text-dim);
  text-align: center;
  margin: 12px 0 0;
}

/* Now playing card */
.now-playing-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, rgba(29, 185, 84, 0.12), rgba(29, 185, 84, 0.03));
  border: 1px solid rgba(29, 185, 84, 0.25);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}
.now-playing-card img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-elev-2);
}
.np-meta {
  flex: 1;
  min-width: 0;
}
.np-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.np-title {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-artist {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.progress {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.4s linear;
}

/* Admin */
.admin .card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* QR card on guest page */
.qr-card {
  display: flex;
  justify-content: center;
  margin: 18px 0 26px;
}
.qr-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 12px;
}
.qr-img {
  width: 120px;
  height: 120px;
  background: white;
  border-radius: 8px;
  display: block;
}
.qr-text {
  display: flex;
  flex-direction: column;
}
.qr-label {
  font-weight: 700;
  color: var(--text);
}
.qr-url {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.9rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.row:last-child {
  margin-bottom: 0;
}
.row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.row label.grow {
  flex: 2 1 240px;
}
.qr-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.qr-wrap img {
  width: 180px;
  height: 180px;
  background: white;
  padding: 10px;
  border-radius: 12px;
}
.qr-wrap code {
  font-size: 0.95rem;
  color: var(--text-dim);
  word-break: break-all;
}

.np-row {
  color: var(--text-dim);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
