:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #203a36;
  background: #f4f7f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f4f7f5;
}

button, input { font: inherit; }
button:focus-visible, input:focus-visible + .custom-check {
  outline: 3px solid #c08d37;
  outline-offset: 3px;
}

.page-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 18px;
}

.conversation-panel {
  background: #fff;
  border: 1px solid #e0e8e3;
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(34, 69, 57, .08);
  max-width: 680px;
  overflow: hidden;
  padding: clamp(22px, 5vw, 38px);
  width: 100%;
}

.panel-topline {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.conversation-panel-returning .panel-topline { flex-wrap: wrap; }
.conversation-panel-returning .panel-topline > div { min-width: 0; max-width: 100%; }

.eyebrow {
  color: #71867d;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  line-height: 1.4;
  margin: 0 0 7px;
}

h1 {
  color: #203e38;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.08;
  margin: 0;
}

.connection-badge {
  align-items: center;
  background: #f0f4f1;
  border-radius: 999px;
  color: #65776f;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  gap: 8px;
  padding: 8px 11px;
}

.connection-dot {
  background: #99a79f;
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.connection-badge[data-state="connecting"] .connection-dot {
  animation: pulse 1.25s ease-in-out infinite;
  background: #c28a2d;
}
.connection-badge[data-state="connected"] {
  background: #eaf3ed;
  color: #2d604a;
}
.connection-badge[data-state="connected"] .connection-dot { background: #4c936b; }
.connection-badge[data-state="error"] {
  background: #f9eeeb;
  color: #984d43;
}
.connection-badge[data-state="error"] .connection-dot { background: #b95f50; }

.welcome-copy {
  color: #536b63;
  font-size: 15px;
  line-height: 1.5;
  margin: 17px 0 0;
}

.voice-stage {
  align-items: center;
  background: #f6f8f6;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 22px 0 20px;
  min-height: 180px;
  padding: 20px;
  text-align: center;
}

.voice-core {
  align-items: center;
  background: #285b4d;
  border: 5px solid #e7f0ea;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(40, 91, 77, .16);
  color: #fff;
  display: flex;
  height: 64px;
  justify-content: center;
  width: 64px;
}

.voice-symbol {
  font-family: Georgia, serif;
  font-size: 27px;
  line-height: 1;
}

.voice-stage-caption {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.voice-stage-caption span:first-child {
  color: #294c41;
  font-size: 14px;
  font-weight: 650;
}
.voice-stage-caption span:last-child {
  color: #75867e;
  font-size: 12px;
}

.voice-stage[data-state="connected"] .voice-core {
  animation: breathe 2.8s ease-in-out infinite;
  background: #397866;
}
.voice-stage[data-state="speaking"] .voice-core {
  animation: speaking 1.15s ease-in-out infinite;
  background: #b58a3b;
}
.voice-stage[data-state="listening"] .voice-core {
  animation: listening 2.1s ease-in-out infinite;
}
.voice-stage[data-state="muted"] .voice-core {
  background: #8b9b94;
  box-shadow: none;
}

.consent-line {
  align-items: flex-start;
  color: #566b63;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  gap: 10px;
  line-height: 1.5;
}

.consent-line input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.custom-check {
  background: #fff;
  border: 1px solid #b8c7be;
  border-radius: 4px;
  flex: 0 0 17px;
  height: 17px;
  margin-top: 1px;
  position: relative;
}

.consent-line input:checked + .custom-check {
  background: #285b4d;
  border-color: #285b4d;
}
.consent-line input:checked + .custom-check::after {
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  height: 8px;
  left: 5px;
  position: absolute;
  top: 2px;
  transform: rotate(45deg);
  width: 4px;
}

.controls-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: #285b4d; color: #fff; }
.button-primary:hover:not(:disabled) { background: #1c493e; }
.button-secondary { background: #fff; border-color: #dce5df; color: #345c4e; }
.button-secondary:hover:not(:disabled) { background: #f4f8f5; }
.button-end {
  background: transparent;
  border-color: #e3e7e4;
  color: #728079;
  margin-left: auto;
}
.button-end:hover:not(:disabled) { border-color: #d8a69c; color: #9c5146; }
.button-secondary:disabled, .button-end:disabled { display: none; }

.transcript-heading {
  align-items: center;
  border-top: 1px solid #edf1ee;
  color: #425e54;
  display: flex;
  font-size: 11px;
  font-weight: 700;
  justify-content: space-between;
  margin-top: 19px;
  padding: 14px 0 8px;
}

.memory-note {
  color: #87958e;
  font-size: 10px;
  font-weight: 500;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 170px;
  min-height: 48px;
  overflow: auto;
  padding: 4px 1px;
  scrollbar-color: #c7d2cc transparent;
  scrollbar-width: thin;
}

.empty-transcript {
  color: #85938c;
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0;
}

.transcript-line {
  align-self: flex-start;
  background: #f2f6f3;
  border-radius: 3px 10px 10px 10px;
  color: #344e45;
  max-width: 94%;
  padding: 8px 10px;
}
.transcript-line[data-role="assistant"] {
  align-self: flex-end;
  background: #f7f2e8;
  border-radius: 10px 3px 10px 10px;
  color: #5d513b;
}
.transcript-speaker {
  color: #7b8d84;
  display: block;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .08em;
  margin-bottom: 3px;
  text-transform: uppercase;
}
.transcript-text {
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.status-message {
  color: #7b8982;
  font-size: 11px;
  line-height: 1.5;
  margin: 10px 0 0;
}
.status-message[data-kind="error"] { color: #9e4d43; }
.status-message[data-kind="success"] { color: #3f745d; }
#remote-audio { display: none; }

@keyframes pulse {
  50% { opacity: .45; transform: scale(.82); }
}
@keyframes breathe {
  50% { box-shadow: 0 0 0 9px rgba(57, 120, 102, .10), 0 8px 22px rgba(40, 91, 77, .14); }
}
@keyframes speaking {
  50% { box-shadow: 0 0 0 9px rgba(181, 138, 59, .12), 0 8px 22px rgba(40, 91, 77, .14); }
}
@keyframes listening {
  50% { box-shadow: 0 0 0 7px rgba(57, 120, 102, .09), 0 8px 22px rgba(40, 91, 77, .14); }
}

@media (max-width: 520px) {
  .page-shell { padding: 14px; }
  .conversation-panel { border-radius: 16px; padding: 21px 18px; }
  .panel-topline { align-items: flex-start; }
  .connection-badge { font-size: 11px; padding: 7px 9px; }
  .controls-row { align-items: stretch; flex-direction: column; }
  .button { width: 100%; }
  .button-end { margin-left: 0; }
}

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

.timing-details { border-top: 1px solid #edf1ee; margin-top: 16px; padding-top: 12px; color: #566b63; font-size: 11px; line-height: 1.55; }
.timing-details summary { cursor: pointer; width: fit-content; }
.timing-details summary:focus-visible { outline: 3px solid #c08d37; outline-offset: 3px; }
.timing-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; margin: 12px 0; }
.timing-grid dt { margin: 0; }
.timing-grid dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.timing-details p { margin: 8px 0 0; }
.audio-notice { color: #566b63; font-size: 12px; line-height: 1.5; margin: 0; }
