:root {
  --bg: #f6f5f2;
  --ink: #16181d;
  --muted: #5c6270;
  --line: #dcdad4;
  --accent: #1f6f5c;
  --red: #c8372d;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding: env(safe-area-inset-top, 0) 16px env(safe-area-inset-bottom, 0);
}
main { max-width: 520px; margin: 0 auto; padding-block: 24px 48px; }
.step { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
h1 { margin: 0 0 8px; font-size: 24px; line-height: 1.25; font-weight: 700; }
.hint { margin: 0 0 16px; color: var(--muted); }
.stage {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
}
.stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
#live { transform: scaleX(-1); }
#playback { object-fit: contain; }
.timer {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,.6); color: #fff;
  padding: 4px 10px; border-radius: 99px; font-size: 15px; font-variant-numeric: tabular-nums;
}
.timer.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: middle; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
button {
  flex: 1 1 140px; min-height: 52px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.primary { background: var(--accent); color: #fff; border: 0; }
.record { background: var(--red); }
.stop { background: var(--ink); }
.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 16px; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.message { min-height: 1.5em; margin: 12px 0; }
.message.error { color: var(--red); }
details { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; color: var(--muted); }
summary { cursor: pointer; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 12px 0 0; }
dt { font-weight: 600; }
dd { margin: 0; word-break: break-word; }
