:root {
  --bg: #0b0b12;
  --surface: #15151f;
  --surface-2: #1d1d2a;
  --line: #2a2a3a;
  --text: #f2f2f7;
  --muted: #9a9ab0;
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-ink: #0b0b12;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 50% -200px, #23173f 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[hidden] {
  display: none !important;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0;
}

.hero {
  text-align: center;
  margin: 12px 0 24px;
}

.hero .logo {
  font-size: 44px;
}

.hero h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
}

.sub,
.hint,
.muted {
  color: var(--muted);
}

.hint {
  min-height: 1.45em;
  margin: 8px 2px;
  font-size: 14px;
}

.hint.error {
  color: var(--bad);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.notice {
  text-align: center;
}

/* --- form controls --- */

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button.good {
  background: color-mix(in srgb, var(--good) 18%, var(--surface-2));
  border-color: color-mix(in srgb, var(--good) 45%, transparent);
  color: var(--good);
}

button.danger {
  background: transparent;
  color: var(--bad);
}

button.big {
  width: 100%;
  padding: 16px;
  font-size: 18px;
}

/* --- track rows (shared) --- */

.art {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b2a6b, #1d1d2a);
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.track-text {
  min-width: 0;
  flex: 1;
}

.track-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- guest --- */

.results {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 8px;
  background: var(--surface);
  border-radius: 12px;
  font-weight: 400;
}

.result:active {
  background: var(--surface-2);
}

.explicit {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--muted);
  color: var(--bg);
  margin-right: 4px;
  vertical-align: 1px;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.65);
}

.confirm-track {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 14px 0 18px;
}

.confirm-track .art {
  width: 72px;
  height: 72px;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions > * {
  flex: 1;
}

.done {
  text-align: center;
}

.done .big-emoji {
  font-size: 48px;
}

.done h2 {
  margin: 8px 0;
}

.countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}

/* --- DJ dashboard --- */

.dj .wrap {
  max-width: 760px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.topbar h1 {
  font-size: 24px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.pill.on .dot {
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.pill.off .dot {
  background: var(--bad);
}

.pill.warn {
  color: var(--warn);
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.statusbar .spacer {
  flex: 1;
}

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}

.banner.error {
  background: color-mix(in srgb, var(--bad) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 24px 2px 10px;
}

.section-title h2 {
  font-size: 18px;
}

.queue {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.req {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.req.is-new {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.req.flash {
  animation: flash 1.2s ease-out 2;
}

@keyframes flash {
  0% {
    background: color-mix(in srgb, var(--accent) 35%, var(--surface));
  }
  100% {
    background: var(--surface);
  }
}

.req .pos {
  flex: none;
  width: 22px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.who {
  font-size: 14px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.who strong {
  color: var(--accent);
}

.who .time {
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  margin-right: 6px;
  vertical-align: 1px;
}

.badge.count {
  background: var(--warn);
}

.req-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.req-actions button {
  padding: 10px 12px;
}

.empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.recent .req {
  opacity: 0.7;
}

.recent .status {
  font-size: 12px;
  color: var(--muted);
}

details.fold {
  margin-top: 28px;
}

details.fold summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 2px;
}

.qr-box {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
}

.qr {
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  line-height: 0;
}

.qr svg {
  width: 100%;
  height: auto;
}

.link {
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0 10px;
}

.stack {
  display: grid;
  gap: 8px;
}

.fold .card + .card {
  margin-top: 12px;
}

.login {
  max-width: 360px;
  margin: 12vh auto 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 12px;
  max-width: calc(100vw - 32px);
  z-index: 10;
}

.toast.error {
  border-color: var(--bad);
  color: var(--bad);
}

@media (max-width: 560px) {
  .qr-box {
    grid-template-columns: 1fr;
  }

  .qr {
    max-width: 240px;
  }

  .req .pos {
    display: none;
  }

  .req-actions button {
    padding: 10px;
  }
}

.pill.stepper {
  padding: 0 2px;
  gap: 2px;
}

.pill.stepper button {
  background: transparent;
  border: 0;
  padding: 4px 10px;
  font-size: 16px;
  line-height: 1;
  color: var(--accent);
}

.pill.stepper button:disabled {
  color: var(--muted);
}
