:root {
  color-scheme: light;
  --ink: #1d1815;
  --muted-ink: #706a65;
  --paper: #fbf2e3;
  --white: #fffdf9;
  --ember: #ed5d32;
  --honey: #f4b64a;
  --sage: #4e7864;
  --border: rgba(29, 24, 21, 0.1);
  --shadow: 0 18px 50px rgba(47, 35, 24, 0.1);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.legal {
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 80px;
  color: var(--ink);
}

.legal h1 { margin-bottom: 10px; }
.legal h2 { margin: 34px 0 8px; font-size: 1.2rem; }
.legal p { line-height: 1.65; }
.legal .lede { font-size: 1.16rem; color: var(--muted-ink); }
.legal a { color: var(--ember); font-weight: 700; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 92% 2%, rgba(244, 182, 74, 0.22), transparent 34rem),
    linear-gradient(rgba(255, 255, 255, 0.24), transparent 42rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
  color: var(--muted-ink);
  font-size: 0.88rem;
  line-height: 1.45;
}

.consent-row input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.05rem;
  accent-color: var(--ember);
  flex: 0 0 auto;
}

.privacy-line a { color: inherit; }

.page-shell {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.4rem max(2rem, env(safe-area-inset-bottom));
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: clamp(3rem, 9vh, 5.5rem);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand-wave {
  color: var(--ember);
  transform: rotate(90deg);
}

.step {
  display: none;
  animation: reveal 320ms ease-out;
}

.step.active {
  display: block;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(0.6rem); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--ember);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2 {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  letter-spacing: -0.035em;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 15vw, 5.2rem);
  line-height: 0.98;
}

h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.05;
}

.lede,
.prompt-repeat {
  margin: 1.35rem 0 2rem;
  color: var(--muted-ink);
  font-size: 1.1rem;
  line-height: 1.55;
}

.prompt-card {
  margin: 2.1rem 0;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 1.4rem;
  background: rgba(255, 253, 249, 0.76);
  box-shadow: var(--shadow);
}

.prompt-card p {
  margin: 0.75rem 0 0;
  color: var(--muted-ink);
  line-height: 1.5;
}

.chapter-number {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--ember);
  font: 800 0.7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
}

.field-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.87rem;
  font-weight: 700;
}

.text-field {
  width: 100%;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  outline: none;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.08rem;
}

.text-field:focus {
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(237, 93, 50, 0.14);
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 3.6rem;
  margin-top: 1.1rem;
  border-radius: 1.1rem;
  font-weight: 750;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--ink);
  color: white;
  box-shadow: 0 14px 32px rgba(29, 24, 21, 0.17);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.secondary-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
}

.text-button {
  display: block;
  margin: 1rem auto 0;
  padding: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--muted-ink);
  cursor: pointer;
}

.privacy-line {
  color: var(--muted-ink);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.privacy-line span {
  margin-right: 0.3rem;
  color: var(--sage);
}

.tips-list {
  display: grid;
  gap: 1rem;
  margin: 2.4rem 0;
  padding: 0;
  list-style: none;
  counter-reset: tips;
}

.tips-list li {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  column-gap: 0.9rem;
  padding: 1.1rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.58);
  counter-increment: tips;
}

.tips-list li::before {
  content: "0" counter(tips);
  grid-row: 1 / span 2;
  color: var(--ember);
  font: 800 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tips-list span {
  margin-top: 0.25rem;
  color: var(--muted-ink);
  font-size: 0.9rem;
  line-height: 1.45;
}

.recorder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2.2rem;
  padding: 2.3rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 1.7rem;
  background: rgba(255, 253, 249, 0.78);
  box-shadow: var(--shadow);
}

.timer {
  font: 750 2.1rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  height: 5rem;
  margin: 1.3rem 0;
}

.waveform i {
  width: 0.36rem;
  height: 20%;
  border-radius: 99px;
  background: var(--ink);
  transition: height 120ms linear;
}

.waveform.recording i {
  animation: pulse 760ms ease-in-out infinite alternate;
}

.waveform.recording i:nth-child(3n) { animation-delay: -240ms; }
.waveform.recording i:nth-child(4n) { animation-delay: -500ms; }

@keyframes pulse {
  from { height: 18%; }
  to { height: 88%; }
}

.record-button {
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
  border: 0.55rem solid rgba(237, 93, 50, 0.18);
  border-radius: 50%;
  background: var(--ember);
  cursor: pointer;
}

.record-button span {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: white;
}

.record-button.recording span {
  border-radius: 0.3rem;
}

.record-status {
  margin: 1rem 0 0;
  color: var(--muted-ink);
  font-size: 0.85rem;
}

audio {
  width: 100%;
  margin: 2rem 0 1rem;
}

.complete-step {
  padding-top: 5vh;
  text-align: center;
}

.complete-mark {
  display: grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  margin: 0 auto 2rem;
  border-radius: 50%;
  background: var(--sage);
  color: white;
  font-size: 2rem;
  box-shadow: 0 14px 34px rgba(78, 120, 100, 0.25);
}

.complete-step h1 {
  font-size: clamp(2.7rem, 12vw, 4.6rem);
}

.permission-message {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  max-width: 32rem;
  margin: auto;
  padding: 1rem;
  border-radius: 1rem;
  background: #7c2d12;
  color: white;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
