:root {
  color-scheme: light;
  --navy: #15314d;
  --navy-deep: #0d2337;
  --teal: #227f7a;
  --teal-dark: #17635f;
  --teal-pale: #e8f5f3;
  --cream: #f6f3ed;
  --white: #ffffff;
  --text: #17324c;
  --muted: #526b80;
  --border: #cad8df;
  --danger: #9c2f2f;
  --danger-pale: #fff0ef;
  --focus: #f0a23b;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(34, 127, 122, 0.13), transparent 32rem),
    var(--cream);
  line-height: 1.55;
}

button,
input,
audio,
progress {
  font: inherit;
}

.page-shell {
  width: min(100% - 1.25rem, 52rem);
  margin-inline: auto;
  padding-block: 1.25rem 2.5rem;
}

.intake-card {
  padding: clamp(1.25rem, 5vw, 3rem);
  background: var(--white);
  border: 1px solid rgba(21, 49, 77, 0.11);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3.5rem rgba(21, 49, 77, 0.12);
}

.brand {
  margin: 0 0 1rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2 {
  color: var(--navy-deep);
  line-height: 1.15;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.3rem);
  letter-spacing: -0.035em;
}

h2 {
  margin: 2rem 0 0.85rem;
  font-size: clamp(1.25rem, 4vw, 1.6rem);
}

.intro {
  margin: 1rem 0 1.5rem;
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.urgent-note {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--danger-pale);
  border-left: 0.3rem solid var(--danger);
  border-radius: 0.7rem;
  color: #5e2222;
}

.urgent-note strong {
  display: block;
  margin-bottom: 0.2rem;
}

.identity-section {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--teal-pale);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
}

.identity-section h2 {
  margin-top: 0;
}

.identity-form {
  display: grid;
  gap: 0.9rem;
}

.identity-form label,
.identity-form label span {
  display: block;
}

.identity-form label span {
  margin-bottom: 0.35rem;
  color: var(--navy-deep);
  font-weight: 700;
}

.identity-form input {
  width: 100%;
  min-height: 3rem;
  padding: 0.72rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: 0.75rem;
}

.identity-name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.identity-form .button {
  width: fit-content;
}

.identity-form .small-copy {
  margin-bottom: 0;
}

.preparing-panel {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 5rem;
  padding: 0.85rem 0;
}

.preparing-panel p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border: 0.24rem solid rgba(34, 127, 122, 0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.completion-panel {
  margin-top: 1.5rem;
  padding: clamp(1.75rem, 6vw, 3rem) clamp(1.1rem, 5vw, 2.5rem);
  text-align: center;
  background: linear-gradient(180deg, #f3fbfa 0%, var(--teal-pale) 100%);
  border: 2px solid var(--teal);
  border-radius: 1rem;
  box-shadow: 0 1rem 2.5rem rgba(23, 99, 95, 0.13);
}

.completion-check {
  display: grid;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1rem;
  place-items: center;
  color: var(--white);
  background: var(--teal);
  border-radius: 50%;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0.65rem 1.5rem rgba(34, 127, 122, 0.24);
}

.completion-kicker {
  margin: 0 0 0.35rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.completion-panel h2 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
}

.completion-lead {
  margin: 0.8rem 0 0.35rem;
  color: var(--navy-deep);
  font-size: 1.15rem;
  font-weight: 750;
}

.completion-panel p:last-child {
  margin-bottom: 0;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.completion-actions .button {
  min-width: 10.5rem;
}

.intake-card.is-complete > :not(.brand):not(.completion-panel) {
  display: none;
}

.intake-card.is-complete .brand {
  text-align: center;
}

.prompt-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding-left: 1.6rem;
}

.prompt-list li {
  padding-left: 0.25rem;
}

.prompt-guidance {
  color: var(--muted);
}

.prompt-guidance p {
  margin: 0.55rem 0;
}

.mode-picker {
  margin: 2rem 0 0;
  padding: 0;
  border: 0;
}

.mode-picker legend {
  margin-bottom: 0.8rem;
  color: var(--navy-deep);
  font-size: 1.15rem;
  font-weight: 760;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.9rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 0.8rem;
  cursor: pointer;
}

.mode-option:has(input:checked) {
  background: var(--teal-pale);
  border-color: var(--teal);
}

.mode-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.mode-option input {
  margin-top: 0.25rem;
}

.mode-option span,
.mode-option small {
  display: block;
}

.mode-option small,
.permission-note {
  color: var(--muted);
}

.mode-picker:disabled .mode-option {
  cursor: not-allowed;
  opacity: 0.58;
}

.mode-guidance {
  margin: 0.9rem 0 0;
  padding: 0.85rem 1rem;
  color: var(--navy);
  background: var(--teal-pale);
  border-radius: 0.7rem;
  line-height: 1.5;
}

.recorder {
  margin-top: 2rem;
  padding-top: 0.1rem;
  border-top: 1px solid var(--border);
}

.section-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.timer {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.time-warning {
  margin: 0.8rem 0;
  padding: 0.8rem 1rem;
  color: var(--navy-deep);
  background: var(--teal-pale);
  border-left: 4px solid var(--teal);
  border-radius: 0.6rem;
  font-weight: 700;
}

.permission-note {
  margin: -0.3rem 0 1rem;
  font-size: 0.94rem;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  margin-bottom: 1rem;
  color: var(--danger);
  font-weight: 750;
}

.recording-dot {
  width: 0.72rem;
  height: 0.72rem;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .recording-dot {
    animation: none;
  }
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  min-height: 3rem;
  padding: 0.72rem 1rem;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  font-weight: 760;
  cursor: pointer;
}

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

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

.button.primary:hover:not(:disabled),
.button.send:hover:not(:disabled) {
  background: var(--teal-dark);
}

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

.button.secondary {
  color: var(--navy);
  background: var(--white);
  border-color: var(--border);
}

.button:focus-visible,
input:focus-visible,
audio:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.live-preview-panel,
.preview-panel,
.upload-panel {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--teal-pale);
  border-radius: 0.75rem;
}

.live-preview-panel .preview-label,
.preview-panel label,
.preview-label,
.upload-panel label {
  margin: 0;
  font-weight: 700;
}

.upload-heading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.upload-heading strong {
  flex: 1;
}

.upload-elapsed {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.upload-spinner {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  border: 3px solid rgba(22, 108, 105, 0.22);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.upload-stages {
  display: grid;
  gap: 0.55rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.upload-stage {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
}

.upload-stage-marker {
  display: inline-grid;
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 800;
}

.upload-stage.is-active {
  color: var(--navy);
  font-weight: 700;
}

.upload-stage.is-active .upload-stage-marker {
  color: var(--white);
  border-color: var(--teal);
  background: var(--teal);
}

.upload-stage.is-complete {
  color: var(--teal-dark);
  font-weight: 700;
}

.upload-stage.is-complete .upload-stage-marker {
  color: var(--white);
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.upload-guidance {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

audio,
video,
progress {
  width: 100%;
}

video {
  max-height: 26rem;
  background: #000;
  border-radius: 0.55rem;
}

#live-video-preview {
  transform: scaleX(-1);
}

.button.send {
  width: 100%;
  margin-top: 1rem;
}

.small-copy,
.privacy-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.small-copy {
  margin: 0;
}

.status {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: var(--navy);
  font-weight: 650;
}

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

.status.success {
  color: var(--teal-dark);
}

.privacy-note {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

[hidden] {
  display: none !important;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-spinner,
  .upload-spinner {
    animation-duration: 1.8s;
  }
}

@media (max-width: 35rem) {
  .identity-name-grid {
    grid-template-columns: 1fr;
  }

  .completion-actions .button {
    flex: 1 1 100%;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .button-row .button {
    flex: 1 1 100%;
  }
}
