.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.mc-chat {
  box-sizing: border-box; width: min(42rem, calc(100% - 2rem)); height: min(42rem, 85dvh);
  max-height: 100dvh; padding: 0; margin: auto; overflow: hidden;
  border: 1px solid var(--mc-line); border-radius: 22px;
  color: var(--mc-text); background: var(--mc-surface);
  font: 400 16px/1.6 var(--mc-font-ui); box-shadow: 0 30px 120px rgba(0, 0, 0, .55);
}
.mc-chat[open] { display: flex; flex-direction: column; }
.mc-chat::backdrop { background: rgba(4, 7, 11, .68); backdrop-filter: blur(6px); }
html:has(.mc-chat[open]) { overflow: hidden; }
.mc-chat__head {
  display: flex; justify-content: space-between; align-items: center; padding: 17px 26px;
  border-bottom: 1px solid var(--mc-line);
}
.mc-chat h2 { margin: 0; font: 400 32px/1.15 var(--mc-font-display); }
.mc-chat button { cursor: pointer; font: inherit; }
.mc-chat__close, .mc-chat__send {
  display: grid; place-items: center; flex: none; padding: 0; width: 44px; height: 44px;
  border-radius: 50%;
}
.mc-chat__close { color: var(--mc-muted); border: 1px solid var(--mc-line); background: transparent; }
.mc-chat__close:hover { border-color: var(--mc-muted); color: var(--mc-text); }
.mc-chat__thread {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px 28px;
  overflow-wrap: anywhere;
}
.mc-chat__question {
  width: fit-content; max-width: 90%; margin: 22px 0 16px auto; padding: 10px 16px;
  background: var(--mc-user-bg); border-radius: 17px 17px 4px 17px; white-space: pre-wrap;
}
.mc-chat__question:first-child { margin-top: 0; }
.mc-chat__answer { white-space: pre-wrap; }
.mc-chat__waiting, .mc-chat__error { color: var(--mc-muted); }
.mc-chat__error button {
  display: block; color: var(--mc-accent); min-height: 44px; margin-top: 4px;
  background: transparent; border: none; padding: 0 4px; text-decoration: underline; text-underline-offset: 3px;
}
.mc-chat__composer {
  display: flex; align-items: flex-end; gap: 10px; padding: 8px; margin: 0 20px 20px;
  border-radius: 24px; border: 1px solid var(--mc-line); background: var(--mc-field);
}
.mc-chat__composer:focus-within { border-color: var(--mc-accent-2); }
.mc-chat__composer[hidden] { display: none; }
.mc-chat__limit:not([hidden]) {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 4px 14px; margin: 0 20px; padding: 10px 14px; border: 1px solid var(--mc-line);
  border-radius: 18px; color: var(--mc-muted); background: var(--mc-field); font-size: 14px;
}
.mc-chat__limit button {
  padding: 4px 0; min-height: 44px; border: 0; background: transparent; color: var(--mc-accent);
  text-decoration: underline; text-underline-offset: 3px;
}
.mc-chat__composer textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 140px; padding: 10px 0 10px 10px;
  resize: none; font: inherit; line-height: 24px; color: inherit; background: transparent; border: none; outline: none;
}
.mc-chat__composer textarea::placeholder { color: var(--mc-muted); }
.mc-chat__send { color: var(--obsidian); background: var(--mc-send-bg); border: 0; }
.mc-chat__send:disabled { opacity: .45; cursor: progress; }
@media (max-width: 600px) {
  .mc-chat { width: 100%; max-width: none; height: min(90dvh, 44rem); margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .mc-chat__head { padding: 14px 18px; }
  .mc-chat__thread { padding: 18px; }
  .mc-chat__composer { margin: 0 12px max(12px, env(safe-area-inset-bottom)); }
}
