:root {
  --ink: #17302d;
  --muted: #66736f;
  --paper: #f6f2e9;
  --card: #fffdf8;
  --line: #dcd8ce;
  --accent: #1f5f55;
  --accent-dark: #174a43;
  --accent-soft: #dcebe6;
  --warm: #df7d54;
  --warm-soft: #f8e4d8;
  --danger: #a33c37;
  --shadow: 0 16px 50px rgba(28, 54, 49, .09);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(223, 125, 84, .12), transparent 29rem),
    radial-gradient(circle at 100% 23%, rgba(31, 95, 85, .1), transparent 30rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.page-shell { width: min(100% - 32px, 1040px); margin: 0 auto; }

.site-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.03em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  color: #fffaf0;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 700;
}

.header-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.header-progress > span:first-child { white-space: nowrap; }

.progress-track {
  width: 142px;
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(23, 48, 45, .12);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .25s ease;
}

.hero {
  padding: 88px 0 72px;
  text-align: center;
}

.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 880px;
  margin-right: auto;
  margin-bottom: 24px;
  margin-left: auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.045em;
}

.hero-copy {
  max-width: 665px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(17px, 2.2vw, 20px);
}

.hero-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.about-card, .participant-card, .master-recorder, .beta-card, .final-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .9);
  box-shadow: var(--shadow);
}

.about-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  margin-bottom: 18px;
  border-color: #bdd3cb;
  background: linear-gradient(135deg, rgba(220, 235, 230, .92), rgba(255, 253, 248, .94));
}

.about-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fffaf0;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 700;
}

.about-card h2 { margin-bottom: 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(29px, 4vw, 40px); font-weight: 500; letter-spacing: -.025em; line-height: 1.05; }
.about-card p:not(.step-label) { max-width: 790px; margin-bottom: 9px; color: #4f625e; }
.about-card p:last-child { margin-bottom: 0; }

.participant-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  column-gap: 44px;
  align-items: end;
}

.participant-card h2, .master-recorder h2, .beta-card h2, .final-card h2, .section-heading h2, .how-it-works h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(29px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.05;
}

.participant-card p:not(.step-label), .beta-card p:not(.step-label), .final-card p:not(.step-label), .section-heading > p { margin-bottom: 0; color: var(--muted); }

.field-label { margin-bottom: 7px; font-size: 13px; font-weight: 750; }

#participantName, #betaContact {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #bfc6c1;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}

#participantName:focus, #betaContact:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,95,85,.12); }
#participantName:disabled, #betaContact:disabled { color: #53615e; background: #f1efe9; }
.field-hint { grid-column: 2; margin: 7px 0 0 !important; font-size: 12px; }
.field-hint.is-error { color: var(--danger) !important; }

.notice {
  margin-top: 18px;
  padding: 17px 20px;
  border: 1px solid #e8c8b7;
  border-radius: 15px;
  color: #743d29;
  background: var(--warm-soft);
}

.notice strong { display: block; margin-bottom: 3px; }

.master-recorder {
  margin-bottom: 74px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.master-recorder.is-recording {
  border-color: var(--warm);
  box-shadow: 0 18px 60px rgba(55, 39, 30, .18);
}

.master-recorder.is-recording .recorder-row {
  position: fixed;
  z-index: 18;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(560px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid #e4b49f;
  border-radius: 16px;
  background: rgba(255, 250, 240, .97);
  box-shadow: 0 16px 48px rgba(55, 39, 30, .24);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

body.is-recording { padding-bottom: 86px; }

.master-recorder.is-ready, .master-recorder.is-saved { border-color: #a9c9bd; }
.master-recorder.is-uploading { border-color: #d9c678; }
.master-recorder.is-text { border-color: #9dbeb3; }

.master-recorder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.master-recorder-heading h2 { margin-bottom: 0; }
.format-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 17px 18px;
  border: 1px solid #d6d9d2;
  border-radius: 16px;
  background: #f4f3ed;
}
.format-note p { max-width: 610px; margin: 0; color: var(--muted); font-size: 13px; }
.format-note strong { color: var(--ink); }
.mode-switch { flex: 0 0 auto; display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: #e5e6df; }
.mode-switch button { min-height: 40px; padding: 0 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 750; }
.mode-switch button[aria-pressed="true"] { color: #fff; background: var(--accent); box-shadow: 0 5px 14px rgba(31, 95, 85, .18); }
.mode-switch button:disabled { cursor: default; opacity: .58; }
#audioModeContent[hidden] { display: none; }
.master-recorder .recorder-row { flex-wrap: wrap; }
.recorder-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.master-recorder .audio-wrap { margin-top: 22px; }
.master-recorder .transcript-wrap { margin-top: 26px; }
.master-recorder textarea { min-height: 190px; }
.speech-note { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.how-it-works { padding: 74px 0; }
.how-it-works h2 { margin-bottom: 26px; }
.how-it-works ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.how-it-works li { display: flex; gap: 14px; padding: 20px; border-top: 1px solid var(--line); }
.how-it-works li > span { flex: 0 0 29px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-size: 13px; font-weight: 800; }
.how-it-works li p { margin: 1px 0 0; color: var(--muted); font-size: 14px; }
.how-it-works li strong { color: var(--ink); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.section-heading > p { max-width: 390px; }

.questions-list { display: grid; gap: 18px; }
.question-card { padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 8px 28px rgba(28, 54, 49, .055); transition: border-color .2s, box-shadow .2s; }
.question-card.is-recording { border-color: var(--warm); box-shadow: 0 10px 36px rgba(223,125,84,.13); }
.question-card.is-saved { border-color: #a9c9bd; }
.question-card.is-error { border-color: #d7a7a3; }

.question-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.question-number { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 99px; color: var(--muted); background: #eeece6; font-size: 12px; font-weight: 700; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ca5a2; }
.is-recording .status-badge { color: #844427; background: var(--warm-soft); }
.is-recording .status-dot { background: var(--warm); animation: pulse 1.2s infinite; }
.is-uploading .status-badge { color: #6b5a1f; background: #f3eac7; }
.is-uploading .status-dot { background: #b79725; animation: pulse 1.2s infinite; }
.is-saved .status-badge { color: var(--accent-dark); background: var(--accent-soft); }
.is-saved .status-dot { background: var(--accent); }
.is-error .status-badge { color: var(--danger); background: #f6dfdd; }
.is-error .status-dot { background: var(--danger); }

.question-text { max-width: 790px; margin-bottom: 26px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(23px, 3vw, 31px); font-weight: 500; line-height: 1.18; letter-spacing: -.02em; }
.question-reference .question-header { margin-bottom: 12px; }
.question-reference .question-text { margin-bottom: 0; }

.recorder-row { display: flex; align-items: center; gap: 16px; }
.record-button, .primary-button, .secondary-button, .retry-button { border: 0; cursor: pointer; font-weight: 800; transition: transform .12s, background .15s, opacity .15s; }
.record-button { min-height: 48px; display: inline-flex; align-items: center; gap: 10px; padding: 0 18px; border-radius: 13px; color: #fff; background: var(--accent); }
.record-button:hover:not(:disabled), .primary-button:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.record-button:disabled { cursor: wait; opacity: .55; }
.record-icon { width: 12px; height: 12px; border: 2px solid #fff; border-radius: 50%; background: var(--warm); }
.is-recording .record-button { background: var(--warm); }
.is-recording .record-icon { border-radius: 2px; background: #fff; }
.timer { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 750; }

.audio-wrap { align-items: center; gap: 14px; margin-top: 18px; }
.audio-wrap:not([hidden]) { display: flex; }
audio { width: min(100%, 480px); height: 42px; }
.retry-button { padding: 9px 12px; color: var(--accent); background: transparent; }
.retry-button:hover { text-decoration: underline; }

.transcript-wrap { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.transcript-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; }
.transcript-label { font-size: 13px; font-weight: 800; }
.listening-indicator { align-items: center; gap: 7px; color: var(--warm); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.listening-indicator:not([hidden]) { display: inline-flex; }
.listening-indicator span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
textarea { width: 100%; min-height: 116px; resize: vertical; padding: 14px 15px; border: 1.5px solid #c9cec9; border-radius: 13px; color: var(--ink); background: #fff; line-height: 1.55; outline: none; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,95,85,.1); }
textarea:disabled { color: #8a9290; background: #f3f1ec; }
.answer-note { min-height: 20px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.is-error .answer-note { color: var(--danger); }

.beta-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 22px 42px;
  align-items: center;
  margin-top: 32px;
}

.beta-copy p { max-width: 610px; }
.beta-choice {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px;
  border: 1px solid #bdc9c4;
  border-radius: 15px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.beta-choice:hover { border-color: var(--accent); }
.beta-choice:has(input:focus-visible) { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,95,85,.1); }
.beta-choice:has(input:checked) { border-color: #8eb7a8; background: var(--accent-soft); }
.beta-choice input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.beta-choice strong, .beta-choice small { display: block; }
.beta-choice strong { margin-bottom: 3px; }
.beta-choice small { color: var(--muted); font-size: 12px; }
.beta-choice:has(input:disabled) { cursor: default; opacity: .62; }
.beta-contact-fields { grid-column: 2; }
.beta-contact-fields[hidden] { display: none; }

.final-card { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin: 18px 0 74px; }
.primary-button { min-height: 54px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 22px; border-radius: 15px; color: #fff; background: var(--accent); white-space: nowrap; }
.primary-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.primary-button:disabled { cursor: not-allowed; opacity: .42; }

footer { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-brand { font-size: 17px; }
.footer-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 17px; }
footer p { margin: 0; text-align: right; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 13px 17px; border-radius: 12px; color: #fff; background: #243936; box-shadow: 0 12px 40px rgba(0,0,0,.18); font-size: 14px; font-weight: 650; }
.toast.is-error { background: #853d38; }

.success-dialog { width: min(520px, calc(100% - 32px)); padding: 42px; border: 0; border-radius: 24px; color: var(--ink); background: var(--card); box-shadow: 0 28px 90px rgba(9,35,31,.26); text-align: center; }
.success-dialog::backdrop { background: rgba(15,37,34,.52); backdrop-filter: blur(4px); }
.success-mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; color: #fff; background: var(--accent); font-size: 31px; }
.success-dialog h2 { margin-bottom: 8px; font-family: Georgia, serif; font-size: 38px; font-weight: 500; }
.success-dialog p { color: var(--muted); }
.response-code { padding: 12px; border-radius: 10px; background: #efede7; font-size: 13px; }
.secondary-button { min-height: 46px; padding: 0 20px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.noscript { padding: 16px; color: #fff; background: var(--danger); text-align: center; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 22px, 1040px); }
  .site-header { min-height: 70px; }
  .header-progress { gap: 8px; font-size: 12px; }
  .progress-track { width: 82px; }
  .hero { padding: 58px 0 50px; }
  h1 { font-size: clamp(39px, 13vw, 58px); }
  .about-card { grid-template-columns: 1fr; padding: 24px; }
  .about-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 26px; }
  .participant-card { grid-template-columns: 1fr; padding: 24px; }
  .participant-card > div { margin-bottom: 24px; }
  .field-hint { grid-column: 1; }
  .how-it-works { padding: 52px 0; }
  .how-it-works ol { grid-template-columns: 1fr; }
  .how-it-works li { padding: 14px 4px; }
  .master-recorder { padding: 24px 20px; margin-bottom: 52px; }
  .master-recorder-heading { display: block; }
  .master-recorder-heading .status-badge { margin-top: 14px; }
  .format-note { align-items: stretch; flex-direction: column; }
  .mode-switch { display: grid; grid-template-columns: 1fr 1fr; }
  .mode-switch button { padding: 0 9px; }
  .master-recorder textarea { min-height: 150px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 16px; }
  .question-card { padding: 23px 20px; border-radius: 19px; }
  .question-text { font-size: 24px; }
  .recorder-row { justify-content: space-between; }
  .record-button { flex: 1; justify-content: center; }
  .audio-wrap:not([hidden]) { align-items: stretch; flex-direction: column; }
  audio { width: 100%; }
  .retry-button { align-self: flex-start; }
  .beta-card { grid-template-columns: 1fr; padding: 24px; }
  .beta-contact-fields { grid-column: 1; }
  .final-card { align-items: stretch; flex-direction: column; padding: 24px; }
  .primary-button { width: 100%; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
  footer p { text-align: left; }
  .success-dialog { padding: 32px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
