/* Talk: the voice control is the screen's one primary action; the keyboard is opt-in. */
#chat { --orb: 160px; }
#chat[data-has-messages="true"] { --orb: 72px; }

#keyboard.icon {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
}
#keyboard.icon[aria-pressed="true"] { color: var(--accent); }
#keyboard.icon svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

#voice.talk-voice {
  position: static; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px 0;
}
#chat[data-has-messages="true"] #voice.talk-voice { flex: none; gap: 6px; padding: 6px 0 10px; }

.greeting {
  margin: 0; max-width: 20ch; text-align: center;
  font-size: 1.4rem; line-height: 1.3; font-weight: 600;
}
.greeting[hidden] { display: none; }

#mic.orb {
  position: static; flex: none; display: grid; place-items: center;
  width: var(--orb); height: var(--orb); min-height: 0; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
  transition: width 200ms ease, height 200ms ease, background-color 200ms ease;
}
#mic.orb svg {
  width: 42%; height: 42%; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
#mic.orb:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }

/* Every state changes colour; motion is a second cue, never the only one. */
#voice[data-phase="thinking"] #mic.orb {
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line);
}
#voice[data-phase="speaking"] #mic.orb {
  box-shadow: 0 0 0 4px var(--accent), 0 12px 32px rgb(0 0 0 / 0.18);
}
#voice[data-phase="listening"] #mic.orb { animation: orb-pulse 1.8s ease-in-out infinite; }
#voice[data-phase="thinking"] #mic.orb { animation: orb-breathe 2.8s ease-in-out infinite; }
#voice[data-phase="speaking"] #mic.orb { animation: orb-ring 2s ease-out infinite; }

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes orb-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.94); }
}
@keyframes orb-ring {
  0% { box-shadow: 0 0 0 0 var(--accent), 0 12px 32px rgb(0 0 0 / 0.18); }
  100% { box-shadow: 0 0 0 22px transparent, 0 12px 32px rgb(0 0 0 / 0.18); }
}

@media (prefers-reduced-motion: reduce) {
  #mic.orb { animation: none !important; transition: none !important; }
}

.caption {
  margin: 0; min-height: 1.5em; max-width: 32ch; text-align: center;
  color: var(--muted); font-size: 1rem; line-height: 1.4; overflow-wrap: anywhere;
}
.caption[hidden] { display: none; }

/* The overflow action on a therapist reply stays quiet until it is asked for. */
.flag-row {
  align-self: stretch; display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px; margin-top: -10px;
}
#more {
  min-width: 44px; padding: 0 10px; border: 0; background: none;
  color: var(--muted); font-size: 1.2rem; line-height: 1; letter-spacing: 1px;
}
.flag-menu { display: flex; }
.flag-menu[hidden] { display: none; }
#flag { font-size: 0.95rem; }

#composer[hidden] { display: none; }
