/* pod-record — base styles. Warm-editorial flavor per recipes/design-brain.md. */

:root {
  --ink: #171717;
  --muted: #6b6b6b;
  --line: #e5e2dc;
  --bg: #faf8f5;
  --card: #ffffff;
  --accent: #1a5f4a;
  --rec: #c62828;
  --warn: #b8860b;
  --safe: #1a5f4a;
  --r: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 20px 80px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

.rig { max-width: 720px; margin: 0 auto; }

h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.15;
  margin: 0 0 8px;
  font-weight: 400;
}

h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 21px;
  font-weight: 400;
  margin: 0 0 12px;
}

.sub { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }
.note { color: var(--muted); font-size: 14px; margin: 12px 0 0; }

/* Status pill — always visible, always honest. */
.pill {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  background: var(--card);
}
.pill.idle  { color: var(--muted); }
.pill.ready { color: var(--accent); border-color: var(--accent); }
.pill.rec   { color: #fff; background: var(--rec); border-color: var(--rec); }
.pill.up    { color: #fff; background: var(--warn); border-color: var(--warn); }
.pill.safe  { color: #fff; background: var(--safe); border-color: var(--safe); }
.pill.lost  { color: #fff; background: #444; border-color: #444; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 20px;
}

video {
  width: 100%;
  border-radius: 10px;
  background: #111;
  aspect-ratio: 16 / 9;
  display: block;
}

.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  font: inherit;
  font-weight: 500;
  padding: 12px 18px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #000; }
.btn.danger { border-color: var(--rec); color: var(--rec); }
.btn.danger:hover { background: var(--rec); color: #fff; }

.bar {
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
#barFill {
  height: 100%;
  width: 0;
  background: var(--safe);
  transition: width .3s ease;
}

.stats { margin: 12px 0 0; font-size: 15px; }
.net { color: var(--safe); font-weight: 500; }
.net.bad { color: var(--rec); }

pre#log {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  color: #333;
}

@media (max-width: 480px) {
  .controls .btn { flex: 1 1 100%; }
}

/* ── Room + lobby ─────────────────────────────────────────────────────────── */

/* MUST come before any author `display` rule on a hideable element.
   `[hidden] { display: none }` lives in the UA stylesheet at the lowest precedence, so ANY author
   display rule (like `.stage { display: flex }` below) silently beats it and every stage renders
   at once. Learned the hard way — the lobby, the browser gate, and the call all stacked. */
[hidden] { display: none !important; }

.room-body { padding: 0; min-height: 100vh; }

.stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
  width: 100%;
  max-width: 560px;
}
.card.narrow { max-width: 460px; text-align: center; }
.card h1 { font-size: clamp(24px, 4vw, 32px); }

.pill.floating { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; margin: 0; }

.field { margin: 14px 0; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
.field select, .field input {
  width: 100%; font: inherit; padding: 11px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.field select:focus, .field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn.wide { width: 100%; justify-content: center; margin-top: 8px; text-align: center; text-decoration: none; display: block; }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn.rec { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn.rec.stop { background: var(--ink); border-color: var(--ink); }

.meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 12px 0 4px; }
#micFill { height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }

.checks { list-style: none; padding: 0; margin: 16px 0; font-size: 15px; }
.checks li { padding: 5px 0; }
.checks li.good { color: var(--safe); }
.checks li.bad { color: var(--rec); }

.warn {
  background: #fff8e6; border: 1px solid #e8d9a8; color: #6b5410;
  padding: 11px 13px; border-radius: 10px; font-size: 14px; margin-top: 14px;
}

.linkrow { display: flex; gap: 8px; margin: 10px 0; }
.linkrow input {
  flex: 1; font: inherit; font-size: 14px; padding: 11px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}

/* ── The call ─────────────────────────────────────────────────────────────── */

.call-stage { flex-direction: column; padding: 0; justify-content: stretch; }

.videos { position: relative; flex: 1; width: 100%; background: #0d0d0d; min-height: 60vh; }
.videos .remote { width: 100%; height: 100%; object-fit: contain; aspect-ratio: auto; border-radius: 0; }
.videos .self {
  position: absolute; right: 16px; bottom: 16px; width: 22%; max-width: 240px; min-width: 120px;
  border-radius: 10px; border: 2px solid rgba(255,255,255,.5); object-fit: cover; aspect-ratio: 16/9;
}
.waiting {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #eee; font-size: 17px; text-align: center; padding: 24px;
}

/* NOTE: named .callbar, not .bar — loop1.html already uses .bar for the upload progress track,
   and a second .bar rule silently broke it. */
.callbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.bar-actions { display: flex; gap: 8px; margin-left: auto; }
.health { font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.health.good { color: var(--safe); }
.health.poor { color: var(--warn); }
.progress { width: 100%; font-size: 13px; color: var(--muted); }

@media (max-width: 600px) {
  .videos .self { width: 32%; right: 10px; bottom: 10px; }
  .bar-actions { margin-left: 0; width: 100%; }
  .bar-actions .btn { flex: 1; }
}

/* On the landing page the ✕ items are deliberate non-features, not failures.
   Red would read as "something is broken" for choices we are proud of. */
.checks.muted-x li.bad { color: var(--muted); }
