:root {
  --bg: #f6f4ef;
  --rail: #e9e5db;
  --side: #efece5;
  --panel: #ffffff;
  --hover: rgba(0,0,0,.05);
  --active: rgba(0,0,0,.09);
  --text: #1c1a16;
  --muted: #6f6a60;
  --line: #ddd8cc;
  --accent: #966216;       /* a deeper honey than before (#b7791f): white on it 5.2:1, as text 4.7:1 on --bg (both were 3.3-3.6:1) */
  --on-accent: #ffffff;
  --accent-soft: rgba(150,98,22,.14);
  --ok: #1f7a45;   /* (redesign) green and red as text reach 4.5:1 here (they were 3.4 and 4.0:1) */
  --warn: #966216;
  --bad: #c03c3c;
  --badge: #c03c3c;
  --code: rgba(0,0,0,.06);
  --menu-shadow: 0 8px 24px rgba(0,0,0,.18);
  --link: var(--accent);   /* the accent as text (theme.js makes it 4.5:1 for custom themes) */
  --on-bad: #fff; --on-ok: #fff;
  /* scrollbars (see "scrollbars" at the end; theme.js derives the same for every theme) */
  --scroll-thumb: #adaba6; --scroll-thumb-hover: #898783; --scroll-track: transparent;
  --scroll-size: 10px; --scroll-radius: 99px; --scroll-fx: thin;
  color-scheme: light;
  /* design tokens (redesign, 18 Nov): not colours (those stay the theme's), so every theme gets them for free.
     Spacing on a 4 px grid; corner radii; a type scale (page title, section, body, row text, helper, caption);
     the height of a control row. --ctl-line: the edge of a text field, select or colour well, worked out from
     the theme's text and panel colours so it is 3:1 or more on the panel in every theme (WCAG 1.4.11). */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --fs-title: 22px; --fs-sec: 17px; --fs-body: 15px; --fs-row: 14px; --fs-help: 13px; --fs-cap: 12px;
  --ctl-h: 32px;
  --ctl-line: color-mix(in srgb, var(--text) 55%, var(--panel));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17150f; --rail: #0f0e0a; --side: #1d1b15; --panel: #24221b;
    --hover: rgba(255,255,255,.04); --active: rgba(255,255,255,.09);
    --text: #ece8de; --muted: #9d968a; --line: #2f2c24;
    --accent: #e3a92b; --on-accent: #1a1408; --accent-soft: rgba(227,169,43,.14); --warn: #e3a92b;
    --bad: #ea6a6a; --badge: #ea6a6a; --on-bad: #1c0b0b; /* (redesign) red text 5.1:1 on the panel (was 3.7:1); dark text on red fills, like the accent */
    --code: rgba(255,255,255,.07); --menu-shadow: 0 8px 24px rgba(0,0,0,.5);
    --scroll-thumb: #57544d; --scroll-thumb-hover: #827f77;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17150f; --rail: #0f0e0a; --side: #1d1b15; --panel: #24221b;
  --hover: rgba(255,255,255,.04); --active: rgba(255,255,255,.09);
  --text: #ece8de; --muted: #9d968a; --line: #2f2c24;
  --accent: #e3a92b; --on-accent: #1a1408; --accent-soft: rgba(227,169,43,.14); --warn: #e3a92b;
  --bad: #ea6a6a; --badge: #ea6a6a; --on-bad: #1c0b0b;
  --code: rgba(255,255,255,.07); --menu-shadow: 0 8px 24px rgba(0,0,0,.5);
  --scroll-thumb: #57544d; --scroll-thumb-hover: #827f77;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-width: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.danger-fill { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn { background: transparent; border: 0; padding: 6px 8px; border-radius: 6px; color: var(--muted); white-space: nowrap; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.app { --side-w: 240px; --mem-w: 220px; display: grid; grid-template-columns: 72px var(--side-w) minmax(0,1fr) var(--mem-w); height: 100dvh; min-width: 0;
  grid-template-rows: minmax(0, 1fr); /* one row as tall as the screen: a long channel list scrolls instead of growing the row (and pushing the message box off the screen) */ }
.app.no-members { grid-template-columns: 72px var(--side-w) minmax(0,1fr) 0; }
.app.no-members .members { display: none; }

/* rail */
.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; overflow-y: auto; overflow-x: hidden; }
.server-list { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 2px; flex: none; }
.rail-btn {
  position: relative; width: 48px; height: 48px; border-radius: 24px; border: 0; padding: 0; flex: none;
  background: var(--panel); color: var(--text); font-weight: 700; font-size: 16px;
  display: grid; place-items: center; transition: border-radius .15s, background .15s;
}
.rail-btn:hover, .rail-btn.active { border-radius: 14px; }
.rail-btn.active { background: var(--accent); color: var(--on-accent); }
.rail-btn.muted-srv { opacity: .6; }
.rail-btn.add { color: var(--link); font-size: 24px; font-weight: 400; }
.rail-btn.add:hover { background: var(--accent); color: var(--on-accent); }
.rail-btn .pip { position: absolute; left: -12px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.rail-btn.active .pip { height: 36px; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--badge); color: var(--on-bad);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none;
}
.rail-btn .badge { position: absolute; right: -4px; bottom: -4px; border: 3px solid var(--rail); height: 22px; border-radius: 11px; }
/* the install button: pinned to the bottom of the rail (sticky, so servers scroll under it), gone in the installed app */
.rail-foot {
  margin-top: auto; position: sticky; bottom: -12px; margin-bottom: -12px; z-index: 2; flex: none;
  width: 100%; display: flex; justify-content: center; padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: inherit;
}
.rail-btn.install-btn { color: var(--link); font-size: 22px; font-weight: 400; }
.rail-btn.install-btn:hover { background: var(--accent); color: var(--on-accent); }
.install-steps { margin: 0 0 14px; padding-left: 20px; font-size: 14px; }
.install-steps li + li { margin-top: 4px; }

/* channel sidebar */
.side { background: var(--side); display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.side-head { border-bottom: 1px solid var(--line); }
.server-title {
  width: 100%; display: flex; align-items: center; gap: 6px; text-align: left; border: 0; border-radius: 0;
  background: transparent; padding: 14px 16px; font-weight: 700; min-height: 52px;
}
.server-title:hover { background: var(--hover); }
.server-title span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); }
/* the headers of the channel and member lists ("Channels", "Members · 2 online"): sentence case in the text colour,
   semibold, like the redesign's headings (sized for a sidebar); they used to be small grey capitals */
.side-section {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 6px 16px; min-height: 22px;
  font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--text);
}
.side-section .icon-btn { font-size: 18px; line-height: 1; padding: 0 6px; }
.channel-list { list-style: none; margin: 0; padding: 0 8px 8px; flex: 1; min-height: 0; overflow-y: auto; }
.channel-list li {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer;
  color: var(--muted); margin-bottom: 1px; min-width: 0;
}
.channel-list li:hover { background: var(--hover); color: var(--text); }
.channel-list li.active { background: var(--active); color: var(--text); }
.channel-list li.unread { color: var(--text); font-weight: 600; }
.channel-list li.muted-ch { opacity: .55; }
.channel-list .hash { opacity: .7; flex: none; }
.channel-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-list .gear { visibility: hidden; padding: 0 4px; }
.channel-list li:hover .gear, .channel-list li.active .gear { visibility: visible; }
/* categories, drag and drop */
.channel-list { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.channel-list li.cat {
  gap: 2px; padding: 14px 2px 4px 0; margin: 0; border-radius: 0; background: none;
  font-size: 12px; font-weight: 600; color: var(--muted); /* (sentence case: the category's name as it was typed) */
}
.channel-list li.cat:hover { background: none; color: var(--text); }
.channel-list li.cat:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.channel-list li.cat .caret { width: 14px; flex: none; text-align: center; font-size: 10px; transition: transform .15s; }
.channel-list li.cat.closed .caret { transform: rotate(-90deg); }
.channel-list li.cat .add { visibility: hidden; font-size: 17px; line-height: 1; padding: 0 6px; }
.channel-list li.cat:hover .add, .channel-list li.cat:focus-within .add { visibility: visible; }
@media (hover: none) { .channel-list li.cat .add { visibility: visible; } }
.channel-list li.dragging { opacity: .4; }
.channel-list.drag-on li { cursor: grabbing; }
.channel-list.drag-on li:hover:not(.active) { background: none; }
.channel-list li.drop-line {
  position: absolute; left: 8px; right: 8px; height: 2px; margin: -1px 0 0; padding: 0; border-radius: 1px;
  background: var(--accent); pointer-events: none; z-index: 1;
}
/* resize handles on the edge of the channel list and the member list */
.grip { position: absolute; top: 0; bottom: 0; width: 8px; z-index: 6; cursor: col-resize; touch-action: none; }
.side-grip { right: -4px; }
.mem-grip { left: 0; }
.grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.grip:hover::after, .grip.active::after, .grip:focus-visible::after { opacity: .8; }
.grip:focus-visible { outline: none; }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
.me { display: flex; align-items: center; gap: 6px; padding: 10px; background: var(--rail); min-width: 0; }
.me .icon-btn { padding: 6px; }
.me-text { flex: 1; min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-status { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.wait { background: var(--warn); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 15px; background: var(--muted); user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }

/* main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
/* backgrounds (theme.js, html.wall): a picture, gradient or colour behind the chat, or behind the
   whole app (html.wall-app). Over it a layer of the theme's background colour (--wall-shade, at
   least as strong as readable text needs); blur blurs the picture under that layer only. */
html.wall .main, html.wall-app .app { isolation: isolate; }
html.wall-app .app { position: relative; }
html.wall:not(.wall-app) .main::before, html.wall-app .app::before,
html.wall:not(.wall-app) .main::after, html.wall-app .app::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
html.wall:not(.wall-app) .main::before, html.wall-app .app::before { background: var(--wall); }
html.wall:not(.wall-app) .main::after, html.wall-app .app::after { background: var(--wall-shade); }
html.wall-blur:not(.wall-app) .main::after, html.wall-blur.wall-app .app::after { -webkit-backdrop-filter: blur(var(--wall-blur)); backdrop-filter: blur(var(--wall-blur)); }
html.wall .main { background: transparent; }
html.wall-app .rail { background: var(--wall-rail); }
html.wall-app .side, html.wall-app .members { background: var(--wall-side); }
html.wall-app .thread-pane { background: var(--wall-bg); }
html.wall-glass .rail, html.wall-glass .side, html.wall-glass .members, html.wall-glass .thread-pane { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.chan-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 6px; border-bottom: 1px solid var(--line); min-height: 52px; min-width: 0; }
.chan-head h1 { font-size: 16px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-head .hash { color: var(--muted); font-size: 20px; flex: none; }
.spacer { flex: 1; min-width: 0; }
.banner { padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
.banner.warn { color: var(--warn); }
.welcome { margin: auto; padding: 24px 16px; max-width: 460px; text-align: center; }
.welcome h2 { margin: 0 0 8px; }
.welcome p { color: var(--muted); }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.log { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 0 12px; }
.log .intro { padding: 24px 16px 12px; }
.log .intro h2 { margin: 0 0 4px; font-size: 24px; overflow-wrap: anywhere; }
.log .intro p { margin: 0; color: var(--muted); }
.older { display: block; margin: 8px auto; font-size: 13px; }
.day { display: flex; align-items: center; gap: 10px; margin: 14px 16px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* messages: a fixed 36px gutter (avatar or short time) + a body that can shrink to nothing */
.msg { position: relative; display: flex; gap: 12px; padding: 2px 16px; min-width: 0; }
.msg:hover, .msg.menu-open { background: var(--hover); }
.msg.first { margin-top: 10px; }
.msg.mention { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.msg.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } }
.gutter { width: 36px; flex: none; }
.side-time {
  display: block; height: 22px; line-height: 22px; font-size: 10px; text-align: right;
  white-space: nowrap; overflow: hidden; color: transparent; user-select: none;
}
.msg:hover .side-time { color: var(--muted); }
.body { flex: 1; min-width: 0; }
.meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; cursor: pointer; }
.msg.mine .who { color: var(--link); }
.tag { font-size: 10px; font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 0 4px; flex: none; }
.time { font-size: 11px; color: var(--muted); white-space: nowrap; flex: none; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 22px; min-height: 22px; }
/* long messages: about 25 lines, then a fade and "Show more" (collapseLong in app.js) */
.text.collapsed { max-height: 550px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.show-more { display: block; margin: 2px 0 4px; font-size: 13px; }
.text a { color: var(--link); }
.text code { background: var(--code); border-radius: 4px; padding: 1px 4px; font: 13px/1.4 ui-monospace, Consolas, monospace; }
.text pre { background: var(--code); border-radius: 6px; padding: 8px 10px; margin: 4px 0; overflow-x: auto; white-space: pre; }
.text pre code { background: none; padding: 0; }
.text .at { background: var(--accent-soft); color: var(--link); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.edited { font-size: 11px; color: var(--muted); margin-left: 4px; }
.reply-line {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer;
  min-width: 0; margin-bottom: 2px;
}
.reply-line::before { content: "↪"; flex: none; }
.reply-line b { color: var(--text); font-weight: 600; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.reply-line:hover span { color: var(--text); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.react {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line);
}
.react.on { border-color: var(--accent); background: var(--accent-soft); }
.react .n { font-size: 12px; font-weight: 600; }

/* hover actions on a message */
.actions {
  position: absolute; right: 12px; top: -14px; display: none; gap: 2px; padding: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--menu-shadow); z-index: 2;
}
.msg:hover .actions, .msg.menu-open .actions { display: flex; }
.actions button { border: 0; background: transparent; padding: 3px 7px; border-radius: 6px; font-size: 14px; }
.actions button:hover { background: var(--hover); }
@media (hover: none) { .msg:hover .actions { display: none; } .msg:hover { background: none; } }

.typing { height: 20px; padding: 0 16px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.compose-bar {
  display: flex; align-items: center; gap: 8px; margin: 0 16px; padding: 4px 4px 4px 12px; font-size: 13px; color: var(--muted);
  background: var(--side); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; min-width: 0;
}
.compose-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-bar b { color: var(--text); }
.composer { display: flex; gap: 8px; padding: 0 16px calc(14px + env(safe-area-inset-bottom)); align-items: flex-end; min-width: 0; flex: none; }
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--panel); max-height: 180px; min-height: 44px;
}
.composer { position: relative; }
.input-box {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 0;
  border: 1px solid var(--box-line, var(--line)); border-radius: 10px; background: var(--box, var(--panel));
  color: var(--box-text, var(--text)); /* a custom theme may give the message box its own colours */
}
.input-box:focus-within { border-color: var(--box-focus, var(--accent)); }
.input-box textarea::placeholder { color: var(--box-muted, var(--muted)); opacity: 1; }
.input-box .icon-btn { color: var(--box-muted, var(--muted)); }
.input-box .icon-btn:hover { color: var(--box-text, var(--text)); }
.input-box .icon-btn { height: 42px; padding: 0 9px; font-size: 17px; }
.composer .input-box textarea { border: 0; background: transparent; padding: 10px 2px; outline: none; min-height: 42px; }
.compose-bar:not([hidden]) ~ .composer .input-box,
.tray:not([hidden]) + .composer .input-box { border-top-left-radius: 0; border-top-right-radius: 0; }
/* long messages: the length counter (lenCount in app.js) and the box when the text is over the limit */
.len-count { align-self: center; flex: none; font-size: 11px; color: var(--box-muted, var(--muted)); white-space: nowrap; padding: 0 6px; font-variant-numeric: tabular-nums; }
.len-count[hidden] { display: none; }
.len-count.over { color: var(--bad); font-weight: 600; }
.input-box.too-long, .input-box.too-long:focus-within { border-color: var(--bad); }
.composer .send { height: 44px; flex: none; padding: 0 14px; }
.composer .send:disabled { opacity: .6; cursor: default; }
.composer .send.busy .send-txt::after { content: "…"; }
.send-ico { display: none; }

/* files waiting to be sent */
.tray {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 16px; padding: 8px;
  background: var(--side); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
}
.compose-bar:not([hidden]) + .tray { border-radius: 0; }
.tray-item { position: relative; width: 96px; flex: none; }
.tray-item img, .tray-ico { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--panel); display: grid; place-items: center; font-size: 28px; }
.tray-name { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.tray-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  background: var(--bad); border-color: var(--bad); color: var(--on-bad); font-size: 11px; line-height: 1;
}

/* @mention suggestions */
.mention-pop {
  position: absolute; bottom: calc(100% + 4px); left: 16px; z-index: 40; display: flex; flex-direction: column; min-width: 180px; max-width: calc(100% - 32px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: var(--menu-shadow);
}
.mention-pop button { border: 0; background: transparent; text-align: left; padding: 6px 10px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-pop button.sel, .mention-pop button:hover { background: var(--accent); color: var(--on-accent); }
.emoji-pop button { display: flex; align-items: center; gap: 8px; }
.emoji-pop .sug-emoji { width: 22px; flex: none; text-align: center; font-size: 18px; line-height: 1; }
.emoji-pop .sug-emoji img.emoji { width: 20px; height: 20px; margin: 0; vertical-align: middle; }

/* drag and drop */
.main { position: relative; }
.drop { position: absolute; inset: 0; z-index: 45; background: rgba(0,0,0,.55); display: grid; place-items: center; pointer-events: none; padding: 16px; }
.drop div { border: 2px dashed var(--accent); border-radius: 14px; padding: 32px 24px; color: #fff; font-weight: 600; text-align: center; }

/* attachments in messages */
.files { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.files .img {
  display: block; padding: 0; border: 0; border-radius: 8px; overflow: hidden; max-width: 100%; width: 240px; aspect-ratio: 4 / 3;
  background: var(--code); cursor: zoom-in;
}
.files .img img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .15s; }
.files .img.ready img { opacity: 1; }
.files .img.err { display: grid; place-items: center; font-size: 13px; color: var(--muted); cursor: default; }
.files .file {
  display: flex; align-items: center; gap: 10px; max-width: min(100%, 360px); padding: 10px 12px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0;
}
.file-ico { font-size: 26px; flex: none; }
.file-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-txt b { color: var(--link); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-txt small { color: var(--muted); font-size: 12px; }
.file-dl { font-size: 18px; color: var(--muted); flex: none; }

/* image viewer */
.viewer { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: calc(100% - 56px); object-fit: contain; border-radius: 6px; }
.viewer-bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: #ddd; font-size: 13px; max-width: 100%; }
.viewer-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-bar button { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; padding: 6px 12px; flex: none; }

/* text bits */
.spoiler { background: var(--text); color: transparent; border-radius: 4px; padding: 0 2px; cursor: pointer; transition: color .1s; }
.spoiler * { visibility: hidden; }
.spoiler.shown { background: var(--code); color: inherit; cursor: auto; }
.quote { border-left: 3px solid var(--muted); padding-left: 10px; margin: 2px 0; color: var(--text); }
.new-line { display: flex; align-items: center; gap: 8px; margin: 10px 16px 0; color: var(--bad); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.new-line::before { content: ""; flex: 1; height: 1px; background: var(--bad); }
.new-line span { background: var(--bad); color: var(--on-bad); border-radius: 4px; padding: 0 5px; }
.topic { color: var(--muted); font-size: 13px; margin-left: 8px; padding-left: 10px; border-left: 1px solid var(--line); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.member-list li.idle .avatar::after { background: var(--warn); }
.member-list li.idle .name { color: var(--muted); }
.me-text { cursor: pointer; border-radius: 6px; }
.me-text:hover .me-name { text-decoration: underline; }

/* jump to present */
.log-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.jump {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 5; white-space: nowrap;
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px;
  padding: 6px 14px; border-radius: 16px; box-shadow: var(--menu-shadow);
}

/* members */
.members { background: var(--side); min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.member-list { list-style: none; margin: 0; padding: 2px 8px 8px; flex: 1; min-height: 0; overflow-y: auto; }
/* rows like the channel list's: 42 px tall with the 30 px picture (a comfortable target), 1 px apart, rounded */
.member-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 1px; border-radius: 6px; min-width: 0; min-height: 42px; box-sizing: border-box; cursor: default; }
.member-list li:hover { background: var(--hover); }
.member-list .avatar { position: relative; }
.member-list .avatar::after {
  content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--side);
}
.member-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.member-list .you { color: var(--muted); font-size: 12px; flex: none; }

/* right-click menu */
.ctx button span:last-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ctx {
  position: fixed; z-index: 100; min-width: 190px; max-width: min(360px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: var(--menu-shadow);
}
.ctx button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left;
  padding: 6px 10px; min-height: 32px; border-radius: 6px; font-size: 14px; white-space: nowrap;
}
.ctx button:hover, .ctx button:focus-visible { background: var(--accent); color: var(--on-accent); outline: none; }
.ctx button.danger { color: var(--bad); }
.ctx button.danger:hover, .ctx button.danger:focus-visible { background: var(--bad); color: var(--on-bad); }
.ctx .ico { width: 18px; text-align: center; flex: none; }
.ctx .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.ctx .label { font-size: var(--fs-cap); font-weight: 700; color: var(--muted); padding: 6px 10px 2px; }
/* submenus (Roles ▸): the item with its arrow, and the tick-box rows of the submenu */
.ctx .has-sub .sub-arrow { margin-left: auto; padding-left: 12px; font-size: 11px; opacity: .7; }
.ctx .has-sub.sub-open { background: var(--hover); }
.ctx-sub { min-width: 200px; }
.ctx-sub button .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.ctx-sub .chk { width: 16px; height: 16px; flex: none; border: 2px solid var(--muted); border-radius: 4px; position: relative; box-sizing: border-box; }
.ctx-sub .chk.on { background: var(--accent); border-color: var(--accent); }
.ctx-sub .chk.on::after { content: ""; position: absolute; left: 4px; top: 0; width: 4px; height: 9px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ctx-sub button:hover .chk, .ctx-sub button:focus-visible .chk { border-color: currentColor; }
.ctx-sub button.dis { opacity: .5; cursor: not-allowed; }
.ctx-sub button.dis:hover, .ctx-sub button.dis:focus-visible { background: var(--hover); color: inherit; }
.ctx-sub button.busy-item { cursor: progress; }
.ctx-sub button.busy-item .chk { opacity: .55; }
/* grouped menus (Settings → Appearance → Menus): a header per section that opens and closes it */
.ctx .ctx-gh {
  font-size: var(--fs-cap); font-weight: 700; color: var(--muted);
  padding: 6px 10px; gap: 6px; min-height: 30px;
}
.ctx .ctx-gh:hover { background: var(--hover); color: var(--text); }
.ctx .ctx-gh:focus-visible { background: var(--hover); color: var(--text); outline: 2px solid var(--accent); outline-offset: -2px; }
.ctx .ctx-gh.danger { color: var(--bad); }
.ctx .ctx-gh.danger:hover, .ctx .ctx-gh.danger:focus-visible { background: var(--hover); color: var(--bad); }
.ctx .ctx-gh .ctx-chev { width: 18px; flex: none; display: inline-flex; justify-content: center; }
.ctx .ctx-gh .ctx-chev::before {
  content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(-45deg); transition: transform var(--m-quick) var(--m-ease);
}
.ctx .ctx-gh[aria-expanded="true"] .ctx-chev::before { transform: rotate(45deg); }
.ctx .ctx-gh .ctx-gl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ctx .ctx-gh .ctx-gn { flex: none; font-weight: 600; letter-spacing: 0; opacity: .75; min-width: 0; }
.ctx .ctx-g[hidden] { display: none; }
@media (hover: none) { .ctx .ctx-gh { min-height: 40px; } }
@media (forced-colors: active) { .ctx .ctx-gh:focus-visible { outline-color: Highlight; } }
.mem-row.focus { background: var(--active); border-radius: 8px; }
.ctx .emojis { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; }
.ctx .emojis button { width: auto; padding: 5px 7px; font-size: 18px; }
.ctx .emojis button:hover { background: var(--hover); color: inherit; }
.ctx .emojis.grid { max-width: 260px; }

/* full emoji picker (composer + reactions) */
.ctx.picker { width: min(360px, calc(100vw - 16px)); height: min(430px, calc(100dvh - 16px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.ctx.picker button { width: auto; padding: 0; justify-content: center; gap: 0; border-radius: 6px; }
.ctx.picker button:hover, .ctx.picker button:focus-visible { background: var(--hover); color: inherit; }
.ctx.picker button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker .pk-top { display: flex; gap: 6px; align-items: center; padding: 8px 8px 6px; }
.picker .pk-search { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.picker .pk-skin, .picker .pk-tones button { width: 32px; height: 32px; flex: none; font-size: 20px; line-height: 1; }
/* the skin tone pop-up: floats over the picker, anchored to the ✋ button (placed from app.js) */
.picker .pk-tones { position: absolute; z-index: 3; display: flex; gap: 2px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--menu-shadow); transform-origin: 100% 0; }
.ctx.picker .pk-tones button.on { background: var(--active); box-shadow: inset 0 0 0 2px var(--accent); }
.picker .pk-skin[aria-expanded="true"] { background: var(--active); }
.picker .pk-tabs { display: flex; padding: 0 6px 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.picker .pk-tab { flex: 1 0 auto; min-width: 30px; height: 30px; font-size: 18px; line-height: 1; opacity: .5; filter: grayscale(.7); }
.picker .pk-tab.on { opacity: 1; filter: none; background: var(--active); }
.picker .pk-body { flex: 1; min-height: 0; overflow-y: auto; position: relative; padding: 0 6px 6px; overscroll-behavior: contain; }
.picker .pk-h { position: sticky; top: 0; z-index: 1; background: var(--panel); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 4px 4px; }
.picker .pk-grid { display: grid; grid-template-columns: repeat(auto-fill, 36px); justify-content: space-between; }
.picker .pk-e { width: 36px; height: 36px; font-size: 24px; line-height: 1; }
.picker img.emoji { width: 24px; height: 24px; margin: 0; vertical-align: middle; }
.picker .pk-tab img.emoji, .picker .pk-skin img.emoji, .picker .pk-tones img.emoji { width: 20px; height: 20px; }
.picker .pk-foot { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker .pk-foot img.emoji { flex: none; }
.picker .pk-code { margin-left: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.picker .pk-loading { padding: 32px 12px; text-align: center; color: var(--muted); }
@media (hover: none) { .picker .pk-foot { display: none; } }

/* dialogs */
dialog {
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text);
  padding: 20px; width: min(400px, calc(100vw - 24px)); max-width: none; box-shadow: var(--menu-shadow);
}
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin: 0 0 6px; overflow-wrap: anywhere; font-size: 18px; font-weight: 650; line-height: 1.3; }
dialog p.muted { line-height: 1.45; }
dialog p { margin: 0 0 14px; font-size: 14px; overflow-wrap: anywhere; }
dialog input:not([type="checkbox"]) { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--bg); margin-bottom: 14px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; margin: -4px 0 14px; cursor: pointer; }
.check input { margin-top: 3px; }

/* server settings (full screen), roles, members, audit log, profile */
dialog.srv-dlg { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--bg); }
.srv-wrap { display: grid; grid-template-columns: minmax(170px, 24%) minmax(0, 1fr); height: 100%; }
.srv-nav { background: var(--side); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 48px 12px 16px; overflow-y: auto; }
.srv-nav > * { width: 200px; max-width: 100%; flex: none; } /* flex: none: in a long nav the server's name was squeezed to nothing under the search box */
/* (redesign) the same nav as User settings: sentence-case group titles, entries in the text colour, the open one marked */
.srv-nav-title { font-size: var(--fs-row); font-weight: 700; color: var(--text); padding: 0 10px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-nav button { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-body); }
.srv-nav button:hover { background: var(--hover); }
.srv-nav button.on { background: var(--active); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.srv-body { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.srv-body header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 40px 32px 8px; max-width: 820px; width: 100%; }
.srv-body header h2 { margin: 0; font-size: var(--fs-title); font-weight: 700; letter-spacing: -.01em; }
.srv-body header .icon-btn { font-size: 18px; border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; padding: 0; }
.srv-content { --pad-b: 40px; flex: 1; min-height: 0; overflow-y: auto; padding: 8px 32px var(--pad-b); max-width: 820px; width: 100%; display: flex; flex-direction: column; gap: var(--sp-4); }
.srv-content input:not([type="checkbox"]):not([type="color"]), .srv-content textarea, .srv-content select {
  width: 100%; border: 1px solid var(--ctl-line); border-radius: var(--r-md); padding: 8px 10px; background: var(--panel); color: var(--text); font: inherit; margin: 0;
}
.srv-content input[type="checkbox"] { accent-color: var(--accent); }
.srv-content .row select { width: auto; flex: 1; min-width: 0; }
.srv-content textarea { resize: vertical; }
.srv-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.srv-card h3 { margin: 0; font-size: var(--fs-sec); font-weight: 650; line-height: 1.3; }
.srv-card p { margin: 0; font-size: var(--fs-row); line-height: 1.45; }
.srv-card p.muted { font-size: var(--fs-help); }
.srv-card summary { cursor: pointer; font-size: 14px; }
.srv-field { display: flex; flex-direction: column; gap: 4px; }
.srv-field > span { font-size: var(--fs-help); font-weight: 600; color: var(--text); }
.srv-content .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
.srv-content .row.end { justify-content: flex-end; }
.srv-content .check { margin: 0; }
.srv-owner { display: flex; align-items: center; gap: 8px; }
.uid { font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); }
.small { font-size: 12px; }
.danger-text { color: var(--bad) !important; }
.roles-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.role-col { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; }
.role-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.role-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.role-list li:hover { background: var(--hover); }
.role-list li.on { background: var(--active); font-weight: 600; }
.role-list li.dragging { opacity: .4; }
.role-list li.drop-above { border-top-color: var(--accent); }
.role-list li.drop-below { border-bottom-color: var(--accent); }
.role-list .grip-dots { color: var(--muted); font-size: 11px; letter-spacing: -2px; cursor: grab; width: 10px; }
.role-list li:not(.movable) .nm { margin-left: 18px; }
.role-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-list .n { color: var(--muted); font-size: 12px; }
.role-list .dot, .role-chip i { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.role-edit { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.role-edit h3, .role-edit h4 { margin: 4px 0 0; }
.role-edit h4 { font-size: var(--fs-help); font-weight: 650; color: var(--muted); }
.role-edit p { margin: 0; font-size: 14px; }
.role-edit input[type="color"] { width: 48px; height: 32px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
/* the action bar of a long form (Save, Reset, Delete...): stays in view at the very bottom of the settings
   page while scrolling (bottom = minus the page's bottom padding, so nothing shows below it), and sits
   after the last field once scrolled to the end */
.srv-content .sticky { position: sticky; bottom: calc(-1 * var(--pad-b)); z-index: 3; background: var(--bg); margin: 0 -8px; padding: 10px 8px;
  border-top: 1px solid var(--line); transition: box-shadow .15s; }
.srv-content .sticky.floating { box-shadow: 0 -8px 12px -10px rgba(0, 0, 0, .3); } /* only while more is below (stickyWatch) */
.role-edit .sticky, .srv-card .sticky { background: var(--panel); }
.srv-card .sticky { margin: 0 -16px; padding: 10px 16px; }
/* the save bar (saveBar in app.js): Save / Apply / Create and their Cancel, Discard... at the bottom of whatever scrolls
   (a settings page, a dialog), the content passing under it; after the last field once scrolled to the end. While
   something is unsaved: "Unsaved changes" on the left and the save button highlighted. Theme colours only. */
.save-bar { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
  background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0; transition: box-shadow .15s, border-color .15s; }
.save-bar.floating { box-shadow: 0 -8px 12px -10px rgba(0, 0, 0, .3); }
.save-note { margin-right: auto; min-width: 0; font-size: 13px; color: var(--muted); }
.save-note:empty { display: none; }
.save-bar.dirty { border-top-color: var(--accent); }
.save-bar.dirty .save-note { color: var(--text); font-weight: 600; }
.save-bar.dirty .save-note::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
button.primary.save-hl:not(:disabled) { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
/* the scroller leaves room for it: a field reached with Tab or the phone keyboard isn't left under the bar */
.srv-content, .us-scroll, dialog:not(.srv-dlg):has(.save-bar), dialog.welcome-dlg form { scroll-padding-bottom: 72px; }
/* user settings: the page's own background, a little wider than the form */
.us-content .save-bar { margin: 12px -12px 0; padding: 10px 12px; }
/* dialogs (not the full-screen settings ones): flush with the dialog's bottom and sides (its padding), on its panel colour */
dialog:not(.srv-dlg) .save-bar { bottom: -20px; margin: 10px -20px -20px; padding: 12px 20px; background: var(--panel); border-radius: 0 0 14px 14px; }
dialog.welcome-dlg .save-bar { bottom: -18px; margin: 0 -18px -18px; padding: 12px 18px; }
dialog.pe-dlg .save-bar { margin-right: 0; padding-right: 0; border-radius: 0 0 0 14px; }
@media (max-width: 680px) { dialog.pe-dlg .save-bar { margin-right: -20px; padding-right: 20px; border-radius: 0 0 14px 14px; } }
@media (max-width: 520px) { dialog.inv-dlg .save-bar { bottom: -16px; margin: 10px -16px -16px; padding: 12px 16px; } }
/* a phone on its side, or a short window: the bar would take too much of the height, so it scrolls with the page */
@media (max-height: 420px) { .save-bar, .srv-content .sticky { position: static; } }
.perm-list { display: flex; flex-direction: column; }
.perm { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm > span { display: flex; flex-direction: column; min-width: 0; }
.perm small { font-size: 12px; }
.perm input { width: 18px; height: 18px; flex: none; }
.perm.admin b { color: var(--bad); }
/* Manage nicknames' two drop-downs (nickScopeEditor), indented under that permission */
.perm-sub { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 10px 12px; border-bottom: 1px solid var(--line); border-left: 2px solid var(--line); margin-left: 4px; }
.perm-sub .perm-scope { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin: 0; }
.perm-sub .perm-scope > span { font-size: 13px; }
.perm-sub select { min-width: 140px; max-width: 100%; }
.role-members, .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 12px; padding: 1px 8px; font-size: 12px; background: var(--bg); max-width: 100%; }
.role-chip .x { border: 0; background: none; padding: 0 0 0 2px; color: var(--muted); font-size: 11px; }
.role-chip .x:hover { color: var(--bad); }
.mem-table { display: flex; flex-direction: column; }
.mem-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.mem-row .nm { font-weight: 600; }
.mem-row .avatar { position: relative; }
.mem-row.online .avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg); }
.crown { margin-left: 4px; font-size: 12px; flex: none; }
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.audit li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit li > div { min-width: 0; overflow-wrap: anywhere; }
.tag.unverified { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; cursor: help; }
.member-list li.mgroup { font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 8px 4px; min-height: 0; cursor: default; } /* (sentence case, like the channel categories) */
.member-list li.mgroup:hover { background: none; }
.member-list li { cursor: pointer; }
/* offline: the picture fades and the name goes to the muted colour (4.5:1 on the panel), instead of the whole row at
   half opacity (which took the text well under 4.5:1) */
.member-list li.offline .avatar { opacity: .5; }
.member-list li.offline .name, .member-list li.offline .you { color: var(--muted); }
.member-list li.offline .avatar::after { display: none; }
/* member list tabs: "In #channel" / "Others" (renderMembers) */
/* the tabs (In #channel / Others / All): 32 px targets, a little room between them, the open one in the text colour
   with the accent underline (the only accent here: what is selected) */
.mem-tabs { display: flex; gap: 2px; margin: 2px 8px 4px; border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
.mem-tab { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 32px; padding: 6px 7px 5px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.mem-tab:first-child { flex: 0 1 auto; } /* the channel name gives way first */
.mem-tab:not(:first-child) { flex: none; }
.mem-tab:hover { background: var(--hover); color: var(--text); }
.mem-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.mem-tab:focus-visible { outline-offset: -2px; }
.mem-tab .mt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mem-tab .mt-n { flex: none; min-width: 16px; padding: 0 4px; border-radius: 9px; background: var(--active); font-size: 11px; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.mem-tab.on .mt-n { background: var(--accent-soft); }
.member-list li.mempty { justify-content: center; text-align: center; color: var(--muted); font-size: 13px; padding: 18px 8px; cursor: default; }
.member-list li.mempty:hover { background: none; }
@media (forced-colors: active) { .mem-tab.on { border-bottom-color: Highlight; } .mem-tab .mt-n { border: 1px solid CanvasText; } }
/* Add to / Remove from #channel on a member row (chanAccBtn): on hover / focus, always on touch screens */
.member-list li .mem-acc { margin-left: auto; padding: 3px 6px; opacity: 0; }
.member-list li:hover .mem-acc, .member-list li:focus-within .mem-acc, .member-list li .mem-acc:focus-visible { opacity: 1; }
.member-list li .mem-acc:hover { color: var(--accent); }
.member-list li .mem-acc.rm:hover { color: var(--bad); }
.member-list li .mem-acc.off { opacity: 0; color: var(--muted); }
.member-list li:hover .mem-acc.off, .member-list li:focus-within .mem-acc.off { opacity: .5; }
.member-list li .mem-acc[aria-disabled=true] { cursor: not-allowed; }
.member-list li .mem-acc.off:hover { color: var(--muted); background: var(--hover); }
@media (hover: none) { .member-list li .mem-acc { opacity: 1; } .member-list li .mem-acc.off { opacity: .5; } }
.ctx button.dis { opacity: .55; }
.chan-acc-opts { display: grid; gap: 6px; margin: 4px 0 8px; }
dialog.profile-dlg { width: min(360px, calc(100vw - 24px)); }
.profile-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.profile-top h3 { margin: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.profile-dlg h4 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.profile-dlg p { margin: 6px 0; }
.profile-dlg .chips { margin: 4px 0; }
.safety { font: 600 15px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; background: var(--code); border-radius: 8px; padding: 8px 10px; text-align: center; }
.banner.claim { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text); background: var(--accent-soft); }
.banner.claim span { flex: 1; min-width: 200px; }
.banner.claim button { padding: 4px 12px; font-size: 13px; }
/* protected servers: no key banner, pending joins on the rail, the Invites tab, the waiting dialog */
.banner.prot { color: var(--text); background: var(--accent-soft); }
#dlgConfirmText { white-space: pre-line; }
.rail-btn.pending-join { opacity: .6; border: 2px dashed var(--muted); }
.rail-btn .badge.wait { background: var(--panel); color: var(--text); font-size: 10px; padding: 0 3px; }
.inv-opts { display: flex; gap: 12px; flex-wrap: wrap; }
.inv-opts .srv-field { flex: 1 1 140px; min-width: 0; }
.inv-out { display: flex; gap: 8px; align-items: center; }
.inv-out[hidden] { display: none; }
.inv-out input { flex: 1; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.inv-appr { display: flex; flex-direction: column; gap: 6px; }
.srv-content .inv-appr input[type="radio"] { width: 16px; height: 16px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent); }
.mem-row.inv-row, .mem-row.inv-req { grid-template-columns: auto minmax(0, 1fr) 0 auto; }
.mem-row.inv-row.dead { opacity: .55; }
.mem-row .row { flex-wrap: wrap; justify-content: flex-end; }
.join-wait { max-width: 420px; }
.join-wait h3 { margin-top: 0; }
/* "Join a server?" for an invite link from outside (inviteAsk) */
.inv-ask .inv-ask-srv { padding: 4px 0 14px; }
/* invite QR codes: plain #000 on #fff whatever the theme (the white is inside the svg), since
   scanners want dark on light; small enough to leave the buttons on screen on a short phone */
dialog.qr-dlg { width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.qr-box { width: min(100%, 340px, max(180px, calc(100dvh - 250px))); margin: 6px auto 12px; border-radius: 8px; overflow: hidden; }
.qr-box svg { display: block; width: 100%; height: auto; aspect-ratio: 1; }
/* the invite dialog (openInviteDialog): preset chips (radios), Custom opens a number box, then the link */
dialog.inv-dlg { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
dialog.inv-dlg h3 { display: flex; align-items: center; gap: 6px; }
.inv-pick { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.inv-pick legend, .inv-ch > label { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.inv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-chip { position: relative; display: inline-flex; cursor: pointer; }
dialog.inv-dlg .inv-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.inv-chip span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: var(--bg); white-space: nowrap; }
.inv-chip:hover span { border-color: var(--muted); }
.inv-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.inv-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.inv-custom { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.inv-custom[hidden] { display: none; }
dialog.inv-dlg .inv-custom input { width: 96px; margin: 0; padding: 6px 9px; }
.inv-ch { margin-bottom: 14px; }
.inv-ch select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
dialog.inv-dlg p.small { margin-bottom: 10px; }
.inv-sum { margin: 0 0 14px; padding: 8px 11px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; font-weight: 600; }
.inv-sum.err { background: transparent; border: 1px solid var(--bad); color: var(--bad); font-weight: 400; }
dialog.inv-dlg .inv-out input { margin-bottom: 6px; }
dialog.inv-dlg p.inv-copied { min-height: 1em; margin-bottom: 8px; }
dialog.inv-dlg .row.end button .ui-ico { vertical-align: -2px; }
@media (max-width: 520px) {
  dialog.inv-dlg { padding: 16px; }
  dialog.inv-dlg .row.end { justify-content: stretch; }
  dialog.inv-dlg .row.end > button { flex: 1 1 auto; }
}
@media (max-width: 520px) {
  .mem-row.inv-row, .mem-row.inv-req { grid-template-columns: auto minmax(0, 1fr); }
  .mem-row.inv-row > .row, .mem-row.inv-req > .row { grid-column: 1 / -1; justify-content: flex-start; }
  .mem-row.inv-row > div:nth-child(3), .mem-row.inv-req > div:nth-child(3) { display: none; }
}
textarea:disabled { cursor: not-allowed; }
@media (max-width: 680px) {
  .srv-wrap { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .srv-nav { flex-direction: row; align-items: center; padding: 8px; overflow-x: auto; }
  .srv-nav > * { width: auto; flex: none; }
  .srv-nav-title { display: none; }
  .srv-body header { padding: 12px 16px 4px; }
  .srv-content { --pad-b: 24px; padding: 8px 16px var(--pad-b); }
  .roles-grid { grid-template-columns: 1fr; }
  .role-col { position: static; }
  .mem-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .mem-row .chips { grid-column: 2 / 4; grid-row: 2; }
}

/* account dialog (sign in, create account, recovery code, change password) */
.acc-dlg p.muted { color: var(--muted); }
.acc-field { display: block; }
.acc-field > span { display: block; font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.acc-field input { margin-bottom: 12px !important; }
.acc-pw { position: relative; }
.acc-dlg .acc-pw input { padding-right: 42px; }
.acc-eye {
  position: absolute; top: 1px; right: 1px; bottom: 13px; width: 38px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 0 7px 7px 0; background: none; color: var(--muted);
}
.acc-eye:hover, .acc-eye[aria-pressed="true"] { color: var(--text); }
.acc-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.acc-err { color: var(--bad); font-weight: 600; margin: -2px 0 12px !important; }
.acc-wait { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: -2px 0 12px !important; }
.acc-wait[hidden] { display: none; }
.acc-wait::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: acc-spin .8s linear infinite; }
@keyframes acc-spin { to { transform: rotate(360deg); } }
.acc-note { font-weight: 600; }
.acc-links { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0 0 14px; }
.link-btn {
  border: 0; background: none; padding: 2px 0; color: var(--link); font: inherit; font-size: 13px;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left;
}
.link-btn:hover { text-decoration-thickness: 2px; }
.acc-code-row { display: flex; gap: 8px; align-items: stretch; margin: 0 0 14px; }
.acc-code {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 8px; background: var(--accent-soft);
  font: 700 17px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .06em; text-align: center;
  overflow-wrap: anywhere; user-select: all;
}
.acc-dlg button:disabled:not(.busy) { opacity: .45; cursor: not-allowed; }
button.busy { opacity: .7; cursor: progress; }
button.busy::after { content: "…"; }
.gif-status .link-btn { display: block; margin: 6px auto 0; font-size: inherit; text-align: center; }
/* feedback on save buttons (withFeedback in app.js): busy → "✓ Saved" or a red reason next to the button */
button.fb-busy { opacity: .75; cursor: progress; }
button.fb-done, button.fb-done:disabled { color: var(--ok); border-color: var(--ok); opacity: 1; }
button.primary.fb-done { background: var(--ok); border-color: var(--ok); color: #fff; }
html.m-ready button.fb-done { transition: background-color var(--m-in) var(--m-ease), color var(--m-in) var(--m-ease), border-color var(--m-in) var(--m-ease); }
.fb-status { display: block; font-size: 13px; line-height: 1.35; margin: 4px 0; }
.fb-status[hidden] { display: none; }
.fb-status.err { color: var(--bad); font-weight: 600; }
.row > .fb-status { flex: 1 1 100%; margin: 0; text-align: right; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 150;
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 24px); text-align: center;
}
.toast.show { opacity: 1; }
.scrim { display: none; }
.only-sm { display: none; }

@media (max-width: 1000px) {
  .app, .app.no-members { grid-template-columns: 72px var(--side-w) minmax(0,1fr); }
  .members {
    position: fixed; right: 0; top: 0; bottom: 0; width: min(240px, 85vw); z-index: 30;
    transform: translateX(100%); transition: transform .2s; display: flex; border-left: 1px solid var(--line);
  }
  .app.show-members .members { transform: none; }
  .app.no-members .members { display: flex; }
  .mem-grip { display: none; }
  .app.show-members .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
}
@media (max-width: 680px) {
  .app, .app.no-members { grid-template-columns: minmax(0,1fr); }
  .rail, .side { position: fixed; top: 0; bottom: 0; z-index: 30; transition: transform .2s; }
  .rail { left: 0; width: 72px; transform: translateX(-100vw); }
  .side { left: 72px; width: min(240px, calc(100vw - 72px)); transform: translateX(-100vw); }
  .app.show-side .rail, .app.show-side .side { transform: none; }
  .app.show-side .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  .only-sm { display: inline-block; }
  .hide-sm { display: none; }
  .chan-head { padding-left: 4px; }
  .side-grip { display: none; }
  .msg { padding: 2px 12px; gap: 10px; }
  .composer { padding-left: 12px; padding-right: 12px; }
  .compose-bar, .tray { margin: 0 12px; }
}
/* collapsed channel list (desktop and tablet; the phone keeps its drawer). The sidebar leaves the grid,
   so the chat moves into its column. */
@media (min-width: 681px) {
  .app.side-collapsed { grid-template-columns: 72px minmax(0,1fr) var(--mem-w); }
  .app.side-collapsed.no-members { grid-template-columns: 72px minmax(0,1fr) 0; }
  .app.side-collapsed .side { display: none; }
}
@media (min-width: 681px) and (max-width: 1000px) {
  .app.side-collapsed, .app.side-collapsed.no-members { grid-template-columns: 72px minmax(0,1fr); }
}
@media (max-width: 400px) {
  .send-txt { display: none; }
  .send-ico { display: inline; }
  .composer .send { width: 44px; padding: 0; }
  .msg { padding: 2px 8px; gap: 8px; }
  .gutter, .msg .avatar { width: 28px; }
  .msg .avatar { height: 28px; font-size: 12px; }
  .composer { padding-left: 8px; padding-right: 8px; gap: 6px; }
  .compose-bar, .tray { margin: 0 8px; }
  .input-box .icon-btn { padding: 0 6px; }
  .log .intro { padding: 16px 8px 8px; }
  .log .intro h2 { font-size: 20px; }
  .day { margin-left: 8px; margin-right: 8px; }
  .typing { padding: 0 8px; }
}
@media (max-width: 260px) {
  .gutter { display: none; }
  .msg .gutter { display: none; }
  .chan-head .hash { display: none; }
  #toggleMembers span { display: none; }
  #emojiBtn { display: none; }
}

/* emoji packs */
img.emoji { width: 1.375em; height: 1.375em; vertical-align: -0.3em; object-fit: contain; margin: 0 .05em; }
.text.jumbo { font-size: 2.4em; line-height: 1.2; }
.text.jumbo img.emoji { width: 1.25em; height: 1.25em; }
.ctx .emojis img.emoji { width: 24px; height: 24px; vertical-align: middle; margin: 0; }
.react img.emoji { width: 18px; height: 18px; vertical-align: -4px; }

/* GIFs */
.gif-btn { font-size: 11px !important; font-weight: 800; letter-spacing: .02em; }
.files .gif { max-width: min(100%, 320px); border-radius: 8px; overflow: hidden; background: var(--code); }
.files .gif img { display: block; max-width: 100%; max-height: 300px; }
.gif-panel {
  position: absolute; right: 16px; bottom: calc(100% + 6px); z-index: 40; width: min(420px, calc(100vw - 24px)); height: min(440px, 60dvh);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--menu-shadow); overflow: hidden;
}
.gif-tabs { display: flex; gap: 4px; padding: 8px 8px 0; }
.gif-tabs button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.gif-tabs button.on { background: var(--accent-soft); color: var(--link); }
.gif-head { display: flex; gap: 6px; padding: 8px; align-items: center; }
.gif-head input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
.gif-grid { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 8px; color: var(--muted); font-size: 13px; }
.gif-cols { display: flex; gap: 6px; align-items: flex-start; }
.gif-col { flex: 1 1 0; min-width: 0; }
.gif-tile { position: relative; margin: 0 0 6px; border-radius: 6px; overflow: hidden; background: var(--code); }
.gif-grid .gif-pick { display: block; width: 100%; padding: 0; border: 0; margin: 0; background: transparent; cursor: pointer; }
.gif-star {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.gif-tile:hover .gif-star, .gif-star:focus-visible, .gif-star.on { opacity: 1; }
.gif-star.on { color: #ffc83d; }
.gif-star:hover { background: rgba(0, 0, 0, .75); }
@media (hover: none) { .gif-star { opacity: 1; } }
.gif-tabs .gif-fav-tab { margin-left: auto; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.gif-grid img { display: block; width: 100%; height: auto; }
.gif-status { text-align: center; padding: 6px 0 2px; font-size: 12px; }
.gif-status.msg { padding: 16px 4px; font-size: 13px; }
.gif-status:empty { display: none; }
.gif-grip { position: absolute; z-index: 2; display: none; touch-action: none; }
.gif-panel.resizable .gif-grip { display: block; }
.gif-grip-x { left: 0; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.gif-grip-y { top: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.gif-grip::after { content: ""; position: absolute; border-radius: 2px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.gif-grip-x::after { left: 2px; top: 50%; width: 3px; height: 40px; margin-top: -20px; }
.gif-grip-y::after { top: 2px; left: 50%; height: 3px; width: 40px; margin-left: -20px; }
.gif-grip:hover::after, .gif-grip:active::after { opacity: .7; }
.gif-empty { padding: 20px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.gif-foot { font-size: 10px; color: var(--muted); text-align: right; padding: 0 10px 6px; }
.gif-foot:empty { display: none; }
@media (max-width: 400px) { .gif-panel { right: 8px; } }

/* GIF provider switches */
.gif-tabs { gap: 14px; padding: 10px 10px 0; flex-wrap: wrap; }
.gif-switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none; }
.gif-switch.on { color: var(--text); }
.gif-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.gif-switch .knob { position: relative; width: 30px; height: 17px; border-radius: 9px; background: var(--line); transition: background .15s; flex: none; }
.gif-switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
.gif-switch.on .knob { background: var(--accent); }
.gif-switch.on .knob::after { transform: translateX(13px); background: var(--on-accent); }
.gif-switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.chickens { column-span: all; text-align: center; padding: 40px 12px; color: var(--muted); font-size: 15px; font-weight: 600; }
.chickens-ico { font-size: 40px; margin-bottom: 8px; }
.chickens-ico img.emoji { width: 44px; height: 44px; }

/* /silent messages */
.silent-tag { color: var(--muted); }
.input-box.silent { border-color: var(--muted); }
.input-box.silent::after { content: "🔕 silent: nobody gets a notification"; align-self: center; font-size: 11px; color: var(--muted); white-space: nowrap; padding-right: 8px; }
@media (max-width: 500px) { .input-box.silent::after { content: "🔕"; } }

/* /important messages */
.important-tag { color: var(--bad); font-weight: 600; }
.input-box.important { border-color: var(--bad); }
.input-box.important::after { content: "❗ important: notifies everyone, even if muted"; align-self: center; font-size: 11px; color: var(--bad); white-space: nowrap; padding-right: 8px; }
@media (max-width: 500px) { .input-box.important::after { content: "❗"; } }

/* disappearing messages: ⏱ on a message, the channel's timer lines, the composer's ⏱ */
.exp-tag { white-space: nowrap; cursor: default; }
.exp-tag .exp-left { font-variant-numeric: tabular-nums; }
.sys-line { display: flex; align-items: center; gap: 8px; margin: 6px 16px; padding: 4px 10px; font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); }
.sys-line .sys-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sys-line b { color: var(--text); font-weight: 600; }
.chan-ttl { cursor: pointer; }
.disappear-btn { display: inline-flex; align-items: center; gap: 2px; }
.disappear-btn .dis-left { font-size: 11px; font-weight: 600; }
.disappear-btn .dis-left:empty { display: none; }
.disappear-btn.on { color: var(--link); background: var(--accent-soft); }
.input-box.disappear { border-color: var(--link); }
.warn-text { color: var(--warn); }
@media (max-width: 500px) { .sys-line { margin: 6px 8px; } }

/* channel notification types */
.chan-mode { flex: none; font-size: 12px; line-height: 1; }
.chan-head .chan-mode { font-size: 14px; margin-left: 6px; }
.channel-list .thread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; margin: 0 4px; }
#threadsBtn { position: relative; }
#threadsBtn.has-new::after { content: ""; position: absolute; top: 5px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--badge); }
.select-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: -4px 0 14px; }
.select-row > span { flex: none; }
.select-row select { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--bg); color: inherit; font: inherit; }

/* threads: the bar under a message */
.thread-bar {
  display: flex; align-items: center; gap: 6px; max-width: min(100%, 480px); margin: 4px 0 2px; padding: 4px 10px; min-width: 0;
  font-size: 13px; text-align: left; color: var(--muted); background: var(--side); border: 1px solid var(--line); border-radius: 8px;
}
.thread-bar:hover { border-color: var(--accent); color: var(--text); }
.thread-bar .tb-ico { flex: none; }
.thread-bar b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.thread-bar .tb-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
.thread-bar.unread b { color: var(--link); }
.thread-bar.closed { opacity: .8; }
.thread-bar img.emoji { width: 16px; height: 16px; vertical-align: -3px; }

/* threads: the side panel */
.thread-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); border-left: 1px solid var(--line); position: relative; }
.thread-head { gap: 6px; }
.thread-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.thread-title h2 { font-size: 15px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-chan { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-closed-tag { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.thread-close-btn { font-size: 13px; }
.thread-intro h2 { font-size: 20px; }
.thread-intro .thread-parent { margin-top: 10px; padding: 6px 10px; background: var(--side); border-radius: 8px; }
.thread-pane .compose-bar, .thread-pane .tray, .thread-pane .composer { margin-top: 6px; }
.thread-pane .compose-bar + .tray, .thread-pane .compose-bar + .tray + .composer, .thread-pane .tray + .composer, .thread-pane .compose-bar:not([hidden]) ~ .composer { margin-top: 0; }
.thread-pane .input-box.silent::after { content: "🔕"; }
.thread-pane .input-box.important::after { content: "❗"; }
.thread-pane .gif-panel { right: 0; }
.thread-closed {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; min-width: 0;
  margin: 6px 16px calc(14px + env(safe-area-inset-bottom)); padding: 10px 12px;
  border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 14px;
}
.thread-closed button { padding: 5px 12px; }
@media (min-width: 1001px) {
  .app { --thr-w: clamp(320px, 32vw, 480px); }
  .app.thread-open, .app.thread-open.no-members { grid-template-columns: 72px var(--side-w) minmax(0,1fr) var(--thr-w); }
  .app.thread-open.side-collapsed, .app.thread-open.side-collapsed.no-members { grid-template-columns: 72px minmax(0,1fr) var(--thr-w); }
  .app.thread-open .members { display: none; }
}
@media (max-width: 1000px) {
  .thread-pane { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, calc(100vw - 72px)); z-index: 25; box-shadow: var(--menu-shadow); }
}
@media (max-width: 680px) {
  .thread-pane { left: 0; width: auto; border-left: 0; box-shadow: none; z-index: 26; }
  .thread-closed { margin-left: 12px; margin-right: 12px; }
}

/* delivery status */
.msg.pending .body { opacity: .5; }
.msg.failed { background: rgba(209,75,75,.08); background: color-mix(in srgb, var(--bad) 8%, transparent); box-shadow: inset 2px 0 0 var(--bad); }
.msg.failed:hover { background: rgba(209,75,75,.12); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.local-files { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-status { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; color: var(--bad); }
.local-status .link-btn { font-size: 12px; color: var(--bad); padding: 0; }
.dstat { font-size: 11px; color: var(--muted); line-height: 16px; }
.dstat.read { color: var(--link); }
/* seen heads: who has read up to here, small pictures on the right under the message (same height as .dstat,
   so "✓✓ Delivered" turning into heads doesn't move anything); .grow / .gone: opening / folding while a head moves */
.seen-heads {
  display: flex; align-items: flex-start; gap: 3px; width: fit-content; margin-left: auto; height: 16px;
  cursor: pointer; border-radius: 8px; user-select: none; transition: height .22s ease, opacity .22s ease;
}
.seen-heads.grow { height: 0; }
.seen-heads.gone { height: 0; opacity: 0; pointer-events: none; }
.seen-heads:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seen-head.avatar { width: 15px; height: 15px; font-size: 7px; font-weight: 700; letter-spacing: -.02em; }
.seen-more { height: 15px; line-height: 15px; padding: 0 4px; border-radius: 8px; font-size: 10px; font-weight: 600; color: var(--muted); background: var(--active); }
@media (prefers-reduced-motion: reduce) { .seen-heads { transition: none; } }
/* view-once mode: "👁 Seen by …" under every view-once message, the countdown, the fade at the end */
.vostat { font-size: 11px; color: var(--muted); line-height: 16px; overflow-wrap: anywhere; cursor: default; }
.vostat.due { color: var(--link); }
.vostat .vo-left { font-variant-numeric: tabular-nums; font-weight: 600; }
.msg.vo-fading .body { opacity: .35; transition: opacity 2.5s linear; }
.vo-toggle { margin-bottom: 10px; }
/* edit history (a server setting, off by default): the "(edited)" button, the header chip, the dialog */
.edited.eh-link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.edited.eh-link:hover, .edited.eh-link:focus-visible { color: var(--text); }
.chan-head .chan-eh { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 7px; border-radius: 10px; color: var(--warn); border: 1px solid currentColor; cursor: pointer; white-space: nowrap; flex: 1000 1 0; max-width: max-content; min-width: 28px; overflow: hidden; } /* takes only the room that is left: the channel name never gives way to it */
.chan-head .chan-eh .eh-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chan-head .chan-eh[hidden] { display: none; }
@media (max-width: 600px) { .chan-head .chan-eh .eh-txt { display: none; } }
.eh-dlg { max-width: 560px; }
.eh-list { list-style: none; margin: 10px 0 14px; padding: 0; max-height: 55vh; overflow-y: auto; }
.eh-ver { padding: 8px 10px; border-left: 3px solid var(--line); margin-bottom: 8px; background: var(--active); border-radius: 0 6px 6px 0; overflow-wrap: anywhere; }
.eh-ver:last-child { border-left-color: var(--link); }
.eh-when { margin-bottom: 2px; }
.eh-confirm { margin: 6px 0 10px; padding-left: 20px; font-size: 13px; }
.eh-confirm li { margin-bottom: 4px; }

/* ===== comfort: status, custom status ===== */
.me .avatar { position: relative; cursor: pointer; }
.me .avatar::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok); border: 3px solid var(--rail);
}
.me .avatar[data-st="idle"]::after, .member-list li.idle .avatar::after { background: var(--warn); }
.me .avatar[data-st="dnd"]::after, .member-list li.dnd .avatar::after { background: var(--bad); }
.me .avatar[data-st="invisible"]::after, .member-list li.offline .avatar::after { background: var(--muted); }
.me .avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member-list li.offline .name { color: var(--muted); }
.member-list .mtext { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cstatus { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); font-weight: 400; }
.cstatus .cs-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cstatus .cs-emoji { flex: none; }
.cstatus img.emoji { width: 14px; height: 14px; }
.me-custom { min-width: 0; overflow: hidden; }
.cf-dlg .cs-row { display: flex; gap: 8px; }
.cf-dlg .cs-row input { margin-bottom: 8px; }
.cf-dlg input.cs-emoji-in { width: 56px; flex: none; text-align: center; font-size: 18px; padding: 6px; }
.cs-quick { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 12px; }
.cs-quick button { border: 0; background: transparent; padding: 4px 6px; font-size: 18px; border-radius: 6px; }
.cs-quick button:hover { background: var(--hover); }
.cs-quick img.emoji { width: 20px; height: 20px; }
.cf-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; margin: 0 0 12px; }
.cf-field > span { font-weight: 600; }
.cf-select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }

/* ===== comfort: keyword alerts, notification dialog ===== */
mark.kw { background: var(--accent-soft); color: var(--link); border-radius: 3px; padding: 0 2px; font-weight: 600; }
.msg.keyword:not(.mention) { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.cf-text { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; resize: vertical; margin: 0 0 12px; }
.cf-dlg .acc-field p.muted { font-size: 13px; margin: 0 0 6px; }

/* ===== comfort: quick switcher, shortcut sheet ===== */
dialog.qs-dlg { width: min(560px, calc(100vw - 24px)); padding: 12px; margin-top: 12vh; }
dialog.qs-dlg .qs-input { margin-bottom: 8px; font-size: 17px; padding: 11px 13px; }
.qs-list { list-style: none; margin: 0; padding: 0; max-height: min(420px, 55dvh); overflow-y: auto; }
.qs-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; min-width: 0; color: var(--muted); }
.qs-item.unread { color: var(--text); font-weight: 600; }
.qs-item.sel { background: var(--active); color: var(--text); }
.qs-item.here .qs-name::after { content: " · you're here"; font-weight: 400; font-size: 12px; color: var(--muted); }
.qs-ico { width: 24px; height: 24px; flex: none; display: grid; place-items: center; font-size: 15px; }
.qs-ico.qs-server { border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 10px; font-weight: 700; color: var(--text); }
.qs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-sub { margin-left: auto; padding-left: 8px; font-size: 12px; font-weight: 400; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.qs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text); flex: none; }
.qs-ment { flex: none; }
.qs-empty { padding: 14px 10px; color: var(--muted); text-align: center; }
.qs-hint { font-size: 12px; color: var(--muted); padding: 8px 4px 0; }
table.keys { width: 100%; border-collapse: collapse; font-size: 14px; margin: 4px 0 14px; }
table.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.keys td.k { white-space: nowrap; padding-right: 14px; color: var(--muted); }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--bg); color: var(--text); font: 600 12px/1.5 ui-monospace, Consolas, monospace; text-align: center; }
dialog#dlgKeys { width: min(520px, calc(100vw - 24px)); }
table.keys .k-note { font-size: 12px; }

/* ===== comfort: appearance ===== */
.log { font-size: var(--chat-font, 15px); }
.log .text { line-height: calc(var(--chat-font, 15px) + 7px); min-height: calc(var(--chat-font, 15px) + 7px); }
.log .msg.first { margin-top: var(--group-gap, 10px); }
html.compact .log .msg { padding-top: 0; padding-bottom: 0; gap: 8px; }
html.compact .log .msg.first { margin-top: calc(var(--group-gap, 10px) / 2); }
html.compact .log .msg .avatar { display: none; }
html.compact .log .msg .gutter { width: 40px; }
html.compact .log .msg .meta { display: inline-flex; margin-right: 6px; vertical-align: baseline; max-width: 40%; }
html.compact .log .msg .meta + .text { display: inline; }
html.compact .log .msg .meta .time { order: -1; }
html.compact .log .side-time { height: calc(var(--chat-font, 15px) + 7px); line-height: calc(var(--chat-font, 15px) + 7px); }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not(.full-motion) *, html:not(.full-motion) *::before, html:not(.full-motion) *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
dialog#dlgLook { width: min(460px, calc(100vw - 24px)); }
.cf-dlg .sep { height: 1px; background: var(--line); margin: 4px 0 12px; }
.cf-field .cf-ctl { display: flex; align-items: center; gap: 8px; flex: none; }
.cf-field > span:first-child { font-weight: 500; }
.cf-dlg input.cf-range { width: 130px; margin: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.cf-out { font-size: 12px; color: var(--muted); width: 34px; text-align: right; }
.cf-dlg input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* ===== comfort: server folders ===== */
.rail-folder { display: flex; flex-direction: column; align-items: center; gap: 8px; border-radius: 24px; flex: none; }
.rail-folder.open { background: color-mix(in srgb, var(--fc) 22%, transparent); padding: 0 0 8px; width: 56px; }
.folder-btn { background: color-mix(in srgb, var(--fc) 35%, var(--panel)); }
.rail-folder.open .folder-btn { background: transparent; }
.rail-folder.open .folder-btn:hover { background: color-mix(in srgb, var(--fc) 25%, transparent); }
.folder-btn.active { background: color-mix(in srgb, var(--fc) 55%, var(--panel)); color: var(--text); }
.folder-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 17px; gap: 2px; width: 36px; }
.folder-grid span { border-radius: 5px; background: var(--panel); font-size: 7px; font-weight: 700; display: grid; place-items: center; overflow: hidden; color: var(--text); letter-spacing: -.02em; }
.folder-ico { position: relative; width: 22px; height: 15px; margin-top: 3px; background: var(--fc); border-radius: 2px 4px 4px 4px; }
.folder-ico::before { content: ""; position: absolute; left: 0; top: -4px; width: 10px; height: 5px; background: var(--fc); border-radius: 2px 2px 0 0; }
.rail-ghost { position: fixed; z-index: 200; pointer-events: none; opacity: .85; box-shadow: var(--menu-shadow); margin: 0; }
.rail-btn.dragging { opacity: .35; }
body.rail-dragging, body.rail-dragging * { cursor: grabbing !important; }
.rail-btn.drop-merge, .folder-btn.drop-into { outline: 3px solid var(--accent); outline-offset: 2px; }
.rail-btn.drop-before::before, .rail-btn.drop-after::after { content: ""; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: var(--accent); }
.rail-btn.drop-before::before { top: -6px; }
.rail-btn.drop-after::after { bottom: -6px; }
.server-list.drop-end::after { content: ""; width: 40px; height: 3px; border-radius: 2px; background: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.swatches .sw { width: 28px; height: 28px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatches .sw.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel) inset; }
.cf-dlg .swatches input.sw-custom { width: 36px; height: 30px; padding: 0 2px; margin: 0; border-radius: 8px; cursor: pointer; }
/* ---------- messaging extras ---------- */
/* markdown: headers, subtext, lists, masked links */
.text .md-h { font-weight: 700; line-height: 1.3; margin: 6px 0 2px; }
.text .md-h1 { font-size: 1.5em; }
.text .md-h2 { font-size: 1.25em; }
.text .md-h3 { font-size: 1.08em; }
.text .md-sub { font-size: 12px; line-height: 16px; color: var(--muted); }
.text .md-list { margin: 2px 0; padding-left: 24px; }
.text .md-list li { padding-left: 2px; }
.text .md-list li.md-in { margin-left: 20px; list-style-type: circle; }
.text ol.md-list li.md-in { list-style-type: lower-alpha; }
.text a.masked { text-decoration-style: dotted; }
.text .masked-host { color: var(--muted); font-size: 12px; }

/* formatting preview (above the composer) */
.md-preview { margin: 0 16px 6px; padding: 6px 10px 8px; max-height: 160px; overflow-y: auto; background: var(--side); border: 1px dashed var(--line); border-radius: 10px; font-size: 14px; flex: none; }
.md-preview-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.preview-btn.on { color: var(--link); background: var(--accent-soft); }

/* slash commands popup */
.slash-pop { min-width: 280px; max-height: 320px; overflow-y: auto; }
.slash-pop .slash-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 10px 2px; }
.slash-pop button { display: flex; align-items: baseline; gap: 8px; }
.slash-cmd { font-weight: 600; flex: none; }
.slash-arg { color: var(--muted); font-size: 12px; flex: none; }
.slash-desc { color: var(--muted); font-size: 13px; margin-left: auto; padding-left: 12px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.slash-pop button.sel .slash-arg, .slash-pop button.sel .slash-desc, .slash-pop button:hover .slash-arg, .slash-pop button:hover .slash-desc { color: inherit; opacity: .85; }

/* message link chip */
.text a.msg-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); text-decoration: none; font-weight: 600; font-size: 13px; vertical-align: baseline; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text a.msg-chip:hover { text-decoration: underline; }
.msg-chip-ico { font-size: 12px; }

/* forwarded messages */
.fwd-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--muted); margin: 1px 0 2px; }
.fwd-head b { color: var(--text); font-weight: 600; }
.fwd-head.link { cursor: pointer; }
.fwd-head.link:hover b { text-decoration: underline; }
.fwd-lost { color: var(--warn); }
.text.fwd-text { border-left: 3px solid var(--line); padding-left: 10px; }

/* polls */
.poll { max-width: min(100%, 440px); margin: 4px 0 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.poll-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.poll-q { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.poll-sub { font-size: 12px; color: var(--muted); margin-top: -4px; }
.poll-opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 10px; border-radius: 8px; background: var(--bg); min-width: 0; }
.poll-opt:disabled { cursor: default; opacity: 1; }
.poll-opt.mine { border-color: var(--accent); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width .3s; pointer-events: none; }
.poll-opt > :not(.poll-bar) { position: relative; }
.poll-check { width: 18px; height: 18px; flex: none; border: 2px solid var(--muted); border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--on-accent); }
.poll.multi .poll-check { border-radius: 4px; }
.poll-opt.mine .poll-check { background: var(--accent); border-color: var(--accent); }
.poll.ended .poll-check { display: none; }
.poll-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.poll-num { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.poll-foot { font-size: 12px; color: var(--muted); }
.poll-foot .link-btn { font-size: 12px; }
.poll-anon { font-size: 11.5px; color: var(--muted); line-height: 1.35; padding-top: 6px; border-top: 1px dashed var(--line); }
.poll.anon .poll-tag { color: var(--accent); }
.poll-dlg .check small { font-size: 12px; line-height: 1.35; }
.poll-dlg .poll-answer { display: flex; gap: 4px; align-items: center; }
.poll-dlg .poll-answer input { margin-bottom: 6px !important; }
.poll-dlg .poll-answer .icon-btn { margin-bottom: 6px; }
.poll-dlg .poll-answer .icon-btn:disabled { opacity: .3; cursor: default; }
.poll-dlg .acc-field { margin-bottom: 10px; }
/* checklists (app.js "checklists"): the card in a message, its dialogs */
.checklist { max-width: min(100%, 440px); margin: 4px 0 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.cl-title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.cl-items { display: flex; flex-direction: column; gap: 2px; }
.cl-item { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; }
.cl-item:hover { background: var(--bg); }
.cl-check { flex: none; width: 20px; height: 20px; padding: 0; border: 2px solid var(--muted); border-radius: 5px; background: transparent; display: grid; place-items: center; color: transparent; cursor: pointer; }
.cl-check .ui-ico, .cl-check svg { width: 14px; height: 14px; }
.cl-check:not(:disabled):hover { border-color: var(--accent); }
.cl-check:disabled { cursor: default; opacity: .6; }
.cl-item.done .cl-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cl-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cl-item.done .cl-label { text-decoration: line-through; color: var(--muted); }
.cl-by { flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 40%; font-size: 12px; color: var(--muted); cursor: default; }
.cl-by-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-av.avatar { width: 16px; height: 16px; font-size: 8px; font-weight: 700; flex: none; }
.cl-rm { flex: none; width: 22px; height: 22px; padding: 2px; opacity: 0; }
.cl-item:hover .cl-rm, .cl-rm:focus-visible { opacity: .7; }
@media (hover: none) { .cl-rm { opacity: .5; } }
.cl-empty { font-size: 13px; color: var(--muted); }
.checklist .poll-foot .link-btn { font-size: 12px; }
.cl-dlg .cl-hint { font-size: 12px; margin: 4px 0 8px; }
.cl-dlg .cl-add-ta { width: 100%; box-sizing: border-box; resize: vertical; margin-bottom: 8px; }
.mf-select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); }

/* YouTube and videos */
.embeds { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; }
.yt { width: min(100%, 400px); aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.yt iframe { width: 100%; height: 100%; border: 0; display: block; }
.yt-thumb { position: relative; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: #111; display: block; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-play { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 22px; flex: none; }
.yt-thumb .yt-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.yt-thumb:hover .yt-play { background: #e00; }
.yt-label { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px #000; }
.vid { max-width: min(100%, 400px); }
.vid video { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; background: #000; }
.vid-start { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 360px; padding: 8px 12px 8px 8px; text-align: left; border-radius: 8px; }
.vid-start .yt-play { width: 36px; height: 36px; font-size: 15px; }
.vid-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.files .vid { flex: 0 1 auto; }

/* inbox badge */
.inbox-btn { position: relative; }
.mf-badge { position: absolute; right: 0; top: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--badge); color: var(--on-bad); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }

/* side panels: saved, inbox, search */
.mf-panel {
  position: absolute; top: 8px; right: 8px; z-index: 30; width: min(420px, calc(100% - 16px)); max-height: calc(100% - 16px);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--menu-shadow);
}
.mf-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.mf-head .link-btn { font-size: 12px; }
.mf-body { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.mf-note, .mf-empty { margin: 4px 6px; font-size: 13px; color: var(--muted); }
.mf-empty { text-align: center; padding: 16px 0; }
.mf-item { position: relative; padding: 7px 30px 7px 10px; border-radius: 8px; border: 1px solid transparent; min-width: 0; }
.mf-item.link { cursor: pointer; }
.mf-item.link:hover, .mf-item.link:focus-visible { background: var(--hover); border-color: var(--line); outline: none; }
.mf-item.unread { background: var(--accent-soft); }
.mf-where { display: flex; gap: 6px; align-items: baseline; font-size: 11px; color: var(--muted); min-width: 0; }
.mf-where > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 600; }
.mf-when { flex: none; }
.mf-tag { flex: none; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--accent); color: var(--on-accent); }
.mf-text { font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.mf-x { position: absolute; right: 2px; top: 4px; padding: 2px 6px; font-size: 12px; }
.mf-search { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
.mf-help { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px; }
.mf-chip { padding: 1px 7px; font-size: 11px; border-radius: 10px; color: var(--muted); }
.mf-chip:hover { color: var(--text); }
.mf-results { display: flex; flex-direction: column; gap: 2px; }

/* forward: channel picker */
.pick-dlg .pick-list { max-height: min(50vh, 420px); overflow-y: auto; margin: 0 0 12px; display: flex; flex-direction: column; }
.pick-server { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px 2px; }
.pick-ch { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: 6px; }
.pick-ch:hover, .pick-ch:focus-visible { background: var(--accent); color: var(--on-accent); }
.pick-ch .hash { color: inherit; opacity: .7; }
.pick-ch small { opacity: .7; }

/* ===== profiles: pictures, profile card, edit profile, cropper ===== */
.avatar { overflow: visible; position: relative; }
.avatar.has-img { background: transparent !important; }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.clickable, .msg .who { cursor: pointer; }
.msg .who:hover { text-decoration: underline; }
.mention-pop button.mention-item { display: flex; align-items: center; gap: 8px; }
.mention-pop button.mention-item > span { overflow: hidden; text-overflow: ellipsis; }

.pcard { border-radius: 12px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.pc-banner { height: 96px; position: relative; overflow: hidden; }
.pc-banner.has-banner { height: auto; aspect-ratio: 5 / 2; }
.pc-banner > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-head { padding: 0 16px; height: 54px; display: flex; align-items: flex-start; }
.pc-av { width: 84px; height: 84px; font-size: 30px; margin-top: -44px; border: 6px solid var(--panel); box-sizing: content-box; }
.pc-av[data-st]::after { content: ""; position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ok); border: 4px solid var(--panel); }
.pc-av[data-st="idle"]::after { background: var(--warn); }
.pc-av[data-st="dnd"]::after { background: var(--bad); }
.pc-av[data-st="invisible"]::after, .pc-av[data-st="offline"]::after { background: var(--muted); }
.pc-body { padding: 8px 16px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pc-name { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.pc-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.pc-cs .cstatus { font-size: 14px; color: var(--text); }
.pc-sec h4 { margin: 0 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pc-about { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-sec .chips { gap: 4px; }

dialog.pe-dlg { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.pe-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.pe-form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pe-form input:not([type="checkbox"]):not([type="color"]), .pe-form textarea, .pe-form select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); color: var(--text); font: inherit; margin: 0;
}
.pe-form textarea { resize: vertical; }
.pe-form input[type="color"] { width: 48px; height: 32px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); margin: 0; }
.pe-form .row { justify-content: flex-start; align-items: center; }
.pe-form .row.end { justify-content: flex-end; }
.pe-form .check { margin: 0; align-items: center; }
.pe-form .acc-err { margin: 0 !important; }
.pe-count { float: right; font-weight: 400; text-transform: none; letter-spacing: 0; }
.pe-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 6px; }
.pe-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pe-server { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.pe-server h4 { margin: 0; font-size: 14px; }
.pe-server p { margin: 0; }
@media (max-width: 680px) {
  .pe-grid { grid-template-columns: 1fr; }
  .pe-preview { position: static; order: -1; }
}

dialog.crop-dlg { width: fit-content; max-width: calc(100vw - 24px); }
.crop-frame { position: relative; display: inline-block; border-radius: 8px; overflow: hidden; line-height: 0; background: var(--code); }
.crop-frame.round::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.5); pointer-events: none; }
.crop-cv { touch-action: none; cursor: grab; display: block; }
.crop-cv:active { cursor: grabbing; }
.crop-cv:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.crop-zoom { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 13px; }
.crop-zoom input { flex: 1; margin: 0 !important; padding: 0 !important; border: 0 !important; accent-color: var(--accent); }

/* the profile card popup */
dialog.pcard-dlg { padding: 0; width: min(320px, calc(100vw - 16px)); border: 0; background: transparent; overflow: visible; max-height: calc(100dvh - 16px); }
dialog.pcard-dlg::backdrop { background: rgba(0,0,0,.25); }
dialog.pcard-dlg.anchored { position: fixed; margin: 0; }
dialog.pcard-dlg .pcard { box-shadow: var(--menu-shadow); max-height: calc(100dvh - 16px); overflow-y: auto; }
.pc-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; line-height: 28px; }
.pc-x:hover { background: rgba(0,0,0,.65); }
.pc-safety summary { cursor: pointer; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pc-safety .safety { margin-top: 6px; font-size: 13px; }
.pc-safety p { margin: 6px 0 0; }
.pc-actions { justify-content: flex-start; }
.pc-actions .primary { flex: 1; }
.pc-actions button:disabled { opacity: .45; cursor: not-allowed; }
.text .at { cursor: pointer; }
@media (max-width: 680px) {
  dialog.pcard-dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; }
  dialog.pcard-dlg .pcard { border-radius: 14px 14px 0 0; max-height: 85dvh; }
}

/* moderation */
.mem-row.ban-row { grid-template-columns: auto minmax(0, 1fr) auto; }

/* slowmode line over the composer */
.slow-info { padding: 2px 16px 4px; font-size: 12px; color: var(--muted); }
.slow-info.waiting { color: var(--warn); font-weight: 600; }

/* channel permission overrides: deny / default / allow */
.perm > span.tri-group, .tri-group { display: inline-flex; flex-direction: row; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.tri-group .tri { border: 0; border-radius: 0; padding: 4px 11px; background: transparent; color: var(--muted); font-weight: 700; }
.tri-group .tri + .tri { border-left: 1px solid var(--line); }
.tri-group .tri.on.deny { background: var(--bad); color: var(--on-bad); }
.tri-group .tri.on.allow { background: var(--ok); color: var(--on-ok); }
.tri-group .tri.on.inherit { background: var(--active); color: var(--text); }
.tri-group .tri:disabled { opacity: .45; cursor: not-allowed; }
.role-list li .avatar.xs { margin-left: -2px; }

/* server icon, banner, invite cards */
.rail-btn > img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; transition: border-radius .15s; }
.rail-btn.has-img { background: transparent; }
.rail-btn .pip, .rail-btn .badge { z-index: 1; }
.server-banner { height: 84px; overflow: hidden; flex: none; background: var(--rail); }
.server-banner > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.srv-look { position: relative; height: 150px; border-radius: 10px; overflow: hidden; background: var(--code); flex: none; }
.srv-look-banner { position: absolute; inset: 0 0 40px; background: var(--accent-soft); }
.srv-look-banner > img, .srv-look-icon > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.srv-look-icon { position: absolute; left: 14px; bottom: 8px; width: 72px; height: 72px; border-radius: 20px; overflow: hidden; display: grid; place-items: center; background: var(--panel); border: 4px solid var(--panel); font-weight: 700; font-size: 22px; }
.invite-card { display: flex; flex-direction: column; max-width: 400px; margin: 6px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); white-space: normal; }
.inv-banner { display: block; height: 70px; overflow: hidden; }
.inv-banner > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-width: 0; }
.inv-icon { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--accent-soft); font-weight: 700; }
.inv-icon > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.inv-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-text small { font-size: 12px; overflow-wrap: anywhere; }
.inv-row button { flex: none; }

/* welcome screen */
dialog.welcome-dlg { width: min(460px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
dialog.welcome-dlg form { display: flex; flex-direction: column; gap: 12px; padding: 0 18px 18px; max-height: calc(100dvh - 40px); overflow-y: auto; }
.wel-head { margin: 0 -18px; }
.wel-head .inv-row { padding: 14px 18px 4px; }
.wel-head .inv-text b { font-size: 18px; }
.wel-banner { height: 110px; overflow: hidden; background: var(--accent-soft); }
.wel-banner > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wel-rules { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; background: var(--code); border-radius: 8px; padding: 10px 12px; max-height: 40vh; overflow-y: auto; }
.welcome-dlg .check { margin: 0; align-items: center; }
.welcome-dlg p.small { margin: 0 0 6px; }
.role-chip.pick { cursor: pointer; padding: 4px 10px; font-size: 13px; color: var(--text); }
.role-chip.pick.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.slow-info .link-btn { font-size: 12px; }

/* user settings page: full screen like server settings; nav left (grouped), one section right */
dialog.us-dlg { background: var(--bg); }
.us-wrap { display: grid; grid-template-columns: minmax(232px, 1fr) minmax(0, 2.4fr); height: 100%; }
.us-nav { background: var(--side); display: flex; justify-content: flex-end; overflow-y: auto; min-height: 0; }
.us-nav-in { width: 218px; padding: 60px 8px 20px 16px; display: flex; flex-direction: column; gap: 2px; }
.us-nav-head { display: none; }
.us-nav-title { font-size: var(--fs-cap); font-weight: 700; color: var(--muted); padding: 6px 10px 4px; }
.us-nav-title ~ .us-nav-title { margin-top: var(--sp-4); }
.us-tab { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-body); }
.us-tab:hover { background: var(--hover); }
.us-tab.on { background: var(--active); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.us-tab.us-logout { color: var(--bad); }
.us-tab.us-logout:hover { background: rgba(209,75,75,.1); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.us-nav-sep { height: 1px; background: var(--line); margin: 10px 10px; }
.us-ver { font-size: 12px; color: var(--muted); padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.us-body { display: flex; min-width: 0; min-height: 0; background: var(--bg); }
.us-scroll { flex: 1; min-height: 0; height: 100%; overflow-y: auto; display: flex; align-items: flex-start; }
.us-col { flex: 0 1 740px; min-width: 0; padding: 60px 40px 80px; }
.us-tools { flex: none; width: 72px; padding-top: 60px; position: sticky; top: 0; }
.us-head { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--sp-5); }
.us-head h2 { margin: 0; font-size: var(--fs-title); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.us-back { display: none; font-size: 20px; }
.us-close { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--muted); }
.us-close:hover { background: none; color: var(--text); }
.us-close .us-x { width: 36px; height: 36px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-size: 15px; }
.us-close:hover .us-x { background: var(--hover); }
.us-close .us-esc { font-size: 12px; font-weight: 700; }
.us-close:focus-visible { outline: none; }
.us-close:focus-visible .us-x { outline: 2px solid var(--accent); outline-offset: 2px; }

.us-content { display: flex; flex-direction: column; font-size: var(--fs-body); }
/* section headings: sentence case in the text colour (they were small grey capitals), the line under them is their footnote */
.us-content .us-h, .us-radios legend.us-h { font-size: var(--fs-sec); font-weight: 650; line-height: 1.3; color: var(--text); margin: 0 0 var(--sp-1); padding: 0; }
.us-content .us-h + .us-desc { margin-bottom: var(--sp-3); }
/* sections are set apart by space and their grouped rows, not a rule */
.us-hr { border: 0; height: 0; margin: var(--sp-6) 0 var(--sp-2); width: 100%; flex: none; }
.us-dlg .us-desc { color: var(--muted); font-size: var(--fs-help); line-height: 1.4; margin: 3px 0 0; overflow-wrap: anywhere; }
.us-content > .us-desc, .us-form > .us-desc { margin: 0 0 var(--sp-3); }
.us-dlg .us-note { margin-top: var(--sp-2); }
.us-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 0; }
.us-row + .us-row { border-top: 1px solid var(--line); }
.us-row-tight { padding: 8px 0; }
/* a run of rows straight in a page is one group: a rounded panel with hairlines between the rows (like a grouped
   form in macOS System Settings); a lone row is a group of one. Rows inside cards and forms keep the flat look */
.us-content > .us-row { background: var(--panel); border: 1px solid var(--line); border-block-width: 0; padding: var(--sp-3) var(--sp-4); }
.us-content > .us-row + .us-row { border-top-width: 1px; }
.us-content > .us-row:not(.us-row + .us-row) { border-top-width: 1px; border-radius: var(--r-lg) var(--r-lg) 0 0; margin-top: var(--sp-1); }
.us-content > .us-row:not(:has(+ .us-row)) { border-bottom-width: 1px; border-end-start-radius: var(--r-lg); border-end-end-radius: var(--r-lg); margin-bottom: var(--sp-2); }
.us-content > .us-row.us-row-tight { padding-block: var(--sp-2); }
.us-content > .us-row.set-flash { border-radius: var(--r-lg); }
.us-row-text { flex: 1 1 260px; min-width: 0; }
/* a switch stays on the right of its text, also on a phone (toggles.md: a switch belongs in the row it controls) */
.us-row:has(> .us-row-ctl > input.us-switch:only-child) { flex-wrap: nowrap; }
.us-row:has(> .us-row-ctl > input.us-switch:only-child) > .us-row-text { flex-basis: 0; }
.us-row-title { display: block; font-weight: 500; font-size: var(--fs-body); line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
label.us-row-title { cursor: pointer; }
.us-row-ctl { flex: 0 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.us-value { font-weight: 600; overflow-wrap: anywhere; }
.us-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.us-dlg .us-btns > button, .us-dlg .us-row-ctl > button, .us-dlg .us-copy > button { min-height: var(--ctl-h); padding: 5px 14px; font-size: var(--fs-row); }
.us-dlg button.us-danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.us-dlg button.us-danger:hover { background: var(--bad); color: var(--on-bad); }
.us-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; background: var(--hover); color: var(--muted); white-space: nowrap; }
/* (quick reactions) Settings → Messages: the six emoji of a message's menu; editable slots in "My own picks" */
.us-qr { display: flex; flex-wrap: wrap; gap: 6px; }
.us-qr-slot { box-sizing: border-box; width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.us-qr-slot img { width: 24px; height: 24px; margin: 0; pointer-events: none; }
.us-qr.edit .us-qr-slot { border-color: var(--ctl-line); cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.us-qr.edit .us-qr-slot:hover { background: var(--hover); }
.us-qr.dragging, .us-qr.dragging .us-qr-slot { cursor: grabbing; }
.us-qr-slot.lift { opacity: .45; }
.us-qr-slot.drop { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (forced-colors: active) { .us-qr-slot.drop { outline: 2px solid Highlight; } }
.us-pill.ok { background: rgba(47,158,91,.15); background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.us-pill.bad { background: rgba(209,75,75,.12); background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.us-pill.warn { background: var(--accent-soft); color: var(--warn); }
.us-card { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); margin: 0 0 var(--sp-5); flex-wrap: wrap; }
.us-me-text { flex: 1 1 160px; min-width: 0; }
.us-me-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.us-me-text .us-desc { margin: 2px 0 0; }
.us-copy { display: flex; align-items: center; gap: 8px; min-width: 0; }
.us-copy code { font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--code); padding: 6px 8px; border-radius: 6px; user-select: all; overflow-wrap: anywhere; min-width: 0; }
.us-copy code.us-safety { font-size: 13px; letter-spacing: .04em; }
.us-copy button { flex: none; padding: 6px 12px; }
.us-list { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.us-list li { margin: 4px 0; overflow-wrap: anywhere; }
.us-kv { list-style: none; margin: 0 0 4px; padding: 0; }
.us-kv li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.us-kv-k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* controls: switch, radio cards, slider, select, text */
.us-dlg input.us-switch, .setup-dlg input.us-switch, .spl-dlg input.us-switch, .plm-dlg input.us-switch, .srv-card input.us-switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 42px; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 12px; background: var(--muted); cursor: pointer; transition: background .15s; }
.us-dlg input.us-switch::before, .setup-dlg input.us-switch::before, .spl-dlg input.us-switch::before, .plm-dlg input.us-switch::before, .srv-card input.us-switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.us-dlg input.us-switch:checked, .setup-dlg input.us-switch:checked, .spl-dlg input.us-switch:checked, .plm-dlg input.us-switch:checked, .srv-card input.us-switch:checked { background: var(--accent); }
.us-dlg input.us-switch:checked::before, .setup-dlg input.us-switch:checked::before, .spl-dlg input.us-switch:checked::before, .plm-dlg input.us-switch:checked::before, .srv-card input.us-switch:checked::before { transform: translateX(18px); background: var(--on-accent); }
.us-dlg input.us-switch:focus-visible, .setup-dlg input.us-switch:focus-visible, .spl-dlg input.us-switch:focus-visible, .plm-dlg input.us-switch:focus-visible, .srv-card input.us-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.us-dlg input.us-switch:disabled { opacity: .45; cursor: not-allowed; }
/* Windows high contrast: the drawn switch keeps a visible track, knob and on state (system colours) */
@media (forced-colors: active) {
  :is(.us-dlg, .setup-dlg, .spl-dlg, .plm-dlg, .srv-card) input.us-switch { border: 1px solid ButtonText; background: Canvas; forced-color-adjust: none; }
  :is(.us-dlg, .setup-dlg, .spl-dlg, .plm-dlg, .srv-card) input.us-switch::before { top: 2px; left: 2px; background: ButtonText; box-shadow: none; }
  :is(.us-dlg, .setup-dlg, .spl-dlg, .plm-dlg, .srv-card) input.us-switch:checked { background: Highlight; border-color: Highlight; }
  :is(.us-dlg, .setup-dlg, .spl-dlg, .plm-dlg, .srv-card) input.us-switch:checked::before { background: HighlightText; }
  :is(.us-dlg, .setup-dlg, .spl-dlg, .plm-dlg, .srv-card) input.us-switch:disabled { border-color: GrayText; }
}
.us-radios { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.us-radio { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-width: 0; }
.us-radio:hover { border-color: var(--muted); }
.us-radio.on { border-color: var(--accent); background: var(--accent-soft); }
.us-radio:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.us-dlg .us-radio input[type="radio"] { width: 18px; height: 18px; margin: 0; padding: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.us-radio label { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: pointer; }
.us-radio-label { font-weight: 600; }
.us-radio .us-desc { margin: 1px 0 0; }
.us-st { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.us-st-online { background: var(--ok); }
.us-st-idle { background: var(--warn); }
.us-st-dnd { background: var(--bad); }
.us-st-invisible { border: 3px solid var(--muted); }
.us-play { flex: none; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--text); }
.us-range-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.us-dlg input.us-range { width: 180px; min-width: 0; height: var(--ctl-h); margin: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); cursor: pointer; }
.us-dlg input.us-range:disabled { cursor: not-allowed; opacity: .45; }
/* the value next to a slider: a small fixed-width readout, so the slider doesn't jump as it changes */
.us-out { flex: none; min-width: 48px; padding: 2px 6px; border-radius: var(--r-sm); background: var(--hover); text-align: center; font-variant-numeric: tabular-nums; color: var(--text); font-size: var(--fs-cap); font-weight: 600; }
.us-select { min-height: var(--ctl-h); border: 1px solid var(--ctl-line); border-radius: var(--r-md); padding: 5px 10px; background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-row); max-width: 100%; cursor: pointer; }
.us-select:hover:not(:disabled) { border-color: var(--text); }
.us-select:disabled { opacity: .45; cursor: not-allowed; }
.us-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.us-text { width: 100%; border: 1px solid var(--ctl-line); border-radius: var(--r-md); padding: 8px 10px; background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-row); resize: vertical; margin: 0 0 4px; }
/* tick boxes in settings: the accent, a little bigger than the browser's */
.us-dlg input[type="checkbox"]:not(.us-switch) { accent-color: var(--accent); width: 16px; height: 16px; flex: none; cursor: pointer; }
.us-dlg input[type="checkbox"]:not(.us-switch):disabled { cursor: not-allowed; }
.us-dlg .check:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
.us-form { display: flex; flex-direction: column; }
.us-form > .us-row-title { margin: 0 0 4px; }
.us-cs-row { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.us-dlg .us-cs-row input { margin: 0; background: var(--panel); }
.us-dlg input.us-cs-emoji { width: 56px; flex: none; text-align: center; font-size: 18px; padding: 6px; }
.us-cs-after .us-row-title { font-size: 14px; }
.us-cs-now { padding: 10px 14px; gap: 6px; margin: 0 0 12px; font-size: 14px; }
.us-cs-now .us-desc { margin: 0; }
.us-dlg .acc-err { margin: 0 0 8px !important; }

/* appearance preview: real message markup, so it follows compact / font size / spacing / emoji */
.us-preview-wrap { margin: 0 0 24px; }
.us-dlg .log.us-preview { flex: none; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 2px 0 12px; pointer-events: none; }

/* Appearance: a small Hive in a theme's tokens (theme.js sets them on .us-mini), theme cards, the
   custom theme editor and the background picker */
.us-mini { display: flex; height: 236px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); color: var(--text); position: relative; isolation: isolate; pointer-events: none; user-select: none; }
.us-mini-rail { flex: none; width: 34px; background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.us-mini-rail i { width: 22px; height: 22px; border-radius: 50%; background: var(--panel); }
.us-mini-rail i.on { border-radius: 7px; background: var(--accent); }
.us-mini-side { flex: none; width: 118px; background: var(--side); display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.us-mini-side b { color: var(--text); font-size: 12px; padding: 2px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-mini-side span { padding: 3px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-mini-side span.on { background: var(--active); color: var(--text); font-weight: 600; }
.us-mini-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; isolation: isolate; }
.us-mini-head { flex: none; padding: 7px 12px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.us-dlg .us-mini .log.us-preview { flex: 1; border: 0; border-radius: 0; background: none; padding: 0 0 4px; }
.us-mini-cmp { flex: none; display: flex; align-items: center; justify-content: space-between; margin: 0 10px 10px; padding: 7px 10px; border: 1px solid var(--box-focus, var(--accent)); border-radius: 8px; background: var(--box, var(--panel)); color: var(--box-muted, var(--muted)); font-size: 12px; }
.us-mini-send { color: var(--on-accent); background: var(--accent); border-radius: 5px; padding: 0 6px; }
.us-mini-wall, .us-mini-shade { position: absolute; inset: 0; z-index: -1; }
.us-mini-shade { background: var(--bg); }
.us-mini.wall-all { background: transparent; }
.us-mini.wall-all .us-mini-rail { background: color-mix(in srgb, var(--rail) var(--mini-op), transparent); }
.us-mini.wall-all .us-mini-side { background: color-mix(in srgb, var(--side) var(--mini-op), transparent); }
.us-mini { container-type: inline-size; }
@container (max-width: 400px) { .us-mini-side { display: none; } }

.us-tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.us-tcard { position: relative; display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); min-width: 0; padding: 0; overflow: hidden; }
.us-tcard:hover { border-color: var(--muted); }
.us-tcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.us-tcard:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.us-tcard > label { display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.us-dlg input.us-tcard-in, .setup-dlg input.us-tcard-in { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; pointer-events: none; }
.us-tcard-name { padding: 6px 8px; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-tcard.has-edit .us-tcard-name { padding-right: 34px; }
.us-tcard.on .us-tcard-name::before { content: "✓ "; color: var(--link); }
.us-tcard-edit { position: absolute; right: 2px; bottom: 1px; padding: 4px 8px; font-size: 14px; }
.us-tsw { display: flex; height: 58px; background: var(--bg); border-bottom: 1px solid var(--line); }
.us-tsw-side { width: 26%; background: var(--side); border-right: 1px solid var(--line); }
.us-tsw-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 10px; }
.us-tsw-body i { display: block; height: 6px; border-radius: 3px; }
.us-tsw-body .l1 { width: 80%; background: var(--text); }
.us-tsw-body .l2 { width: 55%; background: var(--muted); }
.us-tsw-body .acc { width: 34%; height: 10px; border-radius: 5px; background: var(--accent); }
.us-tsw-split { display: flex; }
.us-tsw-split .us-tsw { flex: 1; min-width: 0; }
.us-tsw-split .us-tsw + .us-tsw .us-tsw-side { display: none; }
button.us-tnew { align-items: center; justify-content: center; gap: 2px; border-style: dashed; color: var(--muted); min-height: 90px; }
button.us-tnew:hover { color: var(--text); }
.us-tnew-plus { font-size: 26px; line-height: 1; }

/* the custom theme editor (usThemeEditor; redesign 18 Nov). Its parts (Name, Colours, Effects, Messages) are grouped
   forms like the settings pages: a heading with one line under it, then rows on a rounded panel with hairlines.
   Every row is the same grid: the label (and a short helper or a tick box under it) on the left, the control on
   the right, so the eye runs down one column of names and one of controls. Folded sections are rows too. */
.us-card.us-ted { flex-direction: column; align-items: stretch; gap: var(--sp-3); margin: var(--sp-4) 0 0; padding: var(--sp-4) var(--sp-4) var(--sp-4); background: var(--bg); }
.us-ted > .us-h { margin: 0; font-size: var(--fs-sec); }
.us-ted-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
.us-ted-cols { display: flex; flex-direction: column; gap: var(--sp-5); }
.us-ted-main { container-type: inline-size; }
.us-ted-head { display: flex; flex-direction: column; gap: 2px; margin: 0 0 var(--sp-2); }
.us-dlg h4.us-ted-sub { margin: 0; font-size: var(--fs-body); font-weight: 650; color: var(--text); }
.us-dlg .us-ted-lead { margin: 0; }
/* a part: everything but its heading is one rounded group */
.us-ted-part { display: flex; flex-direction: column; }
.us-ted-part > :not(.us-ted-head) { background: var(--panel); border: 1px solid var(--line); border-block-width: 0; margin: 0; }
.us-ted-part > :not(.us-ted-head) + :not(.us-ted-head) { border-top-width: 1px; }
.us-ted-part > :not(.us-ted-head):first-child, .us-ted-part > .us-ted-head + * { border-top-width: 1px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.us-ted-part > :not(.us-ted-head):last-child { border-bottom-width: 1px; border-end-start-radius: var(--r-lg); border-end-end-radius: var(--r-lg); }
.us-ted-part > :not(.us-ted-head):first-child:last-child, .us-ted-part > .us-ted-head + :last-child { border-radius: var(--r-lg); }
.us-ted-part > .us-ted-row { padding: var(--sp-2) var(--sp-4); min-height: 48px; }
.us-ted-part > p.us-desc { padding: var(--sp-2) var(--sp-4); }
/* the row: label | control; a helper (an "automatic" tick box, the reason it is dimmed) under the label */
.us-ted-row { display: grid; grid-template-columns: minmax(6.5em, 1fr) auto; align-items: center; gap: 2px var(--sp-3); min-height: 36px; }
.us-ted-row > .us-row-title { grid-column: 1; font-size: var(--fs-row); font-weight: 500; overflow-wrap: break-word; }
.us-fx-sec[open] > .us-ted-row { padding-block: 2px; }
.us-fx-sec[open] > .us-fx-checks { margin-block: 2px 6px; }
.us-fx-sec[open] > .us-fx-note { margin-top: 2px; }
/* a control that is off because of another one (also the ones built elsewhere, like the channel list's): its label dims too */
.us-ted-row:has(> select:disabled, > .us-range-wrap input:disabled) > .us-row-title { color: var(--muted); }
.us-ted-row > :not(.us-row-title):not(.us-ted-auto):not(.us-ted-why) { grid-column: 2; grid-row: 1; justify-self: end; }
.us-ted-row:has(> .us-ted-auto, > .us-ted-why:not([hidden])) > :not(.us-row-title):not(.us-ted-auto):not(.us-ted-why) { grid-row: 1 / span 2; }
.us-ted-row:has(> .us-ted-auto):has(> .us-ted-why:not([hidden])) > :not(.us-row-title):not(.us-ted-auto):not(.us-ted-why) { grid-row: 1 / span 3; }
.us-ted-row:has(> .us-ted-auto, > .us-ted-why:not([hidden])) > .us-row-title { align-self: end; }
.us-ted-row > .us-ted-auto, .us-ted-row > .us-ted-why { grid-column: 1; grid-row: 2; }
.us-ted-row > .us-ted-auto ~ .us-ted-why { grid-row: 3; }
.us-dlg .us-ted-row .us-select { min-width: 0; max-width: min(240px, 58cqi); }
.us-dlg .us-ted-row input.us-range { width: clamp(80px, 22cqi, 170px); }
.us-ted-master > .us-row-title { font-weight: 600; }
.us-ted-name input.us-input { width: min(240px, 100%); }
.us-ted-ctl { display: flex; align-items: center; gap: 6px; }
/* dimmed: a setting that waits for another, with why */
.us-ted-row.off > .us-row-title { color: var(--muted); }
.us-dlg .us-ted-why { display: block; font-size: var(--fs-cap); font-weight: 400; color: var(--muted); line-height: 1.35; }
.us-ted-why[hidden] { display: none; }
/* a narrow settings column (the preview beside it, or a phone): the control goes under its label */
@container (max-width: 250px) {
  .us-ted-main .us-ted-row { grid-template-columns: minmax(0, 1fr); }
  .us-ted-main .us-ted-row > * { grid-column: 1 !important; grid-row: auto !important; justify-self: start; }
  .us-dlg .us-ted-row input.us-range { width: min(170px, 60cqi); }
}
/* colour wells: one size everywhere in settings, the colour filling a rounded well */
.us-dlg input.us-color { width: 44px; height: var(--ctl-h); padding: 3px; margin: 0; border: 1px solid var(--ctl-line); border-radius: var(--r-md); background: var(--panel); cursor: pointer; flex: none; }
.us-dlg input.us-color::-webkit-color-swatch-wrapper { padding: 0; }
.us-dlg input.us-color::-webkit-color-swatch { border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.us-dlg input.us-color::-moz-color-swatch { border: 0; border-radius: 5px; }
.us-dlg input.us-color:hover:not(:disabled) { border-color: var(--text); }
.us-dlg input.us-color:disabled { opacity: .4; cursor: not-allowed; }
.us-dlg input.us-hex { width: 84px; min-height: var(--ctl-h); margin: 0; padding: 5px 8px; border-color: var(--ctl-line); background: var(--panel); font: 13px ui-monospace, Consolas, monospace; }
.us-dlg input.us-hex:disabled { opacity: .45; }
.us-dlg input.us-hex.bad { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.us-dlg .us-ted-auto { margin: 0; justify-content: flex-start; font-size: var(--fs-cap); color: var(--muted); align-items: center; gap: 6px; }
.us-dlg .us-ted-auto input[type="checkbox"] { width: 14px; height: 14px; margin: 0; }
.us-ted-pv .us-mini { height: 210px; }
.us-ted-checks { margin-top: 8px; }
.us-ratios li { padding: 5px 0; font-size: 13px; }
.us-ratios .us-pill { font-variant-numeric: tabular-nums; }
.us-warn { margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--bad); border: 1px solid var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.us-warn.soft { color: var(--muted); border-color: var(--line); background: none; font-weight: 400; }
.us-dlg input.us-input { width: 100%; min-height: var(--ctl-h); border: 1px solid var(--ctl-line); border-radius: var(--r-md); padding: 6px 10px; background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-row); margin: 0; }
.us-import { margin-top: 18px; }
.us-dlg .us-import input.us-code-in { flex: 1; min-width: 0; font: 13px ui-monospace, Consolas, monospace; }

.us-seg { position: relative; display: inline-flex; flex-wrap: wrap; align-self: flex-start; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; background: var(--panel); margin: 0 0 12px; max-width: 100%; }
.us-dlg .us-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; pointer-events: none; }
.us-seg label { padding: 6px 14px; border-radius: 6px; font-size: 14px; cursor: pointer; color: var(--muted); }
.us-seg label:hover { color: var(--text); background: var(--hover); }
.us-seg input:checked + label { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.us-seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.us-wall { display: flex; flex-direction: column; }
.us-wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 0 0 10px; }
.us-wcard { position: relative; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); min-width: 0; }
.us-wcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.us-wcard:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.us-wcard label { display: flex; flex-direction: column; cursor: pointer; font-size: 12px; font-weight: 600; }
.us-wcard label > span:last-child { padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-wsw { display: block; height: 60px; }
.us-wdel { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 24px; }
.us-wdel:hover { background: var(--bad); color: var(--on-bad); }
@media (max-width: 860px) { .us-ted-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 400px) {
  .us-tgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .us-tsw { height: 44px; }
  .us-mini { height: 200px; }
  .us-seg label { padding: 6px 10px; }
}

.us-profile .pe-form .srv-field > span { font-size: 12px; }
@media (max-width: 1100px) {
  .us-profile .pe-grid { grid-template-columns: 1fr; }
  .us-profile .pe-preview { position: static; order: -1; max-width: 340px; }
}
@media (max-width: 860px) {
  .us-col { padding: 40px 24px 60px; }
}
/* phones: the section list first, a section opens over it with a back button */
@media (max-width: 680px) {
  .us-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .us-nav, .us-body { grid-area: 1 / 1; }
  .us-wrap.in-section .us-nav, .us-wrap:not(.in-section) .us-body { display: none; }
  .us-nav { justify-content: stretch; background: var(--bg); }
  .us-nav-in { width: 100%; padding: 4px 12px 24px; }
  .us-nav-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 8px 10px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
  .us-nav-head h2 { margin: 0; font-size: 20px; }
  .us-nav-head .us-esc { display: none; }
  .us-tab { padding: 11px 10px; font-size: 16px; }
  .us-tools { display: none; }
  .us-col { flex: 1 1 auto; padding: 0 16px 40px; }
  .us-head { position: sticky; top: 0; z-index: 2; background: var(--bg); margin: 0 -16px 8px; padding: 8px; border-bottom: 1px solid var(--line); }
  .us-head h2 { font-size: 18px; }
  .us-back { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; }
  .us-dlg input.us-range { width: 130px; }
  .us-copy { flex-wrap: wrap; }
}

/* settings search and grouped settings navs (settings regroup): a search box at the top of the User, Server and
   Channel settings navs; while it has text its matches replace the pages. setFlash briefly marks where a match is. */
.us-tabs, .srv-tabs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.us-tabs[hidden], .srv-tabs[hidden], .set-hits[hidden] { display: none; }
.set-search { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; min-width: 0; }
dialog .set-search input.set-q { width: 100%; margin: 0; padding: 7px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
dialog .set-search input.set-q:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.set-hits { display: flex; flex-direction: column; gap: 2px; }
.set-hits .set-hit { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; color: var(--text); width: 100%; }
.set-hits .set-hit:hover, .set-hits .set-hit:focus-visible { background: var(--hover); }
.set-hits .set-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.set-hit-t { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.set-hit-p { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.set-none { font-size: 13px; color: var(--muted); padding: 4px 10px; margin: 0; }
.set-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.srv-nav-grp { font-size: var(--fs-cap); font-weight: 700; color: var(--muted); padding: 14px 10px 4px; }
.srv-nav-grp:first-child { padding-top: 0; }
.us-lead { margin: -12px 0 20px !important; }
.set-flash { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); border-radius: 8px; transition: background .8s, box-shadow .8s; }
@media (forced-colors: active) { .set-flash { outline: 3px solid Highlight; } }
/* Windows high contrast drops box shadows: the open settings page keeps a visible mark */
@media (forced-colors: active) { .us-tab.on, .srv-nav button.on { outline: 2px solid Highlight; outline-offset: -2px; } }
@media (max-width: 680px) {
  .srv-nav .set-search { flex: 1 0 100%; margin: 0 0 4px; }
  .srv-nav:has(.srv-tabs[hidden]) { flex-direction: column; align-items: stretch; max-height: 60dvh; overflow-y: auto; }
  .srv-nav { flex-wrap: wrap; }
  .srv-tabs { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  .srv-tabs > button { flex: none; }
  .srv-nav .srv-tabs > button.on { box-shadow: inset 0 -2px 0 var(--accent); } /* tabs side by side: the mark goes under the open one */
  .srv-nav-grp { display: none; }
  .us-lead { margin: 0 0 16px !important; }
}

/* ===== motion: enter / exit animations (the "motion" section at the end of app.js does the rest) ===== */
:root {
  --m-in: 180ms; --m-in-big: 220ms; --m-out: 130ms; --m-out-big: 160ms; --m-quick: 110ms; --m-move: 1;
  --m-ease: cubic-bezier(.2, .8, .2, 1); --m-ease-in: cubic-bezier(.4, 0, 1, 1);
}
/* reduce motion (Appearance > Animations, or the system setting): nothing moves or scales, only a short fade */
html.reduce-motion { --m-in: 90ms; --m-in-big: 90ms; --m-out: 80ms; --m-out-big: 80ms; --m-quick: 0ms; --m-move: 0; }
@media (prefers-reduced-motion: reduce) {
  html:not(.full-motion) { --m-in: 90ms; --m-in-big: 90ms; --m-out: 80ms; --m-out-big: 80ms; --m-quick: 0ms; --m-move: 0; }
}

/* a dialog that has just closed, fading out where it was: already closed for the app, inert, clicks go through */
dialog[data-m-ghost]:not([open]) {
  display: var(--mg-d, block) !important; position: fixed !important; inset: auto !important;
  left: var(--mg-l) !important; top: var(--mg-t) !important; width: var(--mg-w) !important; height: var(--mg-h) !important;
  min-width: 0 !important; min-height: 0 !important; max-width: none !important; max-height: none !important; margin: 0 !important;
  box-sizing: border-box !important; overflow-x: var(--mg-ox, hidden) !important; overflow-y: var(--mg-oy, hidden) !important;
  z-index: 2147483646; pointer-events: none !important;
}
.m-bd-ghost { position: fixed; inset: 0; z-index: 2147483645; pointer-events: none; }
@keyframes m-fade-in { from { opacity: 0; } }
dialog[data-m-in]::backdrop { animation: m-fade-in var(--m-in) var(--m-ease); }

/* the image viewer: its dark background on a layer of its own, so it can fade while the picture zooms */
.viewer { background: none; }
.viewer::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(0,0,0,.85); }

/* the toast is animated from app.js (a CSS transition would win over it) */
.toast { transition: none; }

/* things that toggle `hidden`: in with @starting-style, out by keeping display a moment (allow-discrete).
   Only after the first screen is up (html.m-ready), so nothing animates on page load. */
.mention-pop { transform-origin: 0 100%; }
html.m-ready .mention-pop:not([hidden]) { transition: opacity var(--m-in) var(--m-ease), scale var(--m-in) var(--m-ease); }
html.m-ready .mention-pop[hidden] {
  opacity: 0; scale: .96; pointer-events: none; interactivity: inert;
  transition: opacity var(--m-out) var(--m-ease-in), scale var(--m-out) var(--m-ease-in), display var(--m-out) allow-discrete;
}
@starting-style { html.m-ready .mention-pop:not([hidden]) { opacity: 0; scale: .96; } }
html.m-ready .picker .pk-tones:not([hidden]) { transition: opacity var(--m-in) var(--m-ease), scale var(--m-in) var(--m-ease); }
@starting-style { html.m-ready .picker .pk-tones:not([hidden]) { opacity: 0; scale: .96; } }

html.m-ready .jump:not([hidden]) { transition: opacity var(--m-in) var(--m-ease), translate var(--m-in) var(--m-ease); }
html.m-ready .jump[hidden] {
  opacity: 0; translate: 0 8px; pointer-events: none; interactivity: inert;
  transition: opacity var(--m-out) var(--m-ease-in), translate var(--m-out) var(--m-ease-in), display var(--m-out) allow-discrete;
}
@starting-style { html.m-ready .jump:not([hidden]) { opacity: 0; translate: 0 8px; } }

/* side panels slide in from their edge */
html.m-ready .thread-pane:not([hidden]) { transition: opacity var(--m-in-big) var(--m-ease), translate var(--m-in-big) var(--m-ease); }
@starting-style { html.m-ready .thread-pane:not([hidden]) { opacity: 0; translate: 12px 0; } }
@media (max-width: 1000px) { /* over the chat: it can also slide out (on a desktop its grid column goes at once) */
  html.m-ready .thread-pane[hidden] {
    opacity: 0; translate: 12px 0; pointer-events: none; interactivity: inert;
    transition: opacity var(--m-out-big) var(--m-ease-in), translate var(--m-out-big) var(--m-ease-in), display var(--m-out-big) allow-discrete;
  }
}
@media (min-width: 1001px) {
  html.m-ready .members { transition: opacity var(--m-in-big) var(--m-ease), translate var(--m-in-big) var(--m-ease); }
  @starting-style { html.m-ready .members { opacity: 0; translate: 12px 0; } }
}
@media (min-width: 681px) {
  html.m-ready .side { transition: opacity var(--m-in-big) var(--m-ease), translate var(--m-in-big) var(--m-ease); }
  @starting-style { html.m-ready .side { opacity: 0; translate: -12px 0; } }
}
/* the drawers (members on tablets and phones, channels on phones): same slide, eased in and out */
@media (max-width: 1000px) {
  .members { transition: transform var(--m-out-big) var(--m-ease-in); }
  .app.show-members .members { transition: transform var(--m-in-big) var(--m-ease); }
}
@media (max-width: 680px) {
  .rail, .side { transition: transform var(--m-out-big) var(--m-ease-in); }
  .app.show-side .rail, .app.show-side .side { transition: transform var(--m-in-big) var(--m-ease); }
}
html.m-ready .app.show-side .scrim, html.m-ready .app.show-members .scrim { transition: opacity var(--m-in-big) var(--m-ease); }
@starting-style { html.m-ready .app.show-side .scrim, html.m-ready .app.show-members .scrim { opacity: 0; } }

/* profile card fixes: a see-through picture shows the card behind it, not the banner;
   about me can't stretch the card (also caps cards from old clients) */
.pc-av.has-img { background: var(--panel) !important; }
.pc-about { max-height: 9.5em; overflow-y: auto; }

/* setup wizard (new people) and the guest strip */
dialog.setup-dlg { width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); padding: 0; overflow-y: auto; }
.setup-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 20px; min-height: min(480px, calc(100dvh - 16px)); }
.setup-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.setup-count { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.setup-dots { display: flex; gap: 5px; }
.setup-dots span { width: 22px; height: 4px; border-radius: 2px; background: var(--line); }
.setup-dots span.on { background: var(--accent); }
.setup-skip { margin-left: auto; }
.setup-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.setup-body h2 { margin: 6px 0 6px; font-size: 22px; overflow-wrap: anywhere; }
.setup-dlg p.setup-lead { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.setup-dlg p.setup-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.setup-choices { display: flex; flex-direction: column; gap: 8px; }
.setup-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 10px; background: var(--bg); min-width: 0; }
.setup-choice:hover, .setup-choice:focus-visible { border-color: var(--accent); }
.setup-choice-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.setup-choice-desc { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.setup-form { display: flex; flex-direction: column; }
.setup-join { display: flex; gap: 8px; align-items: flex-start; }
.setup-join input { flex: 1; min-width: 0; }
.setup-join button { flex: none; }
.setup-or { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 10px; }
.setup-body > button { align-self: flex-start; }
.setup-theme { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.setup-radio { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; }
.setup-radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
dialog .setup-radio input[type="radio"] { width: auto; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.setup-foot .row { display: flex; gap: 8px; margin-left: auto; }
.setup-foot > .primary:only-child, .setup-foot > :first-child:empty + .primary { margin-left: auto; }
@media (max-width: 480px) {
  dialog.setup-dlg { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .setup-card { min-height: 100%; padding: 14px 16px 16px; }
  .setup-body h2 { font-size: 19px; }
}
@media (max-width: 300px) {
  .setup-join { flex-direction: column; align-items: stretch; }
  .setup-card { padding: 12px; }
}
/* the "Hive was reset" notice (resetNotice in app.js): the setup wizard's card */
.reset-dlg .setup-card { min-height: 0; }
.reset-dlg .setup-body { gap: 0; }
.reset-dlg p.reset-when { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.reset-note { margin: 0 0 16px; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--accent-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.reset-dlg .setup-foot { margin-top: 8px; }
.banner.guest { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; color: var(--text); background: var(--accent-soft); padding: 6px 12px; }
.banner.guest span { flex: 1 1 180px; min-width: 0; font-weight: 600; }
.banner.guest button { padding: 3px 10px; font-size: 13px; }
/* ---------- channel features: private channels, forum and media channels, channel options ---------- */
.channel-list li .ch-lock { font-size: 10px; opacity: .7; margin-left: -2px; flex: none; }
.warn-note { color: var(--warn); font-size: 14px; margin: 0; }
.ck-note { display: flex; flex-direction: column; gap: 6px; }
.perm > span.role-line { flex-direction: row; align-items: center; gap: 6px; }
.perm > span.role-line .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.post-intro h2 { margin: 0 0 4px; }
.post-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 16px 8px; }
.post-bar select { width: auto; }
.post-filter { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 8px; }
.post-filter:empty { display: none; }
.post-tag { display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; background: var(--panel); color: var(--text); }
button.post-tag { cursor: pointer; }
.post-tag.on { background: var(--accent-soft); border-color: var(--accent); }
.post-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.post-tags:empty { display: none; }
.post-list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 16px; }
.post-card { display: grid; grid-template-columns: 1fr; gap: 4px; text-align: left; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); padding: 10px 12px; cursor: pointer; font: inherit; }
.post-card:has(.post-thumb) { grid-template-columns: 1fr 72px; }
.post-card .post-thumb { grid-column: 2; grid-row: 1 / span 4; width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.post-card:hover { border-color: var(--accent); }
.post-card.unread .post-title b::after { content: " •"; color: var(--accent); }
.post-card.closed { opacity: .7; }
.post-title { font-size: 15px; overflow-wrap: anywhere; }
.post-snip { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.post-empty { padding: 8px 0; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 0 16px 16px; }
.media-tile { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; background: var(--panel); cursor: pointer; color: var(--text); font: inherit; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .media-video { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 13px; padding: 8px; overflow-wrap: anywhere; }
.media-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; text-align: left; padding: 6px 8px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: 12px; }
.media-cap b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-tile.unread { outline: 2px solid var(--accent); }
.post-dlg { width: min(560px, calc(100vw - 32px)); }
.post-form { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.post-form h3 { margin: 0; }
.post-form textarea { width: 100%; resize: vertical; }
.forum-op { margin-top: 8px; border-top: 1px solid var(--line); }
.tag-rows { display: flex; flex-direction: column; gap: 6px; }
.tag-row { display: flex; gap: 6px; align-items: center; }
.tag-row input.tag-emoji, .srv-content .tag-row input.tag-emoji { width: 56px; flex: 0 0 56px; }
.tag-row input.tag-name, .srv-content .tag-row input.tag-name { flex: 1 1 auto; width: auto; min-width: 0; }
.srv-content input.tag-emoji { max-width: 120px; }
@media (max-width: 680px) {
  .post-list, .post-grid, .post-bar, .post-filter { padding-left: 8px; padding-right: 8px; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
.nsfw-gate { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 16px; max-width: 460px; margin: 0 auto; }
.nsfw-gate .nsfw-ico { font-size: 48px; }
.nsfw-gate h2 { margin: 0; }
.chan-guide { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 8px 16px; padding: 6px 12px; font-size: 14px; }
.chan-guide.banner { margin: 6px 12px 0; max-height: 40vh; overflow: auto; }
.chan-guide summary { cursor: pointer; font-weight: 600; }
.chan-guide .guide-body { padding: 6px 0 2px; overflow-wrap: anywhere; }
.info-name { margin: 0 0 4px; }
.info-topic { margin: 0 0 8px; color: var(--muted); }
.info-desc { margin: 0 0 10px; font-size: 14px; overflow-wrap: anywhere; }
.info-lines { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 14px; }
.info-line { display: flex; justify-content: space-between; gap: 12px; }
.info-line > span:last-child { text-align: right; overflow-wrap: anywhere; }
@media (max-width: 680px) { .chan-guide.banner { margin: 4px 6px 0; } }
.chan-head .info-link { cursor: pointer; }
.chan-head h1.info-link:hover, .chan-head .topic.info-link:hover { text-decoration: underline; }

/* friends and direct messages: the Home button, the DM list, the friends page */
.rail-btn.home-btn { font-size: 22px; font-weight: 400; }
/* unread DMs as bubbles under the Home button (dmBubbles) */
.dm-bubbles { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.dm-bubbles[hidden] { display: none; }
.dm-bubble .dmb-av { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; font-size: 16px; transition: border-radius .15s; }
.dm-bubble .dmb-av > img { border-radius: inherit; }
.dm-bubble.dmb-more { font-size: 14px; color: var(--muted); }
.dm-bubble.dmb-more:hover { background: var(--accent); color: var(--on-accent); }
.dm-bubble.dmb-in { animation: dmb-in var(--m-in-big) var(--m-ease); }
.dm-bubble.dmb-out { animation: dmb-out var(--m-in-big) var(--m-ease-in) forwards; pointer-events: none; overflow: hidden; }
@keyframes dmb-in { from { opacity: 0; scale: .4; } }
@keyframes dmb-out { to { opacity: 0; scale: .4; height: 0; margin-bottom: -8px; } }
.av-wrap { position: relative; display: inline-grid; flex: none; }
.st-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--side); background: var(--muted); box-sizing: border-box; }
.st-dot.online { background: var(--ok); }
.st-dot.idle { background: var(--warn); }
.st-dot.dnd { background: var(--bad); }
.channel-list li.home-fr { gap: 10px; padding: 9px 8px; font-weight: 600; margin-bottom: 6px; }
.channel-list li.home-fr .hash { opacity: 1; width: 30px; text-align: center; }
.channel-list li.dm-row { gap: 10px; padding: 5px 8px; }
.dm-text { flex: 1; min-width: 0; }
.dm-name, .dm-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-prev { font-size: 12px; color: var(--muted); font-weight: 400; }
.dm-row .dm-x { visibility: hidden; padding: 0 4px; }
.dm-row:hover .dm-x, .dm-row.active .dm-x { visibility: visible; }
@media (hover: none) { .dm-row .dm-x { visibility: visible; } }
.channel-list li.dm-empty { cursor: default; font-size: 13px; padding: 10px 8px; white-space: normal; }
.channel-list li.dm-empty:hover { background: none; color: var(--muted); }
.home-page { flex: 1; min-height: 0; overflow-y: auto; }
.home-tabs { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.home-tab { background: transparent; border: 0; padding: 4px 10px; border-radius: 6px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.home-tab:hover { background: var(--hover); color: var(--text); }
.home-tab.on { background: var(--active); color: var(--text); }
.home-tab.add { background: var(--ok); color: var(--on-ok); }
.home-tab.add.on { background: transparent; color: var(--ok); }
.home-body { padding: 0 16px 24px; }
.fr-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 16px 8px 8px; }
.fr-list { list-style: none; margin: 0; padding: 0; }
.fr-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.fr-row[tabindex] { cursor: pointer; }
.fr-row:hover { background: var(--hover); }
.fr-row .st-dot { border-color: var(--bg); }
.fr-row:hover .st-dot { border-color: var(--bg); }
.fr-text { flex: 1; min-width: 0; }
.fr-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-tag { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.fr-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-acts { display: flex; gap: 8px; flex: none; }
.fr-act { width: 36px; height: 36px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--panel); }
.fr-act.ok:hover { color: var(--ok); border-color: var(--ok); }
.fr-act.no:hover { color: var(--bad); border-color: var(--bad); }
.fr-empty { color: var(--muted); padding: 32px 8px 0; text-align: center; margin: 0; }
.fr-add { padding: 16px 0; max-width: 680px; }
.fr-add h2 { margin: 0 0 4px; font-size: 18px; }
.fr-form { display: flex; gap: 8px; margin: 12px 0 6px; flex-wrap: wrap; }
.fr-input { flex: 1 1 200px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.fr-msg { margin: 4px 0 12px; min-height: 1.2em; font-size: 14px; }
.fr-msg.ok { color: var(--ok); }
.fr-msg.bad { color: var(--bad); }
.pf-dlg { width: min(420px, calc(100vw - 32px)); }
.pf-dlg h3 { margin: 0 0 10px; }
.pf-name { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); margin-bottom: 10px; }
.pf-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 50vh; overflow-y: auto; }
.pf-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.pf-row:hover { background: var(--hover); }
.pf-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-count { margin-right: auto; font-size: 13px; }
@media (max-width: 680px) {
  .home-tabs { padding: 8px; gap: 4px; }
  .home-body { padding: 0 8px 16px; }
  .fr-row { gap: 10px; padding: 8px 4px; }
  .fr-act { width: 32px; height: 32px; }
}
/* ===== chat box settings: greentext, the composer's options, preview before sending ===== */
:root { --greentext: #577510; } /* 4chan's #789922 is too light on a light background: darker, 4.8:1 */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --greentext: #789922; } }
:root[data-theme="dark"] { --greentext: #789922; }
.text .greentext { color: var(--greentext); }
.gt-link { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.gt-link:hover { text-decoration-thickness: 2px; }
.composer textarea { font-size: var(--cb-font, inherit); max-height: var(--cb-maxh, 180px); }
.cb-no-attach #attachBtn, .cb-no-attach #tAttachBtn, .cb-no-gif #gifBtn, .cb-no-gif #tGifBtn, .cb-no-emoji #emojiBtn, .cb-no-emoji #tEmojiBtn,
.cb-no-poll #pollBtn, .cb-no-poll #tPollBtn, .cb-no-check #checklistBtn, .cb-no-check #tChecklistBtn, .cb-no-fmt #previewBtn, .cb-no-fmt #tPreviewBtn { display: none; }
@media (hover: hover) and (pointer: fine) { .cb-no-send .composer .send { display: none; } } /* touch screens keep it */
.input-box .pv-chip { display: inline-flex; align-items: center; gap: 4px; align-self: center; height: 26px; margin: 0 2px; padding: 0 8px;
  font-size: 12px; font-weight: 600; color: var(--link); background: var(--accent-soft); border-radius: 13px; }
.input-box .pv-chip:hover { color: var(--link); filter: brightness(1.05); }
.pv-chip-ico { font-size: 12px; }
.input-box.silent .pv-chip-txt, .input-box.important .pv-chip-txt, .input-box.disappear .pv-chip-txt { display: none; } /* room for the other tag */
.thread-pane .pv-chip-txt { display: none; }
@media (max-width: 680px) { .pv-chip-txt { display: none; } }
dialog.pv-dlg { width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.pv-dlg .pv-where { margin-bottom: 10px; }
.pv-log { flex: none; max-height: min(50dvh, 440px); overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 2px 0 10px; margin: 0 0 12px; }
.pv-log .msg { cursor: default; }
.pv-log .msg:hover { background: transparent; }
.pv-notes { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; display: grid; gap: 4px; }
.pv-notes li { display: flex; gap: 8px; align-items: baseline; overflow-wrap: anywhere; }
.pv-ico { flex: none; width: 18px; text-align: center; }
.pv-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pv-file { display: flex; flex-direction: column; gap: 2px; width: 124px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 12px; background: var(--panel); min-width: 0; }
.pv-file img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.pv-file-ico { font-size: 30px; text-align: center; line-height: 80px; }
.pv-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-file-size { color: var(--muted); }
.pv-dlg p.pv-keys { font-size: 12px; margin-bottom: 10px; }
.pv-btns .pv-off { margin-right: auto; font-size: 13px; }
button.pv-discard { color: var(--bad); }
.cb-samples { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 6px; }
@media (max-width: 500px) { .cb-samples { grid-template-columns: 1fr; } }
.us-card.cb-sample { display: block; margin: 0; padding: 8px 12px; }
.cb-sample-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }

/* messages from someone you blocked: one folded line per run (appendMessage) */
.msg.blocked-msg { display: flex; align-items: center; gap: 8px; padding: 4px 16px 4px 68px; color: var(--muted); font-size: 13px; }
.msg.blocked-msg .blk-ico { font-size: 12px; }
.msg.blocked-msg .linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.msg.blocked-msg .linkish:hover { text-decoration: underline; }

/* setup wizard: the theme cards (from Settings → Appearance) in a smaller grid */
.setup-theme.us-radios { display: block; }
.setup-tgrid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 2px; }
/* first-time setup: the "Lighter effects" switch under the themes */
.setup-lite { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.setup-lite .us-switch { flex: none; margin-top: 2px; }
.setup-lite label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.setup-lite-d { font-size: 12px; color: var(--muted); }

/* a toast with a button (reminders: Jump) takes clicks */
.toast.act.show { pointer-events: auto; }
.toast-act { margin-left: 8px; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
/* Remind me… */
.rem-quick { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.rem-quick button { text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; }
.rem-quick button:hover { border-color: var(--accent); }
.rem-custom { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.rem-dlg .rem-custom input { margin: 0; flex: 1; min-width: 0; }
/* ---------- voice messages: the 🎤 button, the recorder over the message box, the player (voice messages in app.js) ---------- */
.voice-btn[hidden] { display: none; }
.input-box.voice-on { position: relative; }
.composer.voice-active > .send { display: none; }
.voice-rec { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 2px; min-width: 0;
  border-radius: inherit; background: var(--box, var(--panel)); color: var(--box-text, var(--text)); }
.voice-rec .voice-x { height: 36px; font-size: 16px; }
.voice-wait { flex: 1; min-width: 0; font-size: 13px; color: var(--box-muted, var(--muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: voice-blink 1.2s ease-in-out infinite; }
@keyframes voice-blink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .voice-dot { animation: none; } }
.voice-time { flex: none; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.voice-max { flex: none; margin-left: -4px; font-size: 12px; color: var(--box-muted, var(--muted)); font-variant-numeric: tabular-nums; }
.voice-meter { flex: 1; min-width: 0; height: 26px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.voice-meter i { flex: 0 1 3px; min-width: 1px; height: 8%; border-radius: 2px; background: var(--bad); opacity: .85; }
.voice-stop { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--box-line, var(--line)); background: var(--hover); color: inherit; font-weight: 600; cursor: pointer; }
.voice-stop:hover { filter: brightness(1.08); }
.voice-stop-ico { width: 10px; height: 10px; border-radius: 2px; background: var(--bad); }
.voice-send { flex: none; height: 32px; padding: 0 14px; }
.voice-rec .voice { flex: 1; max-width: none; padding: 0; border: 0; background: transparent; }
/* the player */
.voice { display: flex; align-items: center; gap: 8px; box-sizing: border-box; width: 100%; max-width: 360px; min-width: 0;
  padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.voice-play { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-size: 12px; line-height: 1; cursor: pointer; }
.voice-play:hover { filter: brightness(1.08); }
.voice-play.busy { opacity: .7; cursor: progress; }
.voice-wave { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; gap: 1px; cursor: pointer; border-radius: 4px; touch-action: manipulation; }
.voice-wave:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.voice-wave i { flex: 1 1 0; min-width: 1px; border-radius: 1px; background: var(--muted); opacity: .45; pointer-events: none; }
.voice-wave i.on { background: var(--accent); opacity: 1; }
.voice-dur { flex: none; min-width: 30px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.voice-speed { flex: none; height: 22px; min-width: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 11px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.voice-speed:hover { color: var(--text); }
@media (max-width: 520px) {
  .voice-rec { gap: 6px; }
  .voice-max { display: none; }
  .voice-stop { padding: 0 10px; }
  .voice { gap: 6px; }
}
/* voice message transcripts (vtxDraw: the Transcript button and text under a player; the transcript above the message
   box while previewing a recording, vtxRecEditor) */
.voice-box { display: flex; flex-direction: column; gap: 4px; box-sizing: border-box; width: 100%; max-width: 360px; min-width: 0; }
.voice-box > .voice { max-width: none; }
.vtx[hidden] { display: none; }
.vtx { padding: 0 6px; min-width: 0; }
.vtx-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vtx-btn { display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; margin-left: -6px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.vtx-btn:hover { color: var(--text); background: var(--hover); }
.vtx-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vtx-btn svg { width: 14px; height: 14px; }
.vtx-chev { width: 5px; height: 5px; margin: 0 6px 3px 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.vtx-btn[aria-expanded="false"] .vtx-chev { margin: 0 6px 0 1px; transform: rotate(-45deg); }
.vtx-run { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vtx-stop { flex: none; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.vtx-stop:hover { color: var(--text); }
.vtx-text { margin: 2px 0 0; padding: 6px 10px; border-left: 3px solid var(--line); font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.vtx-text.live { color: var(--muted); }
.vtx-note { margin-top: 2px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .vtx-chev { transition: none; } }
.voice-txon { flex: none; padding: 1px 5px; border: 1px solid currentColor; border-radius: 4px; font-size: 10px; font-weight: 700; color: var(--box-muted, var(--muted)); }
.voice-tx-edit { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 3; display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.voice-tx-edit.off { flex-direction: row; align-items: center; gap: 8px; }
.voice-tx-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.voice-tx-head label { flex: 1; min-width: 0; }
.voice-tx-x { width: 26px; height: 26px; }
.voice-tx-note { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.voice-tx-in { box-sizing: border-box; width: 100%; min-height: 44px; max-height: 30vh; resize: vertical; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.voice-tx-in:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
/* custom server emoji: Server settings → Emoji, and the pictures in messages (cemoImg; sizes come from img.emoji) */
img.emoji.cemoji { object-fit: contain; }
.cemo-up { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cemo-up input:not([type=file]) { flex: 1 1 200px; min-width: 0; }
.cemo-list { display: flex; flex-direction: column; }
.cemo-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.cemo-row:last-child { border-bottom: 0; }
.cemo-pic { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.cemo-pic img.emoji { width: 32px; height: 32px; margin: 0; vertical-align: middle; }
.cemo-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cemo-name input { width: 100%; max-width: 260px; min-width: 0; }
.cemo-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cemo-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cemo-acts .danger { color: var(--bad); }
@media (max-width: 480px) {
  .cemo-row { grid-template-columns: 40px minmax(0, 1fr); }
  .cemo-acts { grid-column: 2; justify-content: flex-start; }
}

/* ---------- plugins (PLUGINS.md) ---------- */
#plHost { position: fixed; width: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
#plHost iframe { width: 0; height: 0; border: 0; }
/* ui:overlay (Pip): Hive's canvas over the open channel's messages, under the jump button, popups, menus, toasts and dialogs;
   only the hit areas the plugin reports take the pointer */
.pl-ov { position: absolute; z-index: 4; pointer-events: none; overflow: hidden; contain: strict; }
.pl-ov[hidden], .pl-ov-hit[hidden] { display: none; }
.pl-ov-cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: crisp-edges; image-rendering: pixelated; pointer-events: none; }
.pl-ov-hit { position: absolute; pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; }
.pl-ov-hit:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; }
.pl-ov-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* a plugin's window: Hive's own title bar (so nobody mistakes plugin content for Hive), a slot for Hive's questions, the frame */
.pl-win { display: flex; flex-direction: column; background: var(--bg); color: var(--text); min-width: 0; min-height: 0; }
.pl-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; background: var(--rail); border-bottom: 1px solid var(--line); font-size: 13px; user-select: none; flex: none; }
.pl-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--warn); white-space: nowrap; }
.pl-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-x { padding: 4px 8px; }
.pl-body { flex: 1; min-height: 0; display: flex; }
.pl-body iframe { flex: 1; width: 100%; height: 100%; border: 0; background: var(--bg); }
.pl-ask { flex: none; padding: 10px 12px; background: var(--panel); border-bottom: 2px solid var(--accent); box-shadow: var(--menu-shadow); }
.pl-ask-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.pl-ask-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.pl-ask-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.pl-ask-btns button:disabled { opacity: .55; cursor: default; }
.pl-float { position: fixed; z-index: 60; width: 340px; height: 460px; min-width: 240px; min-height: 220px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; resize: both; box-shadow: var(--menu-shadow); }
.pl-float .pl-head { cursor: move; touch-action: none; }
.pl-pip-body { margin: 0; height: 100vh; overflow: hidden; background: var(--bg); }
.pl-pip-body .pl-win { height: 100vh; }
/* asking on the page (no plugin window open) */
dialog.pl-ask-dlg { width: min(460px, calc(100vw - 32px)); }
/* install / permissions */
dialog.pl-dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
dialog.pl-dlg h4 { margin: 16px 0 6px; }
.pl-dlg-meta { margin-bottom: 6px; overflow-wrap: anywhere; }
.pl-from { overflow-wrap: anywhere; }
.pl-warn { color: var(--bad); background: rgba(209,75,75,.08); background: color-mix(in srgb, var(--bad) 8%, transparent); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.pl-fp { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.pl-fp code, .pl-fp-line { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.pl-perm-list { display: flex; flex-direction: column; gap: 4px; }
.pl-perm { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; cursor: pointer; }
.pl-perm:hover { background: var(--hover); }
dialog .pl-perm input[type="checkbox"] { width: auto; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.pl-perm.pl-sub { margin-left: 28px; }
.pl-perm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-perm-label { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pl-perm .us-desc { margin: 0; }
/* Settings → Plugins */
.us-card.pl-card { display: block; }
.pl-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pl-card-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pl-card .us-desc { margin: 6px 0 0; }
.pl-granted { margin: 4px 0 0; padding-left: 20px; font-size: 13px; }
.pl-card .us-btns { margin-top: 10px; }
/* server plugins: Settings → Plugins halves, Server settings → Plugins, Server menu → Plugins in this server */
.us-h.pl-scope-h { font-size: 17px; margin: 18px 0 4px; display: flex; align-items: center; gap: 8px; }
.pl-srv-h { margin: 14px 0 6px; font-size: 14px; overflow-wrap: anywhere; }
.spl-card { margin-bottom: 8px; }
.pl-perm.spl-perm { cursor: default; }
.pl-perm.spl-perm:hover { background: none; }
.spl-on { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; flex: none; }
.spl-on input { width: auto; }
.srv-card input.us-switch:disabled, .spl-dlg input.us-switch:disabled { opacity: .5; cursor: default; }
.srv-card h4.spl-h4 { margin: 4px 0 0; font-size: 13px; }
.srv-card .pl-perm input[type="checkbox"] { width: auto; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.spl-log { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
dialog.spl-dlg .spl-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
@media (max-width: 520px) { .srv-card .pl-card-head { flex-wrap: wrap; } }
/* file previews (text, code, CSV, audio, PDF attachments) */
.files .fp { display: flex; flex-direction: column; width: min(100%, 520px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; overflow: hidden; }
.fp-head { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; min-width: 0; }
.fp-head .file-ico { font-size: 22px; }
.fp-dl { font-size: 18px; flex: none; }
.fp-body { border-top: 1px solid var(--line); padding: 6px 10px 8px; min-width: 0; }
.fp-wait { font-size: 13px; color: var(--muted); padding: 4px 2px; }
.fp-show { font-size: 13px; padding: 5px 10px; }
.fp-view { min-width: 0; }
.fp-view.fold { max-height: calc(12 * 1.45em + 8px); overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.fp-view.fold.open { max-height: 480px; overflow: auto; -webkit-mask-image: none; mask-image: none; }
.fp-pre { margin: 0; padding: 4px 2px; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; overflow-x: auto; tab-size: 4; color: var(--text); }
.fp-pre code { font: inherit; background: none; padding: 0; }
.fp-md { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.fp-table-wrap { overflow-x: auto; }
.fp-table { border-collapse: collapse; font-size: 12.5px; line-height: 1.45; }
.fp-table th, .fp-table td { border: 1px solid var(--line); padding: 2px 8px; text-align: left; vertical-align: top; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-table th { background: var(--code); font-weight: 600; }
.fp-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.fp-more { font-size: 12px; margin-top: 4px; }
.fp-media { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 8px 10px; min-width: 0; }
.fp-media audio { width: 100%; height: 36px; }
.fp-play { width: 36px; height: 36px; border-radius: 50%; padding: 0; flex: none; display: grid; place-items: center; font-size: 14px; background: var(--accent); color: var(--on-accent, #fff); border: 0; }
.fp-hint { font-size: 13px; color: var(--muted); }
a.fp-open, button.fp-open { display: inline-block; font-size: 13px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--link); text-decoration: none; }

/* AI keys (Settings; the AI UI itself is the AI helper plugin) */
.ai-privacy { flex-direction: column; align-items: flex-start; gap: 6px; }
.ai-privacy p { margin: 0; }
.ai-key-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.us-dlg .ai-key-row input.us-input { min-width: 0; flex: 1; width: auto; }

/* issue mode: the status pill on an issue, the filter bar under the channel header, the archived list */
:root { --iss-open: var(--ok); --iss-doing: var(--warn); --iss-done: color-mix(in srgb, #8957e5 78%, var(--text)); --iss-wontfix: var(--muted); }
.iss-open { --c: var(--iss-open); } .iss-doing { --c: var(--iss-doing); } .iss-done { --c: var(--iss-done); } .iss-wontfix { --c: var(--iss-wontfix); }
.iss-pill { display: inline-flex; align-items: center; gap: 5px; align-self: center; font-size: 11px; font-weight: 700; line-height: 1.2; padding: 2px 8px; border-radius: 999px; flex: none;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); cursor: default; white-space: nowrap; }
button.iss-pill { cursor: pointer; }
button.iss-pill:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 24%, transparent); }
.iss-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c, currentColor); flex: none; }
.iss-arch-tag { font-weight: 600; opacity: .85; }
.iss-bar { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
/* the chips scroll sideways in their own strip (issueHead), without a scrollbar track; faded edges where there's more.
   View archived sits outside it, so it never covers a chip. */
.iss-chips { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  padding: 2px; scroll-padding-inline: 24px; --fl: 0px; --fr: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); }
.iss-chips::-webkit-scrollbar { display: none; }
.iss-chips.fade-l { --fl: 28px; }
.iss-chips.fade-r { --fr: 28px; }
.iss-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; background: transparent; color: var(--muted); white-space: nowrap; flex: none; }
.iss-chip:hover { color: var(--text); background: var(--hover); }
.iss-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.iss-chip .n { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); opacity: .75; }
.mf-tag.iss-tag { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.iss-arch-btn { margin-left: auto; }
.iss-arch-btn:hover { text-decoration: underline; }
.iss-unarch { margin-top: 6px; padding: 3px 10px; font-size: 12px; }
.iss-settings { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
@media (max-width: 680px) { .iss-bar { padding: 3px 4px; gap: 4px; } .iss-chips { gap: 4px; } .iss-chip { padding: 3px 8px; } }

/* ---------- UI icons (app.js "UI icons": icon(), prefs.icons). One box size in both looks, so switching
   between Hive icons and Emoji moves nothing. Hive icons: 24-grid line icons in currentColor. ---------- */
.ui-ico { display: inline-flex; align-items: center; justify-content: center; width: 1.25em; height: 1.25em; vertical-align: middle; line-height: 1; flex: none; }
.ui-ico > svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ui-ico > svg .f { fill: currentColor; stroke: none; }
.ui-ico.emo img.emoji { width: 1.15em; height: 1.15em; margin: 0; vertical-align: 0; }
.ui-ico[data-ico="st-online"] { color: var(--ok); }
.ui-ico[data-ico="st-idle"] { color: var(--warn); }
.ui-ico[data-ico="st-dnd"] { color: var(--bad); }
.ui-ico[data-ico="st-off"] { color: var(--muted); }
.us-ico-row { display: inline-flex; gap: 6px; margin-left: auto; padding-left: 12px; color: var(--muted); font-size: 18px; }
.hash > .ui-ico { width: 1em; height: 1em; }
.hash > .ui-ico > svg { width: .95em; height: .95em; }
.us-ico-pick { margin-bottom: 18px; }
.rail-btn > .ui-ico > svg { width: 1em; height: 1em; }
@media (max-width: 680px) { .us-ico-row { gap: 4px; padding-left: 8px; } .us-ico-row .ui-ico:nth-child(n+4) { display: none; } }
.ui-ico[data-ico="iss-open"] { color: var(--iss-open); }
.ui-ico[data-ico="iss-doing"] { color: var(--iss-doing); }
.ui-ico[data-ico="iss-done"] { color: var(--iss-done); }
.ui-ico[data-ico="iss-wontfix"] { color: var(--iss-wontfix); }
/* the thread panel's message box: when its buttons leave the text too little room, the text gets its own row
   above them (it was squeezed to a few px at 1280 px with every button on) */
.thread-pane .input-box { flex-wrap: wrap; container-type: inline-size; }
@container (max-width: 420px) {
  .thread-pane .input-box textarea { flex: 1 0 100%; order: -1; padding-left: 12px; padding-right: 12px; }
  .thread-pane .input-box .icon-btn { height: 38px; padding: 0 6px; }
}
/* silent / important composer tags: no emoji with Hive icons */
html:not(.emoji-icons) .input-box.silent::after { content: "silent: nobody gets a notification"; }
html:not(.emoji-icons) .input-box.important::after { content: "important: notifies everyone, even if muted"; }
@media (max-width: 500px) {
  html:not(.emoji-icons) .input-box.silent::after { content: "silent"; }
  html:not(.emoji-icons) .input-box.important::after { content: "important"; }
}
html:not(.emoji-icons) .thread-pane .input-box.silent::after { content: "silent"; }
html:not(.emoji-icons) .thread-pane .input-box.important::after { content: "important"; }
/* AI modes: the channel list's badge, the "AI can read this" banners, the mode choice, AI members */
.channel-list li .ch-ai { font-size: 10px; opacity: .55; margin-left: -2px; flex: none; display: inline-flex; }
.channel-list li .ch-ai-members { color: var(--accent); opacity: .9; }
.channel-list li .ch-ai-open { color: var(--warn); opacity: .9; }
.banner.ai { color: var(--text); background: var(--accent-soft); }
.banner.ai .ui-ico { color: var(--accent); }
.ai-pick { border: 0; padding: 0; margin: 8px 0; display: grid; gap: 8px; min-width: 0; }
.ai-pick legend { font-weight: 600; font-size: 13px; margin-bottom: 4px; padding: 0; }
.ai-pick label.check { align-items: flex-start; margin: 0; }
.ai-pick label.off { opacity: .55; }
.ai-now { padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); }
.ai-now-open { color: var(--warn); }
.member-list li .bot-tag, .pc-name .bot-tag { vertical-align: middle; margin-left: 4px; }
.pc-name .bot-tag { font-size: 11px; }
.ai-note-dlg { max-width: 460px; }
.ai-note-dlg h3 .ui-ico { color: var(--accent); }
.ai-pick input[type="radio"], .srv-content .ai-pick input[type="radio"] { width: auto; flex: none; margin: 3px 0 0; padding: 0; border: 0; background: none; }
.ai-pick label.check > span { flex: 1; min-width: 0; }
/* encrypting an open channel: the banner button, the dialog, the plain-files list, "sent before encryption" */
#plainBanner .enc-btn { margin-left: 6px; padding: 2px 10px; font-size: 12px; vertical-align: middle; }
.enc-extra { display: grid; gap: 6px; text-align: left; }
.enc-extra label.check { align-items: flex-start; margin: 0; }
.enc-extra label.check > span { flex: 1; min-width: 0; }
.enc-extra label.off { opacity: .6; }
.enc-extra input[type="checkbox"] { width: auto; flex: none; margin: 3px 0 0; }
.enc-extra .linkish, .enc-card .linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; justify-self: start; }
.enc-extra .linkish:hover { text-decoration: underline; }
.enc-files { width: 100%; box-sizing: border-box; font: 12px/1.4 ui-monospace, Consolas, monospace; white-space: pre; overflow: auto; }
.edited.pre-enc { color: var(--warn); }

/* ---------- slash commands: argument hints (Minecraft style) ---------- */
.slash-pop .slash-list { display: flex; flex-direction: column; }
.slash-pop.slash-args .slash-list { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.slash-usage { padding: 6px 10px 2px; font: 13px/1.5 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.slash-usage .slash-cmd { font-weight: 700; }
.slash-u { color: var(--muted); }
.slash-u.cur { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.slash-u.bad { color: var(--bad); }
.slash-d { padding: 0 10px 4px; font-size: 12px; color: var(--muted); }
.slash-err, .slash-note { display: flex; gap: 6px; align-items: flex-start; padding: 2px 10px 4px; font-size: 13px; line-height: 1.35; }
.slash-err { color: var(--bad); }
.slash-note { color: var(--warn); }
.slash-err .ui-ico, .slash-note .ui-ico { margin-top: 1px; }
.slash-args .slash-list .slash-cmd { font-family: ui-monospace, Consolas, monospace; }
/* a plugin's command that isn't on here (/roll without Dice): greyed in the list, why + the fix under it */
.slash-pop button.slash-off .slash-cmd { opacity: .6; }
.slash-miss { flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.slash-miss .slash-why { flex: 1 1 200px; min-width: 0; }
.slash-pop .slash-miss button.slash-fix { display: inline-flex; flex: none; width: auto; padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 6px; background: var(--accent-soft); color: var(--link); }
.slash-pop .slash-miss button.slash-fix:hover { background: var(--accent); color: #fff; }
.spl-new { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin: 4px 0; }

/* ---------- dice (/roll): the card, the tumble when it arrives ---------- */
.dice-card { display: inline-flex; flex-direction: column; gap: 4px; max-width: 100%; padding: 8px 12px 10px; margin: 2px 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); --dice-ms: 800ms; }
.dice-spec { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.dice-spec .ui-ico { color: var(--accent); }
.dice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.die { position: relative; width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; }
.die-shape { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.die-win { position: relative; width: 28px; height: 20px; overflow: hidden; }
.die-strip { display: flex; flex-direction: column; }
.die-face { height: 20px; flex: none; display: grid; place-items: center; }
.die-num { font-weight: 700; font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.d4 .die-win { margin-top: 10px; }
.d4 .die-num, .d8 .die-num, .d10 .die-num { font-size: 13px; }
.d100 .die-num { font-size: 12px; }
.d6 .die-win, .d6 .die-face, .die-pips { width: 34px; height: 34px; }
.die-pips { fill: var(--text); }
.dice-mod, .dice-eq { color: var(--muted); font-weight: 600; }
.dice-total { min-width: 1.4em; font-size: 20px; font-weight: 800; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.dice-card.rolling .die { animation: dice-tumble var(--dice-ms) cubic-bezier(.2,.7,.3,1) both; animation-delay: calc(var(--dice-off, 0ms) + var(--i, 0) * 40ms); }
.dice-card.rolling .die-strip { animation: dice-faces var(--dice-ms) steps(5, end) both; animation-delay: calc(var(--dice-off, 0ms) + var(--i, 0) * 40ms); }
.dice-card.rolling .dice-mod, .dice-card.rolling .dice-eq, .dice-card.rolling .dice-total {
  animation: dice-pop 320ms cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--dice-off, 0ms) + var(--dice-ms) + var(--dice-n, 0) * 40ms); }
@keyframes dice-tumble {
  0% { transform: translateY(-14px) rotate(-220deg) scale(.6); opacity: 0; }
  15% { opacity: 1; }
  55% { transform: translateY(3px) rotate(24deg) scale(1.04); }
  78% { transform: translateY(-3px) rotate(-8deg); }
  100% { transform: none; opacity: 1; }
}
@keyframes dice-faces { from { transform: translateY(0); } to { transform: translateY(calc(-100% * 5 / 6)); } }
@keyframes dice-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
/* Appearance > Animations "Reduce" (or the system setting): no tumble, the result at once */
html.reduce-motion .dice-card.rolling *, html.reduce-motion .dice-card.rolling { animation: none !important; }
html.reduce-motion .dice-card.rolling .die-face:not(:last-child) { display: none; }
@media (prefers-reduced-motion: reduce) {
  html:not(.full-motion) .dice-card.rolling * { animation: none !important; }
  html:not(.full-motion) .dice-card.rolling .die-face:not(:last-child) { display: none; }
}
.dice-one .die { width: 46px; height: 46px; }
.dice-one .die-win { width: 36px; height: 26px; }
.dice-one .die-face { height: 26px; }
.dice-one .die-num { font-size: 18px; font-weight: 800; }
.dice-one .d4 .die-win { margin-top: 13px; }
.dice-one .d6 .die-win, .dice-one .d6 .die-face, .dice-one .die-pips { width: 44px; height: 44px; }
.dice-card.rolling.dice-one .die-face:last-child .die-num { animation: dice-pop 320ms cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--dice-off, 0ms) + var(--dice-ms) - 60ms); }
.slash-args .slash-list button { padding: 4px 10px; }

/* composer drawer (app.js "composer drawer", cbFit): the message box's buttons in the bar after the ^, or in the drawer
   above it (like the hidden icons next to the Windows clock); a narrow box spills the bar's last ones into it */
.input-box .cb-bar { display: flex; align-items: flex-end; flex: none; min-width: 0; }
.cb-chev { position: relative; }
.cb-chev.open { color: var(--box-text, var(--text)); background: var(--hover); }
.cb-chev.on::after { content: ""; position: absolute; top: 8px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--link); box-shadow: 0 0 0 2px var(--box, var(--panel)); }
.cb-chev.open::after { box-shadow: 0 0 0 2px var(--panel); }
.cb-drawer {
  position: absolute; z-index: 45; padding: 4px; min-width: 44px; max-width: calc(100vw - 16px);
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--menu-shadow);
  transform-origin: 50% 100%;
}
.cb-dr-grid, .cb-dr-spill { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(36px, auto)); gap: 2px; justify-content: start; }
.cb-dr-spill:empty, .cb-dr-grid:empty { display: none; }
.cb-dr-spill:not(:empty) + .cb-dr-grid:not(:empty) { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.cb-drawer .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 2px; height: 36px; min-width: 36px; padding: 0 6px;
  border-radius: 8px; color: var(--muted); font-size: 17px; }
.cb-drawer .icon-btn:hover, .cb-drawer .icon-btn:focus-visible { background: var(--hover); color: var(--text); }
.cb-drawer .icon-btn.on, .cb-drawer .icon-btn[aria-pressed="true"] { color: var(--link); background: var(--accent-soft); }
.cb-drawer .later-btn .later-at { display: inline; } /* in the drawer there is room for the time */
.cb-drawer .later-btn .later-at:empty { display: none; }
.cb-dr-empty { margin: 4px 6px; max-width: 170px; font-size: 12px; line-height: 1.35; color: var(--muted); }
.cb-slot { touch-action: none; -webkit-touch-callout: none; user-select: none; }
html.m-ready .cb-drawer:not([hidden]) { transition: opacity var(--m-in) var(--m-ease), scale var(--m-in) var(--m-ease); }
@starting-style { html.m-ready .cb-drawer:not([hidden]) { opacity: 0; scale: .94; } }
/* dragging (cbDragWire): the button stays faint where it was, a copy follows the pointer, a line shows where it lands */
.cb-dragging { opacity: .35; }
.cb-ghost { position: fixed !important; left: 0; top: 0; z-index: 2147483000; margin: 0; pointer-events: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; box-sizing: border-box; font-size: 17px;
  background: var(--panel); color: var(--text); border: 1px solid var(--accent); border-radius: 8px; box-shadow: var(--menu-shadow); opacity: .95; }
.cb-drop-mark { position: fixed; z-index: 2147483001; width: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; box-shadow: 0 0 0 1px var(--panel); }
.cb-drawer.cb-drop-on, .cb-lay-list.cb-drop-on { outline: 2px dashed var(--accent); outline-offset: 2px; }
.input-box.cb-drop-on { border-color: var(--accent); }
html.cb-drag-on, html.cb-drag-on * { cursor: grabbing !important; }
/* Settings → Chat box: the same layout as tiles (cbLayEditor) */
.cb-lay-title { margin: 6px 0 2px; }
.cb-lay { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.cb-lay-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 4px; }
.cb-lay-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 48px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); align-items: center; }
.cb-tile { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 13px; user-select: none; -webkit-touch-callout: none; cursor: grab;
  touch-action: pan-y; } /* a swipe on a tile scrolls Settings; a 350 ms hold picks it up (cbDragWire) */
.cb-tile:hover { border-color: var(--accent); }
.cb-tile.menu-open { border-color: var(--accent); background: var(--accent-soft); }
.cb-tile-ico { display: inline-flex; font-size: 16px; color: var(--muted); }
.cb-tile-gif { font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.cb-tile-name { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cb-lay-empty { font-size: 12px; color: var(--muted); padding: 0 4px; }
.cb-lay-off { margin: 0; }
.cb-lay-btns { display: flex; gap: 8px; }
.cb-lay-reset:disabled { opacity: .55; cursor: default; }
.cb-ghost .cb-tile-name { max-width: none; }
/* an empty box shows its placeholder on one line (cut with …) instead of wrapping it onto a second one */
.composer textarea:placeholder-shown { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* phones: the channel header has up to 8 buttons; tighter ones leave the channel name more than a letter or two */
@media (max-width: 420px) {
  .chan-head { gap: 0; padding-right: 4px; }
  .chan-head .icon-btn { padding: 6px 5px; }
}
/* a narrow chat column on a wide screen (thread panel open at ~1100 px): the header's buttons used to squeeze the
   channel name down to one letter. Measured on the header itself, so it follows the column, not the window. */
.main > .chan-head { container-type: inline-size; }
@container (max-width: 560px) {
  .chan-head .icon-btn { padding: 6px 5px; }
  .chan-head #invite .hide-sm, .chan-head .topic { display: none; }
}
/* ---------- bot settings: Server settings → Bots, folded bot messages ---------- */
dialog .bot-search { width: 100%; margin: 0; }
.srv-content .bot-card .bot-ch input[type="radio"], .srv-content .bot-card .bot-ch input[type="checkbox"] { width: auto; flex: none; margin: 0; padding: 0; accent-color: var(--accent); }
.srv-content .bot-card input.bot-num, .srv-content .bot-card input.bot-word { margin: 0; padding: 6px 8px; }
.bot-card { gap: 12px; }
.bot-card.bot-nomatch { display: none; }
.bot-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.bot-head .bot-who { flex: 1; min-width: 0; }
.bot-fold { flex: none; }
.bot-fold .caret { display: inline-block; font-size: 16px; line-height: 1; transition: transform 0.15s ease; }
.bot-folded .bot-fold .caret { transform: rotate(-90deg); }
.bot-folded .bot-preview { cursor: pointer; }
.bot-body[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .bot-fold .caret { transition: none; } }
.bot-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bot-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bot-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bot-uid { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.srv-card .bot-status { margin: 0; }
.bot-master { font-weight: 600; }
.bot-preview { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--hover); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.bot-paused .bot-preview { color: var(--warn); }
.bot-paused .bot-sec { opacity: .6; }
.bot-sec { display: flex; flex-direction: column; gap: 6px; }
.bot-sec .spl-h4 { margin: 4px 0 0; }
.bot-group { display: flex; flex-direction: column; gap: 2px; }
.bot-group-h { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 6px 0 2px; }
.bot-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bot-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); }
.bot-list > .bot-row:first-child { border-top: 0; }
.bot-row[hidden] { display: none; }
.bot-row-plain { border: 1px solid var(--line); border-radius: 10px; }
.bot-row-ico { flex: none; width: 22px; color: var(--muted); padding-top: 1px; text-align: center; }
.bot-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bot-row-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; cursor: pointer; }
.bot-row .us-desc { margin: 0; }
.bot-row > input.us-switch { margin-top: 2px; }
.bot-use-line { display: flex; flex-direction: column; gap: 2px; }
.bot-use { font-size: 12px; align-self: flex-start; padding: 1px 6px; border-radius: 4px; background: var(--hover); overflow-wrap: anywhere; }
.srv-card .bot-need { margin: 0; font-size: 12px; color: var(--warn); }
.bot-more summary { font-size: 12px; color: var(--accent); width: max-content; }
.bot-more[open] { display: flex; flex-direction: column; gap: 4px; }
.bot-more > :not(summary) { margin: 0; }
.bot-risk { color: var(--bad); }
.bot-ch { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.bot-ch-mode { display: flex; flex-direction: column; gap: 4px; }
.srv-content .bot-ch .check { margin: 0; align-items: center; font-size: 13px; }
.bot-ch-list { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-left: 24px; }
.bot-ch-list[hidden] { display: none; }
.bot-ch-item.off { opacity: .6; cursor: default; }
.bot-ch-item small { display: inline-flex; align-items: center; gap: 3px; }
.bot-ch-cmd { display: flex; flex-direction: column; gap: 2px; }
.bot-num-wrap { display: flex; align-items: center; gap: 6px; flex: none; }
.srv-content .bot-card input.bot-num { width: 72px; }
.srv-content .bot-card input.bot-word { width: 130px; }
.bot-foot { gap: 10px; align-items: center; flex-wrap: wrap; }
.bot-log ul { margin: 6px 0 0; }
.tag.bot-off-tag { background: transparent; color: var(--warn); border: 1px solid currentColor; font-weight: 600; cursor: help; }
.msg.bot-fold .bot-fold-why { opacity: .8; }
@media (max-width: 600px) {
  .bot-head { flex-wrap: wrap; }
  .bot-master { margin-left: auto; }
  .bot-row { padding: 8px 10px; gap: 8px; }
  .bot-row-ico { display: none; }
  .bot-row-plain { flex-wrap: wrap; }
  .bot-row-plain .bot-num-wrap { margin-left: 0; }
}
@media (forced-colors: active) {
  .bot-preview, .bot-use { border: 1px solid CanvasText; }
}

/* ---------- issue board (List | Board in an issue-mode channel; app.js "issue board") ---------- */
.iss-view { display: inline-flex; align-items: center; flex: none; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.iss-view-btn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 0; border-radius: 999px; font-size: 12.5px; line-height: 1.4; background: transparent; color: var(--muted); white-space: nowrap; }
.iss-view-btn:hover { color: var(--text); background: var(--hover); }
.iss-view-btn.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.iss-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: stretch; padding: 4px 12px 8px; } /* columns as tall as the longest: the whole column takes a drop */
.iss-board.one { grid-template-columns: minmax(0, 640px); justify-content: center; }
.iss-col { display: flex; flex-direction: column; min-width: 0; min-height: 120px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--panel) 55%, transparent); transition: border-color .12s, background .12s; }
.iss-col-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 7px; margin: 0; padding: 9px 10px 7px; font-size: 13px; font-weight: 700; background: var(--bg); border-radius: 10px 10px 0 0; border-bottom: 2px solid var(--c); }
.iss-col-head .n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.iss-col-list { display: flex; flex-direction: column; gap: 8px; padding: 8px; min-height: 60px; }
.iss-col-empty { margin: 8px 4px; color: var(--muted); font-size: 12.5px; text-align: center; }
.iss-col.drop-ok { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.iss-col.drop-no { border-color: var(--bad); border-style: dashed; background: color-mix(in srgb, var(--bad) 8%, transparent); }
.iss-card { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: 8px; background: var(--panel); color: var(--text); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; font-size: 14px; }
.iss-card:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--line)); border-left-color: var(--c); }
.iss-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.iss-card.pending { opacity: .7; }
.iss-card.dragging { opacity: .35; }
.iss-card.flash { animation: flash 1.2s ease-out; }
.iss-board.dragging, .iss-board.dragging .iss-card { cursor: grabbing; }
.iss-card-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.iss-card-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.iss-card-time { flex: none; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.iss-card .text.iss-card-text { font-size: 13.5px; line-height: 19px; min-height: 0; max-height: calc(19px * 3 + 2px); overflow: hidden; cursor: inherit; }
.iss-card .text.iss-card-text.jumbo { font-size: 13.5px; }
.iss-card .text.iss-card-text :is(.md-h, .quote, .md-list, pre) { margin: 0; font-size: inherit; }
.iss-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.iss-card-foot .spacer { flex: 1 1 auto; }
.iss-card-n { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.iss-card-btn { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.iss-card-btn:hover { color: var(--text); background: var(--hover); border-color: var(--line); }
.iss-card-menu { margin-left: auto; flex: none; padding: 0 4px; }
.iss-card-rx.reacts { margin: 0; gap: 3px; }
.iss-card-rx .react { padding: 0 6px; font-size: 12px; gap: 3px; }
.iss-card-rx .react .n { font-size: 11px; }
.iss-card-rx .react img.emoji { width: 14px; height: 14px; vertical-align: -2px; }
.iss-card-more { font-size: 11px; }
.iss-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; margin: 0; cursor: grabbing; opacity: .95; box-shadow: 0 10px 28px rgba(0,0,0,.28); rotate: 1.5deg; }
.iss-ghost.no { border-color: var(--bad); border-left-color: var(--bad); }
.iss-ghost.no::after { content: attr(data-why); position: absolute; left: 6px; right: 6px; top: calc(100% + 6px); padding: 5px 8px; border-radius: 6px; background: var(--bad); color: var(--on-bad); font-size: 12px; line-height: 1.3; }
.iss-board-foot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 12px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.iss-board-foot p { margin: 0; }
.iss-board-foot .older { margin: 6px auto 0; }
@media (prefers-reduced-motion: reduce) { html:not(.full-motion) .iss-ghost { rotate: none; } html:not(.full-motion) .iss-col { transition: none; } }
html.reduce-motion .iss-ghost { rotate: none; }
/* a narrow chat (a phone, or the member list and a thread open): the columns swipe sideways; the issue filter shows one */
.iss-board-wrap { container: issboard / inline-size; }
@container issboard (max-width: 760px) {
  .iss-board:not(.one) { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 12px; overscroll-behavior-x: contain; }
  .iss-board.dragging:not(.one) { scroll-snap-type: none; }
  .iss-board:not(.one) > .iss-col { flex: 0 0 min(82%, 300px); scroll-snap-align: start; }
  .iss-board:not(.one) .iss-col-head { position: static; }
}
@container issboard (max-width: 480px) {
  .iss-board { padding: 4px 8px 8px; gap: 8px; }
  .iss-board.one { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) { .iss-view-btn { padding: 2px 7px; } }

/* ---------- send later (scheduled messages) ---------- */
.later-btn { display: inline-flex; align-items: center; gap: 2px; }
.later-btn .later-ico { font-size: 15px; line-height: 1; filter: grayscale(1); opacity: .85; }
.later-btn.on .later-ico, .later-btn:hover .later-ico { filter: none; opacity: 1; }
.later-btn .later-at { font-size: 11px; font-weight: 600; }
.later-btn .later-at:empty { display: none; }
.later-btn.on { color: var(--link); background: var(--accent-soft); }
.input-box.later { border-color: var(--link); }
.later-bar { padding: 2px 16px 4px; font-size: 12px; }
.later-bar[hidden] { display: none; }
.later-bar .link-btn { font-size: 12px; font-weight: 600; color: var(--link); }
.cf-dlg .later-label { display: grid; gap: 4px; margin-bottom: 6px; font-size: 13px; }
.cf-dlg input.later-input { width: 100%; }
.cf-dlg p.later-tz, .cf-dlg p.later-when { font-size: 12px; margin: 0 0 6px; }
.cf-dlg p.later-err { color: var(--bad); font-size: 13px; margin: 0 0 8px; }
.cf-dlg p.later-err[hidden] { display: none; }
dialog.later-dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.later-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.later-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; min-width: 0; }
.later-time { font-size: 13px; font-weight: 600; }
.later-text { font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 6em; overflow: hidden; }
.later-acts { gap: 6px; flex-wrap: wrap; }
.later-acts button { padding: 4px 10px; font-size: 13px; }
.later-empty { padding: 8px 0; }
@media (max-width: 900px) { .later-btn .later-at { display: none; } } /* the box needs the room; the button's colour says it's on */
/* ---------- plugin bars (ui:banner) above the messages, pinned plugin buttons, the store's way in (app.js plugins) ---------- */
.pl-banners { display: grid; gap: 0; border-bottom: 1px solid var(--line); }
.pl-banners[hidden] { display: none; }
.pl-banner { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 14px; background: var(--accent-soft); font-size: 13px; min-width: 0; }
.pl-banner + .pl-banner { border-top: 1px solid var(--line); }
.pl-banner-ico { color: var(--accent); display: inline-flex; flex: none; }
.pl-banner-who { color: var(--muted); white-space: nowrap; flex: none; }
.pl-banner-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pl-banner-btn { flex: none; padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 999px; border: 1px solid var(--accent); background: var(--panel); color: var(--text); cursor: pointer; }
.pl-banner-btn:hover, .pl-banner-btn:focus-visible { background: var(--accent); color: var(--on-accent); }
.pl-banner-x { flex: none; }
@media (max-width: 680px) { .pl-banner-who { display: none; } }
.us-card.pl-store { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-color: var(--accent); }
.pl-store-text { flex: 1; min-width: 200px; }
.pl-store-text p { margin: 2px 0 0; }
.us-card.pl-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.us-card.pl-empty p { margin: 0; }
/* a plugin's note under a message (ui:note: a translation), only on this device */
.pl-notes { display: grid; gap: 4px; margin: 3px 0 2px; }
.pl-note { border-left: 2px solid var(--accent-soft); padding: 1px 0 1px 8px; font-size: 13px; min-width: 0; }
.pl-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pl-note-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0 5px; font-size: 11px; color: var(--muted); }
.pl-note-who { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.pl-note-who .ui-ico { font-size: 11px; }
.pl-note .linkish { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
.pl-note .linkish:hover, .pl-note .linkish:focus-visible { text-decoration: underline; }


/* ---------- plugin gallery (Settings / Server settings → Plugins → Browse plugins; app.js "the plugin gallery") ---------- */
.pl-gicon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); color: var(--warn); font-size: 22px; overflow: hidden; }
.pl-gicon.sm { width: 24px; height: 24px; border-radius: 6px; font-size: 14px; }
.pl-gicon.pic { background: none; }
.pl-gicon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pl-card.flash { animation: flash 1.2s ease-out; }
dialog.pl-gallery { width: min(980px, calc(100vw - 24px)); height: min(860px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
dialog.pl-gallery:not([open]) { display: none; }
dialog.pl-gallery > * { padding-left: 20px; padding-right: 20px; }
.pl-g-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; }
.pl-g-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
dialog.pl-gallery > p.us-desc { margin: 4px 0 2px; }
.pl-g-srcrow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.pl-g-src { font-size: 12.5px; overflow-wrap: anywhere; }
.pl-g-srcrow button { padding: 3px 10px; font-size: 13px; }
.pl-g-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
dialog.pl-gallery input.pl-g-q { flex: 1 1 220px; width: auto; min-width: 0; margin: 0; padding: 7px 11px; }
.pl-g-tools .us-select { flex: none; }
.pl-g-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.pl-g-chk input { margin: 0; accent-color: var(--accent); }
dialog.pl-gallery p.pl-g-count { margin: 8px 0 0; font-size: 12.5px; }
.pl-g-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); align-content: start; gap: 12px; padding-top: 8px; padding-bottom: 20px; }
.pl-g-empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 30px 0; }
.pl-g-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.pl-g-card p { margin: 0; }
.pl-g-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-g-title { min-width: 0; }
.pl-g-title h4 { margin: 0; font-size: 16px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; overflow-wrap: anywhere; }
.pl-g-ver { font-size: 12px; font-weight: 600; color: var(--muted); }
.pl-g-by { font-size: 12.5px; overflow-wrap: anywhere; }
.pl-g-link { color: var(--link); }
.pl-g-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-g-srvpill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pl-g-desc { font-size: 14px; overflow-wrap: anywhere; }
.pl-g-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pl-g-meta .us-pill { display: inline-flex; align-items: center; gap: 4px; }
.pl-g-tag { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.pl-g-cmds { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.pl-g-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 4px; }
.pl-g-perms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.pl-g-perms summary { display: flex; align-items: center; justify-content: space-between; gap: 4px 8px; cursor: pointer; padding: 3px 4px; border-radius: 6px; list-style: none; }
.pl-g-perms summary::-webkit-details-marker { display: none; }
.pl-g-perms summary:hover { background: var(--hover); }
.pl-g-perms summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pl-g-perms details p { margin: 2px 4px 6px 4px; font-size: 12.5px; }
.pl-g-none { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 4px; }
.pl-risk { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; white-space: nowrap; }
.pl-risk.r0 { background: rgba(47,158,91,.13); background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.pl-risk.r1 { background: var(--hover); color: var(--muted); }
.pl-risk.r2 { background: rgba(209,75,75,.12); background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.pl-g-plabel { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pl-g-new { font-size: 13px; border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; overflow-wrap: anywhere; }
.pl-g-new summary { cursor: pointer; color: var(--muted); margin-top: 4px; }
.pl-g-new ul { margin: 4px 0 0; padding-left: 18px; }
.pl-g-shots { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.pl-g-shot { flex: none; padding: 0; border-radius: 8px; overflow: hidden; height: 90px; background: var(--panel); }
.pl-g-shot img { display: block; height: 100%; width: auto; }
.pl-g-shot.big { height: auto; width: 100%; }
.pl-g-shot.big img { width: 100%; height: auto; }
.pl-g-acts { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line); }
.pl-g-actrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.pl-g-actrow button { padding: 6px 12px; font-size: 13.5px; }
.pl-g-for { flex: 1 0 100%; font-size: 12px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-g-acts .us-desc.small { font-size: 12.5px; margin: 0; }
.pl-card-title .pl-gicon.sm { margin-right: 2px; }
@media (max-width: 560px) {
  dialog.pl-gallery { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  dialog.pl-gallery > * { padding-left: 16px; padding-right: 16px; }
  .pl-g-tools .us-select { flex: 1 1 auto; }
}
@media (forced-colors: active) {
  .pl-risk, .pl-g-card, .pl-gicon:not(.pic) { border: 1px solid CanvasText; }
  .pl-g-new { border-left-color: Highlight; }
}


/* ---------- role picker: Pick your roles…, role picker messages, the role editor's Self-assignable ---------- */
.rp-groups { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.rp-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rp-gname { font-size: 13px; overflow-wrap: anywhere; }
.rp-gname small { font-weight: 400; }
.rp-card { display: flex; flex-direction: column; gap: 8px; max-width: min(100%, 520px); padding: 10px 12px 12px; margin: 2px 0;
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; background: var(--panel); }
.rp-title { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.rp-title .ui-ico { color: var(--accent); }
.rp-card p { margin: 0; }
.rp-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.rp-btn i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rp-btn:hover:not(:disabled) { border-color: var(--accent); }
.rp-btn.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rp-btn:disabled { cursor: default; opacity: .7; }
.rp-edit { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 4px; }
.rp-edit h4, .rp-summary h4 { display: flex; align-items: center; gap: 6px; margin: 0; }
.rp-edit p { margin: 0; }
.rp-edit-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.rp-edit-row .srv-field { margin: 0; }
.warn-text { color: var(--warn); }
.rp-summary { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.rp-summary p { margin: 0; }
.rp-sum-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }
.rp-post-form { display: flex; flex-direction: column; gap: 10px; }
.rp-post-form h3, .rp-post-form p { margin: 0; }
dialog.rp-pick-dlg form { padding-top: 16px; }
.rp-pick-dlg h3 { display: flex; align-items: center; gap: 6px; margin: 0; }

/* ---------- scrollbars: thin, rounded, no arrow buttons, in the theme's colours ----------
   Tokens (theme.js derives them for every theme; a custom theme can pick the thumb colour, width, shape
   and "only while scrolling"): --scroll-thumb, --scroll-thumb-hover, --scroll-track, --scroll-size,
   --scroll-radius, --scroll-fx (Firefox's scrollbar-width keyword).
   Chrome, Edge, Brave, Opera and Safari get ::-webkit-scrollbar: it is the only way to have a rounded
   thumb with a gap around it, no arrow buttons and a stronger thumb under the pointer. Since Chromium
   121, scrollbar-width / scrollbar-color on an element switch those pseudo-elements off for it (and the
   standard ones keep the arrow buttons on Windows), so the standard properties are only set where
   ::-webkit-scrollbar doesn't exist (Firefox). Areas that hide their scrollbar (scrollbar-width: none,
   like the issue filter chips) keep doing so. Windows high contrast (forced colours): the system's own.
   Phones draw overlay scrollbars of their own and mostly ignore all of this. */
@media (forced-colors: none) {
  ::-webkit-scrollbar { width: var(--scroll-size); height: var(--scroll-size); background: transparent; }
  ::-webkit-scrollbar-track { background: var(--scroll-track); border-radius: var(--scroll-radius); }
  ::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb) padding-box; border: 3px solid transparent; border-radius: var(--scroll-radius);
    min-height: 36px; min-width: 36px;
  }
  /* under the pointer or dragged: stronger and a little wider (the transparent border gets thinner) */
  ::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--scroll-thumb-hover); border-width: 2px; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-corner { background: transparent; }
  /* only while scrolling (html.sb-auto, theme.js): the thumb shows while the area scrolls (.sb-on), is
     hovered or holds the focus (keyboard users see where they are) */
  .sb-auto ::-webkit-scrollbar-thumb { background-color: transparent; }
  .sb-auto ::-webkit-scrollbar-track { background: transparent; }
  .sb-auto :is(:hover, :focus-within, .sb-on)::-webkit-scrollbar-thumb { background-color: var(--scroll-thumb); }
  .sb-auto :is(:hover, :focus-within, .sb-on)::-webkit-scrollbar-track { background: var(--scroll-track); }
  .sb-auto :is(:hover, :focus-within, .sb-on)::-webkit-scrollbar-thumb:hover,
  .sb-auto :is(:hover, :focus-within, .sb-on)::-webkit-scrollbar-thumb:active { background-color: var(--scroll-thumb-hover); }

  @supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: var(--scroll-fx); scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
    /* Firefox fades it (the motion settings above turn transitions off) */
    .sb-auto * { scrollbar-color: transparent transparent; transition: scrollbar-color .25s; }
    .sb-auto :is(:hover, :focus-within, .sb-on) { scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
  }
  /* the device asks for more contrast: the stronger thumb all the time, and a track to see it against */
  @media (prefers-contrast: more) {
    ::-webkit-scrollbar-thumb, .sb-auto :is(:hover, :focus-within, .sb-on)::-webkit-scrollbar-thumb { background-color: var(--scroll-thumb-hover); border-width: 2px; }
    ::-webkit-scrollbar-track, .sb-auto :is(:hover, :focus-within, .sb-on)::-webkit-scrollbar-track { background: color-mix(in srgb, var(--text) 12%, transparent); }
    @supports not selector(::-webkit-scrollbar) {
      * { scrollbar-color: var(--scroll-thumb-hover) color-mix(in srgb, var(--text) 12%, transparent); }
    }
  }
}
/* the scrollbar in Appearance's small preview (usMini) */
.us-mini-sb { position: absolute; top: 40px; bottom: 52px; right: 2px; width: var(--scroll-size); background: var(--scroll-track); border-radius: var(--scroll-radius); z-index: 1; }
.us-mini-sb i { position: absolute; left: 3px; right: 3px; top: 38%; bottom: 8%; background: var(--scroll-thumb); border-radius: var(--scroll-radius); }
.us-mini-sb.auto { opacity: .55; }
.us-mini-sb.auto i { background: repeating-linear-gradient(0deg, var(--scroll-thumb) 0 4px, transparent 4px 7px); }

/* ---- plugin permissions, Android-style (app.js "permissions, Android-style"): the review's rows, the runtime question,
   the permission manager, the privacy dot */
.pl-perm.pl-perm-req, .pl-perm.pl-perm-opt { cursor: default; align-items: center; }
.pl-perm.pl-perm-req:hover, .pl-perm.pl-perm-opt:hover { background: none; }
.pl-perm .pl-perm-text { flex: 1; }
.pl-perm .us-select, .plm-row .us-select { flex: none; width: auto; max-width: 200px; }
.plm-ico { flex: none; display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; background: var(--hover); color: var(--text); }
.plm-why { font-style: italic; }
.pl-ask-pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 6px; }
.pl-ask-why { margin: 4px 0; font-size: 13px; overflow-wrap: anywhere; }
.pl-ask-never { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; cursor: pointer; }
.pl-ask-never input { width: auto; margin: 0; accent-color: var(--accent); }
.pl-ask .us-desc, .pl-perm-ask .us-desc { margin: 4px 0; font-size: 12px; }
dialog.plm-dlg { width: min(680px, calc(100vw - 24px)); }
.plm-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 8px 0 10px; }
.plm-tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 10px; color: var(--muted); font-weight: 600; }
.plm-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.plm-body { display: flex; flex-direction: column; gap: 10px; }
.plm-card { display: flex; flex-direction: column; gap: 4px; }
.plm-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.plm-text { flex: 1; min-width: 0; }
.plm-text p { margin: 2px 0 0; }
.plm-label { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.plm-sw { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.plm-fixed { flex: none; font-size: 12px; color: var(--muted); max-width: 40%; text-align: right; }
.plm-log, .plm-never { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.plm-log li, .plm-never li { display: flex; gap: 8px; align-items: center; font-size: 13px; overflow-wrap: anywhere; }
.plm-log .plm-ico, .plm-never .plm-ico { width: 22px; height: 22px; }
.spl-req { display: flex; gap: 6px; align-items: center; font-size: 13px; margin-top: 4px; cursor: pointer; }
.srv-card .spl-req input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }
.pl-privacy { display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 130px; padding: 3px 10px 3px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pl-privacy-text { overflow: hidden; text-overflow: ellipsis; }
.pl-privacy-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 3px rgba(47,158,91,.18); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.pl-privacy.ai .pl-privacy-dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
@media (prefers-reduced-motion: no-preference) { .pl-privacy-dot { animation: plDot 1.6s ease-in-out infinite; } }
@keyframes plDot { 50% { opacity: .45; } }
@media (max-width: 560px) {
  .pl-privacy-text { display: none; }
  .pl-privacy { padding: 6px; }
  .plm-row { flex-wrap: wrap; }
  .plm-row .us-select, .pl-perm .us-select { max-width: 100%; width: 100%; }
}
@media (forced-colors: active) { .pl-privacy-dot { background: CanvasText; } .plm-ico { border: 1px solid CanvasText; } }
.plm-card .pl-card-head { justify-content: flex-start; }
.plm-more { font-size: 12px; color: var(--muted); margin-top: 2px; }
.plm-more summary { cursor: pointer; width: fit-content; }
.plm-more p { margin: 2px 0 0; }
.plm-card { align-items: stretch; text-align: left; flex-wrap: nowrap; gap: 0; margin: 0; }
.plm-card > * { align-self: stretch; }

/* view-once attachments: the tray's toggle, the placeholder card, the viewer */
.vof-tog { flex: none; width: 72px; height: 72px; padding: 6px 4px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel); border: 1px dashed var(--line); color: var(--muted); font-size: 11px; line-height: 1.2; text-align: center; }
.vof-tog:hover { color: var(--text); border-color: var(--muted); }
.vof-tog.on { background: var(--accent); border: 1px solid var(--accent); color: var(--on-accent); }
.vof-tog[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.vof-one { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 50%; font-weight: 700; font-size: 12px; line-height: 1; flex: none; }
.tray.vof-on .tray-item img { filter: blur(6px) saturate(.7); }
.files .vof-card { display: flex; align-items: center; gap: 12px; width: min(100%, 320px); min-height: 64px; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); cursor: pointer;
  background: radial-gradient(circle at 18% 30%, var(--accent-soft), transparent 60%), radial-gradient(circle at 85% 75%, rgba(127,127,127,.18), transparent 55%), var(--panel); }
.files .vof-card:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.files .vof-card[aria-disabled="true"] { cursor: default; }
.files .vof-card.opened { background: var(--panel); }
.files .vof-card.opened .file-txt b { color: var(--muted); }
.vof-ico { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--side); color: var(--link); font-size: 20px; }
.vof-ico .vof-one { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; font-size: 10px; border-width: 2px; background: var(--panel); }
.vof-card.opened .vof-ico { color: var(--muted); }
.vof-viewer .vof-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; user-select: none; -webkit-user-select: none; }
.vof-viewer .vof-stage img, .vof-viewer .vof-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.vof-viewer .vof-stage img { pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.vof-viewer .vof-text { max-width: min(100%, 900px); max-height: 100%; overflow: auto; margin: 0; padding: 16px; border-radius: 8px; background: var(--panel); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.vof-viewer .vof-wait { color: #ddd; font-size: 14px; }
.vof-viewer .vof-note { margin-top: 6px; color: #bbb; font-size: 12px; text-align: center; max-width: 560px; }

/* bot approvals (Server settings → Bot approvals; the count on the server name and in the settings nav) */
.ba-badge { min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--badge); color: var(--on-bad); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; vertical-align: middle; }
.server-title .ba-badge { margin: 0 4px 0 6px; }
.ba-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ba-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.ba-item.ba-pending { border-color: var(--accent); }
.ba-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ba-head .muted { margin-left: auto; }
.ba-why-text { margin: 0; font-style: italic; color: var(--muted); }
.ba-direct .ba-why-text { font-style: normal; color: var(--text); }
.ba-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 3px; }
.ba-steps .ba-danger { color: var(--bad); font-weight: 600; }
.ba-cant { margin: 0; }
.ba-acts { gap: 8px; }
.bot-direct { background: rgba(209,75,75,.06); background: color-mix(in srgb, var(--bad) 6%, transparent); border-radius: 8px; }
@media (max-width: 600px) { .ba-head .muted { margin-left: 0; flex-basis: 100%; } }
@media (forced-colors: active) { .ba-badge { border: 1px solid CanvasText; } }
.ba-acts button:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(1); }
/* ===== effect themes (theme.js "effects"): glow, gradients, a backdrop, slow motion =====
   theme.js puts fx-* classes and --fx-* properties on <html> (and on the previews in Settings >
   Appearance). Only with html.fx-move does anything move: Effects "full", motion allowed. Animations
   are transform / opacity / background-position on a handful of elements, never per message, and
   pause while nobody is looking (--fx-play: theme.js fxWatch; the tab hidden, the window in the
   background, no input for a while) and on rows scrolled far away (.log.fx-away / .fx-deep, app.js
   jumpState). Transform and opacity run on the graphics card; the gradient flows (background-position,
   --fx-fp, --fx-sx) repaint the text, so they move in steps (steps(): about 12 repaints a second at the
   usual speed instead of 60) and only on the few elements named. The backdrop, its pattern and the online
   dots move in small steps too (a pixel, a third of a degree): between two steps nothing on screen changes,
   so the graphics card has no frame to draw and no glass to blur again. A background picture of your own
   (html.wall) wins over the backdrop. */
/* the backdrop: body::before the gradient (it moves), body::after a veil of the theme background
   over it (as thick as readability needs) with the sky pattern, html::after twinkling stars / pollen.
   With a plain veil (fx-bg1, theme.js) the gradient comes already mixed with it (--fx-bgv) and body::after
   is not drawn: the same colours in one layer instead of two over the whole window.
   The gradient is laid out on a 150vmax square around the middle of the window (background-size), but the
   layer is only as big as the part of it that can come into view: the window while it stands still, the
   window plus the drift's reach while drifting, a square of the window's diagonal while turning (it was
   always the whole 150vmax square: up to three times the pixels for the graphics card to hold) */
html.fx-bgl:not(.wall) .main { background: transparent; }
html.fx-bgg:not(.wall) body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none; inset: 0;
  background-image: var(--fx-bg); background-position: 50% 50%; background-size: 150vmax 150vmax; background-repeat: no-repeat;
}
html.fx-bg1:not(.wall) body::before { background-image: var(--fx-bgv); }
html.fx-bgl:not(.wall) body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--fx-veil); }
html.fx-bg1:not(.wall) body::after { content: none; }
html.fx-sky-stars:not(.wall)::after, html.fx-sky-pollen:not(.wall)::after { content: ""; position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: -1; pointer-events: none; background: var(--fx-sky2); }
html.fx-sky-pollen:not(.wall)::after { height: calc(100% + 260px); }
/* drifting: 7.5vmax / 6vmax each way (5% / 4% of the old square) and scaled 1.04 to 1.1, so the window plus
   that much on each side is always enough */
html.fx-move.fx-bg-drift:not(.wall) body::before {
  inset: calc(-6vmax - 2px) calc(-7.5vmax - 2px);
  animation: hfx-bgdrift var(--fx-bg-dur) linear infinite alternate; animation-play-state: var(--fx-play, running); will-change: transform;
}
/* turning: a square of the window's diagonal around its middle covers it at every angle (browsers without
   hypot() keep the 150vmax square) */
html.fx-move.fx-bg-rotate:not(.wall) body::before {
  inset: calc(50vh - 75vmax) calc(50vw - 75vmax);
  inset: calc(50vh - hypot(50vw, 50vh) - 2px) calc(50vw - hypot(50vw, 50vh) - 2px);
  animation: hfx-spin var(--fx-bg-dur) steps(1080) infinite; animation-play-state: var(--fx-play, running); will-change: transform;
}
html.fx-move.fx-sky-stars:not(.wall)::after { animation: hfx-twinkle calc(6s * var(--fx-k)) linear infinite alternate; animation-play-state: var(--fx-play, running); }
html.fx-move.fx-sky-pollen:not(.wall)::after { animation: hfx-rise calc(40s * var(--fx-k)) steps(260) infinite; animation-play-state: var(--fx-play, running); will-change: transform; }
/* the drift in steps (480 each way, under a pixel each on a 1080p screen, about 12 a second at the usual
   speed), its ease-in-out kept as eight pieces with as many steps as each piece moves */
@keyframes hfx-bgdrift {
  0% { transform: translate3d(-7.5vmax, -6vmax, 0) scale(1.04); animation-timing-function: steps(15); }
  12.5% { transform: translate3d(-7.034vmax, -5.627vmax, 0) scale(1.0419); animation-timing-function: steps(47); }
  25% { transform: translate3d(-5.562vmax, -4.45vmax, 0) scale(1.0478); animation-timing-function: steps(79); }
  37.5% { transform: translate3d(-3.108vmax, -2.486vmax, 0) scale(1.0576); animation-timing-function: steps(99); }
  50% { transform: translate3d(0, 0, 0) scale(1.07); animation-timing-function: steps(99); }
  62.5% { transform: translate3d(3.108vmax, 2.486vmax, 0) scale(1.0824); animation-timing-function: steps(79); }
  75% { transform: translate3d(5.562vmax, 4.45vmax, 0) scale(1.0922); animation-timing-function: steps(47); }
  87.5% { transform: translate3d(7.034vmax, 5.627vmax, 0) scale(1.0981); animation-timing-function: steps(15); }
  100% { transform: translate3d(7.5vmax, 6vmax, 0) scale(1.1); }
}
/* the same in the previews (Settings > Appearance), in % of their own square */
@keyframes hfx-drift {
  0% { transform: translate3d(-5%, -4%, 0) scale(1.04); animation-timing-function: steps(4); }
  12.5% { transform: translate3d(-4.689%, -3.751%, 0) scale(1.0419); animation-timing-function: steps(12); }
  25% { transform: translate3d(-3.708%, -2.966%, 0) scale(1.0478); animation-timing-function: steps(20); }
  37.5% { transform: translate3d(-2.072%, -1.658%, 0) scale(1.0576); animation-timing-function: steps(25); }
  50% { transform: translate3d(0, 0, 0) scale(1.07); animation-timing-function: steps(25); }
  62.5% { transform: translate3d(2.072%, 1.658%, 0) scale(1.0824); animation-timing-function: steps(20); }
  75% { transform: translate3d(3.708%, 2.966%, 0) scale(1.0922); animation-timing-function: steps(12); }
  87.5% { transform: translate3d(4.689%, 3.751%, 0) scale(1.0981); animation-timing-function: steps(4); }
  100% { transform: translate3d(5%, 4%, 0) scale(1.1); }
}
@keyframes hfx-spin { to { transform: rotate(1turn); } }
/* twinkling in steps of about 1% opacity, eased in four pieces */
@keyframes hfx-twinkle {
  0% { opacity: .3; animation-timing-function: steps(9); }
  25% { opacity: .39; animation-timing-function: steps(27); }
  50% { opacity: .65; animation-timing-function: steps(27); }
  75% { opacity: .91; animation-timing-function: steps(9); }
  100% { opacity: 1; }
}
@keyframes hfx-rise { to { transform: translate3d(0, -260px, 0); } }
/* see-through panels (glass: blurred) over the backdrop; drawers on smaller screens stay solid.
   The blur is only drawn where it shows: over a pattern or a sharp edge of the gradient (fx-detail, theme.js;
   a blurred smooth gradient looks just like the gradient, so there the tint alone is the glass), and not on a
   rail that carries the gradient itself (fx-rail: opaque, nothing shows through). The graphics card redoes a
   blur whenever what is behind it moves. On a weak device (fx-lite, theme.js) the glass is a thicker tint of
   the panel's own colour instead (the pattern shows through about half as much, not blurred). */
@media (min-width: 681px) {
  html.fx-see:not(.wall) .rail, html.fx-see:not(.wall) .me { background: var(--fx-see-rail); }
  html.fx-see:not(.wall) .side { background: var(--fx-see-side); }
  html.fx-glass.fx-detail:not(.wall, .fx-lite) .side, html.fx-glass.fx-detail:not(.wall, .fx-lite, .fx-rail) .rail { -webkit-backdrop-filter: blur(var(--fx-glass)); backdrop-filter: blur(var(--fx-glass)); }
  html.fx-glass.fx-detail.fx-lite:not(.wall) .side { background-image: linear-gradient(color-mix(in srgb, var(--side) 50%, transparent), color-mix(in srgb, var(--side) 50%, transparent)); }
  html.fx-glass.fx-detail.fx-lite:not(.wall, .fx-rail) .rail { background-image: linear-gradient(color-mix(in srgb, var(--rail) 50%, transparent), color-mix(in srgb, var(--rail) 50%, transparent)); }
}
@media (min-width: 1001px) {
  html.fx-see:not(.wall) .members { background: var(--fx-see-side); }
  html.fx-see:not(.wall) .thread-pane { background: var(--fx-see-bg); }
  html.fx-glass.fx-detail:not(.wall, .fx-lite) :is(.members, .thread-pane) { -webkit-backdrop-filter: blur(var(--fx-glass)); backdrop-filter: blur(var(--fx-glass)); }
  html.fx-glass.fx-detail.fx-lite:not(.wall) .members { background-image: linear-gradient(color-mix(in srgb, var(--side) 50%, transparent), color-mix(in srgb, var(--side) 50%, transparent)); }
  html.fx-glass.fx-detail.fx-lite:not(.wall) .thread-pane { background-image: linear-gradient(color-mix(in srgb, var(--bg) 50%, transparent), color-mix(in srgb, var(--bg) 50%, transparent)); }
}
/* the server rail in the backdrop gradient (under a veil of the rail colour), flowing slowly */
html.fx-rail:not(.wall-app) .rail { background: var(--fx-rail); background-size: 100% 100%, 100% 200%; }
html.fx-rail:not(.wall-app) .rail-foot { background: transparent; }
html.fx-move.fx-rail-move:not(.wall-app) .rail { animation: hfx-flow-y var(--fx-rail-dur) steps(240) infinite; animation-play-state: var(--fx-play, running); }
@keyframes hfx-flow-y { from { background-position: 0 0, 0 0; } to { background-position: 0 0, 0 100%; } }
/* glow: a halo around text that is already readable on its own */
html.fx-glow-names :is(.who, .member-list .name, .me-name) { text-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
html.fx-glow-text .log .text { text-shadow: 0 0 var(--fx-glow-rt) var(--fx-glow-t); }
html.fx-glow-text .log .text :is(pre, code, .spoiler) { text-shadow: none; }
html.fx-glow-chans .channel-list li:not(.cat) .name { text-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
html.fx-glow-heads :is(.chan-head h1, .server-title > span:first-child, .log .intro h2, .us-h) { text-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
html.fx-hover :is(button, .rail-btn, .channel-list li:not(.cat), .member-list li):is(:hover, :focus-visible),
html.fx-hover .input-box:focus-within { box-shadow: 0 0 calc(var(--fx-glow-r, 8px) + 4px) var(--fx-halo); }
/* the accent gradient: buttons, the open server, the jump button, tags */
html.fx-ac :is(button.primary, .rail-btn.active, .rail-btn.add:hover, .jump, .tag, .us-seg input:checked + label) { background-image: var(--fx-ac); }
/* gradient text: headings (flowing) and names without a role colour (still) */
html.fx-txt :is(.chan-head h1, .server-title > span:first-child, .log .intro h2, .who:not([style*="color"]), .me-name) {
  background-image: var(--fx-txt); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
html.fx-txt :is(.chan-head h1, .server-title > span:first-child, .log .intro h2, .who, .me-name)::selection { -webkit-text-fill-color: var(--text); }
html.fx-move.fx-ac-move.fx-txt :is(.chan-head h1, .server-title > span:first-child, .log .intro h2) { animation: hfx-flow-x var(--fx-ac-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
@keyframes hfx-flow-x { from { background-position: 0 0; } to { background-position: 100% 0; } }
/* gradient text glows with a drop shadow (a text-shadow would cover the gradient) */
html.fx-txt.fx-glow-heads :is(.chan-head h1, .server-title > span:first-child, .log .intro h2) { text-shadow: none; filter: drop-shadow(0 0 calc(var(--fx-glow-r) / 2) var(--fx-glow)); }
html.fx-txt.fx-glow-names :is(.who:not([style*="color"]), .me-name) { text-shadow: none; filter: drop-shadow(0 0 calc(var(--fx-glow-r) / 2) var(--fx-glow)); }
/* the message box border in the accent gradient, flowing (not while a mode colours the border) */
html.fx-box .input-box:not(.too-long, .silent, .important, .disappear) {
  border-color: transparent; background: linear-gradient(var(--box, var(--panel)), var(--box, var(--panel))) padding-box, var(--fx-boxg) border-box;
  background-size: 100% 100%, 200% 100%;
}
html.fx-move.fx-ac-move.fx-box .input-box:not(.too-long, .silent, .important, .disappear) { animation: hfx-flow-box var(--fx-ac-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
@keyframes hfx-flow-box { from { background-position: 0 0, 0 0; } to { background-position: 0 0, 100% 0; } }
/* a sheen across the open channel; online dots that breathe (the first 40 rows only) */
html.fx-shimmer .channel-list li.active { position: relative; overflow: hidden; isolation: isolate; }
html.fx-shimmer .channel-list li.active::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 25%, var(--fx-shine) 50%, transparent 75%);
}
html.fx-shimmer:not(.fx-move) .channel-list li.active::after { transform: none; background: linear-gradient(90deg, var(--fx-shine), transparent 70%); }
html.fx-move.fx-shimmer .channel-list li.active::after { animation: hfx-shine calc(5s * var(--fx-k)) ease-in-out infinite; animation-play-state: var(--fx-play, running); }
@keyframes hfx-shine { 0%, 50% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
html.fx-pulse .member-list li:not(.offline, .idle, .dnd) .avatar::after { box-shadow: 0 0 6px var(--ok); }
html.fx-move.fx-pulse .member-list li:not(.offline, .idle, .dnd):nth-child(-n+40) .avatar::after { animation: hfx-pulse calc(2.8s * var(--fx-k)) linear infinite; animation-play-state: var(--fx-play, running); }
/* about 11 steps a second at the usual speed, eased in four pieces each way (the dots sit on the members
   panel, which may be glass) */
@keyframes hfx-pulse {
  0% { transform: scale(1); opacity: 1; animation-timing-function: steps(2); }
  12.5% { transform: scale(1.039); opacity: .968; animation-timing-function: steps(6); }
  25% { transform: scale(1.15); opacity: .875; animation-timing-function: steps(6); }
  37.5% { transform: scale(1.261); opacity: .782; animation-timing-function: steps(2); }
  50% { transform: scale(1.3); opacity: .75; animation-timing-function: steps(2); }
  62.5% { transform: scale(1.261); opacity: .782; animation-timing-function: steps(6); }
  75% { transform: scale(1.15); opacity: .875; animation-timing-function: steps(6); }
  87.5% { transform: scale(1.039); opacity: .968; animation-timing-function: steps(2); }
  100% { transform: scale(1); opacity: 1; }
}
/* the newer backdrop patterns (theme.js fxPattern), and old ones with options: one tile layer over the veil
   (html::after); "moving" slides it by exactly one tile (transform), so it loops without a seam, one pixel
   per step (--fx-sky-n steps: the tile's size, theme.js) */
html.fx-sky-x:not(.wall)::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--fx-sky2); }
html.fx-move.fx-sky-dr:not(.wall)::after {
  inset: calc(-1 * var(--fx-sky-h)) calc(-1 * var(--fx-sky-w)); will-change: transform;
  animation: hfx-sky var(--fx-sky-dur) steps(var(--fx-sky-n, 60)) infinite; animation-play-state: var(--fx-play, running);
}
html.fx-move.fx-sky-tw:not(.wall)::after { animation: hfx-twinkle calc(5s * var(--fx-k)) linear infinite alternate; animation-play-state: var(--fx-play, running); }
html.fx-move.fx-sky-dr.fx-sky-tw:not(.wall)::after { animation: hfx-sky var(--fx-sky-dur) steps(var(--fx-sky-n, 60)) infinite, hfx-twinkle calc(5s * var(--fx-k)) linear infinite alternate; animation-play-state: var(--fx-play, running); }
@keyframes hfx-sky { to { transform: translate3d(var(--fx-sky-tx), var(--fx-sky-ty), 0); } }
/* the synthwave horizon: the grid as a floor tilted in 3D at the bottom, fading out toward the horizon;
   moving, it slides toward you by one square */
html.fx-sky-hz:not(.wall)::after, html.fx-move.fx-sky-hz.fx-sky-dr:not(.wall)::after {
  inset: auto -100vw calc(-2 * var(--fx-sky-h)); height: 160vh; transform-origin: 50% 100%; transform: perspective(90vh) rotateX(52deg);
  -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%);
}
html.fx-move.fx-sky-hz.fx-sky-dr:not(.wall)::after { animation-name: hfx-hz; }
@keyframes hfx-hz { from { transform: perspective(90vh) rotateX(52deg) translate3d(0, calc(-1 * var(--fx-sky-h)), 0); } to { transform: perspective(90vh) rotateX(52deg) translate3d(0, 0, 0); } }
/* gradient names flow too (the accent gradient's animation), in the newest 24 rows of a chat */
html.fx-move.fx-ac-move.fx-txt :is(.log:not(.us-preview) > .msg:nth-last-child(-n+24) .who:not([style*="color"]), .me-name) { animation: hfx-flow-x var(--fx-ac-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
/* message text in its own gradient (fx.mt): code, spoilers, links, mentions, emoji and greentext keep their look;
   it flows only in the newest 8 messages */
html.fx-mt .log:not(.us-preview) > .msg .text { --fx-tl: var(--fx-mt); background-image: var(--fx-mt); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
html.fx-mt .log:not(.us-preview) > .msg .text :is(a, code, pre, .spoiler, .at, .masked, .masked-host, .emo, .greentext) { -webkit-text-fill-color: currentColor; }
html.fx-mt .log:not(.us-preview) > .msg .text::selection, html.fx-mt .log:not(.us-preview) > .msg .text ::selection { -webkit-text-fill-color: var(--text); }
html.fx-mt.fx-glow-text .log:not(.us-preview) > .msg .text { text-shadow: none; filter: drop-shadow(0 0 var(--fx-glow-rt) var(--fx-glow-t)); }
html.fx-move.fx-mt-move .log:not(.us-preview) > .msg:nth-last-child(-n+8) .text { animation: hfx-flow-x var(--fx-mt-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
/* text animations (fx.ta) on names, headings, channel names and message text in its own gradient: a light
   layer (--fx-hl) over the text's own colours (--fx-tl: its gradient, or its colour), both clipped to the
   letters. The light's place (--fx-sx) and the gradient's flow (--fx-fp) are animated apart. Only the
   newest names, the first 30 channels and the newest 8 messages move; the rest stays still. */
@property --fx-sx { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@property --fx-fp { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
:root { --fx-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C13 8 16 11 24 12C16 13 13 16 12 24C11 16 8 13 0 12C8 11 11 8 12 0Z'/%3E%3C/svg%3E"); }
.fx-ta-shine { --fx-hl: linear-gradient(100deg, transparent 42%, var(--fx-sheen) 50%, transparent 58%); --fx-ta: hfx-sweep var(--fx-tai) ease-in-out infinite; }
.fx-ta-spot { --fx-hl: linear-gradient(90deg, transparent 30%, var(--fx-sheen) 50%, transparent 70%); --fx-ta: hfx-glide calc(var(--fx-tai) * .5) steps(15) infinite alternate; }
html.fx-txt :is(.chan-head h1, .server-title > span:first-child, .log:not(.us-preview) .intro h2, .log:not(.us-preview) .who:not([style*="color"]), .me-name) { --fx-tl: var(--fx-txt); }
html.fx.fx:is(.fx-ta-shine, .fx-ta-spot) :is(.chan-head h1, .server-title > span:first-child, .log:not(.us-preview) .intro h2, .log:not(.us-preview) > .msg:nth-last-child(-n+12) .who, .me-name, .channel-list li:not(.cat):nth-child(-n+30) .name),
html.fx.fx.fx-mt:is(.fx-ta-shine, .fx-ta-spot) .log:not(.us-preview) > .msg:nth-last-child(-n+8) .text {
  background-image: var(--fx-hl), var(--fx-tl, linear-gradient(currentColor, currentColor)); background-size: 300% 100%, 200% 100%; background-repeat: no-repeat, repeat;
  background-position: var(--fx-sx) 0, var(--fx-fp) 0; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
html.fx:is(.fx-ta-shine, .fx-ta-spot) :is(.channel-list li:not(.cat) .name, .log:not(.us-preview) .who)::selection { -webkit-text-fill-color: var(--text); }
/* with the light: the gradient's flow moves to --fx-fp (a background-position animation would move the light too).
   Only these few carry the light layer at all: on every name of a long chat it costs frames even when still. */
html.fx-move.fx-ac-move.fx-txt:is(.fx-ta-shine, .fx-ta-spot) .log:not(.us-preview) .intro h2 { animation: hfx-fp var(--fx-ac-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
html.fx-move.fx-mt-move.fx-mt:is(.fx-ta-shine, .fx-ta-spot) .log:not(.us-preview) > .msg:nth-last-child(-n+8) .text { animation: var(--fx-ta), hfx-fp var(--fx-mt-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
html.fx-move.fx-mt:not(.fx-mt-move):is(.fx-ta-shine, .fx-ta-spot) .log:not(.us-preview) > .msg:nth-last-child(-n+8) .text { animation: var(--fx-ta); animation-play-state: var(--fx-play, running); }
html.fx-move:is(.fx-ta-shine, .fx-ta-spot) :is(.chan-head h1, .server-title > span:first-child, .me-name, .log:not(.us-preview) > .msg:nth-last-child(-n+12) .who, .channel-list li:not(.cat):nth-child(-n+30) .name) { animation: var(--fx-ta); animation-play-state: var(--fx-play, running); }
html.fx-move.fx-ac-move.fx-txt:is(.fx-ta-shine, .fx-ta-spot) :is(.chan-head h1, .server-title > span:first-child, .me-name, .log:not(.us-preview) > .msg:nth-last-child(-n+12) .who:not([style*="color"])) { animation: var(--fx-ta), hfx-fp var(--fx-ac-dur) steps(120) infinite; animation-play-state: var(--fx-play, running); }
@keyframes hfx-sweep { 0% { --fx-sx: 100%; } 22%, 100% { --fx-sx: 0%; } }
@keyframes hfx-glide { 0% { --fx-sx: 100%; } 25% { --fx-sx: 87%; } 50% { --fx-sx: 50%; } 75% { --fx-sx: 13%; } 100% { --fx-sx: 0%; } }
@keyframes hfx-fp { from { --fx-fp: 0%; } to { --fx-fp: 100%; } }
/* a four-pointed sparkle at the end of the text: after the light has swept over it (shine), or now and then (glint) */
html.fx-move:is(.fx-ta-shine, .fx-ta-glint) :is(.chan-head h1, .server-title > span:first-child, .me-name, .log:not(.us-preview) > .msg:nth-last-child(-n+12) .who, .channel-list li:not(.cat):nth-child(-n+30) .name)::after {
  content: ""; display: inline-block; width: .6em; height: .6em; margin-left: -.2em; vertical-align: .55em; pointer-events: none;
  background: var(--fx-spark); -webkit-mask: var(--fx-star) center / contain no-repeat; mask: var(--fx-star) center / contain no-repeat;
  opacity: 0; transform: scale(0); animation: hfx-spark var(--fx-tai) linear infinite; animation-play-state: var(--fx-play, running);
}
html.fx-move.fx-ta-glint :is(.chan-head h1, .server-title > span:first-child, .me-name, .log:not(.us-preview) > .msg:nth-last-child(-n+12) .who, .channel-list li:not(.cat):nth-child(-n+30) .name)::after { animation-name: hfx-glint; }
@keyframes hfx-spark { 0%, 18% { opacity: 0; transform: scale(0) rotate(0deg); } 23% { opacity: 1; transform: scale(1.15) rotate(45deg); } 31%, 100% { opacity: 0; transform: scale(0) rotate(110deg); } }
@keyframes hfx-glint { 0% { opacity: 0; transform: scale(0) rotate(0deg); } 5% { opacity: 1; transform: scale(1.1) rotate(40deg); } 12%, 100% { opacity: 0; transform: scale(0) rotate(100deg); } }
/* not all at once: rows and channels start at different points of the cycle (.fx.fx.fx: above the animation rules) */
html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .log:not(.us-preview) > .msg:nth-child(3n+1) .who, html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .log:not(.us-preview) > .msg:nth-child(3n+1) .who::after,
html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .channel-list li:nth-child(3n+1) .name, html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .channel-list li:nth-child(3n+1) .name::after { animation-delay: calc(var(--fx-tai, 8s) * -.37), 0s; }
html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .log:not(.us-preview) > .msg:nth-child(3n+2) .who, html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .log:not(.us-preview) > .msg:nth-child(3n+2) .who::after,
html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .channel-list li:nth-child(3n+2) .name, html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .channel-list li:nth-child(3n+2) .name::after { animation-delay: calc(var(--fx-tai, 8s) * -.71), 0s; }
html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .log:not(.us-preview) > .msg:nth-child(5n+3) .text { animation-delay: calc(var(--fx-tai, 8s) * -.53), 0s; }
html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .server-title > span:first-child, html.fx.fx.fx.fx-move:is(.fx-ta-shine, .fx-ta-spot, .fx-ta-glint) .server-title > span:first-child::after { animation-delay: calc(var(--fx-tai, 8s) * -.19), 0s; }
/* pop (fx.pop): the last letters typed light up in a copy of the text over the message box (app.js popTyped) */
.fx-popm { position: absolute; z-index: 2; margin: 0; overflow: hidden; pointer-events: none; white-space: pre-wrap; overflow-wrap: break-word; color: transparent; border-style: solid; border-color: transparent; background: none; user-select: none; }
.fx-popm .fx-popc { color: var(--fx-pop); text-shadow: 0 0 6px var(--fx-pop), 0 0 14px var(--fx-pop); animation: hfx-pop .9s ease-out forwards; animation-play-state: var(--fx-play, running); }
@keyframes hfx-pop { from { opacity: 1; } to { opacity: 0; } }
html:not(.fx-move) .fx-popm, html:not(.fx-pop) .fx-popm { display: none; }
/* a new message glows once (fx.popMsg): a layer behind the row fades out */
html.fx-move.fx-popmsg .log > .msg.fx-new { isolation: isolate; }
html.fx-move.fx-popmsg .log > .msg.fx-new::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, var(--fx-pop), transparent 75%); opacity: 0; animation: hfx-newmsg 1.8s ease-out var(--fx-new-d, 0s) 1; animation-play-state: var(--fx-play, running); }
@keyframes hfx-newmsg { from { opacity: .3; } to { opacity: 0; } }
/* scrolled back in a long chat (app.js jumpState): the newest rows, and the channel's intro at the very top, are
   far off screen; their names and text stop moving until they are near again */
html.fx-move .log.fx-away > .msg :is(.who, .text), html.fx-move .log.fx-away > .msg .who::after,
html.fx-move .log.fx-deep .intro h2 { animation-play-state: paused !important; }
/* the previews in Settings > Appearance: pause with the page (--fx-play), and while scrolled out of view
   (app.js usMini puts fx-off on them) */
.us-mini.fx-move, .us-mini.fx-move::before, .us-mini.fx-move::after, .us-mini.fx-move *, .us-mini.fx-move *::after { animation-play-state: var(--fx-play, running) !important; }
.us-mini.fx-move.fx-off, .us-mini.fx-move.fx-off::before, .us-mini.fx-move.fx-off::after, .us-mini.fx-move.fx-off *, .us-mini.fx-move.fx-off *::after { animation-play-state: paused !important; }
/* the channel list (fx.cards, sideClear, sideCard; theme.js sideStyle). Its muted text is pushed to 4.5:1 against
   what is behind it (--fx-side-muted). Cards: every channel row a small card in a wash of the accent, 6 px in from
   the list's sides and with room inside; with a mouse and motion it slides 8 px sideways on hover (right, or left:
   fx-cards-l), stopping 6 px short of the panel's edge, and at the end of the slide app.js (cardEnd) gives it a knock
   against that invisible stop (fx-smash) and a few chips off that side (.fx-chunk, made then and removed after
   0.6 s; no knock and no chips with Lighter effects). The slide stays inside the list's padding, so the list never
   scrolls sideways. Only translate, scale, transform and opacity move.
   The theme's fine-tuning (fx.cl, theme.js sideStyle) comes as custom properties that are only set when not the
   default; every var() below falls back to the default: --fx-card-r / -py / -gap (corners, room, space between),
   --fx-slide / --fx-slide-t (distance, time), --fx-card-m (more room on the side it slides to), --fx-knock (the
   squash: 0 none, 2 twice). */
html:is(.fx-cards, .fx-clear, .fx-scard) .side { --muted: var(--fx-side-muted); }
html.fx-cards .channel-list li[data-channel] { background: var(--fx-card); border: 1px solid var(--fx-card-line); border-radius: var(--fx-card-r, 9px); padding: var(--fx-card-py, 6px) 8px var(--fx-card-py, 6px) 10px;
  margin: 0 var(--fx-card-m, 6px) var(--fx-card-gap, 4px) 6px; gap: 7px; transform-origin: 100% 50%; }
html.fx-cards-l .channel-list li[data-channel] { transform-origin: 0 50%; margin: 0 6px var(--fx-card-gap, 4px) var(--fx-card-m, 6px); }
html.fx-cards .channel-list li[data-channel]:hover { background: var(--fx-card-h); }
html.fx-cards .channel-list li[data-channel].active { background: var(--fx-card-a); border-color: var(--fx-card-line-a); }
@media (hover: hover) {
  html.fx-move.fx-cards .channel-list li[data-channel] { transition: translate var(--fx-slide-t, .2s) cubic-bezier(.2, .8, .3, 1), background-color .15s; }
  html.fx-move.fx-cards .channel-list:not(.drag-on) li[data-channel]:hover { translate: var(--fx-slide, 8px) 0; }
  html.fx-move.fx-cards-l .channel-list:not(.drag-on) li[data-channel]:hover { translate: calc(-1 * var(--fx-slide, 8px)) 0; }
  html.fx-move.fx-cards .channel-list li[data-channel].fx-smash { animation: hfx-smash .22s ease-out 1; }
}
@keyframes hfx-smash { 0% { scale: 1; } 30% { scale: calc(1 - .035 * var(--fx-knock, 1)) calc(1 + .05 * var(--fx-knock, 1)); }
  65% { scale: calc(1 + .012 * var(--fx-knock, 1)) calc(1 - .015 * var(--fx-knock, 1)); } 100% { scale: 1; } }
.fx-chunk {
  position: fixed; left: 0; top: 0; z-index: 25; width: var(--s); height: var(--s); border-radius: 1px; background: var(--fx-chunk);
  pointer-events: none; opacity: 0; animation: hfx-chunk .56s cubic-bezier(.15, .7, .35, 1) 1 forwards;
}
@keyframes hfx-chunk {
  from { transform: translate(var(--x0), var(--y0)) rotate(0deg); opacity: .9; }
  to { transform: translate(var(--x1), var(--y1)) rotate(var(--r)); opacity: 0; }
}
/* see-through: the channel list's own background goes (the server rail and your own panel at the bottom keep
   theirs). Glass card: the channel list floats with a margin, rounded, see-through (blurred only over a pattern
   or a sharp edge, as the other glass; a thicker tint with Lighter effects), and with a mouse and motion app.js
   leans it toward the pointer (--fx-tilt set inline, used only here, eased; flat again when the pointer leaves, so
   nothing is blurry at rest, and a window made narrow meanwhile keeps its drawer's own transform). Your own background picture behind the whole app keeps its own panel opacity. Narrow
   windows: the channel list is a drawer and stays as it is. Fine-tuning (set only when not the default):
   --fx-clear-bg (what see-through leaves of the fill), --fx-scard-r / -m (corners, margin from the window's edges),
   --fx-scard-rim / -rim2 (the rim highlight), fx-scard-nb (no blur at all). */
@media (min-width: 681px) {
  html.fx-scard .side { margin: var(--fx-scard-m, 10px) 4px var(--fx-scard-m, 10px) var(--fx-scard-m, 10px); border-radius: var(--fx-scard-r, 14px); border: 1px solid var(--fx-scard-line); box-shadow: var(--menu-shadow); }
  html.fx-scard .side .server-title { border-radius: max(0px, var(--fx-scard-r, 14px) - 1px) max(0px, var(--fx-scard-r, 14px) - 1px) 0 0; }
  html.fx-scard .side .me { border-radius: 0 0 max(0px, var(--fx-scard-r, 14px) - 1px) max(0px, var(--fx-scard-r, 14px) - 1px); }
  html.fx-scard:not(.wall-app) .side { background: var(--fx-scard-bg); }
  html.fx-scard.fx-detail:not(.wall-app, .fx-lite) .side { -webkit-backdrop-filter: blur(var(--fx-scard-blur)); backdrop-filter: blur(var(--fx-scard-blur)); }
  html.fx-scard.fx-detail.fx-lite:not(.wall-app) .side { background-image: linear-gradient(color-mix(in srgb, var(--side) 50%, transparent), color-mix(in srgb, var(--side) 50%, transparent)); }
  html.fx-clear:not(.wall-app) .side { background: var(--fx-clear-bg, transparent); }
  html.fx.fx-clear:not(.wall-app, .fx-scard) .side { -webkit-backdrop-filter: none; backdrop-filter: none; } /* (also over see-through glass panels) */
  html.fx-clear.fx-scard:not(.wall-app) .side { background: var(--fx-clear-bg, transparent); }
  /* the glass card, Apple-style glass (Human Interface Guidelines, Materials / Liquid Glass): a hairline highlight on
     the rim, and the blur lifts the colours behind it a little so the backdrop stays lively under the glass */
  html.fx-scard .side { box-shadow: inset 0 1px 0 var(--fx-scard-rim, rgba(255, 255, 255, .14)), inset 0 0 0 1px var(--fx-scard-rim2, rgba(255, 255, 255, .04)), var(--menu-shadow); }
  html.fx-scard.fx-detail:not(.wall-app, .fx-lite) .side { -webkit-backdrop-filter: blur(var(--fx-scard-blur)) saturate(1.35); backdrop-filter: blur(var(--fx-scard-blur)) saturate(1.35); }
  html.fx-scard.fx-scard-nb:not(.wall-app) .side { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* the system asks for less transparency: the glass card and the see-through list become solid panels (the shape
   stays); more contrast: a clearly visible edge and no lean */
@media (min-width: 681px) and (prefers-reduced-transparency: reduce) {
  html:is(.fx-scard, .fx-clear):not(.wall-app) .side { background: var(--side) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (min-width: 681px) and (prefers-contrast: more) {
  html.fx-scard .side { border-color: color-mix(in srgb, var(--text) 45%, transparent); }
  html.fx-move.fx-scard .side { transform: none !important; }
}
@media (min-width: 681px) and (hover: hover) {
  html.fx-move.fx-scard .side { transform: var(--fx-tilt, none); transition: transform .22s cubic-bezier(.2, .7, .3, 1); }
  html.m-ready.fx-move.fx-scard .side { transition: opacity var(--m-in-big) var(--m-ease), translate var(--m-in-big) var(--m-ease), transform .22s cubic-bezier(.2, .7, .3, 1); }
}
/* the member list (fx.memCards, memClear, memCard; theme.js sideStyle with LISTS.mem, memberfx): the same three effects
   as the channel list, with properties of their own (--fxm-…, otherwise named as above) and the same fallbacks. The
   cards slide LEFT by default (the panel is on the right; fxm-cards-r: right). See-through and the glass card only
   on wide windows (1001 px and more: below, the member list is a drawer over the chat and stays solid and flat).
   The lean is the same --fx-tilt, set inline on #members by app.js. The thread pane is chat (content), not a list:
   it keeps its own look. */
html:is(.fxm-cards, .fxm-clear, .fxm-scard) .members { --muted: var(--fxm-side-muted); }
html.fxm-cards .member-list li[data-member] { background: var(--fxm-card); border: 1px solid var(--fxm-card-line); border-radius: var(--fxm-card-r, 9px);
  padding: var(--fxm-card-py, 6px) 8px var(--fxm-card-py, 6px) 10px; margin: 0 6px var(--fxm-card-gap, 4px) var(--fxm-card-m, 6px); transform-origin: 0 50%; }
html.fxm-cards-r .member-list li[data-member] { transform-origin: 100% 50%; margin: 0 var(--fxm-card-m, 6px) var(--fxm-card-gap, 4px) 6px; }
html.fxm-cards .member-list li[data-member]:hover { background: var(--fxm-card-h); }
@media (hover: hover) {
  html.fx-move.fxm-cards .member-list li[data-member] { transition: translate var(--fxm-slide-t, .2s) cubic-bezier(.2, .8, .3, 1), background-color .15s; }
  html.fx-move.fxm-cards .member-list li[data-member]:hover { translate: calc(-1 * var(--fxm-slide, 8px)) 0; }
  html.fx-move.fxm-cards-r .member-list li[data-member]:hover { translate: var(--fxm-slide, 8px) 0; }
  html.fx-move.fxm-cards .member-list li[data-member].fx-smash { animation: hfx-smash-m .22s ease-out 1; }
}
@keyframes hfx-smash-m { 0% { scale: 1; } 30% { scale: calc(1 - .035 * var(--fxm-knock, 1)) calc(1 + .05 * var(--fxm-knock, 1)); }
  65% { scale: calc(1 + .012 * var(--fxm-knock, 1)) calc(1 - .015 * var(--fxm-knock, 1)); } 100% { scale: 1; } }
.fx-chunk.fxm { background: var(--fxm-chunk); }
@media (min-width: 1001px) {
  html.fxm-scard .members { margin: var(--fxm-scard-m, 10px) var(--fxm-scard-m, 10px) var(--fxm-scard-m, 10px) 4px; border-radius: var(--fxm-scard-r, 14px); border: 1px solid var(--fxm-scard-line);
    box-shadow: inset 0 1px 0 var(--fxm-scard-rim, rgba(255, 255, 255, .14)), inset 0 0 0 1px var(--fxm-scard-rim2, rgba(255, 255, 255, .04)), var(--menu-shadow); }
  html.fxm-scard:not(.wall-app) .members { background: var(--fxm-scard-bg); }
  html.fxm-scard.fx-detail:not(.wall-app, .fx-lite) .members { -webkit-backdrop-filter: blur(var(--fxm-scard-blur)) saturate(1.35); backdrop-filter: blur(var(--fxm-scard-blur)) saturate(1.35); }
  html.fxm-scard.fx-detail.fx-lite:not(.wall-app) .members { background-image: linear-gradient(color-mix(in srgb, var(--side) 50%, transparent), color-mix(in srgb, var(--side) 50%, transparent)); }
  html.fxm-clear:not(.wall-app) .members { background: var(--fxm-clear-bg, transparent); }
  html.fx.fxm-clear:not(.wall-app, .fxm-scard) .members { -webkit-backdrop-filter: none; backdrop-filter: none; }
  html.fxm-clear.fxm-scard:not(.wall-app) .members { background: var(--fxm-clear-bg, transparent); }
  html.fxm-scard.fxm-scard-nb:not(.wall-app) .members { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (min-width: 1001px) and (prefers-reduced-transparency: reduce) {
  html:is(.fxm-scard, .fxm-clear):not(.wall-app) .members { background: var(--side) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (min-width: 1001px) and (prefers-contrast: more) {
  html.fxm-scard .members { border-color: color-mix(in srgb, var(--text) 45%, transparent); }
  html.fx-move.fxm-scard .members { transform: none !important; }
}
@media (min-width: 1001px) and (hover: hover) {
  html.fx-move.fxm-scard .members { transform: var(--fx-tilt, none); transition: transform .22s cubic-bezier(.2, .7, .3, 1); }
  html.m-ready.fx-move.fxm-scard .members { transition: opacity var(--m-in-big) var(--m-ease), translate var(--m-in-big) var(--m-ease), transform .22s cubic-bezier(.2, .7, .3, 1); }
}
/* belt and braces: reduced motion stops every effect animation, whatever theme.js decided */
html.reduce-motion.fx::after,
  html.reduce-motion.fx body::before,
  html.reduce-motion.fx :is(.rail, .input-box, .chan-head h1, .server-title > span, .log .intro h2),
  html.reduce-motion.fx .channel-list li::after,
  html.reduce-motion.fx .avatar::after,
  html.reduce-motion.fx :is(.who, .me-name, .channel-list .name, .log .text, .fx-popc, .chan-head h1, .server-title > span, .log .intro h2)::after,
  html.reduce-motion.fx :is(.who, .me-name, .channel-list .name, .log .text, .fx-popc),
  html.reduce-motion.fx .msg::before,
  html.reduce-motion.fx .channel-list li.fx-smash,
  html.reduce-motion.fx .member-list li.fx-smash,
  html.reduce-motion .fx-chunk,
  html.reduce-motion .us-mini::before,
  html.reduce-motion .us-mini *,
  html.reduce-motion .us-mini *::after { animation-name: none !important; }
@media (prefers-reduced-motion: reduce) {
  html:not(.full-motion).fx::after,
  html:not(.full-motion).fx body::before,
  html:not(.full-motion).fx :is(.rail, .input-box, .chan-head h1, .server-title > span, .log .intro h2),
  html:not(.full-motion).fx .channel-list li::after,
  html:not(.full-motion).fx .avatar::after,
  html:not(.full-motion).fx :is(.who, .me-name, .channel-list .name, .log .text, .fx-popc, .chan-head h1, .server-title > span, .log .intro h2)::after,
  html:not(.full-motion).fx :is(.who, .me-name, .channel-list .name, .log .text, .fx-popc),
  html:not(.full-motion).fx .msg::before,
  html:not(.full-motion).fx .channel-list li.fx-smash,
  html:not(.full-motion).fx .member-list li.fx-smash,
  html:not(.full-motion) .fx-chunk,
  html:not(.full-motion) .us-mini::before,
  html:not(.full-motion) .us-mini *,
  html:not(.full-motion) .us-mini *::after { animation-name: none !important; }
}
/* Windows high contrast: none of it */
@media (forced-colors: active) {
  html.fx * { text-shadow: none !important; filter: none !important; -webkit-text-fill-color: currentColor !important; }
  html.fx body::before, html.fx body::after, html.fx::after, html.fx .fx-popm, html.fx .msg.fx-new::before, .fx-chunk { display: none !important; }
  html.fx :is(.side, .members) { transform: none !important; }
  html.fx :is(.who, .me-name, .channel-list .name, .chan-head h1, .server-title > span, .log .intro h2)::after { display: none !important; }
}

/* the same effects in Settings > Appearance: the small Hive (.us-mini) and the theme cards (.us-tsw).
   .us-mini.us-mini first undoes what the page's own effects would add inside the preview. */
.us-mini.us-mini :is(.who, .text, .us-mini-head, .us-mini-side span, .us-mini-side b) { text-shadow: none; filter: none; -webkit-text-fill-color: currentColor; background-image: none; }
.us-mini.fx-bgg::before { content: ""; position: absolute; z-index: -2; left: 50%; top: 50%; width: 170%; aspect-ratio: 1; margin-left: -85%; translate: 0 -50%; background: var(--fx-bg); pointer-events: none; }
.us-mini.fx-bgl::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fx-veil); pointer-events: none; }
.us-mini.fx-sky-pollen::after { background: var(--fx-sky2), var(--fx-veil); }
.us-mini.fx-move.fx-bg-drift::before { animation: hfx-drift var(--fx-bg-dur) linear infinite alternate; }
.us-mini.fx-move.fx-bg-rotate::before { animation: hfx-spin var(--fx-bg-dur) steps(720) infinite; }
.us-mini.fx-see .us-mini-rail { background: var(--fx-see-rail); }
.us-mini.fx-see .us-mini-side { background: var(--fx-see-side); }
/* glass as on the page: blurred only over a pattern, not on a gradient rail, a thicker tint on a weak device */
html:not(.fx-lite) .us-mini.fx-glass.fx-detail .us-mini-side, html:not(.fx-lite) .us-mini.fx-glass.fx-detail:not(.fx-rail) .us-mini-rail { -webkit-backdrop-filter: blur(calc(var(--fx-glass) / 2)); backdrop-filter: blur(calc(var(--fx-glass) / 2)); }
html.fx-lite .us-mini.fx-glass.fx-detail .us-mini-side { background-image: linear-gradient(color-mix(in srgb, var(--side) 50%, transparent), color-mix(in srgb, var(--side) 50%, transparent)); }
html.fx-lite .us-mini.fx-glass.fx-detail:not(.fx-rail) .us-mini-rail { background-image: linear-gradient(color-mix(in srgb, var(--rail) 50%, transparent), color-mix(in srgb, var(--rail) 50%, transparent)); }
.us-mini.fx-rail .us-mini-rail { background: var(--fx-rail); background-size: 100% 100%, 100% 200%; }
/* the channel list's options in the preview: cards, see-through, a glass card (flat: the preview has no mouse) */
.us-mini:is(.fx-cards, .fx-clear, .fx-scard) .us-mini-side { --muted: var(--fx-side-muted); }
.us-mini.fx-cards .us-mini-side span { background: var(--fx-card); border: 1px solid var(--fx-card-line); border-radius: calc(var(--fx-card-r, 9px) * .66); padding: calc(var(--fx-card-py, 6px) / 3) 6px; margin: 0 3px calc(var(--fx-card-gap, 4px) / 2); }
.us-mini.fx-cards .us-mini-side span.on { background: var(--fx-card-a); border-color: var(--fx-card-line-a); }
.us-mini.fx-scard .us-mini-side { margin: calc(var(--fx-scard-m, 10px) * .6) 2px calc(var(--fx-scard-m, 10px) * .6) calc(var(--fx-scard-m, 10px) * .6); border-radius: calc(var(--fx-scard-r, 14px) * .66); border: 1px solid var(--fx-scard-line);
  background: var(--fx-scard-bg); box-shadow: inset 0 1px 0 var(--fx-scard-rim, rgba(255, 255, 255, .14)), var(--menu-shadow); }
html:not(.fx-lite) .us-mini.fx-scard.fx-detail .us-mini-side { -webkit-backdrop-filter: blur(calc(var(--fx-scard-blur) / 2)); backdrop-filter: blur(calc(var(--fx-scard-blur) / 2)); }
html.fx-lite .us-mini.fx-scard.fx-detail .us-mini-side { background-image: linear-gradient(color-mix(in srgb, var(--side) 50%, transparent), color-mix(in srgb, var(--side) 50%, transparent)); }
.us-mini.us-mini.fx-clear .us-mini-side { background: var(--fx-clear-bg, transparent); }
html .us-mini.us-mini.fx-scard.fx-scard-nb .us-mini-side { -webkit-backdrop-filter: none; backdrop-filter: none; }
/* the theme editor's Channel list: each switch's options in a part of their own, a little indented (app.js usFxBlock) */
.us-fx-sec .us-fx-sec { margin-inline-start: 12px; }
/* option groups inside an option group are narrow: a slider goes under its label, full width, instead of over it */
.us-fx-sec .us-fx-sec .us-ted-row:has(> .us-range-wrap) { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
.us-fx-sec .us-fx-sec .us-ted-row:has(> .us-range-wrap) > .us-range-wrap { grid-column: 1; grid-row: 2; justify-self: stretch; width: 100%; }
.us-fx-sec .us-fx-sec .us-ted-row:has(> .us-range-wrap) > .us-range-wrap .us-range { flex: 1; min-width: 0; width: auto; }
.us-mini.fx-move.fx-rail-move .us-mini-rail { animation: hfx-flow-y var(--fx-rail-dur) steps(240) infinite; }
.us-mini.us-mini.fx-glow-names .who { text-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
.us-mini.us-mini.fx-glow-text .text { text-shadow: 0 0 var(--fx-glow-rt) var(--fx-glow-t); }
.us-mini.us-mini.fx-glow-chans .us-mini-side span { text-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
.us-mini.us-mini.fx-glow-heads :is(.us-mini-head, .us-mini-side b) { text-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
.us-mini.us-mini.fx-txt :is(.us-mini-head, .us-mini-side b, .who) { background-image: var(--fx-txt); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.us-mini.us-mini.fx-txt.fx-glow-heads :is(.us-mini-head, .us-mini-side b) { text-shadow: none; filter: drop-shadow(0 0 calc(var(--fx-glow-r) / 2) var(--fx-glow)); }
.us-mini.us-mini.fx-txt.fx-glow-names .who { text-shadow: none; filter: drop-shadow(0 0 calc(var(--fx-glow-r) / 2) var(--fx-glow)); }
.us-mini.us-mini.fx-move.fx-ac-move.fx-txt .us-mini-head { animation: hfx-flow-x var(--fx-ac-dur) steps(120) infinite; }
.us-mini.fx-ac :is(.us-mini-rail i.on, .us-mini-send) { background-image: var(--fx-ac); }
.us-mini.fx-box .us-mini-cmp { border-color: transparent; background: linear-gradient(var(--box, var(--panel)), var(--box, var(--panel))) padding-box, var(--fx-boxg) border-box; background-size: 100% 100%, 200% 100%; }
.us-mini.fx-move.fx-ac-move.fx-box .us-mini-cmp { animation: hfx-flow-box var(--fx-ac-dur) steps(120) infinite; }
.us-mini.us-mini.fx-shimmer .us-mini-side span.on { position: relative; overflow: hidden; isolation: isolate; }
.us-mini.us-mini.fx-shimmer .us-mini-side span.on::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, transparent 25%, var(--fx-shine) 50%, transparent 75%); transform: translateX(-120%); }
.us-mini.us-mini.fx-shimmer:not(.fx-move) .us-mini-side span.on::after { transform: none; background: linear-gradient(90deg, var(--fx-shine), transparent 70%); }
.us-mini.us-mini.fx-move.fx-shimmer .us-mini-side span.on::after { animation: hfx-shine calc(5s * var(--fx-k)) ease-in-out infinite; }
.us-tsw.fx-bgl { background: var(--fx-veil); }
.us-tsw.fx-bgg { background: var(--fx-veil), var(--fx-bg); }
.us-tsw.fx-see .us-tsw-side { background: var(--fx-see-side); }
.us-tsw.fx-ac .acc { background-image: var(--fx-ac); }
.us-tsw.fx-txt .l1 { background-image: var(--fx-txt); }
.us-tsw.fx-glow-heads .l1, .us-tsw.fx-glow-names .l1 { box-shadow: 0 0 var(--fx-glow-r) var(--fx-glow); }
/* a theme with the channel list as cards (fx-cards; the card themes, litecards): two small cards in the swatch's
   sidebar, the first one open (still: nothing on a swatch moves) */
.us-tsw.fx-cards .us-tsw-side::before, .us-tsw.fx-cards .us-tsw-side::after { content: ""; display: block; height: 9px; margin: 0 4px 3px;
  border-radius: 3px; background: var(--fx-card); border: 1px solid var(--fx-card-line); }
.us-tsw.fx-cards .us-tsw-side::before { margin-top: 9px; background: var(--fx-card-a); border-color: var(--fx-card-line-a); }
/* side panels as floating cards (fx-scard / fxm-scard): the swatch's sidebar, and a member panel on its right, float with a
   small margin and rounded corners (round 2) */
.us-tsw.fx-scard .us-tsw-side { margin: 4px 0 4px 4px; border: 1px solid var(--fx-scard-line); border-radius: 5px; background: var(--fx-scard-bg); }
.us-tsw.fxm-scard::after { content: ""; width: 14%; margin: 4px 4px 4px 0; border: 1px solid var(--fxm-scard-line); border-radius: 5px; background: var(--fxm-scard-bg); }
.us-tcard .us-fx-badge { position: absolute; top: 5px; right: 5px; z-index: 1; font-size: 10px; font-weight: 700; line-height: 16px; padding: 0 6px; border-radius: 8px; background: var(--panel); color: var(--text); border: 1px solid var(--line); pointer-events: none; white-space: nowrap; }
/* the theme editor's Effects block (usFxBlock) and gradient editor (usGradEd). The parts' group look is above
   (.us-ted-part); here: tick-box groups as aligned columns (toggles.md: checkboxes line up on their leading edge),
   footnotes, the folded sections' title rows */
.us-fx-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 6px var(--sp-4); }
.us-fx-checks-l { grid-column: 1 / -1; font-size: var(--fs-cap); font-weight: 600; color: var(--muted); margin-bottom: -2px; }
.us-dlg .us-fx-check { margin: 0; font-size: var(--fs-row); align-items: flex-start; gap: 8px; line-height: 1.35; }
.us-dlg .us-fx-check input[type="checkbox"] { margin: 1px 0 0; }
.us-dlg .us-fx-check .us-ted-why { margin-top: 1px; }
.us-dlg .us-fx-note { margin: 0; font-size: var(--fs-cap); line-height: 1.45; color: var(--muted); max-width: 68ch; }
.us-grad { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.us-grad-pv { height: 40px; border-radius: 8px; border: 1px solid var(--line); }
.us-grad-stops { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.us-grad-stop { display: inline-flex; align-items: center; }
.us-grad-stop .us-grad-del { padding: 2px 5px; font-size: 12px; }
.us-dlg button.us-grad-add { padding: 4px 10px; font-size: 13px; }
/* the newer effects in the previews (still patterns; text and message text as on the page) */
.us-mini, .us-tsw, .us-sky-tile { --fx-sky-pv: initial; --fx-sky2: initial; --fx-tl: initial; }
.us-mini.fx-sky-x::after { background: var(--fx-sky-pv, var(--fx-sky2, none)), var(--fx-veil); }
.us-mini.us-mini.fx-move.fx-ac-move.fx-txt :is(.us-mini-side b, .who) { animation: hfx-flow-x var(--fx-ac-dur) steps(120) infinite; }
.us-mini.us-mini.fx-mt .text { background-image: var(--fx-mt); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.us-mini.us-mini.fx-mt.fx-glow-text .text { text-shadow: none; filter: drop-shadow(0 0 var(--fx-glow-rt) var(--fx-glow-t)); }
.us-mini.us-mini.fx-mt .text :is(a, code, .spoiler, .emo) { -webkit-text-fill-color: currentColor; }
.us-mini.us-mini.fx-move.fx-mt-move .text { animation: hfx-flow-x var(--fx-mt-dur) steps(120) infinite; }
.us-mini.fx-txt :is(.us-mini-head, .us-mini-side b, .who) { --fx-tl: var(--fx-txt); }
.us-mini.fx-mt .text { --fx-tl: var(--fx-mt); }
.us-mini.us-mini.us-mini:is(.fx-ta-shine, .fx-ta-spot) :is(.us-mini-head, .us-mini-side b, .who, .us-mini-side span) {
  background-image: var(--fx-hl), var(--fx-tl, linear-gradient(currentColor, currentColor)); background-size: 300% 100%, 200% 100%; background-repeat: no-repeat, repeat;
  background-position: var(--fx-sx) 0, var(--fx-fp) 0; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.us-mini.us-mini.us-mini.fx-move:is(.fx-ta-shine, .fx-ta-spot) :is(.us-mini-head, .us-mini-side b, .who, .us-mini-side span) { animation: var(--fx-ta); }
.us-mini.us-mini.us-mini.fx-move.fx-ac-move.fx-txt:is(.fx-ta-shine, .fx-ta-spot) :is(.us-mini-head, .us-mini-side b, .who) { animation: var(--fx-ta), hfx-fp var(--fx-ac-dur) steps(120) infinite; }
.us-mini.us-mini.fx-move:is(.fx-ta-shine, .fx-ta-glint) :is(.us-mini-head, .who)::after {
  content: ""; display: inline-block; width: .6em; height: .6em; margin-left: .1em; vertical-align: .55em;
  background: var(--fx-spark); -webkit-mask: var(--fx-star) center / contain no-repeat; mask: var(--fx-star) center / contain no-repeat;
  opacity: 0; transform: scale(0); animation: hfx-spark var(--fx-tai) linear infinite;
}
.us-mini.us-mini.fx-move.fx-ta-glint :is(.us-mini-head, .who)::after { animation-name: hfx-glint; }
.us-tsw.fx-sky-x { background: var(--fx-sky-pv, var(--fx-sky2, none)), var(--fx-veil); }
.us-tsw.fx-sky-x.fx-bgg { background: var(--fx-sky-pv, var(--fx-sky2, none)), var(--fx-veil), var(--fx-bg); }
.us-tsw.fx-mt .l2 { background: var(--fx-mt); }
/* the gradient editor: a bar with a handle per colour, the colours (grip, picker, position), tools, presets */
.us-grad-bar { position: relative; height: 30px; margin: 0 9px 16px; }
.us-grad-bar .us-grad-pv { height: 100%; border-radius: 6px; }
.us-grad-hs { position: absolute; inset: 0; pointer-events: none; }
.us-dlg button.us-grad-h { position: absolute; top: calc(100% - 4px); width: 18px; height: 18px; margin: 0 0 0 -9px; padding: 0; border-radius: 50%; pointer-events: auto; cursor: ew-resize; touch-action: none;
  background: var(--c); border: 2px solid var(--text); box-shadow: 0 0 0 2px var(--bg); }
.us-dlg button.us-grad-h::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 2px; height: 28px; margin-left: -1px; background: var(--text); box-shadow: 0 0 0 1px var(--bg); pointer-events: none; }
.us-dlg button.us-grad-h:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.us-grad-stop { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.us-grad-stop.sel { border-color: var(--muted); }
.us-grad-stop.drop { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.us-dlg button.us-grad-grip { padding: 2px 3px; font-size: 14px; cursor: grab; color: var(--muted); }
.us-grad-at { display: inline-flex; align-items: center; }
.us-dlg input.us-grad-pos { width: 48px; margin: 0 0 0 2px; padding: 4px 4px; font-size: 12px; text-align: right; background: var(--panel); }
.us-grad-pct { font-size: 12px; color: var(--muted); margin-left: 1px; }
.us-grad-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.us-dlg button.us-grad-btn { padding: 4px 10px; font-size: 13px; }
.us-grad-pre { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.us-grad-pre-l { font-size: 13px; font-weight: 600; }
.us-grad-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.us-dlg button.us-grad-chip { width: 36px; height: 22px; padding: 0; border-radius: 6px; border: 1px solid var(--line); }
.us-dlg button.us-grad-chip:hover { box-shadow: 0 0 0 2px var(--muted); }
/* folding sections (usFxSec): a row with the title on the left, what is set in it and a chevron on the right */
.us-fx-sec { padding: 0; }
.us-fx-sec > summary, .us-ted-rd > summary { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; list-style: none; padding: var(--sp-3) var(--sp-4); min-height: 48px; border-radius: inherit; }
.us-fx-sec > summary::-webkit-details-marker, .us-ted-rd > summary::-webkit-details-marker { display: none; }
.us-fx-sec > summary:hover { background: var(--hover); }
.us-fx-t { flex: 1 0 auto; max-width: 100%; font-size: var(--fs-row); font-weight: 600; color: var(--text); } /* (the title keeps its width; the summary gives way with "…") */
.us-fx-sum { flex: 0 1 auto; min-width: 0; margin-left: 12px; font-size: var(--fs-cap); color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-fx-sec > summary::after, .us-ted-rd > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 3px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--m-quick, .11s) ease; }
.us-fx-sec[open] > summary::after, .us-ted-rd[open] > summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.us-fx-sec > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.us-fx-sec[open] > summary { border-end-start-radius: 0; border-end-end-radius: 0; }
.us-fx-sec[open] { display: flex; flex-direction: column; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-4); }
.us-fx-sec[open] > summary { margin: 0 calc(-1 * var(--sp-4)); }
@media (forced-colors: active) { .us-fx-sec > summary::after, .us-ted-rd > summary::after { border-color: CanvasText; } }
/* backdrop pattern tiles */
.us-sky-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.us-sky-card { position: relative; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); min-width: 0; }
.us-sky-card:hover { border-color: var(--muted); }
.us-sky-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.us-sky-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.us-sky-card label { display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.us-sky-tile { display: block; height: 60px; background: var(--bg); }
.us-sky-tile.fx-bgl { background: var(--fx-sky-pv, var(--fx-sky2, none)), var(--fx-veil); }
.us-sky-name { padding: 3px 6px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the editor's layout: settings | divider | preview; the preview panel (resize, float); the save bar. While the
   editor is open, Appearance may use more of a wide screen than the other settings pages. */
.us-col:has(.us-ted:not([hidden])) { flex-basis: 1180px; }
/* (redesign) while it is open, the settings nav keeps just its own width, so the editor and its preview get the rest */
@media (min-width: 681px) {
  .us-wrap:has(.us-ted:not([hidden])) { grid-template-columns: 234px minmax(0, 1fr); }
  .us-col:has(.us-ted:not([hidden])) { padding-inline: 28px; }
}
.us-ted-grid { grid-template-columns: minmax(0, var(--ted-l, 1fr)) 12px minmax(0, var(--ted-r, 1.25fr)); gap: 0 4px; }
.us-ted-main { min-width: 0; }
.us-ted-div { position: relative; cursor: col-resize; touch-action: none; border-radius: 6px; }
.us-ted-div::before { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px; border-radius: 1px; background: var(--line); }
.us-ted-div:hover::before, .us-ted-div.on::before, .us-ted-div:focus-visible::before { background: var(--accent); }
.us-ted-div:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.us-ted-pvw { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); padding: 0 var(--sp-3) var(--sp-4); margin: 0 0 12px; }
.us-ted-pv .us-mini { height: var(--ted-pv-h, 210px); }
/* its title bar: the name (a drag handle while it floats), the size buttons as one segmented pair, Float / Dock */
.us-ted-pvh { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; }
.us-ted-pvt { flex: 1; min-width: 0; font-size: var(--fs-row); font-weight: 600; color: var(--text); padding: 2px 4px; border-radius: 4px; }
.us-ted-pvt:focus-visible { outline: 2px solid var(--accent); }
.us-ted-pvw.float .us-ted-pvt { cursor: move; touch-action: none; user-select: none; }
.us-ted-pvz { display: inline-flex; }
.us-dlg button.us-ted-pvb { min-height: 28px; padding: 2px 10px; font-size: var(--fs-help); min-width: 30px; border-color: var(--ctl-line); }
.us-ted-pvz button.us-ted-pvb:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.us-ted-pvz button.us-ted-pvb:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; margin-left: -1px; }
.us-dlg button.us-ted-pvb[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.us-dlg button.us-ted-pvr { position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; padding: 0; border: 0; border-radius: 2px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 45%, var(--muted) 45% 55%, transparent 55% 70%, var(--muted) 70% 80%, transparent 80%); }
.us-dlg button.us-ted-pvr:focus-visible { outline: 2px solid var(--accent); }
.us-ted-pvw.float { position: fixed; z-index: 60; margin: 0; box-shadow: var(--menu-shadow); }
/* (redesign) while the preview floats, the settings take the whole width (its column used to stay, empty) */
.us-ted-grid.pv-float { grid-template-columns: minmax(0, 1fr); }
.us-ted-grid.pv-float > .us-ted-div { display: none; }
/* the readability list inside the preview window: it moves, floats and sticks with the preview */
.us-ted-rd { margin-top: var(--sp-2); }
.us-ted-rd > summary { padding: var(--sp-2) 2px; min-height: 0; }
.us-ted-rd > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.us-ted-rd .us-fx-sum.warn { color: var(--text); }
.us-ted-rd .us-fx-sum.bad { color: var(--bad); font-weight: 600; }
.us-ted-rd .us-ted-checks { margin-top: 0; max-height: min(32vh, 280px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
@media (min-width: 861px) { .us-ted-side .us-ted-pvw:not(.float) { position: sticky; top: 12px; z-index: 2; } }
@media (max-width: 860px) {
  .us-ted-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .us-ted-div, .us-ted-pvb[aria-pressed] { display: none; }
  /* (redesign) one column: the preview comes first and stays in view (shorter) while the settings scroll under it,
     so a change can be seen where it is made; the readability list keeps to a few lines */
  .us-ted-side { order: -1; position: sticky; top: 0; z-index: 4; background: var(--bg); padding-bottom: var(--sp-2); }
  .us-ted-side .us-ted-pvw { margin: 0; }
  .us-ted-pv .us-mini { height: min(var(--ted-pv-h, 210px), 22vh); }
  .us-ted-rd .us-ted-checks { max-height: 92px; }
}
@media (max-width: 680px) { .us-ted-side { top: 57px; } } /* under the page's own sticky title bar */
@media (max-height: 560px) { .us-ted-side { position: static; } }
/* the editor's save bar: the same look as every other save bar (.save-bar): the state on the left, Save first */
.us-ted-bar { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 6px -16px -16px; padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; box-shadow: 0 -10px 18px -12px rgba(0,0,0,.45); }
.us-ted-bar .us-btns { margin: 0; }
.us-ted-dirty { font-size: var(--fs-help); color: var(--muted); }
.us-ted-bar.dirty { border-top-color: var(--accent); }
.us-ted-bar.dirty .us-ted-dirty { color: var(--text); font-weight: 600; }
.us-ted-bar.dirty .us-ted-dirty::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
@media (max-width: 480px) {
  .us-ted-bar { gap: 4px 8px; padding: 8px 12px; }
  .us-ted-bar .us-btns { gap: 6px; }
  .us-dlg .us-ted-bar .us-btns button { padding: 6px 10px; font-size: 13px; }
}

/* ===== message style: bubbles and message text (theme.js "message style"; app.js appendMessage, usMsBlock) =====
   Classes and custom properties on <html> (the page) or on .us-mini (a preview), built in theme.js from
   validated numbers and colours: mb (bubbles), mb-r (mine on the right), mb-grp (runs stack with tighter
   corners), mb-tail, mb-line, mb-blur, mb-mout (name above the bubble), mb-tend (time at the end of every
   bubble), mb-myname, mb-mt / mb-txt (gradient text fixed up for the bubbles); ms-ff, ms-fs, ms-wt, ms-lh, ms-ls,
   ms-it, ms-up, ms-ts (message text), ms-cm / ms-co / ms-ln (text and link colours without bubbles).
   Every rule is scoped to "the page's chat logs" or "a preview with that class", so a preview shows its own
   theme's look and never the page's. The bubble is the message's .body: replies, reactions, attachments,
   polls, embeds, thread previews, seen heads and the delivery line all sit inside it. Nothing here runs per
   frame: no animation on bubbles (their gradients stand still). */
.mb-time { display: none; }
/* each row picks its side's colours: mine (-m) or the others' (-o). Only while a theme sets them (html.ms, or a
   preview with .ms): on other themes no row carries these properties at all */
html.ms .log > .msg, html .us-mini.ms .log > .msg {
  --ms-tx: var(--ms-tx-o); --ms-mu: var(--ms-mu-o); --ms-ln: var(--ms-ln-o); --ms-gt: var(--ms-gt-o); --ms-code: var(--ms-code-o);
  --ms-ts: var(--ms-ts-o); --ms-ds: var(--ms-ds-o); --mb-bg: var(--mb-bg-o); --mb-tl: var(--mb-tl-o); --mb-mt: var(--mb-mt-o); --mb-txt: var(--mb-txt-o);
  --mc-solid: var(--mc-solid-o);
}
html.ms .log > .msg.mine, html .us-mini.ms .log > .msg.mine {
  --ms-tx: var(--ms-tx-m); --ms-mu: var(--ms-mu-m); --ms-ln: var(--ms-ln-m); --ms-gt: var(--ms-gt-m); --ms-code: var(--ms-code-m);
  --ms-ts: var(--ms-ts-m); --ms-ds: var(--ms-ds-m); --mb-bg: var(--mb-bg-m); --mb-tl: var(--mb-tl-m); --mb-mt: var(--mb-mt-m); --mb-txt: var(--mb-txt-m);
  --mc-solid: var(--mc-solid-m);
}

/* --- the bubble */
html.mb .log:not(.us-preview) > .msg > .body, html .us-mini.mb .log > .msg > .body {
  --R: var(--mb-r, 16px); --Rs: var(--mb-rs, 4px); --st: var(--R); --sb: var(--R);
  flex: 0 1 auto; width: fit-content; min-width: 2.5em; max-width: var(--mb-maxw, 75%); position: relative;
  padding: var(--mb-py, 6px) var(--mb-px, 10px); background: var(--mb-bg); color: var(--ms-tx);
  border-radius: var(--st) var(--R) var(--R) var(--sb);
}
/* attachments, embeds, polls and cards keep their size inside a bubble (they don't shrink it to nothing) */
html.mb .log:not(.us-preview) > .msg > .body:has(> :is(.files, .embeds, .poll, .checklist, .vof-card)), html .us-mini.mb .log > .msg > .body:has(> :is(.files, .embeds, .poll, .checklist, .vof-card)) { min-width: min(320px, var(--mb-maxw, 75%)); }
/* runs from one person: the corners on the speaker's side get tighter between bubbles */
html.mb.mb-grp .log:not(.us-preview) > .msg.cont > .body, html .us-mini.mb.mb-grp .log > .msg.cont > .body { --st: var(--Rs); }
html.mb.mb-grp .log:not(.us-preview) > .msg.mb-nx > .body, html .us-mini.mb.mb-grp .log > .msg.mb-nx > .body { --sb: var(--Rs); }
/* mine on the right: the row turns around, my own picture is left out (its place keeps the hover time) */
html.mb.mb-r .log:not(.us-preview) > .msg.mine, html .us-mini.mb.mb-r .log > .msg.mine { flex-direction: row-reverse; }
html.mb.mb-r .log:not(.us-preview) > .msg.mine > .gutter .avatar, html .us-mini.mb.mb-r .log > .msg.mine > .gutter .avatar { visibility: hidden; }
html.mb.mb-r .log:not(.us-preview) > .msg.mine > .body, html .us-mini.mb.mb-r .log > .msg.mine > .body { border-radius: var(--R) var(--st) var(--sb) var(--R); }
html.mb.mb-r .log:not(.us-preview) > .msg.mine > .body > .meta, html .us-mini.mb.mb-r .log > .msg.mine > .body > .meta { justify-content: flex-end; }
html.mb.mb-r .log:not(.us-preview) > .msg.mine > .actions, html .us-mini.mb.mb-r .log > .msg.mine > .actions { right: auto; left: 12px; }
html.mb.mb-r:not(.mb-myname) .log:not(.us-preview) > .msg.mine > .body > .meta > .who, html .us-mini.mb.mb-r:not(.mb-myname) .log > .msg.mine > .body > .meta > .who { display: none; }
/* a small tail on the first bubble of a run */
html.mb.mb-tail:not(.compact) .log:not(.us-preview) > .msg.first > .body, html:not(.compact) .us-mini.mb.mb-tail .log > .msg.first > .body { --st: 0px; }
html.mb.mb-tail:not(.compact) .log:not(.us-preview) > .msg.first > .body::before, html:not(.compact) .us-mini.mb.mb-tail .log > .msg.first > .body::before {
  content: ""; position: absolute; top: 0; left: -7px; width: 8px; height: 12px; background: var(--mb-tl); clip-path: polygon(0 0, 100% 0, 100% 100%); pointer-events: none;
}
html.mb.mb-tail.mb-r:not(.compact) .log:not(.us-preview) > .msg.mine.first > .body::before, html:not(.compact) .us-mini.mb.mb-tail.mb-r .log > .msg.mine.first > .body::before { left: auto; right: -7px; clip-path: polygon(0 0, 100% 0, 0 100%); }
/* a thin border, glass */
html.mb.mb-line .log:not(.us-preview) > .msg > .body, html .us-mini.mb.mb-line .log > .msg > .body { box-shadow: inset 0 0 0 1px var(--mb-lc); }
/* glass blur costs on slow graphics cards (every bubble blurs what is behind it): only with something sharp
   behind the messages for it to blur (a pattern of the backdrop: fx-detail, or your own background; a blurred
   smooth gradient looks the same as none), not over the backdrop on a weak device (fx-lite), and only on the
   newest 40 rows (the ones on screen unless you scroll back; older bubbles keep their colour without the blur) */
html.mb.mb-blur:is(.fx-detail:not(.fx-lite), .wall) .log:not(.us-preview) > .msg:nth-last-child(-n+40) > .body { -webkit-backdrop-filter: blur(var(--mb-blur)); backdrop-filter: blur(var(--mb-blur)); }
html:not(.fx-lite) .us-mini.mb.mb-blur:is(.fx-detail, .wall-all, .wall-chat) .log > .msg > .body { -webkit-backdrop-filter: blur(calc(var(--mb-blur) / 2)); backdrop-filter: blur(calc(var(--mb-blur) / 2)); }
/* the name (and time) above the bubble, on the page's own background */
html.mb.mb-mout:not(.compact) .log:not(.us-preview) > .msg.first > .body, html:not(.compact) .us-mini.mb.mb-mout .log > .msg.first > .body { margin-top: calc(var(--chat-font, 15px) + 7px); }
html.mb.mb-mout:not(.compact) .log:not(.us-preview) > .msg > .body > .meta, html:not(.compact) .us-mini.mb.mb-mout .log > .msg > .body > .meta {
  position: absolute; bottom: calc(100% + 2px); left: 2px; width: max-content; max-width: min(70vw, 520px); color: var(--text);
}
html.mb.mb-mout:not(.compact) .log:not(.us-preview) > .msg > .body > .meta .time, html:not(.compact) .us-mini.mb.mb-mout .log > .msg > .body > .meta .time { color: var(--muted); }
html.mb.mb-mout.mb-r:not(.compact) .log:not(.us-preview) > .msg.mine > .body > .meta, html:not(.compact) .us-mini.mb.mb-mout.mb-r .log > .msg.mine > .body > .meta { left: auto; right: 2px; }
/* the time small at the end of every bubble (no hover time beside it); also on my own bubbles on the right
   while my name isn't shown (a line with only the time on it would be empty space), and that line goes */
html.mb.mb-tend:not(.compact) .log:not(.us-preview) > .msg > .body, html:not(.compact) .us-mini.mb.mb-tend .log > .msg > .body,
html.mb.mb-r:not(.mb-myname):not(.compact) .log:not(.us-preview) > .msg.mine > .body, html:not(.compact) .us-mini.mb.mb-r:not(.mb-myname) .log > .msg.mine > .body { padding-bottom: calc(var(--mb-py, 6px) + 10px); }
html.mb.mb-tend:not(.compact) .log:not(.us-preview) > .msg > .body > .meta > .time, html:not(.compact) .us-mini.mb.mb-tend .log > .msg > .body > .meta > .time,
html.mb.mb-tend:not(.compact) .log:not(.us-preview) > .msg > .gutter .side-time, html:not(.compact) .us-mini.mb.mb-tend .log > .msg > .gutter .side-time,
html.mb.mb-r:not(.mb-myname):not(.compact) .log:not(.us-preview) > .msg.mine > .body > .meta:not(:has(> :not(.who, .time))), html:not(.compact) .us-mini.mb.mb-r:not(.mb-myname) .log > .msg.mine > .body > .meta:not(:has(> :not(.who, .time))),
html.mb.mb-r:not(.mb-myname):not(.compact) .log:not(.us-preview) > .msg.mine > .gutter, html:not(.compact) .us-mini.mb.mb-r:not(.mb-myname) .log > .msg.mine > .gutter { display: none; }
html.mb.mb-tend:not(.compact) .log:not(.us-preview) > .msg > .body > .mb-time, html:not(.compact) .us-mini.mb.mb-tend .log > .msg > .body > .mb-time,
html.mb.mb-r:not(.mb-myname):not(.compact) .log:not(.us-preview) > .msg.mine > .body > .mb-time, html:not(.compact) .us-mini.mb.mb-r:not(.mb-myname) .log > .msg.mine > .body > .mb-time {
  display: block; position: absolute; right: var(--mb-px, 10px); bottom: 3px; font-size: 10px; line-height: 12px; color: var(--ms-mu); white-space: nowrap; pointer-events: none;
}
html.mb.mb-mout.mb-r:not(.mb-myname):not(.compact) .log:not(.us-preview) > .msg.mine.first > .body, html:not(.compact) .us-mini.mb.mb-mout.mb-r:not(.mb-myname) .log > .msg.mine.first > .body { margin-top: 0; }
/* a preview with bubbles shows the newest messages, mine among them (like the chat itself) */
.us-mini.mb .log.us-preview { display: flex; flex-direction: column; justify-content: flex-end; }
/* big emoji reach below their line: room for the time under them */
html.mb .log:not(.us-preview) > .msg > .body > .text.jumbo, html .us-mini.mb .log > .msg > .body > .text.jumbo { padding-bottom: 6px; }
/* compact mode + bubbles: small bubbles, name and text on one line, no tail */
html.compact.mb body .log:not(.us-preview) > .msg > .body, html.compact body .us-mini.mb .log > .msg > .body { --R: min(var(--mb-r, 16px), 10px); --Rs: min(var(--mb-rs, 4px), 3px); padding: 1px calc(var(--mb-px, 10px) * .7); }
html.compact.mb body .log:not(.us-preview) > .msg, html.compact body .us-mini.mb .log > .msg { padding-top: 1px; padding-bottom: 1px; }
/* the search jump and a link to a message: the bubble lights up too */
html.mb .log:not(.us-preview) > .msg.flash > .body, html .us-mini.mb .log > .msg.flash > .body { animation: mb-flash 1.2s ease-out; }
@keyframes mb-flash { from { box-shadow: 0 0 0 3px var(--accent); } }
@media (max-width: 480px) {
  html.mb .log:not(.us-preview) > .msg > .body, html .us-mini.mb .log > .msg > .body { max-width: max(var(--mb-maxw, 75%), 86%); }
  html.mb .log:not(.us-preview) > .msg > .body:has(> :is(.files, .embeds, .poll, .checklist, .vof-card)), html .us-mini.mb .log > .msg > .body:has(> :is(.files, .embeds, .poll, .checklist, .vof-card)) { min-width: min(260px, 86%); }
}

/* --- colours inside a bubble or a message card (mc): every one is 4.5:1 on it (theme.js msStyle) */
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body :is(.meta .time, .edited, .reply-line, .dstat, .text .md-sub, .exp-tag), html .us-mini:is(.mb, .mc) .log > .msg > .body :is(.meta .time, .edited, .reply-line, .dstat, .text .md-sub, .exp-tag) { color: var(--ms-mu); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body :is(.reply-line b, .text .quote), html .us-mini:is(.mb, .mc) .log > .msg > .body :is(.reply-line b, .text .quote) { color: var(--ms-tx); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body .text .quote, html .us-mini:is(.mb, .mc) .log > .msg > .body .text .quote { border-left-color: var(--ms-mu); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body :is(.text a, .text .at, .dstat.read), html .us-mini:is(.mb, .mc) .log > .msg > .body :is(.text a, .text .at, .dstat.read) { color: var(--ms-ln); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg.mine > .body > .meta .who:not([style*="color"]), html .us-mini:is(.mb, .mc) .log > .msg.mine > .body > .meta .who:not([style*="color"]) { color: var(--ms-ln); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body .text :is(.greentext, .gt-line), html .us-mini:is(.mb, .mc) .log > .msg > .body .text :is(.greentext, .gt-line) { color: var(--ms-gt); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body .text :is(pre, :not(pre) > code), html .us-mini:is(.mb, .mc) .log > .msg > .body .text :is(pre, :not(pre) > code) { background: var(--ms-code); }
html:is(.mb, .mc) .log:not(.us-preview) > .msg > .body .text .spoiler:not(.shown), html .us-mini:is(.mb, .mc) .log > .msg > .body .text .spoiler:not(.shown) { background: var(--ms-tx); }
html.mb.mb-mout:not(.compact) .log:not(.us-preview) > .msg.mine > .body > .meta .who:not([style*="color"]), html:not(.compact) .us-mini.mb.mb-mout .log > .msg.mine > .body > .meta .who:not([style*="color"]) { color: var(--link); }
/* gradient message text and gradient names (effects), fixed up for the bubbles and cards */
html:is(.mb, .mc).mb-mt .log:not(.us-preview) > .msg > .body, html .us-mini:is(.mb, .mc).mb-mt .log > .msg > .body { --fx-mt: var(--mb-mt); }
html:is(.mb, .mc).mb-txt:not(.mb-mout) .log:not(.us-preview) > .msg > .body, html .us-mini:is(.mb, .mc).mb-txt:not(.mb-mout) .log > .msg > .body { --fx-txt: var(--mb-txt); }

/* --- message text: font, size, weight, line height, letter spacing, italic, uppercase (theme.js MS_FONTS) */
html.ms-ff .log:not(.us-preview) > .msg .text, html .us-mini.ms-ff .log > .msg .text { font-family: var(--ms-ff); }
html.ms-fs .log:not(.us-preview) > .msg .text:not(.jumbo), html .us-mini.ms-fs .log > .msg .text:not(.jumbo) {
  font-size: calc(var(--chat-font, 15px) * var(--ms-k, 1)); line-height: calc(var(--chat-font, 15px) * var(--ms-k, 1) + 7px); min-height: calc(var(--chat-font, 15px) * var(--ms-k, 1) + 7px);
}
html.ms-lh .log:not(.us-preview) > .msg .text:not(.jumbo), html .us-mini.ms-lh .log > .msg .text:not(.jumbo) { line-height: var(--ms-lh); }
html.ms-wt .log:not(.us-preview) > .msg .text, html .us-mini.ms-wt .log > .msg .text { font-weight: var(--ms-wt); }
html.ms-ls .log:not(.us-preview) > .msg .text, html .us-mini.ms-ls .log > .msg .text { letter-spacing: var(--ms-ls); }
html.ms-it .log:not(.us-preview) > .msg .text, html .us-mini.ms-it .log > .msg .text { font-style: italic; }
html.ms-up .log:not(.us-preview) > .msg .text, html .us-mini.ms-up .log > .msg .text { text-transform: uppercase; }
html:is(.ms-wt, .ms-ls, .ms-it, .ms-up) .log:not(.us-preview) > .msg .text :is(pre, code), html .us-mini:is(.ms-wt, .ms-ls, .ms-it, .ms-up) .log > .msg .text :is(pre, code) { font-weight: 400; letter-spacing: normal; font-style: normal; text-transform: none; }
/* colours without bubbles: on the page's background, 4.5:1 there */
html.ms-cm .log:not(.us-preview) > .msg.mine .text, html .us-mini.ms-cm .log > .msg.mine .text,
html.ms-co .log:not(.us-preview) > .msg:not(.mine) .text, html .us-mini.ms-co .log > .msg:not(.mine) .text { color: var(--ms-tx); }
html.ms-ln .log:not(.us-preview) > .msg .text :is(a, .at), html .us-mini.ms-ln .log > .msg .text :is(a, .at) { color: var(--ms-ln); }
/* a shadow or an outline (with the effects' glow when that is on too); gradient text takes it as a drop shadow */
html.ms-ts .log:not(.us-preview) > .msg .text, html .us-mini.ms-ts .log > .msg .text { text-shadow: var(--ms-ts); }
html.ms-ts.fx-glow-text .log:not(.us-preview) > .msg .text, .us-mini.us-mini.ms-ts.fx-glow-text .log > .msg .text { text-shadow: var(--ms-ts), 0 0 var(--fx-glow-rt) var(--fx-glow-t); }
html.ms-ts.fx-mt.fx-mt .log:not(.us-preview) > .msg .text, .us-mini.us-mini.ms-ts.fx-mt .log > .msg .text { text-shadow: none; filter: var(--ms-ds); }
html.ms-ts.fx-mt.fx-glow-text.fx-glow-text .log:not(.us-preview) > .msg .text, .us-mini.us-mini.ms-ts.fx-mt.fx-glow-text .log > .msg .text { text-shadow: none; filter: var(--ms-ds) drop-shadow(0 0 var(--fx-glow-rt) var(--fx-glow-t)); }
html.ms-ts .log:not(.us-preview) > .msg .text :is(pre, code, .spoiler), html .us-mini.ms-ts .log > .msg .text :is(pre, code, .spoiler) { text-shadow: none; }
@media (forced-colors: active) {
  html.mb .log > .msg > .body, html .us-mini.mb .log > .msg > .body { border: 1px solid CanvasText; backdrop-filter: none; }
  html.mb .log > .msg > .body::before, html .us-mini.mb .log > .msg > .body::before { display: none; }
}
/* ===== message cards (theme.js MS_CARD / msStyle "mc"; app.js usMsBlock, usMsBubbleRows) =====
   Classes and custom properties on <html> (the page) or on .us-mini (a preview), from theme.js: mc (cards; they replace
   the bubbles), mc-run (one card per run of messages from one person), mc-rim, mc-shade, mc-lift, mc-blur; --mc-r, --mc-px,
   --mc-py, --mc-gap, --mc-blur, --mc-line, --mc-hi, --mc-shc, and per side (mine -m, others -o) the fill --mb-bg and the
   solid colour --mc-solid. The card is the message row itself (avatar, name, reply line, text, attachments, reactions,
   the delivery line). A run of messages from one person is one card made of its rows: the first row has the top corners
   (.first), the rows the next one continues (.mb-nx, app.js appendMessage) give up their bottom corners and the rows
   after them (.cont) their top ones and the gap, so no wrapper element and no redraw. Nothing here runs per frame and
   there are no listeners: hover is plain CSS.
   Cost: the fill is a plain translucent colour. The frosted blur (backdrop-filter) is only drawn where it shows and
   where it is cheap enough: over something sharp behind the messages (a pattern of the effects' backdrop: fx-detail, or
   your own background: wall; over a plain colour or a smooth gradient a blur shows nothing), not with Lighter effects
   (fx-lite), and only on the newest 30 rows, 12 while the backdrop may move (fx-move: every blurred card is blurred
   again each frame the backdrop moves). Older cards keep the same fill without the blur. */
html.mc .log:not(.us-preview) > .msg, html .us-mini.mc .log > .msg {
  margin: var(--mc-gap, 6px) 12px 0; padding: var(--mc-py, 7px) var(--mc-px, 10px); border-radius: var(--mc-r, 12px);
  background-color: var(--mb-bg); background-image: none; color: var(--ms-tx);
  box-shadow: var(--mc-edge, 0 0 #0000), var(--mc-sh, 0 0 #0000);
}
/* one card per message: a smaller gap inside a run */
html.mc:not(.mc-run) .log:not(.us-preview) > .msg.cont, html .us-mini.mc:not(.mc-run) .log > .msg.cont { margin-top: max(2px, calc(var(--mc-gap, 6px) / 2)); }
/* one card per run: its rows join (no gap, inner corners square, the usual 2 px between lines) */
html.mc.mc-run .log:not(.us-preview) > .msg.cont, html .us-mini.mc.mc-run .log > .msg.cont { margin-top: 0; padding-top: 2px; border-top-left-radius: 0; border-top-right-radius: 0; }
html.mc.mc-run .log:not(.us-preview) > .msg.mb-nx, html .us-mini.mc.mc-run .log > .msg.mb-nx { padding-bottom: 2px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
/* the rim: a thin edge in the text colour and a light hairline on top (Apple-style materials), drawn per row so that a
   run's rows make one outline */
html.mc.mc-rim .log:not(.us-preview) > .msg, html .us-mini.mc.mc-rim .log > .msg { --mc-edge: inset 0 1px 0 var(--mc-hi), inset 0 0 0 1px var(--mc-line); }
html.mc.mc-rim.mc-run .log:not(.us-preview) > .msg.mb-nx, html .us-mini.mc.mc-rim.mc-run .log > .msg.mb-nx { --mc-edge: inset 0 1px 0 var(--mc-hi), inset 1px 0 0 var(--mc-line), inset -1px 0 0 var(--mc-line), inset 0 1px 0 var(--mc-line); }
html.mc.mc-rim.mc-run .log:not(.us-preview) > .msg.cont, html .us-mini.mc.mc-rim.mc-run .log > .msg.cont { --mc-edge: inset 1px 0 0 var(--mc-line), inset -1px 0 0 var(--mc-line), inset 0 -1px 0 var(--mc-line); }
html.mc.mc-rim.mc-run .log:not(.us-preview) > .msg.cont.mb-nx, html .us-mini.mc.mc-rim.mc-run .log > .msg.cont.mb-nx { --mc-edge: inset 1px 0 0 var(--mc-line), inset -1px 0 0 var(--mc-line); }
/* a soft shadow under each card (only below it: the row under a card in the same run would otherwise get its shadow) */
html.mc.mc-shade:not(.mc-run) .log:not(.us-preview) > .msg, html .us-mini.mc.mc-shade:not(.mc-run) .log > .msg, html.mc.mc-shade.mc-run .log:not(.us-preview) > .msg:not(.mb-nx), html .us-mini.mc.mc-shade.mc-run .log > .msg:not(.mb-nx) { --mc-sh: 0 10px 18px -12px var(--mc-shc); }
/* hover, an open menu, mentions, keywords and failed sends: laid over the card's fill instead of replacing it */
html.mc .log:not(.us-preview) > .msg:is(:hover, .menu-open), html .us-mini.mc .log > .msg:is(:hover, .menu-open) { background-image: linear-gradient(var(--hover), var(--hover)); }
@media (hover: none) { html.mc .log:not(.us-preview) > .msg:hover:not(.menu-open), html .us-mini.mc .log > .msg:hover:not(.menu-open) { background-image: none; } }
html.mc .log:not(.us-preview) > .msg:is(.mention, .keyword), html .us-mini.mc .log > .msg:is(.mention, .keyword) { background-image: linear-gradient(var(--accent-soft), var(--accent-soft)); box-shadow: inset 3px 0 0 var(--accent), var(--mc-edge, 0 0 #0000), var(--mc-sh, 0 0 #0000); }
html.mc .log:not(.us-preview) > .msg.failed, html .us-mini.mc .log > .msg.failed { background-image: linear-gradient(color-mix(in srgb, var(--bad) 12%, transparent), color-mix(in srgb, var(--bad) 12%, transparent)); box-shadow: inset 3px 0 0 var(--bad), var(--mc-edge, 0 0 #0000), var(--mc-sh, 0 0 #0000); }
html.mc .log:not(.us-preview) > .msg:hover .side-time, html .us-mini.mc .log > .msg:hover .side-time { color: var(--ms-mu); }
html.mc .log:not(.us-preview) > .msg.blocked-msg, html .us-mini.mc .log > .msg.blocked-msg { padding-left: calc(var(--mc-px, 10px) + 52px); }
/* frosted: see the cost note above */
html.mc.mc-blur:is(.fx-detail, .wall):not(.fx-lite) .log:not(.us-preview) > .msg:nth-last-child(-n+30) { -webkit-backdrop-filter: blur(var(--mc-blur)) saturate(1.3); backdrop-filter: blur(var(--mc-blur)) saturate(1.3); }
html.mc.mc-blur.fx-move:is(.fx-detail, .wall):not(.fx-lite) .log:not(.us-preview) > .msg:nth-last-child(n+13) { -webkit-backdrop-filter: none; backdrop-filter: none; }
html:not(.fx-lite) .us-mini.mc.mc-blur:is(.fx-detail, .wall-all, .wall-chat) .log > .msg { -webkit-backdrop-filter: blur(calc(var(--mc-blur) / 2)) saturate(1.3); backdrop-filter: blur(calc(var(--mc-blur) / 2)) saturate(1.3); }
/* a 1 px lift on hover (one card per message only): with a mouse, not with Lighter effects; theme.js applyMs leaves out
   mc-lift unless Theme effects is Full and motion is allowed (Animations, the device's reduced motion) */
@media (hover: hover) {
  html.mc.mc-lift:not(.fx-lite) .log:not(.us-preview) > .msg, html:not(.fx-lite) .us-mini.mc.mc-lift .log > .msg { transition: translate .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease; }
  html.mc.mc-lift:not(.fx-lite) .log:not(.us-preview) > .msg:hover, html:not(.fx-lite) .us-mini.mc.mc-lift .log > .msg:hover { translate: 0 -1px; --mc-sh: 0 12px 22px -12px var(--mc-shc); }
}
/* compact mode: tighter cards */
html.compact.mc body .log:not(.us-preview) > .msg, html.compact body .us-mini.mc .log > .msg { padding-top: 2px; padding-bottom: 2px; padding-left: calc(var(--mc-px, 10px) * .7); padding-right: calc(var(--mc-px, 10px) * .7); }
html.compact.mc.mc-run body .log:not(.us-preview) > .msg.first, html.compact body .us-mini.mc.mc-run .log > .msg.first { padding-top: max(2px, calc(var(--mc-py, 7px) / 2)); }
html.compact.mc.mc-run body .log:not(.us-preview) > .msg:not(.mb-nx), html.compact body .us-mini.mc.mc-run .log > .msg:not(.mb-nx) { padding-bottom: max(2px, calc(var(--mc-py, 7px) / 2)); }
@media (max-width: 480px) { html.mc .log:not(.us-preview) > .msg, html .us-mini.mc .log > .msg { margin-left: 6px; margin-right: 6px; } }
/* less transparency: solid cards, no blur; more contrast: solid, a clearly visible edge (also without the rim), no lift;
   Windows high contrast: plain outlined boxes in system colours */
@media (prefers-reduced-transparency: reduce) {
  html.mc .log:not(.us-preview) > .msg, html .us-mini.mc .log > .msg { background-color: var(--mc-solid); -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-contrast: more) {
  html.mc .log:not(.us-preview) > .msg, html .us-mini.mc .log > .msg { background-color: var(--mc-solid); -webkit-backdrop-filter: none !important; backdrop-filter: none !important; translate: none !important;
    --mc-line: color-mix(in srgb, var(--ms-tx) 45%, transparent); --mc-hi: color-mix(in srgb, var(--ms-tx) 45%, transparent); }
html.mc .log:not(.us-preview) > .msg, html .us-mini.mc .log > .msg { --mc-edge: inset 0 1px 0 var(--mc-hi), inset 0 0 0 1px var(--mc-line); }
html.mc.mc-run .log:not(.us-preview) > .msg.mb-nx, html .us-mini.mc.mc-run .log > .msg.mb-nx { --mc-edge: inset 0 1px 0 var(--mc-hi), inset 1px 0 0 var(--mc-line), inset -1px 0 0 var(--mc-line), inset 0 1px 0 var(--mc-line); }
html.mc.mc-run .log:not(.us-preview) > .msg.cont, html .us-mini.mc.mc-run .log > .msg.cont { --mc-edge: inset 1px 0 0 var(--mc-line), inset -1px 0 0 var(--mc-line), inset 0 -1px 0 var(--mc-line); }
html.mc.mc-run .log:not(.us-preview) > .msg.cont.mb-nx, html .us-mini.mc.mc-run .log > .msg.cont.mb-nx { --mc-edge: inset 1px 0 0 var(--mc-line), inset -1px 0 0 var(--mc-line); }
}
@media (forced-colors: active) {
  html.mc .log:not(.us-preview) > .msg, html .us-mini.mc .log > .msg { border: 1px solid CanvasText; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  html.mc.mc-run .log:not(.us-preview) > .msg.cont, html .us-mini.mc.mc-run .log > .msg.cont { border-top: 0; }
  html.mc.mc-run .log:not(.us-preview) > .msg.mb-nx, html .us-mini.mc.mc-run .log > .msg.mb-nx { border-bottom: 0; }
}
