:root {
  color-scheme: light;
  --background: #f3f0e8;
  --surface: #fffdf8;
  --surface-deep: #ece8dc;
  --ink: #17302c;
  --muted: #64726e;
  --primary: #21665a;
  --primary-dark: #164d44;
  --accent: #e26a3d;
  --danger: #b93f32;
  --line: #d9d6ca;
  --shadow: 0 16px 40px rgba(32, 52, 48, 0.1);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(226, 106, 61, 0.12), transparent 28rem),
    var(--background);
}

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: calc(1.25rem + env(safe-area-inset-top)) 1rem 1rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 5vw, 2rem);
  letter-spacing: -0.04em;
}

.eyebrow {
  margin-bottom: 0.25rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.network {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.network-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #9eaaa6;
}

.network.online .network-dot {
  background: #2f9b72;
  box-shadow: 0 0 0 4px rgba(47, 155, 114, 0.12);
}

.network.offline .network-dot {
  background: var(--accent);
}

main {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0 1rem calc(2rem + env(safe-area-inset-bottom));
}

.card {
  border: 1px solid rgba(23, 48, 44, 0.08);
  border-radius: 1.4rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setup-card {
  max-width: 560px;
  margin: 1.5rem auto;
  padding: clamp(1.25rem, 5vw, 2rem);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
}

.section-heading h2 {
  margin-bottom: 0.35rem;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.step-number {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--primary);
  font-weight: 800;
}

label {
  display: block;
  margin: 1rem 0 0.5rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  color: var(--ink);
  background: white;
  font-size: 1rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(33, 102, 90, 0.12);
}

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

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1.2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.55;
}

.consent-row input {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  margin-top: 0.1rem;
  accent-color: var(--primary);
}

.button {
  min-height: 3.2rem;
  border: 0;
  border-radius: 0.95rem;
  padding: 0.8rem 1.2rem;
  font-weight: 800;
  cursor: pointer;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button.primary {
  color: white;
  background: var(--primary);
}

.button.primary:active {
  background: var(--primary-dark);
}

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

.button.full {
  width: 100%;
}

.form-error {
  min-height: 1.4rem;
  margin: 0.65rem 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.collector {
  display: grid;
  gap: 1rem;
}

.progress-card {
  padding: 1rem 1.15rem;
  box-shadow: none;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress-copy strong {
  font-size: 1.25rem;
}

.text-button {
  border: 0;
  padding: 0.45rem;
  color: var(--primary);
  background: transparent;
  font-weight: 750;
  cursor: pointer;
}

.progress-track {
  height: 0.65rem;
  margin-top: 0.8rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-deep);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #4f9b7f);
  transition: width 300ms ease;
}

.queue-status {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.prompt-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.2rem, 5vw, 2.2rem);
}

.prompt-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0.3rem;
  content: "";
  background: linear-gradient(90deg, var(--accent), #f2ac73);
}

.prompt-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  color: var(--primary-dark);
  background: rgba(33, 102, 90, 0.1);
  font-weight: 800;
}

.repetition {
  margin-left: auto;
}

.instruction {
  margin: 2rem 0 0.7rem;
  color: var(--muted);
  text-align: center;
}

.prompt-text {
  max-width: 640px;
  min-height: 3.2em;
  margin: 0 auto 1rem;
  font-size: clamp(1.75rem, 8vw, 3.1rem);
  line-height: 1.35;
  text-align: center;
}

.speak-button {
  display: block;
  min-height: 2.8rem;
  margin: 0 auto;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}

.recording-zone {
  display: grid;
  place-items: center;
  margin-top: 1.8rem;
}

.timer {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.record-button {
  display: grid;
  width: 7.4rem;
  height: 7.4rem;
  place-items: center;
  border: 0.7rem solid rgba(226, 106, 61, 0.18);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 12px 28px rgba(226, 106, 61, 0.28);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.record-button:active {
  transform: scale(0.96);
}

.record-button.recording {
  animation: pulse 1.4s infinite;
  background: var(--danger);
}

.record-icon {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background: white;
}

.record-button.recording .record-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.4rem;
}

.recording-zone p {
  margin: 1rem 0 0;
  color: var(--muted);
  text-align: center;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 63, 50, 0.2); }
  50% { box-shadow: 0 0 0 18px rgba(185, 63, 50, 0); }
}

.review {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
}

.review audio {
  width: 100%;
}

.label-help {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.skip-button {
  display: block;
  margin: 1.3rem auto -0.5rem;
}

.complete-card {
  padding: 2rem;
  text-align: center;
}

.complete-icon {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--primary);
  font-size: 2rem;
}

.complete-card p {
  color: var(--muted);
  line-height: 1.6;
}

.help-card {
  padding: 1rem 1.2rem;
  box-shadow: none;
}

.help-card summary {
  font-weight: 800;
  cursor: pointer;
}

.help-card ul {
  margin-bottom: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 1rem;
  z-index: 10;
  max-width: 520px;
  margin: auto;
  border-radius: 0.9rem;
  padding: 0;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, padding 180ms ease;
}

.toast.show {
  padding: 0.85rem 1rem;
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
  }

  .network span:last-child {
    display: none;
  }

  .prompt-card {
    border-radius: 1.2rem;
  }

  .review-actions {
    grid-template-columns: 1fr;
  }
}

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

