/* Every measurement below the root font-size is in em, so one --fs change
   resizes the whole overlay proportionally — text, emotes, badges, gaps and
   the platform rail. --scale layers window-width scaling on top of it. */

:root {
  --fs: 15px;
  --scale: 1;
  --gap: 0.3em;
  --pad-y: 0.28em;
  --pad-x: 0.5em;
  /* starting values only — overlay.js recomputes the accents through the
     saturation control on every apply() */
  --kick: #6ac93f;
  --vk: #2d7ad2;
  --wtv: #a184d6;
  --fg: #dfe4ec;
  --fg-dim: #8d96a6;
  --surface: rgba(15, 17, 22, 1);
  --page: transparent;
  --radius: 0.45em;
  --panel-w: min(340px, 92vw);
  font-size: calc(var(--fs) * var(--scale));

  /* ---- chrome ----------------------------------------------------------
     The panel, the card and the buttons are equipment, not content: things
     the streamer opens, adjusts and dismisses while a broadcast is running.
     They are built to look like the faceplate of a rack unit — a neutral
     casing, engraved section rules, one signal colour that only ever means
     "this is active" — rather than like an app dialog. That keeps them out
     of the way of the chat, which is the only thing on screen that is
     actually meant to be read.

     Casing greys are deliberately neutral-warm rather than blue-black: the
     three platform accents (green, blue, violet) already own the cool end of
     the palette, and chrome that leans blue competes with them. */
  --case: #191b1c;
  --case-raised: #24272a;
  --case-sunken: rgba(0, 0, 0, 0.22);

  /* Hairlines do the grouping. Rules cost one pixel and carry the same
     information as a box, without stacking a border-radius on every element
     and turning a settings pane into a deck of cards. */
  --rule: rgba(255, 255, 255, 0.085);
  --rule-strong: rgba(255, 255, 255, 0.16);

  /* Light comes from above and only from above: one bright top edge, one
     shaded bottom. A diagonal white gradient across the whole surface is the
     stock glass recipe and reads as a sticker rather than a material. */
  --edge-top: rgba(255, 255, 255, 0.11);
  --edge-bottom: rgba(0, 0, 0, 0.30);

  /* Warm off-white, the colour of a printed legend rather than of a screen. */
  --ink: #e9e6e1;
  --ink-dim: #a29d96;
  --ink-faint: #79746e;

  /* Signal orange, borrowed from the tally and warning lamps on broadcast
     gear. Used only for focus rings and the active state of a control, never
     as decoration, so that seeing it always means something. */
  --signal: #e07b39;

  /* Two shadows, not one: a tight contact edge that seats the panel against
     what is behind it, and a wide soft one that gives it height. A single
     medium blur is what makes stock cards look like they float without ever
     touching anything. */
  --lift:
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 14px 34px -10px rgba(0, 0, 0, 0.55);
  --lift-low:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 6px 16px -6px rgba(0, 0, 0, 0.5);

  /* Three steps, applied by role rather than per element: the outer shell of
     a floating surface, anything nested inside it, and true circles. The old
     set ran 16/12/9/7/5 with no rule behind which got which. */
  --r-shell: 10px;
  --r-inset: 6px;

  /* system-ui resolves to the face the operating system actually uses for its
     own controls — Segoe UI, SF, Cantarell. Naming Inter here instead, as the
     old rule did, imports a look that belongs to no platform and is the single
     most recognisable default in current interface work. */
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page);
}

body {
  /* The chat itself keeps a face the operator chooses; the fallback is the
     platform's own text face rather than a named webfont. */
  font-family: var(--font, "Segoe UI", system-ui, -apple-system, "Noto Sans", sans-serif);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

#counters {
  display: flex;
  align-items: center;
  gap: 0.85em;
  padding: 0.35em 0.7em 0.45em;
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
}
#counters[hidden] { display: none; }


.count {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.count b { color: var(--fg); font-weight: 700; }
.count[data-platform="kick"] { color: var(--kick); }
.count[data-platform="vk"] { color: var(--vk); }
.count[data-platform="wtv"] { color: var(--wtv); }
.count.total { margin-left: auto; color: var(--signal); }
body[data-bg="none"] #counters { text-shadow: 0 1px 2px rgba(0,0,0,.9); }

#stage {
  position: relative; /* anchors the jump-to-bottom button */
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.5em 0.6em;
}

#chat {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
#chat::-webkit-scrollbar { display: none; }

.msg {
  --accent: var(--fg-dim);
  position: relative;
  padding: var(--pad-y) var(--pad-x) var(--pad-y) calc(var(--pad-x) + 0.12em);
  border-radius: var(--radius);
  line-height: 1.4;
  /* Two animations rather than one, because opacity and movement want
     different curves. A single curve has to choose: fade slowly enough to look
     soft and the text is unreadable while it drifts, or fade fast enough to
     read and the row snaps into place. Split, the message is legible about a
     third of the way in and keeps settling gently after — which is what reads
     as smooth. Both properties are still composited, so a burst of messages
     costs no layout. */
  animation:
    msg-fade 260ms cubic-bezier(0.32, 0, 0.24, 1) both,
    msg-rise 380ms cubic-bezier(0.16, 0.9, 0.24, 1) both;
  backface-visibility: hidden; /* keeps the transform off the text raster */
}

/* Long messages and unbroken URLs always fold rather than overflow the source;
   the wrap setting only decides whether the fold is visible or clipped. */
.msg {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Truncation without nowrap.
   Two earlier attempts put white-space:nowrap on the row (first as a block,
   then as a flex row) and both could leave the text invisible. line-clamp is
   the well-trodden path: the row stays an ordinary block, text keeps normal
   wrapping rules, and the box simply stops after one line. Nothing here can
   collapse the row's height, which is what the other two got wrong. */
body[data-wrap="off"] .body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  vertical-align: bottom;
}

.msg::before {
  content: "";
  position: absolute;
  left: 0; top: 0.2em; bottom: 0.2em;
  width: 0.17em;
  border-radius: 1em;
  background: var(--accent);
}

.msg[data-platform="kick"] { --accent: var(--kick); }
.msg[data-platform="vk"]   { --accent: var(--vk); }
.msg[data-platform="wtv"]  { --accent: var(--wtv); }

body[data-bg="plates"] .msg { background: var(--surface); }
body[data-bg="none"] .msg {
  text-shadow: 0 1px 2px rgba(0,0,0,.95), 0 0 0.5em rgba(0,0,0,.75);
}

.icon {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.12em;
  margin-right: 0.32em;
  color: var(--accent);
}
/* wider box (30x16) than the square marks, so it needs the matching width */
/* Two letters can't occupy one letter's width, but they can share its height:
   0.95em tall like K and W, 1.27em wide (the 20x15 box's aspect). */
.icon-vk {
  width: 1.27em;
  height: 0.95em;
  vertical-align: -0.12em;
}

.time {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  font-size: 0.8em;
  margin-right: 0.35em;
}

.name { font-weight: 700; color: var(--user-color, var(--accent)); }
.sep { color: var(--fg-dim); margin-right: 0.3em; }

.badge {
  display: inline-block;
  margin-right: 0.25em;
  padding: 0 0.3em;
  border-radius: 0.25em;
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
  vertical-align: 0.1em;
}

/* Quoted line above a reply. Kept to one line with an ellipsis: the point is
   "what is this answering", not re-reading the original. The corner mark is
   drawn with borders rather than a glyph so it scales with the text. */
.reply {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  font-size: 0.82em;
  line-height: 1.25;
  color: var(--fg-dim);
  margin-bottom: 0.12em;
  min-width: 0;
}

.reply-mark {
  flex: none;
  width: 0.55em;
  height: 0.45em;
  border-left: 0.14em solid currentColor;
  border-bottom: 0.14em solid currentColor;
  border-bottom-left-radius: 0.2em;
  opacity: 0.55;
  transform: translateY(-0.12em);
}

.reply-name {
  flex: none;
  font-weight: 600;
  /* set via CSSOM, never as a style="" attribute — see the CSP */
  color: var(--reply-color, var(--accent));
  opacity: 0.8;
}

.reply-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-text .emote { height: 1.15em; vertical-align: -0.25em; }
.reply-text a { text-decoration: none; }

/* a reply is visually one unit: quote plus answer */
.has-reply { padding-top: calc(var(--pad-y) + 0.1em); }

.badge-icon {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.15em;
  margin-right: 0.26em;
  color: var(--accent);
  flex: none;
}
/* stroke-drawn marks lose weight against a busy background */
body[data-bg="none"] .badge-icon {
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.85));
}

/* The gem and the check read as flat silhouettes without one; a shadow gives
   the facets and the ring some depth on any background, not just video. */
.badge-vip, .badge-verified {
  filter: drop-shadow(0 1px 1.6px rgba(0, 0, 0, 0.55));
}
body[data-bg="none"] .badge-vip,
body[data-bg="none"] .badge-verified {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}

/* channel badges VK sends as images (roles, achievements, subscriptions) */
.badge-img {
  height: 1em;
  width: auto;
  vertical-align: -0.16em;
  margin-right: 0.26em;
  border-radius: 0.15em;
}

/* Deleted by a moderator: struck through but still legible — the point is to
   show it was removed, not to hide what was said. */
.deleted .body {
  text-decoration: line-through;
  text-decoration-thickness: 0.075em;
  text-decoration-color: color-mix(in srgb, currentColor 65%, transparent);
  opacity: 0.72;
}
.deleted .name, .deleted .badge-icon, .deleted .badge-img, .deleted .icon { opacity: 0.6; }
.deleted .emote { filter: grayscale(0.85); opacity: 0.7; }

.emote { height: 1.6em; vertical-align: -0.45em; margin: -0.2em 0.04em; }
a {
  color: var(--link, #6fb0ff);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.15em;
}
a:hover { text-decoration-thickness: 0.1em; }

/* The real destination, shown next to link text that claims something else. */
.host {
  font-size: 0.82em;
  color: var(--fg-dim);
  white-space: nowrap;
}
body[data-bg="none"] a { text-shadow: 0 1px 2px rgba(0,0,0,.95); }
.mention {
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.mention:hover { text-decoration: underline; text-underline-offset: 0.15em; }

/* Hover preview. Fixed position so it escapes the chat's overflow clipping,
   and pointer-events:none so it can never sit between the cursor and the
   image it describes. Sized in px, not em: it should stay legible even when
   the chat itself is scaled down. */
#zoom {
  position: fixed;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(14, 16, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  animation: zoomIn 110ms ease-out both;
}
#zoom[hidden] { display: none; }

#zoom img {
  width: auto;
  height: auto;
  max-width: 96px;
  max-height: 96px;
  image-rendering: auto;
}

#zoom span {
  max-width: 140px;
  font: 600 11px/1.2 var(--ui);
  color: var(--ink-dim);
  text-align: center;
  word-break: break-word;
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: none; }
}

.emote, .badge-img { cursor: zoom-in; }

/* Centred over the tail of the list rather than tucked in a corner: it appears
   only when the reader has scrolled away, and at that moment it is what they
   are looking for. Fixed px sizing so it stays tappable even when the chat
   itself is scaled small; max-width keeps it inside a narrow OBS source. */
/* A pill, because it is genuinely a pill: one short label, no siblings, and it
   appears over moving text. The glass is what keeps the count legible against
   whatever is scrolling underneath. */
#tobottom {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  height: 38px;
  /* Wide. It is the one target the streamer reaches for mid-broadcast, without
     looking, while the text under it is moving — the thing that makes it easy
     to hit is horizontal travel, not height, so the width grows and the pill
     stays a pill. The cap keeps it from spanning a narrow overlay column. */
  min-width: 132px;
  max-width: min(280px, 80%);
  padding: 0 28px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--case) 55%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  color: var(--ink);
  font: 500 13px/1 var(--ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--lift-low), inset 0 1px 0 var(--edge-top);
  animation: jumpIn 140ms ease-out both;
  transition: border-color 140ms ease, color 140ms ease;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #tobottom { background: rgba(25, 27, 28, 0.72); }
}
#tobottom[hidden] { display: none; }
#tobottom:hover {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04) 55%),
    rgba(38, 48, 74, 0.6);
  border-color: var(--signal);
}

@supports not (backdrop-filter: blur(1px)) {
  #tobottom { background: rgba(24, 30, 44, 0.92); }
}
#tobottom:active { transform: translateX(-50%) translateY(1px); }

/* Grown with the pill it sits in, so the count does not look like a leftover
   from the smaller version. */
#unread {
  min-width: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--link, #4d8fe8);
  /* Lighter weight needs darker ink to stay as legible as the bold version. */
  color: #08111c;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 22px;
}
#unread[hidden] { display: none; }

/* Keeps the centring transform — a bare translateY here would snap the button
   to the left edge for the duration of the animation. */
@keyframes jumpIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) { #tobottom { animation: none; } }

#notice {
  margin-top: 0.4em;
  font-size: 0.78em;
  color: var(--fg-dim);
  background: color-mix(in srgb, var(--case) 82%, transparent);
  border-radius: var(--radius);
  padding: 0.3em 0.5em;
  /* Sentences now, sometimes more than one, so they wrap and each error keeps
     its own line instead of running into the next. */
  white-space: pre-line;
  line-height: 1.45;
}

/* The rise outlasts the fade on purpose: the tail of the movement is what the
   eye reads as easing, and it costs nothing to let it run once the text is
   already solid. 0.36em of travel is enough to give direction without the row
   visibly sliding at chat speed. */
@keyframes msg-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes msg-rise {
  from { transform: translate3d(0, 0.36em, 0); }
  to   { transform: none; }
}

@keyframes leave {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translate3d(-0.7em, 0, 0); }
}

.leaving { animation: leave 420ms cubic-bezier(0.4, 0, 0.8, 0.3) both; }

@media (prefers-reduced-motion: reduce) { .msg, .leaving { animation: none; } }

/* ---- settings ---------------------------------------------------------- */
/* Fixed 14px so the panel stays usable no matter how the chat is scaled. */

/* Same 30px footprint, but it has to be findable against a bright game
   capture as well as a dark one: opaque plate, light ring, drop shadow. */
/* The one control always on screen. Small, circular, and quiet until it is
   under the cursor — it sits on top of a broadcast, so it earns its place by
   being findable rather than by being visible. */
#gear {
  position: fixed;
  top: 10px; right: 10px;
  z-index: 11;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: color-mix(in srgb, var(--case) 58%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--lift-low), inset 0 1px 0 var(--edge-top);
  color: var(--ink-dim);
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease-out, border-color 120ms ease-out, transform 120ms ease-out;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #gear { background: rgba(25, 27, 28, 0.7); }
}
#gear svg { width: 19px; height: 19px; }
#gear:hover { color: var(--ink); border-color: var(--signal); }

/* Both sit in the same corner, and the settings button was landing on top of
   the panel's own close button — two controls in one place, one of them
   unreachable. While the panel is open the panel closes itself, so the button
   that opened it has nothing left to do and steps out of the way. */
body[data-panel="open"] #gear { display: none; }
#gear:active { transform: scale(.93); }
#gear[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  #gear { transition: opacity 140ms ease; transform: none; }
}

/* Glass overlay: the chat and the counter bar stay put and show through it.
   Three layers make it read as glass rather than as a flat tint —
   a translucent tint, a blur that also lifts saturation so colours underneath
   stay alive, and a light edge along the top-left where the "pane" catches
   light. Blur is what keeps the labels legible over moving text. */
/* Same glass as the settings pane, centred rather than docked: it is a reply to
   a click, not a mode you stay in. Wider and set in a plain system UI stack —
   the overlay's condensed look is right over video and wrong for reading a
   dozen messages. */
/* Same faceplate as the panel, one step larger: this one holds content to be
   read, so it takes the wider radius and the deeper lift. */
#card {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  width: min(560px, calc(100vw - 24px));
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: calc(var(--r-shell) + 2px);
  background: color-mix(in srgb, var(--case) 70%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--rule-strong);
  box-shadow:
    var(--lift),
    inset 0 1px 0 var(--edge-top),
    inset 0 -1px 0 var(--edge-bottom);
  color: var(--ink);
  font: 15px/1.5 var(--ui);
  animation: cardIn 150ms ease-out both;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #card { background: rgba(25, 27, 28, 0.94); }
}
#card[hidden] { display: none; }
/* A CSS animation overrides inline styles, and cardIn's last keyframe is
   `transform: translate(-50%,-50%)` with fill-mode both. Killing the animation
   only while .dragging meant that on release the keyframe applied again and
   yanked the card half its own size up and left — the jump to the centre.
   Once moved, the animation stays off for good and position is left/top only. */
#card.moved { animation: none; transform: none; }
#card.dragging { transition: none; user-select: none; }

@supports not (backdrop-filter: blur(1px)) {
  #card { background: rgba(16, 19, 27, 0.96); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

#card-drag {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  cursor: grab;
  touch-action: none; /* pointer events handle panning, not the browser */
}
#card.dragging #card-drag { cursor: grabbing; }

#card-avatar {
  flex: none;
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--avatar-bg, #2a3140);
  color: #0d1119;
  font-size: 27px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
/* Stacked over the monogram, not in place of it. The picture starts invisible
   and fades up once it has decoded, so the sequence is letter → letter with a
   face appearing over it, rather than letter → empty circle → face. The empty
   step was short but it was the part that read as loading. */
#card-avatar img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 320ms ease-out;
}
#card-avatar img.ready { opacity: 1; }
.avatar-mono { line-height: 1; }

/* Only when there is a picture to enlarge. A monogram is drawn from the
   nickname and blowing it up shows nothing the card doesn't already show, so
   the class is added in JS and the cursor stays default without it. */
#card-avatar.zoomable { cursor: zoom-in; }

/* Above #card (12) and the emote preview (20): it covers everything while it
   is open. */
#avatar-zoom {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 15, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: avatar-zoom-in 160ms cubic-bezier(0.16, 0.9, 0.24, 1) both;
}
#avatar-zoom[hidden] { display: none; }

/* vmin, so the picture is bounded by whichever side of the window is shorter —
   an overlay docked into a narrow column still gets a square that fits. VK
   serves the original upload here, so there is usually real resolution to
   show. */
#avatar-zoom img {
  grid-area: 1 / 1; /* both layers occupy the same cell */
  max-width: min(420px, 80vmin);
  max-height: min(420px, 80vmin);
  width: auto;
  height: auto;
  /* Square. A rounded frame crops the picture's own corners, and avatars are
     often composed right up to the edge — the enlarged view exists to show the
     whole thing, so it shows the whole thing. The circle in the card is the
     place for the shape. */
  border-radius: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: filter 220ms ease-out;
}

/* The view opens on the 128px thumbnail the card already holds — instant, but
   soft at this size. A slight blur while the full picture downloads makes that
   read as "loading" rather than "bad image". */
#avatar-zoom.lowres #avatar-zoom-img { filter: blur(1.5px); }

/* The full-size layer. Hidden until it has decoded, then brought up over the
   thumbnail; the two are identical apart from sharpness, so the cross-fade
   reads as the picture coming into focus rather than as one image being
   replaced by another. If it never loads, it stays at zero and the thumbnail
   is simply what you see. */
#avatar-zoom-full {
  opacity: 0;
  transition: opacity 340ms ease-out;
}
#avatar-zoom-full.ready { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #card-avatar img, #avatar-zoom-full { transition: none; }
}

@keyframes avatar-zoom-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) { #avatar-zoom { animation: none; } }

#card-who { min-width: 0; flex: 1; }
#card-name {
  display: block;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-dim);
}
.card-where { display: inline-flex; align-items: center; gap: 5px; }
.card-where .icon { width: 0.95em; height: 0.95em; }
.card-where .icon-vk { width: 1.27em; }
.card-where span { color: var(--ink-dim); }

/* Grip along the bottom edge. Wide target, quiet look: two short lines that
   only gain contrast under the pointer. */
#card-resize {
  height: 14px;
  flex: none;
  cursor: ns-resize;
  display: grid;
  place-items: center;
  border-radius: 0 0 18px 18px;
  touch-action: none;
}
#card-resize::before {
  content: "";
  width: 34px;
  height: 4px;
  border-top: 2px solid rgba(255, 255, 255, 0.22);
  border-bottom: 2px solid rgba(255, 255, 255, 0.22);
  transition: border-color 120ms;
}
#card-resize:hover::before,
#card.resizing #card-resize::before { border-color: var(--signal); }
#card.resizing { user-select: none; }

#card-close {
  flex: none;
  border: 0; background: none; color: var(--ink-faint);
  font-size: 17px; cursor: pointer; padding: 6px 4px;
  align-self: flex-start;
}

#card-list {
  list-style: none;
  margin: 0;
  padding: 12px 16px 14px;
  /* Six rows by default, then scroll — a card grown to the full screen height
     pushes its own header off it, and the header is what you drag it by. The
     grip below overrides this, and the value is remembered.
     max-height, not height: a short list stays short instead of leaving a gap,
     and the scrollbar appears only when there is something to scroll. */
  max-height: var(--card-list-h, calc(6 * 44px + 26px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#card-list li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 7px 10px 7px 11px;
  border-radius: 9px;
  background: var(--case-sunken);
  border-left: 2px solid var(--fg-dim);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
#card-list li[data-platform="kick"] { border-left-color: var(--kick); }
#card-list li[data-platform="vk"]   { border-left-color: var(--vk); }
#card-list li[data-platform="wtv"]  { border-left-color: var(--wtv); }
#card-list .icon { flex: none; color: inherit; }
#card-list li[data-platform="kick"] .icon { color: var(--kick); }
#card-list li[data-platform="vk"]   .icon { color: var(--vk); }
#card-list li[data-platform="wtv"]  .icon { color: var(--wtv); }

.card-time { flex: none; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.card-body { min-width: 0; }
.card-text { min-width: 0; font-size: 15px; }
.card-text .emote { height: 1.9em; vertical-align: -0.5em; }

/* Quoted message this one replied to. Dimmer and smaller than the reply
   itself, so the eye lands on the answer first. */
.card-reply {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.card-reply .reply-mark {
  flex: none;
  width: 8px; height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-bottom-left-radius: 3px;
  opacity: 0.6;
  transform: translateY(-2px);
}
.card-reply-name { flex: none; font-weight: 600; opacity: 0.9; }
.card-reply-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-reply-text .emote { height: 1.2em; vertical-align: -0.28em; }

/* 15. The default scrollbar is a grey slab from the OS and looks pasted on.
   Both syntaxes: Firefox takes scrollbar-color, Chromium the pseudo-elements. */
#card-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
#card-list::-webkit-scrollbar { width: 10px; }
#card-list::-webkit-scrollbar-track { background: transparent; }
#card-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
#card-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); background-clip: content-box; }

/* The settings panel scrolls too — same treatment. */
#panel { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
#panel::-webkit-scrollbar { width: 10px; }
#panel::-webkit-scrollbar-track { background: transparent; }
#panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* A nickname is now a target, so say so. */
.name { cursor: pointer; }
.name:hover { text-decoration: underline; text-underline-offset: 0.15em; }
.reply-name { cursor: pointer; }

/* The faceplate. The glass stays — it is what lets the operator keep an eye on
   the chat underneath while adjusting it — but the surface is built from a flat
   tint plus two edges rather than from a diagonal white wash, so it reads as
   anodised metal catching a light from above instead of as frosted plastic. */
#panel {
  position: fixed;
  top: 10px; right: 10px;
  /* Follows the window instead of being one fixed width. max() keeps it usable
     on a phone, the 700px cap stops it swallowing the chat on a wide monitor,
     and the last term is the guard for anything narrower than the minimum. */
  width: min(max(var(--panel-w), 46vw), 700px, calc(100vw - 20px));

  /* Sections lay out in as many columns as the width allows: one on a phone,
     two from roughly 1100px of window, which is what takes the panel from
     taller than a 1080p screen to comfortably inside it. Grid rather than
     multi-column, because a multi-column container with a capped height
     fragments sideways instead of scrolling. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  align-content: start;
  align-items: start;
  column-gap: 20px;
  /* Height follows the content. Setting `bottom` as well would stretch the
     pane to the full window; the max-height keeps it scrollable instead of
     overflowing when the window is short. */
  max-height: calc(100vh - 20px);
  /* Two columns for the checkboxes: they are the shortest rows and the most
     numerous, and stacking them was costing more height than anything else on
     the panel. */
  scrollbar-gutter: stable;
  overflow-y: auto;
  z-index: 10;
  padding: 11px 14px 13px;
  border-radius: var(--r-shell);
  background: color-mix(in srgb, var(--case) 64%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--rule-strong);
  box-shadow:
    var(--lift),
    inset 0 1px 0 var(--edge-top),
    inset 0 -1px 0 var(--edge-bottom);
  color: var(--ink);
  /* 14.5px rather than 13: this is read at arm's length while something else is
     happening on screen, and the panel has room the old size was not using. */
  font: 14.5px/1.5 var(--ui);
  font-variant-numeric: tabular-nums;
}

/* Without a backdrop-filter the tint alone would let text bleed through, so
   fall back to something nearly opaque. */
@supports not (backdrop-filter: blur(1px)) {
  #panel { background: color-mix(in srgb, var(--case) 96%, transparent); }
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  #panel { background: rgba(25, 27, 28, 0.94); }
}
#panel[hidden] { display: none; }

/* Full width whatever the column count: one title, one set of buttons. */
#panel > header, #panel > footer { grid-column: 1 / -1; }

#panel header {
  display: flex;
  /* Centred, not baseline-aligned: the close button is a fixed box with its
     own hit area now, and baseline alignment would hang it off the heading. */
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
#panel h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.006em; }

/* Section legends, engraved rather than shouted. The previous rule set these
   in tracked-out capitals, which is the most reliable single tell of a
   generated interface and, on a panel this small, also the least legible
   option available. Sentence case with the weight doing the work, sitting on
   the rule that separates the section, says the same thing more quietly. */
/* Kept, not removed. Four of them cost about 150px of the panel's 700, and
   dropping them would leave twenty controls in an undifferentiated list — and
   they are what makes the two-column layout readable, since each column has to
   say what it is. Made cheaper instead: tighter margins, thinner rule. */
#panel h2 {
  margin: 9px 0 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-dim);
}
/* No leading gap above the first heading in each column. */
#panel > section:first-of-type h2 { margin-top: 2px; }

#close {
  border: 0; background: none; color: var(--ink-faint);
  font-size: 20px; line-height: 1; cursor: pointer;
  /* A hit area of its own rather than a bare glyph: it is the only way out of
     the panel now that the settings button hides behind it. */
  width: 30px; height: 30px;
  display: grid; place-items: center;
  margin: -4px -4px 0 0;
  border-radius: var(--r-inset);
}
#close:hover { color: var(--ink); }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  /* Rows sit close enough to read as one group; the section rules above do the
     separating, so they need no dividers of their own. Tight, because the whole
     panel has to fit the height of a 1080p window without scrolling — every
     row pays this margin fifteen times over. */
  margin-bottom: 3px;
  min-height: 22px;
  color: var(--ink-dim);
}
.row:has(input[type="range"]) { grid-template-columns: 1fr 104px 34px; }
.row.check { grid-template-columns: auto 1fr; justify-items: start; cursor: pointer; }
.row.check:hover, .row:hover { color: var(--ink); }

/* The readout beside a slider. Tabular figures so the number does not shift
   the row as it counts, and the signal colour so the eye can find the value
   it is currently dragging. */
.row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--ink);
}

#panel input[type="range"] { width: 104px; accent-color: var(--signal); }
#panel input[type="color"] {
  width: 34px; height: 22px; padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-inset); background: none; cursor: pointer;
}
/* Controls are sunken, the panel is raised: a recess reads as something you
   set, which is the opposite of the raised-tile treatment that makes every
   element on a stock settings pane look equally clickable. */
#panel select {
  background: var(--case-sunken);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-inset);
  padding: 3px 6px;
  font: inherit;
  cursor: pointer;
}
#panel select:hover { border-color: var(--signal); }
#panel select option { background: var(--case); color: var(--ink); }
#panel input[type="checkbox"] { accent-color: var(--signal); }

#panel footer {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 5px;
}

/* Both footer buttons say what they do when pressed, and neither is styled as
   a primary call to action: copying a link and restoring defaults are things
   the operator goes looking for, not things the panel should be urging. */
#panel footer button {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-inset);
  background: var(--case-sunken);
  color: var(--ink-dim);
  font: 600 13px/1 var(--ui);
  cursor: pointer;
  transition: color 120ms ease-out, border-color 120ms ease-out;
}
#panel footer button:hover { color: var(--ink); border-color: var(--signal); }
#panel footer button:active { transform: translateY(1px); }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 3px; }

/* ---- light theme -------------------------------------------------------- */
/* Almost all of it is now four token values instead of the sixty-odd rules
   this used to be. Recolouring by hand meant every new element in the chrome
   had to be remembered twice, and the settings panel proved the point by
   shipping white-on-white the first time round.

   The light casing is a cool neutral grey, the colour of a painted faceplate.
   Deliberately not the warm cream that light interfaces default to: it would
   put the whole palette on the warm side and leave the three platform accents
   with nothing to sit against. */
body[data-theme="light"] {
  --case: #eceef0;
  --case-raised: #ffffff;
  --case-sunken: rgba(20, 24, 28, 0.05);

  --rule: rgba(20, 24, 28, 0.11);
  --rule-strong: rgba(20, 24, 28, 0.18);

  /* Light still comes from above, but on a pale surface the top edge is the
     white one and the shade below it is barely there. */
  --edge-top: rgba(255, 255, 255, 0.9);
  --edge-bottom: rgba(20, 24, 28, 0.06);

  --ink: #1d2124;
  --ink-dim: #565d62;
  --ink-faint: #7d858a;

  /* The same orange, darkened until it clears contrast on a pale ground. */
  --signal: #a24d12;

  --lift:
    0 1px 2px rgba(20, 24, 28, 0.12),
    0 14px 34px -10px rgba(20, 24, 28, 0.22);
  --lift-low:
    0 1px 2px rgba(20, 24, 28, 0.1),
    0 6px 16px -6px rgba(20, 24, 28, 0.18);

  --fg-dim: #5c6367;
}

/* The opaque fallbacks are literal colours, so they need stating twice. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  body[data-theme="light"] #panel,
  body[data-theme="light"] #card { background: rgba(240, 242, 244, 0.95); }
  body[data-theme="light"] #gear,
  body[data-theme="light"] #tobottom { background: rgba(240, 242, 244, 0.75); }
}

/* Shadows on a pale page have to come from the text's own colour: a black glow
   around dark text smears it instead of separating it from the video. */
body[data-theme="light"][data-bg="none"] #counters,
body[data-theme="light"][data-bg="none"] a { text-shadow: 0 1px 2px rgba(255, 255, 255, .95); }
body[data-theme="light"][data-bg="none"] .msg {
  text-shadow: 0 1px 2px rgba(255, 255, 255, .95), 0 0 0.5em rgba(255, 255, 255, .8);
}
body[data-theme="light"] .badge-icon,
body[data-theme="light"] .badge-img,
body[data-theme="light"] .icon {
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.18));
}

body[data-theme="light"] #zoom { background: rgba(255, 255, 255, 0.97); }
body[data-theme="light"] #notice { background: rgba(255, 255, 255, 0.86); }
body[data-theme="light"] #avatar-zoom { background: rgba(228, 233, 238, 0.78); }

/* The monogram sits on its own tinted circle, not on the card. */
body[data-theme="light"] #card-avatar { color: #f8f9fa; }
body[data-theme="light"] #card-list li:hover { background: rgba(20, 24, 28, 0.05); }

/* Scrollbar thumbs are white at low alpha in the dark theme and vanish here. */
body[data-theme="light"] #card-list,
body[data-theme="light"] #panel { scrollbar-color: rgba(20, 24, 28, 0.28) transparent; }
body[data-theme="light"] #card-list::-webkit-scrollbar-thumb,
body[data-theme="light"] #panel::-webkit-scrollbar-thumb { background: rgba(20, 24, 28, 0.22); }
body[data-theme="light"] #card-list::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 24, 28, 0.36);
  background-clip: content-box;
}

/* ---- highlighted messages ------------------------------------------------ */
/* A first message and a points redemption are the two moments a streamer is
   meant to catch in a moving wall of text. Both get a tinted plate and a small
   labelled row above the message, and they keep their platform rail — where it
   came from still matters. Colours are their own, not the platform accent:
   the highlight has to read the same whichever chat it arrived in. */

.msg.highlight {
  --hl: var(--fg-dim);
  background: color-mix(in srgb, var(--hl) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hl) 26%, transparent);
}
/* Older engines without color-mix fall back to no tint rather than to a broken
   colour — the label row alone still carries the meaning. */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .msg.highlight { background: rgba(255, 255, 255, 0.07); }
}

.msg.highlight-reward { --hl: #f0a742; }
.msg.highlight-first  { --hl: #4bc07a; }

.hl-label {
  display: flex;
  align-items: center;
  gap: 0.32em;
  margin-bottom: 0.12em;
  font-size: 0.78em;
  font-weight: 700;
  line-height: 1.3;
  color: var(--hl);
  /* The reward title is whatever the streamer typed into their reward list and
     can be long; one line, cut, rather than pushing the message down. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hl-label > span { overflow: hidden; text-overflow: ellipsis; }
.hl-icon { width: 1.05em; height: 1.05em; flex: none; }

/* A redemption with no text of its own is only the label row; the empty body
   would otherwise leave a blank line under it. */
.msg.highlight .body:empty { display: none; }
.msg.highlight .body:empty + .sep { display: none; }

body[data-theme="light"] .msg.highlight-reward { --hl: #a86a00; }
body[data-theme="light"] .msg.highlight-first  { --hl: #1d7a45; }
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  body[data-theme="light"] .msg.highlight { background: rgba(20, 28, 45, 0.06); }
}

/* Over video there is no plate to tint, so the label carries it alone. */
body[data-bg="none"] .msg.highlight { background: none; box-shadow: none; }

@media (prefers-reduced-motion: reduce) { .msg.highlight { box-shadow: none; } }

/* The panel's own background was switched to light, but everything inside it
   kept its dark-theme colours: labels at #b9c2d0, section headings at #939eb4
   and a select with white text on a 8%-white fill. All of that is near-white on
   near-white — the panel went blank rather than unreadable-dark, which is why
   it looked like a rendering fault instead of a missing rule. */
body[data-theme="light"] #panel { color: #1b2331; }
body[data-theme="light"] #panel h2 { color: #5c6678; }
body[data-theme="light"] #close { color: #6b7488; }
body[data-theme="light"] .row { color: #333d4d; }
body[data-theme="light"] .row output { color: #5c6678; }

body[data-theme="light"] #panel select,
body[data-theme="light"] #panel footer button {
  background: rgba(20, 28, 45, 0.05);
  color: #1b2331;
  border-color: rgba(20, 28, 45, 0.18);
}
body[data-theme="light"] #panel footer button:hover {
  background: rgba(20, 28, 45, 0.1);
  border-color: rgba(20, 28, 45, 0.28);
}
/* The dropdown is drawn by the OS, so it needs its own pair — it does not
   inherit the panel's colours. */
body[data-theme="light"] #panel select option { background: #ffffff; color: #1b2331; }
body[data-theme="light"] #panel input[type="color"] { border-color: rgba(20, 28, 45, 0.2); }

/* Card internals that sit on the light panel material for the same reason. */
body[data-theme="light"] .card-count { color: #333d4d; }
body[data-theme="light"] #card-list li { color: #1b2331; }

/* ---- accent ------------------------------------------------------------- */
/* The signal colour, and nothing else. It marks focus, the active state of a
   control and the total viewer count — never decoration — so switching it
   changes what "active" looks like without touching the casing greys the whole
   interface is built from.

   Each has to be stated twice. The dark values are chosen to sit on a near
   black casing; on the pale one they would fail contrast, so every accent
   carries a darkened twin. The two-attribute selector is what lets these win
   over both :root and the light theme block above, whatever order they end up
   in.

   Set with MCHAT_ACCENT in .env, in the URL as &accent=, or in the panel. */

/* Signal orange, from the tally and warning lamps on broadcast gear. */
body[data-accent="orange"] { --signal: #e07b39; }
body[data-theme="light"][data-accent="orange"] { --signal: #a24d12; }

/* Brass — the same family, further from red and closer to a lit filament. */
body[data-accent="amber"] { --signal: #d2a24c; }
body[data-theme="light"][data-accent="amber"] { --signal: #8a6416; }

/* The blue this interface started on. Kept as an option because it is the one
   accent that reads as cool against the warm casing rather than with it, which
   some people will prefer; be aware it sits close to the VK rail colour. */
body[data-accent="blue"] { --signal: #6f8cff; }
body[data-theme="light"][data-accent="blue"] { --signal: #3d51c4; }

/* ---- message entrance, selectable ---------------------------------------- */
/* "smooth" is the pair of curves defined further up. The other two are for
   chats fast enough that motion becomes noise, and for anyone who does not want
   it. Set in the panel, in the URL as &anim=, or as the server default via
   MCHAT_ANIM in .env. */

body[data-anim="quick"] .msg {
  animation:
    msg-fade 120ms linear both,
    msg-rise 160ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

/* Not "faster" — none. A row that appears instantly cannot be mistaken for one
   still arriving, which is what a very short animation looks like at speed. */
body[data-anim="none"] .msg { animation: none; }
body[data-anim="none"] .msg.leaving { animation: none; opacity: 0; }

/* Panel internals need no colour overrides any more: every one of them reads a
   token. What is left here are the two things a token cannot carry — the OS
   paints option lists itself, and a colour input's swatch border. */
body[data-theme="light"] #panel select option { background: #ffffff; color: #1d2124; }
body[data-theme="light"] #panel input[type="color"] { border-color: rgba(20, 24, 28, 0.25); }

/* Badges in the participant card, beside the message count. Same glyphs and
   the same size as in the chat behind it — a moderator's sword should not be a
   different mark depending on where it is read. */
.card-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
  margin-right: 0.55em;
  vertical-align: -0.1em;
}
.card-badges .badge-icon,
.card-badges .badge-img { width: 1.05em; height: 1.05em; }
.card-badges .badge-img { border-radius: 2px; object-fit: contain; }

/* Checkbox pairs. Their labels are short and their control is one glyph wide,
   so a full row each wasted most of the panel's width and all of the height
   that ran it off the bottom of a 1080p screen. */
.checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 10px;
}
.checks .row.check { margin-bottom: 2px; }


/* Touch. A 22px row is a comfortable click and an uncomfortable tap, so the
   controls grow where the pointer is coarse — phones and tablets — without
   costing anything on a desktop where the panel is already tight for height. */
@media (pointer: coarse) {
  .row { min-height: 34px; margin-bottom: 5px; }
  #panel select { padding: 6px; }
  #panel input[type="color"] { width: 40px; height: 28px; }
  #close { width: 36px; height: 36px; font-size: 22px; }
  #gear { width: 44px; height: 44px; }
  #gear svg { width: 22px; height: 22px; }
}

/* A short window — a phone in landscape, or a small OBS preview — cannot fit
   the panel however it is laid out, so it scrolls. Stated rather than left to
   chance: the grid above would otherwise be free to overflow the viewport. */
@media (max-height: 560px) {
  #panel { max-height: calc(100vh - 16px); }
}

/* ---- top fade, for OBS ----------------------------------------------------- */
/* A mask rather than a gradient laid over the top: the overlay's background is
   usually transparent video, and a painted gradient would have to match
   whatever colour is behind it. A mask makes the messages themselves fade to
   transparent, which looks right over any scene and over every bgMode.
   Fixed to the list's own box, so it stays at the top edge while the content
   scrolls underneath it. Only while something is actually hidden above —
   see updateClip() in overlay.js. */
#chat.faded.clipped {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--top-fade, 18%));
          mask-image: linear-gradient(to bottom, transparent 0, #000 var(--top-fade, 18%));
}
