:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --border: #d9d9d9;
  --card: #f6f6f6;
  --accent: #b5442a;
  --accent-dark: #8a3320;
  --danger: #b5442a;
  --success: #2f6b3a;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--white);
  color: var(--ink);
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px 60px;
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }

h1 {
  font-size: 26px;
  margin: 0 0 8px;
}

h2 {
  font-size: 20px;
  margin: 0 0 8px;
}

.sub {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 24px;
}

label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin: 18px 0 6px;
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12.5px;
}

input[type="text"], select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  color: var(--ink);
}

input[type="text"]:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.consent {
  margin-top: 22px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  cursor: pointer;
  line-height: 1.45;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 17px;
  height: 17px;
}

button {
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  padding: 13px 20px;
  cursor: pointer;
  width: 100%;
}

button.primary {
  background: var(--ink);
  color: var(--white);
  margin-top: 22px;
}

button.primary:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

button.secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--ink);
}

.error {
  color: var(--danger);
  font-size: 13.5px;
  min-height: 18px;
  margin-top: 10px;
}

video {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #111;
  border-radius: 10px;
  object-fit: cover;
  margin: 12px 0;
}

.progress-row {
  margin-bottom: 18px;
}

#progressLabel {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.progress-bar {
  height: 6px;
  background: var(--card);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.sentence-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  margin-bottom: 4px;
}

.sentence-text {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

.record-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.timer {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 52px;
}

.record-btn {
  flex: 1;
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
}

.record-btn.recording {
  background: var(--danger);
}

.record-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

.after-record {
  margin-top: 18px;
}

.after-record.hidden {
  display: none;
}

.upload-status {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.upload-status.success { color: var(--success); }
.upload-status.error { color: var(--danger); }

.button-row {
  display: flex;
  gap: 10px;
}

.button-row button {
  margin-top: 0;
}

.checkmark {
  font-size: 56px;
  color: var(--success);
  text-align: center;
  margin-top: 30px;
}

.verify-banner {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
}

.verify-banner.hidden {
  display: none;
}

.verify-banner.fail {
  background: #fbeae7;
  border: 1px solid var(--danger);
  color: #7a2e1c;
}

.verify-banner.warn {
  background: #f6f6f6;
  border: 1px solid var(--border);
  color: var(--muted);
}

.project-intro {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.project-intro p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 10px;
}

.project-intro p:last-child {
  margin-bottom: 0;
}

.project-intro strong {
  color: var(--ink);
}

.quality-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.quality-checklist.small {
  flex-direction: row;
  gap: 14px;
  padding: 8px 12px;
  margin: 10px 0;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.quality-checklist.small .check-item {
  font-size: 11.5px;
}

.check-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cccccc;
  flex-shrink: 0;
}

.check-item.ok { color: var(--ink); font-weight: 600; }
.check-item.ok .dot { background: var(--success); }
.check-item.bad .dot { background: var(--danger); }

.video-stage {
  position: relative;
  width: 100%;
}

.video-stage video {
  display: none; /* raw camera feed is hidden — canvas below shows the composited preview */
}

.video-stage canvas {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background: #111;
  display: block;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-overlay.hidden {
  display: none;
}

.countdown-overlay span {
  font-size: 72px;
  font-weight: 700;
  color: #ffffff;
  font-family: -apple-system, sans-serif;
}
