:root {
  color-scheme: dark;
  --base: #36393f;
  --inset: #202225;
  --panel: #2f3136;
  --field: #404349;
  --text: #f0f1f2;
  --muted: #c3c5c9;
  --line: #536976;
  --accent: #00b0d5;
  --focus: #77deff;
  font: 16px/1.5 system-ui, sans-serif;
  background: var(--base);
  color: var(--text);
}
:root[data-theme="light"] {
  color-scheme: light;
  --base: #f7f8fa;
  --inset: #e3e7ed;
  --panel: #eef0f3;
  --field: #fff;
  --text: #20252b;
  --muted: #515c65;
  --line: #778895;
  --focus: #006989;
}
* { box-sizing: border-box; }
body, h1, h2, p, ol { margin: 0; }
[hidden], [role="alert"]:empty { display: none !important; }
[role="alert"]:not(:empty) { padding: .75rem; border-inline-start: 3px solid currentColor; }
h1, h2 { line-height: 1.2; letter-spacing: -.025em; }
form, label { display: grid; min-width: 0; gap: .4rem; }
form { gap: 1rem; }
input, select, button { font: inherit; }
input:not([type="hidden"]), select, button {
  min-height: 44px; min-width: 0; max-width: 100%; padding: .55rem .85rem;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--field); color: var(--text);
}
button, summary { cursor: pointer; }
button:hover { filter: brightness(1.09); }
button[type="submit"], #composer button { background: var(--accent); color: #001820; border-color: transparent; font-weight: 650; }
a { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
summary { padding: .7rem .25rem; font-weight: 600; }
details > form, details > section { margin: .75rem 0; }
.brand-mark { display: inline-block; width: 42px; height: 42px; flex: none; }
[data-cdn-theme] .brand-mark { background: url("public/brand/logo.png") center / contain no-repeat; }
.entry-page { display: grid; min-height: 100dvh; }
.entry-story { display: none; }
.entry-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 100dvh; padding: 20px 16px; }
.entry-main > header { color: var(--muted); font-weight: 650; font-size: .9rem; line-height: 36px; }
.entry-card { width: 100%; max-width: 420px; margin: auto; padding: 32px 0 max(32px, 9vh); }
.entry-card .emblem { display: block; width: 44px; height: 44px; margin-bottom: 20px; background-color: var(--accent); border-radius: 12px; }
.entry-card h1 { font-size: 27px; }
.entry-card h1 + p { color: var(--muted); font-size: .9rem; margin: 10px 0 20px; }
.entry-card label { font-size: .875rem; font-weight: 650; }
.entry-card input { width: 100%; font-size: 1rem; font-weight: 400; }
.entry-card form { gap: 18px; }
.entry-card button { width: 100%; margin-top: 6px; }
.entry-main > .theme-control { position: absolute; top: 16px; inset-inline-end: 16px; }
.theme-control button { background: transparent; color: var(--muted); border: 0; font-size: 1.3rem; width: 44px; padding: 0; }
.registration { margin-top: 24px; border-top: 1px solid var(--line); }
.registration > summary { text-align: center; }
@media (min-width: 1024px) {
  .entry-page { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-story { background: var(--inset); padding: clamp(40px,5vw,64px); display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; }
  .story-brand { display: flex; align-items: center; gap: 10px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 20px; font-weight: 650; }
  .story-brand .brand-mark { width: 60px; height: 56px; }
  .story-art { width: 100%; max-width: 520px; aspect-ratio: 320/110; opacity: .7; }
  [data-cdn-theme] .story-art { background: url("public/brand/night.svg") center / contain no-repeat; }
  .story-copy small { font-size: 12px; letter-spacing: 1px; }
  .story-copy p { margin: 18px 0; font-size: 44px; font-weight: 700; line-height: 1.12; letter-spacing: -1px; }
  .story-copy span { color: var(--muted); line-height: 1.7; }
  .entry-main { padding-inline: 40px; }
  .entry-main > .theme-control { inset-inline-end: 36px; }
}
.app-header, .room-heading { display: flex; align-items: center; gap: .7rem; padding: .5rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.app-header .theme-control { margin-inline-start: auto; }
.settings-page main, .room-page main:not(:has(.room-grid)) { max-width: 48rem; margin: auto; padding: 1.5rem; }
.settings-page main > *, .room-page main:not(:has(.room-grid)) > * { margin-bottom: 1rem; }

.room-page {
  --room-surface: #14141e; --room-deep: #0e0e16; --room-panel: #20212e;
  --room-line: #363745; --room-ink: #eff0f8; --room-soft: #b8bacb;
  --composer: #222327; --composer-surround: #1a1a1e;
  --composer-ink: #f2f3f5; --composer-muted: oklab(74.5443% .00131971 -.00849813);
  --composer-hover: #ffffff16; --composer-hover-ink: #fff;
  background: var(--room-deep); color: var(--room-ink);
}
:root[data-theme="light"] .room-page {
  --room-surface: #f3f3fa; --room-deep: #e3e3ef; --room-panel: #fff;
  --room-line: #c6c6d7; --room-ink: #222332; --room-soft: #545768;
  --composer: var(--room-panel); --composer-surround: var(--room-surface);
  --composer-ink: var(--room-ink); --composer-muted: var(--room-soft);
  --composer-hover: var(--room-line); --composer-hover-ink: var(--room-ink);
}
.room-page:has(.room-grid) { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.room-page:has(.room-grid) .app-header { min-height: calc(50px + env(safe-area-inset-top)); padding-block: 0; }
.room-page:has(.room-grid) .app-header .brand-mark { width: 30px; height: 30px; }
.room-page:has(.room-grid) main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.room-grid { display: grid; flex: 1; min-height: 0; grid-template-columns: 60px minmax(185px, 20%) minmax(0,1fr) minmax(208px,22%); }
.room-grid h2 { font-size: 1rem; }
.room-rail, .room-heading, #room-drawer header, .people-tabs {
  display: flex; align-items: center; gap: .4rem;
}
.room-rail { flex-direction: column; padding: .75rem .25rem; background: var(--room-deep); }
.room-mark { width: 42px; height: 42px; display: inline-block; border-radius: 12px; background: #181826; }
[data-cdn-theme] .room-mark { background: #181826 url("public/room/default_room.png") center / cover no-repeat; }
.room-rail .room-mark { flex: none; padding: 0; border: 1px solid var(--room-line); }
.rail-group { width: 100%; display: grid; justify-items: center; gap: .4rem; padding-block-start: .5rem; border-block-start: 1px solid var(--room-line); }
.rail-group button[aria-expanded="true"], .side-action[aria-expanded="true"] { box-shadow: inset 3px 0 var(--accent); }
.room-button, #send button { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 10px; background: var(--room-panel); color: var(--room-ink); }
.room-icon, #send button::before { display: block; width: 19px; height: 19px; background: currentColor; mask: url("public/room/icons.svg") var(--pos,0%) center / 1100% 100% no-repeat; }
.icon-users { --pos: 10%; } .icon-envelope { --pos: 20%; } .icon-face-smile { --pos: 30%; }
#send button::before { content: ""; --pos: 40%; } .icon-paperclip { --pos: 50%; }
.icon-house { --pos: 60%; } .icon-cog { --pos: 70%; } .icon-search { --pos: 80%; }
.icon-bell { --pos: 90%; } .icon-times { --pos: 100%; }
.room-tools, #room-people { min-width: 0; overflow: auto; overscroll-behavior: contain; background: var(--room-surface); }
.room-tools { border-inline: 1px solid var(--room-line); }
.room-cover { display: grid; align-content: end; justify-items: start; gap: .65rem; padding: 1.1rem; min-height: 150px; background: radial-gradient(ellipse at 20% 0%,#41456c,transparent 70%),linear-gradient(145deg,#343456,#181825); color: #fff; }
.room-cover .room-mark { width: 52px; height: 52px; }
.room-side-content, #room-settings { padding: 1rem; }
.room-side-content { display: grid; gap: .75rem; }
.room-grid :is(input,select,textarea), #room-drawer :is(input,select,textarea) { color: var(--room-ink); background: var(--room-panel); border-color: var(--room-line); }
.conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: linear-gradient(160deg,var(--room-panel),var(--room-deep)); }
.room-heading { flex: none; padding: .25rem .65rem; gap: .4rem; border-bottom: 1px solid var(--room-line); background: var(--room-surface); }
.room-heading h1 { flex: 1; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-heading .room-button { background: transparent; }
#status, #typing, #compose-feedback, #people-status { font-size: .8rem; color: var(--room-soft); }
#status, #typing { padding: .25rem .8rem; }
#status:empty { margin: 0; padding: 0; }
.typing-indicator { display: flex; align-items: baseline; gap: .4rem; margin-block: .15rem; color: var(--room-soft); font-size: .8rem; }
.typing-indicator:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.typing-dots { display: inline-flex; align-self: center; gap: 2px; }
.typing-dots i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  .typing-dots i { animation: typing-bounce 1.2s ease-in-out infinite; }
  .typing-dots i:nth-child(2) { animation-delay: .16s; }
  .typing-dots i:nth-child(3) { animation-delay: .32s; }
}
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-2px); } }

#messages { flex: 1; overflow: auto; overflow-anchor: none; overscroll-behavior: contain; margin: 0; list-style: none; min-height: 0; }
.new-messages { align-self: center; flex: none; margin: .2rem; padding: .4rem .9rem; border: 1px solid var(--room-line); border-radius: 2rem; background: var(--room-panel); color: var(--room-ink); }
.message-bubble { padding: .3rem .65rem; max-width: 100%; border: 1px solid var(--room-line); border-radius: 4px 12px 12px; background: var(--room-panel); overflow-wrap: anywhere; white-space: pre-wrap; }
.compose-dock { flex: none; padding: 0 16px 8px; background: var(--composer-surround); }
:is(#composer,#private-compose) {
  display: flex; align-items: center; min-height: 56px; gap: 8px;
  padding: 0 11px; border-radius: 8px; background: var(--composer);
}
:is(#composer,#private-compose) label { flex: 1 1 0; min-inline-size: 0; }
:is(#composer,#private-compose) textarea {
  field-sizing: content; resize: none; width: 100%; min-height: 56px; max-height: 160px;
  padding: 17px 0; border: 0; border-radius: 0; background: transparent; color: var(--composer-ink);
  font: inherit; font-size: 16px; line-height: 22px; white-space: pre-wrap;
}
:is(#composer,#private-compose) textarea::placeholder { color: var(--composer-muted); opacity: 1; }
:is(#composer,#private-compose) :is(.room-button,#send button,#private-send button) {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px;
  min-width: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--composer-muted);
}
:is(#composer,#private-compose) :is(.room-button,#send button,#private-send button):hover {
  background: var(--composer-hover); color: var(--composer-hover-ink);
}
:is(#send,#private-send) button { font-size: 0; }
@media (max-width: 768px) {
  .compose-dock { padding: 0 8px max(8px,env(safe-area-inset-bottom)); }
  :is(#composer,#private-compose) { align-items: end; min-height: 52px; gap: 4px; padding: 4px 6px; }
  :is(#composer,#private-compose) textarea { min-height: 34px; max-height: min(160px,40dvh); padding: 5px 0; }
  :is(#composer,#private-compose) :is(.room-button,#send button,#private-send button) {
    width: 40px; height: 44px; min-width: 40px; min-height: 44px;
  }
}

#room-people { padding: .85rem; border-inline-start: 1px solid var(--room-line); }
#room-people > * { margin-bottom: .6rem; }
.people-tabs { flex-wrap: wrap; gap: .25rem; }
.people-tabs button, #people-refresh, #people-more { font-size: .78rem; padding: .4rem; min-height: 36px; }
#people-count { display: inline-grid; place-items: center; min-width: 1.4em; padding: .05em .3em; margin-inline-start: .3em; border-radius: 1em; font-variant-numeric: tabular-nums; background: var(--room-panel); color: var(--room-ink); }
.people-tabs button[aria-pressed="true"] { border-bottom: 2px solid var(--focus); }
#people-list { list-style: none; padding: 0; }
#people-list li { display: flex; align-items: center; gap: .5rem; min-height: 44px; overflow-wrap: anywhere; }
.person-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--room-panel); font-weight: 650; }
#people-list small { color: var(--room-soft); }
#room-drawer { width: min(30rem,100%); max-height: 92dvh; padding: 0; border: 1px solid var(--room-line); border-radius: 14px; background: var(--room-surface); color: var(--room-ink); overscroll-behavior: contain; }
#room-drawer::backdrop { background: rgb(4 5 12 / .72); }
#room-drawer header { position: sticky; top: 0; justify-content: space-between; padding: .4rem .75rem; background: var(--room-surface); z-index: 1; border-bottom: 1px solid var(--room-line); }
#room-settings > * { margin-bottom: .75rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media(max-width:800px) {
  .room-grid { grid-template-columns: minmax(0,1fr); }
  .room-grid > :is(.room-rail,.room-tools,#room-people) { display: none; }
  .room-heading .room-button { min-width: 44px; min-height: 44px; }
  #room-drawer { width: min(24rem,calc(100% - 1rem)); }
}
.room-heading h1 { display: flex; align-items: center; gap: .5rem; }
[data-cdn-theme] .room-heading h1::before {
  content: ""; flex: none; width: 27px; height: 27px; border-radius: 7px;
  background: url("public/room/default_room.png") center / cover;
}
.room-page:has(.room-grid) .app-header {
  padding-top: env(safe-area-inset-top);
  padding-inline-start: max(5px, env(safe-area-inset-left));
  padding-inline-end: max(5px, env(safe-area-inset-right));
}

/* Room and private threads share the reference layout and site-owned default portrait. */
.conversation, #private-thread { container-type: inline-size; }
:is(#messages, #private-thread ol) {
  --message-avatar-size: 40px; --message-avatar-top: 24px;
  --message-inset: 20px; --message-connector: 27px;
  padding: 0 0 32px;
}
:is(#messages, #private-thread ol) > li {
  display: grid; grid-template-columns: var(--message-avatar-size) minmax(0,1fr); align-items: start;
  justify-items: start; column-gap: 10px; row-gap: 4px; padding: 2px var(--message-inset);
}
:is(#messages, #private-thread ol) > li:not(:first-child, .message-continuation) { margin-block-start: 16px; }
:is(#messages, #private-thread ol) > li > .message-bubble {
  padding: 0; border: 0; background: transparent; font-size: 16px; line-height: 22px;
}
@container (max-width: 480px) {
  :is(#messages, #private-thread ol) {
    --message-avatar-size: 32px; --message-avatar-top: 23px;
    --message-inset: 12px; --message-connector: 19px;
    padding-bottom: 24px;
  }
}
.person-mark {
  grid-column: 1; grid-row: 1 / span 2; width: 36px; height: 36px;
  border: 1px solid var(--room-line); border-radius: 50%; background: var(--room-panel);
}
[data-cdn-theme] .person-mark {
  background: var(--room-panel) url("public/avatars/default_avatar.png") center / cover no-repeat;
}
[data-cdn-theme] .person-mark.guest-mark { background-image: url("public/avatars/default_guest.png"); }
#messages li > *, #private-thread ol > li > * { grid-column: 2; }
:is(#messages, #private-thread ol) > li > :is(.private-author-card,.room-author-card) {
  grid-column: 1; grid-row: 1 / span 2; align-self: start; padding: 0;
  width: var(--message-avatar-size); height: var(--message-avatar-size);
  min-height: var(--message-avatar-size); margin-block-start: var(--message-avatar-top);
}
/* Both conversations use the same date break, sender line and compact continuation. */
.message-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px;
  min-inline-size: 0; max-inline-size: 100%; line-height: 18px;
}
.message-meta > strong { overflow-wrap: anywhere; font-size: 16px; font-weight: 600; }
.message-clock { color: var(--room-soft); white-space: nowrap; font-size: 12px; }
:is(#messages, #private-thread ol) > li:not(.message-continuation) > .message-meta { position: relative; }
:is(#messages, #private-thread ol) > li:not(.message-continuation) > .message-meta::before {
  content: ""; position: absolute; inset-inline-end: calc(100% + 3px); inset-block-start: 9px;
  inline-size: var(--message-connector); block-size: 12px; box-sizing: border-box;
  border-block-start: 2px solid var(--room-line); border-inline-start: 2px solid var(--room-line);
  border-start-start-radius: 6px; pointer-events: none;
}
:is(#messages, #private-thread ol) > li[data-day-start]::before {
  content: attr(data-day-start); grid-column: 1 / -1; grid-row: 1; z-index: 1;
  justify-self: center; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis;
  color: var(--room-soft); background: var(--composer-surround); padding: 0 8px;
  font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
}
:is(#messages, #private-thread ol) > li[data-day-start]::after {
  content: ""; position: absolute; inset: 12px var(--message-inset) auto;
  block-size: 1px; background: var(--room-line); pointer-events: none;
}
:is(#messages, #private-thread ol) > li[data-day-start] > :is(.room-author-card,.private-author-card) { grid-row: 2 / span 2; }
:is(#messages, #private-thread ol) > li.message-continuation { padding-block: 0; min-block-size: 22px; }
:is(#messages, #private-thread ol) > li.message-continuation > :is(.room-author-card,.private-author-card),
:is(#messages, #private-thread ol) > li.message-continuation .message-meta > strong { display: none; }
:is(#messages, #private-thread ol) > li.message-continuation > .message-meta { display: contents; }
.message-continuation .message-clock {
  position: absolute; inset-inline-start: 0; inset-block-start: 50%; transform: translateY(-50%);
  inline-size: calc(var(--message-inset) + 20px); text-align: end; font-size: 9px; opacity: 0;
}
.message-continuation:is(:hover,:focus-within,[data-touch-tools]) .message-clock { opacity: 1; }
.message-continuation .private-receipt { position: absolute; inset-block-start: 5px; inset-inline-end: var(--message-inset); }
#private-peer-card { min-height: 34px; padding: 0; }
#private-thread ol { list-style: none; }
.private-receipt { display: inline-block; white-space: nowrap; line-height: 1; color: var(--room-soft); }
@media (prefers-reduced-motion: no-preference) {
  .private-receipt.read-confirmed { animation: read-confirm .35s ease-out; }
}
@keyframes read-confirm { from { transform: scale(.65); opacity: .3; } to { transform: scale(1); opacity: 1; } }
#private-thread ol > li[data-seen] .private-receipt { color: var(--accent); }
#private-thread ol > li small { font-size: 12px; color: var(--room-soft); }
#private-send button::before, #login button::after {
  content: ""; width: 18px; height: 18px; background: currentColor;
  mask: url("public/room/icons.svg") 40% center / 1100% 100% no-repeat;
}
#login button { display: flex; justify-content: center; align-items: center; gap: .45rem; }
#composer [data-room-action="attach"] .room-icon {
  mask: none; border: 1.7px solid currentColor; border-radius: 50%;
  background: linear-gradient(currentColor,currentColor) center / 9px 1.7px no-repeat,
    linear-gradient(currentColor,currentColor) center / 1.7px 9px no-repeat;
}
@media(max-width:800px) {
  #room-drawer:is([data-panel="room-navigation"],[data-panel="room-people"]) {
    margin: 0; height: 100dvh; max-height: 100dvh; border-radius: 0; width: min(240px,100%);
  }
  #room-drawer[data-panel="room-people"] { margin-inline-start: auto; width: min(280px,100%); }
}

#room-filter-status { margin: 0; padding: .25rem .8rem; color: var(--room-soft); font-size: .85rem; }
#room-filter-status:empty { padding: 0; }
.story-tabs, .story-composer { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; }
.story-composer { margin-block: .75rem; }
.story-composer label { display: grid; gap: .3rem; min-inline-size: 0; }
.story-composer :is(textarea, input, select) { box-sizing: border-box; max-inline-size: 100%; }
.story-panel ul { list-style: none; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap: .5rem; padding-inline-start: 0; }
.story-panel li > button { inline-size: 100%; }
.story-panel [data-story-detail] :is(img,video) { display: block; max-inline-size: 100%; max-block-size: min(55dvh,30rem); margin-inline: auto; border-radius: .6rem; }
.story-panel [data-story-detail] p { overflow-wrap: anywhere; white-space: pre-wrap; }
.highlight-editor { display: grid; align-items: start; }
.highlight-editor fieldset { min-inline-size: 0; border: 1px solid var(--line); border-radius: .5rem; }
.highlight-editor [data-highlight-options] { display: grid; gap: .35rem; max-block-size: 16rem; overflow: auto; }
.highlight-editor [data-highlight-options] label { display: flex; align-items: start; overflow-wrap: anywhere; }
.room-site-header { gap: 2px; }
.room-site-brand { display: inline-flex; flex: none; align-items: center; padding-inline: 4px; }
.chat-head-controls { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; min-inline-size: 0; }
.room-site-header .room-button { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent; border: 0; color: inherit; }
#room-filter { display: flex; align-items: center; inline-size: 218px; min-inline-size: 64px; block-size: 28px; gap: 0; margin-inline-start: 7px; border-radius: 5px; background: var(--inset); }
#room-filter:focus-within { outline: 1px solid var(--focus); }
#room-filter label { min-inline-size: 0; flex: 1; }
#room-filter input { box-sizing: border-box; inline-size: 100%; height: 28px; min-height: 28px; padding: 4px 8px; border: 0; outline: 0; background: transparent; font-size: 12px; }
#room-filter .room-search-submit { display: grid; place-items: center; flex: none; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 0; background: transparent; color: inherit; }
@media (max-width: 768px) {
  .room-site-brand { display: none; }
}
@media (max-width: 640px) {
  .chat-head-controls { flex: 1; }
  #room-filter { flex: 1; max-inline-size: 218px; }
  #room-filter input { font-size: 16px; }
}

.expression-picker {
  --picker-panel: #2f3136; --picker-input: #202225; --picker-active: #40444b;
  --picker-line: #42454d; --picker-ink: #f2f3f5; --picker-muted: #b9bbbe;
  box-sizing: border-box; display: flex; flex-direction: column; gap: .45rem; min-width: 0; min-height: 0;
  max-width: 100%; max-height: min(55dvh,32rem); padding: 8px; overflow: hidden;
  border: 1px solid var(--picker-line); border-radius: 8px; background: var(--picker-panel);
  color: var(--picker-ink); font: 14px/1.4 system-ui, sans-serif;
}
#private-emoji-picker { padding: 6px; font-size: 13px; }
.expression-picker[popover] { position: fixed; inset: auto; margin: 0; max-height: none; box-shadow: 0 12px 42px #0005; }
.expression-picker[hidden], .expression-categories button[hidden] { display: none; }
.expression-heading, .expression-modes, .expression-body { display: flex; align-items: center; gap: .3rem; }
.expression-heading { justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--picker-line); padding-bottom: 8px; }
.expression-modes { gap: 8px; min-inline-size: 0; }
#private-emoji-picker :is(.expression-heading, .expression-modes) { gap: 4px; }
#private-emoji-picker .expression-heading { padding-bottom: 4px; }
.expression-picker button { background: transparent; border: 0; color: inherit; }
.expression-heading button { min-height: 40px; color: var(--picker-muted); border-radius: 4px; padding: 8px 12px; }
#private-emoji-picker .expression-heading button { min-height: 32px; padding: 4px 8px; }
.expression-modes [aria-pressed="true"], .expression-categories [aria-pressed="true"],
.expression-results button:is(:hover,:focus-visible) { background: var(--picker-active); color: var(--picker-ink); }
.expression-close { min-width: 44px; padding: .2rem; font-size: 1.4rem; }
.expression-search-row { display: flex; gap: 4px; align-items: center; }
.expression-search-row input { flex: 1; width: 100%; min-inline-size: 0; }
.expression-search-row select { min-width: 0; max-width: 48%; padding-inline: .35rem; }
.expression-search-row :is(input,select) { min-height: 36px; background: var(--picker-input); color: var(--picker-ink); border-color: var(--picker-line); }
.expression-search-row input::placeholder { color: var(--picker-muted); }
@media (pointer: coarse) { .expression-search-row input[type="search"] { font-size: 16px; } }
.expression-body { align-items: stretch; flex: 1; min-height: 0; border-top: 1px solid var(--picker-line); }
.expression-categories { display: flex; flex-direction: column; flex: none; gap: 2px; padding-block: 4px; overflow: auto;
  scrollbar-width: none; border-radius: 6px; background: rgb(0 0 0 / .10); }
.expression-categories button { min-height: 44px; width: 44px; padding: .2rem; font-size: 1.35rem; }
.expression-scroll { flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: .35rem; }
.expression-scroll h3 { margin: .3rem 0; font-size: .8rem; color: var(--picker-muted); }
.expression-results { display: grid; grid-template-columns: repeat(auto-fill,minmax(var(--emoji-cell,44px),1fr)); }
.expression-results button { display: grid; place-items: center; min-width: 0; min-height: var(--emoji-cell,44px); padding: .2rem; font-size: 1.5rem; }
#private-emoji-picker { --emoji-cell: 36px; --emoji-glyph: 24px; }
#private-emoji-picker .expression-categories button { width: 36px; min-height: 36px; }
.expression-twemoji {
  display: inline-block; width: var(--emoji-glyph,28px); height: var(--emoji-glyph,28px);
  vertical-align: middle; background: url("public/expressions/twemoji.png") no-repeat;
  background-size: 6100% 6100%;
}
.expression-credit { font-size: .68rem; color: inherit; }
#private-emoji-picker .expression-preview { display: none; }
.expression-picker[data-mode="stickers"] .expression-results { grid-template-columns: repeat(auto-fill,minmax(min(76px,100%),1fr)); }
.expression-picker[data-mode="stickers"] .expression-results img { width: 68px; height: 68px; max-width: 100%; }
.expression-pages { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.expression-pages button { min-height: 44px; }
.expression-picker footer { min-height: 1.2rem; border-top: 1px solid var(--picker-line); padding-top: .35rem; color: var(--picker-muted); font-size: .8rem; }
.expression-favorite-edit { float: inline-end; min-height: 40px; border-radius: .4rem; }
.expression-favorite-edit[aria-pressed="true"], .expression-results [aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--focus); }
.expression-results [aria-pressed="true"]::after { content: "★"; font-size: .7rem; }
.expression-picker footer span { display: block; }
.message-author, .message-expression { border: 0; padding: 0; min-height: 0; background: transparent; color: inherit; font: inherit; }
.message-author:hover { text-decoration: underline; }
.message-expression { vertical-align: middle; line-height: 1; }
.message-author:focus-visible, .message-expression:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.expression-results img, .message-bubble img { object-fit: contain; vertical-align: middle; }
#private-thread ol { max-height: clamp(5rem,35dvh,24rem); overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; }
/* The desktop conversation docks inside the room. On mobile the same dialog spans the viewport. */
.room-grid { position: relative; }
#room-drawer:is([data-panel="private-panel"],[data-panel="notification-panel"],[data-panel="reports-panel"])[open] {
  display: flex; flex-direction: column; position: absolute; z-index: 5; inset: 0 0 0 auto; margin: 0;
  width: min(420px,100%); max-width: 100%; height: 100%; max-height: 100%; box-sizing: border-box;
  border: 0; border-inline-start: 1px solid var(--room-line); border-radius: 0; box-shadow: -5px 0 22px #0003;
}
#room-drawer[data-panel="private-panel"] > #drawer-content { flex: 1; min-height: 0; }
@media (min-width: 801px) {
  #room-drawer[data-panel="private-panel"][open] {
    position: static; grid-column: 4; grid-row: 1; width: 100%; min-height: 0;
  }
}
#drawer-content > #private-panel, #drawer-content .private-workspace { height: 100%; min-height: 0; }
#drawer-content > #private-panel::details-content { height: 100%; }
#drawer-content .private-workspace { display: flex; flex-direction: column; }
#private-directory { overflow-y: auto; padding: .7rem; }
#private-status:not(:empty) { padding: .35rem .75rem; font-size: .85rem; }
#room-drawer:has(#private-thread:not([hidden]))[data-panel="private-panel"] > header { display: none; }
#room-drawer[data-panel="private-panel"] #private-thread { flex: 1; min-height: 0; }
#room-drawer[data-panel="private-panel"] #private-thread ol {
  flex: 1; min-height: 0; max-height: none; padding: .6rem .75rem; background: var(--room-deep);
}
#private-resume { align-self: end; display: inline-flex; align-items: center; gap: .45rem; max-width: 80%; min-height: 44px; margin-inline: .6rem; padding: .2rem .8rem; border-radius: 2rem; background: var(--room-panel); color: var(--room-ink); }
#private-resume .person-mark { width: 28px; height: 28px; flex: none; }
#private-resume .resume-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#private-resume .navigation-count { position: static; }
.private-heading { display: flex; align-items: center; gap: .5rem; min-height: 60px; padding: .25rem .6rem; border-bottom: 1px solid var(--room-line); }
.private-heading .person-mark { width: 34px; height: 34px; flex: none; }
.private-heading h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.private-heading .room-button { width: 44px; height: 44px; background: transparent; }
#private-thread :is(.reply-preview,#private-typing) { margin-inline: .6rem; }
#private-thread #private-compose { margin: 0 16px 8px; }
@media (max-width: 768px) {
  #private-thread #private-compose { margin: 0 8px max(8px,env(safe-area-inset-bottom)); }
}
#private-thread ol > li:is(:hover,:focus-within) { background: var(--room-panel); }
@media(max-width:800px) {
  #room-drawer:is([data-panel="private-panel"],[data-panel="notification-panel"],[data-panel="reports-panel"])[open] { position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: 100dvh; padding-top: env(safe-area-inset-top); }
}
#drawer-content > #private-panel > summary { display: none; }

/* Shared room and direct-message chrome from the reference room layout. */
@media (min-width:801px) {
  .room-grid {
    grid-template-columns: var(--rail-width,60px) var(--menu-width,minmax(158px,21%)) minmax(0,1fr)
      var(--private-width,0px) var(--roster-width,280px) clamp(40px,4vw,62px);
    grid-template-rows: minmax(0,1fr);
  }
  .room-grid:has(> #room-navigation[hidden]) { --rail-width: 0px; --menu-width: 0px; }
  .room-grid:has(> #room-navigation[hidden]) > .room-rail { display: none; }
  .room-grid:has(> #room-people[hidden]) { --roster-width: 0px; }
  .room-grid:has(> #room-drawer[data-panel="private-panel"][open]) { --private-width: 360px; }
  .room-grid > .room-rail { grid-column: 1; }
  .room-grid > #room-navigation { grid-column: 2; }
  .room-grid > .conversation { grid-column: 3; }
  .room-grid > #room-people { grid-column: 5; }
  .room-grid > .room-utilities { grid-column: 6; }
}
@media (801px <= width <= 1200px) {
  .room-grid:has(> #room-drawer[data-panel="private-panel"][open]) { --menu-width: 0px; }
  .room-grid:has(> #room-drawer[data-panel="private-panel"][open]) > #room-navigation { display: none; }
}
@media (801px <= width <= 960px) {
  .room-grid:has(> #room-drawer[data-panel="private-panel"][open]) { --roster-width: 0px; }
  .room-grid:has(> #room-drawer[data-panel="private-panel"][open]) > #room-people { display: none; }
}
.room-cover { position: relative; isolation: isolate; min-height: clamp(130px,20vh,192px); background: #212735; }
[data-cdn-theme] .room-cover { background: linear-gradient(0deg,rgba(9,12,20,.88),rgba(9,12,20,.04) 78%),url("public/room/cover.webp") center 42% / cover; }
.room-cover h2 { font-size: 1.28rem; margin: 0; }
.room-side-content { padding: .8rem; gap: .3rem; }
.side-action, .person-entry { display: flex; width: 100%; align-items: center; gap: .65rem; text-align: start; background: transparent; color: inherit; border: 0; }
.side-action { justify-content: start; min-height: 44px; }
.room-utilities { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .45rem; padding: .55rem 0; border-inline-start: 1px solid var(--room-line); background: var(--room-deep); }
[data-room-action]:has(> .navigation-count) { position: relative; }
.navigation-count { position: absolute; inset-block-start: 0; inset-inline-end: 0; padding: 0 .3rem; min-width: 1.05rem; border-radius: 1rem; background: #a82146; color: white; font: bold .66rem/1.1rem system-ui; text-align: center; pointer-events: none; }
.side-action > .navigation-count { position: static; margin-inline-start: auto; }
.room-utilities button { min-width: 36px; min-height: 40px; }
.people-heading { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.people-heading h2 { margin-inline-end: auto; }
.people-heading button { display: grid; place-items: center; background: transparent; }
.people-tabs { gap: .15rem; flex-wrap: wrap; }
.people-tabs button { min-width: 0; padding-inline: .35rem; }
.presence-title { display: flex; align-items: center; gap: .4rem; margin-block: 1rem .35rem; font-size: .75rem; color: var(--room-soft); }
[data-cdn-theme] .presence-title::before { width: 1rem; height: 1rem; background: url("public/room/user_count.svg") center / contain no-repeat; }
.presence-title::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: #46c98d; }
#people-list { margin: 0; }
.person-entry { padding: .35rem .2rem; justify-content: start; }
.person-entry small { margin-inline-start: auto; }
.person-entry:hover, .side-action:hover, .person-entry:focus-visible { background: var(--room-panel); }
[data-expression-trigger] { display: inline-flex; flex: none; align-items: center; }
.room-icon.icon-sticker { position: relative; mask: none; background: none; border: 1.6px solid currentColor; width: 16px; height: 17px; border-radius: 3px 3px 6px 3px; }
.room-icon.icon-sticker::after { content: ""; position: absolute; inset: auto -1px -1px auto; width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 2px; background: var(--room-panel); }
#private-thread { display: flex; flex-direction: column; gap: .35rem; }
#private-thread h2 { margin: .55rem 0 .2rem; font-size: 1rem; }
#private-thread ol { margin: 0; min-height: min(11rem,25dvh); }
#private-thread [data-mine] .message-bubble { border-color: color-mix(in srgb,var(--accent) 38%,var(--room-line)); }
.message-bubble { line-height: 1.36; }
.message-mention { background: color-mix(in srgb, var(--accent) 16%, var(--room-panel)); color: var(--room-ink); border-radius: .2em; }
.message-mention.personal-mention { font-weight: 650; text-decoration: underline; text-decoration-color: var(--focus); text-underline-offset: .12em; }
#private-open { display: flex; align-items: end; flex-wrap: wrap; gap: .45rem; }
#private-open label { flex: 1 1 10rem; }
@media (max-width:800px) {
  .room-utilities, .people-heading [data-room-action="hide-people"] { display: none; }
  #room-drawer[data-panel="room-navigation"] #drawer-content { display: grid; grid-template-columns: 48px minmax(0,1fr); min-height: calc(100% - 52px); }
  #drawer-content .room-rail { display: flex; border-inline-end: 1px solid var(--room-line); }
}

#private-inbox { background: var(--room-panel); border: 1px solid var(--room-line); border-radius: .7rem; margin-bottom: .8rem; }
#private-inbox summary { cursor: pointer; padding: .6rem .75rem; font-weight: 650; }
#private-inbox ul { list-style: none; padding: 0 .35rem; margin: 0; max-height: min(34dvh,18rem); overflow: auto; overscroll-behavior: contain; }
#private-inbox li { display: flex; align-items: center; border-top: 1px solid var(--room-line); }
#private-inbox .person-entry { min-width: 0; min-height: 44px; overflow-wrap: anywhere; }
#private-inbox .person-mark { flex: none; }
#private-inbox [role=status]:not(:empty) { margin: .55rem .75rem; color: var(--room-soft); }
#private-inbox [role=status]:empty { display: none; }
.inbox-actions { display: flex; justify-content: end; padding: 0 .4rem .25rem; }
.inbox-pages { display: flex; justify-content: center; align-items: center; gap: .65rem; }
.inbox-pages button { min-width: 44px; min-height: 44px; }
.inbox-pages button[aria-disabled="true"] { opacity: .55; }
.inbox-refresh, .private-hide { background: transparent; color: var(--room-soft); }
.private-hide { min-width: 44px; min-height: 44px; padding: 0; font-size: 1.2rem; }
.private-unread { background: var(--accent); color: #001820; border-radius: 1rem; padding: .05rem .45rem; margin-inline-start: auto; font-size: .8rem; font-weight: 700; }

#roster-friends { padding-block: .5rem; }
#roster-friends [role=status]:empty { display: none; }
#friend-directory > ul, .friend-group ul { list-style: none; margin: .5rem 0; padding: 0; }
#friend-directory li { border-bottom: 1px solid var(--room-line); padding: .55rem 0; overflow-wrap: anywhere; }
#friend-directory li small { color: var(--room-soft); display: block; }
.friend-search label { display: block; color: var(--room-soft); margin-block-end: .25rem; }
.friend-search input { box-sizing: border-box; width: 100%; }
.friend-group h3 { display: flex; align-items: center; gap: .45rem; margin: .85rem 0 .25rem; font-size: .88rem; }
.friend-count { padding: .08rem .45rem; border-radius: 1rem; background: var(--room-line); }
#friend-directory .friend-group li small { display: none; }
#roster-friends .friend-identity { display: inline-flex; align-items: center; gap: .5rem; max-width: calc(100% - 3rem); min-height: 44px; padding: .2rem; border: 0; background: transparent; color: inherit; text-align: start; }
.friend-identity .person-mark { flex: none; }
.friend-identity strong { min-width: 0; overflow-wrap: anywhere; }
.friend-identity:hover strong, .friend-identity:focus-visible strong { text-decoration: underline; }
.friend-message { float: inline-end; }
.friend-group li form { clear: both; }
#roster-friends form { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: .4rem; }
#roster-friends form :is(label,input,select) { min-width: 0; max-width: 100%; }
#roster-friends form label { flex-basis: 100%; }
#roster-friends button { min-height: 36px; font-size: .82rem; }
#roster-friends summary { padding: .5rem 0; cursor: pointer; }

:is(#messages, #private-thread ol) > li { position: relative; padding-inline-end: max(46px, var(--message-inset)); }
.message-row-tools {
  position: absolute; z-index: 5; inset-block-start: -14px; inset-inline-end: 14px;
  display: flex; padding: 2px; border: 1px solid var(--room-line); border-radius: 8px;
  background: var(--room-panel); box-shadow: 0 4px 12px rgb(0 0 0 / .33);
}
.message-row-tools button {
  display: grid; place-items: center; inline-size: 28px; min-inline-size: 28px;
  block-size: 28px; min-block-size: 28px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--room-soft); font-size: 17px;
}
.message-row-tools button:is(:hover,:focus-visible) {
  color: var(--room-ink); background: var(--room-line);
}
.message-row-tools .message-quick-reply { display: none; }
li:is(:hover,:focus-within,[data-touch-tools]) > .message-row-tools .message-quick-reply { display: grid; }
@media (hover: hover) {
  li:not(:hover):not(:focus-within):not([data-touch-tools]):not(:has(.message-more[aria-expanded="true"])) > .message-row-tools {
    opacity: 0; pointer-events: none;
  }
}
@media (max-width: 480px), (pointer: coarse) {
  .message-row-tools { inset-inline-end: 8px; inset-block-start: -12px; }
  .message-row-tools button { inline-size: 36px; min-inline-size: 36px; block-size: 36px; min-block-size: 36px; }
}
@media (pointer: coarse) {
  .message-row-tools button {
    inline-size: 40px; min-inline-size: 40px; block-size: 40px; min-block-size: 40px;
    touch-action: manipulation;
  }
}
.message-action-dialog .message-copy-text { box-sizing: border-box; width: 100%; margin-block: .5rem; resize: vertical; }
.message-attachment { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.message-attachment button { min-height: 40px; }
[data-cdn-theme] .message-attachment :is(.attachment-audio,.attachment-video,.attachment-file)::before {
  content: ""; width: 1.3em; height: 1.3em; margin-inline-end: .35em; display: inline-block;
  vertical-align: middle; background: var(--attachment-icon) center / contain no-repeat;
}
.attachment-audio { --attachment-icon: url("public/attachments/audio.svg"); }
.attachment-video { --attachment-icon: url("public/attachments/video.svg"); }
.attachment-file { --attachment-icon: url("public/attachments/file.svg"); }
.attachment-viewer {
  width: fit-content; max-width: min(56rem,95vw); max-height: 90dvh; overflow: auto;
  padding: .8rem; border: 1px solid var(--room-line); border-radius: 14px;
  color: var(--room-ink); background: var(--room-panel);
}
.attachment-viewer::backdrop { background: rgb(0 0 0 / .75); }
.attachment-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .35rem; }
.attachment-toolbar button, .player-restore { min-height: 44px; }
.attachment-toolbar button[aria-pressed="true"] { box-shadow: inset 0 -3px currentColor; }
.attachment-image:focus-visible { outline-offset: -3px; }
.attachment-image { max-width: min(86vw,52rem); max-height: 72dvh; overflow: auto; }
.attachment-viewer .attachment-image.original-size img { max-width: none; max-height: none; }
.attachment-stage:fullscreen { display: flex; flex-direction: column; align-items: center; background: var(--room-panel); padding: .5rem; }
.attachment-stage:fullscreen .attachment-image { max-width: 100%; max-height: none; min-height: 0; }
.attachment-stage:fullscreen .attachment-image:not(.original-size) img { max-height: calc(100dvh - 4.5rem); }
.attachment-player { position: fixed; inset: auto; top: max(.75rem,env(safe-area-inset-top)); right: max(.75rem,env(safe-area-inset-right)); z-index: 10; margin: 0; width: max-content; max-width: calc(100vw - 1.5rem); }
.attachment-player .player-handle { margin-inline-end: auto; cursor: move; touch-action: none; }
.attachment-player .player-handle:active { cursor: grabbing; }
.player-restore { align-self: flex-start; margin-block: .2rem; }
.attachment-viewer :is(img,video,audio) { display: block; max-width: 100%; max-height: 72dvh; margin-block-start: .5rem; }
.attachment-viewer p:empty { display: none; }
.attachment-selection {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .45rem .65rem;
  background: var(--room-panel); border-inline-start: 3px solid var(--accent); border-radius: .35rem;
}
.attachment-selection img { flex: none; width: 3.5rem; height: 3.5rem; border-radius: .4rem; object-fit: contain; background: var(--room-surface); }
.attachment-selection span { flex: 1 1 9rem; min-width: 0; overflow-wrap: anywhere; }
.attachment-selection button { min-height: 44px; }
#private-thread .attachment-selection { margin-inline: .6rem; }
.text-send-state { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .25rem .6rem; color: var(--room-soft); font-size: .85rem; }
.text-send-state[hidden], .text-send-state button[hidden] { display: none; }
.text-send-state [role="status"] { overflow-wrap: anywhere; }
.reply-preview { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; border-inline-start: 3px solid var(--accent); background: var(--room-panel); }
.reply-preview[hidden] { display: none; }
.reply-selection { display: grid; flex: 1; min-width: 0; }
.reply-selection strong { color: var(--room-soft); font-size: .8rem; }
[data-cdn-theme] .reply-preview::before { content: ""; display: block; flex: none; width: 30px; height: 30px; border-radius: 50%; background: url("public/avatars/default_avatar.png") center / cover; }
.quote-body img { vertical-align: middle; object-fit: contain; }
.reply-selection .quote-body img { width: auto; height: 1.3em; }
.reply-selection .quote-body { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.message-quote { justify-self: start; border: 0; border-inline-start: 2px solid var(--accent); border-radius: 0; padding: .25rem .55rem; color: var(--room-soft); background: transparent; font-size: .85rem; }
:is(#messages, #private-thread) li[tabindex="-1"]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.message-action-dialog { width: min(24rem,92vw); max-height: 80dvh; overflow: auto; border: 1px solid var(--room-line); border-radius: 14px; padding: 1rem; color: var(--room-ink); background: var(--room-panel); }
.message-action-dialog::backdrop { background: rgb(0 0 0 / .55); }
#messages :is(.message-more,.message-quote)[aria-expanded="true"] { anchor-name: --room-message-menu; }
#private-thread :is(.message-more,.message-quote)[aria-expanded="true"] { anchor-name: --private-message-menu; }
#composer-message-actions { position-anchor: --room-message-menu; }
#private-compose-message-actions { position-anchor: --private-message-menu; }
.message-action-dialog:popover-open {
  display: block; position: fixed; inset: auto; margin: 4px 0;
  position-area: bottom span-left; justify-self: end; align-self: start;
  position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline; position-try-order: most-height;
  box-sizing: border-box; inline-size: min(222px, calc(100vw - 16px));
  max-block-size: min(70dvh, 100%); overscroll-behavior: contain;
  padding: 8px; border-radius: 8px; box-shadow: 0 12px 24px rgb(0 0 0 / .4);
}
:root:not([data-theme="light"]) .message-action-dialog:popover-open {
  background: #28282d; color: #d6d7dc; border-color: #3b3c44;
}
.message-action-dialog:popover-open::backdrop { background: transparent; }
.message-action-dialog:popover-open > strong + p {
  max-height: 3.2em; overflow: auto; margin-block: .35rem .6rem;
}
.message-action-dialog div { display: grid; gap: .25rem; }
.message-action-dialog button { min-height: 44px; text-align: start; }
.message-action-dialog:popover-open .message-action-controls { gap: 1px; }
.message-action-dialog:popover-open .message-action-controls > button {
  min-block-size: 36px; padding: 5px 9px; border: 0; border-radius: 4px;
  background: transparent; color: inherit; font: inherit; font-size: 14px;
}
.message-action-dialog:popover-open .message-action-controls > button:is(:hover,:focus-visible) {
  background: var(--room-line); color: var(--room-ink);
}
@media (pointer: coarse) {
  .message-action-dialog:popover-open .message-action-controls > button { min-block-size: 44px; }
}
.message-action-dialog p { overflow-wrap: anywhere; white-space: pre-wrap; }
.message-action-dialog p:empty { display: none; }

.room-directory {
  box-sizing: border-box; width: min(64rem,calc(100% - 1.2rem)); max-height: min(92dvh,56rem); padding: 0;
  border: 1px solid var(--room-line); border-radius: 14px; background: var(--room-surface); color: var(--room-ink);
}
.room-directory::backdrop { background: rgb(4 5 12 / .72); }
.room-directory header, .room-key > div { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.room-directory header { position: sticky; top: 0; z-index: 1; background: var(--room-surface); padding: .5rem 1rem; border-bottom: 1px solid var(--room-line); }
.room-directory h2, .room-directory h3 { margin: 0; }
.room-directory header button { min-width: 44px; min-height: 44px; font-size: 1.4rem; border: 0; background: transparent; color: inherit; }
.room-browser, .room-key { padding: 1rem; }
.room-browser-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.room-browser-toolbar input { flex: 0 1 18rem; min-width: 0; max-width: 100%; }
.room-browser-toolbar p { margin: 0; color: var(--room-soft); font-size: .875rem; }
.room-browser ul { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,270px),1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.room-browser li { container-type: inline-size; min-width: 0; }
.room-choice {
  --room-icon-size: clamp(42px,20cqi,56px);
  display: grid; align-content: start; justify-items: start; width: 100%; height: 100%; padding: 0 0 1rem;
  text-align: start; overflow: hidden; overflow-wrap: anywhere; border: 1px solid var(--room-line); border-radius: 12px;
  background: var(--room-panel); color: var(--room-ink); cursor: pointer;
}
.room-choice::before { content: ""; grid-area: 1 / 1; width: 100%; height: clamp(92px,52cqi,150px); background: radial-gradient(ellipse at 0 0,#7554ad,transparent 70%),linear-gradient(125deg,#322644,#18131f); }
.room-choice::after { content: ""; box-sizing: border-box; grid-area: 1 / 1; align-self: end; margin-inline-start: 1rem; transform: translateY(50%); width: var(--room-icon-size); height: var(--room-icon-size); border-radius: 12px; border: 4px solid var(--room-panel); background: var(--room-panel); }
[data-cdn-theme] .room-choice::after { background: var(--room-panel) url("public/room/default_room.png") center / cover; }
.room-choice strong { margin: calc(var(--room-icon-size) / 2 + .5rem) 1rem .25rem; font-size: 1.125rem; line-height: 1.35; }
.room-choice:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 650px) {
  .room-directory { width: 100%; height: 100dvh; max-width: 100%; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; padding-block: env(safe-area-inset-top) env(safe-area-inset-bottom); }
}
.room-choice small { margin-inline: 1rem; color: var(--room-soft); }
.room-choice[aria-current=true] { border-color: var(--accent); }
[data-cdn-theme] .room-lock::before { content: ""; display: inline-block; width: 1em; height: 1em; margin-inline-end: .3em; vertical-align: -.12em; background: url("public/room/locked_room.svg") center / contain no-repeat; }
.room-key:not([hidden]) { display: grid; gap: .85rem; }

#people-list .person-entry { flex: 1; min-width: 0; }
#people-list .person-mark { flex: none; }
#people-list .roster-message { width: 44px; height: 44px; flex: none; background: transparent; color: var(--room-soft); }
.person-card {
  width: min(22rem,calc(100% - 1.25rem)); max-height: 90dvh; padding: 0; overflow: auto;
  color: var(--room-ink); background: var(--room-panel); border: 1px solid var(--room-line); border-radius: 14px;
}
.person-card::backdrop { background: rgb(4 5 12 / .65); }
.person-cover { display: flex; justify-content: end; align-items: start; min-height: 5.5rem; padding: .3rem; background: linear-gradient(125deg,#343a59,#272637 70%); }
.person-cover button { width: 44px; height: 44px; padding: 0; background: transparent; color: white; border: 0; font-size: 1.5rem; }
.person-cover { position: relative; isolation: isolate; }
.person-cover [data-card-cover] { position: absolute; inset: 0; z-index: -1; }
.person-cover [data-card-cover]:not([hidden]) + button { background: rgb(0 0 0 / .65); }
.person-cover img, .person-identity .person-mark img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.person-about h3 { margin: .75rem 0 .25rem; font-size: .9rem; }
.person-about p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-metrics > :not([hidden]):not(:empty) { margin-block: .55rem; }
.profile-metrics > div { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.profile-metrics button[aria-pressed="true"] { color: var(--room-ink); border-color: currentColor; font-weight: 700; }
.profile-metrics summary { cursor: pointer; }
.profile-metrics progress { width: 100%; }
.profile-metrics dl { display: grid; grid-template-columns: 1fr auto; gap: .25rem .6rem; }
.profile-metrics dd { margin: 0; }
#own-profile-panel > .profile-metrics { padding-inline: .75rem; }
.profile-gifts details { margin-block: .65rem; }
.profile-gifts summary { cursor: pointer; }
.profile-gifts ul { list-style: none; padding-inline-start: 0; display: grid; gap: .4rem; }
.profile-gifts li { display: flex; align-items: center; gap: .5rem; overflow-wrap: anywhere; }
.profile-gifts form, .profile-gifts label { display: grid; gap: .4rem; }
.profile-gifts select { min-inline-size: 0; max-inline-size: 100%; }
.profile-gifts p { overflow-wrap: anywhere; }
.person-identity { padding-inline: 1.25rem; }
.person-identity .person-mark { width: 64px; height: 64px; border: 4px solid var(--room-panel); margin-top: -2rem; position: relative; }
.person-identity h2 { margin: .4rem 0 .15rem; font-size: 1.25rem; overflow-wrap: anywhere; }
.person-role, .person-room { margin: .2rem 0; color: var(--room-soft); font-size: .875rem; overflow-wrap: anywhere; }
.person-room::before { content: "# "; }
.person-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .85rem 1.25rem 1.25rem; }
.person-actions button { flex: 1; min-height: 44px; }

.room-rail { overflow-y: auto; }
.room-rail > * { flex-shrink: 0; }
.room-rail .own-profile-trigger { margin-block-start: auto; }
#room-drawer[data-panel="own-profile-panel"] { width: min(22rem,calc(100% - 1rem)); }
@media (min-width:801px) {
  #room-drawer[data-panel="own-profile-panel"] { position: fixed; inset: auto auto 1rem clamp(50px,5vw,76px); margin: 0; }
}
.own-profile-identity { display: flex; align-items: end; gap: .75rem; min-height: 5.5rem; padding: 1rem; background: linear-gradient(135deg,var(--room-panel),var(--room-deep)); }
.own-profile-identity .person-mark { flex: none; width: 48px; height: 48px; border-radius: .8rem; }
.own-profile-name { align-self: center; overflow-wrap: anywhere; }
.own-profile-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .45rem; padding: .75rem; }
.own-profile-about { padding: .75rem; }
.own-profile-about label { display: grid; gap: .35rem; }
.own-profile-about textarea { max-inline-size: 100%; resize: vertical; }
.own-profile-about button { margin-inline-end: .35rem; }
.own-profile-actions button { min-height: 44px; background: var(--room-panel); color: var(--room-ink); }
.own-profile-actions button:last-child { grid-column: 1 / -1; }
#own-profile-panel [role="status"] { margin: 0; }
#own-profile-panel [role="status"]:not(:empty) { padding: 0 .85rem .85rem; }
#profile-images { padding-block: .25rem; }
#profile-images summary { cursor: pointer; font-weight: 650; }
.profile-comparison { margin: .75rem 0; }
.profile-comparison img { display: block; max-width: 100%; max-height: 14rem; object-fit: contain; border-radius: .5rem; }
.profile-comparison figcaption { color: var(--room-soft); font-size: .875rem; }
.profile-image-stage { position: relative; isolation: isolate; margin-top: .7rem; padding-bottom: 1.85rem; }
.profile-image-stage [data-image-control] { overflow: hidden; background: var(--room-panel); }
.profile-image-stage [data-image-control="cover"] { position: relative; height: clamp(6.5rem,19dvh,10rem); border-radius: 12px; background: linear-gradient(120deg,#44465f,#202033); }
.profile-image-stage [data-image-control="avatar"] { position: absolute; bottom: 0; left: .75rem; width: 5.25rem; height: 5.25rem; border-radius: 50%; border: 3px solid var(--room-surface); }
[data-cdn-theme] .profile-image-stage [data-image-control="avatar"] { background: var(--room-panel) url("public/avatars/default_avatar.png") center / cover; }
.profile-image-stage img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-image-stage button { position: absolute; color: white; background: #181821df; border: 1px solid #ffffff4a; min-height: 44px; }
.profile-image-stage [data-image-control="cover"] button { right: .5rem; top: .5rem; }
.profile-image-stage [data-image-control="avatar"] button { inset: 0; width: 100%; border: 0; border-radius: inherit; padding: 2.3rem 0 0; font-size: .76rem; background: linear-gradient(transparent 24%,#15151de8); }
.profile-image-stage button:focus-visible { outline-offset: -3px; }
.profile-image-picker [role="status"]:not(:empty) { padding-top: .5rem; overflow-wrap: anywhere; }
#profile-images > p, .profile-image-picker [role="status"] { color: var(--room-soft); font-size: .85rem; }
.avatar-crop { width: min(27rem,94vw); max-height: 92dvh; overflow: auto; padding: 1rem;
  border: 1px solid var(--room-line); border-radius: 14px; color: var(--room-ink); background: var(--room-panel); }
.avatar-crop::backdrop { background: rgb(0 0 0 / .7); }
.avatar-crop h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.avatar-crop canvas { display: block; width: min(100%,52dvh); height: auto; margin: auto; touch-action: none; cursor: move; }
.avatar-crop label, .avatar-crop > div { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.avatar-crop input[type="range"] { flex: 1; min-width: 6rem; }
.avatar-crop button { min-height: 44px; }
.avatar-crop p:empty { display: none; }
.profile-image-controls form { display: grid; grid-template-columns: minmax(0,1fr); gap: .55rem; padding-block: .45rem; }
.profile-image-controls input, .profile-image-controls select { min-width: 0; max-width: 100%; }
.profile-image-controls form + form { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }

#room-drawer[data-panel="room-settings"] { width: min(860px,calc(100% - 1.2rem)); }
#room-settings:has(.settings-tabs) { padding: 0; }
.settings-tabs { display: grid; grid-template-columns: 185px minmax(0,1fr); height: min(640px,calc(100dvh - 100px)); }
.settings-menu { display: flex; flex-direction: column; gap: .2rem; overflow: auto; padding: .65rem; background: var(--room-deep); border-inline-end: 1px solid var(--room-line); }
.settings-menu button { flex: none; min-height: 44px; text-align: start; padding: .5rem .75rem; border: 0; color: var(--room-soft); background: transparent; }
.settings-menu button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.settings-menu button[aria-selected="true"] { color: var(--room-ink); background: var(--room-panel); font-weight: 650; }
.settings-section-heading { margin: 0 0 .5rem; font-size: 1.375rem; line-height: 1.3; }
.settings-pane { min-width: 0; min-height: 0; overflow: auto; overflow-wrap: anywhere; padding: 1.875rem 1.625rem; overscroll-behavior: contain; }
.settings-pane[hidden] { display: none; }
.settings-pane:not([hidden]) { display: grid; align-content: start; gap: .75rem; }
.chat-sound-option { display: flex; align-items: center; gap: .7rem; min-height: 44px; cursor: pointer; }
.chat-sound-option input[type="checkbox"] { width: 1.25rem; height: 1.25rem; min-height: 0; padding: 0; accent-color: var(--accent); }
.settings-pane details > summary { cursor: pointer; padding-block: .35rem; }
.settings-pane form:not(#private-compose) { max-width: 100%; }
#room-settings:has(.settings-tabs) > * { margin: 0; }
@media(max-width:650px) {
  .settings-tabs { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .settings-menu { min-width: 0; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: .35rem .5rem; border-inline-end: 0; border-block-end: 1px solid var(--room-line); }
  .settings-menu button { white-space: nowrap; }
  .settings-section-heading { font-size: 1.25rem; }
  .settings-pane { padding: 1.375rem 1.125rem; }
}

#room-drawer:is([data-panel="notification-panel"],[data-panel="reports-panel"]) #drawer-content { min-height: 0; overflow-y: auto; }
:is(#notification-panel,#reports-panel) { padding: .65rem .8rem; }
.notice-actions { display: flex; justify-content: end; }
.notice-actions button { background: transparent; color: var(--room-soft); min-height: 40px; }
#notification-panel ul { list-style: none; margin: 0; padding: 0; }
#notification-panel li { display: flex; gap: .8rem; align-items: center; min-height: 54px; border-bottom: 1px solid var(--room-line); padding: .35rem; overflow-wrap: anywhere; }
#notification-panel li p { margin: .2rem 0 0; color: var(--room-soft); }
:is(#notification-panel,#reports-panel) .person-mark { flex: none; position: relative; width: 38px; height: 38px; }
[data-notice-icon]::after { content: ""; position: absolute; inset: auto -3px -2px auto; width: 17px; height: 17px; background: var(--room-panel) var(--notice-image) center / contain no-repeat; border-radius: 50%; }
.notice-unread { flex: none; width: 8px; height: 8px; margin-inline-start: auto; border-radius: 50%; background: var(--accent); }
.notice-empty { text-align: center; color: var(--room-soft); padding: 1rem; }
.notice-empty::before { content: ""; display: block; height: 48px; margin-bottom: .7rem; background: url("public/notices/nodata.svg") center / contain no-repeat; }
[data-notice-icon="mail"] { --notice-image: url("public/notices/mail.svg"); }
[data-notice-icon="friend"] { --notice-image: url("public/notices/friend.svg"); }
[data-notice-icon="reply"] { --notice-image: url("public/notices/reply.svg"); }
[data-notice-icon="flag"] { --notice-image: url("public/notices/flag.svg"); }
[data-notice-icon="gold"] { --notice-image: url("public/notices/gold.svg"); }
[data-notice-icon="ruby"] { --notice-image: url("public/notices/ruby.svg"); }

.report-flag { display: inline-block; width: 20px; height: 20px; background: url("public/notices/flag.svg") center / contain no-repeat; }
.reports-content ul { list-style: none; padding: 0; margin: 0; }
.report-row { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .65rem .35rem; text-align: start; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--room-line); border-radius: 0; }
.report-row > span:nth-child(2) { display: grid; flex: 1; }
.report-row small { color: var(--room-soft); }
.reports-content { overflow-wrap: anywhere; }
.report-evidence { padding: .6rem; border: 1px solid var(--room-line); border-radius: .5rem; white-space: pre-wrap; }
.report-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: .65rem; }

.file-report { display: grid; gap: .55rem; }
.file-report h3, .file-report p { margin: 0; }
.file-report label { display: grid; gap: .25rem; }

.person-card .file-report, .person-feedback:not(:empty) { margin: .75rem 1.25rem 1.25rem; }
.person-feedback:empty { display: none; }
.person-card .file-report button { min-height: 44px; }

.wall-menu-icon { width: 1.25rem; height: 1.25rem; background: url("public/notices/reply.svg") center / contain no-repeat; }
#room-drawer[data-panel="wall-panel"] { width: min(42rem,96vw); max-height: 92dvh; }
#wall-panel { padding: .9rem; }
.wall-compose, .wall-posts article { background: var(--room-panel); border: 1px solid var(--room-line); border-radius: 12px; padding: .85rem; }
.wall-compose textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.wall-options, .wall-tools, .wall-posts header, .wall-posts footer, .wall-posts form { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.wall-options { margin-top: .55rem; }
.wall-options > span, .wall-tools > span, .wall-posts time { margin-inline-start: auto; }
.wall-toggle { display: inline-flex; align-items: center; gap: .3rem; }
.wall-toggle input { width: auto; }
.wall-posts { display: grid; gap: .65rem; }
#room-drawer .wall-posts header { position: static; padding: 0; background: transparent; }
.wall-posts article > p { white-space: pre-wrap; overflow-wrap: anywhere; }
.wall-posts time, .wall-posts footer { color: var(--room-soft); font-size: .85rem; }
.wall-posts header small { color: var(--room-soft); }
.wall-card-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.wall-card-actions button, .wall-card-settings button { min-height: 44px; }
.wall-card-settings { margin-block-start: .5rem; padding-block-start: .5rem; border-top: 1px solid var(--room-line); }
.wall-card-settings > button { margin-block-start: .5rem; }
.wall-comments .comment-remove { align-self: start; margin-inline-start: auto; }
.wall-posts form, .wall-more { margin-top: .5rem; }
.wall-posts .file-report { display: grid; align-items: stretch; }
.wall-posts .file-report button { min-height: 44px; }
.wall-posts .wall-report-status:empty { margin: 0; }
@media (max-width: 650px) {
  #room-drawer[data-panel="wall-panel"] { inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
}

.wall-comments { min-width: 0; margin-block-start: .75rem; padding-block-start: .75rem; border-top: 1px solid var(--room-line); color: var(--room-ink); }
.wall-comments > header, .comment-tools { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.wall-comments h3 { margin: 0; }
.wall-comments button, .wall-comments-trigger { min-height: 44px; }
.wall-comments header button { min-width: 44px; font-size: 1.25rem; }
.wall-comments form { display: grid; gap: .4rem; margin-bottom: .65rem; }
.wall-comments textarea { width: 100%; box-sizing: border-box; }
.social-gallery img, .social-gallery video { display: block; max-width: 100%; max-height: 60dvh; object-fit: contain; }
.wall-comments blockquote { margin: .35rem 0; padding-inline-start: .6rem; border-inline-start: 2px solid var(--room-line); }
.wall-comments ol { list-style: none; padding: 0; }
.wall-comments li { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid var(--room-line); }
.wall-comments li .person-mark { flex: none; }
.wall-comments li div { min-width: 0; overflow-wrap: anywhere; }
.wall-comments li time { margin-inline-start: .6rem; font-size: .8rem; color: var(--room-soft); }
.wall-comments li p { margin: .2rem 0; white-space: pre-wrap; }

#room-drawer:is([data-panel="store-panel"],[data-panel="appearance-panel"]) { width: min(42rem,96vw); max-height: 92dvh; }
.wallet-balances { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.wallet-balances > div { display: grid; gap: .5rem; padding: .8rem; border: 1px solid var(--room-line); border-radius: .75rem; background: var(--room-panel); overflow-wrap: anywhere; }
.wallet-balances strong { font-variant-numeric: tabular-nums; }
.wallet-tools, #wallet-panel form > button { margin-block-start: .7rem; }
#wallet-panel fieldset, #wallet-panel label { display: grid; gap: .5rem; min-inline-size: 0; }
#wallet-panel fieldset { border: 1px solid var(--room-line); padding: .8rem; border-radius: .75rem; }
#wallet-panel input, #wallet-panel select { width: 100%; min-width: 0; }
#wallet-panel, #store-panel, #appearance-panel { padding: .9rem; }
.store-toolbar, .collection-active, #appearance-panel footer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
#appearance-panel label { display: grid; gap: .3rem; }
.collection-active { margin-block: .7rem; overflow-wrap: anywhere; }
.collection-active button { margin-inline-start: auto; }
.store-icon, .store-price::before { display: inline-block; width: 1.2rem; height: 1.2rem; background: url("public/notices/gold.svg") center / contain no-repeat; }
.store-price.ruby::before { background-image: url("public/notices/ruby.svg"); }
.store-products { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(12rem,100%),1fr)); gap: .65rem; list-style: none; padding: 0; }
.store-products li, .store-checkout { display: grid; align-content: start; gap: .65rem; padding: .85rem; border: 1px solid var(--room-line); border-radius: .75rem; background: var(--room-panel); overflow-wrap: anywhere; }
.store-price { display: inline-flex; align-items: center; gap: .35rem; }
.store-price::before { content: ""; }
.store-checkout h3, .store-checkout p { margin: 0; }
.store-checkout button { margin: .2rem; }
@media (max-width:800px) {
  #room-drawer:is([data-panel="store-panel"],[data-panel="appearance-panel"]) { inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
}

.compose-dock, #composer, #private-compose { position: relative; }
.room-mentions { position: absolute; z-index: 3; inset-inline: .65rem; bottom: 100%; margin: 0; padding: .25rem; max-height: min(15rem,32dvh); overflow-y: auto; overscroll-behavior: contain; list-style: none; background: var(--room-panel); color: var(--room-ink); border: 1px solid var(--room-line); border-radius: .65rem; }
.room-mentions [role="option"] { padding: .55rem .75rem; cursor: pointer; overflow-wrap: anywhere; }
.room-mentions [aria-selected="true"] { background: var(--room-deep); box-shadow: inset 3px 0 var(--accent); }

#messages > [data-quote-target]:focus, #private-thread ol > [data-quote-target]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: .5rem;
}

.room-archive { width: min(34rem,calc(100% - 1.25rem)); max-height: 86dvh; padding: .85rem; box-sizing: border-box; border: 1px solid var(--room-line); border-radius: 14px; color: var(--room-ink); background: var(--room-panel); }
.room-archive::backdrop { background: rgb(4 5 12 / .65); }
.room-archive header, .room-archive nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.room-archive h2 { margin: 0; font-size: 1.1rem; }
.room-archive button { min-height: 44px; }
.room-archive header button { min-width: 44px; }
.room-archive ol { max-height: 50dvh; overflow: auto; overscroll-behavior: contain; list-style: none; margin: .6rem 0; padding: 0; }
.room-archive li { display: grid; gap: .2rem; padding: .5rem; border-top: 1px solid var(--room-line); overflow-wrap: anywhere; }
.room-archive li .message-bubble { justify-self: start; min-width: 0; }
.room-archive strong, .room-archive [role=status] { color: var(--room-soft); font-size: .85rem; }

:is(#composer, #private-compose).drop-ready {
  outline: 2px dashed var(--focus);
  outline-offset: -2px;
  background-color: var(--room-panel);
}

[data-cdn-theme] .rank-badge { display: inline-block; width: 1.25em; height: 1.25em; margin-inline-end: .3em; vertical-align: middle; background: center / contain no-repeat; }
[data-cdn-theme] [data-rank-icon="admin"] { background-image: url("./public/ranks/admin.svg"); }
[data-cdn-theme] [data-rank-icon="bot"] { background-image: url("./public/ranks/bot.svg"); }
[data-cdn-theme] [data-rank-icon="guest"] { background-image: url("./public/ranks/guest.svg"); }
[data-cdn-theme] [data-rank-icon="mod"] { background-image: url("./public/ranks/mod.svg"); }
[data-cdn-theme] [data-rank-icon="owner"] { background-image: url("./public/ranks/owner.svg"); }
[data-cdn-theme] [data-rank-icon="room_admin"] { background-image: url("./public/ranks/room_admin.svg"); }
[data-cdn-theme] [data-rank-icon="room_mod"] { background-image: url("./public/ranks/room_mod.svg"); }
[data-cdn-theme] [data-rank-icon="room_owner"] { background-image: url("./public/ranks/room_owner.svg"); }
[data-cdn-theme] [data-rank-icon="super"] { background-image: url("./public/ranks/super.svg"); }
[data-cdn-theme] [data-rank-icon="user"] { background-image: url("./public/ranks/user.svg"); }
[data-cdn-theme] [data-rank-icon="vip"] { background-image: url("./public/ranks/vip.svg"); }

.room-marks {
  box-sizing: border-box; inline-size: min(380px, calc(100vw - 20px));
  max-block-size: min(480px, calc(100dvh - 20px)); overflow: auto; overscroll-behavior: contain;
  padding: 16px; border: 1px solid var(--room-line); border-radius: 10px;
  background: var(--room-panel); color: var(--room-ink);
}
.room-marks::backdrop { background: rgb(4 5 12 / .6); }
.room-marks > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-marks h2 { margin: 0; font-size: 16px; }
.room-marks ul { display: grid; gap: 6px; list-style: none; padding: 0; }
.room-marks li { padding: 9px; border-radius: 6px; background: var(--room-surface); overflow-wrap: anywhere; }
.room-marks li p { margin: 4px 0; white-space: pre-wrap; }
.room-marks li div { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.room-marks button { min-block-size: 36px; }
@media (pointer: coarse) { .room-marks button { min-block-size: 44px; } }

.room-unread-banner {
  display: flex; align-items: center; justify-content: space-between; flex: none; gap: 8px;
  padding: 4px 16px; background: #a2363d; color: #fff; font-size: 12px; font-weight: 700;
}
.room-unread-banner button { min-block-size: 36px; color: inherit; background: transparent; border-color: currentColor; }
@media (pointer: coarse) { .room-unread-banner button { min-block-size: 44px; } }
#messages > li > .room-unread-divider {
  display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; grid-row: 1;
  justify-self: stretch; color: var(--room-ink); font-size: 12px; font-weight: 700; line-height: 16px;
}
.room-unread-divider::after { content: ""; flex: 1; border-block-start: 1px solid #ed4245; }
#messages > li[data-day-start] > .room-unread-divider { grid-row: 2; }
#messages > li[data-unread-start]:not([data-day-start]) > .room-author-card { grid-row: 2 / span 2; }
#messages > li[data-unread-start][data-day-start] > .room-author-card { grid-row: 3 / span 2; }
