:root {
  --bg: #f8f6f3;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #2a6b6b;
  --accent-light: #e8f0f0;
  --green: #22c55e;
  --green-dark: #16a34a;
  --red: #ef4444;
  --red-dark: #dc2626;
  --amber: #f59e0b;
  --border: #e0ddd8;
  --radius: 12px;
  --font-display: 'Fraunces', serif;
  --font-body: 'Figtree', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.container {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.state {
  display: none;
  animation: fadeIn 0.4s ease;
}

.state.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Question text */
.question-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.3;
  margin-bottom: 32px;
  color: var(--text);
}

.question-text.small {
  font-size: 1.25rem;
  margin-bottom: 24px;
  opacity: 0.8;
}

/* Prompt playing indicator */
.prompt-playing-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
}

.prompt-playing-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Audio bars animation */
.audio-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}

.audio-bars span {
  display: block;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  height: 8px;
  transition: height 0.15s;
}

.audio-bars.active span:nth-child(1) {
  animation: bar1 0.6s ease infinite;
}
.audio-bars.active span:nth-child(2) {
  animation: bar2 0.6s ease infinite 0.1s;
}
.audio-bars.active span:nth-child(3) {
  animation: bar3 0.6s ease infinite 0.2s;
}

@keyframes bar1 { 0%, 100% { height: 8px; } 50% { height: 20px; } }
@keyframes bar2 { 0%, 100% { height: 14px; } 50% { height: 8px; } }
@keyframes bar3 { 0%, 100% { height: 6px; } 50% { height: 24px; } }

/* Call button */
.call-button-wrap {
  transition: opacity 0.5s ease;
}

.call-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.call-btn:hover {
  background: var(--green-dark);
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(34, 197, 94, 0.4);
}

.call-btn:active {
  transform: scale(0.95);
}

.call-label {
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 16px;
  color: var(--text);
}

.call-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Recording state */
.record-button-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
}

.hangup-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: var(--red);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: background 0.2s, transform 0.15s;
}

.hangup-btn:hover {
  background: var(--red-dark);
}

.hangup-btn:active {
  transform: scale(0.95);
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  transform: translate(-50%, -50%);
  border: 3px solid var(--red);
  border-radius: 50%;
  animation: pulse 1.5s ease-out infinite;
  z-index: 1;
}

@keyframes pulse {
  0% { width: 80px; height: 80px; opacity: 0.8; }
  100% { width: 130px; height: 130px; opacity: 0; }
}

.record-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 12px;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 24px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.25s linear, background-color 0.5s;
}

.progress-bar.warning {
  background: var(--amber);
}

.timer-display {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* Review state */
.review-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.waveform {
  width: 100%;
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
}

.review-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.play-review-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.play-review-btn:hover {
  background: var(--accent-light);
}

.duration-display {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.review-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Buttons */
.btn-primary {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 40px;
  padding: 14px 32px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.btn-primary:hover {
  background: #1f5555;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 14px 32px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-secondary:hover {
  background: #f0edea;
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* Submission form */
.form-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 20px;
  text-align: left;
}

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.optional-tag {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="email"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  transition: border-color 0.2s, opacity 0.2s;
}

.field input:disabled {
  opacity: 0.5;
  background: var(--bg);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field input::placeholder {
  color: #aaa;
  font-size: 0.85rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field-error {
  display: block;
  font-size: 0.8rem;
  color: var(--red);
  margin-top: 4px;
  min-height: 1.2em;
}

/* Anonymous toggle */
.name-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anonymous-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
}

.anonymous-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* File upload */
.file-upload-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-upload-wrap input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  background: white;
  color: var(--text);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.file-upload-label:hover {
  background: #f0edea;
  border-color: var(--accent);
}

.image-preview {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
}

.image-preview img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}

.clear-image {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--red);
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-submit {
  width: 100%;
  margin-top: 8px;
}

.privacy-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 16px;
  line-height: 1.5;
}

/* Submit progress */
.submit-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Thank you */
.thanks-content {
  padding: 40px 0;
}

.thanks-content svg {
  margin-bottom: 16px;
}

.thanks-content h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.thanks-content p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.submit-another {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.95rem;
}

.submit-another:hover {
  text-decoration: underline;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Mobile */
@media (max-width: 480px) {
  body {
    padding: 16px;
    align-items: flex-start;
    padding-top: 48px;
  }

  .question-text {
    font-size: 1.5rem;
  }
}

/* Desktop — scale everything up */
@media (min-width: 768px) {
  .container {
    max-width: 560px;
  }

  .question-text {
    font-size: 3rem;
    margin-bottom: 48px;
  }

  .question-text.small {
    font-size: 2rem;
    margin-bottom: 32px;
  }

  .call-btn,
  .hangup-btn {
    width: 100px;
    height: 100px;
  }

  .call-btn svg,
  .hangup-btn svg {
    width: 40px;
    height: 40px;
  }

  .pulse-ring {
    width: 100px;
    height: 100px;
  }

  @keyframes pulse {
    0% { width: 100px; height: 100px; opacity: 0.8; }
    100% { width: 160px; height: 160px; opacity: 0; }
  }

  .call-label {
    font-size: 1.1rem;
    margin-top: 20px;
  }

  .call-note {
    font-size: 0.9rem;
  }

  .record-label {
    font-size: 1.1rem;
  }

  .progress-bar-wrap {
    height: 8px;
    margin-top: 32px;
  }

  .timer-display {
    font-size: 1rem;
    margin-top: 12px;
  }

  .review-heading {
    font-size: 1.75rem;
    margin-bottom: 28px;
  }

  .waveform {
    margin-bottom: 16px;
  }

  .play-review-btn {
    width: 48px;
    height: 48px;
  }

  .duration-display {
    font-size: 1rem;
  }

  .review-actions {
    gap: 16px;
  }

  .btn-primary {
    font-size: 1.05rem;
    padding: 16px 40px;
  }

  .btn-secondary {
    font-size: 1.05rem;
    padding: 16px 40px;
  }

  .form-heading {
    font-size: 1.75rem;
    margin-bottom: 32px;
  }

  .field label {
    font-size: 1rem;
  }

  .field input[type="text"],
  .field input[type="email"] {
    font-size: 1.05rem;
    padding: 14px 18px;
  }

  .btn-submit {
    font-size: 1.1rem;
    padding: 18px 40px;
  }

  .thanks-content h2 {
    font-size: 2rem;
  }

  .thanks-content p {
    font-size: 1.1rem;
  }

  .thanks-content svg {
    width: 56px;
    height: 56px;
  }

  .prompt-playing-label {
    font-size: 1.1rem;
  }

  .audio-bars {
    height: 32px;
    gap: 4px;
  }

  .audio-bars span {
    width: 5px;
  }
}
