/* Laklak — one stylesheet. Colours are tokens; .light swaps them. */

:root { color-scheme: dark; }

/* Fredoka SemiBold for display text: the space name and channel welcome (SIL OFL, assets/fonts/Fredoka-OFL.txt). Latin-ext carries ğ and ş. */
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("fonts/fredoka-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Jost for everything else (variable 100-900, SIL OFL, assets/fonts/Jost-OFL.txt). Latin-ext carries ğ, ş and İ. */
@font-face { font-family: "Jost"; font-weight: 100 900; font-display: swap; src: url("fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Jost"; font-weight: 100 900; font-display: swap; src: url("fonts/jost-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
.sidebar-head.clickable > .ellipsis, .channel-start:not(.thread-start) h1, .welcome h2 {
  font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-weight: 600; letter-spacing: -.005em;
}

.app {
  --rail: #1e1f22; --side: #2b2d31; --main: #313338; --elev: #232428; --input: #383a40; --field: #1e1f22;
  --menu: #111214; --hover: rgba(78, 80, 88, .3); --active: rgba(78, 80, 88, .6); --msg-hover: rgba(2, 2, 2, .06);
  --text: #dbdee1; --strong: #f2f3f5; --muted: #949ba4; --faint: #6d6f78;
  --border: #1f2023; --border-soft: rgba(78, 80, 88, .48);
  --accent: #5d68ec; --accent-2: #4b56d2; --link: #00a8fc;
  --ok: #7ee8a2; --on-ok: #0b2a18; --warn: #f0b232; --danger: #da373c; --danger-text: #fa777c;
  --mention-bg: rgba(240, 178, 50, .08); --mention-bar: #f0b232;
  --pill-bg: color-mix(in srgb, var(--accent) 30%, transparent); --pill-fg: color-mix(in srgb, var(--accent) 40%, #fff);
  --group-gap: 17px;
  --code-bg: #2b2d31; --btn: #4e5058;
  --shadow: 0 8px 16px rgba(0, 0, 0, .24); --shadow-s: 0 0 0 1px rgba(0, 0, 0, .15), 0 4px 8px rgba(0, 0, 0, .2);
  --scroll: #1a1b1e;
  /* Logo gradient down the boom L: purple at the top to turquoise at the foot. */
  --lk-1: #9e00ad; --lk-2: #30d5c8;
  /* Avatar colours for people without a picture; Splash swaps in its four accents. */
  --av-0: #5865f2; --av-1: #3ba55c; --av-2: #faa61a; --av-3: #ed4245; --av-4: #eb459e; --av-5: #4b56d2; --av-6: #1abc9c; --av-7: #e67e22; --av-fg: #fff;
}
.app.light {
  color-scheme: light;
  --rail: #e3e5e8; --side: #f2f3f5; --main: #ffffff; --elev: #ebedef; --input: #ebedef; --field: #e3e5e8;
  --menu: #ffffff; --hover: rgba(116, 127, 141, .16); --active: rgba(116, 127, 141, .3); --msg-hover: rgba(6, 6, 7, .03);
  --text: #313338; --strong: #060607; --muted: #5c5e66; --faint: #80848e;
  --border: #e1e2e4; --border-soft: rgba(116, 127, 141, .25);
  --link: #006ce7; --danger-text: #da373c;
  /* Mint darkened for light ground (3:1 on white); white on it. */
  --ok: #1f9a5c; --on-ok: #fff;
  --mention-bg: rgba(240, 178, 50, .12);
  --pill-bg: color-mix(in srgb, var(--accent) 15%, transparent); --pill-fg: color-mix(in srgb, var(--accent) 80%, #000);
  --code-bg: #f2f3f5; --btn: #6d6f78; --scroll: #c4c9ce;
  /* The turquoise end darkened on light ground, each stop 3:1 or more. */
  --lk-1: #9e00ad; --lk-2: #269994;
  --shadow: 0 8px 16px rgba(0, 0, 0, .12); --shadow-s: 0 0 0 1px rgba(6, 6, 7, .08), 0 2px 10px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c0c22; }
.app {
  height: 100vh; width: 100vw; overflow: hidden; background: var(--main); color: var(--text);
  font-family: "Jost", "Segoe UI Variable Text", "Segoe UI", -apple-system, "Helvetica Neue", system-ui, sans-serif;
  line-height: 1.375; -webkit-font-smoothing: antialiased; user-select: none;
}
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; user-select: text; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.gap { gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: "Cascadia Code", Consolas, monospace; }
.icon { flex: none; display: block; }

.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------ shell */

.shell { display: flex; height: 100%; width: 100%; overflow: hidden; }

.rail {
  width: 72px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 8px; overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { position: relative; width: 72px; display: flex; justify-content: center; flex: none; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--main); color: var(--strong); overflow: hidden;
  display: grid; place-items: center; transition: border-radius .18s, background-color .18s, color .18s;
}
.rail-btn img { width: 100%; height: 100%; object-fit: cover; }
.rail-btn .avatar { width: 48px !important; height: 48px !important; }
/* Spaces morph into rounded squares; Home stays the app icon. */
.rail-item:hover .rail-btn:not(.rail-home), .rail-item.active .rail-btn:not(.rail-home) { border-radius: 16px; }
.rail-item:hover .rail-btn.space, .rail-item.active .rail-btn.space { background: var(--accent); color: #fff; }
/* Home is the app icon: the gradient boom L on deep indigo, always a rounded square. */
.rail-btn.rail-home { background: #1a1b34; border-radius: 16px; }
.rail-btn.add { color: var(--ok); }
.rail-item:hover .rail-btn.add { background: var(--ok); color: var(--on-ok); }
.space-initials { font-weight: 600; font-size: 16px; }
.pill {
  position: absolute; left: 0; top: 50%; width: 8px; height: 0; margin-top: 0; margin-left: -4px;
  background: var(--strong); border-radius: 0 4px 4px 0; transition: height .18s, margin-top .18s;
}
.rail-item.unread .pill { height: 8px; margin-top: -4px; }
.rail-item:hover .pill { height: 20px; margin-top: -10px; }
.rail-item.active .pill { height: 40px; margin-top: -20px; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--border-soft); flex: none; }
.badge {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; flex: none;
}
.rail-item .badge { position: absolute; right: 10px; bottom: -3px; box-shadow: 0 0 0 3px var(--rail); min-width: 20px; height: 20px; border-radius: 10px; }

.sidebar { width: var(--sidebar-w, 240px); flex: none; background: var(--side); display: flex; flex-direction: column; min-width: 0; }
.sidebar-head {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 600;
  color: var(--strong); box-shadow: 0 1px 0 rgba(4, 4, 5, .2), 0 1.5px 0 rgba(6, 6, 7, .05), 0 2px 0 rgba(4, 4, 5, .05); z-index: 1;
}
.sidebar-head.clickable { cursor: pointer; justify-content: space-between; }
/* The drag handle between the channel list and the chat: no width of its own, a 8px grab area over the edge. */
.sidebar-resize { flex: none; width: 0; position: relative; z-index: 5; outline: none; }
.sidebar-resize::before { content: ""; position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; cursor: col-resize; }
.sidebar-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; pointer-events: none; transition: background .15s; }
.sidebar-resize:hover::after, .sidebar-resize.active::after, .sidebar-resize:focus-visible::after { background: var(--accent); }
.resize-cover { position: fixed; inset: 0; z-index: 1000; cursor: col-resize; }
.mobile .sidebar-resize { display: none; }
.sidebar-head.clickable:hover { background: var(--hover); }
.search-like {
  width: 100%; height: 28px; border-radius: 4px; background: var(--rail); color: var(--muted); text-align: left;
  padding: 0 8px; font-size: 14px; font-weight: 500;
}
.channel-list { flex: 1; padding: 8px 8px 16px; }
.category {
  display: flex; align-items: center; gap: 2px; padding: 16px 0 4px 0; font-size: 12px; font-weight: 600;
  letter-spacing: .02em; color: var(--muted); cursor: pointer; text-transform: uppercase;
}
.category:hover { color: var(--text); }
.category.static { cursor: default; padding-left: 8px; }
.category.favorites { color: #f0b232; gap: 6px; }
.category .icon-btn { margin-left: auto; width: 20px; height: 20px; }
.chev { display: inline-flex; transition: transform .15s; }
.chev.closed { transform: rotate(-90deg); }
.channel, .dm {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 8px; margin: 1px 0; border-radius: 4px;
  color: var(--muted); cursor: pointer; font-weight: 500;
}
.channel { height: 32px; }
.dm { height: 42px; gap: 12px; }
.channel:hover, .dm:hover { background: var(--hover); color: var(--text); }
.channel.active, .dm.active { background: var(--active); color: var(--strong); }
.channel.unread, .dm.unread { color: var(--strong); }
.channel.unread .name { font-weight: 600; }
.channel.unread .unread-pill { position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--strong); }
.channel.muted { opacity: .45; }
.channel .name { flex: 1; }
.channel.dragging, .category.dragging { opacity: .4; }
.channel.drop-before, .category.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.channel.drop-after, .category.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
/* Invite to voice, Open chat and the gear: on hover, on the open channel and the one you're in, and on focus. */
.ch-acts { display: flex; gap: 2px; flex: none; width: 0; overflow: hidden; }
.channel:hover .ch-acts, .channel.active .ch-acts, .channel.in-call .ch-acts, .ch-acts:focus-within { width: auto; overflow: visible; }
.ch-act { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; flex: none; color: var(--muted); }
.ch-act:hover, .ch-act:focus-visible { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--strong); }
.dm-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.dm .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.group-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.in-call { color: var(--ok); display: inline-flex; }
.empty-hint { color: var(--muted); font-size: 14px; padding: 16px 8px; text-align: center; }

.voice-members { padding: 0 0 4px 32px; }
.voice-member {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 4px; color: var(--muted);
  font-size: 14px; cursor: pointer;
}
.voice-member:hover { background: var(--hover); color: var(--text); }
.voice-member .ellipsis { flex: 1; }
.voice-member .speaking { color: var(--strong); }
.vm-icon { color: var(--muted); display: inline-flex; }
.live { background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 1px 6px; line-height: 14px; }
.live.watch .watch-label, .voice-member:hover .live.watch .live-label { display: none; }
.voice-member:hover .live.watch .watch-label { display: inline; }
.live.watch:hover { filter: brightness(1.15); }
.watch-cam { display: inline-flex; padding: 2px; border-radius: 4px; }
.watch-cam:hover { color: var(--strong); background: var(--hover); }

/* You + your call: one card under the space name. Row 2 (mic, headset, camera, screen, hang up) only in a call.
   Joining: mic + headset leave row 1, the card grows with a little overshoot, the five buttons pop in 70 ms apart;
   settled by 0.84 s. Leaving runs it back in about 0.4 s. Reduce motion (.reduce-motion) turns it all off. */
.me-card {
  --card: color-mix(in srgb, var(--side), var(--strong) 6%);
  margin: 8px; padding: 8px; border-radius: 12px; background: var(--card); flex: none; --dot-ring: var(--card);
}
.mc-row { display: flex; align-items: center; gap: 8px; }
.mc-me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 8px; cursor: pointer; }
.mc-me:hover { background: var(--hover); }
.mc-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mc-text .name { font-size: 14px; font-weight: 600; color: var(--strong); }
.mc-text .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* "Space / Channel · 1:31:57" under your name in a call: the space name shortens first. */
.mc-loc { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; padding: 0 2px; min-width: 0; font-size: 12px; line-height: 16px; white-space: nowrap; color: var(--ok); text-decoration: none; }
.mc-loc:hover .cn { text-decoration: underline; }
.mc-loc.connecting { color: var(--warn); }
.mc-loc .sp { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.mc-loc .sl { flex: none; color: var(--faint); }
.mc-loc .cn { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.mc-loc .tm { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
/* The connection button left of the gear, in a call: tinted good / fair / poor (and bars fade, below). */
.mc-sigw { display: inline-flex; width: 0; margin-left: -8px; overflow: hidden; opacity: 0; flex: none; transition: width .2s, margin .2s, opacity .15s; }
.me-card.calling .mc-sigw { width: 30px; margin-left: 0; opacity: 1; }
.mc-btn.mc-sig, .mc-btn.mc-sig:hover { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.mc-btn.mc-sig.q-fair, .mc-btn.mc-sig.q-fair:hover { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.mc-btn.mc-sig.q-poor, .mc-btn.mc-sig.q-poor:hover { color: var(--danger-text); background: color-mix(in srgb, var(--danger-text) 16%, transparent); }
.mc-btn.mc-sig:hover { box-shadow: inset 0 0 0 1.5px currentColor; }
.q-fair { color: var(--warn); }
.q-poor { color: var(--danger-text); }
.q-fair path:nth-child(5), .q-poor path:nth-child(4), .q-poor path:nth-child(5) { opacity: .3; }
.q-pop { padding-bottom: 6px; }
.q-state { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 0 8px 6px; }
.q-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 8px; color: var(--muted); }
.q-row b { font-weight: 600; color: var(--strong); text-align: right; min-width: 0; }
.q-row b.q-fair { color: var(--warn); }
.q-row b.q-poor { color: var(--danger-text); }
.q-limit { margin: 6px 8px 0; padding: 6px 8px; border-radius: 8px; font-size: 12px; color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.tile-bad { display: inline-flex; margin-left: 4px; }
.mc-btn { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; flex: none; color: var(--muted); transition: background-color .15s, color .15s; }
.mc-btn:hover { background: var(--hover); color: var(--strong); }
.mc-btn.soft { background: color-mix(in srgb, var(--muted) 10%, transparent); color: var(--text); }
.mc-btn.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.mc-btn.off { background: color-mix(in srgb, var(--danger-text) 9%, transparent); color: var(--danger-text); }
.mc-btn.leave { background: color-mix(in srgb, var(--danger-text) 15%, transparent); color: var(--danger-text); }
.mc-btn.on:hover, .mc-btn.off:hover, .mc-btn.leave:hover { filter: brightness(1.2); }
.mc-btn.lit { background: var(--lk-2); color: #0c0c22; }
/* Row 1 mic + headset: fold away in a call, pop back after leaving. */
.mc-r1 { display: inline-flex; width: 30px; overflow: hidden; flex: none;
  transition: width .2s cubic-bezier(.34, 1.56, .64, 1) .2s, margin .2s cubic-bezier(.34, 1.56, .64, 1) .2s, opacity .15s .2s, transform .2s cubic-bezier(.34, 1.56, .64, 1) .2s; }
.me-card.calling .mc-r1 { width: 0; margin-left: -8px; opacity: 0; transform: scale(.5); transition-duration: .15s; transition-delay: 0s; transition-timing-function: ease; }
.mc-row2 { height: 0; overflow: hidden; transition: height .2s cubic-bezier(.4, 0, .2, 1) .1s; }
.me-card.calling .mc-row2 { height: 60px; transition: height .25s cubic-bezier(.2, .9, .3, 1.15) .05s; }
.mc-row2 > div { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding-top: 8px; }
.mc-row2 > div > span { display: grid; }
.mc-row2 .mc-btn { width: 100%; opacity: 0; transform: translateY(6px) scale(.4); transition: opacity .15s, transform .15s ease-in, background-color .15s, color .15s; }
.me-card.calling .mc-row2 .mc-btn {
  opacity: 1; transform: none;
  transition: opacity .2s linear calc(180ms + var(--i) * 70ms), transform .38s cubic-bezier(.34, 1.8, .64, 1) calc(180ms + var(--i) * 70ms), background-color .15s, color .15s;
}
/* Device presets: the line at the bottom of the voice card ("chip"), its menu, and the manager in Settings. */
.preset-tile { display: inline-grid; place-items: center; flex: none; border-radius: 8px; color: #1e1f22; }
.preset-tile.none { width: 20px; height: 20px; border-radius: 6px; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); }
.preset-tile.dashed { background: none; border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, transparent); }
.preset-chip {
  position: relative; margin-top: 8px; width: 100%; height: 28px; border-radius: 8px; display: flex; align-items: center; gap: 8px;
  padding: 0 6px 0 4px; font-size: 13px; color: var(--text); text-align: left; background: color-mix(in srgb, var(--muted) 8%, transparent);
  transition: background-color .15s;
}
.preset-chip:hover, .preset-chip.open { background: var(--hover); }
.preset-chip.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.preset-chip.empty { background: none; box-shadow: inset 0 0 0 1px var(--border-soft); }
.preset-chip.empty:hover { background: var(--hover); }
.preset-chip .preset-tile { width: 20px; height: 20px; border-radius: 6px; }
.pc-line { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.pc-line b { font-weight: 600; color: var(--strong); flex: none; max-width: 45%; }
.pc-sub { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.pc-sub.warn { color: var(--warn); }
.pc-sub .icon { vertical-align: -1px; }
.pc-edited { font-size: 11px; font-weight: 600; color: #f0609e; background: color-mix(in srgb, #f0609e 14%, transparent); border-radius: 4px; padding: 0 5px; flex: none; }
.pc-caret { display: flex; color: var(--muted); transition: transform .15s; }
.preset-chip.open .pc-caret { transform: rotate(180deg); }
/* Switching: the new line comes up from below, and a ring in the preset's colour flashes and fades; 0.6 s in all. */
.pc-line.swap { animation: pc-in .2s cubic-bezier(.2, .9, .3, 1) both; }
.pc-ring { position: absolute; inset: 0; border-radius: 8px; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 2px var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); animation: pc-ring .5s ease-out .1s; }
@keyframes pc-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pc-ring { 30% { opacity: 1; } }
.pm-backdrop { position: fixed; inset: 0; z-index: 75; }
.preset-menu {
  position: fixed; z-index: 76; background: var(--menu); border: 1px solid var(--border-soft); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; font-size: 14px; overflow-y: auto; animation: fade .08s; outline: none;
}
.pm-head { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 6px 8px 4px; }
.pm-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.pm-item.active { background: color-mix(in srgb, var(--ok) 10%, transparent); }
.pm-item.sel { background: var(--hover); }
.pm-item.dis { opacity: .6; }
.pm-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.pm-text b { font-weight: 600; color: var(--strong); }
.pm-text span { font-size: 12px; color: var(--muted); }
.pm-text .warn { color: var(--warn); }
.pm-check { color: var(--ok); display: flex; }
.pm-pen { width: 26px; height: 26px; }
.pm-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }
.pm-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 8px; color: var(--muted); text-align: left; }
.pm-link:hover { background: var(--hover); color: var(--strong); }
.pm-filter { display: flex; align-items: center; gap: 8px; height: 34px; border-radius: 8px; background: var(--field); padding: 0 10px; margin: 2px 2px 6px; color: var(--muted); }
.pm-filter input { flex: 1; min-width: 0; background: none; border: 0; color: var(--strong); font: inherit; outline: none; }
.pm-edited { padding: 6px 8px 8px; }
.pm-edited-title { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.pm-edited-title b { color: var(--strong); }
.pm-edited-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pm-edited-btns .btn { height: 28px; padding: 0 10px; font-size: 13px; }
.kbd { font-size: 11px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); border-radius: 5px; padding: 1px 6px; white-space: nowrap; flex: none; }
.presets-head { margin-top: 4px; }
.presets-head h3 { margin: 0; }
.preset-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.preset-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--side); }
.preset-row.active { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ok) 55%, transparent); }
.preset-grip { color: var(--muted); display: flex; cursor: grab; opacity: .6; }
.preset-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.preset-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.preset-name b { font-weight: 600; color: var(--strong); }
.preset-badge { font-size: 11px; font-weight: 700; color: var(--on-ok); background: var(--ok); border-radius: 4px; padding: 0 6px; letter-spacing: .03em; flex: none; }
.preset-gone { font-size: 12px; color: var(--warn); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.preset-devs { display: flex; gap: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.preset-devs span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.preset-devs .icon { flex: none; }
.preset-empty { margin: 0; }
.preset-editor { border-radius: 12px; background: var(--side); box-shadow: inset 0 0 0 1.5px var(--accent); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.pe-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pe-name { width: 220px !important; }
.pe-icons, .pe-colors { display: flex; gap: 6px; }
.pe-icons button { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); background: var(--field); }
.pe-icons button.active { color: #1e1f22; }
.pe-color { width: 20px; height: 20px; border-radius: 50%; }
.pe-color.active { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px var(--strong); }
.pe-devices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pe-opts { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.pe-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 4px; }
.pe-opts .btn.keybind { min-width: 120px; }
@media (max-width: 700px) { .pe-devices { grid-template-columns: 1fr; } .preset-devs { flex-direction: column; gap: 0; } }
.up-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.up-text .name { font-size: 14px; font-weight: 600; color: var(--strong); }
.up-text .sub { font-size: 12px; color: var(--muted); }

.avatar { position: relative; flex: none; border-radius: 50%; }
.avatar img, .avatar .initials {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center; color: var(--av-fg);
  font-weight: 600; user-select: none;
}
.avatar.speaking::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; box-shadow: 0 0 0 2px var(--ok); }
.status-dot {
  position: absolute; right: -2px; bottom: -2px; width: 42%; height: 42%; min-width: 10px; min-height: 10px;
  border-radius: 50%; box-shadow: 0 0 0 3px var(--dot-ring, var(--side));
}
/* Inline dots (chat header, status menu): no ring; the cut-outs below take the colour behind them. */
.chat-head .status-dot, .menu-item .status-dot { position: relative; inset: auto; width: 10px; height: 10px; box-shadow: none; flex: none; }
.chat-head { --dot-ring: var(--main); }
.menu-item .status-dot { display: inline-block; vertical-align: -1px; margin-right: 10px; --dot-ring: var(--menu); }
.menu-item:hover .status-dot { --dot-ring: var(--accent); }
.status-dot.online { background: var(--ok); }
.status-dot.idle { background: var(--warn); }
.status-dot.dnd { background: var(--danger); }
.status-dot.offline { background: #80848e; }
/* A shape per status, not only a colour: solid dot online, moon idle, bar do-not-disturb, ring offline/invisible.
   Each cut-out is painted in the ring's colour, the background around the dot. */
.status-dot::after { content: ""; position: absolute; background: var(--dot-ring, var(--side)); }
.status-dot.online::after { content: none; }
.status-dot.idle::after { width: 62%; height: 62%; left: -12%; top: -12%; border-radius: 50%; }
.status-dot.dnd::after { left: 20%; right: 20%; top: 38%; height: 24%; border-radius: 4px; }
.status-dot.offline::after { inset: 27%; border-radius: 50%; }

.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 4px; color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--strong); background: var(--hover); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.on { color: var(--strong); }
.icon-btn:disabled { opacity: .4; background: none; color: var(--muted); cursor: not-allowed; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 4px; background: var(--btn); color: #fff; font-weight: 500; font-size: 14px; transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.nextcloud { background: #0082c9; font-weight: 600; height: 44px; }
.btn.link, .btn.danger-link { background: none; color: var(--text); padding: 0 8px; }
.btn.link:hover { text-decoration: underline; filter: none; }
.btn.danger-link { color: var(--danger); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.keybind { min-width: 140px; font-family: "Cascadia Code", Consolas, monospace; }
.btn.keybind.recording { background: var(--danger); }

/* ------------------------------------------------------------ main column */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--main); position: relative; }
.chat-head {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px; color: var(--muted);
  box-shadow: 0 1px 0 rgba(4, 4, 5, .2), 0 1.5px 0 rgba(6, 6, 7, .05), 0 2px 0 rgba(4, 4, 5, .05); z-index: 2;
}
.chat-head .title { color: var(--strong); font-weight: 600; flex: none; max-width: 30%; }
.chat-head .divider { width: 1px; height: 24px; background: var(--border-soft); margin: 0 4px; flex: none; }
.chat-head .topic { font-size: 14px; flex: 1; cursor: default; }
.chat-head .topic .md, .chat-head .topic p { display: inline; }
.search-box { position: relative; width: 150px; transition: width .2s; margin-left: 4px; flex: none; }
.search-box:focus-within { width: min(520px, 45vw); }
.search-field { display: flex; align-items: center; gap: 4px; height: 24px; border-radius: 4px; background: var(--rail); padding: 0 26px 0 4px; overflow-x: auto; scrollbar-width: none; }
.search-field input { flex: 1; min-width: 60px; height: 24px; border: 0; background: none; padding: 0 4px; font-size: 13px; outline: none; }
.search-box > .icon { position: absolute; right: 6px; top: 4px; }
.search-box .chip { display: inline-flex; align-items: center; flex: none; font-size: 12px; background: var(--side); border-radius: 3px; padding: 1px 4px 1px 6px; color: var(--strong); white-space: nowrap; }
.chip-key { color: var(--accent); font-weight: 600; }
.search-box .autocomplete { top: calc(100% + 6px); bottom: auto; left: auto; right: 0; width: min(400px, 90vw); }
.search-box input[type=date] { width: 100%; margin: 0; }
.ac-head { font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 10px 6px; }
.search-hint { font-size: 13px; color: var(--muted); padding: 6px 10px 2px; }
.search-hint b { color: var(--strong); }
::highlight(search) { background: rgba(246, 195, 68, .3); }
.banner { flex: none; display: flex; gap: 12px; align-items: center; justify-content: center; padding: 6px 16px; font-size: 14px; font-weight: 500; }
.banner.warn { background: var(--warn); color: #1e1f22; }
.banner.update { background: var(--ok); color: var(--on-ok); }
.banner.update .icon-btn { color: inherit; }
.banner .btn { background: rgba(0, 0, 0, .25); }

.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.dm-call { height: 45%; min-height: 280px; flex: none; display: flex; }
.chat-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; padding-bottom: 12px; user-select: text; }
.messages > :first-child { margin-top: auto; }
.messages-end { height: 1px; flex: none; }

.channel-start { padding: 16px 16px 8px; }
.channel-start h1 { font-size: 32px; line-height: 1.25; color: var(--strong); margin: 8px 0; }
.channel-start p { color: var(--muted); margin: 0; }
.start-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--input); display: grid; place-items: center; color: var(--strong); }
.loading-more { display: grid; place-items: center; padding: 20px; flex: none; }

.day-divider { position: relative; margin: 24px 16px 8px; border-top: 1px solid var(--border-soft); flex: none; text-align: center; }
.day-divider span { position: relative; top: -10px; background: var(--main); padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.new-divider { position: relative; margin: 8px 16px 0; border-top: 1px solid var(--danger); flex: none; }
.new-divider span { position: absolute; right: -4px; top: -9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 4px 1px 6px; line-height: 14px; }

.message { position: relative; display: flex; flex-wrap: wrap; padding: 2px 48px 2px 0; flex: none; }
.message.head { margin-top: var(--group-gap); }
.message:hover { background: var(--msg-hover); }
.message.mentioned { background: var(--mention-bg); }
.message.mentioned::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--mention-bar); }
.message.highlight { animation: flash 2s ease-out; }
@keyframes flash { 0%, 40% { background: rgba(93, 104, 236, .25); } 100% { background: transparent; } }
.message.pending .msg-content { opacity: .55; }
.message.failed .msg-content { color: var(--danger-text); opacity: 1; }
.msg-gutter { width: 72px; flex: none; display: flex; justify-content: center; }
.msg-avatar { cursor: pointer; margin-top: 2px; height: 40px; }
.msg-avatar:active { transform: translateY(1px); }
.msg-time-hover { visibility: hidden; font-size: 11px; color: var(--faint); line-height: 22px; }
.message:hover .msg-time-hover { visibility: visible; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.author { font-weight: 500; color: var(--strong); cursor: pointer; }
.author:hover { text-decoration: underline; }
.msg-time { font-size: 12px; color: var(--faint); margin-left: 6px; cursor: default; }
.msg-content { color: var(--text); overflow-wrap: anywhere; }
.msg-content > .md, .msg-content > .md > p:last-child { display: inline; }
.msg-content.jumbo { font-size: 3em; line-height: 1.25; }
.edited { font-size: 10px; color: var(--faint); margin-left: 4px; cursor: default; }
.failed-line { font-size: 13px; color: var(--danger-text); }
.message.system { color: var(--muted); }
.message.system .msg-body { line-height: 22px; }
.sys-icon { color: var(--ok); margin-top: 3px; }
.message.system .author { color: var(--strong); }

.reply-bar { flex-basis: 100%; display: flex; align-items: center; gap: 4px; padding-left: 72px; font-size: 14px; color: var(--muted); cursor: pointer; position: relative; line-height: 18px; margin-bottom: 2px; }
.reply-spine { position: absolute; left: 34px; top: 9px; width: 33px; height: 10px; border-left: 2px solid var(--faint); border-top: 2px solid var(--faint); border-top-left-radius: 6px; }
.reply-author { font-weight: 500; color: var(--strong); margin-right: 2px; flex: none; }
.reply-text { opacity: .85; }
.reply-text.deleted { font-style: italic; }
.reply-bar:hover .reply-text { color: var(--strong); }

.md p { margin: 0; white-space: pre-wrap; }
.md h1, .md h2, .md h3 { margin: 8px 0 4px; color: var(--strong); line-height: 1.25; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1em; }
.md .subtext { font-size: .8em; color: var(--muted); }
.md ul, .md ol { margin: 4px 0; padding-left: 24px; }
.md blockquote { margin: 2px 0; padding: 0 8px 0 12px; border-left: 4px solid var(--faint); border-radius: 2px; }
.md code.inline { background: var(--code-bg); padding: 0 .25em; border-radius: 3px; font-size: 85%; font-family: "Cascadia Code", Consolas, "SF Mono", monospace; }
.codeblock { position: relative; max-width: 90%; margin: 4px 0; }
.codeblock pre { margin: 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; overflow-x: auto; font-size: 14px; line-height: 1.4; font-family: "Cascadia Code", Consolas, "SF Mono", monospace; white-space: pre; }
.codeblock .copy { position: absolute; top: 6px; right: 6px; display: none; background: var(--btn); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 3px; }
.codeblock:hover .copy { display: block; }
.spoiler { background: #1a1b1e; color: transparent; border-radius: 3px; cursor: pointer; padding: 0 2px; transition: background .1s; }
.spoiler * { visibility: hidden; }
.spoiler.shown { background: rgba(255, 255, 255, .1); color: inherit; cursor: auto; }
.spoiler.shown * { visibility: visible; }
.mention { background: var(--pill-bg); color: var(--pill-fg); border-radius: 3px; padding: 0 2px; font-weight: 500; cursor: pointer; }
.mention:hover { background: var(--accent); color: #fff; }
.link { color: var(--link); }

.attachments { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; align-items: flex-start; }
.att-image { max-width: min(400px, 100%); height: auto; border-radius: 8px; cursor: zoom-in; background: var(--side); display: block; }
.att-video { max-width: min(480px, 100%); max-height: 320px; border-radius: 8px; background: #000; }
.att-file { display: flex; gap: 10px; align-items: center; background: var(--side); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; max-width: 432px; width: 100%; color: var(--muted); }
.att-file-text { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.att-file-text .sub { font-size: 12px; }
.att-file audio { margin-top: 6px; width: 100%; height: 32px; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px; border-radius: 8px; background: var(--side);
  border: 1px solid transparent; color: var(--muted); font-size: 14px; font-weight: 600;
}
.reaction .emoji { font-size: 16px; line-height: 1; }
.reaction.me { background: var(--pill-bg); border-color: var(--accent); color: var(--pill-fg); }
.reaction:hover { border-color: var(--faint); }
.reaction.add { opacity: 0; padding: 0 4px; }
.message:hover .reaction.add { opacity: 1; }

.toolbar {
  position: absolute; right: 16px; top: -16px; display: none; background: var(--main); border: 1px solid var(--border-soft);
  border-radius: 8px; box-shadow: var(--shadow-s); padding: 2px; z-index: 3;
}
.message:hover .toolbar { display: flex; }
.message.editing .toolbar, .message.editing:hover .toolbar { display: none; }
.toolbar button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.toolbar button:hover { background: var(--hover); color: var(--strong); }
.toolbar button.danger { color: var(--danger); }
.toolbar .tb-emoji { font-size: 18px; }

.inline-editor textarea {
  width: 100%; resize: none; border: 0; outline: none; background: var(--input); border-radius: 8px; padding: 10px 14px;
  color: var(--text); line-height: 1.375; margin: 4px 0;
}
.editor-hint { font-size: 12px; color: var(--muted); }

.new-bar {
  position: absolute; top: 0; left: 16px; right: 16px; z-index: 4; background: var(--accent); color: #fff; font-size: 14px;
  padding: 3px 12px; border-radius: 0 0 8px 8px; display: flex; gap: 4px; justify-content: space-between; opacity: .95;
}
.new-bar button { color: #fff; font-weight: 700; }
.jump-present {
  position: absolute; bottom: 92px; right: 24px; z-index: 4; display: flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border-radius: 16px; padding: 6px 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
}

.composer-wrap { padding: 0 16px; flex: none; position: relative; }
.composer {
  display: flex; align-items: flex-end; background: var(--input); border-radius: 8px; padding: 0 6px; min-height: 44px;
}
.composer textarea {
  flex: 1; background: transparent; border: 0; resize: none; color: var(--text); padding: 11px 6px; max-height: 50vh;
  line-height: 1.375; outline: none; font-size: 1em;
}
.composer textarea::placeholder { color: var(--faint); }
.composer .icon-btn { height: 44px; width: 36px; }
.composer.has-reply, .upload-strip + .composer { border-top-left-radius: 0; border-top-right-radius: 0; }
.composer.locked { align-items: center; gap: 8px; padding: 0 16px; color: var(--muted); font-size: 14px; }
.char-count { align-self: center; font-size: 12px; color: var(--muted); padding: 0 6px; }
.char-count.over { color: var(--danger-text); font-weight: 700; }
.reply-to { display: flex; align-items: center; gap: 8px; background: var(--side); border-radius: 8px 8px 0 0; padding: 4px 8px 4px 16px; font-size: 14px; color: var(--muted); }
.reply-to b { color: var(--strong); }
.ping-toggle { font-weight: 700; font-size: 13px; color: var(--muted); }
.ping-toggle.on { color: var(--accent); }
.upload-strip { display: flex; gap: 16px; overflow-x: auto; background: var(--input); border-radius: 8px 8px 0 0; padding: 20px 12px 10px; border-bottom: 1px solid var(--border-soft); }
.reply-to + .upload-strip { border-radius: 0; }
.upload { position: relative; width: 176px; height: 176px; flex: none; background: var(--side); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.upload img { flex: 1; min-height: 0; object-fit: contain; border-radius: 4px; }
.upload-icon { flex: 1; display: grid; place-items: center; color: var(--muted); }
.upload-name { font-size: 13px; }
.upload-state { font-size: 12px; color: var(--muted); }
.upload.failed .upload-state { color: var(--danger-text); }
.upload .remove { position: absolute; top: -10px; right: -10px; background: var(--main); box-shadow: var(--shadow-s); color: var(--danger); }
.typing { height: 24px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-left: 4px; }
.typing span:not(.dots):not(.slow-mode) { font-weight: 500; }
.typing .slow-mode { margin-left: auto; font-size: 12px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--strong); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.autocomplete {
  position: absolute; bottom: calc(100% + 4px); left: 16px; right: 16px; background: var(--side); border-radius: 8px;
  padding: 8px; box-shadow: var(--shadow); z-index: 6; max-height: 380px; overflow-y: auto;
}
.ac-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.ac-item.selected { background: var(--hover); }
.ac-label { color: var(--strong); }
.ac-detail { margin-left: auto; color: var(--muted); font-size: 13px; }

.drop-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 10; pointer-events: none; }
.drop-card { background: var(--accent); color: #fff; border-radius: 12px; padding: 32px 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow); outline: 2px dashed rgba(255, 255, 255, .6); outline-offset: -10px; }
.drop-title { font-size: 20px; font-weight: 700; }
.drop-sub { font-size: 14px; opacity: .9; }

.members { width: var(--members-w, 240px); flex: none; background: var(--side); padding: 0 8px 20px; }
.members-label { padding: 24px 8px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.member { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px; border-radius: 4px; cursor: pointer; }
.member:hover { background: var(--hover); }
.member.offline { opacity: .35; }
.member.offline:hover { opacity: 1; }
.member-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.member-text .name { color: var(--text); font-weight: 500; }
.member-text .sub { font-size: 12px; color: var(--muted); }
.crown { margin-left: 4px; font-size: 12px; }

.search-panel { width: 420px; flex: none; background: var(--side); display: flex; flex-direction: column; min-height: 0; }
.search-panel header { height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; font-weight: 600; color: var(--strong); }
.search-results { flex: 1; padding: 0 8px 16px; }
.search-hit { margin: 8px 0; background: var(--main); border-radius: 8px; padding: 6px 0; cursor: pointer; }
.search-hit:hover { outline: 1px solid var(--border-soft); }
.hit-channel { padding: 0 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
.search-hit .message.head { margin-top: 4px; }
.search-hit .toolbar, .pin .toolbar { display: none !important; }

.home { flex: 1; padding: 16px 24px; }
.people { max-width: 760px; margin: 0 auto; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--border-soft); border-radius: 8px; cursor: pointer; --dot-ring: var(--main); }
.person:hover { background: var(--hover); border-top-color: transparent; }
.person-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.person-text .name { color: var(--strong); font-weight: 600; }
.person-text .sub { color: var(--muted); font-size: 13px; }
.welcome { text-align: center; padding: 48px 16px; }
.welcome h2 { color: var(--strong); }

/* ------------------------------------------------------------ calls */

.voice-view { flex: 1; display: flex; min-height: 0; background: #000; }
.voice-chat { width: 400px; flex: none; display: flex; flex-direction: column; background: var(--main); min-height: 0; }
.call-idle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; gap: 6px; background: radial-gradient(circle at 50% 35%, #2a2f6b 0, #000 70%); }
.call-idle h2 { margin: 8px 0 0; }
.call-idle p { margin: 0 0 12px; color: #b5bac1; }
.call-idle-icon { width: 96px; height: 96px; border-radius: 50%; background: rgba(255, 255, 255, .08); display: grid; place-items: center; }
.call { flex: 1; display: flex; flex-direction: column; position: relative; background: #000; min-width: 0; min-height: 0; color: #fff; }
/* Dark colour themes: the call sits on the theme's own ground (Splash by default), not black. */
.app.grad.dark .voice-view, .app.grad.dark .call { background: transparent; }
.app.grad.dark .call.theater, .app.grad.dark .call:fullscreen { background: var(--grad); }
.app.grad.dark .tile { background: var(--solid); }
.call-head { display: flex; align-items: center; gap: 8px; height: 30px; padding: 12px 16px 0; flex: none; min-width: 0; font-size: 15px; font-weight: 600; }
.call-head > .icon { flex: none; color: #acafc8; }
.call-count { flex: none; color: #acafc8; font-size: 13px; font-weight: 400; white-space: nowrap; }
/* The channel header above already names the call; the name shows only when the call fills the window. */
.call:not(.theater) .call-head > .icon, .call:not(.theater) .call-title { display: none; }
.call.theater .call-count::before { content: "· "; }
/* Video only: a chip with a little switch, mint when on. */
.vo-chip {
  margin-left: auto; height: 30px; border-radius: 8px; padding: 0 6px 0 10px; display: inline-flex; align-items: center; gap: 8px; flex: none;
  background: rgba(172, 175, 200, .08); color: #acafc8; font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color .15s, color .15s;
}
.vo-chip:hover { background: rgba(172, 175, 200, .16); color: #fff; }
.vo-chip.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.vo-switch { position: relative; width: 30px; height: 18px; border-radius: 9px; background: #3a3c5e; flex: none; }
.vo-switch i { position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #acafc8; transition: transform .15s; }
.vo-chip.on .vo-switch { background: var(--ok); }
.vo-chip.on .vo-switch i { transform: translateX(12px); background: #0c0c22; }
.call-stage { flex: 1; display: flex; flex-direction: column; padding: 10px 16px 12px; gap: 12px; min-height: 0; }
.call-row { flex: 1; min-height: 0; display: flex; position: relative; }
/* Cells: a stream or camera is 2×2, an avatar 1 (columns and rows set by call.rs from the area's size). The 3px
   padding keeps any outer ring inside the scroll box; the talking ring itself is drawn inside each tile. */
.call-grid { flex: 1; min-width: 0; min-height: 0; display: grid; gap: 8px; grid-auto-flow: row dense; overflow: auto; padding: 3px; --cell: 160px; }
.tile { position: relative; background: #232428; border-radius: 10px; overflow: hidden; display: grid; place-items: center; cursor: pointer; min-width: 0; min-height: 0; }
.call-grid:not(.strip):not(.narrow) .tile.vid { grid-column: span 2; grid-row: span 2; }
.call-grid.narrow .tile.vid { grid-column: 1 / -1; aspect-ratio: 16 / 9; align-self: start; }
/* The talking ring, inset: a scroll box can't clip it and videos don't cover it. */
.tile::after { content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none; transition: box-shadow .1s; }
.tile.sounding::after { box-shadow: inset 0 0 0 3px var(--lk-2); }
.tile.speaking::after { box-shadow: inset 0 0 0 3px var(--ok); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile.screen video { background: #000; }
.tile.mirror video { transform: scaleX(-1); }
.tile:fullscreen { border-radius: 0; }
.tile-avatar { display: grid; place-items: center; }
.call-grid .tile-avatar .avatar {
  width: clamp(36px, calc(var(--cell) * .45), 128px) !important; height: clamp(36px, calc(var(--cell) * .45), 128px) !important;
  font-size: clamp(14px, calc(var(--cell) * .18), 51px) !important;
}
.tile-name {
  position: absolute; left: 8px; bottom: 8px; z-index: 5; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 6px; padding: 2px 8px;
  font-size: 13px; font-weight: 600; line-height: 18px; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); transition: box-shadow .1s;
}
.tile-name > * { flex: none; }
.tile-name > .ellipsis { flex: 0 1 auto; min-width: 0; }
.tile.screen .tile-name { top: 8px; bottom: auto; padding: 3px 8px 3px 3px; border-radius: 8px; }
.tile.big.screen .tile-name { top: 12px; left: 12px; }
/* A stream from someone without a camera: the ring goes on the name. */
.tile-name.speaking { box-shadow: 0 0 0 2px var(--ok); }
.tile-watchers { display: inline-flex; align-items: center; gap: 4px; color: #acafc8; font-weight: 500; white-space: nowrap; }
.call-focus { flex: 1; min-height: 0; display: flex; }
.call-focus .tile { flex: 1; }
/* Focus: the rest in one row of small tiles, folded away with the handle on its top edge. */
.call-stage.focused .call-row { flex: none; height: min(calc(var(--row-h, 144px) + 6px), 60%); transition: height .2s; }
.call-stage.focused .call-row.dragging { transition: none; }
.call-stage.focused .call-row.folded { height: 0; }
.call-row.folded .call-grid { visibility: hidden; }
.call-grid.strip { display: flex; overflow-x: auto; overflow-y: hidden; justify-content: safe center; }
.call-grid.strip { container-type: size; }
.call-grid.strip .tile { flex: none; height: 100%; aspect-ratio: 16 / 9; }
.call-grid.strip .tile-avatar .avatar {
  width: clamp(28px, 45cqh, 128px) !important; height: clamp(28px, 45cqh, 128px) !important; font-size: clamp(12px, 18cqh, 51px) !important;
}
/* A low row: the name goes beside the avatar. */
@container (max-height: 100px) {
  .call-grid.strip .tile:not(.vid) { display: flex; justify-content: flex-start; gap: 10px; padding: 0 12px; }
  .call-grid.strip .tile:not(.vid) .tile-name { position: static; background: none; padding: 0; min-width: 0; }
}
.call-grid.strip .tile video { object-fit: cover; }
/* The row's top edge: drag for its height (call.rs). */
.row-resize { position: absolute; left: 0; right: 0; top: -11px; height: 10px; z-index: 4; cursor: row-resize; }
.row-resize::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 2px; border-radius: 1px; transition: background-color .15s; }
.row-resize:hover::after, .row-resize.active::after, .row-resize:focus-visible::after { background: var(--lk-2); }
.resize-cover.rows { cursor: row-resize; }
.call-grid.strip .tile-ctl { display: none; }
.row-handle {
  position: absolute; left: 50%; top: -14px; z-index: 5; transform: translateX(-50%); width: 52px; height: 18px; border-radius: 9px;
  background: #292a48; color: #f0f1fa; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--solid, #000);
}
.row-handle:hover { filter: brightness(1.25); }
/* Controls on someone's video: shown while the mouse moves over it, gone 2 s after it stops (call.rs). */
.tile-ctl { position: absolute; inset: 0; z-index: 3; opacity: 0; pointer-events: none; transition: opacity .3s; }
/* Keyboard focus keeps them up; a mouse click's focus doesn't (they still fade). */
.tile.awake .tile-ctl, .tile-ctl:has(:focus-visible), .mobile .tile.big .tile-ctl { opacity: 1; }
.tile.awake .tile-ctl :is(.tile-popout, .tile-dock), .tile-ctl:has(:focus-visible) :is(.tile-popout, .tile-dock),
.mobile .tile.big .tile-ctl :is(.tile-popout, .tile-dock) { pointer-events: auto; }
.tile-scrim { position: absolute; left: 0; right: 0; bottom: 0; height: 110px; background: linear-gradient(0deg, rgba(6, 6, 18, .82), rgba(6, 6, 18, 0)); }
.tile-scrim.top { top: 0; bottom: auto; height: 70px; background: linear-gradient(180deg, rgba(6, 6, 18, .6), rgba(6, 6, 18, 0)); }
/* Buttons on a video: 36 px, dark glass with a thin edge; on = mint. */
.glass {
  height: 36px; min-width: 36px; border-radius: 10px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(12, 12, 34, .62); color: #f0f1fa; font-size: 14px; font-weight: 500; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); backdrop-filter: blur(10px); transition: background-color .15s;
}
button.glass:hover, .tile-vol button:hover { background: #292a48; }
.glass.on { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 35%, transparent); }
.tile-popout { position: absolute; right: 12px; top: 12px; }
.tile-dock { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tile-dock .grow { flex: 1; }
.tile-vol { padding: 0 10px 0 0; gap: 6px; }
.tile-vol button { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: inherit; }
.tile-vol input { width: 96px; margin: 0; accent-color: var(--ok); }
.q-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #0c0c22; background: var(--ok); border-radius: 4px; padding: 0 5px; line-height: 15px; }
.q-menu .pm-item { width: 100%; text-align: left; }
.q-check { width: 18px; flex: none; }
.q-receiving { padding: 2px 8px 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Video only: the people without video in one strip, or an empty state when nobody has video. */
.vo-strip {
  height: 44px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 6px 0 10px; border-radius: 10px;
  background: rgba(19, 20, 43, .9); font-size: 13px; white-space: nowrap; min-width: 0;
}
.vo-stack { display: flex; flex: none; padding: 3px; }
.vo-stack > * { margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px #13142b; }
.vo-stack > :first-child { margin-left: 0; }
.vo-av { display: flex; }
.vo-count { flex: 1; min-width: 0; }
.vo-count b { font-weight: 600; }
.vo-count .muted { color: #acafc8; }
.vo-show { margin-left: auto; height: 30px; border-radius: 8px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; flex: none; background: #292a48; color: #f0f1fa; font-size: 13px; font-weight: 500; }
.vo-show:hover { filter: brightness(1.2); }
.vo-empty { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; border-radius: 10px; background: rgba(19, 20, 43, .6); text-align: center; }
.vo-empty > .muted { max-width: 400px; color: #acafc8; }
.vo-empty-icon { width: 56px; height: 56px; border-radius: 50%; background: #292a48; color: #acafc8; display: grid; place-items: center; }
.vo-empty-title { font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-size: 20px; font-weight: 600; }
.vo-more { width: 30px; height: 30px; border-radius: 50%; background: #292a48; color: #f0f1fa; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.vo-empty .btn { display: inline-flex; align-items: center; gap: 8px; }
.call-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; padding: 4px 8px 16px; flex: none; }
.call-controls .round { width: 44px; height: 44px; }
/* Stop watching: first in the bar, grey like Camera (never red like Leave), set off by a thin line. */
.call-controls .round.stop-pill { width: auto; padding: 0 18px 0 14px; border-radius: 22px; display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; white-space: nowrap; }
.bar-sep { width: 1px; height: 26px; align-self: center; flex: none; background: rgba(255, 255, 255, .16); }
.round { width: 52px; height: 52px; border-radius: 50%; background: #2b2d31; color: #fff; display: grid; place-items: center; transition: filter .15s, background-color .15s; }
.round:hover { filter: brightness(1.25); }
.round.off { background: #fff; color: var(--danger); }
.round.on { background: var(--ok); color: var(--on-ok); }
.round.danger { background: var(--danger); }
.round.ok { background: var(--ok); color: var(--on-ok); }
.round.ghost { background: transparent; }
/* Fill window: the call over the whole window, sidebars included (below menus and dialogs). */
.call.theater { position: fixed; inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); z-index: 40; }
.app.framed .call.theater { top: 30px; }
.call-connecting { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .75); padding: 6px 14px; border-radius: 16px; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.call-connecting .spinner { width: 16px; height: 16px; border-width: 2px; }
.ptt-hint { position: absolute; top: 56px; right: 16px; background: rgba(0, 0, 0, .6); padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.ptt-hint.live { background: var(--ok); color: var(--on-ok); }

.ringing {
  position: fixed; top: calc(24px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: 260px; background: var(--rail); color: var(--strong);
  border-radius: 12px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: var(--shadow); z-index: 60;
  animation: rise .2s ease-out;
}
.ringing .avatar { animation: pulse 1.6s infinite; }
.ringing-name { font-size: 18px; font-weight: 700; margin-top: 8px; }
.ringing-sub { color: var(--muted); font-size: 14px; }
.ringing-actions { display: flex; gap: 32px; margin-top: 12px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(126, 232, 162, .6); } 100% { box-shadow: 0 0 0 18px rgba(126, 232, 162, 0); } }

/* ------------------------------------------------------------ overlays */

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: grid; place-items: center; z-index: 50; animation: fade .12s; }
.modal-backdrop.image { background: rgba(0, 0, 0, .85); }
.modal {
  background: var(--main); border-radius: 10px; padding: 24px; width: 480px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px); overflow-y: auto; box-shadow: var(--shadow); animation: pop .16s ease-out; user-select: text;
}
.modal.wide { width: min(1080px, calc(100vw - 48px)); height: min(760px, calc(100vh - 48px)); padding: 0; overflow: hidden; }
.modal.image { background: none; box-shadow: none; padding: 0; width: auto; max-width: 92vw; text-align: center; }
.modal h2 { margin: 0 0 8px; color: var(--strong); font-size: 20px; display: flex; align-items: center; gap: 8px; }
.modal-text { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-6px); } }

.form { display: flex; flex-direction: column; gap: 14px; }
.form.narrow { max-width: 420px; }
.form label:not(.check), .modal label:not(.switch-row, .check), .settings-body label:not(.check):not(.btn):not(.switch-row) {
  display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em;
}
.form input:not([type=checkbox]):not([type=radio]):not([type=range]), .form textarea, .form select, .modal select, .wide-input, .profile-note, .pe-name, .switcher-input, .picker-search, .copy-row input, .settings-body select {
  background: var(--field); border: 0; border-radius: 4px; color: var(--text); font-size: 15px; padding: 10px; outline: none;
  text-transform: none; font-weight: 400; letter-spacing: 0; width: 100%;
}
/* Password boxes with the eye (Reveal). */
.forgot-link { align-self: flex-end; margin-top: -8px; font-size: 13px; }
.login-hint.left { text-align: left; }
.login-title.small { font-size: 18px; }
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 44px !important; }
.reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); }
.reveal:hover { color: var(--text); background: var(--hover); }
.reveal.on { color: var(--accent); }
.temp-password { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }
.temp-password code { flex: 1; font-size: 20px; padding: 10px 12px; background: var(--field); border-radius: 6px; letter-spacing: .06em; user-select: all; color: var(--strong); }
.form input:focus, .form textarea:focus, .wide-input:focus, .profile-note:focus { box-shadow: 0 0 0 2px var(--accent); }
.form textarea { resize: vertical; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 10px; text-transform: none; font-size: 15px; font-weight: 400; color: var(--text); margin: 6px 0; cursor: pointer; letter-spacing: 0; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
/* A radio choice is a full-width row, the picked one highlighted (like Discord's). */
.settings-body label.check:has(> input[type=radio]) { background: var(--side); padding: 10px 12px; border-radius: 6px; margin: 0 0 8px; font-weight: 500; }
.settings-body label.check:has(> input[type=radio]):hover { background: var(--hover); }
.settings-body label.check:has(> input[type=radio]:checked) { background: var(--active); color: var(--strong); }
.form-error { color: var(--danger-text); font-size: 14px; }
.form-ok { color: var(--ok); font-size: 14px; }
.blocked-message .msg-body { padding: 2px 0; }
.blocked-list { display: flex; flex-direction: column; gap: 6px; }
.blocked-row { display: flex; align-items: center; gap: 10px; }
.report-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.report-reasons .btn.active { outline: 2px solid var(--accent); }
.report-card { background: var(--side); border-radius: 8px; padding: 12px 14px; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.report-content { margin: 0; padding: 6px 10px; border-left: 3px solid var(--danger, #e5484d); white-space: pre-wrap; word-break: break-word; }
.report-done { padding: 2px 0; }
.totp-setup { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.totp-qr { background: #fff; padding: 8px; border-radius: 8px; line-height: 0; }
.totp-qr svg { width: 180px; height: 180px; }
.totp-key { font-size: 15px; letter-spacing: 1px; user-select: all; word-break: break-all; }
.recovery-codes { background: var(--side); padding: 12px 16px; border-radius: 8px; font-size: 15px; line-height: 1.7; user-select: all; width: fit-content; }
.wide-input { margin-bottom: 8px; }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 700; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.copy-row { display: flex; gap: 8px; background: var(--field); border-radius: 6px; padding: 4px; margin-bottom: 16px; }
.copy-row input { background: transparent !important; }
.invite-preview { display: flex; gap: 12px; align-items: center; background: var(--side); border-radius: 8px; padding: 12px; }
.space-initials.big { width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.kind-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.composer.locked .btn { margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.kind-pick { display: flex; flex-direction: column; gap: 8px; }
.modal label.kind { flex-direction: row; align-items: center; gap: 12px; background: var(--side); padding: 10px 12px; border-radius: 6px; text-transform: none; font-size: 15px; color: var(--text); font-weight: 400; cursor: pointer; letter-spacing: 0; }
.modal label.kind.active { background: var(--active); }
.modal label.kind input { display: none; }
.modal label.kind .muted { font-size: 13px; }

.menu { position: fixed; z-index: 77; min-width: 188px; max-width: 240px; background: var(--menu); border-radius: 6px; padding: 6px 8px; box-shadow: var(--shadow); animation: fade .08s; }
.menu-item { display: block; width: 100%; text-align: left; padding: 7px 8px; border-radius: 3px; font-size: 14px; color: var(--text); margin: 1px 0; font-weight: 500; }
.menu-item:hover { background: var(--accent); color: #fff; }
.menu-item.danger { color: var(--danger-text); }
.menu-item.danger:hover { background: var(--danger); color: #fff; }
.menu-sep { height: 1px; background: var(--border-soft); margin: 4px 4px; }

.profile { position: fixed; z-index: 65; width: 320px; background: var(--menu); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); animation: fade .1s; user-select: text; }
.profile-banner { height: 60px; }
.profile-avatar { margin: -40px 0 0 16px; width: max-content; border-radius: 50%; box-shadow: 0 0 0 6px var(--menu); --dot-ring: var(--menu); }
.profile-body { padding: 10px 16px 16px; }
.profile-name { font-size: 20px; font-weight: 700; color: var(--strong); }
.profile-username { color: var(--muted); font-size: 14px; display: flex; align-items: center; }
.profile-status { margin-top: 8px; font-size: 14px; }
.profile-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 14px; }
.profile-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--strong); margin-bottom: 4px; }
.profile-note { margin-top: 14px; }
.profile .btn { margin-top: 14px; }
/* Space profile: the form beside a preview of the popout, stacked on a phone. */
.modal:has(> .space-profile) { width: 760px; }
.space-profile { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
.space-profile-pic { display: flex; align-items: center; gap: 12px; }
.space-profile-pic .btn.link { color: var(--muted); }
.profile.preview { position: static; width: auto; box-shadow: none; animation: none; }
@media (max-width: 700px) { .space-profile { grid-template-columns: 1fr; } }
.tag { font-size: 10px; font-weight: 700; background: var(--accent); color: #fff; padding: 1px 5px; border-radius: 3px; margin-left: 6px; letter-spacing: .02em; }
.role-chip { font-size: 12px; background: var(--side); border: 1px solid var(--border-soft); border-radius: 4px; padding: 2px 8px; color: var(--muted); }

.picker-backdrop { position: fixed; inset: 0; z-index: 66; }
.picker { position: fixed; z-index: 67; width: 352px; height: 420px; background: var(--side); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: fade .08s; }
.picker-search { margin: 10px 10px 6px; width: calc(100% - 20px) !important; height: 32px; padding: 0 10px !important; }
.picker-tabs { display: flex; padding: 0 8px 6px; gap: 2px; border-bottom: 1px solid var(--border-soft); }
.picker-tabs button { flex: 1; height: 30px; font-size: 17px; border-radius: 4px; opacity: .55; filter: grayscale(.6); }
.picker-tabs button:hover, .picker-tabs button.active { opacity: 1; filter: none; background: var(--hover); }
.picker-grid { flex: 1; padding: 4px 8px; }
.picker-row { display: grid; grid-template-columns: repeat(8, 1fr); }
.picker-row button { font-size: 24px; height: 40px; border-radius: 4px; line-height: 1; }
.picker-row button:hover { background: var(--hover); }
.picker-label { font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 4px 4px; text-transform: uppercase; }
.picker-foot { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--elev); font-size: 14px; color: var(--strong); }
.picker-foot .big { font-size: 26px; }

/* GIF picker */
.gif-picker { width: min(424px, calc(100vw - 16px)); height: min(480px, calc(100dvh - 16px)); }
.gif-head { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 6px; border-bottom: 1px solid var(--border-soft); }
.gif-head .picker-search { margin: 8px 4px; flex: 1; width: auto !important; }
.gif-title { font-weight: 700; color: var(--strong); padding: 0 6px; }
.gif-body { flex: 1; padding: 8px; }
.gif-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gif-tile { position: relative; height: 100px; border-radius: 6px; overflow: hidden; background: var(--elev); }
.gif-tile.trending { background: linear-gradient(135deg, var(--accent), #8a5cf6); }
.gif-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gif-tile span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; background: rgb(0 0 0 / .45); color: #fff; font-weight: 700; font-size: 15px; text-transform: capitalize; text-shadow: 0 1px 2px rgb(0 0 0 / .6); }
.gif-tile:hover span { background: rgb(0 0 0 / .25); }
.gif-grid { display: flex; gap: 6px; align-items: flex-start; }
.gif-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.gif-item { position: relative; border-radius: 6px; overflow: hidden; background: var(--elev); cursor: pointer; }
.gif-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-item:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.gif-star { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(0 0 0 / .55); opacity: 0; transition: opacity .1s; }
.gif-item:hover .gif-star, .gif-star.on, .mobile .gif-star { opacity: 1; }
.gif-star.on { color: #f5c518; }
.gif-star.on svg { fill: currentColor; }
.gif-note { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.gif-btn span { font-size: 11px; font-weight: 800; letter-spacing: .02em; border: 2px solid currentColor; border-radius: 4px; padding: 1px 3px; line-height: 1.1; }

.switcher-input { font-size: 20px !important; height: 56px; margin-bottom: 12px; }
.switcher-label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 4px 0; }
.switcher-list { max-height: 50vh; overflow-y: auto; }
.switcher-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 4px; cursor: pointer; color: var(--text); --dot-ring: var(--main); }
.switcher-item.selected { background: var(--hover); color: var(--strong); }
.switcher-tip { margin-top: 12px; }

.shortcuts { display: flex; flex-direction: column; }
.sc-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
kbd { background: var(--side); border-radius: 4px; padding: 2px 8px; font-family: inherit; font-size: 13px; font-weight: 600; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); white-space: nowrap; color: var(--strong); }
.pick-list { max-height: 45vh; }
.pick { display: flex !important; flex-direction: row !important; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 4px; cursor: pointer; text-transform: none !important; font-size: 15px !important; color: var(--text) !important; font-weight: 400 !important; --dot-ring: var(--main); }
.pick:hover { background: var(--hover); }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.lightbox { max-width: 90vw; max-height: 84vh; border-radius: 6px; display: block; margin: 0 auto; }
.lightbox-link { color: #fff; opacity: .75; font-size: 14px; display: inline-block; margin-top: 10px; }
.pins { max-height: 60vh; }
.pin { background: var(--side); border-radius: 8px; padding: 4px 0 10px; margin-bottom: 10px; }
.pin .message.head { margin-top: 4px; }
.pin-actions { display: flex; gap: 8px; padding: 0 16px 0 72px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 8px; font-size: 14px; }
.crumb { color: var(--link); }
.crumbs .sep { color: var(--faint); margin: 0 2px; }
.nc-list { max-height: 50vh; margin-bottom: 8px; }
.nc-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 4px; cursor: pointer; }
.nc-item:hover { background: var(--hover); }
.nc-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 8px 0; }

.toasts { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--menu); color: var(--strong); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: pop .16s ease-out; max-width: 520px; }
.toast.error { background: var(--danger); color: #fff; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast-btn { pointer-events: auto; flex: none; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--hover); color: var(--strong); font-weight: 600; font-size: 13px; }
.toast-btn:hover { background: var(--active); }

.spinner { width: 24px; height: 24px; border: 3px solid var(--border-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 8px auto; flex: none; }

/* ------------------------------------------------------------ settings */

.settings { display: flex; height: 100%; }
.settings-nav { width: 232px; flex: none; background: var(--side); padding: 32px 8px 16px 16px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.settings-nav button { text-align: left; padding: 6px 10px; border-radius: 4px; color: var(--muted); font-size: 15px; font-weight: 500; display: flex; align-items: center; }
.settings-nav button:hover { background: var(--hover); color: var(--text); }
.settings-nav button.active { background: var(--active); color: var(--strong); }
.settings-nav button.danger { color: var(--danger-text); }
.settings-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 10px; }
.settings-sep { height: 1px; background: var(--border-soft); margin: 8px 10px; }
.settings-nav .settings-version { margin-top: auto; font-size: 12px; color: var(--faint); padding: 10px; }
.settings-nav .settings-version:hover { background: none; color: var(--text); }
/* What's new: the popup after an update, and Settings › What's new. */
.wn-ver { font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-weight: 600; color: var(--strong); font-size: 16px; }
.wn-x { margin-left: auto; }
.wn-new { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: #fff; }
.wn-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin: 12px 0 4px; }
.wn-release { border-top: 1px solid var(--border-soft); padding: 10px 0; }
.wn-release > summary, .wn-line > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.wn-release > summary::-webkit-details-marker, .wn-line > summary::-webkit-details-marker { display: none; }
.wn-release > summary > svg { margin-left: auto; color: var(--muted); transform: rotate(-90deg); transition: transform .15s; }
.wn-line > summary > svg { color: var(--muted); transform: rotate(-90deg); transition: transform .15s; flex: none; }
.wn-release[open] > summary > svg, .wn-line[open] > summary > svg { transform: none; }
.wn-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.wn-list .md, .wn-line > .md { color: var(--muted); font-size: 14px; }
.wn-list .md strong { color: var(--strong); }
.wn-head { display: flex; align-items: center; gap: 8px; margin: 24px 0 4px; }
.wn-line { padding: 4px 0; color: var(--text); }
.wn-line > .md { padding: 4px 0 6px 22px; }
.modal label.check.wn-off { margin: 0 auto 0 0; font-size: 14px; color: var(--muted); }
.settings-body { flex: 1; padding: 48px 56px; position: relative; user-select: text; }
.settings-body h2 { margin: 0 0 20px; color: var(--strong); font-size: 20px; }
.settings-body h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 28px 0 10px; letter-spacing: .02em; }
.settings-close { position: absolute; right: 24px; top: 24px; border: 2px solid var(--muted); border-radius: 50% !important; width: 36px !important; height: 36px !important; }
.account-card, .profile-edit { display: flex; gap: 24px; align-items: flex-start; background: var(--side); padding: 20px; border-radius: 8px; --dot-ring: var(--side); }
.account-card { align-items: center; }
.avatar-edit { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 150px; flex: none; text-align: center; }
.big-name { font-size: 20px; font-weight: 700; color: var(--strong); }
.device { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--side); margin: 0 0 8px; color: var(--text); }
.member-line { display: flex; align-items: center; gap: 12px; padding: 8px; border-bottom: 1px solid var(--border-soft); --dot-ring: var(--main); }
.space-icon-big { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 28px; font-weight: 700; }
.space-icon-big img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------ sign-in & loading */

.login {
  /* The column, not the card, caps the width: a grid track sized by a 440px card ignores max-width and runs off a phone. */
  height: 100%; width: 100%; display: grid; grid-template-columns: minmax(0, 440px); justify-content: center; align-items: center; align-content: center; overflow-y: auto; padding: 24px;
  /* The logo's two ends glowing in the corners: pink earcup top left, turquoise mic bottom right. */
  background: radial-gradient(circle at 15% 10%, rgba(240, 96, 158, .32) 0, transparent 45%),
              radial-gradient(circle at 90% 95%, rgba(48, 213, 200, .28) 0, transparent 45%), #0c0c22;
}
.login-card { background: var(--main); border-radius: 14px; padding: 32px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 16px; user-select: text; }
.login-brand { display: flex; align-items: center; font-size: 44px; }
/* The wordmark (Wordmark in ui/icons.rs): 1em is the glyphs' em; the L's foot hangs below the baseline. */
.wordmark { width: 2.787em; height: 1.096em; flex: none; color: var(--strong); }
.login-title { font-size: 22px; font-weight: 700; color: var(--strong); }
.login-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.login-hint { font-size: 13px; color: var(--muted); text-align: center; }
.tabs { display: flex; gap: 4px; background: var(--field); padding: 4px; border-radius: 6px; }
.tabs button { flex: 1; height: 32px; border-radius: 4px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs button.active { background: var(--main); color: var(--strong); box-shadow: var(--shadow-s); }
.tabs button:disabled { opacity: .4; cursor: not-allowed; }
.loading { height: 100%; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--main); color: var(--muted); }
.loading-mark { color: var(--accent); animation: bob 1.6s ease-in-out infinite; }

/* ------------------------------------------------------------ compact mode */

.compact .message.head { margin-top: calc(var(--group-gap) / 3); }
.compact .message { padding-top: 1px; padding-bottom: 1px; }
.compact .msg-gutter { width: 56px; }
.compact .msg-avatar { height: 24px; }
.compact .msg-avatar .avatar { width: 24px !important; height: 24px !important; font-size: 10px !important; }
.compact .reply-bar { padding-left: 56px; }
.compact .reply-spine { left: 26px; width: 26px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 900px) {
  .members, .search-panel { display: none; }
  .voice-chat { width: 300px; }
}

/* ------------------------------------------------------------ threads */

.thread-row { height: 28px; margin-left: 22px; padding-left: 14px; font-size: 14px; }
.thread-spine { position: absolute; left: -2px; top: -6px; width: 12px; height: 20px; border-left: 2px solid var(--border-soft); border-bottom: 2px solid var(--border-soft); border-bottom-left-radius: 8px; }
.thread-row.unread .name { font-weight: 600; }
.thread-card {
  margin-top: 6px; max-width: 480px; background: var(--side); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s;
}
.thread-card:hover { border-color: var(--accent); }
.thread-card-top { display: flex; align-items: baseline; gap: 10px; }
.thread-name { font-weight: 600; color: var(--strong); }
.thread-count { color: var(--link); font-size: 14px; font-weight: 600; }
.thread-last { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; }
.thread-last b { color: var(--strong); font-weight: 500; flex: none; }
.thread-panel {
  width: min(480px, 45%); flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--main);
  border-left: 1px solid var(--border-soft);
}
.thread-panel .chat-head .title { max-width: none; flex: 1; }
.banner.archived { background: var(--side); color: var(--muted); font-weight: 400; }
.thread-start .start-icon { color: var(--accent); }
.thread-starter { background: var(--side); border-radius: 8px; padding: 4px 0 8px; margin-bottom: 16px; max-height: 200px; overflow: hidden; }
.thread-starter .message.head { margin-top: 4px; }
.thread-starter .toolbar { display: none !important; }
.thread-list { max-height: 55vh; margin-top: 12px; }
.thread-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 6px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.thread-item:hover { background: var(--hover); }
@media (max-width: 1100px) { .thread-panel { width: 50%; } }

.camera-row { align-items: flex-end; }
.camera-preview { width: 100%; max-width: 480px; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; margin-top: 12px; transform: scaleX(-1); object-fit: cover; }

/* ------------------------------------------------------------ phones (one column at a time) */

.app { height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.shell { height: 100%; position: relative; }
.icon-btn.back { margin-left: -8px; }
.icon-btn.send { color: var(--accent); }

.mobile .shell[data-pane="nav"] .main,
.mobile .shell[data-pane="nav"] .members { display: none; }
.mobile .shell[data-pane="chat"] .rail,
.mobile .shell[data-pane="chat"] .sidebar,
.mobile .shell[data-pane="members"] .rail,
.mobile .shell[data-pane="members"] .sidebar { display: none; }
.mobile .sidebar { flex: 1; width: auto; }
.mobile .members { position: absolute; inset: 0; width: 100%; z-index: 12; padding-top: 0; }
.mobile .members .chat-head { margin: 0 -8px 4px; position: sticky; top: 0; background: var(--side); }
.mobile .chat-body { position: relative; }
.mobile .thread-panel, .mobile .search-panel { position: absolute; inset: 0; width: 100%; z-index: 12; border-left: 0; }
.mobile .voice-chat { position: absolute; inset: 0; width: 100%; z-index: 12; }
.mobile .chat-head { padding-left: 12px; gap: 4px; }
.mobile .chat-head .divider, .mobile .chat-head .topic { display: none; }
.mobile .chat-head .title { max-width: none; flex: 1; }
.mobile .search-box { width: 36px; }
.mobile .search-field { background: none; }
.mobile .search-field input { color: transparent; cursor: pointer; }
.mobile .search-field input::placeholder { color: transparent; }
.mobile .search-box:not(:focus-within) .chip { display: none; }
.mobile .search-box:focus-within { position: absolute; left: 8px; right: 8px; width: auto; z-index: 5; }
.mobile .search-box:focus-within .search-field { background: var(--rail); height: 34px; }
.mobile .search-box:focus-within input { color: var(--text); }
.mobile .search-box .icon { top: 9px; right: 10px; pointer-events: none; }
.mobile .message { padding-right: 12px; }
.mobile .msg-gutter { width: 60px; }
.mobile .reply-bar { padding-left: 60px; }
.mobile .reply-spine { left: 28px; width: 28px; }
.mobile .messages { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mobile .toolbar { top: -20px; right: 8px; }
.mobile .composer-wrap { padding: 0 8px; }
.mobile .jump-present { bottom: 84px; right: 12px; }
.mobile .channel, .mobile .dm { min-height: 40px; }
.mobile .menu { min-width: 220px; }
.mobile .menu-item { padding: 11px 10px; font-size: 15px; }
.mobile .modal { width: calc(100vw - 16px); max-width: calc(100vw - 16px); padding: 20px 16px; }
.mobile .modal.wide { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.mobile .settings { flex-direction: column; }
.mobile .settings-nav { width: auto; flex-direction: row; overflow-x: auto; padding: 8px 52px 8px 8px; gap: 4px; flex: none; scrollbar-width: none; }
.mobile .settings-nav button { white-space: nowrap; flex: none; }
.mobile .settings-group, .mobile .settings-sep, .mobile .settings-version { display: none; }
.mobile .settings-body { padding: 16px; }
.mobile .settings-close { top: 6px; right: 6px; }
.mobile .account-card, .mobile .profile-edit { flex-direction: column; align-items: stretch; }
.mobile .avatar-edit { width: auto; }
.mobile .row.gap { flex-wrap: wrap; }
.mobile .call-controls { gap: 10px; }
.mobile .round { width: 48px; height: 48px; }
.mobile .call-stage { padding: 8px; }
.mobile .call-head { padding: 8px 8px 0; }
.mobile .vo-label, .mobile .round.stop-pill span { display: none; }
.mobile .call-controls .round.stop-pill { width: 48px; padding: 0; justify-content: center; }
.mobile .toasts { width: calc(100vw - 32px); }
.mobile .login { padding: 12px; }
.mobile .login-card { padding: 24px 20px; }
.mobile .profile { left: 8px !important; right: 8px; width: auto; }
.mobile .new-bar { left: 8px; right: 8px; }

/* ------------------------------------------------------------ themes: darker, midnight, colour themes */

.app.darker {
  --rail: #111214; --side: #1a1b1e; --main: #202124; --elev: #161719; --input: #2a2b2f; --field: #111214;
  --border: #0c0d0f; --code-bg: #18191c; --scroll: #0c0d0f; --menu: #0c0d0f;
}
.app.midnight {
  --rail: #000; --side: #000; --main: #000; --elev: #0b0b0d; --input: #16171a; --field: #0b0b0d; --menu: #0b0b0d;
  --border: #1a1a1d; --border-soft: rgba(78, 80, 88, .38); --code-bg: #101012; --scroll: #222327; --hover: rgba(78, 80, 88, .22);
}

/* Colour themes: a gradient behind see-through panels; pop-ups stay solid so they read over anything. */
.grad-mint { --grad: linear-gradient(135deg, #e3fbef 0%, #b3ecd5 55%, #8fdcc6 100%); --solid: #effbf5; }
.grad-peach { --grad: linear-gradient(135deg, #fff1e3 0%, #ffd2b8 55%, #ffb8b0 100%); --solid: #fff5ee; }
.grad-lavender { --grad: linear-gradient(135deg, #f1edff 0%, #d9d4ff 55%, #bfc9fb 100%); --solid: #f5f3ff; }
.grad-candy { --grad: linear-gradient(135deg, #ffe6f4 0%, #f4d9ff 50%, #d3e3ff 100%); --solid: #fdf2fa; }
.grad-sky { --grad: linear-gradient(135deg, #eaf8ff 0%, #c9ebff 55%, #a9dcfb 100%); --solid: #f1faff; }
.grad-sand { --grad: linear-gradient(135deg, #fbf6e9 0%, #f1e6c6 55%, #e4d3a5 100%); --solid: #fbf7ee; }
.grad-twilight { --grad: linear-gradient(135deg, #1d1b4b 0%, #43205f 50%, #8a2e66 100%); --solid: #24204f; }
.grad-ocean { --grad: linear-gradient(135deg, #082640 0%, #0e4f63 55%, #13797a 100%); --solid: #0c2c46; }
.grad-forest { --grad: linear-gradient(135deg, #0d1f15 0%, #1b3f29 55%, #3a6233 100%); --solid: #13281c; }
.grad-ember { --grad: linear-gradient(135deg, #220909 0%, #5c1616 55%, #9a3b22 100%); --solid: #2a0d0d; }
.grad-grape { --grad: linear-gradient(135deg, #1e0f30 0%, #3e1d63 55%, #5f2d8f 100%); --solid: #26143b; }
.grad-sunset { --grad: linear-gradient(135deg, #2f1740 0%, #8c3a58 55%, #c96a3d 100%); --solid: #351b46; }
.grad-neon { --grad: linear-gradient(135deg, #10002a 0%, #4b0a8c 50%, #00838f 100%); --solid: #160433; }
.grad-abyss { --grad: linear-gradient(135deg, #04060f 0%, #0b1433 55%, #16245c 100%); --solid: #070b1a; }
/* Splash, the default: indigo with faint glows of the logo's pink (top left) and turquoise (bottom right). */
.grad-splash {
  --grad: radial-gradient(120% 70% at 0% 0%, rgba(240, 96, 158, .16), transparent 60%), radial-gradient(110% 70% at 100% 100%, rgba(48, 213, 200, .14), transparent 60%), #1a1b34;
  --solid: #13142b;
}

.app.grad { background: var(--grad); }
.app.grad.dark {
  --rail: rgba(0, 0, 0, .42); --side: rgba(0, 0, 0, .28); --main: rgba(0, 0, 0, .14); --elev: rgba(0, 0, 0, .34);
  --input: rgba(255, 255, 255, .08); --field: rgba(0, 0, 0, .32); --code-bg: rgba(0, 0, 0, .3); --border: rgba(0, 0, 0, .25);
  --hover: rgba(255, 255, 255, .07); --active: rgba(255, 255, 255, .13); --scroll: rgba(255, 255, 255, .18); --menu: var(--solid);
}
.app.grad.light {
  --rail: rgba(255, 255, 255, .28); --side: rgba(255, 255, 255, .42); --main: rgba(255, 255, 255, .6); --elev: rgba(255, 255, 255, .5);
  --input: rgba(255, 255, 255, .7); --field: rgba(255, 255, 255, .55); --code-bg: rgba(255, 255, 255, .55); --border: rgba(0, 0, 0, .08);
  --hover: rgba(0, 0, 0, .05); --active: rgba(0, 0, 0, .1); --scroll: rgba(0, 0, 0, .18); --menu: var(--solid);
}
/* Splash brings its own solid panels; only the chat area lets the glow through. White on the accent is 4.6:1. */
.app.grad.grad-splash {
  --rail: #0c0c22; --side: #13142b; --main: rgba(26, 27, 52, .3); --elev: #0c0c22; --input: #292a48; --field: #0c0c22;
  --hover: rgba(172, 175, 200, .1); --active: #292a48; --code-bg: #13142b; --border: #0c0c22; --border-soft: rgba(172, 175, 200, .16);
  --scroll: #292a48; --text: #f0f1fa; --strong: #f0f1fa; --muted: #acafc8; --faint: #8b8eb0;
  --accent: #c04d7e; --accent-2: #a8416d; --link: #30d5c8; --mention-bg: rgba(240, 96, 158, .1); --mention-bar: #f0609e;
  /* The four accents: turquoise, pink, yellow, mint (mint is also --ok: voice, camera, screen share, talking). */
  --av-0: #30d5c8; --av-1: #f0609e; --av-2: #f6c344; --av-3: #7ee8a2; --av-4: #30d5c8; --av-5: #f0609e; --av-6: #f6c344; --av-7: #7ee8a2; --av-fg: #1e1f22;
}
.app.grad .modal:not(.image), .app.grad .login-card { background: var(--solid); }
.app.grad .modal.wide { background: var(--grad); }
.app.grad .picker, .app.grad .profile, .app.grad .toast, .app.grad .preset-menu, .app.grad .day-divider span { background-color: var(--solid); }

/* ------------------------------------------------------------ accessibility */

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
.underline-links .md a { text-decoration: underline; }

/* ------------------------------------------------------------ settings controls */

label.switch-row {
  display: flex; flex-direction: row; align-items: center; gap: 16px; padding: 12px 0; margin: 0;
  border-bottom: 1px solid var(--border-soft); cursor: pointer; text-transform: none; letter-spacing: 0;
}
.switch-label { color: var(--strong); font-size: 15px; font-weight: 500; }
input.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; border-radius: 12px; margin: 0;
  background: #80848e; position: relative; cursor: pointer; transition: background-color .15s;
}
input.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sub-setting { padding-left: 24px; }
.sub-setting.disabled { opacity: .45; pointer-events: none; }

.tile-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 4px; }
.theme-tile {
  width: 60px; height: 60px; border-radius: 10px; background: var(--grad, #313338); position: relative;
  box-shadow: inset 0 0 0 1px rgba(128, 132, 142, .45); transition: transform .12s;
}
.theme-tile:hover:not(:disabled) { transform: translateY(-2px); }
.theme-tile:disabled { opacity: .35; cursor: not-allowed; }
.theme-tile.base-light { background: #fff; }
.theme-tile.base-dark { background: #313338; }
.theme-tile.base-darker { background: #1a1b1e; }
.theme-tile.base-midnight { background: #000; }
.theme-tile.active, .app-icon-pick.active, .accent-dot.active { box-shadow: 0 0 0 2px var(--main), 0 0 0 4px var(--accent); }
.theme-tile.active::after, .app-icon-pick.active::after {
  content: "\2713"; position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.accent-dot { width: 32px; height: 32px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.app-icon-pick { width: 56px; height: 56px; border-radius: 14px; position: relative; padding: 0; }
.app-icon-pick img { width: 100%; height: 100%; display: block; border-radius: 13px; }
.choice-row { display: flex; gap: 12px; flex-wrap: wrap; }
.choice {
  flex: 1; min-width: 180px; text-align: left; padding: 12px 14px; border-radius: 8px; background: var(--side);
  display: flex; flex-direction: column; gap: 2px; box-shadow: inset 0 0 0 1px var(--border-soft);
}
.choice b { color: var(--strong); }
.choice.active { box-shadow: inset 0 0 0 2px var(--accent); }
.slider-row { display: flex; align-items: center; gap: 14px; max-width: 520px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); }
.slider-value { width: 52px; text-align: right; color: var(--strong); font-variant-numeric: tabular-nums; }
.slider-value.wide { width: 150px; }
/* Segmented buttons (Go Live, camera quality). */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 6px; background: var(--side); }
.seg button { padding: 6px 12px; border-radius: 4px; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg button:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.seg button.active { background: var(--active); color: var(--strong); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.modal:has(> .golive-grid) { width: min(620px, calc(100vw - 32px)); }
.golive-presets { margin: 4px 0 18px; }
.golive-presets .choice { min-width: 160px; }
.golive-grid { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: center; margin-bottom: 14px; }
.golive-grid .seg { justify-self: start; }
.golive-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.golive-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; padding: 10px 12px; border-radius: 6px; background: var(--side); font-size: 14px; }
.golive-stats b { color: var(--ok); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
.golive-stats .warn { color: var(--warn, #f0b232); }
.mobile .golive-grid { grid-template-columns: 1fr; }
.tile-stats { position: absolute; right: 8px; top: 8px; z-index: 2; padding: 3px 8px; border-radius: 4px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
.btn.sound-pick { background: var(--side); color: var(--text); gap: 6px; }
.btn.sound-pick.active { background: var(--accent); color: #fff; }
.test-row { margin-top: 20px; }
.keybind-row { display: flex; align-items: flex-end; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.keybind-row .btn.keybind { width: 100%; justify-content: flex-start; }

/* ------------------------------------------------------------ roles */

.role-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.role-chip.add { width: 24px; justify-content: center; font-weight: 700; cursor: pointer; padding: 2px 0; }
.role-chip.owner-chip { color: #f0b232; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.role-emoji { font-size: 12px; }
.chip-x { color: var(--muted); font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.chip-x:hover { color: var(--danger-text); }
.role-pick {
  margin-top: 6px; background: var(--menu); border-radius: 6px; padding: 6px; box-shadow: var(--shadow-s);
  display: flex; flex-direction: column; max-height: 180px; overflow-y: auto;
}
.role-pick button { text-align: left; padding: 6px 8px; border-radius: 4px; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.role-pick button:hover { background: var(--hover); }

.default-perms {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px; margin: 8px 0 20px;
  background: var(--side); border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border-soft); color: var(--muted);
}
.default-perms:hover { background: var(--hover); }
.chev-right { transform: rotate(-90deg); display: inline-flex; }
.roles-tools { margin-bottom: 8px; }
.roles-table { margin-top: 12px; }
.roles-head { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 0 8px 8px; border-bottom: 1px solid var(--border-soft); }
.roles-count { width: 80px; text-align: right; display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--muted); }
.roles-actions { width: 72px; display: inline-flex; justify-content: flex-end; gap: 4px; }
.role-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-bottom: 1px solid var(--border-soft); border-radius: 4px; cursor: pointer; }
.role-row:hover { background: var(--hover); }
.role-row.dragging { opacity: .4; }
.role-grip { color: var(--faint); cursor: grab; display: inline-flex; }
.role-shield { width: 22px; display: inline-flex; justify-content: center; font-size: 16px; }
.role-name { color: var(--strong); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.role-lock { color: var(--muted); display: inline-flex; }

.role-editor { padding-bottom: 72px; }
.back-link { padding: 0; height: auto; margin-bottom: 12px; color: var(--muted); background: none; gap: 4px; }
.back-link:hover { color: var(--strong); }
.editor-tabs { margin: 8px 0 16px; max-width: 520px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled { opacity: .7; }
.accent-dot.no-colour { background: repeating-linear-gradient(45deg, var(--side) 0 4px, var(--border-soft) 4px 8px); }
.colour-input { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.colour-input::-webkit-color-swatch-wrapper { padding: 0; }
.colour-input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.wide-input.emoji-input { width: 80px; text-align: center; font-size: 18px; }
.emoji-pick { width: 36px; height: 36px; border-radius: 8px; font-size: 18px; }
.emoji-pick:hover { background: var(--hover); }
.emoji-pick.active { box-shadow: inset 0 0 0 2px var(--accent); }
/* Inside a .form the generic label look (caps, column) must not leak into the switch row. */
.form label.switch-row { flex-direction: row; gap: 16px; text-transform: none; letter-spacing: 0; font-size: inherit; font-weight: inherit; color: inherit; }
label.switch-row.off-limits { opacity: .55; cursor: not-allowed; }
.save-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; margin-top: 24px; padding: 10px 12px 10px 16px;
  background: var(--menu); color: var(--strong); border-radius: 8px; box-shadow: var(--shadow); animation: rise-in .18s ease-out;
}
@keyframes rise-in { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------ channel permissions */

.private-lock { color: var(--faint); display: inline-flex; margin-left: -2px; }
.add-target { margin-top: 10px; background: var(--field); color: var(--text); border: 0; border-radius: 4px; padding: 6px 8px; font-size: 13px; }
.add-viewer { margin-top: 10px; max-width: 360px; }
.perm-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.perm-row.off-limits { opacity: .55; }
.tri { display: flex; flex: none; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border-soft); }
.tri button { width: 34px; height: 30px; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.tri button:hover:not(:disabled) { background: var(--hover); }
.tri button:disabled { cursor: not-allowed; }
.tri .deny.active { background: var(--danger); color: #fff; }
.tri .inherit.active { background: var(--btn); color: #fff; }
.tri .allow.active { background: var(--ok); color: var(--on-ok); }

/* ------------------------------------------------------------ link previews */

.embed {
  max-width: 440px; margin-top: 6px; padding: 10px 14px 14px 12px; border-radius: 4px; background: var(--side);
  border-left: 4px solid var(--border-soft); display: flex; flex-direction: column; gap: 6px; user-select: text;
}
.embed-site { font-size: 12px; color: var(--muted); }
.embed-title { font-weight: 600; color: var(--link); font-size: 15px; line-height: 1.3; }
.embed-text {
  font-size: 14px; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.embed-picture { max-width: 100%; max-height: 260px; border-radius: 4px; object-fit: cover; cursor: zoom-in; margin-top: 4px; }
.embed-player { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-top: 4px; border-radius: 4px; overflow: hidden; background: #000; }
.embed-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-thumb { position: absolute; inset: 0; padding: 0; display: block; }
.embed-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.embed-play {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 44px; margin: -22px 0 0 -32px; border-radius: 12px;
  background: rgba(0, 0, 0, .72); transition: background-color .15s;
}
.embed-play::after {
  content: ""; position: absolute; left: 26px; top: 12px; border-style: solid; border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
}
.embed-thumb:hover .embed-play { background: #ff0033; }
.embed-image { display: block; max-width: min(440px, 100%); max-height: 320px; margin-top: 6px; border-radius: 6px; cursor: zoom-in; }
.embed-video { display: block; max-width: min(440px, 100%); max-height: 320px; margin-top: 6px; border-radius: 6px; background: #000; }
.mobile .embed, .mobile .embed-image, .mobile .embed-video { max-width: 100%; }
.channel-card { border-left: 0; padding: 12px 16px; gap: 10px; }
.cc-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.cc-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cc-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--hover); color: var(--strong); display: grid; place-items: center; flex: none; }
.cc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cc-text b { color: var(--strong); font-size: 16px; }
.cc-text span { color: var(--muted); font-size: 13px; }
.cc-people { display: flex; flex: none; }
.cc-people > * + * { margin-left: -6px; }
.channel-card .btn { flex: none; }
.channel-card .btn.on { background: var(--ok); color: var(--on-ok); }

/* Daily Word */
.modal.game { width: 520px; padding: 16px 20px 20px; position: relative; }
.word-game { --tile: clamp(34px, calc((100dvh - 500px) / 6), 56px); --w-ok: #538d4e; --w-near: #b59f3b; --w-miss: #3a3a3c; --w-key: #818384; outline: none; display: flex; flex-direction: column; gap: 12px; }
.light .word-game { --w-ok: #6aaa64; --w-near: #c9b458; --w-miss: #787c7e; --w-key: #d3d6da; }
.word-game.colorblind { --w-ok: #f5793a; --w-near: #85c0f9; }
.word-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.word-title { display: flex; align-items: center; gap: 8px; font-size: 18px; color: var(--strong); margin-right: auto; }
.word-logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--w-ok); color: #fff; }
.word-langs { display: flex; gap: 4px; }
.word-langs button { padding: 4px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--field); }
.word-langs button.active { background: var(--accent); color: #fff; }
.word-tabs { flex-basis: 100%; order: 5; }
.word-players { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.word-player { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 14px; background: var(--field); font-size: 12px; font-weight: 700; }
.word-player.won span { color: var(--ok); }
.word-player.lost span { color: var(--danger-text); }
.word-player.playing { opacity: .6; }
.word-note { position: absolute; left: 50%; translate: -50% 0; margin-top: 120px; z-index: 2; background: var(--strong); color: var(--main); font-weight: 700; padding: 10px 14px; border-radius: 6px; animation: pop .12s ease-out; pointer-events: none; }
.word-board { display: grid; gap: 6px; justify-content: center; }
.word-strip { display: flex; align-items: center; gap: 6px; }
.word-pill { width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: 13px; background: var(--field); color: var(--muted); }
.word-pill.won { background: var(--w-ok); color: #fff; }
.word-pill.lost { background: var(--w-miss); color: #fff; }
.word-pill.active { box-shadow: 0 0 0 2px var(--accent); }
.word-pill:disabled { opacity: .45; cursor: default; }
.word-clue { padding: 4px 10px; border-radius: 14px; font-size: 13px; font-weight: 600; background: var(--field); color: var(--text); }
.word-clue:hover:not(:disabled) { background: var(--active); }
.word-clue:disabled { opacity: .45; cursor: default; }
.word-clues { text-align: center; font-size: 14px; color: var(--strong); background: var(--side); border-radius: 6px; padding: 6px 10px; }
.word-total { font-size: 18px; font-weight: 800; color: var(--strong); }
.word-row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: 6px; }
.word-tile { height: var(--tile); display: grid; place-items: center; font-size: calc(var(--tile) / 2); font-weight: 800; text-transform: none; color: var(--strong); border: 2px solid var(--border-soft); border-radius: 4px; user-select: none; }
.word-tile.filled { border-color: var(--faint); animation: tap .1s; }
.word-tile.correct, .word-tile.present, .word-tile.absent { border-color: transparent; color: #fff; }
.word-tile.correct { background: var(--w-ok); }
.word-tile.present { background: var(--w-near); }
.word-tile.absent { background: var(--w-miss); }
/* Not .reveal: that is the password eye (absolutely placed), and it threw the row out of the window. */
.word-row.flipping .word-tile { animation: flip .5s ease-in-out backwards; }
.word-row.shake { animation: shake .45s; }
.word-row.win .word-tile { animation: bounce .5s ease-out; }
.word-row.win .word-tile:nth-child(2) { animation-delay: .1s; }
.word-row.win .word-tile:nth-child(3) { animation-delay: .2s; }
.word-row.win .word-tile:nth-child(4) { animation-delay: .3s; }
.word-row.win .word-tile:nth-child(5) { animation-delay: .4s; }
.word-row:not(.flipping) .word-tile { animation-delay: 0s !important; }
@keyframes tap { 50% { transform: scale(1.1); } }
@keyframes flip { 0% { transform: rotateX(0); background: transparent; border-color: var(--faint); color: var(--strong); } 49% { background: transparent; border-color: var(--faint); color: var(--strong); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes bounce { 40% { transform: translateY(-24px); } 60% { transform: translateY(4px); } 80% { transform: translateY(-6px); } }
.word-keys { display: flex; flex-direction: column; gap: 6px; }
.word-keyrow { display: flex; gap: 5px; justify-content: center; }
.word-key { flex: 1; max-width: 42px; height: 52px; border-radius: 4px; background: var(--w-key); color: var(--strong); font-weight: 700; font-size: 15px; user-select: none; }
.light .word-key { color: #1a1a1b; }
.word-key.wide { max-width: 66px; flex: 1.5; font-size: 12px; }
.word-key.correct, .word-key.present, .word-key.absent { color: #fff; }
.word-key.correct { background: var(--w-ok); }
.word-key.present { background: var(--w-near); }
.word-key.absent { background: var(--w-miss); opacity: .55; }
.word-options { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.word-options label.check { flex-direction: row; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--muted); margin: 0; }
.word-done { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--side); border-radius: 8px; padding: 10px 14px; }
.word-done-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.word-countdown { font-size: 24px; font-weight: 800; color: var(--strong); font-variant-numeric: tabular-nums; }
.word-stats h3 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.word-numbers { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.word-numbers b { display: block; font-size: 30px; color: var(--strong); }
.word-numbers span { font-size: 12px; color: var(--muted); }
.word-bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-weight: 700; font-size: 13px; }
.word-bar > span { width: 10px; }
.word-bar-fill { background: var(--w-miss); color: #fff; text-align: right; padding: 2px 8px; border-radius: 2px; min-width: 24px; }
.word-bar-fill.today { background: var(--w-ok); }
.word-standings { display: flex; flex-direction: column; gap: 8px; }
.word-standings p { margin: 0; }
.word-standing { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; background: var(--side); }
.word-rank { width: 24px; text-align: center; font-weight: 800; color: var(--muted); }
.word-points { font-size: 18px; color: var(--strong); min-width: 32px; text-align: right; }
@media (max-width: 560px) {
  /* Full screen; keep clear of the phone's status bar and gesture bar. */
  .modal.game { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
  .word-game { --tile: clamp(34px, min(15vw, calc((100dvh - 480px) / 6)), 56px); }
  .word-key { height: 48px; font-size: 14px; }
  .word-keyrow { gap: 4px; }
}

/* Desktop app: no native window frame, our own title bar */
.app.framed { padding-top: 30px; }
.titlebar { position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 100; display: flex; align-items: center; background: var(--rail); color: var(--muted); }
.titlebar-name { flex: 1; align-self: stretch; display: flex; align-items: center; gap: 6px; padding-left: 12px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.titlebar-name svg { pointer-events: none; }
.titlebar-name .wordmark { font-size: 15px; }
.titlebar-btn { width: 46px; height: 100%; display: grid; place-items: center; color: var(--muted); }
.titlebar-btn:hover { background: var(--hover); color: var(--strong); }
.titlebar-btn.close:hover { background: #e81123; color: #fff; }
.titlebar-update { height: 22px; margin-right: 8px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; background: var(--ok); color: var(--on-ok); font-size: 12px; font-weight: 600; }
.titlebar-update:hover { filter: brightness(1.1); }
.watch-card { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.watch-bg { position: absolute; inset: -20%; display: grid; place-items: center; filter: blur(28px) brightness(.55); }
.watch-bg .avatar { width: 100% !important; height: 100% !important; }
.watch-body { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; }
.watch-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* Device menus on the voice card buttons */
.mc-btn { -webkit-touch-callout: none; user-select: none; position: relative; }
.mc-btn.has-menu::after { content: ""; position: absolute; right: 3px; bottom: 3px; border: 3px solid transparent; border-top-color: currentColor; border-right-color: currentColor; opacity: 0; transition: opacity .15s; }
.mc-btn.has-menu:hover::after { opacity: .6; }
.dm-level { display: block; height: 4px; border-radius: 2px; background: var(--hover); margin-top: 4px; overflow: hidden; }
.dm-level i { display: block; height: 100%; background: var(--ok); transition: width .08s linear; }
.dm-seg { margin: 2px 8px 6px; }
.watch-card.popped { z-index: 3; }

/* Android picture-in-picture: only the watched video, full window (class set by MainActivity). */
html.pip body * { visibility: hidden; }
html.pip .call-focus, html.pip .call-focus .tile, html.pip .call-focus video { visibility: visible; }
html.pip .call-focus { position: fixed; inset: 0; z-index: 99999; background: #000; }
html.pip .call-focus .tile > :not(video) { display: none; }
/* share popover (ui/share.rs) */
.share-menu .pm-item, .share-menu .pm-link { width: 100%; text-align: left; color: inherit; }
.share-menu .pm-link { color: var(--muted); }
.share-menu .pm-link.danger { color: var(--danger-text); }
.share-menu .pm-link.danger:hover { background: var(--danger); color: #fff; }
.share-head { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; }
.share-head b { color: var(--strong); font-size: 14px; }
.pm-note { padding: 0 8px 6px; margin: 0; }

.menu .pm-head { padding: 6px 8px 2px; }
.menu .slider-row { gap: 8px; padding: 2px 8px; }
.menu .slider-value { width: 44px; }
.vol-scale { display: flex; justify-content: space-between; padding: 0 8px; margin: -2px 0 4px; font-size: 11px; color: var(--muted); }
.menu-item .icon { margin-right: 8px; vertical-align: -4px; }

.gif-still { position: relative; display: inline-block; vertical-align: top; max-width: 100%; }
.gif-still.playing canvas { visibility: hidden; }
.gif-still.playing .gif-badge { display: none; }
.gif-still.playing img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.gif-still canvas { display: block; max-width: 100%; height: auto; cursor: zoom-in; }
.gif-still .embed-image { max-height: 320px; width: auto; }
.gif-badge { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgb(0 0 0 / .6); color: #fff; font-size: 11px; font-weight: 700; pointer-events: none; }

.ch-icon { position: relative; display: inline-flex; flex: none; }
.trap-mark { position: absolute; right: -4px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--danger, #e5484d); color: #fff; font: 700 9px/12px sans-serif; text-align: center; font-style: normal; }
.trap-banner { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: color-mix(in srgb, var(--danger, #e5484d) 15%, transparent); border-bottom: 1px solid var(--danger, #e5484d); color: var(--strong); }
.trap-info { display: grid; gap: 2px; padding: 0 0 4px; }

/* ------------------------------------------------------------ language picker (Settings tab, sign-in switch) */

.lang-note { margin-bottom: 14px; }
.lang-list { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.lang-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--field); text-align: left; color: var(--text); }
.lang-opt:hover { background: var(--hover); }
.lang-opt.on { background: var(--active); box-shadow: inset 0 0 0 2px var(--accent); }
.lang-radio { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px var(--muted); display: grid; place-items: center; }
.lang-radio i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: none; }
.lang-opt.on .lang-radio { box-shadow: inset 0 0 0 2px var(--accent); }
.lang-opt.on .lang-radio i { display: block; }
.lang-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.lang-text b { font-weight: 600; font-size: 15px; color: var(--strong); }
.lang-text > span { font-size: 13px; color: var(--muted); }
.lang-preview { max-width: 520px; margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: var(--field); }
.lang-preview-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.lang-preview-msg { display: flex; gap: 12px; }
.lang-preview-av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--av-3); color: #1e1f22; font-weight: 600; font-size: 14px; font-style: normal; }
.lang-preview .day-divider { margin: 18px 0 8px; }
.lang-preview .day-divider span { background: var(--field); }
.lang-beta { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.lang-switch { position: relative; justify-self: center; margin-top: 14px; }
.lang-pill { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 22px; background: color-mix(in srgb, var(--main) 85%, transparent); color: var(--strong); font-size: 14px; font-weight: 500; box-shadow: 0 0 0 1px var(--border-soft); }
.lang-pill:hover { background: var(--main); }
.lang-menu { position: absolute; z-index: 76; bottom: 52px; left: 50%; transform: translateX(-50%); width: 240px; background: var(--menu); border: 1px solid var(--border-soft); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; animation: fade .08s; }
.lang-mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 8px; font-size: 14px; text-align: left; color: var(--text); }
.lang-mi:hover { background: var(--hover); }
.lang-mi.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.lang-mi .icon { color: var(--accent); }

/* Soundboard: the voice card popover (a bottom sheet on phones) and the chip on whoever is playing a sound. */
.sb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sb-head span { text-transform: none; letter-spacing: 0; font-weight: 400; min-width: 0; }
.sb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 2px 2px 6px; }
.sb-cell { position: relative; min-width: 0; }
.sb-tile {
  position: relative; overflow: hidden; width: 100%; height: 52px; border-radius: 8px; padding: 6px 8px; text-align: left;
  display: flex; flex-direction: column; justify-content: center; gap: 2px; background: color-mix(in srgb, var(--muted) 10%, transparent);
}
.sb-tile:hover { background: var(--hover); }
.sb-name { font-size: 13px; font-weight: 600; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-len { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 20px; }
.sb-tile.play { box-shadow: inset 0 0 0 1px var(--ok); }
.sb-tile.play .sb-len { color: var(--ok); }
.sb-cell.cool .sb-tile { opacity: .5; cursor: default; }
.sb-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--ok); animation: sb-progress linear forwards; }
@keyframes sb-progress { to { width: 100%; } }
.sb-ear { position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 6px; display: none; place-items: center; color: var(--muted); }
.sb-cell:hover .sb-ear, .mobile .sb-ear { display: grid; }
.sb-ear:hover { background: var(--hover); color: var(--strong); }
.sb-empty { padding: 12px 8px; color: var(--muted); }
.sb-vol { padding: 0 8px 4px; }
.sb-chip {
  display: inline-flex; align-items: center; gap: 3px; flex: none; max-width: 50%; min-width: 0;
  background: var(--lk-2); color: #0c0c22; border-radius: 4px; padding: 0 6px; font-size: 11px; font-weight: 600;
}
.sb-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile .sb-pop {
  left: 0 !important; right: 0; top: auto !important; bottom: 0 !important; width: auto !important; max-height: 70dvh !important;
  border-radius: 12px 12px 0 0; padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
/* Space settings › Sounds. */
.btn.disabled { opacity: .5; pointer-events: none; }
.sb-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.sb-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; }
.sb-row:hover { background: var(--hover); }
.sb-play { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--strong); }
.sb-play:hover { background: var(--lk-2); color: #0c0c22; }
.sb-row-text { min-width: 0; }
.sb-rename { width: 100%; background: none; border: 1px solid transparent; border-radius: 4px; padding: 2px 4px; margin-left: -5px; color: var(--strong); font: inherit; font-weight: 600; }
.sb-rename:hover, .sb-rename:focus { border-color: var(--border-soft); background: var(--field); outline: none; }
.sb-level { width: 200px; flex: none; gap: 8px; }
.sb-level input[type=range] { min-width: 0; }
.sb-level .slider-value { width: 44px; flex: none; }
.mobile .sb-level { width: 130px; }

/* Profile photos (#31): Settings › Profile slots */
.photos-head { display: flex; align-items: center; gap: 6px; }
.photos-head .muted { margin-left: auto; font-weight: 500; text-transform: none; }
.photo-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-slot { position: relative; width: 96px; height: 120px; border-radius: 10px; overflow: hidden; flex: none; cursor: grab; }
.photo-slot :is(img, canvas), .photo-slot .gif-still { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot.dragging { transform: rotate(-3deg) translateY(-6px); box-shadow: 0 10px 24px rgba(0,0,0,.5), 0 0 0 2px var(--accent); }
.photo-slot .photo-x { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(12,12,34,.8); color: #fff; display: grid; place-items: center; border: 0; padding: 0; }
.photo-n { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; background: rgba(12,12,34,.75); color: #fff; border-radius: 4px; padding: 0 6px; }
.photo-add { border: 2px dashed var(--border-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }

/* Profile photos: the card's row and the viewer */
.photo-row { display: flex; gap: 7px; overflow-x: auto; }
.photo-thumb, .photo-row .gif-still { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; cursor: zoom-in; }
.photo-row .gif-still canvas { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.modal.image:has(> .photo-viewer) { animation: none; }
/* The desktop title bar (30px) stays above the viewer: start under it, or its close button hides behind the bar. */
.app.framed .photo-viewer { top: 30px; }
.photo-viewer { position: fixed; inset: 0; background: rgba(6,6,18,.96); color: #f0f1fa; display: grid; place-items: center; padding: 72px 72px 84px; }
.pv-who { position: absolute; left: 16px; top: 14px; display: flex; align-items: center; gap: 10px; text-align: left; line-height: 1.2; }
.pv-of { font-size: 12px; opacity: .7; }
.pv-tools { position: absolute; right: 14px; top: 12px; display: flex; gap: 8px; }
.pv-tools button, .pv-prev, .pv-next { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 0; padding: 0; color: #f0f1fa; background: rgba(12,12,34,.7); }
.pv-prev, .pv-next { position: absolute; top: 50%; transform: translateY(-50%); }
.pv-prev { left: 24px; } .pv-next { right: 24px; }
.pv-photo { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.pv-strip { position: absolute; left: 0; right: 0; bottom: 22px; display: flex; justify-content: center; gap: 8px; }
.pv-strip :is(img, canvas, .gif-still) { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.pv-strip :is(img, canvas) { opacity: .6; cursor: pointer; }
.pv-strip .sel :is(img, canvas) { opacity: 1; box-shadow: 0 0 0 2px #1f2040, 0 0 0 4px var(--accent); }
@media (max-width: 560px) { .photo-viewer { padding: 64px 8px 76px; } .pv-prev, .pv-next { display: none; } }
.report-photo { max-width: 240px; max-height: 240px; object-fit: contain; border-radius: 6px; display: block; }

/* overlay: the in-game overlay window (ui::overlay). See-through everywhere but its boxes, Splash colours over any game. */
html.overlay, html.overlay body, .app.grad.ov-root { background: transparent; }
.ov-root { position: fixed; inset: 0; color: var(--strong); }
.ov-dim { position: fixed; inset: 0; background: rgba(6, 6, 18, .45); }
.ov-pill {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px; background: #0c0c22; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow);
}
.ov-box { position: fixed; touch-action: none; }
.unlocked .ov-box { cursor: grab; }
.ov-in { zoom: var(--ov-scale); min-width: 180px; max-width: 320px; padding: 8px; border-radius: 12px; background: rgba(12, 12, 34, var(--ov-alpha)); }
.unlocked .ov-in { outline: 2px dashed #30d5c8; outline-offset: 2px; }
.ov-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; font-size: 14px; font-weight: 500; }
.ov-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-av {
  width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; object-fit: cover;
  font-size: 10px; font-weight: 600; color: var(--av-fg);
}
.ov-av.talk { box-shadow: 0 0 0 2px rgba(12, 12, 34, .9), 0 0 0 4px var(--ok); }
.ov-mic { display: grid; color: var(--danger-text); }
.ov-btns { display: flex; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.ov-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .08); cursor: pointer; }
.ov-btn:hover { background: rgba(255, 255, 255, .16); }
.ov-btn.on { color: var(--ok); }
.ov-btn.off { color: var(--danger-text); }
.ov-btn.leave { margin-left: auto; background: var(--danger); color: #fff; }
.ov-toast { display: flex; gap: 10px; padding: 4px; font-size: 14px; animation: ov-slide .2s ease-out; }
.ov-toast + .ov-toast { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.ov-toast .ov-av { width: 28px; height: 28px; font-size: 11px; }
.ov-toast .grow { flex: 1; min-width: 0; }
.ov-toast b { font-weight: 600; }
.ov-place { color: var(--muted); font-size: 12px; }
.ov-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ov-open { margin-top: 6px; padding: 4px 10px; border-radius: 6px; background: #30d5c8; color: #0c0c22; font-size: 13px; font-weight: 600; }
@keyframes ov-slide { from { opacity: 0; transform: translateY(8px); } }
/* Settings › Overlay */
.ov-warn {
  display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 16px; padding: 10px 12px; border-radius: 8px; font-size: 14px;
  background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.ov-warn .icon { flex: none; color: var(--warn); }
.ov-where { display: flex; align-items: center; gap: 16px; }
.ov-where p { margin: 0; }
.ov-corners { position: relative; flex: none; width: 96px; height: 60px; border-radius: 6px; background: #0c0c22; border: 1px solid var(--border-soft); }
.ov-corner { position: absolute; width: 24px; height: 14px; border-radius: 3px; background: #3a3c5e; }
.ov-corner.tl { left: 5px; top: 5px; }
.ov-corner.tr { right: 5px; top: 5px; }
.ov-corner.bl { left: 5px; bottom: 5px; }
.ov-corner.br { right: 5px; bottom: 5px; }
.ov-corner.call { background: #30d5c8; }
.ov-corner.msg { background: #acafc8; }
.ov-corner:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ov-key { display: flex; align-items: center; gap: 12px; }
.ov-kbd { display: inline-block; cursor: default; pointer-events: none; }

/* ------------------------------------------------------------ profiles (page, edit, badges, game picker, who plays) */

.app { --r-common: #acafc8; --r-uncommon: #7ee8a2; --r-rare: #30d5c8; --r-epic: #f0609e; --r-legendary: #f6c344; }
.app.light { --r-common: #6d6f78; --r-uncommon: #1f9a5c; --r-rare: #269994; --r-epic: #c04d7e; --r-legendary: #b8860b; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; color: var(--strong); }
.gap8 { gap: 8px; }
.gap4 { gap: 4px; }
.wrap { flex-wrap: wrap; }
.seg button.on { background: var(--active); color: var(--strong); }
.member.faded { opacity: .45; }
.member.faded:hover { opacity: 1; }

/* Buttons on the profile header: 36 px, 10 px corners, dark glass with a thin edge; the main one in the accent. */
.gb {
  height: 36px; min-width: 36px; border-radius: 10px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; background: rgba(12, 12, 34, .62); color: #f0f1fa; font-weight: 500; font-size: 14px; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); backdrop-filter: blur(10px); flex: none;
}
.gb:hover:not(:disabled) { filter: brightness(1.15); }
.gb:disabled { opacity: .45; cursor: not-allowed; }
.gb.sq { padding: 0; }
.gb.pri { background: var(--accent); box-shadow: none; font-weight: 600; color: #fff; }
.gb.flat { background: var(--input); color: var(--text); box-shadow: none; backdrop-filter: none; }
.gb.grow { flex: 1; }
label.gb { cursor: pointer; }
.lfg {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 10px; flex: none;
  background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.member-text .name .lfg { margin-left: 6px; vertical-align: 1px; }
.chipf {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; color: #f0f1fa;
  background: rgba(12, 12, 34, .55); white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); max-width: 100%;
}
.chipf .icon { color: #acafc8; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--muted) 14%, transparent); white-space: nowrap;
}
.tag-pill.acc { background: color-mix(in srgb, var(--pf-accent, var(--accent)) 18%, transparent); color: color-mix(in srgb, var(--pf-accent, var(--accent)) 60%, #fff); }
.app.light .tag-pill.acc { color: color-mix(in srgb, var(--pf-accent, var(--accent)) 75%, #000); }

/* Header backgrounds: gradients, patterns over the owner's accent, or their picture. */
.pf-bg-splash { background: radial-gradient(120% 90% at 0% 0%, rgba(240, 96, 158, .5), transparent 60%), radial-gradient(110% 90% at 100% 100%, rgba(48, 213, 200, .45), transparent 60%), #1a1b34; }
.pf-bg-neon { background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .13) 1px, transparent 1.5px) 0 0 / 14px 14px, linear-gradient(120deg, #9e00ad, #5b2a86 45%, #1f8f9a 80%, #30d5c8); }
.pf-bg-sunset { background: linear-gradient(175deg, #e9a25b, #b85c4a 40%, #4e3456); }
.pf-bg-aurora { background: linear-gradient(160deg, #0e4d4a, #30d5c8 50%, #5d3a9b); }
.pf-bg-ember { background: linear-gradient(140deg, #3a0d1a, #c04d7e 60%, #f6c344); }
.pf-bg-deep_sea { background: linear-gradient(170deg, #04060f, #16245c 60%, #30d5c8); }
.pf-bg-forest { background: linear-gradient(160deg, #10241a, #3d6b3f 55%, #c9d46c); }
.pf-bg-night { background: linear-gradient(160deg, #1f2040, #13142b); }
.pf-img-dots { background: radial-gradient(circle at 2px 2px, rgba(255, 255, 255, .28) 1.5px, transparent 2px) 0 0 / 16px 16px, linear-gradient(135deg, var(--pf-accent, var(--accent)), #13142b); }
.pf-img-grid { background: linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(160deg, #13142b, var(--pf-accent, var(--accent))); }
.pf-img-stripes { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .1) 0 10px, transparent 10px 24px), linear-gradient(120deg, var(--pf-accent, var(--accent)), #1a1b34); }
.pf-img-stars {
  background: radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 70%, #fff, transparent), radial-gradient(1px 1px at 85% 60%, #fff, transparent),
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--pf-accent, var(--accent)) 70%, transparent), transparent 60%), #0c0c22;
  background-size: 160px 110px, 160px 110px, 160px 110px, 160px 110px, auto, auto;
}
.pf-upload { background-color: #1a1b34; background-size: cover; background-position: center; }

/* The page. */
.pf-host { flex: 1; min-height: 0; overflow-y: auto; }
.pf-loading { padding: 40px; text-align: center; }
.pf { --pf-accent: var(--accent); container-type: inline-size; min-height: 100%; background: linear-gradient(180deg, color-mix(in srgb, var(--pf-accent) 10%, transparent), transparent 520px); user-select: text; }
.pf-hero { position: relative; min-height: 236px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px 20px 18px 28px; }
.pf-hero-fade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(12, 12, 34, .78), rgba(12, 12, 34, 0) 70%); pointer-events: none; }
.pf-top { position: relative; display: flex; gap: 8px; align-items: center; }
.pf.preview .pf-top, .pf.preview .pf-photo, .pf.preview .pf-bh button, .pf.preview .pf-narrow-actions { pointer-events: none; }
.pf-who { position: relative; display: flex; align-items: flex-end; gap: 20px; margin-top: 18px; }
.pf-frame { display: inline-block; border-radius: 50%; padding: 5px; flex: none; }
.pf-frame-in { display: block; border-radius: 50%; padding: 4px; background: #13142b; }
.pf-frame-in .avatar { display: block; }
.frame-none { padding: 0; }
.frame-none .pf-frame-in { padding: 0; background: none; }
.frame-accent { background: var(--pf-accent, var(--accent)); }
.frame-splash { background: conic-gradient(from 200deg, #f0609e, #f6c344, #30d5c8, #9e00ad, #f0609e); }
.frame-double { background: #13142b; box-shadow: inset 0 0 0 2px var(--pf-accent, var(--accent)); }
.frame-flame { background: conic-gradient(#f6c344, #ff6b7a, #ff8a5c, #f6c344); box-shadow: 0 0 14px rgba(255, 107, 122, .55); }
.frame-gold { background: linear-gradient(135deg, #fff1b8, #f6c344 40%, #b8860b 70%, #fff1b8); }
.frame-neon { background: conic-gradient(#30d5c8, #9e00ad, #f0609e, #30d5c8); box-shadow: 0 0 16px rgba(48, 213, 200, .6); }
.pf-id { flex: 1; min-width: 0; padding-bottom: 4px; color: #f0f1fa; }
.pf-id .muted { color: #acafc8; }
.pf-name-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pf-name { font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-weight: 600; font-size: 36px; line-height: 1.05; overflow-wrap: anywhere; }
.pf-status { font-size: 14px; margin: 4px 0 0; }
.pf-facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pf-featured { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 4px; flex: none; color: #f0f1fa; max-width: 120px; text-align: center; }
.pf-narrow-actions { display: none; }
.pf-blocks { padding: 18px 28px 28px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.pf-blk { grid-column: span 3; background: var(--side); border-radius: 14px; padding: 14px; box-shadow: 0 0 0 1px var(--border-soft); min-width: 0; }
.pf-about { grid-column: span 8; }
.pf-about:not(:has(+ .pf-common)) { grid-column: span 12; }
.pf-common { grid-column: span 4; }
.pf-games { grid-column: span 12; }
.pf-bh { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 10px; white-space: nowrap; color: var(--strong); }
.pf-bh > .icon { color: var(--pf-accent); }
.pf-bh .r { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.pf-bh button.r { color: var(--link); }
.pf-bh button.r:hover { text-decoration: underline; }
.pf-about-text { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.pf-about-text p { margin: 0; }
.pf-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-common-rows { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.pf-common-rows b { font-weight: 600; }
.pf-space-dot { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 600; flex: none; }
.pf-games-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pf-gc { display: flex; gap: 12px; padding: 10px; border-radius: 12px; background: var(--main); box-shadow: 0 0 0 1px var(--border-soft); min-width: 0; position: relative; }
.profile .pf-gc { margin-top: 4px; }
.pf-gc-text { min-width: 0; flex: 1; }
.pf-gc .t { font-weight: 600; font-size: 14px; line-height: 1.2; padding-right: 44px; color: var(--strong); }
.pf-gc .rk { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 6px; font-weight: 500; }
.pf-gc .rk .icon { color: #f6c344; }
.pf-gc .rk.muted { font-weight: 400; }
.pf-gc .ro { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pf-gc > .lfg { position: absolute; right: 10px; top: 10px; }
.pf-cov {
  position: relative; display: inline-flex; align-items: flex-end; flex: none; border-radius: 8px; overflow: hidden; padding: 6px; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--cov) 45%, #0c0c22), var(--cov)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-weight: 600; line-height: 1.05;
}
.pf-cov img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pf-cov-name { position: relative; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); overflow: hidden; overflow-wrap: anywhere; }
.medal {
  position: relative; border-radius: 50%; display: inline-grid; place-items: center; flex: none; color: var(--md); font-family: "Fredoka", "Segoe UI", system-ui, sans-serif;
  font-weight: 600; background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--md) 40%, transparent), var(--main) 72%); box-shadow: inset 0 0 0 3px var(--md);
}
.medal img { width: 70%; height: 70%; object-fit: cover; border-radius: 50%; }
.medal.locked { filter: grayscale(1); opacity: .45; }
.medal-lock { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--side); color: var(--muted); }
.pf-medals { display: grid; grid-template-columns: repeat(auto-fill, 40px); justify-content: space-between; gap: 10px; }
.pf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pf-stat { background: var(--main); border-radius: 8px; padding: 6px 9px; line-height: 1.2; }
.pf-stat b { font-weight: 600; font-size: 15px; color: var(--strong); }
.pf-stat b.hot { color: var(--pf-accent); }
.pf-week { display: flex; gap: 4px; margin-top: 10px; }
.pf-week i { width: 22px; height: 22px; border-radius: 5px; background: var(--active); display: grid; place-items: center; font: 600 11px "Fredoka", sans-serif; font-style: normal; color: var(--muted); }
.pf-week i.on { background: var(--ok); color: var(--on-ok); }
.pf-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pf-photo { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--main); }
.pf-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-text-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
/* By the page's own width (the edit preview is narrower): two small blocks a row, then one column, same order. */
@container (max-width: 860px) { .pf-blk.pf-small { grid-column: span 6; } .pf-games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 560px) {
  .pf-blk { grid-column: span 12 !important; }
  .pf-blocks { padding: 12px 16px 24px; }
  .pf-games-grid { grid-template-columns: 1fr; }
  .pf-hero { padding: 12px 16px 16px; }
  .pf-who { flex-wrap: wrap; gap: 12px; }
}
.pf.narrow .pf-blocks { padding: 12px 16px 24px; gap: 12px; }
.pf.narrow .pf-blk { grid-column: span 12 !important; }
.pf.narrow .pf-games-grid { grid-template-columns: 1fr; }
.pf.narrow .pf-hero { min-height: 150px; padding: 12px; }
.pf.narrow .pf-who { flex-wrap: wrap; gap: 10px; }
.pf.narrow .pf-name { font-size: 28px; }
.pf.narrow .pf-wide-only { display: none; }
.pf.narrow .pf-narrow-actions { display: flex; gap: 8px; padding: 12px 16px 0; }
.pf.narrow .pf-narrow-actions .gb { height: 44px; }
.pf.narrow .pf-narrow-actions .gb.sq { width: 44px; }
.pf.narrow .pf-featured { flex-direction: row; max-width: none; text-align: left; }

/* Badges overview. */
.bdg { padding: 20px 28px 32px; display: flex; flex-direction: column; gap: 14px; user-select: text; }
.bdg-head { display: flex; align-items: center; gap: 14px; }
.bdg-title { font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-weight: 600; font-size: 24px; color: var(--strong); }
.bdg-legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.bdg-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bdg-sec { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.bdg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.bdg-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--side); box-shadow: 0 0 0 1px var(--border-soft); }
.bdg-card.hidden-badge { opacity: .6; }
.bdg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bdg-name { font-weight: 600; color: var(--strong); }
.bdg-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.prog { height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 20%, transparent); overflow: hidden; margin-top: 6px; }
.prog i { display: block; height: 100%; background: var(--ok); }
.mobile .bdg { padding: 16px; }
.mobile .bdg-head { flex-wrap: wrap; }

/* Edit profile: the editor on the left, the live preview on the right. */
.pf-host.editing { overflow: hidden; display: flex; }
.pe { display: flex; flex: 1; min-height: 0; position: relative; }
.pe-panel { width: 420px; flex: none; background: var(--side); display: flex; flex-direction: column; min-height: 0; }
.pe-head { padding: 18px 20px 4px; display: flex; flex-direction: column; gap: 10px; }
.pe-title { font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; font-weight: 600; font-size: 20px; color: var(--strong); }
.pe-body { flex: 1; min-height: 0; padding: 0 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.pe-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border-soft); }
.pe-preview { flex: 1; min-width: 0; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.pe-frame { flex: 1; min-height: 0; overflow-y: auto; border-radius: 10px; box-shadow: 0 0 0 1px var(--border-soft); background: var(--main); }
.pe-frame.phone { width: 390px; max-width: 100%; align-self: center; }
.pe-sec { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 12px 0 2px; }
.pe-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pe-bg { height: 46px; border-radius: 8px; }
.pe-bg.on, .pe-acc.on, .give-icon.on, .pe-frame-opt.on .pf-frame { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px var(--strong); }
.pe-accents { display: flex; gap: 12px; flex-wrap: wrap; padding: 2px; }
.pe-acc { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.pe-acc.default { background: var(--accent); background-image: linear-gradient(135deg, transparent 45%, rgba(255, 255, 255, .7) 45% 55%, transparent 55%); }
.pe-frames { display: flex; gap: 12px; flex-wrap: wrap; }
.pe-frame-opt { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 64px; text-align: center; }
.pe-frame-opt:disabled { cursor: not-allowed; }
.pe-frame-opt:disabled .pf-frame { opacity: .45; filter: grayscale(.6); }
.pe-frame-opt .pf-frame { padding: 4px; }
.pe-frame-opt .pf-frame-in { padding: 2px; }
.pe-frame-opt .frame-none { padding: 0; }
.pe-unlock { color: #f6c344; }
.pe-input { background: var(--field); border: 0; border-radius: 8px; color: var(--text); font-size: 14px; padding: 8px 10px; outline: none; width: 100%; resize: vertical; }
.pe-input:focus { box-shadow: 0 0 0 2px var(--link); }
.pe-blocks { display: flex; flex-direction: column; gap: 4px; }
.lrow { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: 8px; background: var(--main); font-size: 14px; color: var(--text); text-align: left; }
.lrow.wide { width: 100%; }
.lrow:hover { background: var(--hover); }
.lrow.dragging { opacity: .4; }
.lrow:focus-visible { outline: 2px solid var(--link); }
.lrow .g { color: var(--faint); display: flex; cursor: grab; }
.lrow .i { color: var(--muted); display: flex; }
.lrow .n { flex: 1; min-width: 0; }
.pe-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--field); border-radius: 8px; padding: 6px; }
.pe-tag-input { flex: 1; min-width: 90px; background: none; border: 0; outline: none; font-size: 14px; padding: 2px 4px; }
.pe-note { margin: 10px 0 4px; }
.pe-game { background: var(--main); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pe-game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pe-lfg { min-height: 36px; }
.mobile .pe-preview { display: none; }
.mobile .pe-panel { width: 100%; }

/* The game picker sheet. */
.pf-sheet-back { position: fixed; inset: 0; z-index: 55; background: rgba(6, 6, 18, .6); display: grid; place-items: center; animation: fade .12s; }
.pf-sheet {
  background: var(--menu); border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); padding: 20px 22px; width: 680px;
  max-width: calc(100vw - 24px); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.pe-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 8px; background: var(--field); color: var(--muted); margin-top: 6px; }
.pe-search:focus-within { box-shadow: inset 0 0 0 2px var(--link); }
.pe-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 14px; }
.gp-label { margin-top: 6px; }
.gp-results { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.gp-result { position: relative; display: flex; flex-direction: column; gap: 6px; width: 104px; flex: none; text-align: left; }
.gp-result:disabled { opacity: .4; cursor: not-allowed; }
.gp-result.on .pf-cov { box-shadow: 0 0 0 2px var(--ok); }
.gp-check { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: var(--on-ok); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--menu); }
.gp-name { font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--text); }
.gp-add {
  width: 104px; height: 156px; flex: none; border-radius: 8px; box-shadow: inset 0 0 0 1.5px var(--border-soft); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; padding: 8px; font-size: 12px; color: var(--muted); text-align: center;
}
.gp-add:hover { color: var(--text); background: var(--hover); }
.gp-custom { display: flex; gap: 14px; align-items: flex-start; background: var(--side); border-radius: 12px; padding: 12px; }
.gp-tray-head { gap: 10px; margin-top: 10px; }
.gp-tray { display: flex; gap: 10px; flex-wrap: wrap; }
.gp-slot { position: relative; border-radius: 8px; cursor: grab; }
.gp-slot.dragging { opacity: .4; }
.gp-slot:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; }
.gp-n { position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; border-radius: 5px; background: rgba(12, 12, 34, .7); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 600; }
.gp-x { position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: rgba(12, 12, 34, .75); color: #fff; display: grid; place-items: center; opacity: 0; }
.gp-slot:hover .gp-x, .gp-slot:focus-within .gp-x { opacity: 1; }
.gp-empty { width: 70px; height: 105px; border-radius: 8px; box-shadow: inset 0 0 0 1.5px var(--border-soft); display: grid; place-items: center; color: var(--faint); }
.gp-foot { gap: 8px; margin-top: 8px; }

/* Give a badge. */
.give { display: flex; flex-direction: column; gap: 6px; }
.give h2 { margin-bottom: 0; }
.give-icons { display: flex; gap: 8px; flex-wrap: wrap; }
.give-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--side); display: grid; place-items: center; color: var(--text); cursor: pointer; }
.give-found { display: flex; flex-direction: column; gap: 2px; }
.give-preview { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; background: var(--side); }
.give-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* Who plays…? on the member list. Phones show the list full screen (the 900 px rule above hid it there too). */
.mobile .members { display: block; }
.wp { position: relative; padding: 12px 0 0; }
.wp-btn, .wp-chip { width: 100%; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 8px; background: var(--main); color: var(--muted); font-size: 14px; }
.wp-btn { text-align: left; }
.wp-btn:hover { color: var(--text); }
.wp-chip { color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 45%, transparent); }
.wp-chip b { font-weight: 600; }
.wp-pop {
  position: absolute; left: 0; right: 0; top: 52px; z-index: 20; background: var(--menu); border-radius: 12px; box-shadow: var(--shadow);
  padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto;
}
.wp-pop .pe-search { margin: 0 0 4px; }
.wp-label { padding: 4px 6px; }
.wp-empty { padding: 6px; }
.wp-pop .lrow { background: none; }
.wp-pop .lrow:hover { background: var(--hover); }
.wp-rank { display: flex; align-items: center; gap: 4px; }
.wp-rank .icon { color: #f6c344; }
