:root {
  color-scheme: light;
  font: 100%/1.5 "Avenir Next", "Segoe UI", sans-serif;
  --etna-blue: #246fbf;
  --ink: #172c45;
  --muted: #455f7a;
  --accent: #123f70;
  --accent-hover: #0e3056;
  --bot: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--etna-blue); }
button, input { font: inherit; }
button { cursor: pointer; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.chat {
  height: 100vh;
  height: 100dvh;
}
.chat-body { height: 100%; overflow-y: auto; overscroll-behavior-y: contain; }
.thread {
  --avatar-size: 42px;
  --avatar-space: 54px;
  width: min(100%, 624px);
  margin-inline: auto;
  padding: max(30px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
.chat-brand { margin: 0 0 clamp(27px, 5vh, 43px); }
.chat-brand img { display: block; width: clamp(148px, 28vw, 182px); height: auto; margin-inline: auto; }
.thread noscript { color: #fff; }
.messages { display: grid; gap: 7px; }
.bubble {
  position: relative;
  width: fit-content;
  max-width: min(calc(100% - var(--avatar-space)), 46ch);
  margin: 0 0 0 var(--avatar-space);
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bot);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: appear .19s ease-out both;
}
.bubble.visitor {
  justify-self: end;
  margin: 6px 0;
  background: var(--accent);
  color: #fff;
  border-end-end-radius: 5px;
}
.bubble:first-child:not(.visitor), .visitor + .bubble:not(.visitor) { border-start-start-radius: 5px; }
.bubble:first-child:not(.visitor)::before, .visitor + .bubble:not(.visitor)::before,
.messages:empty + .typing::before, .messages:has(.visitor:last-child) + .typing::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: calc(-1 * var(--avatar-space));
  width: var(--avatar-size);
  height: var(--avatar-size);
  border: 1px solid #ffffffc9;
  border-radius: 50%;
  background: var(--etna-blue) url("./etna-avatar.png") center / cover no-repeat;
}
.bubble a { color: var(--accent); font-weight: 650; text-underline-offset: 3px; }
.bubble a:focus-visible { outline-color: var(--accent); }
.typing {
  position: relative;
  display: flex;
  gap: 5px;
  width: fit-content;
  margin: 7px 0 0 var(--avatar-space);
  padding: 15px;
  background: var(--bot);
  border-radius: 16px;
}
.typing > span[aria-hidden] {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: dot .94s ease-in-out infinite;
}
.typing > span:nth-child(3) { animation-delay: .13s; }
.typing > span:nth-child(4) { animation-delay: .26s; }
.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 8px;
  margin: 11px 0 0 var(--avatar-space);
  animation: appear .2s ease-out both;
}
.choices:empty { display: none; }
.choice {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border: 1px solid #e0eeff;
  border-radius: 12px;
  background: #eff7ff;
  color: var(--accent);
  text-align: start;
  text-decoration: none;
  font-weight: 600;
}
.choice:hover { background: #dcefff; border-color: #dcefff; }
.choice.primary { background: #20623e; border-color: #20623e; color: #fff; }
.choice.primary:hover { background: #184e31; }
.composer {
  display: flex;
  align-items: stretch;
  gap: 8px;
  max-width: 495px;
  margin: 11px 0 0 var(--avatar-space);
  animation: appear .2s ease-out both;
}
.composer input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #d5e5f8;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}
.composer input::placeholder { color: var(--muted); }
.composer button {
  padding-inline: 15px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}
.composer button:hover { background: var(--accent-hover); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@keyframes appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dot {
  0%, 55%, 100% { opacity: .55; transform: translateY(0); }
  27% { opacity: 1; transform: translateY(-3px); }
}
@media (max-width: 480px) {
  .thread { --avatar-size: 36px; --avatar-space: 45px; padding-inline: 12px; }
  .chat-brand img { width: min(220px, 68vw); }
  .choice { padding-inline: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
