
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding-inline: 18px;
  padding-block: 20px 120px;
}
.wrap.wide { max-width: 1100px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-track);
  margin: 0;
}
h1 {
  font-family: var(--hero);
  font-weight: var(--hero-weight);
  font-size: calc(clamp(30px, 7vw, 42px) * var(--hero-scale));
  line-height: var(--hero-leading);
  letter-spacing: var(--hero-track);
  text-wrap: balance;
}
h2 { font-size: calc(24px * var(--display-scale)); }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 6px;
}
.sub { color: var(--muted); margin: 6px 0 0; }

header.masthead {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

/* ── Controls ─────────────────────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="search"], input[type="number"], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  outline: none;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input::placeholder, textarea::placeholder { color: #667081; }

.search-wrap { position: relative; }
.search-wrap input { padding-right: 46px; font-size: 17px; }
.search-spin {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .search-spin { animation: none; } }

button {
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  padding: 14px 20px;
  cursor: pointer;
  min-height: 48px;
}
button:disabled { opacity: 0.45; cursor: default; }
/* Every press shows: the button sinks while held, and a button that is
   saving says so (.working) instead of just fading. */
button, a.button { transition: transform 80ms ease, filter 120ms ease, background-color 120ms ease; }
button:not(:disabled):active, a.button:active { transform: scale(0.96); filter: brightness(1.25); }
button:focus-visible, a.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.working, button.working:disabled { opacity: 1; cursor: progress; }
button.working::after {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-left: 8px; vertical-align: -0.1em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
button.quiet { background: var(--surface-2); color: var(--text); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
button.small { padding: 8px 12px; min-height: 38px; font-size: 14px; border-radius: 10px; }
/* A link that looks like a button: Connect this Mac is a djrequest:// link. */
a.button {
  display: inline-flex; align-items: center; text-decoration: none;
  font-weight: 600; color: var(--bg); background: var(--accent);
  border-radius: var(--radius); padding: 14px 20px; min-height: 48px;
}
a.button.small { padding: 8px 12px; min-height: 38px; font-size: 14px; border-radius: 10px; }
a.button.quiet { background: var(--surface-2); color: var(--text); }
.plan-lock { align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.plan-lock .eyebrow { margin: 0; }
.plan-lock .sub { margin: 2px 0 0; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 6px; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }

/* ── Lists ────────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-weight: 400;
  min-height: 0;
}
button.item { cursor: pointer; }
button.item:hover { background: var(--surface-2); }

.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 14px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.count {
  flex: 0 0 auto;
  display: grid; place-items: center;
  min-width: 42px; height: 42px; padding: 0 8px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.count.hot { background: var(--accent); color: var(--bg); }

.pill {
  flex: 0 0 auto;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700;
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.pill.queued  { color: var(--good); border-color: #235247; }
.pill.playing { color: var(--bg); background: var(--good); border-color: var(--good); }
.pill.played  { color: var(--muted); }
.pill.declined{ color: var(--bad); border-color: #4A2A28; }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
}

.note-line { color: var(--muted); font-size: 14px; font-style: italic; }
.played-flag { color: var(--accent); font-size: 13px; }
.where-line { font-size: 13px; color: var(--accent); }
.where-line.ok { color: var(--good); }

/* ── Sheet ────────────────────────────────────────────────────────────── */
.sheet-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 680px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); }
}

/* ── Status strip ─────────────────────────────────────────────────────── */
.strip {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  font-size: 14px;
}
.strip.warn { background: #3A2E14; border-top-color: var(--accent-soft); color: var(--accent); }

.party-state {
  margin: 4px 0 2px; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.party-state::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: 0 0 auto;
}
.party-state.live::before { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); }
.party-state.live.closed::before, .party-state.paused::before { background: var(--accent); }
.party-state.ended { color: var(--muted); }
button.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.toast[hidden] { display: none; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  background: var(--text); color: var(--bg);
  font-weight: 600; padding: 12px 18px; border-radius: 999px; z-index: 60;
  max-width: calc(100% - 36px); text-align: center;
}

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 18px 0 4px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 10px 12px; border-radius: 0; font-weight: 600; min-height: 0;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; }

.qr { background: #fff; padding: 14px; border-radius: var(--radius); display: inline-block; }
.joincode {
  font-family: var(--display);
  font-size: calc(40px * var(--display-scale)); letter-spacing: 0.18em; color: var(--accent);
}
.err { color: var(--bad); }
.ok  { color: var(--good); }

/* Catalog results carry artwork; the crate's own tracks often do not. */
.item .art {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.pill.need { color: var(--accent); border-color: var(--accent-soft); }
.vip-line { color: var(--accent); font-weight: 600; }

.cmd {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0 0;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* ── Couple plan (console) ────────────────────────────────────────────── */
/* .stack/.row/.sheet-back set display, which beats the hidden attribute. */
#tab-plan [hidden], #qrSheet[hidden], #qrSheet [hidden], #vipCoupleHint[hidden] { display: none !important; }

/* Six tabs do not fit a phone: the bar scrolls instead of squashing. */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; }

.item.vip-item { flex-wrap: wrap; }
.vip-item .grow { flex: 1 1 220px; }
.vip-actions { flex: 0 1 auto; }

.qr.qr-big { align-self: center; line-height: 0; }
.qr.qr-big img, .qr.qr-big canvas { display: block; max-width: 100%; height: auto; }
#qrSheet .sheet { max-height: 100dvh; overflow-y: auto; }

.plan-kind-note { color: var(--accent); }

.item.plan-moment { flex-direction: column; align-items: stretch; gap: 10px; }
.plan-moment.quiet { opacity: 0.62; }
.plan-moment.quiet:focus-within, .plan-moment.quiet:has(details[open]) { opacity: 1; }
.plan-moment-head { flex-wrap: nowrap; align-items: flex-start; }
.plan-time {
  flex: 0 0 auto; min-width: 74px; padding-top: 1px;
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent);
}
.pill.mode-announce { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.pill.mode-play     { color: var(--good); border-color: var(--good); }
.pill.mode-skip     { color: var(--bad); border-color: var(--bad); }
.pill.mode-undecided{ color: var(--muted); border-style: dashed; }
.pill.edited        { color: var(--accent); border-color: var(--accent-soft); }
.pill.private       { color: var(--bad); border-color: var(--bad); }
.plan-song { flex-wrap: nowrap; }
.plan-song .art { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.plan-body p { margin: 0; }
.plan-script { font-size: 18px; line-height: 1.5; }
.plan-second { color: var(--muted); }
.plan-after { color: var(--muted); font-style: italic; }
.lang-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--accent);
}
.plan-names { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.plan-name { display: inline-flex; align-items: center; gap: 6px; }
.plan-name strong { color: var(--text); font-weight: 600; }
button.plan-play { min-height: 30px; padding: 2px 10px; font-size: 13px; }
.plan-warn { list-style: none; margin: 0; padding: 0; color: var(--accent); font-size: 14px; }
.plan-more summary { cursor: pointer; margin-bottom: 8px; }
.plan-editor { border-top: 1px solid var(--line); padding-top: 10px; }

.plan-sections { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.plan-section {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; background: var(--surface-2);
}
.plan-section.sensitive { border-color: var(--bad); }
.plan-section .eyebrow { margin: 0; }
.plan-section > .sub { margin-top: 6px; }
.plan-dl { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 6px 12px; margin: 8px 0 0; font-size: 14px; }
.plan-dl dt { color: var(--muted); }
.plan-dl dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.plan-who { flex: 0 0 auto; text-align: right; }

@media (max-width: 520px) {
  .plan-time { min-width: 0; }
  .plan-sections { grid-template-columns: 1fr; }
}

