:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f3ee;
  color: #17211b;
  --ink: #17211b;
  --muted: #68716b;
  --paper: #fffdf8;
  --line: #d9d8d0;
  --green: #1f6a47;
  --green-dark: #154b33;
  --red: #ae3f37;
  --shadow: 0 24px 70px rgb(28 47 37 / 10%);
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; }

button, audio { font: inherit; }

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

header { max-width: 720px; margin-bottom: 40px; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { font-size: clamp(48px, 8vw, 76px); line-height: 0.98; letter-spacing: -0.045em; }
h2 { font-size: 30px; }

.lede { max-width: 650px; margin: 24px 0 0; color: var(--muted); font-size: 18px; line-height: 1.65; }

.recorder, .playback, .next-stage, .comparison {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.recorder { display: grid; gap: 28px; padding: clamp(24px, 5vw, 44px); }
.recorder-copy { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.status { margin: 0; color: var(--green); font-weight: 750; }
.session-id { margin: 8px 0 0; color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }

.meter-wrap { height: 12px; overflow: hidden; border-radius: 999px; background: #e6e7e1; }
.meter { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2a8158, #d4a52c, #bd4a3f); transition: width 80ms linear; }
.time { font-variant-numeric: tabular-nums; font-size: clamp(56px, 12vw, 100px); font-weight: 650; letter-spacing: -0.065em; line-height: 0.9; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
button { min-height: 48px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer; font-weight: 750; }
button:focus-visible { outline: 3px solid #3b82f6; outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: 0.42; }
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.danger { background: var(--red); color: white; }
.secondary { border: 1px solid var(--line); background: transparent; color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; }
.stats div { padding: 16px; border-radius: 14px; background: #f2f1eb; }
.stats dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.stats dd { margin: 6px 0 0; font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.error { margin: 0; padding: 14px 16px; border-radius: 12px; background: #f9e5e2; color: #7b2924; }

.playback, .next-stage, .comparison { margin-top: 24px; padding: 28px; }
.playback { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.playback[hidden], .comparison[hidden] { display: none; }
.playback p:not(.eyebrow) { color: var(--muted); }
audio { width: min(420px, 100%); }
.transcript-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.transcript-status { margin: 0; color: var(--muted); font-size: 14px; }
.transcript-body { display: grid; gap: 12px; margin-top: 20px; }
.empty-transcript { min-height: 130px; margin: 0; display: grid; place-items: center; border: 1px dashed #c5c7be; border-radius: 16px; color: var(--muted); text-align: center; }
.transcript-segment { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.transcript-segment:first-child { border-top: 0; }
.transcript-speaker { margin: 0; color: var(--green); font-size: 13px; font-weight: 800; }
.transcript-text { margin: 0; line-height: 1.6; }
.transcript-time { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.transcript-segment.provisional { opacity: 0.68; }
.comparison-heading-row, .provider-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.provider-transcript { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #faf9f4; }
.provider-heading { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.provider-heading h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 500; }
.provider-status { max-width: 180px; margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.provider-transcript .transcript-segment { grid-template-columns: 96px 1fr; gap: 14px; }
.provider-transcript .empty-transcript { min-height: 180px; }

@media (max-width: 650px) {
  .shell { padding-top: 40px; }
  .recorder-copy, .playback, .transcript-heading-row, .comparison-heading-row, .provider-heading { align-items: flex-start; flex-direction: column; }
  .comparison-grid { grid-template-columns: 1fr; }
  .provider-status { max-width: none; text-align: left; }
  .stats { grid-template-columns: 1fr; }
  .transcript-segment { grid-template-columns: 1fr; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .meter { transition: none; }
}

/* The reconciled transcript is the authoritative one; the provider columns below it are
   evidence, not the answer. The border is the only signal distinguishing them, so it stays
   visible in both themes rather than relying on a background tint. */
.provider-transcript.authoritative {
  border: 2px solid currentColor;
  margin-bottom: 20px;
}

/* Shown only when a previous page load left audio unsent. It is deliberately obtrusive: the
   recording it refers to cannot be made again. */
.recovery-notice {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  max-width: min(38rem, calc(100vw - 2rem));
  padding: 0.9rem 1.1rem;
  border-radius: 0.6rem;
  border: 1px solid #b45309;
  background: #fffbeb;
  color: #7c2d12;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 20;
}

.recovery-notice p {
  margin: 0 0 0.6rem;
}

.recovery-actions {
  display: flex;
  gap: 0.5rem;
}

.recovery-notice button.secondary {
  background: transparent;
  border: 1px solid #b45309;
  color: #7c2d12;
}
