/* app.css — one stylesheet for both pages.
   The listener page should feel like the room lights going down: near-black,
   almost nothing on it, type big enough to read from a mat with your eyes half
   shut. The host page can hold more, but it stays in the same night. */

:root {
  --ink:        #f2efe9;   /* warm off-white — pure white glares in a dark room */
  --ink-soft:   #a49f97;
  --ink-faint:  #6a655e;
  --bg:         #0b0b0d;
  --bg-lift:    #141418;
  --line:       #23232a;
  --glow:       #d8cdb8;   /* the one warm accent */
  --good:       #7fb98a;
  --warn:       #d9a05b;
  --bad:        #cf7a6a;
  --r:          14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
}

body {
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  /* Nothing should rubber-band or highlight under a resting thumb. */
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

/* ── the listener page ─────────────────────────────────────────────────────── */

.stage {
  min-height: 100svh;              /* svh, not vh: iOS Safari's toolbar lies about vh */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px calc(24px + env(safe-area-inset-bottom));
  gap: 22px;
}

.screen { display: none; flex-direction: column; align-items: center; gap: 20px; width: 100%; max-width: 420px; }
.screen.on { display: flex; }

.mark { letter-spacing: 0.42em; font-size: 12px; color: var(--ink-faint); text-transform: uppercase; }

.lead { font-size: 26px; line-height: 1.35; font-weight: 400; margin: 0; color: var(--ink); }
.sub  { font-size: 16px; color: var(--ink-soft); margin: 0; max-width: 30ch; }
.hint { font-size: 14px; color: var(--ink-faint); margin: 0; max-width: 34ch; line-height: 1.55; }

.title { font-size: 18px; color: var(--ink-soft); margin: 0; }

.field {
  width: 100%;
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px;
  text-align: center;
  font-size: 17px;
}
.field::placeholder { color: var(--ink-faint); }

.big {
  width: 100%;
  padding: 22px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--glow);
  color: #17150f;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, opacity 120ms ease;
}
.big:active { transform: scale(0.985); }
.big.quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); }

/* the progress ring while the file comes down */
.pct { font-size: 44px; font-variant-numeric: tabular-nums; color: var(--ink); }
.bar { width: 100%; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0%; background: var(--glow); transition: width 240ms ease; }

/* the breathing dot — the only moving thing while a piece plays */
.dot {
  width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(216,205,184,0.5), rgba(216,205,184,0.06) 70%);
  animation: breathe 8s ease-in-out infinite;
}
.dot.still { animation: none; opacity: 0.35; }
@keyframes breathe {
  0%, 100% { transform: scale(0.82); opacity: 0.5; }
  45%      { transform: scale(1.12); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
}

.clock { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--ink-soft); letter-spacing: 0.02em; }

.foot[hidden] { display: none; }   /* `hidden` must beat the flex below */

.foot {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12px; color: var(--ink-faint);
}
.led { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.led.live { background: var(--good); }
.led.off  { background: var(--warn); }

/* ── the host page ─────────────────────────────────────────────────────────── */

.wrap { max-width: 720px; margin: 0 auto; padding: 20px 18px calc(28px + env(safe-area-inset-bottom)); }

.card {
  background: var(--bg-lift);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-faint); margin: 0 0 12px; font-weight: 600; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grow { flex: 1 1 140px; min-width: 0; }

.btn {
  background: #1d1d23;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--ink);
  font-size: 15px;
  min-height: 46px;
}
.btn:disabled { opacity: 0.32; cursor: not-allowed; }
.btn.on  { background: var(--glow); color: #17150f; border-color: var(--glow); }
.btn.wide { flex: 1; }
.btn.play { min-width: 120px; font-weight: 600; }

.time { font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.time small { font-size: 16px; color: var(--ink-faint); }

.seek { width: 100%; accent-color: var(--glow); height: 30px; }

.tracks { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tracks li { border-top: 1px solid var(--line); }
.tracks li:first-child { border-top: 0; }
.tracks button {
  width: 100%; text-align: left; background: none; border: 0;
  padding: 12px 4px; color: var(--ink); font-size: 15px;
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
}
.tracks button.sel { color: var(--glow); }
.tracks .meta { color: var(--ink-faint); font-size: 12px; white-space: nowrap; }

.people { list-style: none; margin: 0; padding: 0; }
.people li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-top: 1px solid var(--line);
  font-size: 14px; border-radius: 8px;
}
.people li:first-child { border-top: 0; }
.people li.waiting { background: rgba(217,160,91,0.10); }
.people .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .st { color: var(--ink-soft); }
.people .num { color: var(--ink-faint); font-variant-numeric: tabular-nums; font-size: 12px; }

.tiny { font-size: 12px; color: var(--ink-faint); margin: 0; }
.sub-line { margin: 0 0 4px; color: var(--ink-soft); }
.btn.small { min-height: 36px; padding: 8px 12px; font-size: 13px; }
.tracks li.empty { padding: 12px 4px; color: var(--ink-faint); font-size: 14px; }

.note { font-size: 13px; color: var(--ink-faint); margin: 10px 0 0; }
.note code { background: #000; padding: 2px 6px; border-radius: 5px; color: var(--ink-soft); font-size: 12px; }

.link { display: flex; gap: 8px; align-items: center; }
.link input {
  flex: 1; min-width: 0; background: #000;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-size: 13px; color: var(--ink-soft);
  text-overflow: ellipsis;
}

.err { color: var(--bad); font-size: 14px; margin: 8px 0 0; min-height: 1em; }
.ok  { color: var(--good); }
.hide { display: none !important; }
