/* Theme-dependent surfaces and stable intrinsic sizing. */
.workspace-menu{flex:1 1 auto;min-height:0;overflow:auto}
.workspace-menu #wsSettings{margin-top:auto;flex-shrink:0;order:999}
.reference-person .av,.reference-person .avw,.reference-file .av,.reference-own .av,.reference-own .avw{flex:0 0 auto}
.reference-person>.av,.reference-person>.avw{min-width:40px;max-width:60px}
.reference-person>span:not(.av):not(.avw),.reference-own>div{min-width:0;flex:1}
.reference-own b,.reference-own small,.reference-person b,.reference-person small{overflow-wrap:anywhere}
.reference-card p,.reference-card small,.reference-directory>p{color:var(--tx2)}
#musicPlayer{grid-template-columns:44px minmax(0,1fr) repeat(3,24px);align-items:center}
#musicMeta{overflow:hidden}#musicTitle,#musicArtist{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reference-own .av{border-radius:50%;overflow:hidden}.reference-own .av img{width:100%;height:100%;object-fit:cover}
html[data-theme=day] .composer-menu422{background:var(--pan)!important;color:var(--tx)!important;border-color:var(--line)}
html[data-theme=day] .composer-menu422 button:hover{background:var(--hov)}
html[data-theme=day] .composer-menu422 small{color:var(--tx2)}
html[data-theme=day] .composer-menu422 hr{border-color:var(--line)}
html[data-theme=day] .browser-home411,html[data-theme=day] .embedded-browser-surface,html[data-theme=day] .embedded-browser-page{background:var(--pan);color:var(--tx)}
.browser-home411{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;min-height:100%;padding:32px;text-align:center;background:var(--pan);color:var(--tx)}
.browser-home411>img{width:72px;height:72px;object-fit:contain}.browser-home411 h2{font-size:28px}
.tx .composer-spoiler422:not(.revealed){color:transparent!important;text-shadow:none!important;user-select:none}
.tx .composer-spoiler422:not(.revealed) *{color:transparent!important;visibility:hidden!important}
#richComposer{flex:1;min-width:0;min-height:38px;max-height:140px;overflow:auto;padding:10px 6px;white-space:pre-wrap;overflow-wrap:anywhere;outline:none;user-select:text;caret-color:var(--acc);line-height:1.35}
#richComposer:empty:before{content:attr(data-placeholder);color:var(--tx2);pointer-events:none}
#richComposer .composer-spoiler422{color:transparent!important;background:var(--tx2);border-radius:4px}
#richComposer .composer-spoiler422 *{visibility:hidden}
#richComposer a{color:var(--acc);text-decoration:underline}
.peer-key-notice{display:block;width:100%;flex:none;white-space:normal;text-align:left;padding:12px 16px;background:var(--pan);color:var(--tx);border:1px solid var(--line);border-radius:0}
/* Creation forms share the same viewport and theme rules on every client. */
.reference-wizard-layout,.reference-wizard-main,.reference-wizard .reference-form-card,.reference-wizard .reference-preview{min-width:0;box-sizing:border-box}
.reference-wizard input:not([type=radio]):not([type=file]),.reference-wizard textarea{min-width:0;max-width:100%;box-sizing:border-box}
.reference-wizard .reference-form-fields .channel-photo{flex:none;border-radius:50%;overflow:hidden;background:var(--in);color:var(--acc)}
.reference-wizard .reference-preview-identity{align-items:flex-start;margin-top:0}
.reference-wizard .reference-preview-identity>.av{flex:none;margin-top:-28px;position:relative;z-index:1;border-radius:50%;overflow:hidden}
.reference-wizard .reference-preview-identity>div:not(.av){flex:1;min-width:0;padding-top:12px}
.reference-wizard .reference-preview-identity b{display:block;line-height:1.3;color:var(--tx)}
.reference-wizard .reference-preview-actions{grid-template-columns:repeat(4,minmax(0,1fr))}
.reference-wizard .reference-preview-actions>span{min-width:0;background:var(--in);color:var(--tx2);overflow-wrap:normal;word-break:normal;hyphens:auto;font-size:9px;padding:13px 2px}
.reference-wizard .reference-preview-actions>span>span{color:var(--acc)}
.reference-wizard .reference-preview-description{background:var(--in);color:var(--tx2)}
.reference-wizard .reference-types .channel-type{background:var(--in);color:var(--tx)}
.reference-wizard .reference-types .channel-type small{color:var(--tx2)}
.reference-wizard .channel-username{background:var(--in);color:var(--tx);border-color:var(--line)}
.reference-wizard .channel-username input{background:transparent;color:var(--tx)}
.reference-wizard .reference-preview-link{color:var(--acc)}
.reference-wizard .reference-form-fields label,.reference-wizard .reference-wizard-main header small,.reference-wizard .reference-form-card>p,.reference-wizard .reference-preview>p,.reference-wizard .reference-preview-identity small{color:var(--tx2)}
@media(max-width:850px){
 .ov:has(>.reference-wizard){position:fixed!important;inset:0!important;inset-inline:0!important;width:100%!important;height:100dvh!important;padding:0!important;z-index:100;align-items:stretch!important;justify-content:stretch!important;background:var(--pan)}
 .md.reference-wizard{width:100%!important;max-width:100vw!important;min-width:0!important;height:100%!important;max-height:100dvh!important;box-sizing:border-box!important;border-radius:0!important;margin:0!important;padding:0!important;overflow:hidden!important}
 .reference-wizard-layout{grid-template-columns:minmax(0,1fr)!important;width:100%;height:100%;min-height:0;gap:20px;padding:max(16px,env(safe-area-inset-top)) 14px max(24px,env(safe-area-inset-bottom));overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;align-content:start}
 .reference-wizard-main{width:100%}
 .reference-wizard-main>header{align-items:flex-start;gap:10px}
 .reference-wizard-main>header>.ib{flex:none}
 .reference-wizard-main>header>div{min-width:0;flex:1}
 .reference-wizard-main h2{font-size:22px;line-height:1.3;overflow-wrap:anywhere}
 .reference-wizard-main header small{line-height:1.5}
 .reference-wizard .reference-form-fields{grid-template-columns:minmax(0,1fr);gap:16px}
 .reference-wizard .reference-form-card{padding:16px}
 .reference-wizard .reference-avatar-pick{flex-wrap:wrap;justify-content:flex-start;gap:12px}
 .reference-wizard .reference-avatar-pick>label{flex-basis:100%;margin:0}
 .reference-wizard .reference-avatar-pick .channel-photo{margin:0;width:80px;height:80px}
 .reference-wizard .reference-avatar-pick .sec{width:auto;max-width:100%;white-space:normal}
 .reference-wizard .reference-steps{gap:12px;flex-wrap:wrap}
 .reference-wizard .reference-steps span{gap:7px}
 .reference-wizard .reference-types{grid-template-columns:minmax(0,1fr)}
 .reference-wizard .channel-type>div{min-width:0}
 .reference-wizard .channel-username{min-width:0;max-width:100%;box-sizing:border-box}
 .reference-wizard .channel-username input{width:0;flex:1}
 .reference-wizard .reference-form-footer{flex-wrap:wrap;gap:10px}
 .reference-wizard .reference-form-footer button{flex:1 1 0;min-width:0;white-space:normal;min-height:44px}
 .reference-wizard .reference-preview{position:static;width:100%;max-width:100%;padding:16px}
 body:has(.reference-wizard) #bottomDock{display:none!important}
}

/* Keep selection confined to the content, never the full chat row. */
#msgs .message-selected{background:transparent!important;outline:none!important;box-shadow:none!important;border-color:transparent!important}
#msgs .message-selected .bub,#msgs .message-selected .bubble,#msgs .message-selected.bub{outline:2px solid var(--acc);outline-offset:2px;background:color-mix(in srgb,var(--acc) 13%,var(--pan))!important}
#msgs .message-selected .sticker-message417{outline:2px solid var(--acc);outline-offset:2px;background:transparent!important}
#msgs .message-selected .sticker-message417 img{filter:none}
#selectionToolbar{position:relative!important;inset:auto!important;order:-1;flex:none!important;width:100%;max-width:100%!important;box-sizing:border-box;gap:6px!important;border-radius:0!important;box-shadow:none!important;padding:8px 12px!important;flex-wrap:nowrap!important;overflow-x:auto;background:var(--pan)!important}
#selectionToolbar b{font-size:11px}#selectionToolbar .sec{font-size:11px;white-space:nowrap;padding:6px 9px!important}#selectionToolbar>.ib{margin-left:auto;flex:none}
.story-view421 header>.av{display:flex!important;flex:none!important;width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;aspect-ratio:1;border-radius:50%;overflow:hidden}
.story-view421 header>.av :is(img,video){width:100%;height:100%;object-fit:cover}
.story-view421 header>div:not(.av){min-width:0;flex:1}.story-view421 header b{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.r1{justify-content:flex-start!important;gap:5px!important}.r1>b{flex:0 1 auto!important;min-width:0}.r1>time{margin-left:auto}.r1>.chat-verified{margin:0!important;flex:none}
#head .hi>.chat-verified{display:inline-flex;margin-left:5px;vertical-align:middle}#head .hi>b{display:inline}
.premium-tabs button{flex:0 0 auto!important;min-width:max-content;padding:9px 12px!important}.premium-tabs{overflow-x:auto;max-width:100%}.premium-window .premium-hero{padding:12px!important}.premium-hero h2{margin:3px 0 7px!important;font-size:23px}.premium-hero p{margin:0;line-height:1.4}
.settings-window,.settings-layout,.settings-columns,.settings-content,.settings-aside{box-sizing:border-box;min-width:0;min-height:0}.settings-window{overflow:hidden!important}.settings-columns{overflow-x:hidden!important;overflow-y:auto!important;scrollbar-gutter:auto!important;overscroll-behavior:contain}.settings-layout{width:100%!important;height:100%!important}.settings-content>*{max-width:100%;box-sizing:border-box}.settings-window *{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--tx2) 25%,transparent) transparent}
.language-options{min-height:0;overflow-y:auto;overscroll-behavior:contain;max-height:55dvh}
.discussion-head417{padding-block:8px!important;min-height:0!important}.discussion-head417 .hi{gap:3px!important}.discussion-head417 .discussion-tabs{margin-top:3px;gap:4px}.discussion-head417 small{line-height:1.25}
@media(max-width:850px){.ov:has(>.settings-window){padding:0!important;inset:0!important}.md.settings-window{width:100%!important;height:100dvh!important;max-width:100%!important;max-height:100dvh!important;margin:0!important;border-radius:0!important}.settings-layout{flex-direction:column}.settings-nav{width:100%!important;box-sizing:border-box;flex:none;padding:12px!important;max-height:190px;overflow-y:auto}.settings-menu{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}.settings-nav>.settings-search,.settings-nav>h2,.settings-logout{display:none!important}.settings-menu button{min-width:0;padding:8px!important;font-size:11px}.settings-columns{display:flex!important;flex-direction:column!important;flex:1 1 0!important;width:100%;padding:12px!important;gap:12px}.settings-content,.settings-aside{flex:none;width:100%}.settings-close{right:10px;top:10px}.settings-menu{padding-right:32px}}

.folder-manager{padding:18px;gap:12px!important;width:min(470px,100%);box-sizing:border-box}.folder-manager-row{display:flex;gap:10px;align-items:center;padding:9px 12px;border-radius:14px;background:var(--in);min-width:0}.folder-manager-edit{display:flex;align-items:center;gap:10px;min-width:0;flex:1;color:var(--tx);background:transparent;border:0;text-align:left;padding:5px}.folder-manager-edit b{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.folder-manager-row>.ib{flex:none;width:36px;height:36px}
.story-image-layer{padding:0!important;background:transparent!important;border-radius:0!important}.story-image-layer img{width:100%;height:auto;display:block;max-height:none;pointer-events:none}.story-editor-toolbar{flex-wrap:wrap}.story-editor-layer{touch-action:none}

.story-editor-music{display:grid;gap:8px;padding:12px;background:var(--in);border-radius:14px;min-width:0}.story-editor-music audio{width:100%;max-width:100%;height:36px}.story-editor-music label{display:flex;gap:8px;align-items:center}.story-editor-music input{width:90px!important}

.music-controls420{justify-content:flex-start!important;gap:2px!important;flex-wrap:wrap}.music-controls420>button{flex:0 0 23px}.music-controls420 .on,.mobile-music418 .on{color:var(--acc);background:var(--hov);border-radius:7px}#musicPlayer{min-width:0;max-width:100%;box-sizing:border-box}#musicExtra{display:flex!important;align-items:center;gap:6px;min-width:0}#musicVolume{width:0;min-width:0;flex:1}#musicSeek{width:100%;min-width:0;box-sizing:border-box}.mobile-music418{display:none}
@media(max-width:850px){.mobile-music418{display:flex;flex:none;position:relative;align-self:flex-end;align-items:center;gap:3px;width:min(220px,calc(100% - 26px));min-width:0;margin:2px 13px 5px;padding:5px 7px;border-radius:22px;background:#f5f7fc;color:#19253c;border:1px solid #26385518;box-sizing:border-box}.mobile-music-title418{flex:1;min-width:0;text-align:left;background:none;color:inherit;padding:2px 4px}.mobile-music-title418 b{display:block;font-size:11px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0}.mobile-music418>.ib{flex:none;width:27px;height:27px;color:inherit}.mobile-music-expanded418{display:none}.mobile-music418.expanded{flex-wrap:wrap;border-radius:18px}.expanded>.mobile-music-expanded418{display:grid;width:100%;gap:5px;padding-top:5px}.mobile-music-expanded418>input{width:100%;min-width:0}.mobile-music-expanded418>div{display:flex;gap:5px;align-items:center}.mobile-music-expanded418 input{min-width:0;flex:1;accent-color:#7064dd}.mobile-music-expanded418 .ib{width:26px;height:26px;flex:none;color:inherit}#app>#musicPlayer{display:none!important}}

@media(max-width:850px){.settings-nav{max-height:72px;overflow:hidden!important;padding:10px 45px 10px 12px!important}.settings-menu{display:flex!important;flex-direction:row!important;overflow-x:auto!important;overflow-y:hidden;gap:6px;padding:0!important}.settings-menu button{flex:0 0 auto;min-height:40px;white-space:nowrap;padding:8px 12px!important}.mobile-music418 .ib{color:#243650!important}.mobile-music418 .ib.on{color:#6754cb!important}.mobile-music418 .ib:disabled{opacity:.35}}

#head .hi>b{display:block!important}#head .hi:has(>.chat-verified){display:grid;grid-template-columns:minmax(0,max-content) max-content;gap:3px 5px;align-items:center}#head .hi:has(>.chat-verified)>b{grid-column:1;grid-row:1}#head .hi>.chat-verified{grid-column:2;grid-row:1;margin:0!important}#head .hi:has(>.chat-verified)>small,#head .hi:has(>.chat-verified)>.discussion-tabs{grid-column:1/-1}
#selectionToolbar{color:var(--tx)!important}#selectionToolbar b{color:var(--tx)!important}

/* r19: call surfaces and header controls have independent layout space. */
#main.reference-call-expanded #comp{display:none!important}
#head .hi{min-width:0;flex:1 1 auto!important;overflow:hidden}
#head .hi>b{white-space:normal!important;overflow-wrap:anywhere;line-height:1.2}
#head>.av,#head>.ib,#head>.join{flex:none}
#head>.join{width:auto;min-width:40px;max-width:58px;padding:8px;gap:4px;white-space:nowrap}
#head>[data-header-more]{order:100;margin-left:18px!important;flex:none}
.tx code{cursor:copy;white-space:pre-wrap}
.tx code>.tx{font:inherit}
.reference-call-controls{gap:6px!important;justify-content:space-around!important}
.reference-call-controls>button{min-width:0!important;flex:1!important;max-width:90px}
@media(max-width:600px){.reference-call-controls small{font-size:9px!important;overflow-wrap:anywhere}#head>[data-header-more]{margin-left:12px!important}}

.message-site-preview419{position:relative!important;inset:auto!important;margin-top:10px;max-width:100%;box-sizing:border-box;z-index:1}
.message-site-preview419 .mini-profile-body{padding:10px}
.story-view-canvas>img,.story-view-canvas>video{object-fit:cover}
.story-view-canvas.story-contain419>img,.story-view-canvas.story-contain419>video{object-fit:contain}
.story-reactions419{display:flex;justify-content:center;gap:6px;padding:8px;flex:none}.story-reactions419 button{padding:6px;background:#ffffff12;border-radius:12px;color:inherit}.story-reactions419 button.on{background:#7558db}
#musicPlayer{display:grid!important;grid-template-columns:38px minmax(0,1fr)!important;grid-template-rows:auto auto auto auto!important;height:auto!important;gap:8px!important;padding:12px!important}
#musicCover{grid-column:1!important;grid-row:1!important;width:38px!important;height:38px!important}
#musicMeta{grid-column:2!important;grid-row:1!important;min-width:0!important;width:100%;text-align:left;padding:0}
.music-controls420{grid-column:1/-1!important;grid-row:2!important;display:flex!important;flex-wrap:nowrap!important;justify-content:space-between!important;gap:4px!important}
.music-controls420>button{width:28px!important;height:28px!important;flex:0 0 28px!important}
#musicSeek{grid-column:1/-1!important;grid-row:3!important;margin:0!important}
#musicExtra{grid-column:1/-1!important;grid-row:4!important}

/* r21: music disc shares the metadata row; group forms retain readable labels. */
#musicPlayer>.music-record-disc{grid-column:1!important;grid-row:1!important;width:38px!important;height:38px!important;align-self:center!important;margin:0!important}
.social-auth button{flex-direction:row!important;width:100%;height:54px!important;gap:12px!important}
.premium-form>.setting-row:has(input){display:flex;flex-direction:column;align-items:stretch;gap:10px}.premium-form>.setting-row input{width:100%;box-sizing:border-box;min-width:0}
.md>.sec.red{margin:14px 12px!important;padding:12px 18px!important;border-radius:14px!important;color:#ff5b76!important;background:color-mix(in srgb,#ff385c 12%,var(--pan))!important;width:calc(100% - 24px)!important;box-sizing:border-box}

.premium-form>.settings-row:has(input){display:grid;grid-template-columns:22px minmax(0,1fr);gap:10px;height:auto;min-height:0}.premium-form>.settings-row>input{grid-column:1/-1;width:100%;box-sizing:border-box}.premium-form>.settings-row>.settings-row-label{white-space:normal;overflow:visible}

.browser-music-embed{grid-column:1/-1!important;grid-row:5!important;width:100%;height:180px;border:0;border-radius:12px;display:block;background:var(--pan)}#musicPlayer.has-browser-source .music-controls420,#musicPlayer.has-browser-source #musicSeek,#musicPlayer.has-browser-source #musicExtra{display:none!important}

/* Settings columns must grow with their cards before the outer scroller clips them. */
.settings-window .settings-columns{grid-auto-rows:max-content;align-content:start;align-items:start}
.settings-window .settings-content,.settings-window .settings-aside{height:max-content;align-self:start}
.settings-window .settings-content>*,.settings-window .settings-aside>*{flex-shrink:0;min-width:0;max-width:100%;box-sizing:border-box}
@media(max-width:1300px) and (min-width:851px){.settings-window .settings-content,.settings-window .settings-aside{grid-column:1/-1;grid-row:auto}}
@media(max-width:850px){.settings-window .settings-aside{display:flex;flex-direction:column;gap:16px}}

/* Editable emoji use the same local artwork font as the picker and sent messages. */
#richComposer,.message-inline-editor{font-family:Inter,'Truectrum Emoji',sans-serif!important}

/* Compact list actions keep the name visible and menus inside the visible viewport. */
.menu{box-sizing:border-box;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}
.menu>button{min-width:0;white-space:normal;overflow-wrap:anywhere}
.menu>button>svg{flex:none}.menu>button>span{min-width:0}
#list .people-row{display:grid;grid-template-columns:38px minmax(0,1fr) auto;gap:8px;align-items:center}
#list .people-row>.avw{width:38px;min-width:38px}
#list .people-row>.rb{min-width:0;overflow:hidden}
#list .people-row>.rb>b{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#list .people-row>.people-row-actions{display:flex;flex:none;align-items:center;gap:4px;width:auto;min-width:0;padding:0;background:transparent;border:0}
#list .people-row-actions>.ib{display:grid;place-items:center;flex:0 0 30px;width:30px;height:30px;min-height:30px;padding:0;border:0;border-radius:50%!important;color:var(--tx2);background:transparent}
#list .people-row-actions>.ib:hover,#list .chat-row-actions:hover,#list .chat-row-actions[aria-expanded=true]{background:var(--hov);color:var(--tx)}
#list .chat-row-actions{display:grid;place-items:center;flex:0 0 30px;width:30px;height:30px;padding:0;margin:0;opacity:1;color:var(--tx2);background:transparent;border:0;border-radius:50%!important}
#list .chat-row-actions svg{width:18px;height:18px;display:block}

.channel-verification{display:inline-grid;place-items:center;vertical-align:middle;margin-left:6px;width:16px;height:16px;min-width:16px;font-size:11px;line-height:1;border-radius:50%;background:#3289ee;color:#fff;font-weight:700}

/* Channel covers have an explicit draft, preview and reset action. */
.channel-cover-editor{display:flex;flex-direction:column;gap:10px;margin:18px 0;min-width:0}
.channel-cover-editor>label{font-size:12px;color:var(--tx2)}
.channel-cover-picker-preview{width:100%;height:145px;overflow:hidden;background:var(--in);border-radius:12px}
.channel-cover-current{width:100%;height:100%;background:url('winter-city.png') center/cover;overflow:hidden}
.channel-cover-current.has-custom-cover,.reference-preview-cover.has-custom-cover{background:var(--in)}
.channel-cover-picker-preview img,.channel-cover-picker-preview video,.channel-cover-current>img,.channel-cover-current>video,.reference-preview-cover>img,.reference-preview-cover>video,.channel-profile-cover>img,.channel-profile-cover>video{display:block;width:100%;height:100%;object-fit:cover;object-position:center}
.reference-preview-cover{overflow:hidden}.reference-preview-cover>.channel-cover-current{border-radius:inherit}
.channel-cover-actions{display:flex;flex-wrap:wrap;gap:8px}.channel-cover-actions>button{flex:1;min-width:130px;min-height:38px}
.channel-cover-editor>small{font-size:11px;line-height:1.5;overflow-wrap:anywhere}
#details.channel-panel>.channel-profile-cover.has-custom-cover{display:block;height:140px;flex:none}
.reference-channel-full #details.channel-panel>.channel-profile-cover.has-custom-cover{height:250px}
@media(max-width:850px){.reference-channel-full #details.channel-panel>.channel-profile-cover.has-custom-cover{height:200px}}
