:root {
  color-scheme: light dark;
  --bg: #faf7f2;
  --surface: #fffdf9;
  --fg: #211d18;
  --muted: #6d6459;
  --border: #e6ddcf;
  --accent: #a8481f;
  --accent-fg: #ffffff;
  --danger: #b3261e;
  --ok: #2e6b45;
  --chip: #f2ece2;
  --stage: #101010;
  --shadow: 0 12px 34px rgba(48, 35, 18, 0.09);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191613;
    --surface: #221e1a;
    --fg: #f2ece3;
    --muted: #b2a696;
    --border: #3b342c;
    --accent: #e8875b;
    --accent-fg: #211005;
    --danger: #ff8a80;
    --ok: #7fd1a0;
    --chip: #2d2823;
    --stage: #000000;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.3;
}

a {
  color: var(--accent);
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 26px 16px 64px;
}

.page.parent {
  max-width: 620px;
  padding-bottom: 48px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.masthead h1 {
  font-size: 1.35rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card > h2 {
  margin-bottom: 4px;
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.card > .hint {
  margin-bottom: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.row.tight {
  margin-top: 14px;
}

.row > input {
  flex: 1 1 220px;
}

form {
  display: block;
}

label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 6px;
}

input,
textarea {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  min-height: 44px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.button:hover {
  border-color: var(--muted);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

button.primary:hover {
  filter: brightness(1.06);
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

button.ghost:hover {
  color: var(--fg);
  border-color: var(--border);
}

button.danger {
  color: var(--danger);
}

button.small {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.84rem;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fineprint {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 18px;
}

.error {
  color: var(--danger);
  font-weight: 600;
  margin-top: 12px;
}

.empty {
  color: var(--muted);
  padding: 12px 2px;
}

/* ---------- Admin ---------- */

.person {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 1fr;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.person:first-child {
  border-top: 0;
}

.person-name {
  font-weight: 700;
}

.person-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.person-link input.link {
  flex: 1 1 200px;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  min-height: 38px;
  padding: 8px 10px;
}

.question {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.question:first-child {
  border-top: 0;
  padding-top: 6px;
}

.question-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.question-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.question-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.responses {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.response {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
}

.response-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.response-who {
  font-weight: 700;
  font-size: 0.92rem;
}

.response-when {
  color: var(--muted);
  font-size: 0.8rem;
}

.response video {
  display: block;
  width: 100%;
  max-width: 440px;
  margin-top: 10px;
  border-radius: 9px;
  background: #000;
}

.response-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.82rem;
}

.response-actions a {
  font-weight: 600;
}

.response-status {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}

.response-status.failed {
  color: var(--danger);
}

.waiting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--fg);
  font-weight: 600;
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(90vw, 460px);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 20;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.narrow {
  max-width: 420px;
  margin: 10vh auto 0;
}

/* ---------- Parent ---------- */

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.lede {
  color: var(--muted);
  margin-top: 8px;
  font-size: 1.02rem;
}

.question-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.question-card {
  display: block;
  width: 100%;
  min-height: 0;
  text-align: left;
  white-space: normal;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 400;
}

.question-card:hover {
  border-color: var(--accent);
}

.question-card .q-text {
  display: block;
  font-size: 1.18rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.question-card .q-meta {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.question-card.answered {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
}

.question-card.answered .q-meta {
  color: var(--ok);
  font-weight: 650;
}

.back {
  margin-bottom: 14px;
  padding-left: 10px;
}

.record-question {
  font-size: 1.22rem;
  line-height: 1.35;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  max-height: 62vh;
  border-radius: 18px;
  overflow: hidden;
  background: var(--stage);
}

.stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--stage);
}

.stage video.mirrored {
  transform: scaleX(-1);
}

.stage video#review {
  object-fit: contain;
}

.timer {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(12, 12, 12, 0.72);
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.92rem;
}

.timer::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff453a;
}

.stage-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 26px;
  background: rgba(10, 10, 10, 0.82);
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 540px;
  margin: 20px auto 0;
}

.controls.review {
  justify-content: center;
  flex-wrap: wrap;
}

.icon-button {
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
}

.icon-spacer {
  width: 52px;
  flex: 0 0 52px;
}

.record-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.record-button {
  width: 78px;
  height: 78px;
  min-height: 78px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid var(--surface);
  background: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.25);
}

.record-button:hover {
  border-color: var(--surface);
  filter: brightness(1.05);
}

.record-button.recording {
  background: #d92d20;
  box-shadow: 0 0 0 7px rgba(217, 45, 32, 0.18);
}

.record-icon {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
}

.record-button.recording .record-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.record-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
  text-align: center;
}

.upload {
  max-width: 540px;
  margin: 20px auto 0;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--chip);
  overflow: hidden;
}

#upload-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.upload p {
  margin-top: 8px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.done-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 12vh auto 20px;
  border-radius: 50%;
  background: var(--ok);
  color: var(--bg);
  font-size: 2.2rem;
  font-weight: 800;
}

#done-view {
  text-align: center;
}

#done-view p {
  color: var(--muted);
  margin: 10px 0 28px;
}

.parent-head {
  display: flex;
  justify-content: flex-end;
  min-height: 10px;
}

.loading {
  color: var(--muted);
  padding: 20vh 0;
  text-align: center;
}

@media (max-width: 560px) {
  .page {
    padding: 18px 14px 56px;
  }

  .card {
    padding: 18px;
    border-radius: 14px;
  }

  .person {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .question-head {
    flex-direction: column;
    gap: 8px;
  }

  .question-actions {
    align-self: flex-end;
  }

  .stage {
    max-height: 58vh;
  }
}
