/* The chat page: the voice IME's tokens, buttons and dark mode (../ime.css), plus bubbles and
   three switches (which Gemma answers, where OmniVoice speaks, in which voice). */

.chat .top { flex-wrap: wrap; row-gap: 8px; }
.chat .top > .icon-btn { margin-left: -8px; }
/* It may shrink so its rows wrap: unshrinkable, the three rows ran off a 560–800px screen. */
.switches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; flex: 0 1 auto; }
.switch-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.switch-label { flex: none; font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.chat .switch-row .hw { order: 0; flex: 0 1 auto; }
.chat .hw button { min-width: 52px; }
/* The voices come from the server: an empty row keeps its size until they do. */
.chat #voice-hw:empty { min-height: 44px; min-width: 162px; }
/* A phone: each switch takes a row of its own under the title, buttons sharing the width. */
@media (max-width: 559px) {
  .switches { order: 3; flex-basis: 100%; flex-direction: column; gap: 6px; }
  .switch-row { width: 100%; }
  .chat .switch-row .hw { flex: 1 1 auto; }
  .chat .hw button { flex: 1; min-width: 0; }
}

.intro, .msg {
  max-width: 86%; margin: 0; padding: 9px 14px; font-size: 16px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.intro, .msg.bot {
  align-self: flex-start; border-radius: 18px 18px 18px 6px; background: var(--paper);
  box-shadow: 0 1px 0 var(--line);
}
.intro { color: var(--muted); }
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg p { margin: 0; }
.msg p span { display: block; }
.msg p span + span { margin-top: 6px; }
.msg.user { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--accent); color: var(--accent-ink); }
/* Tapping one of her answers says it again. */
.msg.bot { color: var(--ink); cursor: pointer; transition: box-shadow .2s; -webkit-tap-highlight-color: transparent; }
.msg.bot small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.msg.bot small:empty { display: none; }
.msg.bot.waiting { cursor: default; }
.msg.bot.waiting p:empty::after { content: "…"; animation: blink 1s steps(2) infinite; }
.msg.bot.speaking { animation: speak 1.6s ease-in-out infinite; }
.msg.bot.failed p { color: var(--muted); }
.msg.bot.failed small { color: var(--warn); }
.msg.bot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes speak {
  0%, 100% { box-shadow: 0 1px 0 var(--line), 0 0 0 0 var(--fresh); }
  50% { box-shadow: 0 1px 0 var(--line), 0 0 0 4px var(--fresh); }
}

.chat .status { margin-bottom: 8px; }
.composer-bar {
  display: flex; align-items: flex-end; gap: 8px; margin: 0 0 10px; padding: 4px 4px 4px 16px;
  border-radius: 24px; background: var(--paper); box-shadow: 0 1px 0 var(--line), 0 8px 28px rgb(40 52 42 / 5%);
}
.composer-bar textarea {
  flex: 1; min-width: 0; max-height: 132px; margin: 0; padding: 9px 0; border: 0; outline: none; resize: none;
  background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.6;
}
.composer-bar textarea::placeholder { color: var(--muted); }
.composer-bar:focus-within { box-shadow: 0 0 0 2px var(--accent), 0 8px 28px rgb(40 52 42 / 5%); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
