/* --- Themes (internal/social/appearance.go, static/appearance.js) -------------------------------------
   hangspace is built from the logo: Night paper, white ink, two grays for what is secondary, and ONE
   brand accent (--accent, pink by default, set in the shared block below and nowhere else). The accent is
   what is selected, primary or alive: filled buttons (--fill, --primary), the selected item in the rail and
   the side column, focus rings and switches (--emphasis, --tint-ink), badges, mentions, own messages, links
   under the pointer and the ring of whoever speaks in voice. On Light, where pink on white is too light,
   lines and text take its deep shade. Letter avatars and space tiles get one of six identity colours
   (--avatar-1 … 6). Other colour is for status (errors, verified, voice, warnings, links) and for what
   people choose themselves (folder and role colours). After hangspace's own
   Night, Black and Light come named third-party palettes (Monokai, Catppuccin, Rosé Pine, Solarized) that
   people pick on purpose: they keep their own hues, drawn with the same components.
   Every colour of the site is a token here. <html data-theme="…"> picks a theme; logged out the page
   follows the system (static/appearance.js sets light or dark). A theme block names every base token,
   so a preview (any element with data-theme, e.g. in the settings) shows that theme inside another.
   The derived tokens below follow the base ones unless a theme sets them itself.
   internal/site/static_test.go checks that each theme is complete and that its text meets WCAG AA. */
:root {
  accent-color: var(--emphasis);
  /* Icons: three sizes and one stroke weight (px, not scaled with the size), so rows line up. */
  --icon-xs: 14px;
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-stroke: 1.6px;
  /* What people read (messages, captions, explanations, legal text): one size, 16px. Labels, names,
     times and buttons stay smaller. */
  --text-read: 16px;
  /* Rows of people and spaces (chats, friends, members, spaces, rooms): name and the line beneath it. */
  --row-name: 16px;
  --row-sub: 14px;
  /* Type: Unbounded (the wordmark's face) for the brand and page titles only, Instrument Sans for
     everything read, monospace only where characters must line up (codes, CSS, the IRC chat style). */
  --display: "Unbounded", "Instrument Sans", Arial, sans-serif;
  --sans: "Instrument Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  /* Corners echo the favicon's rounded square: tiles about 22 % of their size, cards and fields 12px. */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  font:
    16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
}
/* Over photos and videos: the same in every theme, so text on media stays readable. */
:root, [data-theme] {
  --media-bg: #000;
  --on-scrim: #fff;
  --scrim-soft: rgb(0 0 0 / .56);
  --scrim: rgb(0 0 0 / .66);
  --scrim-strong: rgb(0 0 0 / .9);
  --media-youtube: #3a1418;
  --media-spotify: #123a26;
  --media-soft: #111;
  /* Derived: a theme may set these itself. */
  --primary: var(--tint-ink);
  --brand: var(--tint-ink);
  --tick-read: var(--tint-ink);
  --bubble-in-ink: var(--ink);
  --bubble-out-ink: var(--ink);
  --reply-bg: color-mix(in srgb, var(--ink) 7%, transparent);
  --rule-soft: color-mix(in srgb, var(--rule) 75%, var(--paper));
  --sticker-alt: color-mix(in srgb, var(--emphasis) 78%, var(--paper));
  --on-mention: var(--paper);
  --knob: #fff;
  /* The signature accent of hangspace's own themes, set here and nowhere else: --accent is the colour
     (on the dark themes and behind dark text everywhere), --accent-deep its darker shade for Light, where the
     accent alone on white is too light (2:1); deep keeps 4.5:1 there. To re-colour hangspace, change these two
     lines (violet: #8b7cff and #5b45d6); the hover and everything below follow. Named palettes set --accent
     (and its family) to their own accent. */
  --accent: #f58bc0;
  --accent-deep: #b4296a;
  --accent-hover: color-mix(in srgb, var(--accent) 80%, #fff);
  --accent-contrast: #0d0b12;
  /* The accent where it stands alone on the paper (rings, the rail's marker, link text): deep on Light. */
  --accent-strong: var(--accent);
  /* What uses the accent, each its own token so a theme can keep its old colour there. */
  --speaking-ring: var(--speaking);
  --rail-current: var(--ink);
  --link-hover: var(--link);
  /* Filled controls (buttons, the selected rail item, pressed tools) and their text. */
  --fill: var(--emphasis);
  --fill-hover: var(--emphasis-hover);
  --on-fill: var(--paper);
  --mention-badge: var(--mention-me);
  --on-mention-badge: var(--on-mention);
  /* Identity colours: six for letter avatars and space tiles, the tone hashed from a person's name or a
     space's ID (avatarTone in static/app.js, social.PixelAvatar in Go: keep the three in step). Dark
     letters on every one (>= 4.5:1). Night, Black and Light use exactly these; named palettes set their own. */
  --avatar-1: #8b7cff;
  --avatar-1-ink: #0d0b12;
  --avatar-2: #ff9f5a;
  --avatar-2-ink: #0d0b12;
  --avatar-3: #3dd6c6;
  --avatar-3-ink: #0d0b12;
  --avatar-4: #f58bc0;
  --avatar-4-ink: #0d0b12;
  --avatar-5: #c6f26b;
  --avatar-5-ink: #0d0b12;
  --avatar-6: #6ab7ff;
  --avatar-6-ink: #0d0b12;
  /* Layers of the chats page: the rail on the paper, the side column (spaces, channels) and the open chat.
     A selected row in the side column is a step above the hover. */
  --layer-side: var(--control);
  --layer-pane: var(--surface);
  --selected: color-mix(in srgb, var(--ink) 7%, var(--hover));
}
/* Night: the default, the app icon's colours. */
:root, [data-theme="dark"] {
  color-scheme: dark;
  /* Layers, each a step up: page, surface (cards, the open chat), control (panels, the side column,
     fields), hover (rows under the pointer). */
  --paper: #0d0b12;
  --surface: #15131d;
  --control: #1d1a27;
  --hover: #272336;
  --ink: #fff;
  --muted: #a9a4ba;
  --rule: #2e2a3d;
  --field-rule: #6b6878;
  --emphasis: var(--accent);
  --emphasis-hover: var(--accent-hover);
  --tint: color-mix(in srgb, var(--accent) 14%, transparent);
  --tint-ink: var(--accent);
  --brand-2: #b9b5c6;
  /* The one filled button of a form (pill): --primary on it. */
  --primary-ink: var(--accent-contrast);
  --primary-hover: var(--accent-hover);
  --danger: #ff5d4f;
  --danger-tint: rgb(255 93 79 / .1);
  --danger-rule: #5a2d2d;
  --danger-solid: #b8312c;
  --danger-solid-hover: #a12a26;
  --danger-edge: #f2594b;
  --on-danger: #fff;
  --success: #93dbab;
  --success-rule: #2c4a37;
  --speaking: #93dbab;
  --warning: #e6c28c;
  --warning-rule: #574a2e;
  --link: #b7caf2;
  --mention-me: var(--accent-hover);
  --mention-me-bg: color-mix(in srgb, var(--accent) 14%, transparent);
  --mention-edge: var(--accent);
  --fresh: #fff;
  --on-fresh: #0d0b12;
  --bubble-in: #221f2e;
  --bubble-out: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --bubble-in-meta: #b9b5c6;
  --bubble-out-meta: #cdc9d8;
  --sender: #fff;
  --tick: #9a96a8;
  --reply-ink: #d7d4df;
  --chip-mine: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --chip-mine-rule: var(--accent);
  --chip-mine-ink: #fff;
  --shadow: #000;
  --backdrop: rgb(6 5 9 / .72);
  --scrollbar: #34303e;
  --toggle-off: #3a3645;
  /* hangspace's accent at work: badges, mentions, the speaking ring, the rail's marker, links on hover. */
  --badge: var(--accent);
  --on-badge: var(--accent-contrast);
  --scope-mention: var(--accent);
  --mention-badge: var(--accent);
  --on-mention-badge: var(--accent-contrast);
  --speaking-ring: var(--accent-strong);
  --rail-current: var(--accent-strong);
  --link-hover: var(--accent-strong);
  /* Folder and role colours people pick: kept, but quiet; pink is the brand's own pink. */
  --swatch-gray: #8e8a9c;
  --swatch-red: #e8685c;
  --swatch-orange: #e0a36e;
  --swatch-yellow: #d9c27a;
  --swatch-green: #86c79c;
  --swatch-teal: #7cc3c0;
  --swatch-blue: #8fb0e6;
  --swatch-purple: #b4a6e3;
  --swatch-pink: var(--accent);
  --name-1: #e9a978;
  --name-2: #e6c28c;
  --name-3: #d6d08a;
  --name-4: #9fd6ab;
  --name-5: #92d1d1;
  --name-6: #a9c1f0;
  --name-7: #b3b6f0;
  --name-8: #c3d996;
  --name-9: #8fc8ef;
  --name-10: #c9c6d3;
  --primary: var(--accent);
  --fill: var(--accent);
  --fill-hover: var(--accent-hover);
  --on-fill: var(--accent-contrast);
}
/* Black: Night's look on true black, for OLED screens. */
[data-theme="black"] {
  color-scheme: dark;
  --paper: #000;
  --surface: #0d0b12;
  --control: #18161f;
  --hover: #24212c;
  --ink: #fff;
  --muted: #b9b5c6;
  --rule: #24212c;
  --field-rule: #6b6878;
  --emphasis: var(--accent);
  --emphasis-hover: var(--accent-hover);
  --tint: color-mix(in srgb, var(--accent) 14%, transparent);
  --tint-ink: var(--accent);
  --brand-2: #b9b5c6;
  --primary-ink: var(--accent-contrast);
  --primary-hover: var(--accent-hover);
  --danger: #ff5d4f;
  --danger-tint: rgb(255 93 79 / .1);
  --danger-rule: #5a2d2d;
  --danger-solid: #b8312c;
  --danger-solid-hover: #a12a26;
  --danger-edge: #f2594b;
  --on-danger: #fff;
  --success: #93dbab;
  --success-rule: #2c4a37;
  --speaking: #93dbab;
  --warning: #e6c28c;
  --warning-rule: #574a2e;
  --link: #b7caf2;
  --mention-me: var(--accent-hover);
  --mention-me-bg: color-mix(in srgb, var(--accent) 14%, transparent);
  --mention-edge: var(--accent);
  --fresh: #fff;
  --on-fresh: #000;
  --bubble-in: #16141d;
  --bubble-out: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --bubble-in-meta: #b9b5c6;
  --bubble-out-meta: #cdc9d8;
  --sender: #fff;
  --tick: #9a96a8;
  --reply-ink: #d7d4df;
  --chip-mine: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --chip-mine-rule: var(--accent);
  --chip-mine-ink: #fff;
  --shadow: #000;
  --backdrop: rgb(0 0 0 / .75);
  --scrollbar: #2e2a38;
  --toggle-off: #34303e;
  /* hangspace's accent at work: badges, mentions, the speaking ring, the rail's marker, links on hover. */
  --badge: var(--accent);
  --on-badge: var(--accent-contrast);
  --scope-mention: var(--accent);
  --mention-badge: var(--accent);
  --on-mention-badge: var(--accent-contrast);
  --speaking-ring: var(--accent-strong);
  --rail-current: var(--accent-strong);
  --link-hover: var(--accent-strong);
  /* Pure black stays pure black: no layers, rules part them. */
  --layer-side: var(--paper);
  --layer-pane: var(--paper);
  --swatch-gray: #8e8a9c;
  --swatch-red: #e8685c;
  --swatch-orange: #e0a36e;
  --swatch-yellow: #d9c27a;
  --swatch-green: #86c79c;
  --swatch-teal: #7cc3c0;
  --swatch-blue: #8fb0e6;
  --swatch-purple: #b4a6e3;
  --swatch-pink: var(--accent);
  --name-1: #e9a978;
  --name-2: #e6c28c;
  --name-3: #d6d08a;
  --name-4: #9fd6ab;
  --name-5: #92d1d1;
  --name-6: #a9c1f0;
  --name-7: #b3b6f0;
  --name-8: #c3d996;
  --name-9: #8fc8ef;
  --name-10: #c9c6d3;
  --primary: var(--accent);
  --fill: var(--accent);
  --fill-hover: var(--accent-hover);
  --on-fill: var(--accent-contrast);
}
/* Light: the inverse, white paper and Night ink. */
[data-theme="light"] {
  color-scheme: light;
  --paper: #fff;
  --surface: #f6f5f8;
  --control: #eeedf2;
  --hover: #e4e2ea;
  --ink: #0d0b12;
  --muted: #6b6878;
  --rule: #e4e2ea;
  --field-rule: #8a8698;
  --emphasis: var(--accent-deep);
  --emphasis-hover: color-mix(in srgb, var(--accent-deep) 85%, #0d0b12);
  --tint: color-mix(in srgb, var(--accent) 16%, transparent);
  --tint-ink: var(--accent-deep);
  --brand-2: #6b6878;
  --primary-ink: var(--accent-contrast);
  --primary-hover: var(--accent-hover);
  --danger: #b3261e;
  --danger-tint: rgb(200 30 40 / .07);
  --danger-rule: #e8b0ac;
  --danger-solid: #c0322b;
  --danger-solid-hover: #a32923;
  --danger-edge: #d4453b;
  --on-danger: #fff;
  --success: #1d6e3a;
  --success-rule: #a9d4b6;
  --speaking: #1d6e3a;
  --warning: #85540d;
  --warning-rule: #e2cc9c;
  --link: #2a4f96;
  --mention-me: var(--accent-deep);
  --mention-me-bg: color-mix(in srgb, var(--accent) 18%, transparent);
  --mention-edge: var(--accent-deep);
  --on-mention: #fff;
  --fresh: #0d0b12;
  --on-fresh: #fff;
  --bubble-in: #f1f0f4;
  --bubble-out: color-mix(in srgb, var(--accent) 20%, #fff);
  --bubble-in-meta: #615e6e;
  --bubble-out-meta: #585565;
  --sender: #0d0b12;
  --tick: #6b6878;
  --reply-ink: #2a2733;
  --chip-mine: color-mix(in srgb, var(--accent) 22%, #fff);
  --chip-mine-rule: var(--accent-deep);
  --chip-mine-ink: #0d0b12;
  --shadow: rgb(13 11 18 / .22);
  --backdrop: rgb(13 11 18 / .42);
  --scrollbar: #cfccd8;
  --toggle-off: #8a8698;
  /* hangspace's accent at work: badges, mentions, the speaking ring, the rail's marker, links on hover. */
  --badge: var(--accent);
  --on-badge: var(--accent-contrast);
  --scope-mention: var(--accent);
  --mention-badge: var(--accent);
  --on-mention-badge: var(--accent-contrast);
  --speaking-ring: var(--accent-strong);
  --rail-current: var(--accent-strong);
  --link-hover: var(--accent-strong);
  /* Paper for the open chat, a gray side column. The accent alone on white is too light (2:1). */
  --accent-strong: var(--accent-deep);
  --layer-side: var(--surface);
  --layer-pane: var(--paper);
  --swatch-gray: #807c8e;
  --swatch-red: #c4483f;
  --swatch-orange: #b8651f;
  --swatch-yellow: #977a12;
  --swatch-green: #3d8a59;
  --swatch-teal: #2a817e;
  --swatch-blue: #4469b0;
  --swatch-purple: #7461b8;
  --swatch-pink: var(--accent-deep);
  --name-1: #9a5520;
  --name-2: #85540d;
  --name-3: #6b6410;
  --name-4: #2c6e3e;
  --name-5: #1f6a6a;
  --name-6: #2f559c;
  --name-7: #4c4fa6;
  --name-8: #4d6a1e;
  --name-9: #1e6290;
  --name-10: #57536a;
  --primary: var(--accent);
  --fill: var(--accent);
  --fill-hover: var(--accent-hover);
  --on-fill: var(--accent-contrast);
  --sticker-alt: var(--emphasis-hover);
}
/* Monokai (the classic editor palette). */
[data-theme="monokai"] {
  color-scheme: dark;
  --paper: #272822;
  --surface: #2e2f29;
  --control: #3e3d32;
  --hover: #49483e;
  --ink: #f8f8f2;
  --muted: #b8b4a0;
  --rule: #49483e;
  --field-rule: #8f8b77;
  --emphasis: #e6db74;
  --emphasis-hover: #f2ea9e;
  --accent: var(--emphasis);
  --accent-hover: var(--emphasis-hover);
  --accent-contrast: var(--paper);
  /* Where hangspace's themes use the accent, this palette keeps its own colours (Night's block applies at :root too). */
  --speaking-ring: var(--speaking);
  --rail-current: var(--ink);
  --link-hover: var(--link);
  --fill: var(--emphasis);
  --fill-hover: var(--emphasis-hover);
  --on-fill: var(--paper);
  --mention-badge: var(--mention-me);
  --on-mention-badge: var(--on-mention);
  --tint: rgb(249 38 114 / .14);
  --tint-ink: #ff8ab2;
  --brand: #f92672;
  --brand-2: #fd971f;
  --primary: #f92672;
  --primary-ink: #1a1a16;
  --primary-hover: #ff5c93;
  --danger: #ff8db0;
  --danger-tint: rgb(249 38 114 / .14);
  --danger-rule: #7a2a44;
  --danger-solid: #c4164f;
  --danger-solid-hover: #d91e5c;
  --danger-edge: #ff6b9d;
  --on-danger: #fff;
  --success: #a6e22e;
  --success-rule: #4c5f1d;
  --speaking: #a6e22e;
  --warning: #fd971f;
  --warning-rule: #6e5021;
  --link: #66d9ef;
  --mention-me: #d9c2ff;
  --mention-me-bg: rgb(174 129 255 / .14);
  --mention-edge: #ae81ff;
  --scope-mention: #fd971f;
  --on-mention: #1a1a16;
  --badge: #f92672;
  --on-badge: #000;
  --fresh: #a6e22e;
  --on-fresh: #000;
  --bubble-in: #3e3d32;
  --bubble-out: #443f56;
  --bubble-in-meta: #c2bea9;
  --bubble-out-meta: #d0c8e6;
  --sender: #ae81ff;
  --tick: #c2bea9;
  --tick-read: #a6e22e;
  --reply-ink: #e2e0d4;
  --chip-mine: #443f56;
  --chip-mine-rule: #ae81ff;
  --chip-mine-ink: #e4d9ff;
  --shadow: #000;
  --backdrop: rgb(0 0 0 / .6);
  --scrollbar: #5b5a4d;
  --toggle-off: #5b5a4d;
  --swatch-gray: #8f8b77;
  --swatch-red: #f92672;
  --swatch-orange: #fd971f;
  --swatch-yellow: #e6db74;
  --swatch-green: #a6e22e;
  --swatch-teal: #4ec9b0;
  --swatch-blue: #66d9ef;
  --swatch-purple: #ae81ff;
  --swatch-pink: #f92672;
  --avatar-1: #352c48;
  --avatar-1-ink: #ae81ff;
  --avatar-2: #3a4426;
  --avatar-2-ink: #a6e22e;
  --avatar-3: #4a3a24;
  --avatar-3-ink: #fd971f;
  --avatar-4: #24414a;
  --avatar-4-ink: #66d9ef;
  --avatar-5: #4a2433;
  --avatar-5-ink: #ff6b9d;
  --avatar-6: #45421f;
  --avatar-6-ink: #e6db74;
  --name-1: #ff6b9d;
  --name-2: #fd971f;
  --name-3: #e6db74;
  --name-4: #a6e22e;
  --name-5: #66d9ef;
  --name-6: #7fb2ff;
  --name-7: #ae81ff;
  --name-8: #ff8a80;
  --name-9: #c4ef6b;
  --name-10: #ff8fd2;
}
/* Catppuccin Mocha. */
[data-theme="catppuccin"] {
  color-scheme: dark;
  --paper: #1e1e2e;
  --surface: #181825;
  --control: #313244;
  --hover: #45475a;
  --ink: #cdd6f4;
  --muted: #a6adc8;
  --rule: #45475a;
  --field-rule: #7f849c;
  --emphasis: #b4befe;
  --emphasis-hover: #cdd6f4;
  --accent: var(--emphasis);
  --accent-hover: var(--emphasis-hover);
  --accent-contrast: var(--paper);
  /* Where hangspace's themes use the accent, this palette keeps its own colours (Night's block applies at :root too). */
  --speaking-ring: var(--speaking);
  --rail-current: var(--ink);
  --link-hover: var(--link);
  --fill: var(--emphasis);
  --fill-hover: var(--emphasis-hover);
  --on-fill: var(--paper);
  --primary: var(--tint-ink);
  --mention-badge: var(--mention-me);
  --on-mention-badge: var(--on-mention);
  --tint: rgb(203 166 247 / .14);
  --tint-ink: #cba6f7;
  --brand: #f5c2e7;
  --brand-2: #fab387;
  --primary-ink: #11111b;
  --primary-hover: #f5c2e7;
  --danger: #f38ba8;
  --danger-tint: rgb(243 139 168 / .14);
  --danger-rule: #6b3a4e;
  --danger-solid: #f38ba8;
  --danger-solid-hover: #eba0ac;
  --danger-edge: #f38ba8;
  --on-danger: #11111b;
  --success: #a6e3a1;
  --success-rule: #3f5a45;
  --speaking: #a6e3a1;
  --warning: #fab387;
  --warning-rule: #6b4d3c;
  --link: #89b4fa;
  --mention-me: #f5c2e7;
  --mention-me-bg: rgb(245 194 231 / .16);
  --mention-edge: #cba6f7;
  --scope-mention: #fab387;
  --on-mention: #11111b;
  --badge: #f38ba8;
  --on-badge: #11111b;
  --fresh: #a6e3a1;
  --on-fresh: #11111b;
  --bubble-in: #313244;
  --bubble-out: #45395e;
  --bubble-in-meta: #a6adc8;
  --bubble-out-meta: #c3bce0;
  --sender: #b4befe;
  --tick: #a6adc8;
  --tick-read: #89dceb;
  --reply-ink: #bac2de;
  --chip-mine: #45395e;
  --chip-mine-rule: #cba6f7;
  --chip-mine-ink: #e4d4fb;
  --shadow: #11111b;
  --backdrop: rgb(17 17 27 / .7);
  --scrollbar: #45475a;
  --toggle-off: #45475a;
  --swatch-gray: #7f849c;
  --swatch-red: #f38ba8;
  --swatch-orange: #fab387;
  --swatch-yellow: #f9e2af;
  --swatch-green: #a6e3a1;
  --swatch-teal: #94e2d5;
  --swatch-blue: #89b4fa;
  --swatch-purple: #cba6f7;
  --swatch-pink: #f5c2e7;
  --avatar-1: #3b3452;
  --avatar-1-ink: #cba6f7;
  --avatar-2: #2c3f3b;
  --avatar-2-ink: #a6e3a1;
  --avatar-3: #45372f;
  --avatar-3-ink: #fab387;
  --avatar-4: #2b3650;
  --avatar-4-ink: #89b4fa;
  --avatar-5: #45334a;
  --avatar-5-ink: #f5c2e7;
  --avatar-6: #25403d;
  --avatar-6-ink: #94e2d5;
  --name-1: #f5c2e7;
  --name-2: #fab387;
  --name-3: #f9e2af;
  --name-4: #a6e3a1;
  --name-5: #94e2d5;
  --name-6: #89b4fa;
  --name-7: #cba6f7;
  --name-8: #f38ba8;
  --name-9: #89dceb;
  --name-10: #f2cdcd;
}
/* Rosé Pine (main). */
[data-theme="rose-pine"] {
  color-scheme: dark;
  --paper: #191724;
  --surface: #1f1d2e;
  --control: #26233a;
  --hover: #403d52;
  --ink: #e0def4;
  --muted: #908caa;
  --rule: #403d52;
  --field-rule: #6e6a86;
  --emphasis: #ebbcba;
  --emphasis-hover: #f4d6d4;
  --accent: var(--emphasis);
  --accent-hover: var(--emphasis-hover);
  --accent-contrast: var(--paper);
  /* Where hangspace's themes use the accent, this palette keeps its own colours (Night's block applies at :root too). */
  --speaking-ring: var(--speaking);
  --rail-current: var(--ink);
  --link-hover: var(--link);
  --fill: var(--emphasis);
  --fill-hover: var(--emphasis-hover);
  --on-fill: var(--paper);
  --primary: var(--tint-ink);
  --mention-badge: var(--mention-me);
  --on-mention-badge: var(--on-mention);
  --tint: rgb(235 188 186 / .14);
  --tint-ink: #ebbcba;
  --brand: #eb6f92;
  --brand-2: #f6c177;
  --primary-ink: #191724;
  --primary-hover: #f4d6d4;
  --danger: #eb6f92;
  --danger-tint: rgb(235 111 146 / .14);
  --danger-rule: #5c2e44;
  --danger-solid: #eb6f92;
  --danger-solid-hover: #f088a6;
  --danger-edge: #eb6f92;
  --on-danger: #191724;
  --success: #9ccfd8;
  --success-rule: #2f4f5a;
  --speaking: #9ccfd8;
  --warning: #f6c177;
  --warning-rule: #5c4a30;
  --link: #9ccfd8;
  --mention-me: #c4a7e7;
  --mention-me-bg: rgb(196 167 231 / .14);
  --mention-edge: #c4a7e7;
  --scope-mention: #f6c177;
  --on-mention: #191724;
  --badge: #eb6f92;
  --on-badge: #191724;
  --fresh: #9ccfd8;
  --on-fresh: #191724;
  --bubble-in: #26233a;
  --bubble-out: #352d4a;
  --bubble-in-meta: #a5a1bf;
  --bubble-out-meta: #b9b0d4;
  --sender: #c4a7e7;
  --tick: #a5a1bf;
  --tick-read: #ebbcba;
  --reply-ink: #cfcde6;
  --chip-mine: #352d4a;
  --chip-mine-rule: #c4a7e7;
  --chip-mine-ink: #e3d5f5;
  --shadow: #0b0a12;
  --backdrop: rgb(11 10 18 / .7);
  --scrollbar: #403d52;
  --toggle-off: #403d52;
  --swatch-gray: #908caa;
  --swatch-red: #eb6f92;
  --swatch-orange: #f2a272;
  --swatch-yellow: #f6c177;
  --swatch-green: #95c9a0;
  --swatch-teal: #9ccfd8;
  --swatch-blue: #5ea8c7;
  --swatch-purple: #c4a7e7;
  --swatch-pink: #eb6f92;
  --avatar-1: #352d4a;
  --avatar-1-ink: #c4a7e7;
  --avatar-2: #233a45;
  --avatar-2-ink: #9ccfd8;
  --avatar-3: #3e3127;
  --avatar-3-ink: #f6c177;
  --avatar-4: #3d2a3a;
  --avatar-4-ink: #ebbcba;
  --avatar-5: #40233a;
  --avatar-5-ink: #eb6f92;
  --avatar-6: #26382c;
  --avatar-6-ink: #95c9a0;
  --name-1: #eb6f92;
  --name-2: #f6c177;
  --name-3: #ebbcba;
  --name-4: #9ccfd8;
  --name-5: #c4a7e7;
  --name-6: #7fb6cc;
  --name-7: #e0a7d8;
  --name-8: #f09a8a;
  --name-9: #a8d3a4;
  --name-10: #f2c6c4;
}
/* Solarized dark. Text one step brighter than the palette's body tones, so it passes AA. */
[data-theme="solarized-dark"] {
  color-scheme: dark;
  --paper: #002b36;
  --surface: #073642;
  --control: #0d3f4b;
  --hover: #1a4b57;
  --ink: #eee8d5;
  --muted: #a3b1b1;
  --rule: #1f4e5a;
  --field-rule: #839496;
  --emphasis: #93a1a1;
  --emphasis-hover: #eee8d5;
  --accent: var(--emphasis);
  --accent-hover: var(--emphasis-hover);
  --accent-contrast: var(--paper);
  /* Where hangspace's themes use the accent, this palette keeps its own colours (Night's block applies at :root too). */
  --speaking-ring: var(--speaking);
  --rail-current: var(--ink);
  --link-hover: var(--link);
  --fill: var(--emphasis);
  --fill-hover: var(--emphasis-hover);
  --on-fill: var(--paper);
  --mention-badge: var(--mention-me);
  --on-mention-badge: var(--on-mention);
  --tint: rgb(211 54 130 / .14);
  --tint-ink: #f58ac0;
  --brand: #d33682;
  --brand-2: #b58900;
  --primary: #2aa198;
  --primary-ink: #001a21;
  --primary-hover: #35b8ae;
  --danger: #ff7b72;
  --danger-tint: rgb(220 50 47 / .16);
  --danger-rule: #6b2a2c;
  --danger-solid: #c22a27;
  --danger-solid-hover: #a82422;
  --danger-edge: #ff6b5f;
  --on-danger: #fdf6e3;
  --success: #a8bd2f;
  --success-rule: #3f5214;
  --speaking: #3fc1b5;
  --warning: #d9a521;
  --warning-rule: #5c4a14;
  --link: #74bdf2;
  --mention-me: #b8bbf5;
  --mention-me-bg: rgb(108 113 196 / .18);
  --mention-edge: #8a8fe0;
  --scope-mention: #e8834f;
  --on-mention: #002b36;
  --badge: #c02a74;
  --on-badge: #fdf6e3;
  --fresh: #859900;
  --on-fresh: #002b36;
  --bubble-in: #073642;
  --bubble-out: #0b4a63;
  --bubble-in-meta: #a3b1b1;
  --bubble-out-meta: #b5c4c4;
  --sender: #a8acf0;
  --tick: #a3b1b1;
  --tick-read: #3fc1b5;
  --reply-ink: #d4d8cc;
  --chip-mine: #0b4a63;
  --chip-mine-rule: #268bd2;
  --chip-mine-ink: #d6ecfa;
  --shadow: #001218;
  --backdrop: rgb(0 18 24 / .7);
  --scrollbar: #2a5a66;
  --toggle-off: #2a5a66;
  --swatch-gray: #839496;
  --swatch-red: #e8504d;
  --swatch-orange: #e0662b;
  --swatch-yellow: #b58900;
  --swatch-green: #859900;
  --swatch-teal: #2aa198;
  --swatch-blue: #268bd2;
  --swatch-purple: #8388d6;
  --swatch-pink: #f07ab5;
  --avatar-1: #1f3a5a;
  --avatar-1-ink: #a8acf0;
  --avatar-2: #1b4030;
  --avatar-2-ink: #a8bd2f;
  --avatar-3: #3a3a1a;
  --avatar-3-ink: #d9a521;
  --avatar-4: #083e54;
  --avatar-4-ink: #5fb0ec;
  --avatar-5: #3a1f3a;
  --avatar-5-ink: #f07ab5;
  --avatar-6: #0f3f3c;
  --avatar-6-ink: #3fc1b5;
  --name-1: #f07ab5;
  --name-2: #e8834f;
  --name-3: #d9a521;
  --name-4: #a8bd2f;
  --name-5: #3fc1b5;
  --name-6: #5fb0ec;
  --name-7: #a8acf0;
  --name-8: #ff7b72;
  --name-9: #93a1a1;
  --name-10: #e58fc9;
  --sticker-alt: #c9cfc4;
}
/* Solarized light. Text one step darker than the palette's body tones, so it passes AA. */
[data-theme="solarized-light"] {
  color-scheme: light;
  --paper: #fdf6e3;
  --surface: #eee8d5;
  --control: #e8e1cc;
  --hover: #ddd6c0;
  --ink: #073642;
  --muted: #4f656c;
  --rule: #d6cfb9;
  --field-rule: #657b83;
  --emphasis: #073642;
  --emphasis-hover: #586e75;
  --accent: var(--emphasis);
  --accent-hover: var(--emphasis-hover);
  --accent-contrast: var(--paper);
  /* Where hangspace's themes use the accent, this palette keeps its own colours (Night's block applies at :root too). */
  --speaking-ring: var(--speaking);
  --rail-current: var(--ink);
  --link-hover: var(--link);
  --fill: var(--emphasis);
  --fill-hover: var(--emphasis-hover);
  --on-fill: var(--paper);
  --mention-badge: var(--mention-me);
  --on-mention-badge: var(--on-mention);
  --tint: rgb(211 54 130 / .12);
  --tint-ink: #a8215f;
  --brand: #d33682;
  --brand-2: #a67e00;
  --primary: #1f6f9e;
  --primary-ink: #fdf6e3;
  --primary-hover: #185a80;
  --danger: #b3221f;
  --danger-tint: rgb(220 50 47 / .1);
  --danger-rule: #e2a8a0;
  --danger-solid: #c42d2a;
  --danger-solid-hover: #a82624;
  --danger-edge: #dc322f;
  --on-danger: #fdf6e3;
  --success: #506000;
  --success-rule: #b9c48a;
  --speaking: #13716a;
  --warning: #7a5a00;
  --warning-rule: #dbc58a;
  --link: #1b65a0;
  --mention-me: #4f54a8;
  --mention-me-bg: rgb(108 113 196 / .14);
  --mention-edge: #6c71c4;
  --scope-mention: #a83c10;
  --on-mention: #fdf6e3;
  --badge: #b02a6c;
  --on-badge: #fdf6e3;
  --fresh: #506000;
  --on-fresh: #fdf6e3;
  --bubble-in: #eee8d5;
  --bubble-out: #dcebf2;
  --bubble-in-meta: #4f656c;
  --bubble-out-meta: #3f5a66;
  --sender: #4f54a8;
  --tick: #4f656c;
  --tick-read: #1f6f9e;
  --reply-ink: #2c4a52;
  --chip-mine: #dcebf2;
  --chip-mine-rule: #268bd2;
  --chip-mine-ink: #0d4466;
  --shadow: rgb(7 54 66 / .3);
  --backdrop: rgb(0 43 54 / .4);
  --scrollbar: #cfc7b0;
  --toggle-off: #8f8a78;
  --swatch-gray: #6f8487;
  --swatch-red: #dc322f;
  --swatch-orange: #cb4b16;
  --swatch-yellow: #9c7600;
  --swatch-green: #6f8000;
  --swatch-teal: #1f8a82;
  --swatch-blue: #268bd2;
  --swatch-purple: #6c71c4;
  --swatch-pink: #d33682;
  --avatar-1: #e4e2f3;
  --avatar-1-ink: #4f54a8;
  --avatar-2: #e6ead0;
  --avatar-2-ink: #506000;
  --avatar-3: #f3e6c4;
  --avatar-3-ink: #7a5a00;
  --avatar-4: #dcebf2;
  --avatar-4-ink: #1b65a0;
  --avatar-5: #f5dce6;
  --avatar-5-ink: #a8215f;
  --avatar-6: #d5ece8;
  --avatar-6-ink: #13716a;
  --name-1: #a8215f;
  --name-2: #a23c0f;
  --name-3: #7a5a00;
  --name-4: #506000;
  --name-5: #13716a;
  --name-6: #1b65a0;
  --name-7: #4f54a8;
  --name-8: #b3221f;
  --name-9: #4f656c;
  --name-10: #9c2a7a;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
button,
input,
textarea {
  font: inherit;
}
button,
a.btn {
  cursor: pointer;
}
button,
:is(a, input, textarea, iframe, [tabindex]):focus-visible {
  outline-offset: 4px;
}
*:focus-visible {
  outline: 2px solid var(--emphasis);
}
#mast {
  position: relative;
  z-index: 4;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  /* The page reaches under the notch (viewport-fit=cover): the bar's content stays clear of it. */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}
.mast-inner {
  max-width: 1180px;
  padding: 10px 36px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
  flex-wrap: wrap;
}
nav,
.brand,
.actions,
.post-meta,
.byline,
.section-heading {
  display: flex;
  align-items: center;
}
/* The logo (static/brand), drawn as masks so it takes the theme's ink. The logo's rule: on desktop (the rail
   layout, 900 px and up) the "hangspace" wordmark, at least 80 px wide; narrower, the "h" (the favicon: a tile
   in the ink with the h cut out of it, so the bar's paper shows through). */
.brand {
  min-block-size: 34px;
  padding-inline: 2px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  display: block;
  inline-size: 32px;
  block-size: 32px;
  border-radius: 7px; /* the favicon's 14 of 64 */
  background: currentColor;
  mask: url(/static/brand/hangspace-h.svg) center / contain no-repeat, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
@media (min-width: 900px) {
  .brand-mark {
    inline-size: 112px;
    block-size: 16px;
    border-radius: 0;
    mask: url(/static/brand/hangspace-wordmark-white.svg) left center / contain no-repeat;
  }
}
.brand:hover {
  opacity: .82;
}
.actions {
  gap: 10px;
}
nav {
  gap: clamp(10px, 2.5vw, 20px);
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-inline-start: auto;
}
.nav-text,
.account-action {
  display: inline-flex;
  align-items: center;
  min-block-size: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 17px/1.25 var(--sans);
  text-decoration: none;
  white-space: nowrap;
}
.nav-text:hover,
.nav-text[aria-current="page"],
.nav-text[aria-pressed="true"],
.account-action:hover {
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
}
.nav-icon {
  display: grid;
  place-items: center;
  min-inline-size: 34px;
  min-block-size: 34px;
  border-radius: 10px;
  color: var(--muted);
}
.nav-icon:hover {
  color: var(--ink);
  background: var(--hover);
}
/* Selected: inverted, like the app icon. */
.nav-icon[aria-current="page"] {
  color: var(--on-fill);
  background: var(--fill);
}
.nav-icon .icon { width: var(--icon-md); height: var(--icon-md); }
/* The desktop app's update button (app.js desktopUpdateButton): a solid accent pill with a dot, "Restart to update", in the
   top bar; an icon with a dot badge in the rail. Only there while a version is ready (or must be downloaded by hand). */
.update-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 34px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--tint-ink);
  color: var(--paper);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.update-button[hidden] { display: none; }
.update-button:hover { filter: brightness(1.08); }
.update-button:disabled { opacity: 0.6; cursor: progress; }
.update-button:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: 2px; }
.update-button .icon { width: var(--icon-md); height: var(--icon-md); }
.update-button-dot, .update-notice-dot {
  flex: none;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: update-pulse 2s ease-in-out infinite;
}
@keyframes update-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .update-button-dot, .update-notice-dot { animation: none; } }
/* Phones: the top bar has little room, so the pill is the icon, the dot and a short word. */
@media (max-width: 480px) {
  .update-button { padding-inline: 9px; }
  .update-button-label { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* The notice at the top of the app (app.js updateNotice): a new web release (Reload) or the desktop app's update. */
.update-notice {
  position: fixed;
  z-index: 40;
  /* Below the top bar, so its navigation stays usable (wide: below the slim bar with the wordmark, beside the rail). */
  inset-block-start: calc(60px + env(safe-area-inset-top, 0px));
  inset-inline: 16px;
  margin-inline: auto;
  inline-size: fit-content;
  max-inline-size: min(560px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--tint-ink);
  border-radius: 14px;
  background: linear-gradient(var(--tint), var(--tint)), var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--shadow) 55%, transparent);
  font-size: 0.9rem;
  animation: update-notice-in 0.2s ease-out;
}
.update-notice[hidden] { display: none; }
.invite-notice .avatar { flex: none; inline-size: 28px; block-size: 28px; border-radius: 8px; }
.update-notice-dot { color: var(--tint-ink); }
.update-notice-text { flex: 1 1 auto; min-inline-size: 0; font-weight: 600; }
.update-notice-action {
  flex: none;
  min-block-size: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--tint-ink);
  color: var(--paper);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.update-notice-action:hover { filter: brightness(1.08); }
.update-notice-action:disabled { opacity: 0.6; cursor: progress; }
.update-notice-close {
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.update-notice-close:hover { background: var(--hover); color: var(--ink); }
.update-notice-close .icon { width: 18px; height: 18px; }
.update-notice-action:focus-visible, .update-notice-close:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: 2px; }
/* Movement only: a page whose animations are held (a background tab) still shows the notice. */
@keyframes update-notice-in { from { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .update-notice { animation: none; } }
@media (max-width: 480px) {
  .update-notice { inline-size: auto; max-inline-size: none; flex-wrap: wrap; gap: 8px; padding-inline-start: 12px; }
  .update-notice-text { flex-basis: calc(100% - 60px); }
  .update-notice-action { margin-inline-start: auto; }
}
@media (forced-colors: active) { .update-notice { border-color: CanvasText; } }
.account {
  position: relative;
}
.account-trigger {
  display: grid;
  place-items: center;
  min-inline-size: 34px;
  min-block-size: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
}
.account-trigger:hover,
.account-trigger[aria-expanded="true"] {
  background: var(--hover);
}
.account-trigger:focus-visible {
  outline: 2px solid var(--emphasis);
}
.account-name {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}
.btn,
button {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--control);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.4;
}
.btn:hover,
button:hover {
  background: var(--hover);
}
.primary {
  background: var(--fill);
  color: var(--on-fill);
  border-color: var(--fill);
}
.primary:hover {
  background: var(--fill-hover);
  border-color: var(--fill-hover);
}
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon * { vector-effect: non-scaling-stroke; }
/* Where an icon is the only content of a box, it must not sit on a text baseline. */
.icon-button .icon, .nav-icon .icon, .chats-scope-icon .icon, .menu-item .icon, .channel-icon .icon, .room-kind .icon { display: block; }
main {
  max-width: 748px;
  padding: 0 22px 60px;
  margin: auto;
}
/* A slim page title row. It leaves room for page tabs later. */
.section-heading {
  min-height: 44px;
  margin: 12px 0 10px;
  gap: 20px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: -6px;
  padding: 6px 10px 6px 4px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover { background: var(--hover); color: var(--ink); }
.back-link .icon { width: 18px; }
.section-heading h1 {
  margin: 0;
  font: 800 19px/24px var(--display);
  letter-spacing: -.03em;
}
/* Tabs that are links (the profile's Posts and Comments): drawn like the in-page tabs (.tab). */
.feed-tabs {
  gap: 2px;
  border-block-end: 1px solid var(--rule);
}
.feed-tab {
  position: relative;
  padding: 9px 14px;
  border-radius: 7px 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.feed-tab:hover { background: var(--hover); color: var(--ink); }
.feed-tab[aria-current="page"] { color: var(--ink); }
.feed-tab[aria-current="page"]::after { content: ""; position: absolute; inset: auto 8px 0; border-block-end: 2px solid var(--emphasis); }
/* The strip above the Home feed (spaces.js homeActivity): a few quiet lines, voice in green like voice presence. */
.home-activity { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; margin: 0 0 8px; }
.home-activity-item {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 2px;
  color: var(--muted); font-size: 13px; text-decoration: none;
}
.home-activity-item:hover { color: var(--ink); }
.home-activity-item .icon { width: var(--icon-sm); height: var(--icon-sm); flex: none; }
.home-activity-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-activity-item.voice { color: var(--speaking); }
.home-activity-title { display: none; }
@media (max-width: 1199px) { .home-activity-item:nth-of-type(n+4) { display: none; } }
.friend-button {
  flex: none;
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 700 11px/1.4 var(--sans);
  cursor: pointer;
}
.friend-button:hover { background: var(--hover); }
.friend-button.active { background: var(--control); color: var(--muted); }
.friend-button:disabled { opacity: .6; cursor: progress; }
.post {
  margin-bottom: 20px;
}
.feed-list .post {
  max-width: 600px;
  margin-inline: auto;
}
.post:has(+ .post) {
  padding-block-end: 12px;
  border-block-end: 1px solid var(--rule-soft);
  margin-block-end: 16px;
}
.post-meta {
  justify-content: space-between;
  gap: 12px;
  margin: 0 3px 11px;
}
.byline {
  gap: 10px;
  min-width: 0;
}
.avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 22%;
  flex: none;
}
.avatar svg {
  width: 100%;
  height: 100%;
}
.username {
  font-size: 14px;
  font-weight: 700;
}
.byline time {
  font: 11px/1.4 var(--sans);
  color: var(--muted);
}
.postlink {
  font: 11px var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: var(--muted);
  padding: 6px;
}
.postlink:hover {
  text-decoration: underline;
}
.postlink .icon {
  width: 13px;
  height: 13px;
}
.post-slot {
  position: relative;
  height: 600px;
  overflow: hidden;
  background: var(--paper);
  border-radius: 5px;
}
.post-slot.full-post {
  height: auto;
}
.post-slot .post-frame {
  height: 100%;
}
.full-post .post-frame {
  height: 0;
}
.post-preview-more:not([hidden]) {
  position: absolute;
  inset: auto 6px 6px auto;
  padding: 5px 10px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.post-preview-more:hover,
.post-preview-more:focus-visible,
.tile:hover .post-preview-more,
.tile:focus-within .post-preview-more {
  color: var(--emphasis);
  text-decoration: underline;
}
.post-preview-more:focus-visible {
  outline-offset: -3px;
}
.post-preview-more:active {
  color: var(--muted);
}
.post-frame {
  display: block;
  width: 100%;
  height: 600px;
  border: 0;
  border-radius: 5px;
  background: var(--paper);
}
.post-footer {
  margin-top: 6px;
  padding-top: 3px;
}
.post-actions,
.post-action {
  display: flex;
  align-items: center;
}
.post-actions {
  gap: 6px;
}
.post-action {
  min-block-size: 36px;
  gap: 5px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.post-action:hover {
  color: var(--ink);
  background: var(--hover);
}
.post-action[aria-disabled="true"] {
  cursor: wait;
}
.post-edit,
.post-report {
  margin-inline-start: auto;
}
.post-action-status {
  font-size: 13px;
}
.comments {
  margin: 24px 0;
}
.comments h2 {
  margin: 0 0 12px;
  font-size: 21px;
}
.comment-form {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.comment-form label {
  margin: 0;
}
.comment-form textarea {
  min-height: 88px;
  font: inherit;
}
.comment-form button {
  justify-self: start;
}
.comment-empty {
  color: var(--muted);
  font-size: var(--text-read);
}
.comment-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.comment {
  border-top: 1px solid var(--rule);
  padding: 12px 0;
}
.comment-text {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.comment-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.reply-branch {
  margin-top: 4px;
  padding-inline-start: clamp(10px, 3vw, 22px);
  border-inline-start: 1px solid var(--rule);
}
.reply-branch .reply-branch .reply-branch {
  padding-inline-start: 0;
  border-inline-start: 0;
}
.reply-branch > .comment-list {
  margin: 0;
}
.continue-thread {
  display: inline-block;
  margin-top: 6px;
}
.load-comments[aria-disabled="true"] {
  cursor: wait;
}
.small-link {
  font-size: 13px;
}
.center {
  display: block;
  margin: 18px auto;
}
.notice {
  color: var(--danger);
}
.auth,
.leave {
  max-width: 440px;
}
label {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  font-size: 14px;
  font-weight: 600;
}
input,
textarea {
  border: 1px solid var(--field-rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: 9px 12px;
  width: 100%;
}
textarea {
  min-height: 160px;
  resize: vertical;
  font: 14px/1.5 var(--mono);
}
.leave p {
  margin: 0;
  font-size: var(--text-read);
}
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 12px;
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}
.tools button {
  padding: 6px 10px;
}
.tools [aria-pressed="true"] {
  background: var(--fill);
  color: var(--on-fill);
}
.post-size {
  font-size: 14px;
}
[hidden] {
  display: none !important;
}
.status:empty {
  display: none;
}
.status {
  font-size: 14px;
}
.leave strong {
  word-break: break-word;
}
.destination {
  font: 12px var(--mono);
  word-break: break-all;
}
.empty {
  color: var(--muted);
}
.wall-page {
  overflow: hidden;
}
.wall-page #mast {
  position: fixed;
  inset-block-start: 16px;
  inset-inline-start: 16px;
  border: 0;
  border-radius: 8px;
}
.wall-nav > button {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wall-nav nav {
  position: absolute;
  inset-block-start: calc(100% + 5px);
  inset-inline-start: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-inline-size: 150px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.wall-nav .account-panel {
  inset-inline: 0 auto;
}
.wall-page main {
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0;
}
.wall-viewport {
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  cursor: grab;
  background-color: var(--paper);
}
.dragging {
  cursor: grabbing;
  user-select: none;
}
.feed-tail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  text-align: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 14px;
}
.wall-grid {
  --gap: 12px;
  --tile-width: clamp(310px, 32vw, 390px);
  --tile-height: clamp(255px, 36vh, 315px);
  position: relative;
  overflow: clip;
  overflow-anchor: none;
}
.wall-end {
  position: fixed;
  inset: auto 0 1rem;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.wall-coordinates {
  font: 12px var(--mono);
  color: var(--muted);
}
.wall-block {
  position: absolute;
  inset: 0 auto auto 0;
  width: max(100vw, calc(3 * (var(--tile-width) + var(--gap))));
  height: max(100dvh, calc(4 * (var(--tile-height) + var(--gap))));
  transform: translate(calc((var(--origin-x, 0) + var(--x)) * 100%), calc((var(--origin-y, 0) + var(--y)) * 100%));
  padding: calc(var(--gap) / 2);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
}
.tile {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--paper);
  border-radius: 10px;
  padding: 10px;
}
.tile .post-meta {
  flex: none;
}
.tile .post-slot {
  flex: 1;
  min-height: 0;
}
.tile iframe {
  pointer-events: none;
}
.tile > a.cover {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  cursor: inherit;
}
.tile > a:focus-visible {
  outline-offset: 0;
}
.tile .post-footer {
  position: relative;
  flex: none;
  pointer-events: none;
}
.tile .post-action {
  pointer-events: auto;
}
@media (pointer: coarse) {
  .post-action,
  .comment-form button {
    min-block-size: 44px;
  }
}
@media (max-width: 560px) {
  .mast-inner {
    padding: 8px 12px;
  }
  .btn,
  button {
    padding: 7px 10px;
  }
  main {
    padding: 0 12px 35px;
  }
  .section-heading {
    margin: 4px 2px 6px;
  }
  .byline {
    gap: 7px;
  }
  .byline time {
    font-size: 10px;
  }
  .post-meta {
    margin: 1px 1px 9px;
  }
  .form-card { margin-top: 12px; }
}

.language-picker {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 5px;
}
.media-players iframe { display: block; width: 100%; border: 0; margin-block: 8px; }
.spotify-player { height: 352px; }
.youtube-player { aspect-ratio: 16 / 9; min-height: 200px; }
.post { position: relative; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* The reaction button of a post and its picker: the quick six as a row, the rest behind "+". */
.reaction-control { position: relative; pointer-events: auto; }
.reaction-trigger { cursor: pointer; list-style: none; }
.reaction-trigger::-webkit-details-marker { display: none; }
.reaction-trigger:hover, .reaction-control[open] .reaction-trigger { color: var(--emphasis); }
.reaction-mine { font: 18px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.reaction-panel {
  width: min(300px, calc(100vw - 16px)); padding: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 16px; box-shadow: 0 5px 20px color-mix(in srgb, var(--shadow) 60%, transparent);
  pointer-events: auto;
}
:is(.reaction-panel:popover-open, details[open] > .reaction-panel) { display: flex; flex-direction: column; gap: 6px; }
.reaction-quick { display: flex; justify-content: space-between; gap: 2px; }
.reaction-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  max-height: 180px; overflow-y: auto; overscroll-behavior: contain;
  padding-top: 6px; border-top: 1px solid var(--rule);
}
.reaction-grid[hidden] { display: none; }
.reaction-grid .reaction-choice { width: auto; border-radius: 8px; height: 36px; }
.reaction-more { display: grid; place-items: center; color: var(--muted); }
.reaction-more .icon { width: var(--icon-sm); height: var(--icon-sm); }
details[open] > .reaction-panel { position: absolute; z-index: 3; bottom: 100%; left: 0; }
@supports (position-area: block-start) {
  .reaction-panel[popover] {
    position-area: block-start; inset: auto; margin: 4px 0;
    position-try-fallbacks: flip-block, block-start span-inline-end, block-start span-inline-start,
      block-end span-inline-end, block-end span-inline-start;
  }
}
/* Chips directly under the post, as under a chat message. */
.post-reactions { gap: 6px; margin: 8px 0 0; padding-inline: 2px; }
.post-reactions .reaction-chip { font-size: 15px; line-height: 24px; padding-inline: 10px; cursor: pointer; }
span.reaction-chip { cursor: default; }
.post-reactions .reaction-chip:hover:not(.mine) { background: var(--hover); }
.reaction-people { margin-inline-start: 2px; font-size: 13px; }
.reactors-dialog .reactors-filter { margin: 0 0 8px; }
.reactors-list { display: flex; flex-direction: column; }
.reactors-list .friend-row { align-items: center; }
.reactors-emoji { margin-inline-start: auto; font-size: 22px; line-height: 1; }
.shout-sticker {
  display: inline-block; padding: 3px 9px; border: 2px solid var(--ink);
  border-radius: 8px 5px 9px 5px; background: var(--emphasis); color: var(--paper);
  font: italic 900 15px/1.15 system-ui, sans-serif; letter-spacing: -.035em;
  transform: rotate(-3deg); box-shadow: 1px 2px 0 var(--shadow);
}
.shout-sticker.shout-emoji {
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; transform: none;
  font: 22px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.shout-sticker[data-phrase="peak"], .shout-sticker[data-phrase="let them cook"] {
  background: var(--sticker-alt); transform: rotate(2deg);
}

/* Chat open: theater layout. The page itself stops scrolling; the post scrolls on its own
   and the chat always fills the remaining space (beside the post on desktop, below it on phones). */
body.chat-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-page #mast { flex: none; }
.chat-page .mast-inner { max-width: none; padding-inline: 20px; }
.chat-page main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.chat-page .post-stage {
  flex: 0 1 auto;
  max-height: 45%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 12px 20px;
}
.chat-page .post-stage .section-heading { margin-block: 0; }
.post-chat {
  position: relative;
  flex: 1 1 0;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}
@media (min-width: 960px) {
  .chat-page main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 420px);
  }
  .chat-page .post-stage { max-height: none; padding: 0 32px 40px; }
  .chat-page .post-stage-inner { max-width: 960px; margin-inline: auto; }
  .chat-page .post-stage .section-heading { margin-block: 8px 4px; }
  .post-chat { min-height: 0; border-top: 0; border-inline-start: 1px solid var(--rule); }
}
.post-chat[hidden] { display: none; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
}
.chat-head h2:focus { outline: none; }
.chat-head h2 { margin: 0; flex: 1; color: var(--muted); font-size: 13px; font-weight: 600; }
.chat-live {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--danger-solid);
  color: var(--on-danger);
  font: bold 11px/1.5 var(--sans);
}
.chat-close {
  width: 32px; height: 32px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--muted);
}
.chat-close:hover { background: var(--hover); color: var(--ink); }
.chat-gate { padding: 28px 16px; text-align: center; color: var(--muted); }
.chat-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 0;
  font-size: var(--text-read);
  line-height: 1.55;
}
.chat-notice { margin: 4px 12px 10px; color: var(--muted); font-size: 13px; }
.chat-line {
  padding: 3px 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-line:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.chat-time { margin-inline-end: 6px; color: var(--muted); font: 11px var(--sans); }
.chat-author { font-weight: 700; }
.chat-text a { color: var(--link); }
/* Inline links in text take the accent under the pointer (--link-hover; Light's is the darker accent). */
:is(.chat-text, .friend-text, .legal-copy, .media-notice, .space-where, .audience-space, .note) a:hover { color: var(--link-hover); }
.chat-emote { font-size: 26px; line-height: 1.2; vertical-align: middle; }
.chat-line-own { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.chat-line-shout {
  margin: 4px 0;
  padding-block: 8px;
  border-inline-start: 3px solid var(--tint-ink);
  background: linear-gradient(90deg, var(--tint), transparent 70%);
}
.chat-shouted { color: var(--muted); }
.chat-line-shout .shout-sticker { margin-inline-start: 4px; }
.chat-jump {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  padding: 5px 14px; border: 0; border-radius: 99px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow) 65%, transparent);
}
.chat-jump[hidden] { display: none; }
.chat-form {
  position: relative;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
}
.chat-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--control);
  border: 2px solid transparent;
  border-radius: 6px;
}
.chat-field:focus-within { border-color: var(--tint-ink); background: var(--paper); }
.chat-field input {
  flex: 1; min-width: 0;
  padding: 9px 10px;
  border: 0; outline: 0;
  background: transparent; color: var(--ink);
}
.chat-emoji-toggle {
  width: 36px; height: 36px; margin-inline-end: 2px;
  border: 0; border-radius: 4px;
  background: transparent; font-size: 18px;
  filter: grayscale(1); opacity: .8;
}
.chat-emoji-toggle:hover, .chat-emoji-toggle[aria-expanded="true"] { filter: none; opacity: 1; background: var(--hover); }
.chat-emoji-panel {
  position: absolute; z-index: 3;
  right: 12px; bottom: calc(100% - 4px);
  width: min(320px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  padding: 8px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 6px 24px color-mix(in srgb, var(--shadow) 80%, transparent);
}
.chat-emoji-panel[hidden] { display: none; }
.chat-emoji {
  aspect-ratio: 1; padding: 0;
  border: 0; border-radius: 6px;
  background: transparent; font-size: 20px;
}
.chat-emoji:hover, .chat-emoji:focus-visible { background: var(--hover); }
.chat-hint { grid-column: 1 / -1; margin: 4px 2px 0; color: var(--muted); font-size: 11px; }
.chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-shouts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0 0 8px;
}
.chat-shout {
  min-height: 0;
  flex: none;
  padding: 2px 1px;
  border: 0;
  background: transparent;
}
.chat-shout .shout-sticker { font-size: 11px; padding: 1px 5px; border-width: 1.5px; transition: transform .12s; }
.chat-shout:hover .shout-sticker, .chat-shout:focus-visible .shout-sticker { transform: rotate(0) scale(1.08); }
.chat-shout:disabled { opacity: .5; }
.chat-send {
  flex: none;
  align-self: stretch;
  padding: 0 16px;
  border: 0; border-radius: 6px;
  background: var(--primary); color: var(--primary-ink);
  font-weight: 700;
}
.chat-send:hover { background: var(--primary-hover); }
.chat-send:disabled { opacity: .6; }
.chat-status { margin: 6px 0 0; color: var(--muted); font-size: .875rem; }
.chat-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .chat-shout .shout-sticker { transition: none; }
}

/* Post editor: the edit frame is the live preview. Creative mode adds the CSS panel beside it. */
.creative-page main { max-width: 1320px; }
.editor-workspace { display: grid; gap: 16px; }
.editor-canvas { min-width: 0; position: relative; }
.tools.formatting { margin: 0 0 8px; }
.formatting button { min-width: 36px; padding: 6px 9px; }
.tool-bold { font-weight: 900; }
.tool-italic { font-style: italic; font-family: Georgia, serif; }
.formatting [aria-pressed="true"] { background: var(--fill); color: var(--on-fill); }
.editframe {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
  border-radius: 12px;
  background: var(--media-bg);
}
.editor-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.css-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.css-panel-head h2 { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.css-panel textarea {
  height: 45vh;
  min-height: 220px;
  font-size: 13px;
  tab-size: 2;
  white-space: pre-wrap;
}
.css-matches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  color: var(--muted);
  font: 12px var(--mono);
}
.css-matches:empty::before { content: attr(data-empty); }
.css-matches-target { color: var(--tint-ink); font-weight: 700; margin-inline-end: 4px; }
.css-match { padding: 2px 9px; border-radius: 99px; font: 12px var(--mono); }
.css-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 960px) {
  .editor.creative .editor-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
    align-items: start;
  }
  .css-panel { position: sticky; top: calc(var(--shell-top, 0px) + 12px); }
  .css-panel textarea { height: calc(100vh - 230px); max-height: 760px; }
}

/* Media: cached cover with a gradient; the provider player loads on click. */
.media-facade {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-block: 8px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--media-soft);
  text-align: start;
}
.media-facade.media-spotify { aspect-ratio: auto; height: 352px; }
.media-cover { position: absolute; inset: 0; display: block; background: var(--media-soft); }
.media-cover.media-youtube { background: linear-gradient(135deg, var(--media-youtube), var(--media-soft) 70%); }
.media-cover.media-spotify { background: linear-gradient(135deg, var(--media-spotify), var(--media-soft) 70%); }
.media-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.media-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--scrim-strong), color-mix(in srgb, var(--media-bg) 40%, transparent) 42%, transparent 72%);
}
.media-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--on-scrim) 92%, transparent);
  box-shadow: 0 6px 24px var(--scrim-soft);
  transform: translate(-50%, -50%);
  transition: transform .15s ease, background .15s ease;
}
.media-play svg { display: block; width: 30px; height: 30px; fill: var(--media-soft); }
.media-facade:hover .media-play,
.media-facade:focus-visible .media-play,
.tile:hover .media-play { background: var(--brand); transform: translate(-50%, -50%) scale(1.08); }
.media-facade:hover .media-cover img,
.tile:hover .media-cover img { transform: scale(1.04); }
.media-caption {
  position: absolute;
  inset: auto 16px 14px;
  display: grid;
  gap: 2px;
  color: var(--on-scrim);
  text-shadow: 0 1px 3px var(--media-bg);
}
.media-provider { font: 700 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.media-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.media-author { font-size: 13px; opacity: .8; }
/* Link cards: the linked page's image, host, title and description, cached by our server. */
.link-cards { display: grid; gap: 8px; margin-block: 8px; }
.link-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.link-card:hover, .link-card:focus-visible { border-color: var(--muted); }
.link-card-image { display: block; width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; background: var(--media-soft); }
.link-card-text { display: grid; gap: 2px; padding: 10px 12px; min-width: 0; overflow-wrap: anywhere; }
.link-card-host { color: var(--muted); font: 11px/1.4 var(--sans); }
.link-card-title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 700;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.link-card-description {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.media-tile { position: relative; overflow: hidden; border-radius: 5px; }
.media-tile .media-play { top: 36%; width: 48px; height: 48px; }
.media-tile .media-play svg { width: 24px; height: 24px; }
.media-tile .media-title { font-size: 16px; }
.media-more {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--scrim);
  color: var(--on-scrim);
  font: 700 12px var(--sans);
}
@media (prefers-reduced-motion: reduce) {
  .media-cover img, .media-play { transition: none; }
  .media-facade:hover .media-cover img, .tile:hover .media-cover img { transform: none; }
}

/* Legal pages and links. Both languages are served; the reader's language hides the other. */
.site-footer {
  max-width: 748px;
  margin: 0 auto;
  padding: 18px 22px 32px;
  border-top: 1px solid var(--rule);
}
.site-footer nav,
.account-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 13px;
}
.site-footer a,
.account-legal a { color: var(--muted); }
.site-footer a:hover,
.account-legal a:hover,
.site-footer a[aria-current="page"],
.account-legal a[aria-current="page"] { color: var(--ink); }
.account-legal {
  flex-direction: column;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}
.wall-page .site-footer,
.chat-page .site-footer { display: none; }
html[data-lang="de"] .legal-copy[lang="en"],
html[data-lang="en"] .legal-copy[lang="de"] { display: none; }
.legal-copy {
  padding-block: 12px 24px;
  font-size: var(--text-read);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.legal-copy + .legal-copy { border-top: 1px solid var(--rule); }
.legal-copy h1 { margin: 20px 0 4px; font-size: 22px; }
.legal-copy h2 { margin: 28px 0 8px; font-size: 15px; }
.legal-copy p,
.legal-copy ul { margin: 0 0 10px; }
.legal-copy ul { padding-inline-start: 20px; }
.legal-copy li { margin-bottom: 4px; }
.legal-copy a { color: var(--ink); }
.legal-updated { color: var(--muted); font-size: 13px; }
.media-notice {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.media-notice a { color: var(--ink); }

/* Photo, video and GIF tools */
/* The chats' GIF picker in the editor: above the footer's tools (a bottom sheet on phones, as in chats). */
@media (min-width: 601px) {
  .editor-canvas > .gifpick { inset-block: auto 8px; inset-inline: 0 auto; }
}

/* Server-rendered posts. Readers see them before scripts run, and crawlers index them.
   The app then swaps in each post's own styled document. */
.ssr-post {
  position: relative;
}
.ssr-body {
  max-height: 600px;
  overflow: hidden;
  padding: 2px 3px;
  overflow-wrap: anywhere;
  mask-image: linear-gradient(#000 75%, transparent);
}
.ssr-body.full {
  max-height: none;
  mask-image: none;
}
.ssr-body :first-child {
  margin-top: 0;
}
.ssr-body img,
.ssr-body video {
  max-width: 100%;
  display: block;
  margin-inline: auto;
  max-height: 560px;
  width: auto;
  height: auto !important;
  object-fit: contain;
}
.ssr-more {
  display: inline-block;
  margin: 6px 3px 0;
  font-size: 13px;
  color: var(--muted);
}

/* In-app navigation: a thin progress bar while the next page loads. The delay hides it on fast loads. */
html.navigating,
html.navigating a {
  cursor: progress;
}
html.navigating::before {
  content: "";
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  height: 2px;
  background: var(--emphasis);
  transform-origin: left;
  animation: page-progress 8s cubic-bezier(.1, .7, .2, 1) .15s both;
  pointer-events: none;
}
@keyframes page-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(.92); }
}
/* Page swaps cross-fade the content while the site header stays in place. */
#mast {
  view-transition-name: mast;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 140ms;
}
@media (prefers-reduced-motion: reduce) {
  html.navigating::before {
    animation: none;
    transform: scaleX(.5);
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Names: the display name leads, the account name sits beneath it so every author stays recognisable. */
.name-block {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}
.name-block .display-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.display-name:hover { text-decoration: underline; }
.name-sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
}
.name-sub .username {
  flex: none;
  color: var(--muted);
  font: 400 12px/1.4 var(--sans);
  text-decoration: none;
}
.byline .name-sub time { font-size: 11px; }
.ssr-post .identity { display: grid; text-decoration: none; }
.ssr-post .identity .display-name { font-weight: 700; }
.ssr-post .identity .username { color: var(--muted); font: 400 12px var(--sans); }
.avatar-photo { overflow: hidden; background: var(--control); }
.avatar-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.account-profile {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.account-profile:hover, .account-profile:focus-visible { background: var(--hover); }
.account-profile-hint { color: var(--muted); font-size: 12px; }
.chat-author { text-decoration: none; }
.chat-author:hover { text-decoration: underline; }
.chat-handle { margin-inline-start: 5px; color: var(--muted); font: 11px var(--sans); }

/* Profile page. The card is a sandboxed document; everything below it is the site's own UI. */
.profile-page { padding-top: 16px; }
.profile-frame {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--paper);
}
.profile-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 14px 0 6px;
  padding: 12px 0;
  border-block: 1px solid var(--rule);
}
.profile-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 200px; }
.profile-who .name-block .display-name { font-size: 15px; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 4px; }
.profile-stat {
  padding: 5px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.profile-actions .friend-button { padding: 7px 16px; font-size: 13px; }
.profile-tabs { justify-content: flex-start; margin: 8px 0 16px; }
.profile-comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.profile-comment-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 13px;
}
.profile-comment-post { color: var(--muted); text-decoration: none; }
.profile-comment-post:hover { color: var(--ink); text-decoration: underline; }
.profile-comment-post strong { color: var(--ink); }
.profile-comment-post .username { font: 12px var(--sans); }
.profile-comment-meta time { font: 11px/1.8 var(--sans); }
.profile-comment .comment-text { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-ssr h1 { margin: 0; font-size: 26px; }
.profile-ssr .username { color: var(--muted); font: 14px var(--sans); }
.profile-ssr .bio { white-space: pre-line; }

/* Profile editor: live card preview, the profile fields, and the CSS panel beside them. */
.profile-preview { outline: 1px dashed var(--rule); outline-offset: 4px; }
.profile-fields { display: grid; gap: 4px; margin-top: 18px; }
.profile-field { position: relative; margin: 8px 0; }
.profile-field textarea { min-height: 96px; font: 15px/1.5 var(--sans); }
.profile-counter {
  justify-self: end;
  color: var(--muted);
  font: 400 11px var(--sans);
}
.profile-photo-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 14px;
  font-weight: 600;
}
.profile-photo-label { min-width: 110px; }
.profile-editor .css-panel h3 { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.profile-editor .css-matches { gap: 4px; }
@media (min-width: 960px) {
  .profile-editor .editor-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
    align-items: start;
  }
}
@media (max-width: 600px) {
  .profile-page { padding-top: 8px; }
  .profile-bar { gap: 8px 12px; }
}

/* Reports: the dialog is the same for posts, comments, chat messages and profiles. */
.profile-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.report-reasons {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
}
.report-reasons legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 600; }
.report-reason {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 7px;
  font-weight: 400;
  cursor: pointer;
}
.report-reason:hover { background: var(--hover); }
.report-reason:has(:checked) { background: var(--control); }
.report-reason input { flex: none; width: auto; margin: 0; accent-color: var(--emphasis); }
.report-details-label { margin: 14px 0 6px; }
.report-dialog textarea { min-height: 84px; font: 14px/1.5 var(--sans); }
.report-status:empty { display: none; }
.chat-report {
  margin-inline-start: 6px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  vertical-align: middle;
  opacity: 0;
}
.chat-report .icon { width: var(--icon-xs); height: var(--icon-xs); }
.chat-report:hover { background: transparent; color: var(--ink); }
.chat-line:hover .chat-report,
.chat-report:focus-visible { opacity: 1; }
@media (hover: none) {
  .chat-report { opacity: .6; }
}

/* --- Friends and their end-to-end encrypted chat ------------------------------------------- */
.nav-chats, .nav-friends { position: relative; }
.nav-chats.has-count::after, .nav-friends.has-count::after {
  content: attr(data-count);
  position: absolute;
  top: 1px;
  inset-inline-end: 0;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--badge);
  color: var(--on-badge);
  box-shadow: 0 0 0 2px var(--paper);
  font: 700 10px/16px var(--sans);
  text-align: center;
}
.friends-panel {
  margin: 0 0 16px;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
}
.friends-panel h2 { margin: 0 0 8px; font-size: 16px; }
.friends-panel p { margin: 0 0 12px; color: var(--muted); }
.friends-intro { color: var(--muted); font-size: var(--text-read); }
.friends-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.secure-notice { border-color: var(--warning-rule); }
.friend-add { display: flex; gap: 8px; margin-bottom: 4px; }
.friend-add input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
}
/* Discover: topics as a row of chips, the sort switch as plain text. */
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 8px; }
.topic-chip {
  min-block-size: 0; padding: 3px 11px; border: 1px solid var(--rule); border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
}
.topic-chip:hover { color: var(--ink); background: var(--surface); }
.topic-chip[aria-pressed="true"] { border-color: var(--muted); background: var(--hover); color: var(--ink); }
.sort-switch { display: flex; align-items: center; gap: 6px; margin-block-end: 4px; }
.sort-divider { color: var(--rule); }
.sort-switch .text-button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.friend-feedback { min-height: 1.5em; margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
.friend-section h2 {
  margin: 18px 0 6px;
  color: var(--muted);
  font: 600 13px var(--sans);
}
.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}
.friend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
a.friend-row:hover { background: var(--hover); }
.friend-unread {
  margin-inline-start: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--badge);
  color: var(--on-badge);
  font: 700 12px/18px var(--sans);
  text-align: center;
}
.friend-empty { color: var(--muted); }
.friend-control { display: contents; }
.friend-control a.friend-button { text-decoration: none; }

/* The chat fills the viewport below the header, like a messenger. */
body.friend-chat-page main { display: flex; flex-direction: column; height: calc(100dvh - 58px); padding-bottom: 12px; }
.friend-chat-head { display: flex; align-items: center; gap: 10px; flex: none; }
.friend-chat-head .friend-row { padding: 0; }
.secure-badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 11px/1.4 var(--sans);
}
.secure-badge.verified { color: var(--success); border-color: var(--success-rule); }
.chat-menu { flex: none; padding: 2px 10px; }
.friend-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.friend-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 2px;
  overscroll-behavior: contain;
}
.older-messages { align-self: center; margin: 4px 0; }
.older-messages[hidden] { display: none; }
.friend-message { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.friend-message.mine { align-self: flex-end; align-items: flex-end; }
.friend-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--control);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mine .friend-bubble { background: var(--bubble-out); }
.friend-pending, .friend-invalid { color: var(--muted); font-size: 13px; font-style: italic; }
.friend-invalid { color: var(--danger); }
/* The outboxes (friends.js queuedBubble, rooms.js pendingBubble): the reader's messages on their way. */
.friend-message.queued .friend-bubble { opacity: .72; }
.friend-message.queued.failed .friend-bubble { opacity: 1; box-shadow: inset 0 0 0 1px var(--danger-edge); }
.queued-status { margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px; padding: 2px 6px;
  color: var(--muted); font-size: 12px; }
.queued-status .text-button { font-size: 12px; }
.queued-failed-mark { color: var(--danger); font-weight: 700; }
.friend-meta { display: flex; align-items: center; gap: 4px; padding: 2px 6px; color: var(--muted); font: 11px var(--sans); }
.friend-report { padding: 0 2px; border: 0; background: none; color: var(--muted); opacity: .6; }
.friend-report .icon { width: var(--icon-xs); height: var(--icon-xs); }
.friend-message:hover .friend-report, .friend-report:focus-visible { opacity: 1; }
.document-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 10px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--paper);
  text-align: start;
}
.document-icon { grid-row: span 2; font-size: 24px; }
.document-name { font-weight: 700; overflow-wrap: anywhere; }
.document-size { color: var(--muted); font: 11px var(--sans); }
.circle-documents { display: grid; gap: 8px; padding: 8px 0; border-radius: 12px; }
.circle-documents.dropping { outline: 2px dashed var(--muted); outline-offset: 4px; }
.circle-documents-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.circle-documents-usage { color: var(--muted); font: 12px var(--sans); }
.circle-documents-status { margin: 8px 0; color: var(--muted); font-size: 14px; }
.circle-documents-status:empty, .circle-documents-pending:empty { display: none; }
.circle-documents-pending { display: grid; gap: 6px; }
.circle-document-open { flex: 1; min-width: 0; border: 0; color: inherit; font: inherit; cursor: pointer; background: transparent; }
.circle-document-open:hover .document-name { text-decoration: underline; }
.circle-document-upload { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface); }
.circle-document-upload progress { grid-column: 1; width: 100%; accent-color: var(--tint-ink); }
.circle-document-upload .icon-button { grid-row: 1 / span 3; grid-column: 2; }
.circle-document-upload.failed .document-size { color: var(--danger); }
.circle-document-rename label { display: grid; gap: 6px; }
/* Folders (documents.js): path bar, folder rows, who sees the open folder, move picker, access dialog. */
/* A nav, so the global nav rule would push it to the end. */
.circle-documents-path { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 2px 6px; margin-inline-start: 0; font-size: 14px; }
.circle-documents-path[hidden] { display: none; }
.circle-documents-crumb { padding: 2px 4px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; overflow-wrap: anywhere; }
button.circle-documents-crumb { cursor: pointer; }
button.circle-documents-crumb:hover { color: var(--ink); background: var(--hover); }
span.circle-documents-crumb { color: var(--ink); font-weight: 700; }
.circle-documents-separator { color: var(--muted); }
.circle-documents-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-inline-start: auto; }
.circle-documents-who { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.circle-documents-who:empty { display: none; }
.circle-documents-who .icon, .circle-folder-restricted .icon { inline-size: 13px; block-size: 13px; flex: none; }
.circle-folder .document-icon { display: grid; place-items: center; color: var(--tint-ink); }
.circle-folder .document-icon .icon { inline-size: 26px; block-size: 26px; }
.circle-folder-restricted { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.circle-folder-picker { display: grid; gap: 2px; max-block-size: 320px; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 0; border: 0; }
.circle-folder-picker legend { margin-block-end: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.circle-folder-choice { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 10px; border-radius: 10px; font-weight: 400; cursor: pointer; }
.circle-folder-choice:hover { background: var(--control); }
.circle-folder-choice:has(:checked:not(:disabled)) { background: var(--tint); }
.circle-folder-choice:has(:disabled) { color: var(--muted); cursor: default; }
.circle-folder-choice input { flex: none; inline-size: 18px; block-size: 18px; margin: 0; padding: 0; accent-color: var(--emphasis); }
.circle-folder-choice .icon { inline-size: 14px; block-size: 14px; color: var(--muted); }
.circle-folder-choice small { color: var(--muted); }
.circle-folder-warning:not(:empty) { padding: 8px 10px; border-radius: 10px; background: var(--control); color: var(--ink); }
.circle-access-editor { display: grid; gap: 8px; }
.circle-access-editor[hidden] { display: none; }
.member-row.circle-access-entry { flex-wrap: nowrap; padding-block: 4px; }
.circle-access-entry > :first-child { margin-inline-end: auto; min-inline-size: 0; }
.circle-access-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.modal .form-body .circle-access-entry select { inline-size: auto; padding-block: 6px; }
.circle-access-add { display: flex; align-items: center; gap: 8px; }
.circle-access-add[hidden] { display: none; }
.modal .form-body .circle-access-add :is(input, select) { flex: 1; min-inline-size: 0; padding-block: 6px; }
.compose-status { min-height: 1.2em; margin: 2px 0; color: var(--muted); font-size: 13px; }
.friend-compose { display: flex; align-items: flex-end; gap: 8px; flex: none; }
/* The field is the rounded box; the textarea inside it has no border of its own, so the GIF
   button can sit at its end. */
.compose-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--control);
}
.compose-field:focus-within { border-color: var(--emphasis); }
.friend-compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 160px;
  padding: 9px 6px 9px 14px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-read);
  line-height: 1.4;
  font-family: var(--sans);
  resize: none;
  outline: 0;
}
.compose-attach { padding: 8px 10px; border-radius: 999px; }
.friend-compose :disabled { opacity: .5; cursor: not-allowed; }

.safety-verified { color: var(--success) !important; font-weight: 700; }
.safety-digits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 12px;
  padding: 14px;
  border-radius: 10px;
  background: var(--paper);
  font: 600 18px var(--mono);
  text-align: center;
  letter-spacing: .06em;
}
.device-list { display: grid; gap: 8px; margin: 12px 0 18px; }
.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.device-info { display: grid; min-width: 0; }
.device-info span { color: var(--muted); font-size: 13px; }
.link-code { display: grid; justify-items: center; gap: 12px; margin: 8px 0; }
.link-code svg { width: min(260px, 70vw); height: auto; border-radius: 8px; }
.link-code figcaption { display: grid; gap: 6px; justify-items: center; color: var(--muted); font-size: 13px; text-align: center; }
.link-typed { font: 600 16px var(--mono); color: var(--ink); letter-spacing: .05em; overflow-wrap: anywhere; }
.link-state { font-size: 13px; }
.link-done { color: var(--success) !important; font-weight: 700; }
.danger-zone { border-color: var(--danger-rule); }
@media (max-width: 600px) {
  .friend-message { max-width: 92%; }
  .safety-digits { font-size: 16px; gap: 6px; }
  .friend-chat-head { flex-wrap: wrap; }
}
.friend-lists { margin-bottom: 18px; }
.friend-lists > .friend-section:first-child h2 { margin-top: 4px; }
.friend-empty { display: grid; justify-items: start; gap: 4px; }
.friend-empty p { margin: 0 0 8px; }

/* In-page tabs. One row that scrolls sideways once more tabs than fit are added. */
.tab-list {
  display: flex;
  gap: 2px;
  margin-block-end: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
  border-block-end: 1px solid var(--rule);
}
.tab {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.tab:hover { background: var(--hover); color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
/* A border, not a background or shadow, so the marker survives forced colors. */
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 8px 0;
  border-block-end: 2px solid var(--emphasis);
}
.tab:focus-visible { outline-offset: -2px; }
.tab-count {
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--badge);
  color: var(--on-badge);
  font: 700 11px/17px var(--sans);
  text-align: center;
}
.tab-count:empty { display: none; }

/* Connecting a device, and the chat list as chat entries. */
.connect-panel h2 { margin-bottom: 12px; }
.connect-steps { margin: 0 0 14px; padding-inline-start: 22px; display: grid; gap: 6px; }
.connect-steps li { color: var(--ink); }
.connect-panel .friend-add input { font: 600 15px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.connect-panel .link-state { min-height: 1.5em; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.connect-reset { margin-top: 10px; color: var(--muted); font-size: var(--text-read); }
.connect-reset summary { cursor: pointer; }
.connect-reset p { margin: 8px 0; }
.connect-typed { margin-top: 10px; color: var(--muted); font-size: var(--text-read); }
.connect-typed summary { cursor: pointer; }
.connect-typed p { margin: 8px 0; }
.link-scan { margin: 4px 0 10px; }
.scan-video { display: block; width: 100%; max-height: 60vh; border-radius: 12px; background: var(--media-bg); object-fit: cover; }
.friends-head { display: flex; align-items: center; gap: 14px; }
.friends-head h1 { margin-inline-end: auto; }
.friend-open { padding: 10px 8px; border-bottom: 1px solid var(--rule); border-radius: 0; }
.friend-open:hover { background: var(--hover); }
.friend-chat-icon { margin-inline-start: auto; color: var(--muted); display: grid; place-items: center; }
.friend-open:hover .friend-chat-icon { color: var(--ink); }
.chat-more { position: relative; margin-inline-start: auto; }

/* --- Friend chat: a messenger layout that fills the screen, on phones too ------------------- */
body.friend-chat-page { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.friend-chat-page #mast { flex: none; }
body.friend-chat-page .site-footer { display: none; }
body.friend-chat-page main { flex: 1; min-height: 0; width: 100%; height: auto; display: flex; flex-direction: column; padding-bottom: 0; }
.friend-chat-head { margin: 6px 0; min-height: 44px; }
.friend-chat-head .back-link { padding: 6px; }
.friend-chat { position: relative; }
.friend-log { gap: 2px; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; overflow-anchor: none; }
.friend-older { align-self: center; margin: 6px; color: var(--muted); font-size: 13px; }
.friend-older[hidden] { display: none; }
/* The day between two hairlines: "Today". */
.friend-day { align-self: stretch; display: flex; align-items: center; gap: 12px; margin: 10px 8px 6px; }
.friend-day::before, .friend-day::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.friend-day span { color: var(--muted); font: 600 12px/1.4 var(--sans); }
.friend-message { max-width: min(80%, 560px); margin-top: 2px; }
.friend-bubble { position: relative; display: inline-block; max-width: 100%; padding: 6px 9px 7px; font-size: var(--text-read); line-height: 1.35; }
.friend-text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Time and ticks sit in the bubble's last line, like in messengers: an invisible copy of them
   (.friend-meta-space) takes the room at the end of the text, and the real one is placed over it. */
.friend-meta { position: absolute; right: 8px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px;
  padding: 0; color: var(--bubble-in-meta); font: 11px/1 var(--sans); white-space: nowrap; }
.friend-meta-space { display: inline-flex; height: 0; overflow: hidden; gap: 3px; margin-inline-start: 10px;
  visibility: hidden; font: 11px/1 var(--sans); white-space: nowrap; }
.friend-report-space { display: inline-block; width: 15px; }
.has-image .friend-meta-space { display: none; }
.friend-log { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.mine .friend-meta { color: var(--bubble-out-meta); }
.friend-ticks { letter-spacing: -3px; padding-inline-end: 3px; color: var(--tick); }
.friend-ticks.read { color: var(--tick-read); }
.friend-report { margin-inline-start: 2px; }
@media (pointer: coarse) { .friend-report { opacity: .45; } }
.friend-bubble.has-image { padding: 3px; }
/* Only the last bubble of a run gets the pointed corner; images inside follow it. */
.friend-bubble.has-image .friend-meta {
  right: 9px; bottom: 8px; margin: 0; padding: 3px 6px; border-radius: 9px;
  background: var(--scrim-soft); color: var(--on-scrim);
}
.chat-image {
  display: block; width: min(300px, 68vw); max-height: 380px; padding: 0; border: 0; border-radius: 11px;
  overflow: hidden; background: var(--control); cursor: zoom-in;
}
.chat-image.unknown-size { aspect-ratio: 4 / 3; }
.chat-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-image.loading { animation: chat-image-pulse 1.2s ease-in-out infinite alternate; }
.chat-image.failed { aspect-ratio: auto; padding: 14px; color: var(--danger); font-size: 13px; cursor: default; }
@keyframes chat-image-pulse { from { background: var(--control); } to { background: var(--hover); } }
@media (prefers-reduced-motion: reduce) { .chat-image.loading { animation: none; } }
/* Inline video and audio in chats: a poster or compact card until played, then the native player. */
.chat-media { display: grid; gap: 4px; width: min(300px, 68vw); }
.chat-media-card {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 52px; padding: 0 12px; border: 0; border-radius: 11px; overflow: hidden; color: var(--ink);
  background: var(--control); font: inherit; cursor: pointer;
}
.chat-media.video .chat-media-card { aspect-ratio: 16 / 9; max-height: 380px; padding: 0; }
.chat-media-card:focus-visible, .chat-media-save:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: 2px; }
.chat-media-card:disabled { cursor: progress; }
.chat-media-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chat-media-play {
  position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 38px;
  border-radius: 50%; background: var(--scrim); color: var(--on-scrim); font-size: 15px; padding-inline-start: 2px;
}
.chat-media-name { position: relative; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.chat-media-duration { position: relative; padding: 2px 6px; border-radius: 8px; background: var(--scrim-soft); color: var(--on-scrim); font: 11px/1.4 var(--sans); }
.chat-media.video .chat-media-duration { position: absolute; right: 8px; bottom: 8px; }
.chat-media.loading .chat-media-card { animation: chat-image-pulse 1.2s ease-in-out infinite alternate; }
.chat-media video { display: block; width: 100%; max-height: 380px; border-radius: 11px; background: var(--media-bg); }
.chat-media audio { display: block; width: 100%; height: 40px; }
.chat-media-save { justify-self: start; padding: 0 2px; border: 0; background: none; color: var(--muted); font: 12px var(--sans); cursor: pointer; }
.chat-media-save:hover:not(:disabled) { text-decoration: underline; }
.chat-media-error { color: var(--danger); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .chat-media.loading .chat-media-card { animation: none; } }
.chat-jump-down {
  position: absolute; right: 10px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 3;
  display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%;
  background: var(--control); box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow) 50%, transparent);
}
.chat-jump-down[hidden] { display: none; }
.chat-jump-count {
  position: absolute; top: -6px; right: -4px; min-width: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--fresh); color: var(--on-fresh); font: 700 11px/20px var(--sans); text-align: center;
}
.chat-jump-count[hidden] { display: none; }
.compose-status:empty { display: none; }
.friend-compose { gap: 6px; padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); background: var(--paper); }
.compose-field { border-radius: 21px; }
.friend-compose textarea { font-size: 16px; min-height: 42px; padding: 10px 6px 10px 14px; border-radius: 21px;
  overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.compose-send, .compose-attach { flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%; }
.compose-attach { border: 0; background: transparent; color: var(--muted); }
.compose-attach:hover, .compose-attach:focus-visible { background: var(--hover); color: var(--ink); }
.compose-send { background: var(--fill); color: var(--on-fill); border-color: var(--fill); }
.compose-send:hover { background: var(--fill-hover); border-color: var(--fill-hover); }
.compose-send .icon { width: var(--icon-md); height: var(--icon-md); }
.compose-send:disabled { background: var(--hover); border-color: var(--hover); color: var(--muted); }
.compose-attach .icon { width: var(--icon-md); height: var(--icon-md); }
.compose-more { position: relative; flex: none; }
.compose-more .compose-menu { inset-block-start: auto; inset-block-end: calc(100% + 8px); inset-inline-start: 0; inset-inline-end: auto; }
.compose-gif {
  flex: none; align-self: flex-end; margin: 0 8px 9px 0; padding: 3px 7px; border: 1px solid var(--rule); border-radius: 7px;
  background: transparent; color: var(--muted); font: 700 12px/1.2 var(--sans); letter-spacing: .04em; cursor: pointer;
}
.compose-gif:hover, .compose-gif:focus-visible, .compose-gif[aria-expanded="true"] { background: var(--hover); color: var(--ink); }

/* GIFs: the clip in a message, and the picker above the composer (a bottom sheet on phones). */
.chat-gif { position: relative; display: block; width: min(260px, 68vw); overflow: hidden; border-radius: 11px; background: var(--control); }
.chat-gif video, .chat-gif img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A GIF that cannot load: its alt text stays for screen readers but does not cover the badge. */
.chat-gif img { color: transparent; }
.gif-badge {
  position: absolute; inset: 6px auto auto 6px; padding: 2px 6px; border-radius: 6px; background: var(--scrim); color: var(--on-scrim);
  font: 700 10px/1.3 var(--sans); letter-spacing: .05em; pointer-events: none;
}
.gif-play {
  position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; display: grid; place-items: center; width: 44px; height: 44px;
  padding: 0; border: 0; border-radius: 50%; background: var(--scrim); color: var(--on-scrim); cursor: pointer;
}
.gif-play .icon { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.gif-play.playing { opacity: 0; }
.gif-play.playing:focus-visible, .chat-gif:hover .gif-play.playing { opacity: 1; }
.friend-compose { position: relative; }
.gifpick-backdrop { display: none; }
.gifpick {
  position: absolute; inset-block-end: calc(100% + 8px); inset-inline-end: 0; z-index: 6; display: flex; flex-direction: column;
  width: min(420px, 100%); height: min(440px, 60dvh); border: 1px solid var(--rule); border-radius: 14px; background: var(--surface);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow) 60%, transparent), 0 2px 6px color-mix(in srgb, var(--shadow) 40%, transparent); overflow: hidden;
}
.gifpick-search { flex: none; padding: 10px 10px 6px; }
.gifpick-search input {
  width: 100%; padding: 9px 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: 15px var(--sans);
}
.gifpick-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px; scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
.gifpick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: start; }
.gifpick-item { display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--control); cursor: pointer; }
.gifpick-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gifpick-item:hover, .gifpick-item:focus-visible { outline: 2px solid var(--emphasis); }
.gifpick-note { margin: 8px 0; color: var(--muted); font-size: 13px; text-align: center; }
.gifpick-note:empty { display: none; }
.gifpick-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .gifpick-backdrop { display: block; position: fixed; inset: 0; z-index: 5; background: var(--backdrop); }
  .gifpick {
    position: fixed; inset: auto 0 0 0; z-index: 6; width: auto; height: 70dvh; border-width: 1px 0 0; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .gifpick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.image-viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--scrim-strong); color: var(--on-scrim);
}
.image-viewer[open] { display: flex; flex-direction: column; }
.image-viewer::backdrop { background: var(--media-bg); }
.image-viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; cursor: zoom-out; }
.image-viewer-bar { display: flex; justify-content: center; gap: 10px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
/* A post's photos and videos full screen (storyViewer in story.js): one per screen, snapping, with arrows and a counter. */
.media-viewer {
  inline-size: 100vw; block-size: 100dvh; max-inline-size: none; max-block-size: none; margin: 0; padding: 0; border: 0;
  overflow: hidden; background: var(--media-bg); color: var(--on-scrim);
}
/* Scrolling in the viewer or over its backdrop never moves the page behind it. */
.media-viewer:modal { overscroll-behavior: contain; }
.media-viewer::backdrop { overflow: hidden; overscroll-behavior: contain; background: var(--media-bg); }
.media-viewer-track {
  display: flex; block-size: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x pinch-zoom;
}
.media-viewer-track::-webkit-scrollbar { display: none; }
.media-viewer-track:focus-visible { outline: 2px solid var(--on-scrim); outline-offset: -4px; }
.media-viewer-slide {
  display: flex; align-items: center; justify-content: center; flex: 0 0 100%; box-sizing: border-box; min-inline-size: 0;
  padding: calc(56px + env(safe-area-inset-top)) 72px calc(24px + env(safe-area-inset-bottom));
  scroll-snap-align: center; scroll-snap-stop: always; cursor: zoom-out;
}
.media-viewer-slide img,
.media-viewer-slide video { display: block; max-inline-size: 100%; max-block-size: 100%; inline-size: auto; block-size: auto; object-fit: contain; cursor: default; }
.media-viewer-close,
.media-viewer-nav {
  position: absolute; display: grid; place-items: center; inline-size: 44px; block-size: 44px; padding: 0; border: 0; border-radius: 50%;
  background: var(--scrim); color: var(--on-scrim); cursor: pointer; touch-action: manipulation;
}
.media-viewer-close:hover,
.media-viewer-nav:hover { background: var(--scrim-strong); }
.media-viewer-close:focus-visible,
.media-viewer-nav:focus-visible { outline: 2px solid var(--on-scrim); outline-offset: 2px; }
.media-viewer-close .icon,
.media-viewer-nav .icon { inline-size: 22px; block-size: 22px; stroke-width: 2.2px; }
.media-viewer-close { inset-block-start: calc(8px + env(safe-area-inset-top)); inset-inline-end: 8px; }
.media-viewer-nav { inset-block-start: 50%; transform: translateY(-50%); }
.media-viewer-nav[hidden] { display: none; }
.media-viewer-prev { inset-inline-start: 14px; }
.media-viewer-next { inset-inline-end: 14px; }
.media-viewer-count {
  position: absolute; inset-block-start: calc(16px + env(safe-area-inset-top)); inset-inline-start: 50%; transform: translateX(-50%);
  padding: 2px 10px; border-radius: 99px; background: var(--scrim); font: 13px/1.5 var(--sans); pointer-events: none;
}
.story-carousel.viewable .story-slide img { cursor: zoom-in; }
@media (max-width: 600px) {
  /* Phones swipe; the arrows stay but leave the photo the whole width. */
  .media-viewer-slide { padding-inline: 0; }
  .media-viewer-nav { inline-size: 36px; block-size: 36px; }
  .media-viewer-prev { inset-inline-start: 6px; }
  .media-viewer-next { inset-inline-end: 6px; }
}
@media (max-width: 600px) {
  body.friend-chat-page main { padding-inline: 8px; }
  body.friend-chat-page .mast-inner { padding-block: 6px; }
  .friend-message { max-width: 86%; }
  .friend-chat-head { margin: 2px 0; gap: 6px; flex-wrap: nowrap; }
}
/* Reactions: chips under the bubble, and a row of quick emojis that opens from the small face. */
.reaction-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; }
.reaction-row:empty { display: none; }
.mine .reaction-row { justify-content: flex-end; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 4px; min-block-size: 0; padding: 1px 8px; border: 1px solid var(--rule);
  border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; line-height: 20px;
}
.reaction-chip .reaction-count { color: var(--muted); font: 11px var(--sans); }
.reaction-chip.mine { border-color: var(--chip-mine-rule); background: var(--chip-mine); }
.reaction-chip.mine .reaction-count { color: var(--chip-mine-ink); }
/* Beside the bubble, on the side facing the middle of the chat. */
.reaction-add {
  position: absolute; bottom: 0; left: calc(100% + 4px); display: grid; place-items: center; width: 26px; height: 26px;
  min-block-size: 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); opacity: 0;
}
.mine .reaction-add { left: auto; right: calc(100% + 4px); }
.reaction-add .icon { width: var(--icon-sm); height: var(--icon-sm); }
.friend-message:hover .reaction-add, .reaction-add:focus-visible, .reaction-add[aria-expanded="true"] { opacity: 1; }
@media (pointer: coarse) { .reaction-add { opacity: .45; } }
.reaction-picker {
  display: flex; gap: 2px; margin-top: 4px; padding: 4px; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--control); box-shadow: 0 4px 14px color-mix(in srgb, var(--shadow) 50%, transparent);
}
.reaction-choice { min-block-size: 0; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 22px; line-height: 1; }
.reaction-choice:hover, .reaction-choice:focus-visible { background: var(--hover); }
.reaction-choice.mine { background: var(--chip-mine); }
/* The report flag fits the height of the time line. */
.friend-meta .friend-report { display: inline-grid; place-items: center; height: 11px; min-block-size: 0; padding: 0; border: 0; background: none; line-height: 1; }
.friend-meta .friend-report .icon { width: var(--icon-xs); height: var(--icon-xs); }
.friend-report-space { width: 14px; }

.group-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.group-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A circle chat's header links to the circle. */
.circle-who { color: inherit; text-decoration: none; }
.circle-who:hover strong { text-decoration: underline; }
.circle-who .name-block { display: flex; flex-direction: column; min-width: 0; }
.circle-who .name-sub { font-size: 12px; }
.chat-typing { color: var(--muted); font-size: .8rem; padding-inline: .75rem; }
.chat-typing:not(:empty) { padding-block: .35rem; }
.chat-typing:not(:empty)::before {
  content: ""; display: inline-block; inline-size: 22px; block-size: 6px; margin-inline-end: 6px; vertical-align: middle;
  background: radial-gradient(circle, var(--muted) 2.5px, transparent 3px) 0 50% / 6px 6px no-repeat,
    radial-gradient(circle, var(--muted) 2.5px, transparent 3px) 8px 50% / 6px 6px no-repeat,
    radial-gradient(circle, var(--muted) 2.5px, transparent 3px) 16px 50% / 6px 6px no-repeat;
  animation: typing-dots 1.2s ease-in-out infinite;
}
@keyframes typing-dots {
  0%, 100% { background-position: 0 50%, 8px 50%, 16px 50%; }
  25% { background-position: 0 0, 8px 50%, 16px 50%; }
  50% { background-position: 0 50%, 8px 0, 16px 50%; }
  75% { background-position: 0 50%, 8px 50%, 16px 0; }
}
@media (prefers-reduced-motion: reduce) { .chat-typing:not(:empty)::before { animation: none; } }
.group-sender, .group-readers { display: inline-flex; align-items: center; gap: .25rem; }
.group-sender { font-size: .8rem; }
.group-readers { max-width: 8rem; flex-wrap: wrap; }

/* --- Dropdown panels (account, chat menu) ---------------------------------------------------- */
.menu-panel {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 5;
  display: grid;
  gap: 2px;
  min-inline-size: 232px;
  max-inline-size: calc(100vw - 16px);
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--shadow) 60%, transparent), 0 2px 6px color-mix(in srgb, var(--shadow) 40%, transparent);
}
.menu-panel[hidden] { display: none; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-block-size: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/1.3 var(--sans);
  text-align: start;
  text-decoration: none;
  white-space: nowrap;
}
.menu-item .icon { flex: none; width: var(--icon-sm); height: var(--icon-sm); color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item:hover .icon, .menu-item:focus-visible .icon { color: var(--ink); }
.menu-item:focus-visible { outline-offset: -2px; }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-tint); }
.menu-separator { margin: 4px 6px; border: 0; border-block-start: 1px solid var(--rule); }
.account-language { display: grid; gap: 4px; padding: 6px 12px; color: var(--muted); font-size: 12px; }
/* A nav, so the global nav rule would push it to the end. */
.account-panel .account-legal { padding: 4px 12px 6px; margin-inline-start: 0; justify-content: flex-start; align-items: flex-start; }
.account-version { margin: 0; padding: 4px 12px 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) {
  .menu-item { min-block-size: 46px; }
}

/* --- Modal dialogs: centred on wide screens, a bottom sheet on phones ------------------------ */
.modal {
  display: none;
  inline-size: min(520px, calc(100vw - 32px));
  max-block-size: min(760px, calc(100dvh - 48px));
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px color-mix(in srgb, var(--shadow) 70%, transparent);
}
.modal[open] { display: flex; flex-direction: column; }
/* Without these, scrolling over the backdrop or inside the dialog scrolls the page behind it. */
.modal:modal { overscroll-behavior: contain; }
.modal::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}
.modal-section { display: grid; gap: 10px; margin: 0; }
.modal-section > h3 {
  margin: 0;
  color: var(--muted);
  font: 600 13px var(--sans);
}
.modal-section > .btn { justify-self: start; }
.modal-text { margin: 0; color: var(--muted); font-size: var(--text-read); line-height: 1.5; }
.modal-status { margin: 0; color: var(--danger); font-size: 13px; }
.modal-status:empty { display: none; }
.modal-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--control);
}
.modal-callout p { margin: 0; font-size: var(--text-read); }
.modal-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
/* Fields in a form: filled wells with a hairline border. */
.form-body :is(input:not([type=checkbox], [type=radio], [type=file], [type=range]), select, textarea) {
  inline-size: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px var(--sans);
}
.form-body textarea { min-block-size: 84px; font-family: var(--sans); }
.form-body input[type=file] { inline-size: auto; padding: 0; border: 0; background: none; }
.form-body :is(input, select, textarea):focus-visible { outline-offset: 0; }
.form-body > label { margin: 0; }
.btn-small { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.danger { border-color: var(--danger-rule); color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-tint); }
@media (max-width: 600px) {
  .modal {
    inline-size: 100%;
    max-inline-size: none;
    max-block-size: 92dvh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
  }
  .modal .form-head::before {
    content: "";
    position: absolute;
    inset: 6px auto auto 50%;
    inline-size: 36px;
    block-size: 4px;
    border-radius: 999px;
    background: var(--rule);
    translate: -50% 0;
  }
  .form-head { padding-inline: 16px; }
  .form-body { padding: 16px; }
  .modal .form-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal .form-foot .btn { flex: 1; }
  .modal .form-foot .modal-foot-start { flex-basis: 100%; order: 1; margin: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .modal[open] { animation: modal-in .16s ease-out; }
  @media (max-width: 600px) { .modal[open] { animation-name: sheet-in; animation-duration: .22s; } }
}
@keyframes modal-in { from { opacity: 0; translate: 0 8px; } }
@keyframes sheet-in { from { translate: 0 100%; } }

/* Group settings */
.group-identity { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.group-identity > .modal-field { flex: 1 1 220px; }
.group-identity-media { display: grid; justify-items: center; gap: 8px; }
.group-identity .avatar { inline-size: 72px; block-size: 72px; border-radius: 18px; }
.group-identity-name { font-size: 18px; }
.group-picture-actions { display: flex; gap: 6px; }
.member-list, .member-picker { display: grid; gap: 2px; margin: 0; padding: 0; border: 0; list-style: none; }
.member-row, .member-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 10px;
  border-radius: 10px;
}
.member-row:hover, .member-choice:hover { background: var(--control); }
.member-who { display: flex; align-items: center; gap: 10px; flex: 1 1 180px; min-inline-size: 0; }
.member-badges { display: flex; gap: 4px; }
.member-badge {
  padding: 1px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  font: 600 11px/18px var(--sans);
}
.member-actions { display: flex; gap: 6px; margin-inline-start: auto; }
.member-choice { cursor: pointer; }
.member-choice input { flex: none; inline-size: 18px; block-size: 18px; margin: 0; accent-color: var(--emphasis); }
.member-choice:has(:checked) { background: var(--control); }
.member-picker { max-block-size: 260px; overflow-y: auto; overscroll-behavior: contain; }
.knock-results { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.knock-results li { padding: 8px 10px; border-radius: 8px; background: var(--control); }

/* Safety code and report dialogs */
.safety-verified { margin: 0; color: var(--success); font-weight: 700; }
.report-form { display: grid; gap: 4px; }

/* Deleting chats */
.btn.danger-solid { border-color: var(--danger-solid); background: var(--danger-solid); color: var(--on-danger); }
.btn.danger-solid:hover { border-color: var(--danger-solid-hover); background: var(--danger-solid-hover); }
@media (min-width: 601px) { .confirm-dialog { inline-size: min(420px, calc(100vw - 32px)); } }
.friend-ended { margin-inline-start: auto; color: var(--muted); font: 600 12px var(--sans); }
.chat-start { margin-top: 12px; }
.chat-start .btn { justify-self: start; }

/* Story posts: photos and videos in a carousel with a caption below. The first item sets the frame. */
.post-slot.story-slot { height: auto; overflow: visible; background: none; }
.story-carousel { position: relative; overflow: hidden; border-radius: 5px; background: var(--media-bg); }
.story-track {
  display: flex;
  aspect-ratio: var(--story-ratio, 1);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.story-track::-webkit-scrollbar { display: none; }
.story-track:focus-visible { outline-offset: -2px; }
.story-slide { position: relative; flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.story-slide img,
.story-slide video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--media-bg); }
.story-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--on-scrim) 85%, transparent);
  color: var(--media-soft);
  transform: translateY(-50%);
  box-shadow: 0 2px 8px var(--scrim-soft);
}
.story-nav:hover { background: var(--on-scrim); }
.story-nav .icon { width: var(--icon-sm); height: var(--icon-sm); stroke-width: 2.4px; }
.story-prev { left: 8px; }
.story-next { right: 8px; }
.story-count {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--scrim);
  color: var(--on-scrim);
  font: 12px/1.5 var(--sans);
  pointer-events: none;
}
.story-dots { position: absolute; inset: auto 0 10px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.story-dot { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--on-scrim) 45%, transparent); }
.story-dot.current { background: var(--on-scrim); }
.story-caption { margin: 10px 3px 0; font-size: var(--text-read); }
.story-caption p { margin: 0; }
.story-caption-text { overflow-wrap: anywhere; }
.story-caption:not(.full, .expanded) .story-caption-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.story-more { padding: 0; border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.story-more:hover { color: var(--ink); text-decoration: underline; }
.story-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-tile .media-play { top: 50%; }
.ssr-story img { width: 100%; height: auto; object-fit: cover; margin-block-end: 6px; }
.visibility-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font: 11px/1.4 var(--sans); }
.visibility-badge .icon { width: var(--icon-xs); height: var(--icon-xs); }

/* Writing: post type, audience and the story editor */
.audience { display: contents; }
.audience-select { color: var(--tint-ink); }
.audience-hint { color: var(--muted); font-size: 13px; }
.audience-hint, .audience-as { flex-basis: 100%; }
.audience-option {
  display: flex;
  flex: 1 1 200px;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}
.audience-option:has(:checked) { border-color: var(--emphasis); }
.audience-option input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; }
.audience-text { display: grid; gap: 1px; }
.audience-text small { color: var(--muted); font-weight: 400; font-size: 13px; }
.story-preview { max-width: 480px; margin: 0 auto 16px; }
.story-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  max-height: 320px;
  width: 100%;
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}
.story-tray-title { margin: 0 0 8px; font-size: 14px; }
.story-tray { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.story-tray:empty { display: none; }
.story-tray-item {
  position: relative;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--media-bg);
  cursor: grab;
}
.story-tray-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-tray-item.pending { display: grid; place-items: center; padding: 6px; cursor: progress; }
.story-tray-progress { color: var(--muted); font-size: 11px; line-height: 1.3; text-align: center; }
.story-tray-index,
.story-tray-kind {
  position: absolute;
  top: 4px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--scrim);
  color: var(--on-scrim);
  font: 11px/18px var(--sans);
}
.story-tray-index { left: 4px; }
.story-tray-kind { right: 4px; }
.story-tray-tools { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; background: var(--scrim); }
.story-tray-tools button { flex: 1; min-width: 0; padding: 2px 0; border: 0; border-radius: 0; background: none; color: var(--on-scrim); font-size: 14px; }
.story-tray-tools button:hover:not(:disabled) { background: color-mix(in srgb, var(--on-scrim) 20%, transparent); }
.story-tray-tools button:disabled { opacity: .35; }
.story-caption-field { margin: 0; }
.caption-count { justify-self: end; color: var(--muted); font: 400 12px var(--sans); }

/* Communities (static/spaces.js) */
.verified-badge { display: inline-flex; color: var(--ink); vertical-align: -2px; }
.verified-badge .icon { width: var(--icon-xs); height: var(--icon-xs); }
.space-name { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.space-where { color: var(--muted); font: 11px/1.4 var(--sans); }
.space-where a { color: var(--ink); }
/* On the community's own page every post is in it. */
.space-posts .space-where { display: none; }
.space-head { display: grid; gap: 12px; margin: 8px 0 16px; }
.space-cover { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 10px; background: var(--surface); }
.space-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.space-title .avatar { width: 56px; height: 56px; border-radius: 13px; }
.space-title h1 { margin: 0; font: 800 24px/1.2 var(--display); letter-spacing: -.03em; overflow-wrap: anywhere; }
.space-title h1 .verified-badge { margin-inline-start: 6px; vertical-align: 0; }
.space-title h1 .verified-badge .icon { width: var(--icon-md); height: var(--icon-md); }
.space-title .name-sub { color: var(--muted); font-size: 14px; }
.space-description { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.space-status { flex: none; color: var(--muted); font: 12px var(--sans); }
.space-field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.space-field input, .space-field textarea, .space-field select, .space-role {
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.4 inherit;
}
.space-dialog .friend-lists { margin-bottom: 12px; }
.audience-space { margin: 0; }
.audience-space a { color: var(--tint-ink); }
.friend-item .friends-actions { flex: none; align-items: center; }
.circles-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.circles-section { margin-bottom: 16px; }
.space-head .back-link { justify-self: start; }
/* An invitation to a circle: who invited, who is in it, what joining means, Accept / Decline. */
.circle-invite {
  display: grid; gap: 10px; margin: 8px 0 12px; padding: 14px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface);
}
.circle-invite-head { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.circle-invite-head .avatar { width: 48px; height: 48px; border-radius: 12px; }
.circle-invite-people { display: flex; align-items: center; gap: 10px; }
.circle-invite-faces { display: flex; }
.circle-invite-faces .avatar { width: 28px; height: 28px; margin-inline-end: -6px; border: 2px solid var(--surface); }
.circle-invite-faces:not(:empty) { margin-inline-end: 6px; }
.circle-invite-rules h3 { margin: 0 0 4px; font-size: 14px; }
.circle-invite-explain { margin: 0; color: var(--muted); font-size: var(--text-read); }
.circle-invite-status:empty { display: none; }
.circle-chat { display: contents; }
.circle-chat-status { margin: 0; align-self: center; color: var(--muted); font-size: 14px; }
.circle-pending-head { margin: 16px 0 4px; font-size: 15px; }
/* A circle's page: Posts | Documents | Chat | Members, and its ground rules. */
.circle-panel-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.circle-panel-note { margin: 12px 0; color: var(--muted); font-size: var(--text-read); line-height: 1.5; }
a.member-who { color: inherit; text-decoration: none; }
a.member-who:hover .display-name { text-decoration: underline; }
.circle-rules-fold { margin-top: 8px; }
.circle-rules-fold > summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.circle-rules { display: grid; gap: 6px; margin-top: 8px; }
.circle-rules-list { margin: 0; padding-inline-start: 18px; color: var(--muted); font-size: var(--text-read); line-height: 1.5; }
.circle-rules-editor { display: grid; gap: 10px; }
.circle-rules-editor textarea { inline-size: 100%; min-block-size: 84px; font: 14px/1.5 var(--sans); }
.circle-switches { display: grid; gap: 2px; margin: 0; padding: 0; border: 0; }
/* Voice (voice.js): who is in a channel, presence in lists, the call bar. */
.voice-people { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.voice-person { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--control); font-size: 14px; }
.voice-person { --ring-gap: var(--control); }
.voice-person .avatar { width: 28px; height: 28px; }
/* Whoever speaks gets a ring in the accent (--speaking-ring) with a gap in the background's colour (--ring-gap)
   and a slow halo; in the channel list also a small voice wave after the name. voice.js only toggles .speaking on
   nodes that stay (paintVoiceSpeaking), many times a second. The ring comes at once (50 ms) and goes softly (180 ms).
   The halo starts only after 300 ms of speaking and its first frame is the plain ring, so short words and pauses
   never restart it visibly. No motion when it is not wanted: then the ring alone, still fading. */
.voice-person .avatar, .voice-tile .avatar, .voice-speaker .avatar { transition: box-shadow 0.18s ease-out; }
.voice-person.speaking .avatar, .voice-tile.speaking .avatar, .voice-speaker.speaking .avatar {
  box-shadow: 0 0 0 2px var(--ring-gap), 0 0 0 4px var(--speaking-ring), 0 0 0 4px transparent;
  transition-duration: 0.05s;
}
@media (prefers-reduced-motion: no-preference) {
  .voice-person.speaking .avatar, .voice-tile.speaking .avatar, .voice-speaker.speaking .avatar { animation: speaking-halo 1.6s ease-in-out 0.3s infinite; }
  .voice-person.speaking::after { animation: speaking-wave 0.9s ease-in-out infinite; }
}
@keyframes speaking-halo {
  0%, 100% { box-shadow: 0 0 0 2px var(--ring-gap), 0 0 0 4px var(--speaking-ring), 0 0 0 4px transparent; }
  50% { box-shadow: 0 0 0 2px var(--ring-gap), 0 0 0 4px var(--speaking-ring), 0 0 0 8px color-mix(in srgb, var(--speaking-ring) 30%, transparent); }
}
.voice-person.speaking::after {
  content: ""; flex: none; inline-size: 13px; block-size: 12px; margin-inline-start: -2px;
  background: linear-gradient(var(--speaking-ring), var(--speaking-ring)) 0 50% / 3px 45% no-repeat,
    linear-gradient(var(--speaking-ring), var(--speaking-ring)) 50% 50% / 3px 100% no-repeat,
    linear-gradient(var(--speaking-ring), var(--speaking-ring)) 100% 50% / 3px 65% no-repeat;
}
@keyframes speaking-wave {
  0%, 100% { background-size: 3px 45%, 3px 100%, 3px 65%; }
  33% { background-size: 3px 100%, 3px 55%, 3px 85%; }
  66% { background-size: 3px 70%, 3px 80%, 3px 40%; }
}
.voice-person-muted { display: inline-flex; color: var(--muted); }
.voice-person-muted .icon { width: var(--icon-sm); height: var(--icon-sm); }
.voice-presence { display: flex; align-items: center; gap: 5px; color: var(--speaking); font-size: 13px; }
.voice-presence .icon { width: var(--icon-xs); height: var(--icon-xs); flex: none; }
.voice-presence span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-bar {
  position: fixed; inset-inline: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 12px; max-inline-size: 560px; margin-inline: auto; padding: 8px 8px 8px 14px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--control); box-shadow: 0 8px 30px color-mix(in srgb, var(--shadow) 53%, transparent);
}
.in-voice body { padding-bottom: 88px; }
.voice-bar-room { display: flex; flex: 1; align-items: center; gap: 10px; min-inline-size: 0; color: inherit; text-decoration: none; }
.voice-bar-icon { display: inline-flex; color: var(--speaking); }
.voice-bar-icon .icon { width: var(--icon-md); height: var(--icon-md); }
.voice-bar-text { display: grid; min-inline-size: 0; line-height: 1.25; }
.voice-bar-text strong, .voice-bar-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-bar-status { color: var(--muted); font-size: 13px; }
.voice-bar-controls { display: flex; gap: 6px; }
.voice-bar-button { display: inline-grid; place-items: center; inline-size: 40px; block-size: 40px; padding: 0; border: 1px solid var(--rule); border-radius: 50%; background: var(--control); color: var(--ink); }
.voice-bar-button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.voice-bar-button.voice-leave { border-color: transparent; background: var(--danger-solid); color: var(--on-danger); }
.voice-bar-button .icon { width: var(--icon-md); height: var(--icon-md); }
.voice-bar-button.voice-repair { inline-size: auto; padding-inline: 14px; border-radius: 999px; font: inherit; font-size: 14px; }

/* --- Spaces (spaces.js, rooms.js) --------------------------------------------------------------- */
.space-lock { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.space-lock .icon { width: var(--icon-xs); height: var(--icon-xs); }
.space-lock.e2ee { color: var(--speaking); }
.space-row { display: flex; align-items: center; gap: 12px; }
.space-row .name-block { flex: 1; min-width: 0; }
.space-row-lock { display: inline-flex; margin-inline-start: 6px; color: var(--speaking); }
.space-row-lock .icon { width: var(--icon-xs); height: var(--icon-xs); }
.space-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); flex: none; }
.space-mention { background: var(--mention-badge); color: var(--on-mention-badge); }
.space-notices { display: grid; gap: 8px; }
.space-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.space-notice p { margin: 0; }
.space-muted { margin: 0; color: var(--warning); }
.space-choices { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; }
.field-hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.space-photo-field { display: grid; gap: 6px; justify-items: start; }
.space-photo-preview img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; }
.space-link-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 14px; }
.invite-row.inactive { opacity: 0.6; }
.invite-url { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.member-badge.muted { color: var(--warning); }
.member-badge.via { font-family: var(--sans); font-size: 12px; }
.rooms-editor { display: grid; gap: 12px; }
.rooms-editor .member-row input { flex: 1; min-width: 0; }
.invite-page { display: grid; gap: 10px; justify-items: start; max-width: 560px; margin: 24px auto; }
.invite-page .space-photo { width: 96px; height: 96px; border-radius: 20px; object-fit: cover; }
.room-security { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.room-head .group-who { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.friend-edited { color: var(--muted); font-size: 11px; margin-inline-end: 4px; }
/* History sharing: the asks for missing messages (the "restored" mark is styled with the time line below). */
.friend-history { text-align: center; }
.friend-bubble .friend-history-again { padding: 0; min-block-size: 0; color: inherit; font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.friend-deleted { font-style: italic; color: var(--muted); }
.mention { padding: 0 3px; border-radius: 6px; background: var(--tint); color: inherit; font-weight: 700; }
.mention.me { background: var(--mention-me-bg); color: var(--mention-me); border-radius: 4px; padding: 0 2px; }
.friend-message.mentions-me .friend-bubble { box-shadow: inset 3px 0 0 var(--mention-me); }
.message-tools { display: flex; gap: 4px; flex-wrap: wrap; opacity: 0.75; font-size: 13px; }
.friend-message.mine .message-tools { justify-content: flex-end; }
.reply-quote { border-inline-start: 3px solid var(--rule); padding-inline-start: 8px; margin-bottom: 4px; color: var(--muted);
  font-size: 13px; overflow-wrap: anywhere; }
.reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; color: var(--muted); }
.server-room .reaction-picker { display: flex; gap: 4px; flex-wrap: wrap; }
.server-room .reaction-picker[hidden] { display: none; }
@media (max-width: 600px) {
  .space-link-form { display: grid; }
}
.friend-message.friend-event { align-self: center; }
.friend-message.friend-event .friend-bubble { background: none; color: var(--muted); font-size: 13px; padding: 2px 8px; box-shadow: none; }
.friend-message.friend-event .friend-meta, .friend-message.friend-event .friend-meta-space { display: none; }

/* --- Small actions: icon buttons and text buttons (app.js iconButton, textButton) ---------------- */
.icon-button {
  display: inline-grid; place-items: center; flex: none; inline-size: 32px; block-size: 32px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-decoration: none;
}
.icon-button:hover, .icon-button:focus-visible, .icon-button[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.icon-button .icon { width: var(--icon-md); height: var(--icon-md); }
.icon-button:disabled { opacity: .3; cursor: default; background: transparent; }
.icon-button.danger:hover:not(:disabled) { background: var(--danger-tint); color: var(--danger); }
.text-button { padding: 6px 2px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.text-button:hover { background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { opacity: .5; text-decoration: none; }
.text-button.accent { color: var(--ink); }
.text-button.danger { color: var(--danger); }
.text-button.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.text-button.with-icon .icon { width: var(--icon-sm); height: var(--icon-sm); }
.load-older { display: block; margin: 6px auto; }
.load-older[hidden] { display: none; }
@media (pointer: coarse) {
  .icon-button { inline-size: 44px; block-size: 44px; }
  .text-button { padding-block: 10px; }
}
.chat-menu.icon-button { padding: 0; }

/* --- The chats page: scope rail, list and open chat (friends.js chatsPage, rooms.js) ------------- */
body.chats-page main { max-width: 1180px; }
.chats-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.chats-side, .chats-pane { min-height: 0; min-width: 0; }
.chats-pane { display: none; flex-direction: column; }
.chats-layout.has-pane .chats-pane { display: flex; }
.chats-layout.has-pane .chats-side { display: none; }
/* The list column: its title, then the list (the rail is the shell's, left of it). */
.chats-side { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "head" "list"; }
.chats-head { grid-area: head; margin-block-end: 4px; }
.chats-head .icon-button { margin-inline-start: auto; }
.chats-list { grid-area: list; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent; padding-bottom: 16px; }
.chats-list [hidden] { display: none; }
/* A space's feed in the pane: it scrolls on its own below the head. */
.chats-feed { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 24px; }
/* "New post" and "Older posts" line up with the posts (600 px, centered: .feed-list .post). */
.chats-feed > .circle-panel-top, .chats-feed > .feed-tail, .chats-feed > .space-head, .chats-feed > .space-section { inline-size: min(100%, 600px); margin-inline: auto; }
.chats-feed > .space-head { padding-top: 8px; }
.chats-empty { flex: 1; display: grid; place-items: center; color: var(--muted); font-size: var(--text-read); }
.friend-open.is-current { background: var(--selected); box-shadow: inset 3px 0 0 var(--rail-current); }
.chats-side .friend-open { border-radius: 8px; border-bottom: 0; }

/* The scope rail (rooms.js scopeRail): Home, Direct, Unread, the spaces and folders, New space and Discover in a
   column that scrolls on its own, square items with the name only as tooltip and accessible name. The same on
   every width; phones make it narrower (--rail-w, --rail-pad: the iOS app's ServerRail is 76 points). */
:root { --rail-w: 72px; --rail-pad: 14px; }
.chats-rail { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 4px; margin: 0; padding: 12px var(--rail-pad);
  overflow: hidden auto; min-height: 0; scrollbar-width: none; overscroll-behavior: contain; }
.chats-scope { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; inline-size: 44px; block-size: 44px;
  padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.chats-scope:hover { background: var(--hover); color: var(--ink); }
/* The selected scope: inverted like the app icon (forced colors get an outline from the rule below). */
.chats-scope[aria-current] { background: var(--fill); color: var(--on-fill); }
@media (forced-colors: active) { .chats-scope[aria-current] { outline: 2px solid; } }
/* A space keeps its picture: selected, it gets a ring in the ink instead of the inverted tile. */
.chats-scope[data-scope="space"][aria-current] { background: transparent; }
.chats-scope[data-scope="space"][aria-current] .avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--rail-current); }
/* The marker of the selected item: a short bar at the rail's edge, in the accent (--rail-current). */
.chats-scope[aria-current]::before { content: ""; position: absolute; inset-block: 10px; inset-inline-start: calc(-1 * var(--rail-pad)); inline-size: 4px;
  border-radius: 0 4px 4px 0; background: var(--rail-current); }
.chats-scope-face { display: inline-grid; place-items: center; flex: none; inline-size: 30px; block-size: 30px; }
.chats-scope-face .avatar { width: 100%; height: 100%; border-radius: 8px; }
.chats-scope-brand, .chats-scope-brand svg { display: block; inline-size: 100%; block-size: 100%; }
.chats-scope-icon { display: inline-flex; }
.chats-scope-icon .icon { width: var(--icon-md); height: var(--icon-md); }
.chats-scope-name { display: none; }
.chats-scope-flags { display: contents; }
.chats-scope-voice { display: inline-flex; position: absolute; inset: auto -4px -4px auto; padding: 2px; border-radius: 50%; background: var(--paper); color: var(--speaking); }
.chats-scope-voice .icon { width: var(--icon-xs); height: var(--icon-xs); }
.chats-scope .friend-unread { min-width: 18px; margin: 0; padding: 0 5px; font-size: 11px; line-height: 16px; }
.chats-scope .friend-unread, .chats-scope .space-dot { position: absolute; inset: -5px -5px auto auto; }
.chats-scope .friend-unread { box-shadow: 0 0 0 2px var(--paper); }
.chats-scope .space-dot { box-sizing: content-box; border: 2px solid var(--paper); }
.chats-scope .space-mention { background: var(--scope-mention); }
.chats-rail-rule { flex: none; align-self: center; inline-size: 32px; block-size: 1px; margin: 2px 0; background: var(--rule); }
.chats-rail-link { flex: none; color: var(--muted); }
/* New space and Discover are rail items too: same box, muted like the others. */
.chats-rail .chats-rail-link { inline-size: 44px; block-size: 44px; border-radius: 12px; }

/* The app shell (signed in, rooms.js startShell): the rail is the navigation, fixed at the left edge from the
   top of the window; the app has no top bar (the user's choice: the "h" app icon is Home at the top of the
   rail; #mast is for signed-out pages). Pages fill the rest and keep their readable width (main's max-width)
   centered in it. --shell-top stays for what sticks to the top, should a bar come back. Safe areas: the rail
   reaches under the notch and the home indicator with its items clear of them. */
body.app-shell { --shell-top: 0px; --rail-edge: calc(var(--rail-w) + env(safe-area-inset-left, 0px)); padding-inline-start: var(--rail-edge); }
body.app-shell #mast, body.app-shell .site-footer { display: none; }
.app-rail { position: fixed; inset: var(--shell-top, 0px) auto 0 0; z-index: 6; display: flex; flex-direction: column; inline-size: var(--rail-edge);
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--paper); border-inline-end: 1px solid var(--rule); }
.app-rail .chats-rail { flex: 1; }
/* Write, Friends and the account: outside the scroller, so the account menu opens beside the rail. */
.chats-rail-foot { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 4px; padding: 10px var(--rail-pad) 12px; border-top: 1px solid var(--rule); }
.chats-rail-foot .account-trigger { inline-size: 44px; block-size: 44px; border-radius: 12px; }
.chats-rail-foot .update-button { inline-size: 44px; block-size: 44px; padding: 0; justify-content: center; border-radius: 12px; }
.chats-rail-foot .update-button-label { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* In the rail the dot is a badge on the icon's corner. */
.chats-rail-foot .update-button-dot { position: absolute; inset-block-start: -3px; inset-inline-end: -3px; inline-size: 12px; block-size: 12px;
  background: var(--tint-ink); border: 2px solid var(--paper); }
/* The notice is centered over the content, beside the rail. */
body.app-shell .update-notice { inset-inline-start: calc(var(--rail-edge) + 16px); inset-block-start: calc(var(--shell-top) + 12px + env(safe-area-inset-top, 0px)); }
.chats-rail-foot .account-trigger:hover, .chats-rail-foot .account-trigger[aria-expanded="true"] { background: var(--hover); }
.chats-rail-foot .account-panel { inset-block: auto 0; inset-inline: calc(100% + var(--rail-pad)) auto; }
.chats-rail-foot .nav-friends.has-count::after { top: -5px; inset-inline-end: -5px; }
/* Discover spaces carries the Spaces badge: invitations and join requests to answer (spacesChanged). */
.chats-rail .nav-spaces { position: relative; }
.chats-rail .nav-spaces.has-count::after { content: attr(data-count); position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--badge); color: var(--on-badge); box-shadow: 0 0 0 2px var(--paper); font: 700 11px/16px var(--sans); text-align: center; }
/* The back button of a page opened from the rail on a phone (rooms.js, shellLevel); hidden elsewhere. */
.pane-bar { display: none; }
@media (min-width: 900px) {
  .chats-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .chats-layout .chats-side, .chats-layout.has-pane .chats-side { display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "head" "list"; border-inline-end: 1px solid var(--rule);
    background: var(--layer-side); --paper: var(--layer-side); }
  /* Inside a layer, --paper is the layer: what sits on the paper (sticky heads, the composer, the gap of a ring)
     sits on it. Tokens derived from --paper keep the page's colour (they are computed at the root). */
  .chats-layout { background: var(--layer-pane); }
  .chats-layout .chats-pane { --paper: var(--layer-pane); }
  /* The end padding: the pane reaches the window edge (send button, lobby tiles were cut off there). */
  .chats-layout .chats-pane { display: flex; padding-inline: 22px 16px; }
  .chats-pane .chats-back { display: none; }
  .chats-head, .chats-list { padding-inline: 14px; }
  body.app-shell.chats-page main { max-width: none; padding-inline: 0; }
  /* In a call, the chats page keeps the call at the foot of the side column (a panel of the column), not over the chat. */
  html.in-voice body.app-shell.chats-page { padding-bottom: 0; }
  html.in-voice:not(.voice-lobby-open) body.app-shell.chats-page .chats-list { padding-bottom: 132px; }
  body.app-shell.chats-page .voice-bar { inset: auto auto 0 var(--rail-edge); inline-size: 300px; max-inline-size: none; margin: 0; flex-wrap: wrap; gap: 10px;
    padding: 12px 14px 14px; border: 0; border-block-start: 1px solid var(--rule); border-inline-end: 1px solid var(--rule); border-radius: 0;
    background: var(--surface); box-shadow: none; }
  body.app-shell.chats-page .voice-bar-room { flex: 1 1 100%; }
  body.app-shell.chats-page .voice-bar-controls { flex: 1; justify-content: space-between; }
}
/* Phones (below 900 px), signed in: two levels like the iOS app (RailRoot). Level 1 is the rail with the selected
   scope's list beside it (Home's feed, Direct, Unread, a space's list); what a row opens is level 2, full screen
   without the rail (body.shell-pane) under a back button: the chats page's panes have their own header with it
   (chatsPaneBack), every other page the bar `.pane-bar`. */
@media (max-width: 899px) {
  :root { --rail-w: 64px; --rail-pad: 10px; }
  .chats-rail { padding-block: 10px; }
  .chats-rail-foot { padding-block: 8px 10px; }
  /* The account menu opens beside the rail and fits a 320 px screen. */
  .chats-rail-foot .account-panel { inset-inline-start: calc(100% + 6px); max-inline-size: calc(100vw - var(--rail-edge) - 10px); }
  body.app-shell.shell-pane { padding-inline-start: env(safe-area-inset-left, 0px); }
  body.app-shell.shell-pane .app-rail { display: none; }
  body.app-shell.shell-pane .update-notice { inset-inline-start: 16px; }
  body.app-shell.shell-pane:not(.chats-page) .pane-bar { position: sticky; inset-block-start: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-start; margin: 0;
    min-block-size: 48px; padding: env(safe-area-inset-top, 0px) 8px 0; background: var(--paper); border-block-end: 1px solid var(--rule); }
  .pane-back { display: inline-flex; align-items: center; gap: 2px; min-block-size: 44px; padding: 0 12px 0 4px; border-radius: 12px;
    color: var(--ink); font: 600 16px/1 var(--sans); text-decoration: none; }
  .pane-back:hover { background: var(--hover); }
  .pane-back .icon { width: var(--icon-md); height: var(--icon-md); }
  /* The bar is the way back: the pages' own back links would say it twice. */
  body.app-shell.shell-pane:not(.chats-page) main .section-heading > .back-link,
  body.app-shell.shell-pane:not(.chats-page) main .space-head > .back-link { display: none; }
  body.app-shell.shell-pane:not(.chats-page) main .section-heading:has(> .back-link):not(:has(> :not(.back-link, .visually-hidden))) { display: none; }
  /* Level 1 of the chats page: the list beside the rail, edge to edge; its title is the scope's (a space's list
     has the space's header instead). */
  body.app-shell.chats-page main { max-width: none; padding-inline: 12px; }
  .chats-side[data-scope="space"] .chats-head { display: none; }
  .chats-side[data-scope="space"] .chats-list { padding-block-start: 10px; }
  /* Safe areas: the list and the open chat keep clear of the home indicator and the notch. */
  body.app-shell.chats-page main { padding-block-start: env(safe-area-inset-top, 0px); padding-block-end: env(safe-area-inset-bottom, 0px); }
  body.app-shell main { padding-inline-end: max(12px, env(safe-area-inset-right, 0px)); }
  /* The voice bar floats over the bottom of every level (the iOS app's VoiceBar); each level keeps its height
     free: the page (body padding, above), the rail's foot (here), the open chat's composer (body padding of the
     chats page's 100dvh column). While typing on a touch screen the keyboard has the bottom: the bar steps aside. */
  html.in-voice:not(.voice-lobby-open) body.app-shell .app-rail { padding-block-end: calc(80px + env(safe-area-inset-bottom, 0px)); }
  html.in-voice body.app-shell .voice-bar { inset-inline: max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom)); max-inline-size: 560px; }
  html.in-voice:not(.voice-lobby-open) body.app-shell { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  html.in-voice:not(.voice-lobby-open) body.app-shell.chats-page main { padding-block-end: 0; }
}
@media (max-width: 899px) and (pointer: coarse) {
  html.in-voice body.app-shell:has(:is(textarea, input:not([type=checkbox], [type=radio], [type=range], [type=file]), [contenteditable]):focus) .voice-bar { display: none; }
  html.in-voice body.app-shell:has(:is(textarea, input:not([type=checkbox], [type=radio], [type=range], [type=file]), [contenteditable]):focus) { padding-bottom: 0; }
  html.in-voice body.app-shell:has(:is(textarea, input:not([type=checkbox], [type=radio], [type=range], [type=file]), [contenteditable]):focus) .app-rail { padding-block-end: env(safe-area-inset-bottom, 0px); }
}
/* --- My sidebar (sidebar.js): folders in the rail, drag markers, the editor, the Spaces page ---- */
/* Folder colours: any view sets data-color (a name or "none") and reads --folder. */
[data-color] { --folder: var(--swatch-gray); }
[data-color="red"] { --folder: var(--swatch-red); }
[data-color="orange"] { --folder: var(--swatch-orange); }
[data-color="yellow"] { --folder: var(--swatch-yellow); }
[data-color="green"] { --folder: var(--swatch-green); }
[data-color="teal"] { --folder: var(--swatch-teal); }
[data-color="blue"] { --folder: var(--swatch-blue); }
[data-color="purple"] { --folder: var(--swatch-purple); }
[data-color="pink"] { --folder: var(--swatch-pink); }
/* A folder: a tile (button) with a 2x2 mosaic on its colour; unfolded, a glyph in its colour and a tinted band around tile and spaces. */
button.chats-scope { font-family: inherit; cursor: pointer; }
.chats-folder { background: color-mix(in srgb, var(--folder) 26%, transparent); }
.chats-folder:hover { background: color-mix(in srgb, var(--folder) 38%, transparent); }
.chats-folder.has-current { background: var(--tint); }
.chats-folder-mosaic { display: grid; grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); gap: 2px; box-sizing: border-box;
  inline-size: 100%; block-size: 100%; padding: 4px; }
/* Cells are ~15 px: the avatar and its letter shrink with them instead of spilling into the neighbours. */
.chats-folder-mosaic .avatar { inline-size: 100%; block-size: 100%; min-inline-size: 0; border-radius: 4px; overflow: hidden; }
.chats-folder .chats-scope-icon { color: var(--folder); }
.chats-folder-band { position: relative; flex: none; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin-inline: -6px;
  padding: 4px 6px; border-radius: 16px; background: color-mix(in srgb, var(--folder) 20%, transparent); }
.chats-folder-band .chats-folder { background: transparent; }
.chats-folder-band .chats-scope[aria-current] { background: color-mix(in srgb, var(--folder) 30%, var(--paper)); }
/* Where a drag would land: a bar between items, a ring on the target. */
.is-dragging { opacity: .4; }
.chats-scope[data-drop], .chats-folder-band[data-drop] { position: relative; }
:is(.chats-scope, .chats-folder-band)[data-drop="before"]::after, :is(.chats-scope, .chats-folder-band)[data-drop="after"]::after {
  content: ""; position: absolute; inset-inline: 2px; block-size: 3px; border-radius: 2px; background: var(--tint-ink); pointer-events: none; }
:is(.chats-scope, .chats-folder-band)[data-drop="before"]::after { inset-block-start: -5px; }
:is(.chats-scope, .chats-folder-band)[data-drop="after"]::after { inset-block-end: -5px; }
:is(.chats-scope, .chats-folder-band)[data-drop="onto"], .chats-scope[data-drop="first"] { outline: 2px solid var(--tint-ink); outline-offset: 1px; }
.chats-folder-band[data-drop="onto"] { outline-style: dashed; outline-offset: 2px; }
.chats-rail[data-drop="start"] { box-shadow: inset 0 3px 0 var(--tint-ink); }
.chats-rail[data-drop="end"] { box-shadow: inset 0 -3px 0 var(--tint-ink); }
/* Menu colour dots */
.menu-swatch { flex: none; inline-size: 14px; block-size: 14px; margin-inline: 3px; border-radius: 50%; background: var(--folder); }
.menu-check { margin-inline-start: auto; color: var(--muted); }
/* The Edit sidebar dialog */
@media (min-width: 600px) { .sidebar-editor { inline-size: min(560px, calc(100vw - 32px)); } }
.sidebar-edit-list { display: grid; grid-template-columns: minmax(0, 1fr); min-inline-size: 0; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sidebar-edit-list[data-drop="end"] { box-shadow: 0 6px 0 -3px var(--tint-ink); }
.sidebar-edit-list.nested { margin-inline-start: 18px; padding-inline-start: 10px; border-inline-start: 3px solid var(--folder); border-radius: 2px; }
.sidebar-edit-row { display: flex; align-items: center; gap: 8px; min-block-size: 46px; padding: 3px 6px; border-radius: 10px; background: var(--control); }
.sidebar-edit-row[data-drop="before"] { box-shadow: 0 -3px 0 var(--tint-ink); }
.sidebar-edit-row[data-drop="after"] { box-shadow: 0 3px 0 var(--tint-ink); }
.sidebar-edit-row[data-drop="first"] { outline: 2px solid var(--tint-ink); outline-offset: -2px; }
.sidebar-edit-list .is-dragging { opacity: .4; }
.sidebar-edit-name { flex: 1; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; }
.sidebar-edit-face { flex: none; display: inline-grid; inline-size: 28px; block-size: 28px; }
.sidebar-edit-face .avatar { inline-size: 100%; block-size: 100%; border-radius: 8px; }
.sidebar-grip, .sidebar-grip-space { flex: none; display: inline-grid; place-items: center; inline-size: 24px; block-size: 32px; color: var(--muted); }
.sidebar-grip { cursor: grab; touch-action: none; }
.sidebar-grip .icon { inline-size: var(--icon-xs); block-size: var(--icon-xs); }
.sidebar-edit-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 6px; border: 1px solid color-mix(in srgb, var(--folder) 40%, transparent); border-radius: 14px;
  background: color-mix(in srgb, var(--folder) 12%, transparent); }
.sidebar-edit-group.draft { border-style: dashed; }
.sidebar-edit-group .sidebar-edit-row { background: var(--surface); }
.sidebar-edit-group .sidebar-edit-list .sidebar-edit-row { background: var(--control); }
.sidebar-edit-glyph { flex: none; display: inline-grid; place-items: center; color: var(--folder); }
.sidebar-edit-glyph .icon { inline-size: var(--icon-md); block-size: var(--icon-md); }
.form-body input.sidebar-edit-input { flex: 1; inline-size: auto; min-inline-size: 0; padding: 7px 10px; }
.form-body select.sidebar-edit-select { flex: 0 1 132px; min-inline-size: 0; inline-size: 132px; padding: 6px 8px; font-size: 13px; text-overflow: ellipsis; }
.sidebar-edit-move:disabled { opacity: .3; cursor: default; }
.sidebar-edit-ungroup { flex: none; }
/* Phones: the folder select gets its own line under the name, so names keep their room. */
@media (max-width: 599px) {
  .sidebar-edit-row:has(.sidebar-edit-select) { flex-wrap: wrap; }
  .form-body select.sidebar-edit-select { order: 9; flex: 1 1 100%; inline-size: auto; margin: 0 0 4px 32px; }
}
.sidebar-swatches { display: flex; flex-wrap: wrap; gap: 8px; padding-inline: 4px; }
.sidebar-swatch { inline-size: 24px; block-size: 24px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--folder); cursor: pointer; }
.sidebar-swatch[data-color="none"] { background: repeating-linear-gradient(135deg, var(--swatch-gray) 0 3px, color-mix(in srgb, var(--swatch-gray) 60%, var(--paper)) 3px 6px); }
.sidebar-swatch[aria-checked="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.sidebar-edit-note { margin: 0; padding-inline: 8px; color: var(--muted); font-size: 12px; }
/* The Spaces page: a folder's spaces under its label */
.space-folder { display: grid; margin-block: 6px; padding-inline-start: 10px; border-inline-start: 3px solid var(--folder); border-radius: 3px; }
.space-folder-title { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--folder); font-size: 13px; font-weight: 600; }
.space-folder-title .icon { inline-size: var(--icon-sm); block-size: var(--icon-sm); }

.skip-link { position: absolute; inset-block-start: 8px; inset-inline-start: 8px; z-index: 10; padding: 8px 12px; border-radius: 8px;
  background: var(--surface); color: var(--ink); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
/* Home's feed filter below 1280 px: a row of chips above the posts (the left column has it from there). */
.home-side { display: none; }
.home-chips { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 6px; margin: 0 0 12px; padding: 2px 0 4px; overflow-x: auto; scrollbar-width: none; }
.home-chips::-webkit-scrollbar { display: none; }
.home-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; max-inline-size: 220px; min-block-size: 34px; padding: 3px 12px;
  border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none;
}
.home-chip.with-face { padding-inline-start: 4px; }
.home-chip:hover { background: var(--hover); }
.home-chip[aria-current] { background: var(--fill); color: var(--on-fill); }
.home-chip .avatar { flex: none; inline-size: 24px; block-size: 24px; border-radius: 7px; }
.home-chip span:last-child { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (forced-colors: active) { .home-chip[aria-current], .home-filter-row[aria-current] { outline: 2px solid; } }
@media (min-width: 1200px) {
  /* Home: the feed column and the activity panel. */
  /* The whole window, like the chats page: the feed keeps its readable width centered in what the
     panel leaves, and the panel sits full height at the right edge. */
  /* The space under the feed belongs to the feed column: below the grid, the sticky side columns would be pushed up by
     its height each time the page reaches its end (before the next posts load, at the end of the feed, short filters). */
  body.app-shell.home-page main { max-width: none; padding-inline: 0; padding-block-end: 0; }
  body.app-shell .home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; column-gap: 24px; grid-template-rows: auto auto auto auto 1fr;
    grid-template-areas: "top aside" "chips aside" "invites aside" "list aside" "tail aside"; }
  .home-layout > .home-invites { grid-area: invites; inline-size: min(100%, 600px); justify-self: center; }
  .home-layout > .section-heading { grid-area: top; }
  .home-layout > .home-chips { grid-area: chips; }
  .home-layout > .feed-list { grid-area: list; }
  .home-layout > .feed-tail { grid-area: tail; align-self: start; padding-block-end: 60px; }
  .home-layout > .feed-list { inline-size: min(100%, 748px); justify-self: center; }
  /* Title, chips and the end of the feed line up with the posts (600 px, .feed-list .post). */
  .home-layout > .section-heading, .home-layout > .home-chips, .home-layout > .feed-tail { inline-size: min(100%, 600px); justify-self: center; }
  .home-layout > .home-activity { grid-area: aside; position: sticky; inset-block-start: var(--shell-top, 0px); align-self: start;
    min-block-size: calc(100dvh - var(--shell-top, 0px)); margin: 0;
    padding: 16px; border-inline-start: 1px solid var(--rule); background: var(--layer-side); --paper: var(--layer-side); }
  .home-layout > .home-activity[hidden] { display: none; }
  .home-activity-title { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
  .home-activity-item span { white-space: normal; }
}
@media (min-width: 1280px) {
  /* Three columns: [rail 72] [filter and news 280] [feed up to 748, centered in the rest] [activity 320]. The filter is
     a column now, so the chips go. */
  body.app-shell .home-layout { grid-template-columns: 280px minmax(0, 1fr) 320px; grid-template-areas: "side top aside" "side chips aside" "side invites aside" "side list aside" "side tail aside"; }
  .home-layout > .home-chips { display: none; }
  .home-layout > .home-side { grid-area: side; display: block; position: sticky; inset-block-start: var(--shell-top, 0px); align-self: start;
    max-block-size: calc(100dvh - var(--shell-top, 0px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    padding: 16px 12px 24px; border-inline-end: 1px solid var(--rule); min-block-size: calc(100dvh - var(--shell-top, 0px));
    background: var(--layer-side); --paper: var(--layer-side); }
  .home-side-title { margin: 0 8px 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
  .home-filter { display: grid; justify-content: stretch; gap: 1px; margin: 0 0 22px; }
  .home-filter-row .avatar { flex: none; inline-size: 24px; block-size: 24px; border-radius: 7px; }
  .home-side .home-filter-row { min-block-size: 36px; }
  .home-filter-row .channel-icon { inline-size: 24px; }
  .home-side .home-filter-row[aria-current], .home-side .home-filter-row[aria-current]:hover { background: var(--selected); color: var(--ink); }
  .home-side .home-filter-row[aria-current] .channel-icon { color: var(--rail-current); }
  .home-folder { display: grid; }
  .home-folder-toggle {
    display: flex; align-items: center; gap: 6px; inline-size: 100%; min-block-size: 36px; padding: 4px 8px 4px 2px; border: 0; border-radius: 6px;
    background: transparent; color: var(--muted); font: 500 var(--row-name)/1.3 var(--sans); text-align: start;
  }
  .home-folder-toggle:hover { background: var(--hover); color: var(--ink); }
  .home-folder-toggle .channel-category-chevron { inline-size: 18px; }
  .home-folder:not(.open) .channel-category-chevron { transform: rotate(-90deg); }
  .home-folder-dot { flex: none; inline-size: 12px; block-size: 12px; border-radius: 4px; background: var(--folder, var(--muted)); opacity: .9; }
  .home-folder.open { border-radius: 8px; background: color-mix(in srgb, var(--folder, var(--muted)) 9%, transparent); }
  .home-folder-spaces { display: grid; gap: 1px; padding: 0 0 4px 12px; }
  .home-news { display: grid; gap: 1px; }
  .home-news-list { display: grid; gap: 1px; }
  .home-news-row { min-block-size: 44px; }
  .home-news-row .avatar { flex: none; inline-size: 28px; block-size: 28px; border-radius: 8px; }
  .home-news-row .channel-text { gap: 0; }
  .home-news-row .channel-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; font-weight: 400; }
  .home-news-row .channel-name { font-weight: 700; color: var(--ink); }
  .home-news-all { padding: 6px 8px; }
  .home-news-empty { margin: 0; padding: 4px 8px; color: var(--muted); font-size: 14px; }
}

/* The Spaces list: a section per space, its rooms and voice channels below, like Discord. */
.space-channels { display: grid; gap: 4px; }
.space-group-head { display: flex; align-items: center; gap: 2px; }
.space-group-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px; font-size: 14px; font-weight: 700; }
.space-group-title .avatar { flex: none; width: 28px; height: 28px; border-radius: 8px; }
.space-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-row:focus-visible { outline-offset: -2px; }
.space-group-more { inline-size: 32px; block-size: 32px; }
.space-group-more .icon { width: var(--icon-xs); height: var(--icon-xs); }
.channel-list { display: grid; gap: 1px; margin: 0 0 8px; padding: 0 0 0 22px; list-style: none; }
.channel-row {
  display: flex; align-items: center; gap: 8px; inline-size: 100%; min-block-size: 34px; padding: 4px 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font: 500 15px/1.3 var(--sans); text-align: start; text-decoration: none;
}
.channel-row:hover { background: var(--hover); color: var(--ink); }
.channel-row.unread { color: var(--ink); font-weight: 700; }
.channel-row[aria-current] { background: var(--selected); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--rail-current); }
.channel-row[aria-current] .channel-icon { color: var(--rail-current); }
.channel-row.muted { opacity: .55; }
.channel-row:disabled { opacity: .4; cursor: default; background: transparent; }
.channel-icon { display: inline-grid; place-items: center; flex: none; inline-size: 18px; color: var(--muted); font-weight: 700; }
.channel-icon .icon { width: var(--icon-sm); height: var(--icon-sm); }
.channel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-row .friend-unread { flex: none; }
.channel-row.connected, .channel-row.connected .channel-icon { color: var(--speaking); }
.channel-empty { padding: 4px 8px; color: var(--muted); font-size: 13px; }
/* Unread: the same rows across spaces, each naming its space under the channel. */
.news-group .channel-list { padding-left: 0; }
.channel-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.channel-space { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 400; }
.channel-space .avatar { flex: none; width: 14px; height: 14px; border-radius: 4px; }
.channel-space span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-empty { display: grid; gap: 2px; padding: 28px 8px; text-align: center; }
.news-empty strong { color: var(--ink); font-size: 15px; }
.voice-channel .voice-people { display: grid; gap: 4px; padding: 4px 0 6px 34px; }
.voice-channel .voice-person { --ring-gap: var(--paper); gap: 9px; padding: 0; background: none; color: var(--muted); font-size: 13px; }
.voice-channel .voice-person.speaking { color: var(--ink); }
.voice-channel .voice-person .avatar { width: 24px; height: 24px; border-radius: 7px; }
.invite-strip { display: grid; gap: 2px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
/* On top of Home (spaces.js homeInvitations): the same rows, as a card above the posts. */
.home-invites { margin: 0 0 12px; padding: 8px; border: 1px solid var(--tint-ink); border-radius: 14px; background: var(--tint); }
.home-invites[hidden] { display: none; }
.home-invites-title { margin: 0 6px 2px; color: var(--muted); font-size: 13px; font-weight: 600; }
.invite-compact { display: flex; align-items: center; gap: 4px; }
.invite-compact-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px;
  color: inherit; text-decoration: none; }
.invite-compact-who:hover { background: var(--hover); }
.invite-compact .avatar { flex: none; width: 28px; height: 28px; border-radius: 8px; }
.invite-compact .name-block { display: grid; min-width: 0; line-height: 1.25; }
.invite-compact .display-name, .invite-compact .name-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-compact .display-name { font-size: 14px; font-weight: 700; }
.invite-compact .name-sub { color: var(--muted); font-size: 12px; }

/* A room open in the pane, and the space page's way into it. */
.room-head .group-who { flex: 1; min-width: 0; }
.room-head .name-block { display: grid; min-width: 0; line-height: 1.25; }
.room-head .name-sub { color: var(--muted); font-size: 13px; }
.space-chat-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; color: var(--ink); font-size: 14px;
  font-weight: 600; text-decoration: none; }
.space-chat-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.space-chat-link .friend-unread { margin-inline-start: 2px; }
/* A message's actions (reply, edit, delete, report): beside the bubble on hover or focus, like the
   reaction face; on touch screens under the message once it is tapped. */
.friend-message { position: relative; }
.message-tools { gap: 0; flex-wrap: nowrap; opacity: 1; }
.message-tools:empty { display: none; }
.message-tool { inline-size: 30px; block-size: 30px; }
.message-tool .icon { width: var(--icon-sm); height: var(--icon-sm); }
/* Beside the message only with a mouse and room for them; else under it on tap or focus (the log never scrolls sideways). */
@media (hover: hover) and (pointer: fine) and (min-width: 601px) {
  .friend-message > .message-tools { position: absolute; bottom: 0; inset-inline-start: calc(100% + 32px); opacity: 0; }
  .friend-message.mine > .message-tools { inset-inline-start: auto; inset-inline-end: calc(100% + 32px); }
  .friend-message:hover > .message-tools, .friend-message:focus-within > .message-tools { opacity: 1; }
}
@media not ((hover: hover) and (pointer: fine) and (min-width: 601px)) {
  .friend-message > .message-tools { display: none; }
  .friend-message:focus-within > .message-tools { display: flex; }
}
.room-head .name-sub { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.room-space-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.room-head .room-security { display: inline-flex; flex: none; align-items: center; gap: 3px; margin: 0; font-size: inherit; color: var(--muted); }
@media (max-width: 600px) {
  .room-security-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.room-edit-row input { padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); font: inherit; }
.room-edit-row input:hover { border-color: var(--rule); }
.room-edit-row input:focus { border-color: var(--rule); background: var(--paper); }
.room-add-form { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.room-add-form select, .room-add-form input { min-height: 38px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 7px;
  background: var(--paper); color: var(--ink); font: 400 15px/1.4 inherit; }
.room-head .room-security.e2ee { color: var(--speaking); }
.room-head .room-security .icon { width: var(--icon-xs); height: var(--icon-xs); }
.room-edit-row { flex-wrap: nowrap; }
.room-kind { display: inline-grid; place-items: center; flex: none; inline-size: 22px; color: var(--muted); font-weight: 700; }
.room-kind .icon { width: var(--icon-sm); height: var(--icon-sm); }
.voice-bar-button.voice-sound { background: var(--fill); color: var(--on-fill); }
.space-head-tools { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.space-head-tools .chat-more { margin-inline-start: 0; }
a.text-button { text-decoration: none; }
.channel-menu { z-index: 50; }

/* Room categories in the chats list: small headings that fold on this device. */
.channel-category { margin: 10px 0 0 -18px; }
.channel-category:first-child { margin-top: 2px; }
.channel-category-toggle {
  display: flex; align-items: center; gap: 4px; inline-size: 100%; min-block-size: 28px; padding: 2px 8px 2px 2px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font: 600 13px/1.3 var(--sans); text-align: start;
}
.channel-category-toggle:hover { color: var(--ink); }
.channel-category-toggle:focus-visible { outline-offset: -2px; }
.channel-category-chevron { display: inline-grid; place-items: center; flex: none; inline-size: 16px; transition: transform .15s; }
.channel-category-chevron .icon { width: var(--icon-xs); height: var(--icon-xs); }
.channel-category-toggle[aria-expanded="false"] .channel-category-chevron { transform: rotate(-90deg); }
.channel-category-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-category .friend-unread { flex: none; letter-spacing: 0; text-transform: none; }

/* Admins edit a space's channels in place: the header's edit icon (on hover or focus with a mouse). */
.space-group-edit { inline-size: 32px; block-size: 32px; }
.space-group-edit .icon { width: var(--icon-xs); height: var(--icon-xs); }
.space-group-done { flex: none; padding-inline: 8px; color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .space-group-head:not(:hover):not(:focus-within) .space-group-edit { opacity: 0; }
}
.channel-editor { position: relative; display: grid; gap: 4px; margin: 0 0 10px; padding-inline-start: 4px; }
.channel-edit-note { margin: 0 0 2px 30px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.channel-edit-list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.channel-edit-row { display: flex; align-items: center; gap: 2px; min-block-size: 36px; border-radius: 6px; }
.channel-edit-row:hover, .channel-edit-row:focus-within { background: var(--surface); }
.channel-edit-row.category { margin-top: 8px; }
.channel-edit-row.category:first-child { margin-top: 0; }
.channel-edit-row.dragging { opacity: .35; }
.channel-edit-row .channel-icon { inline-size: 20px; }
.channel-grip { flex: none; inline-size: 28px; block-size: 32px; color: var(--muted); cursor: grab; touch-action: none; }
.channel-grip .icon { width: var(--icon-xs); height: var(--icon-xs); }
.channel-grip-space { flex: none; inline-size: 28px; }
.channel-editor.is-dragging, .channel-editor.is-dragging * { cursor: grabbing; user-select: none; }
.channel-edit-name {
  flex: 1; min-width: 0; padding: 5px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: var(--ink); font: 500 15px/1.3 var(--sans);
}
.channel-edit-name:hover { border-color: var(--rule); }
.channel-edit-name:focus { border-color: var(--rule); background: var(--paper); }
.channel-edit-name::placeholder { color: var(--muted); }
.channel-edit-row.category .channel-edit-name { color: var(--muted); font-size: 13px; font-weight: 600; }
.channel-edit-row.category .channel-edit-name:focus { color: var(--ink); letter-spacing: 0; text-transform: none; }
.channel-edit-more, .channel-add, .channel-add-done { flex: none; inline-size: 30px; block-size: 30px; }
.channel-edit-more .icon, .channel-add .icon, .channel-add-done .icon { width: var(--icon-xs); height: var(--icon-xs); }
@media (hover: hover) and (pointer: fine) {
  .channel-edit-row:not(:hover):not(:focus-within) .channel-edit-more { opacity: 0; }
}
.channel-kind-switch {
  display: inline-grid; place-items: center; flex: none; inline-size: 28px; block-size: 28px; margin-inline-end: 2px; padding: 0;
  border: 1px solid var(--rule); border-radius: 6px; background: transparent; color: var(--ink); font-weight: 700;
}
.channel-kind-switch .icon { width: var(--icon-xs); height: var(--icon-xs); }
.channel-drop-line { position: absolute; inset-inline: 0; block-size: 2px; border-radius: 1px; background: var(--emphasis); pointer-events: none; }
.channel-drop-line::before {
  content: ""; position: absolute; inset-inline-start: -3px; inset-block-start: -3px; inline-size: 8px; block-size: 8px;
  border-radius: 50%; background: var(--emphasis);
}
.channel-drop-line.category { block-size: 3px; }
.channel-edit-foot { display: flex; align-items: center; gap: 14px; padding: 0 0 0 30px; }
.channel-edit-status { margin: 0 0 0 30px; color: var(--danger); font-size: 13px; }
.channel-edit-status:empty { display: none; }

/* Cropping a photo before upload (crop.js). */
/* Wider than other dialogs on larger screens; phones keep the full-width bottom sheet. */
@media (min-width: 601px) { .crop-modal { inline-size: min(720px, calc(100vw - 32px)); } }
.crop-modal .form-body { gap: 14px; justify-items: center; }
.crop-stage {
  position: relative;
  display: inline-block;
  max-inline-size: 100%;
  line-height: 0;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.crop-image { display: block; max-inline-size: 100%; max-block-size: min(58dvh, 560px); pointer-events: none; }
.crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid var(--on-scrim);
  box-shadow: 0 0 0 100vmax var(--scrim);
  cursor: grab;
  background-image:
    linear-gradient(to right, transparent calc(33.33% - .5px), color-mix(in srgb, var(--on-scrim) 35%, transparent) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), color-mix(in srgb, var(--on-scrim) 35%, transparent) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), color-mix(in srgb, var(--on-scrim) 35%, transparent) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), color-mix(in srgb, var(--on-scrim) 35%, transparent) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}
.crop-stage.dragging .crop-box { cursor: grabbing; }
.crop-box:focus-visible { outline: 2px solid var(--emphasis); outline-offset: 2px; }
.crop-handle {
  position: absolute;
  inline-size: 14px;
  block-size: 14px;
  border: 2px solid var(--media-bg);
  border-radius: 3px;
  background: var(--on-scrim);
}
/* A larger target for fingers, without a larger square. */
.crop-handle::before { content: ""; position: absolute; inset: -12px; }
/* Inside the corners: the stage clips the shade, and a handle at the photo's edge must stay whole. */
.crop-nw { left: -1px; top: -1px; cursor: nwse-resize; }
.crop-se { right: -1px; bottom: -1px; cursor: nwse-resize; }
.crop-ne { right: -1px; top: -1px; cursor: nesw-resize; }
.crop-sw { left: -1px; bottom: -1px; cursor: nesw-resize; }
.crop-shapes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.crop-shape { min-block-size: 32px; padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.crop-shape[aria-pressed="true"] { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.crop-size { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* The voice lobby in the chats pane (voice.js voiceLobby): without a shared screen a grid of participant tiles; with one
   (.has-share) the screen takes the pane and the people shrink to a strip below it. Cinema (.cinema, html.voice-cinema)
   hides the strip, the room header and the lists around, so only the screen is left. */
.voice-lobby { flex: 1; min-height: 0; min-inline-size: 0; display: flex; flex-direction: column; gap: 14px; padding-block: 8px; overflow-y: auto; }
.voice-stage[hidden] { display: none; }
.voice-spotlight { position: relative; display: grid; place-items: center; max-block-size: 48vh; border-radius: 12px; background: var(--media-bg); overflow: hidden; }
.voice-spotlight video { display: block; inline-size: 100%; max-block-size: 48vh; object-fit: contain; }
.voice-spotlight-label { position: absolute; inset: auto auto 8px 8px; padding: 2px 10px; border-radius: 999px; background: var(--scrim); color: var(--on-scrim); font-size: 13px; }
.voice-spotlight-full, .voice-spotlight-cinema { position: absolute; inset-block-start: 8px; z-index: 3; background: var(--scrim); color: var(--on-scrim); }
.voice-spotlight-full { inset-inline-end: 8px; }
.voice-spotlight-cinema { inset-inline-end: 60px; }
.voice-spotlight-cinema[aria-pressed="true"] { background: color-mix(in srgb, var(--on-scrim) 87%, transparent); color: var(--media-bg); }
/* The volume of the screen's sound (voice.js voiceShareVolume): over the picture's bottom right, in full screen too. */
.voice-share-volume { position: absolute; inset: auto 8px 8px auto; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 2px 12px 2px 2px;
  border-radius: 999px; background: var(--scrim); color: var(--on-scrim); font-size: 13px; }
.voice-share-volume[hidden] { display: none; }
.voice-share-volume-mute { background: none; color: inherit; }
.voice-share-volume-slider { inline-size: clamp(80px, 14vw, 140px); margin: 0; accent-color: var(--emphasis); }
.voice-share-volume-slider:disabled { opacity: .5; }
.voice-share-volume-value { min-inline-size: 5ch; text-align: end; font-variant-numeric: tabular-nums; }
.voice-tiles { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-auto-rows: minmax(130px, 160px); align-content: start; gap: 10px; margin: 0; padding: 0; list-style: none; }
.voice-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-inline-size: 0; padding: 10px;
  border-radius: 14px; background: var(--control); --ring-gap: var(--control); }
.voice-tile .avatar { width: 80px; height: 80px; border-radius: 50%; }
.voice-tile.speaking .avatar { box-shadow: 0 0 0 3px var(--ring-gap), 0 0 0 6px var(--speaking-ring), 0 0 0 6px transparent; animation-name: speaking-halo-tile; }
@keyframes speaking-halo-tile {
  0%, 100% { box-shadow: 0 0 0 3px var(--ring-gap), 0 0 0 6px var(--speaking-ring), 0 0 0 6px transparent; }
  50% { box-shadow: 0 0 0 3px var(--ring-gap), 0 0 0 6px var(--speaking-ring), 0 0 0 13px color-mix(in srgb, var(--speaking-ring) 26%, transparent); }
}
.voice-tile-name { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.voice-tile .voice-person-muted { position: absolute; inset: 8px 8px auto auto; }
.voice-tile.share { padding: 0; overflow: hidden; background: var(--media-bg); }
/* Someone else's tile is a button: their volume and, for moderators, Remove from channel (voicePersonMenu). */
.voice-tile:has(> .voice-tile-person) { padding: 0; }
.voice-tile-person { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; inline-size: 100%; block-size: 100%;
  min-inline-size: 0; padding: 10px; border: 0; border-radius: inherit; background: none; color: inherit; font: inherit; cursor: pointer; }
.voice-tile-person:hover, .voice-tile-person[aria-expanded="true"] { background: var(--hover); }
.voice-person.actionable { cursor: pointer; }
/* It opens like a context menu (voicePersonPlace): the corner nearest the pointer or tile is pinned (data-v down|up,
   data-h right|left) and it grows out of that corner; it fades out faster than it came, and neither moves when the
   reader asks for less motion. Moving to another person while open is not animated. */
.voice-person-menu { --person-menu-ox: left; --person-menu-oy: top; --person-menu-ty: -4px;
  z-index: 50; min-inline-size: 260px; max-block-size: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain;
  gap: 8px; padding: 12px; transform-origin: var(--person-menu-ox) var(--person-menu-oy);
  animation: person-menu-in 140ms cubic-bezier(.2, .9, .3, 1); }
.voice-person-menu[data-h="left"] { --person-menu-ox: right; }
.voice-person-menu[data-v="up"] { --person-menu-oy: bottom; --person-menu-ty: 4px; }
.voice-person-menu.closing { animation: person-menu-out 90ms ease-in forwards; pointer-events: none; }
@keyframes person-menu-in { from { opacity: 0; transform: translateY(var(--person-menu-ty)) scale(.96); } }
@keyframes person-menu-out { to { opacity: 0; transform: scale(.98); } }
/* Moderation not known yet: rows of a menu item's height, so the answer takes the same room. */
.voice-person-pending { min-block-size: 40px; border-radius: 8px; background: var(--hover); animation: chat-image-pulse 900ms ease-in-out infinite alternate; }
@media (pointer: coarse) { .voice-person-pending { min-block-size: 46px; } }
.voice-person-none { margin: 0; padding: 4px; color: var(--muted); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .voice-person-menu, .voice-person-menu.closing, .voice-person-pending { animation: none; } }
.voice-person-menu-head { display: grid; padding-inline: 4px; }
.voice-person-menu-head small { color: var(--muted); }
.voice-volume { display: grid; gap: 4px; padding-inline: 4px; font-size: 14px; }
.voice-volume-top { display: flex; justify-content: space-between; gap: 12px; }
.voice-volume-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.voice-volume-slider { inline-size: 100%; margin: 0; accent-color: var(--emphasis); }
.voice-volume-mute { display: flex; align-items: center; gap: 8px; padding: 4px; font-size: 14px; cursor: pointer; }
.voice-volume-mute input { margin: 0; accent-color: var(--emphasis); }
.voice-person-moderation { display: grid; gap: 2px; }
.voice-person-moderation:empty { display: none; }
/* A camera's picture fills its person's tile instead of the avatar (the own one mirrored); name and muted mark sit on it, the
   speaking ring is the tile's edge (an outline: it is drawn over the picture). While cameras are on, the grid's tiles are
   wider and all 16:9, so it stays even. */
.voice-camera { display: block; inline-size: 100%; block-size: 100%; min-block-size: 0; object-fit: cover; background: var(--media-bg); }
.voice-camera.mirror { transform: scaleX(-1); }
.voice-lobby.has-camera:not(.has-share) .voice-tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); grid-auto-rows: auto; }
.voice-lobby.has-camera:not(.has-share) .voice-tile:not(.voice-empty) { aspect-ratio: 16 / 9; }
.voice-tile.camera { padding: 0; overflow: hidden; background: var(--media-bg); color: var(--on-scrim);
  outline: 3px solid transparent; outline-offset: -3px; transition: outline-color 0.18s ease-out; }
.voice-tile.camera.speaking { outline-color: var(--speaking-ring); transition-duration: 0.05s; }
.voice-tile.camera .voice-tile-person { padding: 0; }
.voice-tile.camera .voice-tile-person:hover .voice-camera, .voice-tile.camera .voice-tile-person[aria-expanded="true"] .voice-camera { filter: brightness(.85); }
.voice-tile.camera .voice-tile-name { position: absolute; inset: auto auto 8px 8px; max-inline-size: calc(100% - 16px); padding: 2px 10px;
  border-radius: 999px; background: var(--scrim); color: var(--on-scrim); font-size: 13px; }
.voice-tile.camera .voice-person-muted { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--scrim); color: var(--on-scrim); }
.voice-tile-full { position: absolute; inset: 8px auto auto 8px; z-index: 1; background: var(--scrim); color: var(--on-scrim); opacity: 0; transition: opacity .15s; }
.voice-tile.camera:hover .voice-tile-full, .voice-tile-full:focus-visible { opacity: 1; }
@media (hover: none) { .voice-tile-full { opacity: 1; } }
.voice-tile.camera:fullscreen { border-radius: 0; outline: 0; }
.voice-tile.camera:fullscreen .voice-camera { object-fit: contain; }
.voice-tile-pick { display: flex; flex-direction: column; inline-size: 100%; block-size: 100%; padding: 0; border: 0; background: none; color: var(--on-scrim); }
.voice-tile-pick video { flex: 1; min-block-size: 0; inline-size: 100%; object-fit: contain; }
.voice-tile-pick .voice-tile-name { padding: 4px 8px; }
/* A screen is shared: it fills the pane, the people are a one-line strip at the bottom (scrolls sideways when long). */
.voice-lobby.has-share { overflow: hidden; gap: 8px; }
.voice-lobby.has-share .voice-stage { flex: 1; min-block-size: 0; display: flex; }
.voice-lobby.has-share .voice-spotlight { flex: 1; min-inline-size: 0; max-block-size: none; }
.voice-lobby.has-share .voice-spotlight video { block-size: 100%; max-block-size: none; }
.voice-lobby.has-share .voice-tiles { flex: none; display: flex; align-items: center; gap: 6px; padding-block: 2px; overflow-x: auto; scrollbar-width: thin; }
.voice-lobby.has-share .voice-tile { flex: none; flex-direction: row; gap: 8px; padding: 3px 12px 3px 4px; border-radius: 999px; }
.voice-lobby.has-share .voice-tile .avatar { width: 28px; height: 28px; }
.voice-lobby.has-share .voice-tile.speaking .avatar { box-shadow: 0 0 0 2px var(--ring-gap), 0 0 0 4px var(--speaking-ring), 0 0 0 4px transparent; animation-name: speaking-halo; }
/* At this size the ring alone is easy to miss: the speaker's pill takes on the accent as well (the gap follows it). */
.voice-lobby.has-share .voice-tile:not(.share) { transition: background-color 0.18s ease-out; }
.voice-lobby.has-share .voice-tile.speaking { --ring-gap: color-mix(in srgb, var(--speaking-ring) 22%, var(--control)); background: var(--ring-gap); transition-duration: 0.05s; }
.voice-lobby.has-share .voice-tile-name { max-inline-size: 140px; font-size: 13px; }
.voice-lobby.has-share .voice-tile .voice-person-muted { position: static; display: inline-flex; }
.voice-lobby.has-share .voice-tile-person { flex-direction: row; gap: 8px; padding: 3px 12px 3px 4px; }
.voice-lobby.has-share .voice-tile.share { inline-size: 112px; block-size: 64px; padding: 0; border-radius: 10px; }
.voice-lobby.has-share .voice-tile.share .voice-tile-pick { position: relative; }
.voice-lobby.has-share .voice-tile.share .voice-tile-name { position: absolute; inset: auto 0 0 0; max-inline-size: none; padding: 2px 6px;
  overflow: hidden; background: var(--scrim); color: var(--on-scrim); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
/* Cameras in the strip: small pictures like the other screens, the ring on their edge. */
.voice-lobby.has-share .voice-tile.camera { inline-size: 112px; block-size: 64px; padding: 0; border-radius: 10px; background: var(--media-bg); }
.voice-lobby.has-share .voice-tile.camera .voice-tile-person { padding: 0; }
.voice-lobby.has-share .voice-tile.camera .voice-tile-name { inset: auto 0 0 0; max-inline-size: none; padding: 2px 6px; border-radius: 0; font-size: 11px; }
.voice-lobby.has-share .voice-tile.camera .voice-person-muted { position: absolute; inset: 4px 4px auto auto; padding: 2px; }
.voice-lobby.has-share .voice-tile-full { display: none; }
.voice-lobby.has-share .voice-empty { flex: none; }
.voice-lobby.has-share .voice-controls { flex: none; padding-block: 4px; }
.voice-lobby.has-share .voice-control { block-size: 40px; }
.voice-lobby.has-share .voice-hint { display: none; }
@media (max-width: 600px) {
  .voice-lobby.has-share .voice-control-label { display: none; }
  .voice-lobby.has-share .voice-control { padding-inline: 12px; }
}
/* Cinema: nothing but the screen. The controls float over its bottom edge while the pointer moves, a finger touches it or focus is on them. */
html.voice-cinema #mast, html.voice-cinema .app-rail, html.voice-cinema .chats-side, html.voice-cinema .room-head, html.voice-cinema .site-footer { display: none; }
html.voice-cinema body.app-shell { padding-inline-start: 0; }
html.voice-cinema body.friend-chat-page main { block-size: 100dvh; padding-block-end: 0; }
html.voice-cinema .chats-layout { grid-template-columns: minmax(0, 1fr); }
html.voice-cinema .chats-layout.has-pane .chats-side { display: none; } /* outranks the two-column layout's display: grid */
html.voice-cinema body.chats-page main { padding-inline: 0; }
html.voice-cinema .chats-layout .chats-pane { padding-inline: 0; }
.voice-lobby.cinema { position: relative; gap: 0; padding-block: 0; }
.voice-lobby.cinema .voice-spotlight { border-radius: 0; }
.voice-lobby.cinema .voice-tiles, .voice-lobby.cinema .voice-hint { display: none; }
.voice-lobby.cinema .voice-spotlight-label, .voice-lobby.cinema .voice-spotlight-full, .voice-lobby.cinema .voice-spotlight-cinema,
.voice-lobby.cinema .voice-controls { opacity: 0; transition: opacity .2s; }
.voice-lobby.cinema.peek .voice-spotlight-label, .voice-lobby.cinema.peek .voice-spotlight-full, .voice-lobby.cinema.peek .voice-spotlight-cinema,
.voice-lobby.cinema.peek .voice-controls, .voice-lobby.cinema:focus-within .voice-spotlight-label, .voice-lobby.cinema :is(.voice-spotlight-full, .voice-spotlight-cinema, .voice-controls):focus-within,
.voice-lobby.cinema .voice-controls:hover, .voice-lobby.cinema .voice-spotlight-cinema:focus-visible, .voice-lobby.cinema .voice-spotlight-full:focus-visible { opacity: 1; }
.voice-lobby.cinema .voice-share-volume { opacity: 0; transition: opacity .2s; }
.voice-lobby.cinema.peek .voice-share-volume, .voice-lobby.cinema .voice-share-volume:is(:focus-within, :hover) { opacity: 1; }
.voice-lobby.cinema .voice-controls { position: absolute; inset: auto 0 12px 0; z-index: 2; pointer-events: none; background: transparent; }
.voice-lobby.cinema .voice-controls > * { pointer-events: auto; }
.voice-lobby.cinema .voice-control { background: var(--scrim); border-color: color-mix(in srgb, var(--on-scrim) 20%, transparent); color: var(--on-scrim); }
.voice-lobby.cinema .voice-control[aria-pressed="true"] { background: color-mix(in srgb, var(--on-scrim) 87%, transparent); color: var(--media-bg); }
.voice-lobby.cinema .voice-control.voice-leave { background: var(--danger-solid); }
/* Who is speaking over the screen (voice.js voiceLobby), where the tiles are hidden: in cinema mode and in full screen.
   The list holds everyone in the call; a quiet person's row is folded away and transparent, so a speaker fades in
   (50 ms) and out (180 ms) without a node being added. Bottom right, clear of the label and the top buttons; it moves
   up while the controls show, and never takes a click. */
.voice-speakers { position: absolute; inset: auto 12px 12px auto; z-index: 2; display: none; flex-direction: column; align-items: flex-end;
  max-inline-size: calc(100% - 24px); margin: 0; padding: 0; list-style: none; pointer-events: none; transition: translate 0.2s ease-out; }
.voice-lobby.cinema .voice-speakers, .voice-spotlight:fullscreen .voice-speakers { display: flex; }
.voice-lobby.cinema.peek .voice-speakers { translate: 0 -64px; }
/* Full screen keeps the stream's volume (.voice-share-volume) in that corner at all times: the speakers sit above it. */
.voice-spotlight:fullscreen:has(> .voice-share-volume:not([hidden])) .voice-speakers { inset-block-end: 56px; }
.voice-speaker { display: grid; grid-template-rows: 0fr; max-inline-size: 100%; opacity: 0;
  transition: grid-template-rows 0.18s ease-out, opacity 0.18s ease-out; }
.voice-speaker.speaking { grid-template-rows: 1fr; opacity: 1; transition-duration: 0.05s; }
.voice-speaker-clip { min-block-size: 0; overflow: hidden; }
.voice-speaker-pill { display: flex; align-items: center; gap: 8px; max-inline-size: 260px; margin-block-start: 6px; padding: 5px 12px 5px 5px;
  border-radius: 999px; background: var(--scrim); color: var(--on-scrim); font-size: 13px; font-weight: 600; --ring-gap: transparent; }
.voice-speaker .avatar { flex: none; width: 26px; height: 26px; border-radius: 50%; }
.voice-speaker-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .voice-speakers, .voice-speaker { transition-property: opacity; }
}
.voice-lobby.cinema .notice { position: absolute; inset: 8px 116px auto 8px; z-index: 2; margin: 0; pointer-events: none; } /* never over the spotlight's buttons (top right) */
.voice-empty { grid-column: 1 / -1; color: var(--muted); font-size: var(--text-read); text-align: center; }
.voice-controls { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 10px 0; background: var(--paper); }
.voice-control { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; block-size: 44px; inline-size: auto; padding-inline: 14px; gap: 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--control); color: var(--ink); }
.voice-control[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.voice-control.voice-leave { border-color: transparent; background: var(--danger-solid); color: var(--on-danger); }
.voice-control-label { font-size: 14px; }
.voice-spotlight:fullscreen { max-block-size: none; border-radius: 0; }
.voice-spotlight:fullscreen video { max-block-size: none; block-size: 100%; }
/* The desktop app's share dialog: screens and windows as live thumbnails (only where the page may list them) */
.share-grid { inline-size: min(760px, calc(100vw - 32px)); }
.share-picker .form-body { display: grid; gap: 14px; }
.share-sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-block-size: min(46dvh, 360px);
  overflow-y: auto;
  padding: 2px;
  overscroll-behavior: contain;
}
.share-source {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--control);
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.share-source[hidden], .share-empty[hidden] { display: none; }
.share-source:hover { background: var(--hover); }
.share-source:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: 2px; }
.share-options { display: grid; gap: 14px; align-items: start; }
@media (min-width: 640px) { .share-grid .share-options { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.share-source[aria-pressed="true"] { border-color: var(--tint-ink); background: var(--tint); }
.share-thumb { display: block; inline-size: 100%; aspect-ratio: 16 / 10; object-fit: contain; border-radius: 6px; background: var(--media-bg); }
.share-label { display: flex; align-items: center; gap: 6px; min-inline-size: 0; font-size: 13px; }
.share-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-app-icon { flex: none; inline-size: 16px; block-size: 16px; }
.share-empty { text-align: center; padding: 24px 0; }
.share-note:empty { display: none; }
.share-note { color: var(--tint-ink); font-size: 13px; }
.voice-hint { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.voice-hint[hidden] { display: none; }
/* Settings dialog: the microphone level, the key and shortcut recorders. */
.app-settings .form-body { gap: 20px; }
.voice-meter-row { display: flex; align-items: center; gap: 12px; }
/* The camera's preview (cameraPreview): 16:9 on the media background, the own picture mirrored like the tile; while the camera
   starts, or when it cannot, a line in the middle instead of the picture. */
.camera-preview { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; inline-size: 100%; border-radius: 12px;
  background: var(--media-bg); color: var(--on-scrim); overflow: hidden; }
.camera-preview[hidden] { display: none; }
.camera-preview .voice-camera { position: absolute; inset: 0; object-fit: cover; opacity: 0; transition: opacity .2s; }
.camera-preview.live .voice-camera { opacity: 1; }
.camera-preview-note { position: relative; margin: 0; padding: 12px 20px; font-size: 14px; text-align: center; }
.camera-preview-note:empty { display: none; }
.camera-preview.starting .camera-preview-note { color: color-mix(in srgb, var(--on-scrim) 70%, transparent); }
.voice-camera-dialog { inline-size: min(560px, calc(100vw - 32px)); }
.voice-camera-test-row { display: flex; align-items: flex-end; gap: 12px; }
.voice-camera-test-row .modal-field { flex: 1; min-inline-size: 0; }
.voice-camera-test-row .voice-camera-test { flex: none; padding-block: 10px; }
.voice-meter { flex: 1; block-size: 8px; border-radius: 999px; background: var(--control); overflow: hidden; }
.voice-meter-level { display: block; inline-size: 0; block-size: 100%; border-radius: inherit; background: var(--speaking); }
.voice-meter-level.closed { background: var(--muted); opacity: .6; }
.voice-sense { flex: 1; display: grid; gap: 4px; min-inline-size: 0; }
.voice-sense-bar { position: relative; block-size: 20px; display: flex; align-items: center; }
.voice-sense-bar .voice-meter { inline-size: 100%; flex: none; }
.voice-threshold { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.voice-threshold[hidden] { display: none; }
.voice-threshold::-webkit-slider-runnable-track { background: transparent; block-size: 100%; }
.voice-threshold::-moz-range-track { background: transparent; block-size: 100%; }
.voice-threshold::-webkit-slider-thumb { -webkit-appearance: none; inline-size: 6px; block-size: 20px; border-radius: 3px; background: var(--ink); border: 0; }
.voice-threshold::-moz-range-thumb { inline-size: 6px; block-size: 20px; border-radius: 3px; background: var(--ink); border: 0; }
.voice-threshold:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: 2px; }
.voice-threshold-value { color: var(--muted); font-size: 13px; }
.voice-threshold-value[hidden] { display: none; }
.voice-input { display: grid; gap: 10px; }
.voice-input-title { margin: 0; font-size: 14px; }
.voice-input-note[hidden], .voice-custom[hidden] { display: none; }
.voice-custom { padding-inline-start: 4px; gap: 8px; }
.voice-key, .voice-shortcut .btn { justify-self: start; }
.voice-shortcut { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.voice-shortcut-name { flex: 0 0 100px; font-size: 14px; font-weight: 600; }
.voice-shortcut-value { flex: 1; min-inline-size: 0; color: var(--muted); font: 13px var(--sans); }
.voice-shortcut-note { flex-basis: 100%; color: var(--muted); font-size: 13px; }
.notify-setting { display: grid; gap: 10px; justify-items: start; }
.voice-lobby-open .voice-bar { display: none; }
.in-voice.voice-lobby-open body { padding-bottom: 0; }

/* --- Forms: one card for every form (app.js: formCard, formHeader, chip, toggle, note) ---------- */
/* A card: header (title or segmented control, text actions, round close), body, footer (tools, quiet
   status, one pill primary). On a page it is flat: the page's paper inside a hairline, no shadow. Dialogs
   (.modal) are the same card in a <dialog>, raised on the surface colour above the backdrop. */
.form-card {
  display: flex;
  flex-direction: column;
  max-inline-size: 640px;
  margin: 32px auto 0;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--paper);
}
.modal.form-card { background: var(--surface); box-shadow: 0 24px 64px color-mix(in srgb, var(--shadow) 70%, transparent); }
.form-card:is(.auth, .leave) { max-inline-size: 440px; }
.form-card:is(.profile-editor, .editor.creative) { max-inline-size: none; }
.form-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-block-size: 64px;
  padding: 12px 16px 12px 20px;
  border-block-end: 1px solid var(--rule);
}
.form-title { flex: 1; min-width: 0; margin: 0; font: 700 17px/1.3 var(--display); letter-spacing: -.025em; }
h1.form-title { font-size: 20px; }
.form-head > .segmented { margin-inline-end: auto; }
.form-head .text-button { padding-inline: 8px; font-size: 14px; }
.text-button.danger-text { color: var(--danger); }
.form-close {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 40px;
  block-size: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--control);
  color: var(--muted);
}
.form-close:hover { background: var(--hover); color: var(--ink); }
.form-close:focus-visible { outline-offset: 0; }
.form-body {
  flex: 1;
  min-block-size: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
}
.modal .form-body {
  gap: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 12px;
  padding: 12px 16px 12px 20px;
  border-block-start: 1px solid var(--rule);
}
.form-foot:empty, .form-foot[hidden] { display: none; }
.form-foot > :is(.status, .modal-status) { flex: 1 1 100%; order: -1; margin: 0; color: var(--muted); }
.form-foot > .notice { color: var(--danger); }
.form-foot .modal-foot-start { margin-inline-end: auto; }
.form-foot .modal-foot-start:has(+ .modal-foot-start) { margin-inline-end: 0; }
.form-foot :is(.btn, button):not(.form-tool, .text-button, .form-close) {
  min-block-size: 40px;
  padding-inline: 20px;
  border-radius: 999px;
  font-size: 14px;
}
.form-foot :is(.primary, .danger-solid) { font-weight: 700; }
.form-foot .primary { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.form-foot .primary:hover:not(:disabled) { border-color: var(--primary-hover); background: var(--primary-hover); }
.form-foot .primary:disabled { opacity: .5; cursor: default; }
/* Tools on the left of the footer (icon buttons), the status and the primary on the right. */
.form-tools { display: flex; align-items: center; gap: 2px; margin-inline-end: auto; }
.form-tool {
  display: grid;
  place-items: center;
  inline-size: 40px;
  block-size: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tint-ink);
}
.form-tool .icon { inline-size: 22px; block-size: 22px; }
.form-tool:hover:not(:disabled), .form-tool[aria-expanded="true"] { background: var(--tint); }
.form-tool:disabled { opacity: .4; cursor: default; }
.form-foot .post-size, .form-foot .caption-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font: 400 13px var(--sans);
  white-space: nowrap;
}
.form-foot .post-size::before {
  content: "";
  inline-size: 20px;
  block-size: 20px;
  border-radius: 50%;
  background: conic-gradient(var(--tint-ink) var(--used, 0%), var(--hover) 0);
  mask: radial-gradient(circle, transparent 6px, #000 7px);
}
.form-foot .post-size.notice::before { background: var(--danger); }
/* A pill: icon, label and (around a select) a caret. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 32px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}
.chip > .icon { inline-size: var(--icon-sm); block-size: var(--icon-sm); color: var(--tint-ink); }
.chip > .icon:last-child:not(:first-child) { inline-size: var(--icon-xs); block-size: var(--icon-xs); color: var(--muted); }
.chip-select { padding-inline-end: 9px; cursor: pointer; }
.chip-select:hover { background: var(--hover); }
.chip-select:focus-within { outline: 2px solid var(--emphasis); }
.chip-select select, .form-body .chip-select select {
  inline-size: auto;
  margin: 0;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  appearance: none;
  cursor: pointer;
}
.chip-select select:focus-visible { outline: 0; }
.chip-select option, .chip-select optgroup { background: var(--surface); color: var(--ink); }
.chip-prefix { color: var(--muted); }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); }
.segmented button { border: 0; border-radius: 999px; background: transparent; color: var(--muted); padding: 7px 18px; font-size: 14px; }
.segmented button:hover { background: transparent; color: var(--ink); }
.segmented [aria-pressed="true"] { background: var(--fill); color: var(--on-fill); }
/* A labelled switch: a checkbox drawn as a track and a knob. */
.toggle { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 14px; cursor: pointer; }
.toggle:has(small) { align-items: flex-start; }
.toggle-input {
  appearance: none;
  position: relative;
  flex: none;
  inline-size: 36px;
  block-size: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--hover);
  cursor: pointer;
}
.toggle:has(small) .toggle-input { margin-block-start: 2px; }
.toggle-input::before {
  content: "";
  position: absolute;
  inset: 3px auto 3px 3px;
  inline-size: 14px;
  border-radius: 50%;
  background: var(--knob);
}
.toggle-input:checked { background: var(--tint-ink); }
.toggle-input:checked::before { translate: 16px 0; background: var(--primary-ink); }
@media (prefers-reduced-motion: no-preference) {
  .toggle-input, .toggle-input::before { transition: background .15s, translate .15s; }
}
.toggle-text { display: grid; gap: 1px; }
.toggle-text strong { font-weight: 600; }
.toggle-text small { color: var(--muted); font-weight: 400; font-size: 13px; }
.form-body > .toggle, .circle-switches .toggle { padding: 2px 0; }
/* A short explanation: a rule at its side like a margin note, small icon, muted text, inline link. */
.note { display: flex; align-items: flex-start; gap: 10px; padding: 2px 0 2px 14px; border-inline-start: 2px solid var(--rule); color: var(--muted); font-size: var(--text-read); line-height: 1.5; }
.note > .icon { inline-size: var(--icon-sm); block-size: var(--icon-sm); margin-block-start: 3px; }
.note p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note a { color: var(--tint-ink); }
/* The composers: who writes, the borderless text, options as chips, tools in the footer. */
.compose-who { display: flex; align-items: flex-start; gap: 12px; }
.compose-who .avatar { inline-size: 44px; block-size: 44px; border-radius: 50%; }
.compose-who-text { display: flex; flex: 1; flex-wrap: wrap; align-items: center; align-content: center; gap: 6px 10px; min-inline-size: 0; min-block-size: 44px; }
.compose-name { font-size: 16px; }
.compose-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.compose-options .toggle { min-block-size: 32px; padding: 0 12px 0 6px; border: 1px solid var(--rule); border-radius: 999px; font-size: 13px; font-weight: 600; }
.compose-options .toggle-input { inline-size: 30px; block-size: 18px; }
.compose-options .toggle-input::before { inline-size: 12px; }
.compose-options .toggle-input:checked::before { translate: 12px 0; }
.form-body .story-caption-field textarea { min-height: 110px; resize: none; padding: 0; border: 0; background: transparent; font-size: var(--text-read); line-height: 1.5; }
.space-choices .audience-option:has(:checked) { border-color: var(--tint-ink); background: var(--tint); }

/* Native file inputs in forms: the button looks like our buttons (pill), the file name stays quiet. */
.space-photo-field input[type="file"] { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
input[type="file"]::file-selector-button {
  margin-inline-end: 10px;
  padding: 7px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--control);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

/* --- Lists of people and spaces: one larger size, the whole width --------------------------------- */
/* Chats, friends, requests, members, spaces and rooms read at --row-name, the line beneath at --row-sub. */
.friend-row .name-block .display-name, .member-who .name-block .display-name, .invite-compact .name-block .display-name,
.member-row .name-block .display-name, .member-choice .display-name { font-size: var(--row-name); }
.member-choice .name-sub, .member-choice .name-sub .username { font-size: var(--row-sub); }
.member-picker { max-block-size: min(360px, 50dvh); }
.voice-person { font-size: 15px; }
.voice-channel .voice-person { font-size: 15px; }
.voice-channel .voice-person .avatar { width: 24px; height: 24px; }
.friend-row .name-sub, .member-who .name-sub, .member-row .name-sub, .invite-compact .name-sub,
.friend-row .name-sub .username, .member-who .name-sub .username, .member-row .name-sub .username { font-size: var(--row-sub); }
.friend-row .name-sub, .member-who .name-sub { color: var(--muted); }
.friend-row, .member-who { font-size: var(--row-name); }
.friend-row .avatar, .member-who .avatar { inline-size: 40px; block-size: 40px; flex: none; }
.member-row, .member-choice { font-size: var(--row-name); padding-block: 10px; }
.member-badge { font-size: 12px; }
.channel-row { font-size: var(--row-name); min-block-size: 38px; }
.space-group-title { font-size: var(--row-name); }
.channel-space, .channel-sub, .space-group-title .name-sub { font-size: var(--row-sub); }
.channel-empty { font-size: var(--row-sub); }
.space-group-title .avatar { width: 32px; height: 32px; }
/* Pages that are lists (Friends, Spaces, a space's members) use the full width of the content area instead of
   the 748 px reading column; posts keep theirs (.feed-list .post). */
main:has(> .friends-head), main:has(> .space-head), main:has(> .tab-view) { max-width: none; }
.friend-people, .friend-chats, .friend-lists, .member-list { inline-size: 100%; }

/* A space's list: the header card (cover, photo, name, mark, kind and members, quick actions), then the rows
   Posts, Documents and Members, then the channels under their own label. */
.space-group-head { position: relative; display: grid; gap: 6px; margin-bottom: 6px; padding: 6px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); overflow: hidden; }
.space-group-head.has-cover { padding-top: 0; }
.space-group-cover { display: block; inline-size: calc(100% + 12px); margin: 0 -6px 4px; aspect-ratio: 3 / 1; object-fit: cover; background: var(--control); }
.space-group-bar { display: flex; align-items: center; gap: 2px; }
.space-group-title { border-radius: 8px; color: var(--ink); text-decoration: none; }
.space-group-title:hover { background: var(--control); }
.space-group-title .avatar { width: 40px; height: 40px; border-radius: 10px; }
.space-group-text { display: grid; min-width: 0; line-height: 1.25; }
.space-group-nameline { display: flex; align-items: center; gap: 4px; min-width: 0; }
.space-group-nameline .verified-badge .icon { width: var(--icon-sm); height: var(--icon-sm); }
.space-group-sub { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: var(--row-sub); font-weight: 400; white-space: nowrap; }
.space-group-mark { display: inline-flex; flex: none; }
.space-group-mark .icon { width: var(--icon-xs); height: var(--icon-xs); }
.space-group-mark.e2ee { color: var(--speaking); }
.space-group-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.space-group-action {
  display: inline-flex; align-items: center; gap: 5px; min-block-size: 32px; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px;
  background: transparent; color: var(--ink); font: 600 13px/1.2 var(--sans); text-decoration: none; cursor: pointer;
}
.space-group-action .icon { width: var(--icon-xs); height: var(--icon-xs); }
.space-group-action:hover { background: var(--control); }
.section-row .channel-icon { color: var(--ink); }
.channel-count { flex: none; color: var(--muted); font-size: var(--row-sub); font-weight: 400; }
.channel-divider { padding: 12px 8px 4px; color: var(--muted); font-size: 13px; font-weight: 600; list-style: none; }

/* --- Space roles (spaces.js: Manage → Roles, the role editor, chips on members; docs/SPACES-ROLES.md 8.1) --- */
.role-dot, .role-swatch, .role-chip { --role: var(--swatch-gray); }
.role-color-red { --role: var(--swatch-red); }
.role-color-orange { --role: var(--swatch-orange); }
.role-color-yellow { --role: var(--swatch-yellow); }
.role-color-green { --role: var(--swatch-green); }
.role-color-teal { --role: var(--swatch-teal); }
.role-color-blue { --role: var(--swatch-blue); }
.role-color-purple { --role: var(--swatch-purple); }
.role-color-pink { --role: var(--swatch-pink); }
.member-badges { flex-wrap: wrap; }
.role-dot { flex: none; display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--role); }
.role-chip { display: inline-flex; align-items: center; gap: 5px; max-inline-size: 14em; }
.role-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip:not([class*="role-color-"]) .role-dot { background: var(--muted); }
.role-chip[class*="role-color-"] { border-color: color-mix(in srgb, var(--role) 55%, var(--rule)); color: color-mix(in srgb, var(--role) 70%, var(--ink)); }
.role-list { display: grid; gap: 2px; }
.role-list.is-dragging { user-select: none; }
.role-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; min-block-size: 44px; position: relative; }
.role-row:hover { background: var(--control); }
.role-row.dragging { z-index: 2; background: var(--control); box-shadow: 0 6px 20px color-mix(in srgb, var(--shadow) 35%, transparent); }
.role-row.drop-before { box-shadow: inset 0 2px 0 var(--emphasis); }
.role-row.drop-after { box-shadow: inset 0 -2px 0 var(--emphasis); }
.role-row .name-block { flex: 1; min-inline-size: 0; display: grid; gap: 2px; }
.role-open { cursor: pointer; }
.role-name { display: flex; align-items: center; gap: 8px; min-inline-size: 0; overflow-wrap: anywhere; }
.role-row:not(.builtin) .role-name > span, .role-row.builtin .role-name > span { min-inline-size: 0; }
.role-row .role-dot:not([class*="role-color-"]) { background: transparent; border: 1.5px solid var(--muted); box-sizing: border-box; }
.role-handle { cursor: grab; touch-action: none; }
.role-handle:active { cursor: grabbing; }
.role-handle-space { flex: none; inline-size: var(--icon-button, 32px); }
.role-lock { flex: none; display: inline-flex; color: var(--muted); padding: 8px; }
.role-lock svg { inline-size: 18px; block-size: 18px; }
.role-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.role-swatch { inline-size: 30px; block-size: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--role);
  cursor: pointer; padding: 0; outline-offset: 2px; }
.role-swatch.none { background: transparent; border: 2px dashed var(--muted); }
.role-swatch[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--role); }
.role-swatch.none[aria-checked="true"] { border-style: solid; box-shadow: none; }
.role-group .toggle-input:disabled + .toggle-text { opacity: 0.6; }
.role-switches .toggle strong { display: inline-flex; align-items: center; gap: 8px; }
.role-editor .tab-view { margin-block-start: -4px; }

/* --- Chat messages: one messenger look for direct chats, E2EE rooms and server rooms ------------
   (friends.js and rooms.js share these classes). Runs of one sender within five minutes (decorateRuns)
   are tight, with .run-first showing the sender's name and .run-last the small tail corner. Time, ticks and
   the clock sit inside the bubble's last line; a failed message's Retry and Discard under its edge. */
.friend-log { --r: 18px; --rs: 6px; --rt: 4px; gap: 0; padding: 6px 4px 14px; overflow-x: hidden; }
.friend-message { max-width: min(72%, 560px); margin-top: 2px; }
.friend-message.run-first { margin-top: 10px; }
.friend-log > :first-child { margin-top: 0; }
.friend-message.tail { margin-bottom: 0; }
.friend-day { margin: 18px 8px 8px; }
.group-sender { display: none; padding: 0 12px 3px; color: var(--sender); font-size: 12px; font-weight: 600; line-height: 1.3; }
.friend-message.run-first .group-sender { display: block; }
.friend-bubble {
  padding: 7px 12px 6px; border-radius: var(--r); background: var(--bubble-in); line-height: 1.4; font-size: var(--text-read);
  overflow-wrap: anywhere; word-break: break-word;
}
.mine .friend-bubble { background: var(--bubble-out); }
/* Corners: squarer on the side that faces the neighbours of the run, a small one at its end. */
.friend-message:not(.mine):not(.run-first) .friend-bubble { border-top-left-radius: var(--rs); }
.friend-message:not(.mine):not(.run-last) .friend-bubble { border-bottom-left-radius: var(--rs); }
.friend-message:not(.mine).run-last .friend-bubble { border-bottom-left-radius: var(--rt); }
.friend-message.mine:not(.run-first) .friend-bubble { border-top-right-radius: var(--rs); }
.friend-message.mine:not(.run-last) .friend-bubble { border-bottom-right-radius: var(--rs); }
.friend-message.mine.run-last .friend-bubble { border-bottom-right-radius: var(--rt); }
.friend-meta { right: 11px; bottom: 6px; gap: 4px; color: var(--bubble-in-meta); font: 11px/1 var(--sans); font-variant-numeric: tabular-nums; }
.friend-meta-space { margin-inline-start: 14px; font: 11px/1 var(--sans); }
.mine .friend-meta { color: var(--bubble-out-meta); }
.friend-edited { margin: 0; color: inherit; font-size: 11px; font-style: italic; }
/* History sharing's mark on a message restored from another device sits in the time line like "edited". */
.friend-meta .friend-restored { margin: 0; color: inherit; font-size: 11px; font-style: italic; white-space: nowrap; }
.friend-ticks { letter-spacing: -3px; padding-inline-end: 3px; color: var(--tick); }
.friend-ticks.read { color: var(--tick-read); }
.friend-ticks.group-readers { max-width: none; flex-wrap: nowrap; }
.queued-clock { display: inline-grid; place-items: center; }
.friend-meta .queued-failed-mark { color: var(--danger); font-size: 12px; font-weight: 700; line-height: 1; }
/* Messages on their way: dimmed; a failed one is marked with a red edge and its actions under it. */
.friend-message.queued .friend-bubble { opacity: .68; }
.friend-message.queued.failed .friend-bubble { opacity: 1; box-shadow: inset 0 0 0 1px var(--danger-edge); }
.queued-status { margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 6px; padding: 4px 6px 0; max-width: 100%;
  color: var(--muted); font-size: 12px; line-height: 1.4; }
.queued-status:has(> .visually-hidden:only-child) { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.queued-reason { color: var(--danger); }
.queued-dot { color: var(--muted); }
.queued-status .text-button { padding: 2px 0; min-block-size: 0; font-size: 12px; }
/* Short messages without a bubble, a deleted one as a quiet outline, a reply's quote inside its bubble. */
/* Large emoji: the time line under them, in the flow and on the message's side, so it never leaves the log's gutter. */
.friend-bubble.emoji-only { padding: 0 4px; background: none; box-shadow: none; font-size: 44px; line-height: 1.15; }
.friend-bubble.emoji-only .friend-meta { position: static; display: flex; justify-content: flex-start; padding: 0; margin-top: 1px; line-height: 1; color: var(--muted); }
.friend-message.mine .friend-bubble.emoji-only .friend-meta { justify-content: flex-end; }
.friend-bubble.emoji-only .friend-meta-space { display: none; }
.friend-message.queued .friend-bubble.emoji-only { opacity: .68; }
.friend-bubble.friend-deleted { background: none; box-shadow: inset 0 0 0 1px var(--rule); }
.friend-message.mentions-me .friend-bubble { box-shadow: inset 0 0 0 1px var(--mention-edge); }
.reply-quote {
  display: block; margin: 0 0 5px; padding: 4px 8px; border-inline-start: 3px solid var(--tint-ink); border-radius: 6px; background: var(--reply-bg);
  color: var(--reply-ink); font-size: 13px; line-height: 1.35; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Photos, GIFs, videos and files: the media fills the bubble (no second padding) and takes its corners. */
.friend-bubble.has-image { padding: 0; }
.friend-bubble.has-image > :first-child, .has-image .chat-image, .has-image .chat-gif, .has-image .chat-media-card, .has-image .chat-media video { border-radius: inherit; }
.friend-bubble.has-image > .friend-text, .friend-bubble.has-image > .reply-quote { margin: 6px 12px 7px; }
.friend-bubble.has-image > .reply-quote { margin: 7px 8px 0; }
.friend-bubble.has-image .friend-meta { right: 8px; bottom: 7px; padding: 3px 7px; border-radius: 999px; background: var(--scrim-soft); color: var(--on-scrim); }
.friend-bubble.has-file .friend-meta-space { display: block; height: 14px; }
.friend-bubble.has-file { padding-bottom: 8px; }
.friend-message.mine .reaction-row { justify-content: flex-end; }
.reaction-row { gap: 4px; margin-top: 3px; padding-inline: 4px; }
.reaction-chip { padding: 0 8px; line-height: 22px; font-size: 13px; background: var(--control); }
.friend-message:focus-visible { outline: none; }
.friend-message:focus-visible .friend-bubble { outline: 2px solid var(--tint-ink); outline-offset: 2px; }
@media (max-width: 600px) {
  .friend-message { max-width: 85%; }
  .friend-log { --r: 17px; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 601px) {
  /* Room beside every bubble for its tools (up to four, 32px off), inside the log. */
  .friend-message { max-width: min(72%, 560px, 100% - 160px); }
}

/* --- Chat styles (appearance.js): the log carries chat-style-classic, -compact (the look above) or -irc ------
   friends.js and rooms.js draw the same messages for all three; decorateRuns adds the classic pictures. */
/* Classic: rounder bubbles, a tail on the last one of a run pointing to its sender, their picture beside it. */
.chat-style-classic { --r: 17px; --face: 32px; }
.chat-style-classic .friend-message:not(.mine, .friend-event) { margin-inline-start: calc(var(--face) + 10px); }
@media (max-width: 600px) {
  .chat-style-classic .friend-message:not(.mine, .friend-event) { max-width: calc(85% - var(--face) - 10px); }
}
@media (hover: hover) and (pointer: fine) and (min-width: 601px) {
  .chat-style-classic .friend-message:not(.mine, .friend-event) { max-width: min(72%, 560px, 100% - 160px - var(--face) - 10px); }
}
/* Room for the tail of an own bubble at the log's edge. */
.chat-style-classic .friend-message.mine { margin-inline-end: 10px; }
.chat-style-classic .friend-message.run-first { margin-top: 12px; }
.chat-style-classic .friend-message .friend-bubble { border-radius: var(--r); }
.chat-style-classic .friend-message:not(.mine).run-last .friend-bubble:not(.emoji-only, .friend-deleted) { border-bottom-left-radius: 4px; }
.chat-style-classic .friend-message.mine.run-last .friend-bubble:not(.emoji-only, .friend-deleted) { border-bottom-right-radius: 4px; }
.chat-style-classic .friend-message.run-last:not(.friend-event) .friend-bubble:not(.emoji-only, .friend-deleted)::before {
  content: ""; position: absolute; bottom: 0; inline-size: 12px; block-size: 18px; background: inherit; pointer-events: none;
}
/* A horn: the bubble's edge curving out to a point at its foot (outside a circle around the far top corner). */
.chat-style-classic .friend-message:not(.mine).run-last .friend-bubble::before {
  left: -10px; mask: radial-gradient(circle at 0 0, transparent 16px, #000 16.5px);
}
.chat-style-classic .friend-message.mine.run-last .friend-bubble::before {
  right: -10px; mask: radial-gradient(circle at 100% 0, transparent 16px, #000 16.5px);
}
.chat-style-classic .group-sender { padding-inline: 13px; }
.chat-style-classic .message-face {
  position: absolute; inset-inline-start: calc(-1 * var(--face) - 10px); bottom: 0; inline-size: var(--face); block-size: var(--face);
  border-radius: 50%; font-size: 13px;
}
.chat-style-classic .friend-bubble.emoji-only .message-face { bottom: 0; }

/* IRC: one line per message, [time] <nick> text, monospace; own messages stay on the left. The bubble and its
   time line dissolve into the line (display: contents), so their parts are ordered here. */
.chat-style-irc { gap: 0; padding: 4px 0 12px; font: 14px/1.45 var(--mono); }
.chat-style-irc .friend-message,
.chat-style-irc .friend-message.mine {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 1ch; row-gap: 2px; align-self: stretch;
  max-width: none; width: 100%; margin: 0; padding: 1px 10px; border-radius: 0; font: inherit;
}
.chat-style-irc .friend-message.run-first { margin-top: 0; }
.chat-style-irc .friend-message:hover, .chat-style-irc .friend-message:focus-within { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.chat-style-irc .friend-message::before { content: "<" attr(data-nick) ">"; order: 2; flex: none; color: var(--sender); font-weight: 600; }
.chat-style-irc .friend-message.mine::before { color: var(--tint-ink); }
.chat-style-irc .friend-message.friend-event { align-self: stretch; }
.chat-style-irc .friend-message.friend-event::before { content: "*"; color: var(--muted); }
.chat-style-irc .friend-message .group-sender { display: none; }
.chat-style-irc .friend-message .friend-bubble,
.chat-style-irc .friend-message .friend-bubble .friend-meta { display: contents; }
.chat-style-irc .friend-message .friend-bubble { font-size: inherit; line-height: inherit; }
.chat-style-irc .friend-meta-space, .chat-style-irc .message-face { display: none; }
.chat-style-irc .friend-message .friend-bubble .friend-meta { color: var(--muted); font: inherit; }
.chat-style-irc .friend-meta > time { order: 1; flex: none; color: var(--muted); font-size: 13px; }
.chat-style-irc .friend-meta > time::before { content: "["; }
.chat-style-irc .friend-meta > time::after { content: "]"; }
.chat-style-irc .reply-quote {
  order: 3; flex: 0 1 auto; max-inline-size: min(40%, 32ch); margin: 0; padding: 0 6px; border-inline-start-width: 2px; border-radius: 0;
  background: none; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.chat-style-irc .reply-quote::before { content: "↪ "; }
.chat-style-irc .friend-text, .chat-style-irc .group-event, .chat-style-irc .friend-note { order: 4; flex: 1 1 16ch; min-inline-size: 0; }
.chat-style-irc .friend-deleted .friend-text { color: var(--muted); font-style: italic; }
.chat-style-irc .friend-event .group-event { color: var(--muted); }
.chat-style-irc .friend-bubble > :is(.chat-image, .chat-gif, .chat-media, .document-card) {
  order: 4; flex: none; align-self: flex-start; inline-size: min(220px, 100%); max-block-size: 160px; margin-block: 2px; border-radius: 6px;
}
.chat-style-irc .friend-bubble > .document-card { inline-size: auto; max-inline-size: min(320px, 100%); padding: 2px 8px; background: var(--control); }
.chat-style-irc .friend-bubble > .chat-media { max-block-size: none; }
.chat-style-irc .friend-edited, .chat-style-irc .friend-meta .friend-restored { order: 5; flex: none; margin: 0; color: var(--muted); font: italic 12px var(--mono); }
.chat-style-irc .friend-edited::before, .chat-style-irc .friend-meta .friend-restored::before { content: "("; }
.chat-style-irc .friend-edited::after, .chat-style-irc .friend-meta .friend-restored::after { content: ")"; }
.chat-style-irc .friend-ticks, .chat-style-irc .queued-clock, .chat-style-irc .friend-meta .queued-failed-mark { order: 6; flex: none; font-size: 12px; }
.chat-style-irc .friend-ticks:not(.read) { color: var(--muted); }
.chat-style-irc .friend-meta .friend-report { order: 7; height: auto; opacity: 0; }
.chat-style-irc .friend-message:is(:hover, :focus-within) .friend-report { opacity: 1; }
.chat-style-irc .reaction-row { order: 8; flex: none; margin: 0; padding: 0; justify-content: flex-start; }
.chat-style-irc .friend-message.mine .reaction-row { justify-content: flex-start; }
.chat-style-irc .reaction-chip { padding: 0 6px; line-height: 18px; font-size: 12px; }
.chat-style-irc .queued-status { order: 9; flex: none; margin: 0; padding: 0; justify-content: flex-start; font: 12px var(--mono); }
.chat-style-irc .friend-message.queued:not(.failed) { opacity: .68; }
.chat-style-irc .friend-message.queued .friend-bubble { opacity: 1; }
.chat-style-irc .friend-message.queued.failed { box-shadow: inset 3px 0 0 var(--danger-edge); }
.chat-style-irc .friend-message.mentions-me { background: var(--mention-me-bg); box-shadow: inset 3px 0 0 var(--mention-edge); }
.chat-style-irc .friend-message.mentions-me .friend-bubble { box-shadow: none; }
.chat-style-irc .mention.me { padding: 0; background: none; }
.chat-style-irc .reaction-picker { order: 10; flex-basis: 100%; }
/* The reaction face and the tools sit at the line's end on hover, over the line (never beside it). */
.chat-style-irc .reaction-add { position: absolute; inset: 0 8px auto auto; left: auto; right: 8px; width: 24px; height: 24px; }
.chat-style-irc .friend-message.mine .reaction-add { right: 8px; left: auto; }
.chat-style-irc .friend-message > .message-tools {
  position: absolute; inset-block: -12px auto; inset-inline: auto 36px; z-index: 1; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--surface);
}
.chat-style-irc .friend-message.mine > .message-tools { inset-inline: auto 36px; }
@media not ((hover: hover) and (pointer: fine) and (min-width: 601px)) {
  .chat-style-irc .friend-message > .message-tools { position: static; order: 11; flex-basis: 100%; justify-content: flex-start; border: 0; background: none; }
}
.chat-style-irc .friend-day { align-self: stretch; display: flex; align-items: center; gap: 10px; margin: 10px 10px 4px; }
.chat-style-irc .friend-day::before, .chat-style-irc .friend-day::after { content: ""; flex: 1; border-top: 1px dashed var(--rule); }
.chat-style-irc .friend-day span { padding: 0; border-radius: 0; background: none; color: var(--muted); font: 12px var(--mono); }
.chat-style-irc .friend-bubble.emoji-only { font-size: inherit; }
.chat-style-irc .friend-message:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: -2px; }

/* --- Appearance in the settings (appearance.js appearanceSettings) ------------------------------------------- */
.appearance-settings fieldset { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.appearance-settings legend { margin-block-end: 8px; padding: 0; font-size: 14px; font-weight: 600; }
.theme-choices { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.theme-option, .chat-style-option {
  position: relative; display: grid; gap: 6px; margin: 0; padding: 6px; border: 2px solid var(--rule); border-radius: 12px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.theme-option:has(:checked), .chat-style-option:has(:checked) { border-color: var(--tint-ink); background: var(--tint); }
.theme-option:has(:focus-visible), .chat-style-option:has(:focus-visible) { outline: 2px solid var(--emphasis); outline-offset: 2px; }
.theme-option input, .chat-style-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option-name { padding-inline: 2px; }
.theme-preview {
  display: grid; grid-template-rows: 8px 1fr; gap: 6px; position: relative; block-size: 64px; padding: 6px; border: 1px solid var(--rule);
  border-radius: 8px; background: var(--paper); color: var(--ink); overflow: hidden;
}
.theme-preview-bar { align-self: center; inline-size: 52%; block-size: 4px; margin-inline-start: 14px; border-radius: 2px; background: var(--muted); }
.theme-preview-chat { display: grid; align-content: end; gap: 4px; }
.theme-preview-bubble { display: block; block-size: 12px; border-radius: 6px; }
.theme-preview-bubble.in { inline-size: 62%; background: var(--bubble-in); }
.theme-preview-bubble.out { justify-self: end; inline-size: 48%; background: var(--bubble-out); }
/* The app icon in small: a tile in the theme's accent before the title line. */
.theme-preview-accent { position: absolute; inset: 6px auto auto 6px; inline-size: 8px; block-size: 8px; border-radius: 2px; background: var(--tint-ink); }
.chat-style-choices { grid-template-columns: 1fr; }
.chat-style-option { grid-template-columns: 96px 1fr; align-items: center; gap: 12px; font-weight: 400; }
.chat-style-text { display: grid; gap: 1px; }
.chat-style-text strong { font-weight: 600; font-size: 14px; }
.chat-style-text small { color: var(--muted); font-size: 13px; }
.chat-style-sample { display: grid; gap: 4px; padding: 6px; border-radius: 8px; background: var(--paper); border: 1px solid var(--rule); }
.chat-style-sample-row { display: flex; align-items: flex-end; gap: 4px; }
.chat-style-sample-row.out { justify-content: flex-end; }
.chat-style-sample-bubble { display: block; inline-size: 56%; block-size: 12px; border-radius: 6px; background: var(--bubble-in); }
.chat-style-sample-row.out .chat-style-sample-bubble { background: var(--bubble-out); }
.chat-style-sample.classic .chat-style-sample-bubble { border-radius: 7px 7px 7px 1px; }
.chat-style-sample.classic .chat-style-sample-row.out .chat-style-sample-bubble { border-radius: 7px 7px 1px 7px; }
.chat-style-sample-face { inline-size: 12px; block-size: 12px; border-radius: 50%; background: var(--avatar-1-ink); }
.chat-style-sample.irc { gap: 1px; font: 9px/1.3 var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; }
@media (max-width: 480px) {
  .theme-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-style-option { grid-template-columns: 72px 1fr; }
}
