/* DarkChan web portal — desktop/tablet-first app shell (D-026 IN-6; the
 * layout overhaul the operator asked for: large screens are the primary
 * target, small ones adapt DOWN). No external fonts or assets — the CSP
 * forbids external origins, so a system font stack only. */
:root {
  --bg: #eef0f4;          /* app ground (behind the panes)      */
  --surface: #ffffff;     /* sidebar / chat surface             */
  --surface-2: #f4f6f9;   /* inset rows, composer, code         */
  --rail: #2a2f36;        /* instance bar (always dark)         */
  --rail-fg: #dfe3e8;
  --fg: #1a1d21;
  --muted: #5b6570;
  --border: #d8dde3;
  --accent: #2f6f4f;
  --accent-fg: #ffffff;
  --warn-bg: #fff4e5;
  --warn-fg: #7a4a00;
  --warn-border: #e0a24a;
  --ok: #2f6f4f;
  --err: #b00020;
  --hover: rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  --rail-w: 4.5rem;
  --side-w: 19rem;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317; --surface: #1b1f25; --surface-2: #23282f; --rail: #14171b;
    --rail-fg: #cdd3da; --fg: #e6e8ea; --muted: #9aa4ae; --border: #333b44;
    --accent: #7fc9a3; --accent-fg: #10231a; --warn-bg: #3a2c12;
    --warn-fg: #ffd79a; --warn-border: #7a5a25; --ok: #7fc9a3; --err: #ff6b81;
    --hover: rgba(255, 255, 255, 0.06);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}
* { box-sizing: border-box; }
/* the views below set `display`, which would otherwise beat the UA rule for
 * the `hidden` attribute — app.js toggles views with `hidden`, so make it win */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.7rem; margin: 0.5rem 0 0.25rem; }
h2 { font-size: 1rem; margin: 0 0 0.75rem; }
.tagline { color: var(--muted); margin: 0 0 1.25rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em; }

/* ---- shared controls --------------------------------------------------- */
label { display: block; font-size: 0.85rem; color: var(--muted);
  margin: 0.6rem 0 0.2rem; }
input {
  width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--fg);
  font: inherit;
}
input:focus-visible, button:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button {
  margin-top: 0.9rem; padding: 0.55rem 0.9rem; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-fg); font: inherit;
  font-weight: 600; cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent);
  border: 1px solid var(--accent); }
button.secondary:hover { background: var(--hover); }
button.danger { background: var(--err); color: #ffffff; }
button.compact { margin-top: 0; padding: 0.3rem 0.6rem; font-size: 0.85rem;
  white-space: nowrap; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { margin-top: 0; padding: 0.25rem 0.5rem; background: transparent;
  color: var(--muted); border: 1px solid transparent; font-size: 1.05rem;
  line-height: 1.2; }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row button { margin-top: 0; }
.status { font-size: 0.88rem; margin: 0.4rem 0 0; }
.status:empty { margin: 0; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.pending { color: var(--muted); }

/* ---- sign-in view (centred card stack) --------------------------------- */
.auth-view { min-height: 100%; display: flex; justify-content: center;
  padding: 3rem 1rem; }
.auth-wrap { width: 100%; max-width: 34rem; }
.banner {
  background: var(--warn-bg); color: var(--warn-fg);
  border: 1px solid var(--warn-border); border-radius: var(--radius);
  padding: 0.8rem 0.95rem; margin: 0 0 1.25rem; font-size: 0.9rem;
}
.banner strong { display: block; margin-bottom: 0.2rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem; margin: 0 0 1rem;
  box-shadow: var(--shadow);
}

/* ---- app shell: instance bar | sidebar | conversation ------------------- */
.app { display: flex; height: 100dvh; overflow: hidden; }

/* instance bar (D-026 IN-6) — rendered only when the server has instances */
.inst-bar {
  flex: 0 0 var(--rail-w); width: var(--rail-w); background: var(--rail);
  color: var(--rail-fg); display: flex; flex-direction: column;
  align-items: center; gap: 0.5rem; padding: 0.6rem 0; overflow-y: auto;
  scrollbar-width: none;
}
.inst-bar::-webkit-scrollbar { display: none; }
.inst-btn {
  position: relative; margin: 0; padding: 0; width: 2.9rem; height: 2.9rem;
  border-radius: 30%; background: var(--surface-2); color: var(--fg);
  border: 0; font-weight: 700; font-size: 0.95rem; cursor: pointer;
  display: grid; place-items: center; flex: none;
  transition: border-radius 0.12s ease;
}
.inst-btn:hover { border-radius: 22%; }
/* the avatar is clipped to the icon shape, but the BUTTON must not clip —
 * the unread badge deliberately overhangs its bottom-right corner */
.inst-btn img { width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: inherit; }
.inst-btn.sel { box-shadow: 0 0 0 2px var(--rail), 0 0 0 4px var(--accent); }
/* the left pill marking the selected instance, Discord-style */
.inst-btn.sel::before {
  content: ""; position: absolute; left: -0.6rem; top: 25%; height: 50%;
  width: 0.25rem; border-radius: 0 3px 3px 0; background: var(--accent);
}
.inst-btn.muted { opacity: 0.55; }
.inst-badge {
  position: absolute; right: -0.15rem; bottom: -0.15rem; min-width: 1.05rem;
  height: 1.05rem; padding: 0 0.22rem; border-radius: 0.55rem;
  background: var(--muted); color: var(--rail); font-size: 0.68rem;
  font-weight: 700; line-height: 1.05rem; text-align: center;
  border: 2px solid var(--rail);
}
.inst-badge.mention { background: var(--err); color: #fff; }
.inst-sep { width: 1.8rem; height: 2px; border-radius: 1px;
  background: var(--rail-fg); opacity: 0.3; flex: none; margin: 0.1rem 0; }

/* sidebar */
.sidebar {
  flex: 0 0 var(--side-w); width: var(--side-w); background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  min-height: 0; padding: 0.7rem 0.7rem 0.5rem;
}
.side-head { display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.6rem; }
.side-title { flex: 1; font-weight: 700; font-size: 1.05rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.newdm { display: flex; flex-direction: column; gap: 0.45rem; }
.newdm input { margin: 0; }
.side-foot { margin: 0.5rem 0 0; padding-top: 0.5rem;
  border-top: 1px solid var(--border); font-size: 0.72rem; color: var(--muted);
  cursor: help; }

/* conversation list */
.conv-list { list-style: none; margin: 0.6rem 0 0; padding: 0; flex: 1;
  min-height: 0; overflow-y: auto; }
.conv { display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.55rem; border-radius: 8px; cursor: pointer; }
.conv:hover { background: var(--hover); }
.conv.sel { background: var(--surface-2); font-weight: 600; }
.conv span:first-child { flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 0.72rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 0 0.4rem; }
/* unread pill on a conversation row: accent, red once you were mentioned */
.conv.unread span:first-child { font-weight: 700; }
.count.new { color: var(--accent-fg); background: var(--accent);
  border-color: var(--accent); font-weight: 700; }
.count.new.mention { background: var(--err); border-color: var(--err);
  color: #fff; }
/* a category header inside an instance's channel list */
.conv-cat { padding: 0.6rem 0.55rem 0.2rem; font-size: 0.72rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  cursor: pointer; user-select: none; }
.conv-cat:hover { color: var(--fg); }
.conv-action { color: var(--accent); }

/* conversation pane */
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--bg); }
.chat-head { display: flex; gap: 0.5rem; align-items: center;
  padding: 0.6rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--surface); }
.chat-head #chat-who { font-weight: 600; flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.back-btn { display: none; } /* narrow screens only */
/* with no conversation open there is nothing to act on */
.chat-main.empty .chat-head { display: none; }
/* the pane's frame: positions the jump-to-latest button over its corner */
.msg-wrap { flex: 1; min-height: 0; position: relative; display: flex;
  flex-direction: column; }
.msg-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; }
/* shown only while the reader is above the newest message */
.to-latest { position: absolute; right: 1rem; bottom: 1rem; margin: 0;
  width: 2.75rem; height: 2.75rem; padding: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); z-index: 2; }
/* the "nothing open" placeholder gets the whole empty pane, centred */
.msg-pane > .status:only-child { height: 100%; display: grid;
  place-items: center; text-align: center; margin: 0; }
.composer { display: flex; gap: 0.5rem; align-items: center;
  padding: 0.7rem 1rem; border-top: 1px solid var(--border);
  background: var(--surface); }
/* the composer is a textarea (multi-line messages: lists, code blocks,
 * tables): Enter sends, Shift+Enter adds a line, and it grows with the text
 * up to ~8 lines (app.js growComposer) before it scrolls */
.composer #composer-text { flex: 1; margin: 0; width: 100%;
  padding: 0.55rem 0.65rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--fg);
  font: inherit; line-height: 1.35; resize: none; overflow-y: auto;
  max-height: calc(8 * 1.35em + 1.1rem); }
.composer { align-items: flex-end; }
.composer button { margin-top: 0; }
#send-status { padding: 0 1rem 0.4rem; }
#send-status:empty { padding: 0; }

/* ---- messages ---------------------------------------------------------- */
.msg { margin-bottom: 0.6rem; max-width: min(70ch, 100%); }
.msg-who { display: block; font-size: 0.75rem; color: var(--muted); }
.msg-text { display: block; white-space: pre-wrap; word-break: break-word; }
.msg.dim .msg-text { color: var(--muted); font-style: italic; }
/* bubble actions: SVG icons (app.js svgIcon), never font glyphs. Visible at
 * rest -- a touch screen has no hover, and at 45% opacity of a muted colour
 * they were close to invisible there. margin-top resets the global button
 * rule, which pushed them below the bubble. */
.msg-act { margin: 0 0 0 0.3rem; padding: 0.2rem 0.3rem; font-size: 1rem;
  line-height: 1; color: var(--muted); background: none; border: none;
  border-radius: 6px; cursor: pointer; opacity: 0.85;
  display: inline-flex; align-items: center; vertical-align: middle; }
.msg-act:hover { background: var(--hover); }
.msg:hover .msg-act { opacity: 1; }
.msg-act:hover { opacity: 1; }
.msg-del:hover { color: var(--err); }
.msg-act.on { opacity: 1; } /* the quick 👍 once it is yours */
/* a reply's quoted-message preview inside the bubble */
.msg-quote { border-left: 3px solid var(--border); padding: 0.1rem 0 0.1rem 0.5rem;
  margin: 0 0 0.25rem; color: var(--muted); font-size: 0.85rem;
  white-space: pre-wrap; word-break: break-word; }
/* the "Replying to …" bar above the composer */
.reply-bar { display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 1rem; border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent); background: var(--surface-2);
  font-size: 0.85rem; }
.reply-bar .reply-to { flex: 1; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
/* reaction chips under a message bubble */
.reactions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.2rem; }
.reaction { font-size: 0.8rem; padding: 0.05rem 0.4rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); cursor: pointer; }
.reaction.mine { border-color: var(--accent); color: var(--fg); }
/* own messages */
.msg.mine { margin-left: auto; text-align: right; }
.msg.mine .msg-text {
  display: inline-block; max-width: 100%; text-align: left;
  background: var(--accent); color: var(--accent-fg); border-radius: 12px;
  padding: 0.35rem 0.65rem; }
.msg.mine.dim .msg-text { background: none; color: var(--muted); }
/* buttons inside OUR bubble (voice ▶, Download, View): the bubble is the
 * accent colour, so the accent-outlined button was drawn accent on accent --
 * the "invisible play button" -- and takes the bubble's text colour here */
.msg.mine .msg-text button.secondary { color: var(--accent-fg);
  border-color: var(--accent-fg); }
.msg.mine .msg-text button.secondary:hover {
  background: rgba(127, 127, 127, 0.25); }
/* rendered Markdown (§16): tight blocks inside a bubble */
.msg-text p { margin: 0; }
.msg-text p + p, .msg-text pre, .msg-text blockquote, .msg-text ul,
.msg-text ol { margin: 0.35rem 0 0; }
.msg-text code { font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9em; background: var(--surface-2); padding: 0 0.25em;
  border-radius: 3px; }
.msg-text pre { white-space: pre-wrap; background: var(--surface-2);
  padding: 0.4rem 0.55rem; border-radius: 5px; overflow-x: auto; }
.msg-text pre code { background: none; padding: 0; }
.msg-text blockquote { border-left: 3px solid var(--muted); margin-left: 0;
  padding-left: 0.6rem; color: var(--muted); }
.msg-text ul, .msg-text ol { padding-left: 1.3rem; }
.msg-text a { color: inherit; text-decoration: underline; }
/* D-053 headings: scaled modestly -- they live inside a chat bubble */
.msg-text .md-h { margin: 0.35rem 0 0.1rem; line-height: 1.25;
  font-weight: 700; }
.msg-text .md-h:first-child { margin-top: 0; }
.msg-text .md-h1 { font-size: 1.3em; }
.msg-text .md-h2 { font-size: 1.2em; }
.msg-text .md-h3 { font-size: 1.1em; }
.msg-text .md-h4, .msg-text .md-h5, .msg-text .md-h6 { font-size: 1em; }
/* D-053 pipe tables: the wrapper scrolls a wide table inside the bubble
 * instead of widening the page; alignment comes as a class, never an inline
 * style (CSP) */
.msg-text .md-table-wrap { margin: 0.35rem 0 0; max-width: 100%;
  overflow-x: auto;
  /* the table's own bar is replaced by the sticky .md-hbar below */
  scrollbar-width: none; }
.msg-text .md-table-wrap::-webkit-scrollbar { display: none; }
/* D-055: each column as wide as its widest cell on one line, capped near
 * the widest a bubble gets (a longer cell wraps inside it); a table wider
 * than its bubble scrolls instead of being squeezed. NOT container query
 * units: container-type gives the wrapper inline-size containment, so OUR
 * bubble -- an inline-block sized to its content -- collapsed to ~20 px and
 * squeezed every column to a sliver (2026-10-05) */
.msg-text .md-table { border-collapse: collapse; font-size: 0.92em;
  width: max-content; }
.msg-text .md-table th, .msg-text .md-table td {
  border: 1px solid var(--border); padding: 0.15rem 0.45rem;
  text-align: left; vertical-align: top; white-space: normal;
  word-break: normal; overflow-wrap: anywhere; max-width: min(60ch, 80vw); }
/* the sticky horizontal bar of a table wider than its bubble: under the
 * table, or riding the bottom of the view while the table runs past it */
.msg-text .md-hbar { position: sticky; bottom: 0; overflow-x: auto;
  overflow-y: hidden; height: 14px; max-width: 100%;
  background: var(--bg); } /* opaque: rows pass under it while it sticks */
.msg.mine .msg-text .md-hbar { background: var(--accent); }
.msg-text .md-hbar > div { height: 1px; }
.msg-text .md-hbar[hidden] { display: none; }
.msg-text .md-table th { background: var(--surface-2); font-weight: 600; }
.msg-text .md-table .md-al-center { text-align: center; }
.msg-text .md-table .md-al-right { text-align: right; }
.msg.mine .msg-text .md-table th, .msg.mine .msg-text .md-table td {
  border-color: rgba(255, 255, 255, 0.45); }
.msg.mine .msg-text .md-table th { background: rgba(255, 255, 255, 0.22);
  color: inherit; }
/* inside our own (accent-filled) bubble the neutral surfaces would vanish —
 * tint them against the accent instead */
.msg.mine .msg-text code, .msg.mine .msg-text pre {
  background: rgba(255, 255, 255, 0.22); color: inherit; }
.msg.mine .msg-text blockquote { border-left-color: currentColor;
  color: inherit; opacity: 0.85; }
/* attachment Download button */
.dl-btn { margin: 0; padding: 0.15rem 0.55rem; font-size: 0.82rem;
  vertical-align: baseline; }

/* ---- overlay panel (channels / manage / requests / instance screens) ---- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex;
  align-items: center; justify-content: center; padding: 1.5rem;
  background: rgba(0, 0, 0, 0.45); }
.overlay-card { width: min(46rem, 100%); max-height: min(80vh, 44rem);
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); }
.channel-head { display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.6rem; }
.channel-head strong { flex: 1; font-size: 1.05rem; }
.channel-list { list-style: none; margin: 0; padding: 0; overflow-y: auto;
  flex: 1; min-height: 0; }
.channel-list li { display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap; padding: 0.5rem 0.15rem;
  border-top: 1px solid var(--border); }
.channel-list li:first-child { border-top: 0; }
.channel-list li span { flex: 1; min-width: 8rem; }
.channel-list li input { flex: 1; min-width: 10rem; width: auto; margin: 0; }
.channel-list li button { margin-top: 0; padding: 0.3rem 0.6rem;
  font-size: 0.85rem; white-space: nowrap; }
/* a one-time invite link: monospace, selectable, on its own full-width row */
.channel-list li .invite-link, .channel-list li .panel-note {
  flex: 1 0 100%; min-width: 0; }
.invite-link { font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem;
  word-break: break-all; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.5rem;
  user-select: all; }
.panel-note { font-size: 0.82rem; color: var(--muted); }

/* search results: a two-line row (where it was, then the matching text), each
 * line full-width so a long snippet wraps under its heading rather than
 * squeezing it. The whole row is the click target. */
#search-input { width: 100%; margin: 0 0 0.4rem; }
#search-list li { cursor: pointer; flex-direction: column;
  align-items: stretch; gap: 0.15rem; }
#search-list li:hover { background: var(--surface-2); }
#search-list li span { flex: 1 0 100%; min-width: 0; }
.search-head { font-size: 0.85rem; }
.search-snippet { font-size: 0.82rem; color: var(--muted);
  overflow-wrap: anywhere; }

/* ---- responsive: tablet, then phone ------------------------------------ */
@media (max-width: 1100px) {
  :root { --side-w: 16rem; }
}
@media (max-width: 780px) {
  :root { --rail-w: 3.6rem; }
  .inst-btn { width: 2.4rem; height: 2.4rem; font-size: 0.8rem; }
  .auth-view { padding: 1.5rem 0.9rem; }
  /* one pane at a time: the list, or the open conversation */
  .sidebar { flex: 1 1 auto; width: auto; border-right: 0; }
  .chat-main { display: none; }
  .app.show-chat .sidebar { display: none; }
  .app.show-chat .inst-bar { display: none; }
  .app.show-chat .chat-main { display: flex; }
  .back-btn { display: block; }
  /* the header's action buttons wrap to a second row instead of squeezing the
     conversation title out of existence */
  .chat-head { flex-wrap: wrap; }
  .chat-head #chat-who { flex: 1 1 8rem; }
  .msg-pane { padding: 0.8rem; }
  .chat-head, .composer { padding-left: 0.7rem; padding-right: 0.7rem; }
  .overlay { padding: 0.6rem; }
  .overlay-card { max-height: 90vh; }
}
/* an emoji sprite from a verified atlas page (darkchan_emoji.js, item 17) */
.emoji { display: inline-block; width: 1.35em; height: 1.35em;
  vertical-align: -0.3em; background-repeat: no-repeat; }
/* voice notes and inline images (item 17) */
.voice-btn { min-width: 2.2rem; display: inline-flex; align-items: center;
  justify-content: center; }
.dl-btn { display: inline-flex; align-items: center; gap: 0.25rem; }
.voice-wave { display: inline-flex; align-items: center; gap: 1px;
  height: 1.6em; vertical-align: middle; margin: 0 0.4rem; }
.voice-bar { display: inline-block; width: 2px; background: currentColor;
  opacity: 0.7; }
.msg-image { max-width: min(100%, 360px); max-height: 360px;
  border-radius: 8px; margin-top: 0.4rem; display: block; cursor: zoom-in; }
/* the full-size viewer (TODO 28). The picture is centred with margin:auto,
   not by the flex alignment .overlay uses: centring by alignment clips the
   top and left of anything bigger than the window, out of scroll reach. */
.image-viewer { padding: 0; background: rgba(0, 0, 0, 0.9); overflow: auto;
  align-items: flex-start; justify-content: flex-start; cursor: zoom-out; }
.image-viewer img { margin: auto; display: block; max-width: 100vw;
  max-height: 100vh; max-height: 100dvh; cursor: zoom-out; }
/* scaled down to fit: a click shows it at 100 % (and scrolls) */
.image-viewer.fits-less img { cursor: zoom-in; }
.image-viewer.actual img { max-width: none; max-height: none;
  cursor: zoom-out; }
.image-viewer-close { position: fixed; top: 0.7rem; right: 0.7rem; margin: 0;
  width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%;
  display: grid; place-items: center; z-index: 21;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 1.2rem; }

/* the inline SVG icon set (app.js ICONS) */
svg.icon { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.15em; flex: none; }

/* the emoji picker (composer button + React) */
.emoji-card { width: min(28rem, 100%); }
.emoji-card #emoji-search { margin: 0 0 0.6rem; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, 2.6rem);
  gap: 0.25rem; overflow-y: auto; flex: 1; min-height: 8rem;
  justify-content: center; }
.emoji-grid .status { grid-column: 1 / -1; }
.emoji-cell { margin: 0; padding: 0.3rem; width: 2.6rem; height: 2.6rem;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; }
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--hover);
  border-color: var(--border); }
.emoji-cell .emoji { width: 1.9rem; height: 1.9rem; vertical-align: 0; }
/* swipe right to reply (touch): the row follows the finger, pan-y keeps the
 * vertical scroll native, and past the threshold an accent bar says
 * "release to reply" */
.msg { touch-action: pan-y; transition: transform 0.15s ease-out; }
.msg.swiping { transition: none; }
.msg.swipe-armed { box-shadow: -4px 0 0 0 var(--accent); }
/* the record button while recording, and the composer's recording strip */
#record-btn.recording { color: var(--err); border-color: var(--err); }
.rec-time { font-variant-numeric: tabular-nums; color: var(--err);
  min-width: 3.2rem; }

/* "#channel" chips and "@mentions" (D-053) */
.md-chip { color: var(--accent); font-weight: 600; text-decoration: none; }
.md-chip:hover { text-decoration: underline; }
.md-mention { color: var(--accent); font-weight: 600; }
.md-mention.me { color: var(--warn-fg); background: var(--warn-bg);
  border-radius: 4px; padding: 0 0.15em; }
/* on OUR bubble (the accent fill) a link, a chip or a mention keeps the
 * bubble's text colour and is underlined: accent on accent vanished */
.msg.mine .msg-text a, .msg.mine .msg-text .md-mention {
  color: inherit; text-decoration: underline; }
.msg.mine .msg-text .md-mention.me { background: none; }
