:root {
  /* DJ BWISE light brand defaults; overridden per-DJ by partials/theme.ejs */
  --bg: #f7f5ef;
  --surface: #ffffff;
  --text: #16335f;
  --muted: #5a7088;
  --accent: #1f6fe0;
  --accent2: #0f9bd4;
  --border: rgba(20,40,80,.12);
  --field: rgba(20,40,80,.04);
  --shadow: rgba(20,40,80,.14);
  --on-accent: #ffffff;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Touch ergonomics: kill the grey tap flash, snappier taps on controls */
a, button, .btn, .upvote, .search-results li { -webkit-tap-highlight-color: transparent; }
button, .btn, .upvote { touch-action: manipulation; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .4em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.error { color: #d64541; }

.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 28px var(--shadow);
  border: 1px solid var(--border);
}

/* Buttons & inputs */
.btn {
  display: inline-block; border: none; border-radius: 12px; cursor: pointer;
  padding: 12px 18px; font-size: 16px; font-weight: 700; color: var(--text);
  background: var(--field); transition: transform .08s ease, filter .15s ease;
  width: 100%;
}
.btn:active { transform: scale(.97); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border: 1px solid var(--border); width: auto; }
.btn-on { background: #1db954; color: #fff; }
.btn-off { background: #d64541; color: #fff; }
input, select {
  width: 100%; padding: 12px 14px; margin: 6px 0; border-radius: 12px;
  border: 1px solid var(--border); background: var(--field);
  color: var(--text); font-size: 16px;
}
input::placeholder { color: var(--muted); }
/* Compact inline number field (e.g. VIP promote slots/minutes). Tighter padding
   + wider box so the digits aren't clipped by border-box + spinner arrows. */
input.num-mini { width: 70px; padding: 10px 8px; margin: 0; }
label { display: block; font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ---------- Guest ---------- */
.guest {
  max-width: 560px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
}
/* Bigger touch targets on phones */
.upvote { min-width: 52px; min-height: 52px; justify-content: center; }
.q-delete { padding: 8px; min-width: 40px; }
.guest-header { text-align: center; margin-bottom: 16px; }
.dj-logo { max-height: 140px; margin-bottom: 4px; }
.guest-header h1 { font-size: 28px; }
.venue { color: var(--muted); margin: 0; }
.dj-name { color: var(--accent); font-weight: 700; margin: 4px 0 0; font-size: 22px; }

.now-playing {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--on-accent); font-weight: 800; padding: 12px; border-radius: 12px; margin-bottom: 16px;
  animation: pulse 2.5s ease-in-out infinite;
}
.np-label { text-transform: uppercase; font-size: 12px; letter-spacing: .08em; opacity: .85; }
@keyframes pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.12); } }

.countdown { text-align: center; color: var(--accent); font-weight: 700; margin-bottom: 16px; }

.slots { text-align: center; margin-bottom: 8px; }
.disclaimer { text-align: center; font-size: 13px; color: var(--muted); font-style: italic; margin: 0 0 14px; }
.search-wrap { position: relative; }
.search-results {
  list-style: none; margin: 0; padding: 0; position: absolute; z-index: 20; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; max-height: 320px; overflow-y: auto; box-shadow: 0 12px 28px var(--shadow);
}
.search-results li { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; }
.search-results li:hover { background: var(--field); }
.search-results img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.search-results .sr-meta small { color: var(--muted); display: block; }
.form-msg { text-align: center; min-height: 20px; margin: 8px 0 0; font-weight: 700; }
.form-msg.ok { color: #1db954; } .form-msg.bad { color: #d64541; }
.closed { text-align: center; font-size: 18px; }

.queue-section { margin-top: 24px; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.queue-head h2 { margin: 0; }
/* Compact tip button for inline placement next to the queue heading. */
.tip-jar-btn--inline { font-size: 1rem; padding: 8px 16px; gap: 8px; }
.tip-jar-btn--inline .tip-jar-icon { font-size: 18px; }

/* Guest "did you mean?" match nudge (shown when they type without picking). */
.match-panel { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--field); }
.match-title { margin: 0 0 8px; font-weight: 800; font-size: 14px; }
.match-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.match-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; color: var(--text); }
.match-opt:hover { border-color: var(--accent); }
.match-opt img, .match-art { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--field); flex: none; }
.match-meta { display: flex; flex-direction: column; min-width: 0; }
.match-meta strong { font-size: 14px; }
.match-meta small { color: var(--muted); font-size: 12px; }
.match-anyway { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }

/* Admin "find on Spotify" match modal. */
.sp-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.sp-modal { background: var(--surface); color: var(--text); border-radius: 14px; border: 1px solid var(--border); width: 420px; max-width: 100%; max-height: 80vh; overflow: auto; }
.sp-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 800; }
.sp-modal-x { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.sp-modal-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sp-modal-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: var(--field); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; color: var(--text); }
.sp-modal-opt:hover { border-color: var(--accent); }
.sp-modal-opt img, .sp-art { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface); flex: none; }
.sp-meta { display: flex; flex-direction: column; min-width: 0; }
.sp-meta small { color: var(--muted); font-size: 12px; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--border); box-shadow: 0 4px 14px var(--shadow);
  animation: slideIn .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.q-art { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--field); flex: none; }
.q-main { flex: 1; min-width: 0; }
.q-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-artist { color: var(--muted); font-size: 14px; }
.q-badge { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge-queued { background: rgba(241,196,15,.18); color: #b8860b; }
.badge-upnext { background: rgba(15,155,212,.16); color: var(--accent2); }
.badge-played { background: rgba(29,185,84,.16); color: #128a3e; }
.badge-deferred { background: rgba(120,90,200,.16); color: #6f57c8; }
.q-count { font-size: 12px; color: var(--muted); }
.upvote {
  display: flex; flex-direction: column; align-items: center; cursor: pointer; user-select: none;
  background: var(--field); border-radius: 10px; padding: 6px 10px; border: 1px solid transparent;
  color: var(--text); font-weight: 800; min-width: 46px;
}
.upvote.on { border-color: var(--accent); color: var(--accent); }
.upvote small { font-weight: 600; font-size: 11px; color: var(--muted); }
.q-delete { background: none; border: none; color: #d64541; cursor: pointer; font-size: 18px; }
.empty { text-align: center; padding: 20px; }

.tip-jar { text-align: center; margin-top: 12px; }
.tip-jar-btn {
  display: inline-flex; align-items: center; gap: 16px; text-decoration: none;
  background: var(--field); color: var(--text); font-weight: 800; font-size: 2rem;
  padding: 20px 36px; border-radius: 999px; border: 1px solid var(--border);
  transition: transform .08s ease, filter .15s ease;
}
.tip-jar-btn:hover { filter: brightness(1.04); }
.tip-jar-btn:active { transform: scale(.97); }
.tip-jar-icon { font-size: 40px; }

/* ---------- Owl mascot ---------- */
.wr-owl {
  position: fixed; top: max(8px, env(safe-area-inset-top)); left: 10px; z-index: 40;
  width: 52px; height: 52px; pointer-events: none;
  filter: drop-shadow(0 3px 6px var(--shadow));
}
.wr-owl svg { width: 100%; height: 100%; display: block; }
@media (max-width: 560px) { .wr-owl { width: 44px; height: 44px; } }

/* ---------- Tip page ---------- */
.tip-page .card { margin-top: 8px; }
.tip-amount-row { display: flex; align-items: center; gap: 6px; }
.tip-currency { font-size: 28px; font-weight: 800; color: var(--muted); }
.tip-amount-row input { font-size: 28px; font-weight: 800; text-align: center; padding: 10px; }
.tip-chips { display: flex; gap: 8px; margin: 12px 0 4px; }
.tip-chip {
  flex: 1; border: 1px solid var(--border); background: var(--field); color: var(--text);
  font-weight: 800; padding: 10px 0; border-radius: 12px; cursor: pointer;
}
.tip-chip:active { transform: scale(.97); }
.tip-methods { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.tip-btn { text-decoration: none; text-align: center; color: #fff; }
.tip-venmo { background: #3d95ce; }
.tip-cashapp { background: #00d632; }
.tip-paypal { background: #003087; }
.tip-back { text-align: center; margin-top: 18px; }

.message-card, .login-card { max-width: 360px; text-align: center; }
.login-card h1 { margin-bottom: 0; }

/* ---------- Admin ---------- */
.admin { padding: 0; }
.admin-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px 14px 72px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.admin-bar .muted { margin-left: 8px; font-size: 14px; }
.admin-bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; padding: 20px; align-items: start; }
.controls .card { margin-bottom: 16px; }
.controls h3 { font-size: 15px; }
/* Per-card help: a blue "i" pinned to the card's top-right corner; tooltip on
   hover (desktop) or tap (mobile). */
.help-wrap { position: relative; display: inline-block; }
.card .help-wrap { position: absolute; top: 16px; right: 16px; }
.help {
  width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: none; background: var(--accent); color: var(--on-accent);
  font-size: 12px; font-weight: 800; font-style: italic; font-family: Georgia, 'Times New Roman', serif;
  line-height: 18px; text-align: center; cursor: pointer;
}
.help:hover, .help-wrap.open .help { filter: brightness(1.12); }
.help-tip {
  position: absolute; right: 0; left: auto; top: calc(100% + 6px); z-index: 30;
  width: max-content; max-width: 230px;
  background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 500; font-style: normal; line-height: 1.35; text-align: left;
  padding: 8px 10px; border-radius: 8px; box-shadow: 0 6px 18px var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-2px); transition: opacity .12s, transform .12s; pointer-events: none;
}
.help-wrap:hover .help-tip, .help-wrap.open .help-tip { opacity: 1; visibility: visible; transform: translateY(0); }
.copy-field { font-size: 13px; cursor: pointer; }
.qr { width: 100%; max-width: 240px; margin-top: 10px; background: #fff; border-radius: 8px; }
.mini-list { list-style: none; margin: 10px 0 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 4px 0; }
.x { background: none; border: none; color: #d64541; cursor: pointer; font-size: 14px; }
.danger h3 { color: #d64541; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: 4px 0 10px; cursor: pointer; }
.switch-row input { width: auto; margin: 0; flex: none; }

.admin-queue { list-style: none; margin: 0; padding: 0; }
.admin-queue li {
  background: var(--surface); border-radius: 12px; padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--border); box-shadow: 0 4px 14px var(--shadow);
}
.aq-row { display: flex; align-items: center; gap: 12px; }
.aq-handle { cursor: grab; color: var(--muted); font-size: 20px; }
.aq-main { flex: 1; min-width: 0; }
.aq-title { font-weight: 700; }
.aq-artist { color: var(--muted); font-size: 14px; }
.aq-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.aq-actions .btn { width: auto; padding: 7px 12px; font-size: 13px; }
.requesters { margin-top: 8px; font-size: 13px; color: var(--muted); }
.requesters summary { cursor: pointer; }
.admin-queue li.dragging { opacity: .5; }
/* De-emphasize played songs, but NOT their reaction row/actions — a parent
   opacity can't be undone by children, so dim the song-info children only. */
.admin-queue li.status-played .aq-handle,
.admin-queue li.status-played .q-art,
.admin-queue li.status-played .aq-title,
.admin-queue li.status-played .aq-artist,
.admin-queue li.status-played .requesters,
.admin-queue li.status-played .aq-vote { opacity: .55; }

/* Crowd reaction on played songs */
.aq-rate { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.aq-rate-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.aq-rate .rx {
  cursor: pointer; border: 1px solid var(--border); background: var(--field);
  border-radius: 9px; padding: 3px 9px; font-size: 16px; line-height: 1.2;
  filter: grayscale(1) opacity(.65); transition: filter .12s, border-color .12s, background .12s;
}
.aq-rate .rx:hover { filter: grayscale(0) opacity(1); }
.aq-rate .rx.on { filter: none; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
}

/* --- Branding & theme card --- */
.logo-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.logo-preview { max-height: 56px; max-width: 160px; border-radius: 8px; background: var(--field); padding: 4px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 2px; }
.theme-swatch {
  position: relative; width: 72px; height: 48px; border-radius: 10px; border: 2px solid var(--border);
  cursor: pointer; overflow: hidden; padding: 0; display: flex; align-items: flex-end; gap: 0;
}
.theme-swatch span { position: absolute; top: 6px; width: 14px; height: 14px; border-radius: 50%; }
.theme-swatch span:nth-of-type(1) { left: 6px; }
.theme-swatch span:nth-of-type(2) { left: 24px; }
.theme-swatch small { width: 100%; text-align: center; font-size: 10px; font-weight: 700; padding: 2px; background: rgba(0,0,0,.04); }
.theme-swatch:hover { border-color: var(--accent); }
.theme-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 4px 0; }
.color-field { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.color-field input[type=color] { width: 38px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }

.btn-mini {
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 8px;
  font-size: 12px; font-weight: 800; padding: 4px 8px; cursor: pointer; white-space: nowrap;
}
.btn-mini:disabled { background: var(--field); color: var(--muted); cursor: default; }
.vip-promote #requester-list li span { font-size: 13px; }
