/* Conversation-specific visual polish. Layout remains docked in app.css. */
.chatHeader {
  padding: 10px 52px 11px;
  gap: 4px;
  background: rgba(12, 12, 14, 0.97);
  border-bottom-color: #202023;
}
.chatAvatar {
  width: 42px;
  height: 42px;
  border-color: #343438;
}
.chatHeader strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 19px;
}
.chatHeader small {
  font-size: 10px;
  line-height: 14px;
  margin-top: 0;
  color: #929298;
}
#chatRestart {
  top: 23px;
  right: 12px;
  font-size: 21px;
  color: #84848c;
}
.chatThread {
  gap: 12px;
  padding: 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.chatBubble {
  max-width: 88%;
  padding: 11px 14px;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  border-radius: 20px;
}
.chatBubble.anna {
  background: #252528;
  padding-right: 48px;
  border-bottom-left-radius: 6px;
}
.chatBubble.me {
  background: #0a7cf5;
  border-bottom-right-radius: 6px;
}
.chatAudio {
  top: 1px;
  bottom: auto;
  right: 2px;
  color: #b9b9c1;
  display: grid;
  place-items: center;
}
.chatAudio svg,
.chatChoiceAudio svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.chatTranslation {
  display: block;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #414145;
  color: #babac2;
  font-size: 13px;
  line-height: 1.5;
}
.chatAnswers {
  background: #121214;
  border-top-color: #29292c;
  padding: 8px 12px 12px;
  gap: 8px;
}
.chatComposerTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  margin: 0 3px 2px;
}
.chatComposerHeading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}
.chatComposerLabel {
  font-size: 11px;
  font-weight: 550;
  color: #b1b1b8;
  white-space: nowrap;
}
.chatProgress {
  font-size: 10px;
  line-height: 1;
  color: #797982;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chatHint {
  flex-shrink: 0;
  min-height: 36px;
  padding: 6px 0 6px 6px;
  font-size: 11px;
  color: #7aafff;
}
.chatChoiceRow {
  gap: 0;
  align-items: stretch;
  background: #232326;
  border: 1px solid #343438;
  border-radius: 14px;
  overflow: hidden;
}
.chatChoiceRow .chatChoice {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 13px 14px;
  min-height: 50px;
  font-size: 15px;
  line-height: 1.45;
}
.chatChoiceAudio {
  position: relative;
  display: grid;
  place-items: center;
  align-self: stretch;
  flex-basis: 48px;
  width: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #aeb0ba;
  min-height: 50px;
}
.chatChoiceAudio:before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: #3b3b40;
}
.chatChoiceAudio:hover {
  background: #303035;
  color: #fff;
}
.chatChoiceRow:has(.incorrect) {
  border-color: #8c585e;
}
.chatChoiceRow:has(.incorrect) .chatChoice {
  color: #c7a0a4;
  opacity: 0.75;
}
.chatChoiceRow:has(button:focus-visible) {
  outline: 2px solid #7aafff;
  outline-offset: 2px;
}
.chatChoiceRow button:focus-visible {
  outline: none;
  background: #303035;
}
.chatFeedback {
  font-size: 12px;
  color: #c3afb3;
  padding: 4px 3px 0;
  margin: 0;
}
.chatFeedback:empty {
  display: none;
}
@media (max-width: 350px) {
  .chatComposerHeading {
    gap: 6px;
  }
  .chatComposerLabel,
  .chatHint {
    font-size: 10px;
  }
  .chatChoiceRow .chatChoice {
    font-size: 14px;
    padding: 11px 12px;
  }
  .chatBubble {
    font-size: 15px;
  }
  .chatAnswers {
    padding-left: 10px;
    padding-right: 10px;
  }
}
@media (max-height: 600px) {
  .chatHeader {
    flex-direction: row;
    justify-content: center;
    gap: 9px;
    padding: 8px 52px;
    text-align: left;
  }
  .chatAvatar {
    width: 34px;
    height: 34px;
  }
  #chatRestart {
    top: 5px;
  }
  .chatAnswers {
    gap: 6px;
    padding-top: 4px;
  }
  .chatComposerTop {
    min-height: 32px;
  }
  .chatChoiceRow .chatChoice,
  .chatChoiceAudio {
    min-height: 44px;
  }
}

/* Audio feedback stays in the control without shifting the conversation. */
.chatAudio { position: absolute; }
.chatChoiceAudio { position: relative; }
[data-audio-state="loading"] svg { opacity: .35; }
:is(.chatAudio, .chatChoiceAudio)[data-audio-state="loading"]::after {
  content: ""; position: absolute; width: 23px; height: 23px;
  left: 50%; top: 50%; margin: -12px 0 0 -12px;
  border: 1.5px solid transparent; border-top-color: #8ebfff;
  border-right-color: #8ebfff; border-radius: 50%;
  animation: audio-turn .85s linear infinite;
}
[data-audio-state="playing"] { color: #8ebfff; }
[data-audio-state="playing"] svg { animation: audio-breathe 1s ease-in-out infinite; }
@keyframes audio-turn { to { transform: rotate(360deg); } }
@keyframes audio-breathe { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  [data-audio-state] svg, [data-audio-state]::after { animation: none; }
}

/* Audio controls are action buttons, not native pressed/toggle controls. */
.chatAudio, .chatChoiceAudio {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  box-sizing: border-box;
}
@media (hover: none) {
  .chatChoiceAudio:hover { background: transparent; color: #aeb0ba; }
  .chatChoiceAudio[data-audio-state="playing"] { color: #8ebfff; }
}

.avatarButton {
  display: grid; place-items: center; padding: 0; border: 0;
  background: transparent; border-radius: 50%; width: 44px; height: 44px;
  -webkit-appearance: none; appearance: none;
}
.avatarButton .chatAvatar { display: block; }
.profilePhotoDialog {
  position: fixed; inset: 0; margin: 0; padding: 24px;
  width: 100%; height: 100%; max-width: none; max-height: none;
  border: 0; box-sizing: border-box; background: rgba(0,0,0,.94);
  overflow: hidden;
}
.profilePhotoDialog[open] { display: grid; place-items: center; }
.profilePhotoDialog::backdrop { background: rgba(0,0,0,.6); }
.profilePhotoDialog img {
  width: min(82vw, 420px, 72dvh); aspect-ratio: 1; object-fit: cover;
  object-position: center 42%; border-radius: 50%;
  animation: portrait-open .18s ease-out;
}
.profilePhotoClose {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  width: 44px; height: 44px; padding: 0; border: 1px solid #ffffff20;
  border-radius: 50%; background: #222; color: #eee; font-size: 28px;
  display: grid; place-items: center;
}
@keyframes portrait-open { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .profilePhotoDialog img { animation: none; } }

.chatTranslation[hidden] { display: none !important; }
.chatChoice .chatTranslation { margin-top: 4px; padding-top: 0; border: 0; font-size: 12px; font-weight: 400; }
.chatBubble.me .chatTranslation { color: #e0eeff; border-top-color: #ffffff40; }

/* Message history must never compress bubbles as more content arrives. */
.chatBubble { flex: 0 0 auto; box-sizing: border-box; }
.chatAudio:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #7aafff; }
.chatChoiceRow:has(button:focus-visible) { outline: none; box-shadow: inset 0 0 0 2px #7aafff; }
