#chatRoot {
  --chat-cyan: #67e8f9;
  --chat-purple: #a5a0ff;
  --chat-text: #f1f3fa;
  --chat-muted: #b0b6c8;
  --chat-line: rgba(161, 172, 204, .19);
  width: min(1520px, 100%);
  margin: clamp(22px, 3vw, 38px) auto 0;
  color: var(--chat-text);
  font: inherit;
}

#chatRoot[hidden], #chatRoot [hidden] { display: none !important; }
#chatRoot * { box-sizing: border-box; }
#chatRoot .abchat-panel {
  overflow: hidden;
  border: 1px solid var(--chat-line);
  border-radius: 20px;
  background: radial-gradient(ellipse at 100% 0, rgba(104, 76, 177, .16), transparent 60%), #191d26;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .23);
}
#chatRoot .abchat-panel.is-admin-only { border-radius: 12px; background: #191e28; box-shadow: none; }
#chatRoot .abchat-panel.is-admin-only .abchat-admin { border-top: 0; background: none; }
#chatRoot .abchat-panel.is-admin-only .abchat-admin > summary { padding: 16px 20px; }
#chatRoot .abchat-panel.is-admin-only .abchat-admin-content { padding: 0 20px 20px; }
#chatRoot .abchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(18px, 2.5vw, 28px);
  background: linear-gradient(110deg, rgba(103, 232, 249, .035), rgba(165, 160, 255, .06));
}
#chatRoot .abchat-kicker {
  color: var(--chat-cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
#chatRoot h2 { margin: 0; font-size: clamp(23px, 2.4vw, 30px); letter-spacing: -.035em; }
#chatRoot h3 { margin: 0 0 16px; font-size: 17px; line-height: 1.4; }
#chatRoot .abchat-header-actions, #chatRoot .abchat-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
#chatRoot .abchat-availability { color: var(--chat-muted); font-size: 12px; padding: 8px 11px; border: 1px solid var(--chat-line); border-radius: 999px; white-space: nowrap; }
#chatRoot .abchat-sound-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; padding: 3px 10px 3px 3px; border: 1px solid var(--chat-line); border-radius: 12px; background: #151a2399; }
#chatRoot .abchat-sound-controls > .abchat-help { max-width: 210px; }
#chatRoot .abchat-sound[aria-checked="true"] { border-color: var(--chat-cyan); color: var(--chat-cyan); }
#chatRoot .abchat-availability::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: #8890a6;
  content: '';
}
#chatRoot .abchat-availability.is-online::before { background: var(--chat-cyan); box-shadow: 0 0 10px #67e8f933; }
#chatRoot .abchat-button {
  min-height: 44px;
  border: 1px solid #53596e;
  border-radius: 9px;
  padding: 10px 16px;
  background: #2b2e3d;
  color: var(--chat-text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  touch-action: manipulation;
}
#chatRoot .abchat-button:hover:not(:disabled) { border-color: var(--chat-purple); background: #34364c; }
#chatRoot .abchat-button:disabled { opacity: .5; cursor: not-allowed; }
#chatRoot .abchat-button:focus-visible, #chatRoot .abchat-input:focus-visible,
#chatRoot summary:focus-visible, #chatRoot .abchat-messages:focus-visible, #chatRoot .abchat-message:focus-visible {
  outline: 2px solid var(--chat-cyan);
  outline-offset: 3px;
}
#chatRoot .abchat-primary { border-color: #61788d; color: #d3faff; background: linear-gradient(110deg, #1c4654, #37334f); }
#chatRoot .abchat-subtle { border-color: transparent; background: transparent; color: #c7c8df; }
#chatRoot .abchat-leave { flex-shrink: 0; min-width: 145px; border-color: #bd7d95; color: #ffe0e8; background: #492d3d; }
#chatRoot .abchat-leave::before { content: '↪'; margin-right: 9px; font-size: 16px; }
#chatRoot .abchat-leave:hover:not(:disabled) { border-color: #ffb6ca; background: #603449; }
#chatRoot .abchat-send { min-width: 116px; }
#chatRoot .abchat-voice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(18px, 2.5vw, 28px) 20px;
}
#chatRoot .abchat-mic { flex-shrink: 0; border-color: #7d72b6; background: #39314f; }
#chatRoot .abchat-mic::before { margin-right: 9px; content: '●'; color: var(--chat-purple); }
#chatRoot .abchat-mic[data-state="active"] { background: #503041; border-color: #e489b4; }
#chatRoot .abchat-mic[data-state="active"]::before { color: #ffbad8; }
#chatRoot .abchat-mic[data-state="starting"]::before { color: #fbd38d; }
#chatRoot .abchat-help { margin: 0; color: var(--chat-muted); font-size: 12px; line-height: 1.65; }
#chatRoot .abchat-notice { margin: 0; padding: 0 28px 16px; color: var(--chat-cyan); font-size: 13px; line-height: 1.5; }
#chatRoot .abchat-notice:empty { display: none; }
#chatRoot .is-error { color: #ffb6ba !important; }
#chatRoot .abchat-conversation { border-top: 1px solid var(--chat-line); }
#chatRoot .abchat-join { max-width: 580px; margin: 0 auto; padding: clamp(22px, 3vw, 36px); }
#chatRoot .abchat-join-prompt { padding: 22px; border-top: 1px solid var(--chat-line); background: #191e28; text-align: center; }
#chatRoot .abchat-join-prompt .abchat-button { width: min(100%, 300px); }
#chatRoot .abchat-join-form { display: grid; gap: 16px; margin: 0; }
#chatRoot .abchat-join-form h3 { margin-bottom: 2px; }
#chatRoot .abchat-join-form > .abchat-subtle { justify-self: start; border-color: var(--chat-line); }
#chatRoot .abchat-join-form .abchat-actions { justify-content: space-between; margin-top: 4px; }
#chatRoot .abchat-join-notice:empty { display: none; }
#chatRoot .abchat-join-notice:not(:empty) { margin-top: 12px; padding: 12px; border: 1px solid #9a6073; border-radius: 9px; background: #3b2531; }
#chatRoot .abchat-field { display: flex; min-width: 0; flex-direction: column; gap: 8px; color: #d2d7e6; font-size: 13px; }
#chatRoot .abchat-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid #485166;
  border-radius: 9px;
  background: #141820;
  color: var(--chat-text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}
#chatRoot .abchat-input::placeholder { color: #929aac; opacity: 1; }
#chatRoot .abchat-identity { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 22px; border-top: 1px solid #486170; background: linear-gradient(100deg, #1f3440, #29293e); font-size: 13px; }
#chatRoot .abchat-identity > span { min-width: 0; overflow-wrap: anywhere; color: #dbf8ff; font-weight: 700; line-height: 1.55; }
#chatRoot .abchat-messages { position: relative; height: clamp(240px, 40vh, 460px); overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #525a73 transparent; scrollbar-gutter: stable; padding: clamp(16px, 2.5vw, 28px); background: #111620; }
#chatRoot .abchat-message-list { list-style: none; padding: 0; margin: 0 auto; max-width: 1100px; }
#chatRoot .abchat-presence { max-width: 100%; margin: 16px auto; padding: 4px 12px; color: #acb5c8; background: none; border: 0; text-align: center; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; cursor: default; }
#chatRoot .abchat-message { width: fit-content; min-width: min(180px, 100%); padding: 13px 16px; margin-bottom: 14px; max-width: min(88%, 880px); border: 1px solid var(--chat-line); border-radius: 4px 16px 16px; background: #222b3a; }
#chatRoot .abchat-message.is-own { margin-left: auto; border-radius: 16px 4px 16px 16px; border-color: #585178; background: #302d47; }
#chatRoot .abchat-message.is-direct { border-left: 3px solid #67bacb; }
#chatRoot .abchat-message.is-replyable { cursor: pointer; }
#chatRoot .abchat-message.is-replyable:hover { border-color: #8d88ba; }
#chatRoot .abchat-message-reply { display: block; margin-top: 10px; padding: 8px 11px; min-height: 36px; border-color: #625d83; color: #ded9ff; background: #28273c; font-size: 12px; text-align: left; }
#chatRoot .abchat-message:last-child { margin-bottom: 0; }
#chatRoot .abchat-message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 12px; }
#chatRoot .abchat-message-meta strong { min-width: 0; color: #c8c3ff; overflow-wrap: anywhere; }
#chatRoot .abchat-message-meta time { flex-shrink: 0; color: #a4adc2; font-size: 11px; }
#chatRoot .abchat-message-text { margin: 7px 0 0; font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
#chatRoot .abchat-message-route { display: block; margin-top: 5px; color: var(--chat-cyan); font-size: 11px; overflow-wrap: anywhere; }
#chatRoot .abchat-empty { display: grid; place-items: center; min-height: 150px; margin: 0; color: var(--chat-muted); text-align: center; font-size: 14px; }
#chatRoot .abchat-composer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 250px); gap: 18px; padding: 20px 22px 22px; border-top: 1px solid var(--chat-line); background: #191e28; }
#chatRoot .abchat-compose-main { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
#chatRoot .abchat-compose-aside { display: flex; min-width: 0; flex-direction: column; gap: 16px; padding-left: 18px; border-left: 1px solid var(--chat-line); }
#chatRoot .abchat-compose-aside .abchat-send { width: 100%; min-width: 0; margin-top: auto; }
#chatRoot .abchat-destination { width: 100%; }
#chatRoot .abchat-destination select { color-scheme: dark; cursor: pointer; }
#chatRoot .abchat-destination .abchat-help:empty { display: none; }
#chatRoot .abchat-textarea { display: block; min-height: 104px; max-height: 240px; resize: vertical; }
#chatRoot .abchat-composer-actions { display: flex; align-items: center; gap: 10px; }
#chatRoot .abchat-count { margin-left: auto; color: var(--chat-muted); font-size: 11px; }
#chatRoot .abchat-emoji-picker { position: fixed; z-index: 10000; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 24px)); height: min(420px, calc(100vh - 24px)); min-width: 0; padding: 10px; overflow: hidden; border: 1px solid #65718c; border-radius: 14px; background: #191e28; box-shadow: 0 20px 65px #000a; }
#chatRoot .abchat-picker-toolbar { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 10px; padding-left: 6px; color: #d5d1f4; font-size: 13px; font-weight: 700; }
#chatRoot .abchat-picker-toolbar .abchat-button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
#chatRoot .abchat-emoji-picker > .abchat-help:empty { display: none; }
#chatRoot .abchat-emoji-picker > .abchat-help:not(:empty) { margin-bottom: 10px; }
#chatRoot .abchat-emoji-picker emoji-picker {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  --background: #191e28;
  --border-color: #485166;
  --border-radius: 10px;
  --indicator-color: #67e8f9;
  --outline-color: #67e8f9;
  --input-border-color: #65718c;
  --input-font-color: #f1f3fa;
  --input-placeholder-color: #b0b6c8;
  --category-font-color: #c9c4f8;
  --button-hover-background: #34364c;
  --button-active-background: #41405a;
  --num-columns: 8;
}
#chatRoot .abchat-admin { border-top: 1px solid var(--chat-line); background: rgba(113, 92, 173, .045); }
#chatRoot .abchat-admin > summary { padding: 18px 26px; color: #c9c4f8; font-size: 13px; font-weight: 700; cursor: pointer; }
#chatRoot .abchat-admin-content { display: grid; gap: 18px; padding: 0 26px 26px; }
#chatRoot .abchat-admin-voice-help { padding: 12px 14px; border: 1px solid var(--chat-line); border-radius: 9px; background: #202430; overflow-wrap: anywhere; }
#chatRoot .abchat-admin-toggle { display: flex; align-items: center; justify-content: space-between; gap: 15px; font-size: 14px; }
#chatRoot .abchat-admin-toggle [aria-pressed="true"] { color: var(--chat-cyan); border-color: #4e8992; }
#chatRoot .abchat-allowed-form { display: flex; align-items: end; gap: 12px; }
#chatRoot .abchat-allowed-form .abchat-field { flex: 1; }
#chatRoot .abchat-email-list, #chatRoot .abchat-participants { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
#chatRoot .abchat-email-row, #chatRoot .abchat-participant { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--chat-line); border-radius: 9px; padding: 10px 14px; background: #202430; }
#chatRoot .abchat-email-row > span { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
#chatRoot .abchat-participant-copy { display: grid; min-width: 0; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }
#chatRoot .abchat-participant-copy > span { color: var(--chat-muted); font-size: 12px; }
#chatRoot .abchat-admin-content h3 { margin: 8px 0 0; font-size: 15px; }
#chatRoot .abchat-admin-content .abchat-notice { padding: 0; }
#chatRoot .abchat-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; }

@media (max-width: 680px) {
  #chatRoot .abchat-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  #chatRoot .abchat-header-actions { width: 100%; justify-content: flex-start; gap: 10px; }
  #chatRoot .abchat-voice { align-items: stretch; flex-direction: column; gap: 10px; }
  #chatRoot .abchat-voice .abchat-button { width: 100%; }
  #chatRoot .abchat-identity { padding: 14px; flex-wrap: wrap; gap: 12px; }
  #chatRoot .abchat-identity > span { flex: 1 1 140px; }
  #chatRoot .abchat-messages { padding: 14px; }
  #chatRoot .abchat-message { padding: 12px; }
  #chatRoot .abchat-composer { grid-template-columns: minmax(0, 1fr); padding: 16px 14px; }
  #chatRoot .abchat-compose-aside { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--chat-line); }
  #chatRoot .abchat-admin > summary { padding: 18px; }
  #chatRoot .abchat-admin-content { padding: 0 18px 20px; }
  #chatRoot .abchat-allowed-form { flex-direction: column; align-items: stretch; }
  #chatRoot .abchat-participant { align-items: stretch; flex-direction: column; gap: 10px; }
  #chatRoot .abchat-notice { padding: 0 18px 14px; }
}

@media (max-width: 440px) {
  #chatRoot .abchat-sound-controls { width: 100%; }
  #chatRoot .abchat-identity > span { flex-basis: 100%; }
  #chatRoot .abchat-leave { width: 100%; }
  #chatRoot .abchat-message { max-width: 96%; }
  #chatRoot .abchat-send { min-width: 88px; }
  #chatRoot .abchat-emoji-picker emoji-picker {
    --num-columns: 6;
    --emoji-size: 1.25rem;
    --emoji-padding: .375rem;
    --category-emoji-size: 1.125rem;
    --category-emoji-padding: .25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #chatRoot .abchat-button { transition: none; }
}
