body{min-height:100dvh}.stage{padding-top:24px}.status{position:sticky;bottom:10px;z-index:10;background:#eef4ff;border-radius:10px;padding:8px 14px;max-width:700px}.status:empty{display:none}#loading{text-align:center;padding:40px;color:#6b819f}button:disabled{opacity:.5;cursor:wait}.profile-photo,.avatar{overflow:hidden}.profile-photo img,.avatar img{width:100%;height:100%;object-fit:cover}.home-row small{font-size:11px;color:#8b9bb0;margin-left:8px}.home-row .badge{width:auto;min-width:18px;padding:0 4px}.home-top-actions #logout{display:block}#chat-view{max-width:850px;margin:auto;height:calc(100dvh - 50px);display:flex;flex-direction:column}#message-scroll{flex:1;overflow-y:auto;padding:18px 28px;background:#f8faff}.message .bubble{white-space:pre-wrap;overflow-wrap:anywhere}.compose input{font-size:16px}#older-messages{display:block;margin:auto}.flow-card input[readonly]{max-width:100%}#emoji-panel{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}#emoji-panel button{font-size:24px;padding:7px;background:#f1f5fc;border-radius:9px}#no-contacts{font-size:13px;color:#8796ac;padding:20px 0}#video-grid{position:relative;width:100%;height:240px;margin:20px 0;background:#e2ebf8;border-radius:18px;overflow:hidden}#remote-video{width:100%;height:100%;display:grid;place-items:center;color:#6b819f}#local-video{position:absolute;right:10px;bottom:10px;width:90px;height:120px;background:#cad9ef;border-radius:10px;overflow:hidden}#video-grid video{width:100%;height:100%;object-fit:cover}#local-video video{transform:scaleX(-1)}.call-view:has(#video-grid:not([hidden])) .hero-avatar{display:none}.call-view:has(#video-grid:not([hidden])) h2{margin-top:18px}.call-controls{padding-top:20px}.call-view{min-height:570px}.call-view .hero-avatar{margin-top:30px}.call-control.on .circle{background:#3475e5;color:white}.flow-card.center .hero-avatar{overflow:hidden}#profile-error{color:#b64d60}#notice{white-space:pre-line}#invite-status{min-height:24px}.my-profile h2{overflow-wrap:anywhere}#my-status{font-weight:400}#chat-status{white-space:nowrap}@media(max-width:600px){.stage{padding:0}.home-shell{border:0;border-radius:0}.home-layout{min-height:calc(100dvh - 80px)}.flow-card{margin:16px 12px}.call-view{margin:12px;min-height:calc(100dvh - 24px)}#chat-view{height:100dvh}.chat-head{padding-top:max(16px,env(safe-area-inset-top))}#message-scroll{padding:16px}.composer{padding-bottom:max(13px,env(safe-area-inset-bottom))}.home-row{min-height:80px}.status{margin:10px}.home-top-actions #logout{font-size:11px;padding:5px}.call-button span{display:none}.home-top .call-button span{display:inline}.profile-edit{min-height:32px}.home-recent{max-height:none;overflow:visible}}
.home-row .row-copy{flex:1;min-width:0}.home-row b{display:block;overflow-wrap:anywhere}.home-row .meta{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-end;gap:9px;min-width:64px}.home-row.unread{background:linear-gradient(100deg,#edf5ff,#fff 80%);border-left:3px solid #4286f5;padding-left:12px;border-radius:14px;margin-top:8px}.home-row .unread-badge{display:inline-flex;align-items:center;justify-content:center;gap:5px;white-space:nowrap;min-height:25px;padding:3px 9px;border-radius:999px;background:linear-gradient(135deg,#397cf1,#6862ea);color:white;font-size:11px;font-weight:600;line-height:19px;box-shadow:0 3px 12px #547ced38;transform:none}.unread-badge:before{content:'';width:5px;height:5px;border-radius:50%;background:white;box-shadow:0 0 0 3px #ffffff26;animation:unread-pulse 2s ease-in-out 3}@keyframes unread-pulse{50%{opacity:.5;box-shadow:0 0 0 5px #ffffff08}}@media(prefers-reduced-motion:reduce){.unread-badge:before{animation:none}}

/* Keep the avatar and all profile text in two real columns at every width. */
.my-profile{display:block}.profile-summary{display:grid;grid-template-columns:52px minmax(0,1fr);gap:14px;align-items:start}.my-profile .profile-photo{grid-area:auto;width:52px;height:52px;margin:0;border-radius:18px}.profile-details{min-width:0;display:flex;flex-direction:column;gap:5px}.my-profile .profile-details h2{grid-area:auto;margin:0;font-size:18px;line-height:1.5;overflow-wrap:anywhere;align-self:auto}.my-profile .profile-details .mood{grid-area:auto;margin:0;font-size:13px;line-height:1.65;overflow-wrap:anywhere;align-self:auto}.profile-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.my-profile .profile-actions .my-status{grid-area:auto;margin:0;font-size:11px;align-self:auto}.my-profile .profile-actions .profile-edit{grid-area:auto;width:auto;margin:0;padding:3px 0;min-height:30px;border:0;background:transparent;font-size:12px;align-self:auto}.compose #emoji{width:44px;height:44px;flex:0 0 44px}.compose #emoji .ico{width:30px;height:30px;stroke-width:1.8}#emoji-panel{gap:8px}#emoji-panel button{width:52px;height:52px;font-size:34px;line-height:1;display:grid;place-items:center;padding:0}.message .bubble.emoji-only{font-size:38px;line-height:1.4;padding:8px 13px}
/* Fixed frame: only the message list scrolls, even when the keyboard reduces the viewport. */
body.chat-open{overflow:hidden;min-height:0}body.chat-open .stage{padding:0}
#chat-view{position:fixed;top:var(--chat-top,0px);left:50%;transform:translateX(-50%);width:100%;max-width:850px;height:var(--chat-height,100dvh);min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden;background:#fff;border:0;border-radius:0}
#chat-view .chat-head{min-width:0;gap:10px;padding:14px 16px;padding-top:max(14px,env(safe-area-inset-top));background:white;z-index:2;flex-shrink:0}
#chat-view .heading{min-width:0}#chat-name{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#chat-status{overflow:hidden;text-overflow:ellipsis;font-size:11px}
#chat-view .chat-head>button,#chat-avatar{flex-shrink:0}
#message-scroll{min-height:0;overscroll-behavior:contain;overflow:auto;-webkit-overflow-scrolling:touch}
#chat-view .composer{min-height:0;padding:10px 12px max(10px,env(safe-area-inset-bottom));position:relative;background:white;z-index:2;display:flex;flex-direction:column}
#chat-view .compose{order:0}#send-status{order:1}.compose #emoji{font-size:28px}
#emoji-panel{order:2;display:flex;flex-direction:column;flex-wrap:nowrap;gap:10px;margin:12px 0 0;max-height:min(350px,45dvh);overflow:hidden;background:#fff;animation:emoji-rise .18s ease-out}
@keyframes emoji-rise{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){#emoji-panel{animation:none}}
#emoji-panel .emoji-toolbar{display:flex;gap:10px;align-items:center;flex-shrink:0}
#emoji-panel .emoji-search{width:100%;min-width:0;background:#f3f6fb;border:1px solid #e5ebf4;border-radius:12px;padding:11px 12px;font-size:16px;color:#24314b}
#emoji-panel .emoji-close{width:40px;height:40px;flex:0 0 40px;font-size:22px;background:transparent;color:#708299}
#emoji-panel .emoji-tabs{display:flex;gap:4px;flex-shrink:0;flex-wrap:wrap}
#emoji-panel .emoji-tab{width:auto;height:34px;padding:0 9px;font:13px/1.2 system-ui;background:transparent;color:#6b7b93;border-radius:9px}
#emoji-panel .emoji-tab[aria-pressed=true]{background:#e9f1ff;color:#2867d1;font-weight:600}
#emoji-panel .emoji-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:5px;overflow:auto;min-height:0;overscroll-behavior:contain;padding:2px 2px 6px}
#emoji-panel .emoji-choice{width:100%;height:49px;font-size:33px;line-height:1;background:#f7f9fd;border-radius:12px}
#emoji-panel .emoji-choice:hover{background:#e7efff}#emoji-panel .emoji-result-label{font-size:11px;color:#8391a5;margin:0;flex-shrink:0}
#emoji-panel .emoji-empty{grid-column:1/-1;font-size:13px;color:#8391a5;margin:12px 4px}
@media(max-width:360px){#chat-view .chat-head{gap:8px;padding:12px}#chat-avatar{width:38px;height:38px}#emoji-panel .emoji-tab{padding:0 7px}}

body:has(#call-view:not([hidden])),body:has(#incoming-view:not([hidden])){display:flow-root}
body:has(#call-view:not([hidden])) .stage,body:has(#incoming-view:not([hidden])) .stage{padding-top:0;padding-bottom:0;display:flow-root}
#call-view{width:calc(100% - 32px);max-width:400px;margin:16px auto;min-height:calc(100dvh - 32px)}
#incoming-view{width:calc(100% - 32px);max-width:420px;margin:16px auto}
#chat-view .chat-head .call-button.unified-call{display:flex;min-height:46px;gap:7px;padding:10px 15px;border-radius:14px;font-size:14px;font-weight:600;flex-shrink:0}
#chat-view .chat-head .unified-call span{display:inline}
#chat-view .chat-head .unified-call .ico{width:22px;height:22px}
@media(max-width:360px){#chat-view .chat-head .unified-call{padding:10px 12px}}

/* A lightweight MSN welcome: no network assets or artificial login delay. */
body:has(#login-view:not([hidden])),body:has(#login-view:not([hidden])) .stage{display:flow-root}
#loading.msn-loading{min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 20px;background:radial-gradient(ellipse at 50% 43%,#ffffff 0%,#f4f8ff 44%,#edf2f9 100%);color:#24314b}
.msn-loading>strong{font-size:29px;font-weight:650;letter-spacing:-1px;margin-top:16px}.msn-loading>p{font-size:14px;color:#7a8ba4;margin:12px 0}
.msn-welcome-mark{position:relative;width:132px;height:132px;margin:8px auto 22px;display:grid;place-items:center;isolation:isolate}
.msn-welcome-mark:before{content:'';position:absolute;inset:12px;border-radius:50%;background:radial-gradient(circle,#e1eeff,#eff6ff 60%,#ffffff00 73%);box-shadow:0 0 35px #5599ed18;animation:msn-glow 3.6s ease-in-out infinite}
.msn-welcome-mark .logo{width:92px;height:92px;position:relative;z-index:1;transform-origin:50% 60%;animation:msn-buddies-sway 4s ease-in-out infinite}
.msn-orbit{position:absolute;inset:0;border:1px solid #dbe8f8;border-radius:50%;animation:msn-orbit 8s linear infinite}
.msn-orbit:before,.msn-orbit:after{content:'';position:absolute;left:50%;width:9px;height:9px;margin-left:-4.5px;border-radius:50%;box-shadow:0 0 12px #5b9ce64a}.msn-orbit:before{top:-5px;background:#429ce9}.msn-orbit:after{bottom:-5px;background:#ee6e8c}
#login-view{width:calc(100% - 32px);max-width:420px;margin:24px auto;padding:34px 28px;animation:msn-arrive .45s ease-out both}
#login-view h2{font-size:29px;letter-spacing:-1px}#login-view #login{min-height:48px;border-radius:13px;background:#3475e5;color:white;border:1px solid #3475e5;font-size:15px}#login-view #login-message{font-size:12px;min-height:46px;margin-top:18px}
#login-view.is-signing-in .msn-orbit,.msn-loading .msn-orbit{animation-duration:2.8s}
.msn-loading-dots{display:inline-flex;gap:4px;margin-left:5px;vertical-align:middle}.msn-loading-dots i{width:4px;height:4px;border-radius:50%;background:#6b98d2;animation:msn-dot 1.4s ease-in-out infinite}.msn-loading-dots i:nth-child(2){animation-delay:.16s}.msn-loading-dots i:nth-child(3){animation-delay:.32s}
@keyframes msn-orbit{to{transform:rotate(360deg)}}
@keyframes msn-buddies-sway{0%,100%{transform:translateY(0) rotate(-5deg)}50%{transform:translateY(-5px) rotate(5deg)}}
@keyframes msn-glow{0%,100%{opacity:.65;transform:scale(.94)}50%{opacity:1;transform:scale(1.04)}}
@keyframes msn-dot{0%,70%,100%{opacity:.3;transform:translateY(0)}35%{opacity:1;transform:translateY(-3px)}}
@keyframes msn-arrive{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){#login-view,.msn-welcome-mark:before,.msn-welcome-mark .logo,.msn-orbit,.msn-loading-dots i{animation:none!important}}
#login-view #login{display:flex;align-items:center;justify-content:center;text-align:center;width:100%}

/* Keep every flow card centered when its max-width is reached on wide phones. */
body:has(#invite-view:not([hidden])),body:has(#recipient-view:not([hidden])){display:flow-root}
body:has(#invite-view:not([hidden])) .stage,body:has(#recipient-view:not([hidden])) .stage{display:flow-root}
@media(max-width:600px){.flow-card{width:calc(100% - 32px);margin:16px auto}}

/* Keep the nickname attached to the avatar, separate from the editable status. */
.my-profile .profile-summary{grid-template-columns:76px minmax(0,1fr);align-items:center;gap:18px}
.profile-identity{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0}
.my-profile .profile-identity .profile-photo{width:60px;height:60px;flex-shrink:0}
.my-profile .profile-identity h2{margin:0;width:100%;font-size:16px;line-height:1.4;text-align:center;overflow-wrap:anywhere}
.my-profile .profile-details .mood{font-size:15px;line-height:1.7;white-space:pre-wrap}
.my-profile .profile-details{gap:10px}
@media(min-width:601px){.my-profile .profile-summary{grid-template-columns:66px minmax(0,1fr);gap:12px}}
.profile-notifications{margin-top:18px;min-width:0}
.profile-notifications button{width:100%;min-height:44px;padding:9px 8px;border:1px solid #dc6970;border-radius:12px;background:#fff0f1;color:#a93140;font-size:12px;font-weight:650;cursor:pointer}
.profile-notifications p{margin:7px 0 0;font-size:11px;line-height:1.6;color:#98616a;overflow-wrap:anywhere}
.profile-notifications[data-state="ready"] button{background:#e8f7ee;border-color:#83b899;color:#226b44}
.profile-notifications[data-state="ready"] p{color:#527762}
.profile-notifications[data-state="checking"] button{background:#f1f4fa;border-color:#cbd5e4;color:#64758c}
.profile-notifications[data-state="checking"] p{color:#64758c}
@media(max-width:600px){
  .my-profile{display:grid;grid-template-columns:minmax(0,1fr) 102px;gap:14px;padding:18px 16px;align-items:start}
  .my-profile .profile-summary{grid-template-columns:60px minmax(0,1fr);gap:12px;align-items:start}
  .my-profile .profile-identity h2{font-size:15px}
  .my-profile .profile-details .mood{font-size:13px}
  .my-profile .profile-actions{gap:2px 8px}
  .profile-notifications{margin-top:0}
}
/* Group the status text with the profile actions and put notification copy first. */
.my-profile .profile-details{gap:2px}
.profile-notifications{display:flex;flex-direction:column;gap:8px}
.profile-notifications p{margin:0}
@media(max-width:600px){.my-profile .profile-details{padding-top:14px}}
/* Preserve the full camera frame in both previews; portrait video must not overflow its grid track. */
#video-grid{height:clamp(260px,45dvh,420px);background:#172233}
#remote-video{min-width:0;min-height:0;overflow:hidden;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
#video-grid video{display:block;min-width:0;min-height:0;max-width:100%;max-height:100%;object-fit:contain;object-position:center}
#local-video{background:#172233}
#notice:not(:empty){position:fixed;top:auto;bottom:max(18px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:calc(100% - 32px);max-width:600px;margin:0;display:flex;align-items:flex-start;gap:12px;box-shadow:0 6px 24px #24314b20;z-index:30}
#notice span{flex:1;min-width:0;max-height:22dvh;overflow:auto;overflow-wrap:anywhere}
#notice button{flex:0 0 32px;min-height:32px;background:transparent;color:#536d94;font-size:24px;line-height:1;border-radius:8px}
body.chat-open #notice:not(:empty){bottom:calc(90px + env(safe-area-inset-bottom))}

/* Shared member directory and friend-request dialog. */
.circle-section{margin-top:28px;padding-top:22px;border-top:1px solid #e6eaf1;min-width:0}
.circle-section h3{font-size:16px;margin:0 0 8px}.circle-section small{color:#8391a6;font-size:12px;font-weight:400}
.circle-intro,#circle-empty{font-size:13px;line-height:1.7;color:#77869c;margin:8px 0 16px}
.circle-row{width:100%;text-align:left}.friend-badge{flex:none;border-radius:12px;padding:7px 10px;background:#eef4ff;color:#356bbe;font-size:12px;white-space:nowrap}
#friend-inbox{background:#f3f7ff;border:1px solid #dce7fc;border-radius:18px;padding:16px}
.member-dialog{text-align:center}.member-dialog .hero-avatar{width:76px;height:76px;margin:4px auto 16px}.member-dialog h2{overflow-wrap:anywhere}.member-dialog p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;color:#75839a}.member-dialog #member-error{color:#b63850}
.member-actions{display:flex;flex-direction:column;gap:10px}.member-actions button{width:100%;justify-content:center;min-height:44px}.member-actions button:disabled{opacity:.55;cursor:default}
@media(max-width:600px){.circle-row{gap:10px}.circle-row .avatar{width:44px;height:44px;flex:0 0 44px}.friend-badge{padding:7px 8px;font-size:11px}}

@media(max-width:360px){.home-top{padding:12px;gap:8px}.home-wordmark{font-size:18px;gap:6px;white-space:nowrap}.home-wordmark .logo{width:32px;height:32px}.home-top-actions{gap:6px}.home-top-actions button{white-space:nowrap}.home-top .call-button{padding:10px;gap:6px}}

.browser-help{margin:24px auto;text-align:left}.browser-help h2{font-size:24px;line-height:1.5}.browser-help .full{display:flex;align-items:center;justify-content:center;text-decoration:none;margin:12px 0;min-height:48px}.browser-help #browser-help-steps{white-space:pre-line;line-height:2;font-size:14px}.browser-help input,.join-help input{width:100%;padding:12px;border:1px solid #d6e0ed;border-radius:10px;font:inherit;min-width:0}.join-help{padding:20px;border:1px solid #d7e5fa;border-radius:16px;background:#f1f6ff;margin-bottom:24px}.join-help h3{margin:0;font-size:17px}.join-help p,.join-help label{font-size:13px;line-height:1.8;color:#536c8e}.join-help label{display:block;margin:12px 0 6px}.join-help button{margin-top:12px}.join-help summary{cursor:pointer;color:#346cb5;font-size:14px}.join-help #join-error{color:#ae3e4f}@media(max-width:600px){.browser-help{width:calc(100% - 32px);margin:16px auto}}

.flow-card.browser-help{text-align:left}.browser-help #browser-copy{border:1px solid #bfd0ea;background:#f0f5ff;color:#315f9c;font-size:15px;padding:12px}.browser-help:has(#browser-open[hidden]) #browser-copy{background:#3475e5;color:white;border-color:#3475e5}.browser-help #browser-help-copy{font-size:14px;line-height:1.8}
/* Pending sends stay next to their message, with a reachable retry on small screens. */
.message.me{flex-wrap:wrap}.message .bubble{min-width:0;max-width:min(350px,calc(100% - 62px))}.message .delivery-state{flex-basis:100%;text-align:right;font-size:12px;color:#7d6a49;white-space:normal;margin-top:-4px}.delivery-state button{margin-left:8px;padding:8px 12px;min-height:36px;border-radius:10px;background:#edf3ff;color:#245fbd;font-size:12px}.outgoing-pending .bubble{border-style:dashed}
.permission-dialog{max-height:calc(100dvh - 40px);overflow:auto}.permission-dialog>p{font-size:13px;line-height:1.7;color:#657791}.permission-checks p{padding:12px;border-radius:12px;background:#f1f5fc;font-size:13px;overflow-wrap:anywhere}.permission-checks [data-state=ready]{background:#eaf7ef;color:#267548}.permission-checks [data-state=attention]{background:#fff3e7;color:#895a24}.permission-dialog .dialog-actions{flex-wrap:wrap}#setup-start{min-height:44px}
.call-spinner{width:26px;height:26px;margin:10px auto;border:3px solid #d9e5f8;border-top-color:#3475e5;border-radius:50%;animation:call-wait 1s linear infinite}#call-view #call-error{margin:16px 0;padding:16px;background:#fff3ed;border:1px solid #f1d7c9;border-radius:16px;color:#88513c;font-size:14px;line-height:1.8;overflow-wrap:anywhere}#call-result-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin:12px 0 24px}#call-result-actions button{min-height:44px}#call-view:has(#call-result-actions:not([hidden])) .timer{display:none}@keyframes call-wait{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.call-spinner{animation:none}}
.camera-flip{position:absolute;left:12px;bottom:12px;z-index:2;display:block;min-height:44px;margin:0;padding:10px 20px;border:1px solid #c8d9ef;border-radius:24px;background:#fff;color:#315f9c;font:inherit;font-size:14px}.camera-flip:disabled{cursor:wait}#local-video.back-camera video{transform:none}
