/* Composer and popovers share the palette of the active chat theme. */
.chat-modal, #chat-person-menu, #shore-sticker-menu, .vg-mention-list {
  --menu-paper: #fffaf0; --menu-line: #dbcfad; --menu-ink: #344f43;
  --menu-muted: #6c6958; --menu-active: #ecebd8; --menu-accent: #497563;
}
.chat-dark :is(.chat-modal, #chat-person-menu, #shore-sticker-menu, .vg-mention-list) {
  --menu-paper: #202d40; --menu-line: #47596e; --menu-ink: #eef2f7;
  --menu-muted: #c1ccdc; --menu-active: #344860; --menu-accent: #a3d4c8;
}
#modal-root .chat-modal #shore-chat-form { position:relative; overflow:visible }
#modal-root .chat-modal #shore-chat-form .join-row {
  display:grid!important; grid-template-columns:minmax(0, 1fr) 36px 36px!important;
  gap:5px!important; align-items:center; position:relative;
}
#shore-chat-form #shore-message { width:100%!important; min-width:0; box-sizing:border-box }
#modal-root #shore-chat-form :is(#shore-chat-send, #shore-sticker-toggle) {
  width:36px!important; min-width:36px!important; height:36px!important; min-height:36px!important; max-height:36px!important; padding:0!important;
  display:grid; place-items:center; box-sizing:border-box; margin:0;
}
#shore-sticker-toggle {
  border:1px solid var(--menu-line); border-radius:8px; background:var(--menu-paper);
  color:var(--menu-accent); cursor:pointer;
}
#shore-sticker-toggle span { display:grid; place-items:center; width:22px; height:16px; border:1.5px solid currentColor; border-radius:4px; font:700 9px/1 Interface,sans-serif; letter-spacing:.2px }
#shore-sticker-toggle[aria-expanded=true] { background:var(--menu-active); border-color:var(--menu-accent) }
#modal-root #shore-chat-form .chat-compose-footer { right:89px!important }
#shore-sticker-picker, #shore-sticker-menu {
  box-sizing:border-box; border:1px solid var(--menu-line); border-radius:12px;
  color:var(--menu-ink); background:var(--menu-paper); box-shadow:0 5px 16px #14231d33;
}
#shore-sticker-picker { position:absolute; z-index:10; inset:auto 0 calc(100% + 3px); padding:7px 9px; }
#shore-sticker-picker header { display:flex; gap:7px; align-items:center; border-bottom:1px solid var(--menu-line); padding-bottom:3px }
#shore-sticker-picker header button {
  padding:4px 8px; border:0; border-radius:5px; background:transparent; color:var(--menu-muted);
  font:600 12px/1.3 Interface,sans-serif;
}
#shore-sticker-picker header button[aria-pressed=true] { color:var(--menu-ink); background:var(--menu-active) }
.chat-sticker-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; padding-top:5px }
.chat-sticker-grid button { display:grid; place-items:center; min-width:0; height:58px; padding:2px; background:transparent; border:1px solid transparent; border-radius:7px; }
.chat-sticker-grid button:disabled { opacity:.58 }
.chat-sticker-grid small { grid-column:1/-1 }
#shore-sticker-picker small { display:block; padding:3px 2px; font:500 11px/1.35 Interface,sans-serif; color:var(--menu-muted) }
#shore-sticker-picker [data-sticker-delay]:empty { display:none }
.chat-sticker-grid img { max-width:100%; width:54px; height:54px; object-fit:contain }
.chat-sticker-message { display:block; width:78px; height:78px; margin:3px 0 3px 2.1em; border:1px solid transparent; padding:2px; border-radius:8px; background:transparent; }
.chat-sticker-message img { display:block; width:100%; height:100%; object-fit:contain }
.chat-sticker-message picture { display:block; width:100%; height:100% }
.chat-sticker-message.is-selected, .chat-sticker-grid button:focus-visible { border-color:var(--menu-accent); background:var(--menu-active) }
#shore-sticker-menu {
  position:fixed; z-index:2100; padding:6px; display:grid; gap:3px; max-height:var(--chat-menu-height,70vh); overflow:auto;
}
#shore-sticker-menu strong { padding:3px 7px 5px; color:var(--menu-muted); border-bottom:1px solid var(--menu-line); font:600 12px/1.3 Interface,sans-serif }
#shore-sticker-menu button { border:0; text-align:left; border-radius:6px; padding:7px; color:var(--menu-ink); background:transparent; font:600 12px/1.3 Interface,sans-serif }
#shore-sticker-menu button:is(:hover,:active,:focus-visible), .chat-sticker-grid button:enabled:hover { background:var(--menu-active) }
#shore-messages :is(.chat-mention,.chat-nick).is-selected { border-radius:3px; box-shadow:0 0 0 1px var(--menu-accent) }
@layer chat-appearance {
  html #chat-person-menu {
    max-height:min(278px,var(--chat-menu-height,70vh))!important; overflow:auto; padding:6px!important;
    background:var(--menu-paper)!important; border:1px solid var(--menu-line)!important;
    box-shadow:0 5px 18px #14231d38!important;
  }
  html #chat-person-menu>strong { color:var(--menu-ink)!important; padding:3px 5px 6px!important }
  html #chat-person-menu>strong::before,html #chat-person-menu>strong::after { background:var(--menu-line)!important }
  html #chat-person-menu>button {
    margin:0; background:transparent!important; color:var(--menu-ink)!important; border:0!important;
    border-radius:5px!important; box-shadow:none!important; min-height:32px!important;
  }
  html #chat-person-menu>button::before { background:var(--menu-accent)!important }
  html #chat-person-menu>button.is-small { color:var(--menu-accent)!important }
  html #chat-person-menu>button:is(:hover,:active,:focus-visible) { color:var(--menu-ink)!important; background:var(--menu-active)!important }
  html.chat-dark #shore-messages .chat-mention { color:#bce0d6!important }
  html.chat-dark #shore-messages .chat-mention.is-me { color:#ffdc9d!important; background:#423b30!important; box-shadow:inset 0 0 0 1px #77654b }
  html #shore-messages :is(.chat-mention,.chat-nick):focus-visible { outline:1px solid var(--menu-accent)!important; outline-offset:1px; border-radius:3px }
}

.chat-modal #shore-sticker-picker { border-radius:11px; padding:6px 8px; }
.chat-sticker-grid button { cursor:pointer; border-radius:7px }
.chat-sticker-grid button:disabled { cursor:default }
.chat-sticker-grid button:enabled:is(:hover,:focus-visible) { border-color:var(--menu-line); background:var(--menu-active) }
.vg-mention-list { background:var(--menu-paper); border-color:var(--menu-line); box-sizing:border-box }
.vg-mention-list button { color:var(--menu-ink) }
.vg-mention-list button b { color:var(--menu-accent) }
.vg-mention-list button:is(.is-active,:hover,:focus-visible) { background:var(--menu-active); color:var(--menu-ink) }
@media (prefers-reduced-motion: no-preference) {
  #shore-sticker-picker { animation:sticker-picker-open .14s ease-out }
  @keyframes sticker-picker-open { from { opacity:0; transform:translateY(3px) } to { opacity:1; transform:none } }
}

.chat-dark .chat-sticker-message { background:radial-gradient(ellipse at center,#4c5e715c 0%,#33465a3d 62%,transparent 78%) }
.chat-dark .chat-sticker-grid button picture { background:radial-gradient(ellipse at center,#6877884d 0%,transparent 72%) }
.chat-dark .chat-sticker-message.is-selected { background:var(--menu-active) }

#modal-root #shore-sticker-picker { position:relative;inset:auto;margin:0 0 5px;box-shadow:none }
#modal-root .chat-modal #shore-messages { display:flex;flex-direction:column;justify-content:flex-start }
#shore-messages>article { flex:none }
#modal-root .chat-modal #shore-messages>article:first-child { margin-top:auto!important }
#shore-sticker-picker [data-sticker-delay] { font-variant-numeric:tabular-nums; font-size:10px; padding:3px 2px 0; }
