/* Wilfred Studio. Wilfred's colours (docs/style-guide.md), kept calm: a guest
   should see their own face, one clear next step, and whether they are being
   recorded. */
:root {
  --bg: #f6f4f1; --panel: #ffffff; --raised: #faf8f6; --line: #e6e0d9; --ink: #1d1a17; --muted: #5c544d;
  --accent: #a8411c; --on-accent: #ffffff; --bad: #b3261e; --ok: #2f7d3a; --warn: #8a5a00; --tile: #2a2420;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210; --panel: #1f1b18; --raised: #2a2420; --line: #3a332e; --ink: #ece6e1; --muted: #b5aca4;
    --accent: #f08a5d; --on-accent: #141210; --bad: #ff8a80; --ok: #7fc48a; --warn: #f2c14e; --tile: #2a2420;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
main { min-height: 100%; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin: 32px auto;
  width: min(560px, calc(100% - 32px));
}
.card.narrow { width: min(440px, calc(100% - 32px)); }
.step { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
label.field { display: block; font-weight: 500; margin: 16px 0 4px; }
input[type=text], select {
  width: 100%; height: 44px; padding: 0 12px; font: inherit; color: var(--ink); background: var(--raised);
  border: 1px solid var(--muted); border-radius: 8px;
}
.agree { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; cursor: pointer; }
.agree input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
button {
  font: inherit; font-weight: 500; min-height: 44px; padding: 0 16px; border-radius: 8px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--muted); cursor: pointer;
}
button:hover { background: var(--raised); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.record { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { button.record { color: #141210; } }
button.off { background: var(--raised); color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }
.acts .primary { min-width: 140px; }
.notice {
  background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 12px 0 0; font-size: 15px;
}
.notice.bad { color: var(--bad); border-color: var(--bad); }
.preview {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--tile); border-radius: 10px; display: block;
  transform: scaleX(-1);
}
.meter { height: 10px; border-radius: 5px; background: var(--raised); border: 1px solid var(--line); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); }
.choice { display: flex; gap: 8px; margin-top: 4px; }
.choice button { flex: 1; }
.choice button[aria-pressed=true] { border-color: var(--accent); border-width: 2px; color: var(--accent); }

/* The room */
.room { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.bar .title { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.pill.on { color: #fff; background: #b3261e; border-color: #b3261e; }
.pill.on::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.stage { display: flex; min-height: 0; }
.tiles { flex: 1; min-width: 0; display: grid; gap: 8px; padding: 8px; align-content: center; justify-content: center; }
.tile { position: relative; background: var(--tile); border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; min-width: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.me video { transform: scaleX(-1); }
.tile .who {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgb(0 0 0 / 0.65); color: #fff; font-size: 14px;
  max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side { width: 320px; flex: none; border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 16px; }
.side h2 { margin-top: 16px; }
.side h2:first-child { margin-top: 0; }
.person { padding: 10px 0; border-top: 1px solid var(--line); }
.person b { font-weight: 600; }
.person .line { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.person .x { min-height: 32px; padding: 0 8px; font-size: 14px; }
.level { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; margin-top: 4px; }
.level i { display: block; height: 100%; background: var(--ok); }
.controls {
  display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); justify-content: center; flex-wrap: wrap;
  background: var(--panel); border-top: 1px solid var(--line);
}
.saving { padding: 6px 16px; font-size: 15px; text-align: center; background: var(--raised); border-top: 1px solid var(--line); }
.link-row { display: flex; gap: 8px; margin-top: 4px; }
.link-row input { flex: 1; min-width: 0; font-size: 14px; height: 40px; }
@media (max-width: 800px) {
  .stage { flex-direction: column; }
  .side { width: 100%; max-height: 40%; border-left: 0; border-top: 1px solid var(--line); }
  .bar { padding: 8px 12px; }
  .controls button { flex: 1; padding: 0 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .pill.on::before { animation: beat 2s ease-in-out infinite; }
  @keyframes beat { 50% { opacity: 0.4; } }
}
