:root{color-scheme:dark;--bg:#100b20;--panel:#191329;--line:#30253f;--muted:#9e90b7;--text:#f5f1fc;--accent:#a57bff;--green:#71dcba}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font:15px Manrope,system-ui,sans-serif}
button,input,select{font:inherit}
button,a,input,select{ -webkit-tap-highlight-color:transparent}
button{cursor:pointer;color:inherit}
button:disabled{opacity:.45;cursor:default}
button:focus-visible,a:focus-visible{outline:2px solid #c5a7ff;outline-offset:4px}
a{color:inherit;text-decoration:none}
svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.shell{max-width:1440px;min-height:100dvh;margin:auto;display:grid;grid-template-columns:256px 1fr}
.sidebar{padding:38px 26px;border-right:1px solid var(--line);display:flex;flex-direction:column;position:sticky;top:0;height:100dvh}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:25px;letter-spacing:-1.2px}
.brand img{width:44px;height:44px;border-radius:13px}
.side-caption{font-size:9px;letter-spacing:2px;color:var(--muted);margin:16px 0 38px}
.nav-item{display:flex;gap:14px;align-items:center;padding:16px;margin-bottom:9px;border-radius:15px;color:var(--muted);font-weight:600}
.nav-item.active{background:#a87fff18;color:#d8c3ff;border:1px solid #ad7cfb28}
.side-bottom{margin-top:auto}
.quiet-card{border:1px solid var(--line);border-radius:20px;padding:20px;color:#b3a4c7;background:linear-gradient(140deg,#36214855,transparent)}
.quiet-card p{font-size:13px;line-height:1.7;margin-bottom:0}
.spark{color:#d2b2ff;font-size:24px}
.self{background:transparent;border:0;display:flex;gap:12px;align-items:center;width:100%;text-align:left;padding:22px 0}
.self small{display:block;color:var(--muted);margin-top:4px;font-size:11px}
.prototype{font-size:10px;line-height:1.7;color:#7f7194}
main{padding:45px 48px 30px;background:transparent;min-width:0}
.page-head{display:flex;justify-content:space-between;gap:18px;align-items:center;margin-bottom:30px}
.page-head h1{font-size:32px;letter-spacing:-1.2px;margin:0;font-weight:800}
.subtitle{color:var(--muted);font-size:13px;margin:9px 0 0;line-height:1.7}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--green);margin-right:6px}
.field{height:50px;background:#21192f;border:1px solid var(--line);border-radius:14px;padding:0 15px;color:var(--text);outline:0;min-width:0}
.field:focus{border-color:var(--accent)}
.search{position:relative;flex:1}
.search svg{position:absolute;left:16px;top:14px;color:var(--muted)}
.search input{width:100%;padding-left:48px}
.field::placeholder{color:#8b7e9f}
.icon-btn{background:#21192f;border:1px solid var(--line);border-radius:14px;display:grid;place-items:center;width:50px;height:50px}
.avatar{position:relative;border-radius:50%;background:radial-gradient(circle at 35% 25%,#5d4380,#20153c 75%);border:1px solid #6d4a9270;width:62px;height:62px;flex-shrink:0;display:grid;place-items:center;font-size:32px;box-shadow:inset 0 0 22px #8f57dc22}
.avatar.small{width:42px;height:42px;font-size:23px}
.avatar.large{width:112px;height:112px;font-size:61px}
.avatar i{width:11px;height:11px;position:absolute;bottom:2px;right:2px;background:var(--green);border:2px solid #1b122a;border-radius:50%}
.person-info{flex:1;min-width:0}
.person-info h3{margin:0 0 6px;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.age{color:#ba9ad6;font-weight:500;font-size:12px;margin-left:6px}
.status{margin-top:7px;font-size:11px;color:var(--green)}
.status.off{color:#8b7d9e}
.note{font-size:11px;color:#8d7da3;line-height:1.7;margin:24px 0;text-align:center}
.mobile-nav{display:none}
.tabs{display:flex;gap:8px;margin:24px 0}
.tab{border:1px solid var(--line);background:var(--panel);border-radius:30px;padding:10px 19px;color:var(--muted)}
.tab.active{background:#a575ff22;color:#d9c4ff;border-color:#9c72d870}
.dialog-list{max-width:740px}
.dialog-row{display:flex;align-items:center;gap:16px;width:100%;text-align:left;background:transparent;border:0;border-bottom:1px solid var(--line);padding:21px 0}
.dialog-copy{flex:1;min-width:0}
.dialog-copy strong{font-size:15px}
.dialog-copy p{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:7px 0 0}
.dialog-time{font-size:11px;color:var(--muted);text-align:right}
.unread{background:#a276f0;color:#160d29;border-radius:30px;padding:3px 7px;display:block;margin-top:8px;font-weight:800}
.empty{text-align:center;padding:55px 20px;color:var(--muted);line-height:1.8}
.empty .spark{font-size:40px}
.primary{background:linear-gradient(115deg,#b387ff,#7945e7);border:1px solid #c397ff50;border-radius:14px;padding:14px 24px;font-weight:700;box-shadow:0 6px 28px #7b40dc1a}
.secondary{background:var(--panel);border:1px solid var(--line);border-radius:13px;padding:12px 20px}
.chat-layout{height:calc(100dvh - 75px);display:flex;flex-direction:column;max-width:850px;margin:auto}
.chat-head{display:flex;align-items:center;gap:13px;padding-bottom:22px;border-bottom:1px solid var(--line)}
.chat-head .icon-btn{width:38px;height:38px}
.chat-head .person-info h3{font-size:17px}
.chat-head .status{margin-top:3px}
.chat-head .avatar{width:48px;height:48px;font-size:27px}
.messages{flex:1;overflow:auto;padding:25px 3px;display:flex;flex-direction:column;gap:14px;min-height:120px}
.day{text-align:center;font-size:10px;letter-spacing:1px;color:#857495;margin:2px 0 12px}
.message{align-self:flex-start;max-width:76%;min-width:70px}
.message.mine{align-self:flex-end}
.bubble{background:#2b223b;border:1px solid #77608b24;border-radius:18px 18px 18px 5px;padding:13px 17px;line-height:1.6;font-size:14px;overflow-wrap:anywhere}
.mine .bubble{background:linear-gradient(120deg,#925cef,#7540df);border-radius:18px 18px 5px 18px;border-color:#c197ff25}
.message-time{font-size:9px;color:#8e7ba5;margin:5px 5px;text-align:right}
.message img{display:block;max-width:100%;max-height:300px;border-radius:12px;cursor:zoom-in}
.message audio{max-width:100%;width:260px;height:38px}
.composer{padding:18px 0 8px;border-top:1px solid var(--line);display:flex;gap:10px;align-items:flex-end}
.composer-box{display:flex;align-items:center;flex:1;border:1px solid var(--line);background:#21192f;border-radius:20px;padding:5px 10px}
.composer textarea{resize:none;flex:1;min-width:0;background:transparent;color:var(--text);border:0;outline:0;padding:13px 8px;max-height:110px;font:inherit;height:48px}
.composer-box button{background:transparent;border:0;color:#aa93c3;display:grid;place-items:center;padding:8px}
.send-btn{background:linear-gradient(130deg,#b080fc,#7541e2);border:1px solid #c297ff50;border-radius:18px;width:58px;height:58px;display:grid;place-items:center;touch-action:none;user-select:none}
.profile-wrap{max-width:650px;margin:auto}
.profile-top{display:flex;flex-direction:column;align-items:center;padding:7px 0 30px;gap:15px}
.profile-top h2{margin:0}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.form-grid label{display:flex;flex-direction:column;gap:9px;color:#b2a1c7;font-size:12px}
.form-grid .field{width:100%}
.profile-actions{display:flex;justify-content:flex-end;margin-top:25px}
.settings{margin-top:30px;border-top:1px solid var(--line);padding-top:15px}
.settings button{display:flex;align-items:center;gap:12px;padding:15px 0;width:100%;border:0;background:transparent;text-align:left;color:var(--muted)}
.settings .danger{color:#e698af}
.avatar-options{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.avatar-option{background:var(--panel);border:1px solid var(--line);padding:15px;border-radius:16px;display:grid;place-items:center}
.avatar-option.active{border-color:var(--accent)}
dialog{background:#1b132c;color:var(--text);border:1px solid #6b4c89;border-radius:24px;padding:25px;width:min(460px,calc(100% - 30px));max-height:90dvh;overflow:auto;box-shadow:0 30px 100px #0008}
dialog::backdrop{background:#08040dba;backdrop-filter:blur(7px)}
.modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px}
.modal-head h2{font-size:19px;margin:0}
.modal-head button{border:0;background:transparent;color:var(--muted);font-size:26px}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}
.modal-copy{color:var(--muted);line-height:1.8;font-size:13px}
#wave{width:100%;height:85px;background:#110b20;border-radius:12px}
.lightbox{width:auto;max-width:90vw}
.lightbox img{max-width:100%;max-height:75dvh;border-radius:12px}
#toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);padding:13px 22px;border:1px solid #70528c;background:#2e2140;border-radius:14px;z-index:20;opacity:0;pointer-events:none;transition:opacity .2s;max-width:90vw;text-align:center;font-size:13px}
#toast.show{opacity:1}
@media(min-width:1300px){
  .avatar{width:54px;height:54px;font-size:29px}
}
@media(max-width:1050px){  main{padding:35px 28px}
  .shell{grid-template-columns:220px 1fr}
  .sidebar{padding:30px 20px}
}
@media(max-width:760px){  .shell{display:block}
  .sidebar{display:none}
  main{padding:24px 20px 100px;min-height:100dvh}
  .page-head{margin-bottom:20px}
  .page-head h1{font-size:28px}
  .subtitle{font-size:12px}
  .search{flex-basis:calc(100% - 59px)}
  .person-info h3{font-size:16px}
  .mobile-nav{display:flex;position:fixed;bottom:0;left:0;right:0;justify-content:space-around;padding:12px 10px calc(10px + env(safe-area-inset-bottom));background:#130d22ed;backdrop-filter:blur(18px);border-top:1px solid var(--line);z-index:5}
  .mobile-nav .nav-item{flex-direction:column;gap:6px;font-size:10px;padding:0 16px;margin:0;border:0;background:transparent}
  .mobile-nav .nav-item.active{color:#ba91ff}
  .mobile-nav .nav-item.active:after{content:'';height:2px;width:24px;background:#ba91ff;position:absolute;top:0}
  .chat-layout{height:calc(100dvh - 34px - env(safe-area-inset-bottom));max-width:none}
  .chat-mode main{padding:18px 15px 0}
  .chat-mode .mobile-nav{display:none}
  .chat-head{padding-bottom:15px}
  .chat-head .person-info h3{font-size:16px}
  .messages{padding:20px 1px}
  .message{max-width:85%}
  .bubble{font-size:14px;padding:12px 15px}
  .composer{padding-top:12px}
  .composer textarea{font-size:14px}
  .send-btn{width:52px;height:54px}
  .form-grid{gap:16px}
  .profile-top{padding-top:5px}
  .profile-actions .primary{width:100%}
  .profile-actions{margin-top:22px}
  #toast{bottom:100px}
  .chat-mode #toast{bottom:95px}
  .dialog-row{padding:19px 0}
  .dialog-row .avatar{width:55px;height:55px;font-size:29px}
}
/* Compact directory header and stable filter alignment. */
/* Match the approved four-screen reference. */
:root{--bg:#100b20;--panel:#1c152d;--line:#342846;--muted:#b0a0cf;--accent:#a86cff;--green:#43ed80}
body{background:#100b20}
main{background:transparent}
.sidebar>.brand,.side-caption,.quiet-card{display:none}
.sidebar nav{margin-top:55px}
.page-head h1{font-size:30px;letter-spacing:-.8px}
.field{background:linear-gradient(115deg,#2b203b,#231a33);border-color:#524069;height:44px;border-radius:12px;font-size:13px}
.search svg{top:11px;width:20px;height:20px}
.search input{padding-left:43px}
.person-info h3{margin-bottom:5px;font-size:16px;font-weight:700}
.age{margin-left:0;font-size:inherit;font-weight:500;color:var(--text)}
.status{font-size:12px;margin:0 0 3px;color:#64edaf;display:flex;align-items:center;gap:6px}
.status.off{color:#a899bc}
.avatar{width:64px;height:64px;border:1px solid #c19eff88;box-shadow:0 0 15px #7739bf16;background-color:#201332}
.avatar i{display:none}
.avatar.small{width:42px;height:42px}
.avatar.large{width:140px;height:140px}
.tabs{border:1px solid #392b4d;background:#292036;display:flex;gap:0;border-radius:14px;width:max-content;padding:3px;margin:16px 0 8px}
.tab{border:0;background:transparent;border-radius:11px;padding:9px 22px;font-size:12px;color:#dbc8f3}
.tab.active{background:linear-gradient(120deg,#c68cff,#7732fc);color:#1e092e;font-weight:800;box-shadow:0 0 18px #a565fc55}
.dialog-row{padding:20px 0;border-color:#372a43}
.dialog-copy strong{font-size:16px}
.dialog-copy p{font-size:13px;color:#c6b3df}
.dialog-time{font-size:12px;color:#9f83be}
.unread{background:linear-gradient(140deg,#ca82ff,#8734ff);box-shadow:0 0 14px #9c49ff55;font-size:12px;color:#210836}
.primary{background:linear-gradient(120deg,#c37aff,#8738ff 75%);box-shadow:0 0 20px #ae5bff25;border-color:#b575ff;font-size:13px}
.secondary{background:#21182e;border-color:#71508c;font-size:12px}
.profile-wrap{max-width:500px}
.profile-top{padding:0 0 24px}
.profile-wrap .page-head{margin-bottom:15px}
.profile-wrap form{border:1px solid #362740;border-radius:17px;padding:12px;background:linear-gradient(135deg,#21152d55,transparent)}
.form-grid{display:flex;flex-direction:column;gap:8px}
.form-grid label{display:grid;grid-template-columns:90px minmax(0,1fr);align-items:center;gap:10px;color:#c1acd9;font-size:13px}
.form-grid .field{height:38px;background:#21172d;border-color:#33243f;border-radius:9px}
.profile-actions{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.profile-actions button{width:100%;padding:13px}
.settings{margin-top:20px;border-color:#34263e}
.settings button{padding:14px 0;color:#c7b4dc;font-size:13px}
.settings .danger{color:#d199ae}
.chat-layout{position:relative}
.chat-brand{display:flex;justify-content:center;margin:0 0 24px}
.chat-brand .brand{font-size:22px}
.chat-brand .brand img{width:34px;height:34px;border-radius:8px}
.chat-head{border:0;padding-bottom:12px}
.chat-head>.icon-btn:first-child{position:absolute;top:0;left:0}
.chat-head>#chat-menu{position:absolute;top:0;right:0}
.chat-head .icon-btn{background:transparent;border:0}
.chat-head .avatar{width:68px;height:68px}
.chat-head .status{font-size:12px;color:#c5b3db}
.chat-head .person-info h3{font-size:17px;margin-bottom:7px}
.chat-head .age{display:none}
.bubble{background:linear-gradient(135deg,#352a42,#2a2135);border:0;border-radius:18px;font-size:14px}
.mine .bubble{background:linear-gradient(120deg,#9e5bff,#682dec);border-radius:18px}
.message-time{color:#947cad;font-size:10px}
.composer{border:0;padding-top:14px;padding-bottom:10px;background:#171022;border-radius:24px 24px 0 0;margin:0 -8px}
.composer-box{border-radius:28px;background:linear-gradient(120deg,#30253d,#241b31);border-color:#59406c}
.send-btn{border-radius:50%;background:linear-gradient(145deg,#a461ff,#6324ef);width:52px;height:52px;flex-shrink:0}
.mobile-nav{background:#150e23f5;border-color:#392947}
.mobile-nav .nav-item{color:#a995c5}
.mobile-nav .nav-item.active{color:#be82ff}
.mobile-nav .nav-item.active:after{top:auto;bottom:calc(3px + env(safe-area-inset-bottom));width:42px;background:#bb78ff;height:2px}
.mobile-nav svg{width:23px;height:23px}
.mobile-nav .active svg{fill:#a968ff;stroke:#bd8aff}
@media(max-width:760px){  main{padding:19px 20px 92px}
  .page-head h1{font-size:28px}
  .person-info h3{font-size:15px;margin-bottom:4px}
  .status{font-size:12px}
  .dialog-row{padding:18px 0}
  .dialog-row .avatar{width:64px;height:64px}
  .dialog-copy strong{font-size:15px}
  .dialog-copy p{font-size:12px}
  .profile-top{padding-bottom:20px}
  .profile-top .avatar{width:138px;height:138px}
  .profile-actions{margin-top:12px}
  .chat-mode main{padding:16px 16px 0}
  .chat-layout{height:calc(100dvh - 20px - env(safe-area-inset-bottom))}
  .chat-brand{margin-bottom:20px}
  .chat-head .avatar{width:68px;height:68px}
  .chat-head{padding-bottom:12px}
  .messages{padding-top:15px;gap:15px}
  .composer{padding:12px 9px calc(9px + env(safe-area-inset-bottom));gap:8px}
  .composer textarea{font-size:13px;padding-left:4px}
  .composer-box{padding-left:5px;padding-right:6px}
  .composer-box button{padding:6px}
  .mobile-nav{padding-top:11px}
  .mobile-nav .nav-item{font-size:10px;gap:5px}
}
/* City lives in the filter panel; centre the wordmark itself. */
.chat-brand .brand{position:relative;display:block;width:max-content;text-align:center;font-size:28px;line-height:46px;letter-spacing:-.8px}
.chat-brand .brand img{position:absolute;right:calc(100% + 12px);top:3px;width:40px;height:40px;border-radius:10px}
.chat-brand{margin-bottom:22px}
@media(max-width:760px){
  .chat-brand .brand{font-size:28px;line-height:46px}
  .chat-brand .brand img{width:40px;height:40px;right:calc(100% + 10px)}
}
/* Keep mobile app screens focused on people and conversations. */
.sidebar>.brand{display:flex}
.sidebar nav{margin-top:35px}
.chat-brand{display:none}
.chat-head>.icon-btn:first-child,.chat-head>#chat-menu{position:static}
.chat-head{padding-bottom:15px}
.chat-head>#chat-menu{margin-left:auto}
@media(max-width:760px){  main{padding-top:20px}
  .chat-mode main{padding-top:16px}
}
/* Account entry uses the same violet palette as the chat. */
body.auth-mode .sidebar,body.auth-mode #mobile-nav{display:none!important}
body.auth-mode #main{width:100%;max-width:none;margin:0;min-height:100dvh;padding:40px 20px;display:flex;align-items:center;justify-content:center}
.auth-card{width:100%;max-width:420px;padding:32px;border:1px solid #49375f;border-radius:28px;background:linear-gradient(145deg,#20162f,#140f22);box-shadow:0 24px 80px #05020c55}
.auth-brand{display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:28px;font-size:30px;font-weight:800;letter-spacing:-1px}
.auth-brand img{width:48px;height:48px;border-radius:14px}
#auth-form>label{display:block;color:#e5dbf1;font-size:14px;margin:0 0 17px}
#auth-form .field{margin-top:8px;width:100%;height:48px;font-size:16px}
#auth-form select{appearance:auto}
.input-hint{font-size:12px;line-height:1.5;color:#a59ab9;margin:-9px 0 18px}
.optional{font-size:12px;color:#a59ab9;margin-left:4px}
.auth-submit{width:100%;min-height:48px;margin-top:5px}
.auth-back{background:none;border:0;color:#c6a6ff;padding:15px;width:100%;font-size:14px;cursor:pointer}
.auth-error{border:1px solid #a24f77;background:#57203940;border-radius:12px;padding:12px;color:#ffc2d8;font-size:14px;line-height:1.5}
.password-field{position:relative}
.password-field input{padding-right:86px}
.password-field button{position:absolute;right:12px;top:8px;height:48px;border:0;background:none;color:#c6a6ff;font-size:12px;cursor:pointer}
.auth-card button:disabled{opacity:.6;cursor:wait}
@media(max-width:760px){  body.auth-mode #main{padding:24px 20px;align-items:center}
  .auth-card{border:none;background:none;box-shadow:none;padding:20px 0;max-width:380px}
  .auth-brand{margin-bottom:34px;font-size:34px}
  .auth-brand img{width:54px;height:54px}
}
body.auth-mode .shell{display:block;max-width:none}
body.auth-mode{padding-bottom:0}
.form-grid input[readonly]{color:#b0a0cf;cursor:default}
/* Compact conversation: normal document flow, one internal message scroller. */
.bubble{display:flow-root}
.message-content{white-space:pre-wrap}
.bubble .message-time{float:right;display:inline-block;margin:5px 0 -2px 9px;line-height:12px;white-space:nowrap;font-size:10px}
@media(max-width:760px){  .field,input,select,textarea{font-size:16px}
  html.chat-viewport-locked{height:100%;overflow:hidden;overscroll-behavior:none}
  body.chat-mode{position:static;width:100%;height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
  body.chat-mode .shell{display:block;width:100%;height:var(--chat-viewport-height,100dvh);min-height:0;overflow:hidden}
  body.chat-mode #main{position:relative;top:auto;left:auto;width:100%;height:100%;min-height:0;max-height:none;padding:6px 8px 0;overflow:hidden;overflow-anchor:none}
  body.chat-mode .chat-layout{display:flex;width:100%;height:100%;min-height:0;max-width:none;margin:0;overflow:hidden;transition:none}
  body.chat-mode .chat-head{flex:0 0 auto;min-width:0;gap:9px;padding:4px 2px 8px;min-height:54px;overflow-anchor:none}
  body.chat-mode .chat-head .avatar{width:40px;height:40px}
  body.chat-mode .chat-head .icon-btn{width:32px;height:36px;flex-shrink:0}
  body.chat-mode .chat-head .icon-btn svg{width:21px;height:21px}
  body.chat-mode .chat-head .person-info h3{font-size:15px;line-height:19px;margin-bottom:2px}
  body.chat-mode .chat-head .status{font-size:11px;line-height:15px;margin:0}
  body.chat-mode .messages{flex:1 1 0;min-height:0;min-width:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;padding:8px 2px 10px;gap:8px;overflow-anchor:none}
  body.chat-mode .message{max-width:88%;min-width:70px}
  body.chat-mode .bubble{font-size:15px;line-height:1.35;padding:8px 11px;border-radius:15px}
  body.chat-mode .bubble .message-time{font-size:10px;margin-top:5px}
  body.chat-mode .composer{flex:0 0 auto;display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:end;gap:7px;width:100%;max-width:100%;min-width:0;margin:0;padding:6px 5px calc(6px + env(safe-area-inset-bottom));border-radius:18px 18px 0 0;overflow-anchor:none}
  body.chat-mode.keyboard-open .composer{padding-bottom:6px}
  body.chat-mode .composer-box{width:100%;min-width:0;overflow:hidden;padding:0 5px;border-radius:23px}
  body.chat-mode .composer-box button{width:30px;height:40px;padding:4px;flex-shrink:0}
  body.chat-mode .composer-box button svg{width:21px;height:21px}
  body.chat-mode .composer textarea{font-size:16px;line-height:22px;width:100%;min-width:0;height:40px;max-height:100px;padding:9px 4px}
  body.chat-mode .send-btn{width:44px;height:44px;min-width:0}
  body.chat-mode .send-btn svg{width:23px;height:23px}
  body.chat-mode #toast{bottom:calc(100dvh - var(--chat-viewport-height,100dvh) + 70px)}
}
/* Reserve timestamp space on the final text line, including wrapped messages. */
.message .bubble{position:relative;font-size:16px;line-height:1.35;padding:8px 11px}
.message .message-content{white-space:pre-wrap;overflow-wrap:anywhere}
.message-time-space{display:inline-block;visibility:hidden;height:0;margin-left:9px;font-size:11px;line-height:12px;white-space:nowrap;vertical-align:baseline}
.message .bubble .message-time{position:absolute;right:11px;bottom:6px;float:none;margin:0;font-size:11px;line-height:12px;white-space:nowrap;color:#b3a0c9;pointer-events:none}
.message.mine .bubble .message-time{color:#dfc9ff}
.message.has-media .bubble{padding-bottom:24px}
@media(max-width:760px){  .dialogs-view .page-head{margin-bottom:12px}
  .dialogs-view .page-head h1{font-size:23px;line-height:29px;letter-spacing:-.6px}
  .dialogs-view .tabs{margin:12px 0 10px}
  .dialogs-view .tab{padding:8px 17px;font-size:14px;line-height:20px}
  .dialogs-view .dialog-row{position:relative;display:grid;grid-template-columns:56px minmax(0,1fr) auto;gap:12px;min-height:78px;padding:10px 0;border-bottom:0;align-items:center}
  .dialogs-view .dialog-row:after{content:"";position:absolute;bottom:0;left:68px;right:0;height:1px;background:var(--line)}
  .dialogs-view .dialog-row .avatar{width:56px;height:56px;font-size:29px}
  .dialogs-view .dialog-copy strong{display:block;font-size:17px;line-height:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .dialogs-view .dialog-copy p{font-size:15px;line-height:21px;margin:3px 0 0}
  .dialogs-view .dialog-time{align-self:start;padding-top:5px;font-size:13px;line-height:19px;white-space:nowrap}
  .dialogs-view .unread{width:max-content;min-width:21px;margin:6px 0 0 auto;padding:1px 6px;font-size:12px;line-height:19px;text-align:center}
  body.chat-mode .message .bubble{font-size:16px;line-height:1.35;padding:8px 11px}
  body.chat-mode .message .bubble .message-time{font-size:11px;margin:0}
  body.chat-mode .message.has-media .bubble{padding-bottom:24px}
}
/* Keep the chat inside Safari's visual viewport across repeated keyboard opens. */
@media(max-width:760px){  body.chat-mode{position:static}
  body.chat-mode .shell{position:absolute;top:var(--chat-viewport-top,0px);left:0;right:0;width:100%;max-width:none;margin:0;height:var(--chat-viewport-height,100dvh);min-height:0;overflow:hidden;transition:none}
}
/* Photos occupy their own message surface, without padding around the image. */
.message{flex-shrink:0}
.message.photo-message{width:min(66vw,320px);min-width:0;max-width:86%}
.message.photo-message .bubble,body.chat-mode .message.photo-message .bubble{padding:0;border:0;overflow:hidden;border-radius:15px;background:#21192f}
.message.photo-message .message-content{display:block;white-space:normal}
.message.photo-message img{display:block;width:100%;max-width:100%;height:auto;max-height:none;border-radius:0;object-fit:contain}
.message.photo-message:not(.has-caption) .message-time{right:7px;bottom:7px;padding:3px 6px;border-radius:9px;background:#0008;color:#fff;line-height:12px}
.message.photo-message .photo-caption{padding:8px 11px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.35}
.message.photo-message.has-caption.mine .bubble{background:linear-gradient(120deg,#9e5bff,#682dec)}
.message.photo-message.has-caption .message-time{bottom:6px}
.attachment-draft{position:relative;grid-column:1/-1;flex:0 0 100%;height:82px;width:82px;margin-bottom:4px}
.attachment-draft[hidden]{display:none}
.attachment-draft img{display:block;width:82px;height:82px;object-fit:cover;border-radius:12px;border:1px solid #70528c}
.composer:has(.attachment-draft:not([hidden])){display:grid;grid-template-columns:minmax(0,1fr) 52px;gap:8px 10px}
body.chat-mode .composer:has(.attachment-draft:not([hidden])){grid-template-columns:minmax(0,1fr) 44px;gap:6px 7px}
dialog.photo-viewer{position:fixed;inset:auto;top:var(--photo-viewer-top,0px);left:0;margin:0;width:100vw;max-width:none;height:var(--photo-viewer-height,100dvh);max-height:none;padding:0;border:0;border-radius:0;background:#000;box-shadow:none;overflow:hidden;color:#fff}
dialog.photo-viewer[open]{display:flex;flex-direction:column}
dialog.photo-viewer::backdrop{background:#000;backdrop-filter:none}
.photo-viewer-head{position:relative;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:12px;flex:0 0 auto;padding:calc(env(safe-area-inset-top) + 12px) 16px 12px;font-size:17px}
.photo-viewer-head button{width:44px;height:44px;display:grid;place-items:center;background:#1c1c1c;border:1px solid #ffffff30;border-radius:50%;color:#fff;padding:0;flex-shrink:0}
.photo-viewer-head button:focus:not(:focus-visible),.photo-viewer-actions button:focus:not(:focus-visible){outline:none;box-shadow:none}
.photo-viewer-head button svg{width:25px;height:25px;stroke:currentColor;stroke-width:1.8;fill:none;stroke-linecap:round;stroke-linejoin:round}
.photo-viewer-identity{justify-self:center;min-width:0;max-width:280px;width:100%;display:flex;flex-direction:column;align-items:center;padding:5px 14px;background:#1c1c1c;border:1px solid #ffffff30;border-radius:28px;line-height:1.3}
.photo-viewer-identity strong,.photo-viewer-identity span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.photo-viewer-identity span{color:#999;font-size:13px;font-weight:400}
.photo-viewer-stage{display:flex;align-items:center;justify-content:center;flex:1 1 0;min-height:0;overflow:hidden}
.photo-viewer-stage img{display:block;width:100%;height:100%;object-fit:contain;touch-action:pinch-zoom}
.photo-viewer-caption{flex:0 0 auto;max-height:15%;overflow:auto;padding:12px 17px;font-size:16px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.message.photo-message,body.chat-mode .message.photo-message{max-width:min(65%,300px)}
.message.photo-message .bubble,body.chat-mode .message.photo-message .bubble{border:1px solid #a66ae8;border-radius:16px;background:#281f36}
.message.photo-message.mine .bubble,body.chat-mode .message.photo-message.mine .bubble{background:linear-gradient(120deg,#9e5bff,#682dec);border-color:#ab70f2}
/* Profile: portrait and identity above vertically stacked fields. */
.profile-redesign{max-width:560px;margin:0 auto}
.profile-redesign .profile-top{display:flex;flex-direction:column;align-items:center;padding:22px 0 32px}
.profile-avatar-wrap{position:relative}
.profile-redesign .profile-top .avatar{width:132px;height:132px}
.avatar-edit{position:absolute;right:-3px;bottom:-3px;width:44px;height:44px;display:grid;place-items:center;border-radius:50%;border:4px solid var(--bg);background:linear-gradient(130deg,#bc7aff,#7833ee);box-shadow:0 5px 20px #8738ff33}
.avatar-edit svg{width:22px;height:22px}
.profile-identity{display:flex;justify-content:center;align-items:baseline;gap:10px;max-width:100%;margin:24px 0 0;font-size:27px;line-height:1.25;letter-spacing:-.6px}
.profile-identity>span:first-child{overflow-wrap:anywhere;min-width:0}
.profile-redesign form{border:0;background:none;padding:0}
.profile-redesign .form-grid{gap:22px}
.profile-redesign .form-grid label{display:flex;flex-direction:column;align-items:stretch;gap:10px;font-size:16px;color:var(--text);font-weight:600}
.profile-redesign .form-grid .field{width:100%;height:54px;border-radius:16px;border-color:#4b395f;background:linear-gradient(120deg,#2a2038,#20182d);font-size:16px;padding:0 18px;font-weight:400}
.nickname-field{position:relative}
.profile-redesign .nickname-field .field{padding-right:68px}
.nickname-field>span{position:absolute;right:17px;top:18px;color:var(--muted);font-weight:400;font-size:13px}
.nickname-hint{margin:-12px 0 0;font-size:12px;line-height:1.5;color:var(--muted)}
.profile-redesign .profile-actions{margin-top:26px}
.profile-redesign .profile-actions button{min-height:52px;font-size:16px;border-radius:16px}
.random-avatar{width:100%;margin-bottom:18px;padding:12px}
.profile-redesign .optional{font-size:12px;font-weight:400;color:var(--muted)}
@media(max-width:760px){  .profile-redesign .profile-top{padding-top:12px}
  .profile-redesign .settings{margin-top:28px}
}
/* Compact chat identity and avatar presence. */
.dialogs-view .dialog-identity{display:flex;align-items:baseline;gap:5px;min-width:0;line-height:22px}
.dialogs-view .dialog-identity strong{display:block;flex:0 1 auto;min-width:0;max-width:60%;font-size:16px;line-height:22px}
.dialogs-view .avatar i{display:block;width:13px;height:13px;right:0;bottom:0;border:2px solid var(--bg);border-radius:50%;background:#43ed80;box-shadow:none}
.dialogs-view .dialog-identity{gap:0}
.dialogs-view .dialog-identity strong{max-width:none;flex:0 1 auto}
.dialogs-view .dialog-copy p{margin-top:2px}
.dialogs-view .dialog-row{min-height:84px}
.dialogs-view .dialog-row{min-height:78px}
.dialogs-view .dialog-copy p{margin-top:3px}
/* Search filters: modal sheet with draft controls. */
dialog.filter-sheet{width:min(100%,560px);max-width:560px;max-height:90dvh;padding:24px;border-radius:26px;background:#1c142c;color:var(--text);border:1px solid #4c365f;overflow-y:auto}
.filter-sheet::backdrop{background:#0009;backdrop-filter:blur(2px)}
.filter-sheet .modal-head{margin-bottom:24px}
.filter-sheet .modal-head h2{font-size:24px}
@media(max-width:760px){  dialog.filter-sheet{position:fixed;inset:auto 0 0;margin:0;max-width:none;width:100%;border-radius:28px 28px 0 0;padding:28px 24px calc(20px + env(safe-area-inset-bottom));max-height:90dvh;animation:filter-rise .22s ease-out}
  .filter-sheet:before{content:"";display:block;width:42px;height:4px;background:#695477;border-radius:3px;margin:-16px auto 22px}
}
@keyframes filter-rise{  from{transform:translateY(70px);opacity:.4}
  to{transform:translateY(0);opacity:1}
}
@media(prefers-reduced-motion:reduce){  dialog.filter-sheet{animation:none}
}
.auth-brand-button{width:100%;padding:0;border:0;background:transparent;color:inherit;border-radius:14px}
.auth-brand-button:hover{color:#dec6ff}
.auth-brand-button:active{opacity:.85}
body.welcome-mode #main{display:block;padding-bottom:0}
@media(max-width:760px){  body.welcome-mode #main{padding-bottom:0}
}
/* First-visit introduction. */
body.welcome-mode #main{padding:40px 24px;min-height:100dvh}
.welcome-avatars .avatar:nth-child(even){transform:translateY(-10px) rotate(8deg)}
@media(max-width:760px){  body.welcome-mode #main{padding:30px 24px;min-height:100dvh;min-height:100svh}
}
.dialog-time-line{display:flex;align-items:center;justify-content:flex-end;gap:4px}
.dialog-receipt{display:inline-flex;align-items:center;color:#4c9bff;flex-shrink:0}
.dialog-receipt svg{width:21px;height:16px;stroke-width:1.8}
/* Keep search and chats at the same heading, nickname and avatar scale. */
:root{--directory-heading-size:30px;--directory-heading-line:1.2;--directory-heading-spacing:-.8px;--directory-avatar-size:64px;--directory-avatar-symbol:32px;--directory-name-size:16px;--directory-name-line:22px}
.dialogs-view .page-head h1{font-size:var(--directory-heading-size);line-height:var(--directory-heading-line);letter-spacing:var(--directory-heading-spacing)}
.dialogs-view .dialog-row .avatar{width:var(--directory-avatar-size);height:var(--directory-avatar-size);font-size:var(--directory-avatar-symbol)}
.dialogs-view .dialog-copy strong{font-size:var(--directory-name-size);line-height:var(--directory-name-line);font-weight:700}
@media(max-width:760px){  :root{--directory-heading-size:23px;--directory-heading-line:29px;--directory-heading-spacing:-.6px;--directory-avatar-size:56px;--directory-avatar-symbol:29px;--directory-name-size:17px}
}
body.welcome-mode #main{padding:30px 24px}
.welcome-info{width:min(560px,calc(100% - 30px));max-height:85dvh;overscroll-behavior:contain}
.welcome-info .modal-head{position:sticky;top:-25px;background:#1b132c;z-index:1;padding:12px 0;margin-top:-12px}
@media(max-width:760px){  .welcome-info .modal-head h2{font-size:20px}
}
/* The ribbon mark replaces the o on welcome and authentication screens. */
.auth-brand .anoveyl-wordmark{display:inline-block;font-size:40px;font-weight:800;letter-spacing:-1.4px;line-height:1.25;white-space:nowrap;color:var(--text)}
.auth-brand .anoveyl-wordmark .wordmark-o{display:inline-block;width:.8em;height:.83em;margin:0 .015em;vertical-align:-.14em;object-fit:contain;border-radius:0;box-shadow:none}
.auth-brand-button:hover .anoveyl-wordmark{color:#dec6ff}
@media(max-width:760px){  .auth-brand .anoveyl-wordmark{font-size:38px}
}
body.welcome-mode #main{padding:16px 20px}
@media(max-width:760px){  body.welcome-mode #main{padding:14px 20px}
}
/* One continuous conversation header with a centered identity. */
body.chat-mode .chat-head{display:grid;grid-template-columns:76px minmax(0,1fr) 76px;align-items:center;gap:8px;flex:0 0 auto;min-height:48px;padding:1px 10px;margin:0 0 8px;background:#251c34;border:1px solid #58416866;border-radius:22px;overflow-anchor:none}
body.chat-mode .chat-head>.icon-btn:first-child,body.chat-mode .chat-head #chat-menu{position:static;background:transparent;border:0;border-radius:0;margin:0;box-shadow:none}
body.chat-mode .chat-head>.icon-btn:first-child{justify-self:start;width:40px;height:44px}
body.chat-mode .chat-head .person-info{min-width:0;text-align:center}
body.chat-mode .chat-head .person-info h3{font-size:17px;line-height:22px;margin:0 0 2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.chat-mode .chat-head .status{display:block;font-size:11px;line-height:16px;color:var(--muted);margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.chat-mode .chat-head .avatar{width:40px;height:40px;flex:0 0 40px}
body.chat-mode .chat-head #chat-menu{width:28px;height:44px;flex:0 0 28px}
@media(max-width:760px){  body.chat-mode .chat-head{grid-template-columns:68px minmax(0,1fr) 68px;gap:4px;min-height:48px;padding:1px 8px;border-radius:20px}
  body.chat-mode .chat-head .avatar{width:36px;height:36px;flex-basis:36px}
  body.chat-mode .chat-head .person-info h3{font-size:16px;line-height:21px}
  body.chat-mode .chat-head .status{font-size:10px;line-height:15px}
}
/* The avatar opens the person's profile; no separate overflow button. */
body.chat-mode .chat-head{grid-template-columns:44px minmax(0,1fr) 44px}
body.chat-mode .chat-head #chat-menu.chat-person-menu{display:grid;place-items:center;justify-self:end;width:44px;height:44px;padding:2px;flex:none;border:0;background:transparent;border-radius:50%;cursor:pointer}
body.chat-mode .chat-head #chat-menu.chat-person-menu:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
body.chat-mode .chat-head #chat-menu.chat-person-menu:hover{background:#a875ff14}
.chat-person-profile{display:flex;flex-direction:column;align-items:center;text-align:center;padding:8px 0 18px;gap:8px}
.chat-person-profile .avatar.large{width:112px;height:112px}
.chat-person-profile h3{display:flex;align-items:center;justify-content:center;gap:8px;margin:8px 0 0;font-size:22px;overflow-wrap:anywhere}
.chat-person-profile p{margin:0;color:var(--muted);font-size:14px}
.chat-person-profile .chat-person-presence{font-size:12px}
/* A continuous Telegram-style composer bar, with photo attachment. */
body.chat-mode .composer,body.chat-mode .composer:has(.attachment-draft:not([hidden])){display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:end;gap:6px;width:100%;max-width:100%;margin:0;padding:5px 8px calc(5px + env(safe-area-inset-bottom));background:#251c34;border:0;border-top:1px solid #58416855;border-radius:0;box-shadow:none}
body.chat-mode.keyboard-open .composer{padding-bottom:5px}
body.chat-mode .composer-box{border:0;border-radius:0;background:transparent;box-shadow:none;padding:0;overflow:hidden}
body.chat-mode .composer-box #attach{width:36px;height:44px;padding:6px;color:#b8a7cb}
body.chat-mode .composer-box #attach svg{width:25px;height:25px}
body.chat-mode .composer textarea{height:44px;max-height:100px;padding:11px 6px;font-size:16px;line-height:22px;background:transparent}
body.chat-mode .composer textarea::placeholder{color:#a99aba}
body.chat-mode .composer .send-btn{width:44px;height:44px;border:0;border-radius:0;background:transparent;box-shadow:none;color:#c29aff}
body.chat-mode .composer .send-btn svg{width:27px;height:27px}
body.chat-mode .composer .send-btn:active{color:#e2ccff}
body.chat-mode .composer .attachment-draft{margin:3px 0 3px 4px}
@media(max-width:760px){  body.chat-mode #main{padding:6px 0 0}
  body.chat-mode .chat-head{margin-left:16px;margin-right:16px}
  body.chat-mode .messages{padding-left:10px;padding-right:10px}
}
.person-dialog .modal-head{justify-content:flex-end;margin-bottom:0}
.person-dialog .modal-head h2{display:none}
#close-modal{width:36px;height:36px;padding:0;display:grid;place-items:center;border-radius:50%;outline:none}
#close-modal:focus-visible{outline:none;background:#b890ff1c;color:#eee0ff}
/* Home Screen installation and iPhone safe areas. */
html.ios-device:not(.installed-app) .install-app{display:flex!important;align-items:center;justify-content:center}
html.ios-device:not(.installed-app) .settings .install-app{justify-content:flex-start}
.install-steps{padding-left:22px;margin:18px 0;color:var(--text);font-size:15px;line-height:1.7}
.install-steps li{padding:5px 0}
@media(display-mode:standalone){  body:not(.chat-mode){padding-top:env(safe-area-inset-top)}
  body.chat-mode #main{padding-top:calc(6px + env(safe-area-inset-top))}
  .mobile-nav{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
  body.auth-mode #main{min-height:calc(100svh - env(safe-area-inset-top));padding-bottom:calc(20px + env(safe-area-inset-bottom))}
}
/* The app interface does not expose browser text selection. */
body,body *{
 -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
}
input,textarea,[contenteditable="true"]{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
/* Shared circular age badge in search and chats. */
.dialogs-view .dialog-identity{display:flex;align-items:center;gap:8px;min-width:0}
.dialogs-view .dialog-identity strong{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dialogs-view .dialog-row{min-height:96px}
.dialogs-view .dialog-copy p{margin-top:4px}
@media(max-width:760px){  .dialogs-view .dialog-row{min-height:96px}
}
/* City follows the age badge on the chat identity line. */
.dialogs-view .dialog-row{min-height:78px}
@media(max-width:760px){  .dialogs-view .dialog-row{min-height:78px}
}
/* Age follows the nickname in the chat header. */
body.chat-mode .chat-head .chat-identity{display:flex;align-items:center;justify-content:center;gap:8px;min-width:0}
body.chat-mode .chat-head .chat-name{min-width:0;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* One rounded composer with photo and voice controls. */
body.chat-mode .composer,body.chat-mode .composer:has(.attachment-draft:not([hidden])){
 width:calc(100% - 16px);max-width:calc(100% - 16px);margin:6px 8px max(8px,env(safe-area-inset-bottom));padding:6px 8px;gap:4px;border:0;border-radius:28px;background:#211d2a;box-shadow:0 4px 18px #0002
}
body.chat-mode.keyboard-open .composer,body.chat-mode.keyboard-open .composer:has(.attachment-draft:not([hidden])){margin-bottom:8px;padding-bottom:6px}
body.chat-mode .composer-box #attach{display:grid;place-items:center;width:40px;height:44px;padding:7px;color:#aca4ba;flex-shrink:0}
body.chat-mode .composer-box #attach svg{width:27px;height:27px;stroke-width:1.8}
body.chat-mode .composer textarea{padding-left:7px;color:#f5f1fc}
body.chat-mode .composer textarea::placeholder{color:#a59eaf}
body.chat-mode .composer .send-btn{border-radius:50%;color:#aca4ba}
body.chat-mode .composer .send-btn[aria-label="Отправить сообщение"]{color:#c29aff}
body.chat-mode .composer .attachment-draft{margin:6px 0 4px 7px}
/* Welcome identity. */
/* Clean gallery symbol with balanced stroke and optical size. */
body.chat-mode .composer-box #attach svg{width:26px;height:26px;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round}
/* Presence on the chat avatar and an incoming typing indicator. */
body.chat-mode .chat-head .avatar i{display:block;width:11px;height:11px;right:-1px;bottom:-1px;border:2px solid #251c34;background:#43ed80;border-radius:50%;box-shadow:none}
body.chat-mode .chat-head .status.peer-typing{color:#c29aff}
.typing-dots{display:inline-flex;align-items:center;gap:2px;margin-left:3px;vertical-align:middle}
.typing-dots i{display:block;width:3px;height:3px;background:currentColor;border-radius:50%;animation:typing-pulse 1.2s ease-in-out infinite}
.typing-dots i:nth-child(2){animation-delay:.15s}
.typing-dots i:nth-child(3){animation-delay:.3s}
@keyframes typing-pulse{  0%,60%,100%{opacity:.35;transform:translateY(0)}
  30%{opacity:1;transform:translateY(-2px)}
}
@media(prefers-reduced-motion:reduce){  .typing-dots i{animation:none;opacity:1}
}
/* Lower the composer by halving its empty bottom inset. */
body.chat-mode .composer,body.chat-mode .composer:has(.attachment-draft:not([hidden])){margin-bottom:max(4px,calc(env(safe-area-inset-bottom) / 2))}
body.chat-mode.keyboard-open .composer,body.chat-mode.keyboard-open .composer:has(.attachment-draft:not([hidden])){margin-bottom:4px}
/* Active presence uses a saturated purple accent. */
body.chat-mode .chat-head .status:not(.off){color:#b469ff;font-weight:500}
/* Approved quiet city wallpaper, only inside conversations. */
body.chat-mode .chat-layout{background-color:#100b20;background-image:url("assets/chat-wallpaper-night-v3.png");background-size:260px 390px;background-position:center top;background-repeat:repeat}
/* Hover is for a mouse; touch rows open on the first completed tap. */
.dialog-row{touch-action:pan-y pinch-zoom}
@media(hover:hover) and (pointer:fine){
  .dialog-row:hover{background:#ad8aff05}
}
/* Keep bottom navigation interactive after native iOS history gestures. */
#mobile-nav{pointer-events:auto}
#mobile-nav .nav-item{touch-action:manipulation;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
@media(hover:none){  #mobile-nav .nav-item:focus:not(:focus-visible){outline:none}
}
/* Hide scroll indicators without disabling scrolling. */
html,body,*{scrollbar-width:none;-ms-overflow-style:none}
*::-webkit-scrollbar{display:none;width:0;height:0}
.swipe-return-preview{position:fixed;inset:0;background:#100b20;z-index:1;pointer-events:none;overflow:hidden}
body.swipe-back-active main{position:relative;z-index:2;background:transparent}
body.swipe-back-active .chat-layout{will-change:transform;box-shadow:-8px 0 24px #0004}
body.swipe-back-active .chat-layout,body.swipe-back-active main{overflow-x:clip}
.swipe-return-preview{will-change:transform}
/* Root sections scroll vertically and never pan horizontally. */
body:not(.chat-mode):not(.auth-mode){overflow-x:hidden;overscroll-behavior-x:none}
body:not(.chat-mode):not(.auth-mode) main,body:not(.chat-mode):not(.auth-mode) .mobile-nav{touch-action:pan-y pinch-zoom;overscroll-behavior-x:none}
/* Match the reference's single photo frame and heavier microphone. */
body.chat-mode .composer-box #attach svg{width:30px;height:30px;stroke-width:3}
body.chat-mode .composer .send-btn[aria-label="Записать голосовое"] svg{width:30px;height:30px;stroke-width:3}
body.chat-mode .composer-box #attach,body.chat-mode .composer .send-btn[aria-label="Записать голосовое"]{color:#fff}
/* Compact GPT-sized composer with Telegram's bottom clearance. */
@media(max-width:760px){  body.chat-mode:not(.keyboard-open) .shell{position:fixed;top:0}
  body.chat-mode #main{display:flex;flex-direction:column;height:100%;min-height:0}
  body.chat-mode .chat-layout{flex:1 1 0;height:auto;min-height:0}
  body.chat-mode .chat-head{flex-shrink:0}
  body.chat-mode .composer,body.chat-mode .composer:has(.attachment-draft:not([hidden])){width:82%;max-width:560px;min-height:50px;margin:6px auto calc(env(safe-area-inset-bottom) + 8px);padding:3px 8px;grid-template-columns:minmax(0,1fr) 40px;border-radius:26px;flex-shrink:0}
  body.chat-mode .composer textarea{height:44px;min-height:44px;max-height:100px}
  body.chat-mode .composer-box #attach,body.chat-mode .composer .send-btn{width:40px;height:44px}
  body.chat-mode.keyboard-open .composer,body.chat-mode.keyboard-open .composer:has(.attachment-draft:not([hidden])){margin-bottom:6px;padding:3px 8px}
}
/* Continue the wallpaper through the footer and iPhone home indicator area. */
html.chat-viewport-locked,body.chat-mode{background-color:#100b20;background-image:url("assets/chat-wallpaper-night-v3.png");background-size:260px 390px;background-repeat:repeat;background-position:center 6px}
@media(display-mode:standalone){  html.chat-viewport-locked,body.chat-mode{background-position:center calc(6px + env(safe-area-inset-top))}
}
body.chat-mode .composer-box #attach svg,body.chat-mode .composer .send-btn[aria-label="Записать голосовое"] svg{width:24px;height:24px;stroke-width:3}
/* One foreground screen above a frozen return screen, independent of nested stacking contexts. */
body.chat-mode .shell{z-index:1}
.swipe-return-preview{z-index:10}
body.swipe-back-active .shell{z-index:20;will-change:transform;background-color:#100b20;background-image:url("assets/chat-wallpaper-night-v3.png");background-size:260px 390px;background-repeat:repeat;background-position:center 6px;box-shadow:-8px 0 24px #0004}
body.swipe-back-active main{z-index:auto}
body.swipe-back-active .chat-layout{box-shadow:none;will-change:auto}
body.chat-mode::before{content:"";position:fixed;top:0;left:0;right:0;height:100vh;height:calc(100lvh + env(safe-area-inset-bottom));z-index:0;pointer-events:none;background:#100b20 url("assets/chat-wallpaper-night-v3.png") center 6px / 260px 390px repeat}
@media(display-mode:standalone){  body.chat-mode::before,body.swipe-back-active .shell{background-position:center calc(6px + env(safe-area-inset-top))}
}
/* The root canvas and return preview use the same flat background. */
html:not(.chat-viewport-locked){background:#100b20}
body:not(.chat-mode) main,.swipe-return-preview{background:#100b20}
/* The screen canvas includes the PWA's lower safe area; the keyboard only resizes chat content. */
@media(max-width:760px){  html.chat-viewport-locked,body.chat-mode{height:var(--app-canvas-height,100lvh);min-height:var(--app-canvas-height,100lvh)}
  body.chat-mode::before{height:var(--app-canvas-height,100lvh)}
  body.swipe-back-active .shell{overflow:visible}
  body.swipe-back-active .shell::after{content:"";position:absolute;top:100%;left:0;right:0;height:max(0px,calc(var(--app-canvas-height,100lvh) - var(--chat-viewport-height,100dvh)));pointer-events:none;background:#100b20 url("assets/chat-wallpaper-night-v3.png") center calc(6px - var(--chat-viewport-height,100dvh)) / 260px 390px repeat}
}
@media(display-mode:standalone){  body.swipe-back-active .shell::after{background-position:center calc(6px + env(safe-area-inset-top) - var(--chat-viewport-height,100dvh))}
}
/* Photo viewing uses the same unified header as the conversation. */
.photo-viewer-head{grid-template-columns:44px minmax(0,1fr) 44px;gap:8px;min-height:48px;margin:calc(env(safe-area-inset-top) + 8px) 16px 8px;padding:1px 10px;background:#251c34;border:1px solid #58416866;border-radius:22px}
.photo-viewer-head #close-photo{background:transparent;border:0;border-radius:12px;width:44px;height:44px}
.photo-viewer-identity{background:transparent;border:0;border-radius:0;padding:0;max-width:100%;line-height:1.35}
.photo-viewer-identity strong{font-size:17px;font-weight:700}
.photo-viewer-identity span{color:#9e90b7;font-size:13px}
.photo-viewer-stage img,.message.photo-message img{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}
@media(max-width:760px){  .photo-viewer-head{gap:4px;min-height:48px;padding:1px 8px;border-radius:20px}
}
/* Hold actions, replies and multi-message selection. */
.message{position:relative;-webkit-touch-callout:none}
.message .bubble{-webkit-user-select:none;user-select:none}
.message-selecting .message::before{content:'';position:absolute;left:var(--selection-left,0px);top:50%;transform:translateY(-50%);width:24px;height:24px;display:grid;place-items:center;background:#21192b99;border:1.5px solid #e6d9ff99;color:#fff;border-radius:50%;font-size:15px;z-index:3;pointer-events:auto}
.message-selecting .message.selected::before{content:'✓';background:#a66aff;border-color:#a66aff}
.message-selecting .message:not(.mine)>.bubble{translate:36px 0}
.message-selecting .message>.bubble{transition:translate 200ms ease}
.message.selected .bubble{box-shadow:none}
@media(prefers-reduced-motion:reduce){  .message-selecting .message>.bubble{transition:none}
}
.message-reply{display:flex;flex-direction:column;border-left:3px solid #c49aff;background:#ffffff0b;border-radius:4px;padding:5px 8px;margin:0 0 6px;max-width:100%;font-size:12px;line-height:1.4;overflow:hidden}
.message-reply strong{color:#d5b4ff;font-size:12px}
.message-reply span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;color:#e1d8ed}
.photo-message .message-reply{margin:6px 7px}
.reply-draft{grid-column:1/-1;display:flex;align-items:center;gap:8px;min-width:0;margin:5px 5px 0}
.reply-draft[hidden]{display:none}
.reply-draft .message-reply{flex:1;min-width:0;margin:0}
.reply-draft>button{border:0;background:transparent;color:#b9a5d1;font-size:24px;padding:2px 6px}
body.chat-mode .composer.selecting{display:none}
.message-selection-bar{flex-shrink:0;display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 16px calc(env(safe-area-inset-bottom) + 12px);background:#251c34;border-radius:20px 20px 0 0;font-size:13px}
.message-selection-bar button{border:0;background:transparent;color:#c69aff;padding:7px}
.message-selection-bar>span{color:#e9e0f5}
dialog.message-context{position:fixed;inset:auto;left:var(--context-left,16px);top:var(--context-top,100px);margin:0;padding:5px;width:min(250px,calc(100vw - 32px));max-width:none;background:#251c34;border:1px solid #584168;border-radius:20px;box-shadow:0 12px 40px #0008;color:#f5f1fc;overflow:hidden}
dialog.message-context::backdrop{background:#08051099;backdrop-filter:blur(4px)}
.message-context-actions button{display:flex;align-items:center;gap:12px;width:100%;min-height:48px;padding:10px 16px;background:transparent;border:0;text-align:left;font-size:15px;color:#f5f1fc}
.message-context-actions button:focus:not(:focus-visible){outline:none}
.message-context-actions button:last-child{border-top:1px solid #ffffff12}
.message-context-actions .danger{color:#f47b89}
.message-delete .delete-message-actions{display:flex;flex-direction:column;gap:3px}
.delete-message-actions button{border:0;background:transparent;text-align:left;padding:13px 9px;font-size:15px;color:#f47b89}
.delete-message-actions #cancel-delete{color:#c8b6dd;border-top:1px solid #ffffff12}
.photo-viewer-bottom-space{flex:0 0 calc(env(safe-area-inset-bottom) + 12px)}
@keyframes photo-viewer-appear{  from{opacity:.3}
  to{opacity:1}
}
.message-reply[role=button]{cursor:pointer}
.message-reply[role=button]:focus-visible{outline:2px solid #c391ff;outline-offset:2px}
.message{touch-action:pan-y pinch-zoom}
.swipe-reply-indicator{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#38254d;color:#cda6ff;opacity:0;pointer-events:none;transition:background 120ms ease}
.swipe-reply-indicator svg{width:18px;height:18px;fill:currentColor;stroke:none}
.reply-swipe-ready .swipe-reply-indicator{background:#8b4be1;color:#fff}
.message.reply-target .bubble{animation:reply-target-flash 1.5s ease}
@keyframes reply-target-flash{  0%,20%{box-shadow:0 0 0 3px #c391ff,0 0 22px #a36bff55}
  100%{box-shadow:0 0 0 0 transparent}
}
@media(prefers-reduced-motion:reduce){  .message.reply-target .bubble{animation:none;outline:2px solid #c391ff}
  .swipe-reply-indicator{transition:none}
}
/* The conversation header follows the composer's horizontal footprint. */
@media(max-width:760px){  body.chat-mode .chat-head{width:82%;max-width:560px;margin-left:auto;margin-right:auto}
  .photo-viewer-head{width:82%;max-width:560px;margin-left:auto;margin-right:auto}
}
/* Photo unfolds from the message and returns there on dismissal. */
dialog.photo-viewer,dialog.photo-viewer::backdrop{background:transparent}
.photo-viewer-shade{position:absolute;inset:0;z-index:0;background:#000;opacity:var(--photo-shade-opacity,1);pointer-events:none}
.photo-viewer-head,.photo-viewer-caption,.photo-viewer-bottom-space{z-index:2;opacity:var(--photo-chrome-opacity,1);transition:opacity 180ms ease}
.photo-viewer-caption,.photo-viewer-bottom-space{position:relative}
.photo-viewer-stage{position:relative;z-index:1;overflow:visible;touch-action:none}
.photo-viewer-stage img{width:auto;height:auto;max-width:100%;max-height:100%;object-fit:contain;transform-origin:center;will-change:transform;opacity:0;touch-action:none}
.photo-viewer-settling .photo-viewer-shade{transition:opacity 260ms ease}
.photo-controls-hidden .photo-viewer-head,.photo-controls-hidden .photo-viewer-caption{pointer-events:none}
@media(prefers-reduced-motion:reduce){  .photo-viewer-head,.photo-viewer-caption,.photo-viewer-bottom-space,.photo-viewer-settling .photo-viewer-shade{transition:none}
}
/* Age badges keep their established shape and indicate the profile's sex. */
#mobile-nav{z-index:30;isolation:isolate;touch-action:none}
#mobile-nav .nav-item{touch-action:none}
/* Lift the held message above the blurred chat, then unfold its actions. */
dialog.message-context{inset:0;left:0;top:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:hidden}
dialog.message-context::backdrop{background:transparent;backdrop-filter:none}
.message-context-shade{position:absolute;inset:0;background:#080510a8;backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px)}
.message-context-actions{position:absolute;z-index:2;padding:5px;background:#251c34;border:1px solid #584168;border-radius:20px;box-shadow:0 12px 40px #0008;overflow:hidden}
.message-context-preview{position:absolute;z-index:1;margin:0;pointer-events:none;min-width:0;filter:drop-shadow(0 8px 18px #0004)}
.message-context-preview .bubble{visibility:visible!important;transform:none!important;width:100%;height:100%}
.message-context-preview{pointer-events:auto}
.message-context-preview .context-selectable,.message-context-preview .context-selectable *{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default;cursor:text}
.message-context-preview img,.message-context-preview audio,.message-context-preview .message-time,.message-context-preview .reply-quote{pointer-events:none;-webkit-user-select:none;user-select:none}
.message-context-preview .context-selectable::selection,.message-context-preview .context-selectable *::selection{background:#a57bff77}
.message-context-shade{background:#08051080;backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
.message-context-preview:focus{outline:none}
.message-context-preview,.message-context-actions{will-change:transform,opacity}
/* GPT-style send control; the empty composer continues to show its mic. */
body.chat-mode .composer .send-btn[aria-label="Отправить сообщение"]{width:36px;height:36px;min-width:36px;padding:0;justify-self:center;align-self:center;border:0;border-radius:50%;background:#a855f7;color:#fff;box-shadow:none}
body.chat-mode .composer .send-btn[aria-label="Отправить сообщение"] svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round}
body.chat-mode .composer .send-btn[aria-label="Отправить сообщение"]:active{background:#9341e7;color:#fff}
/* Matching quiet circles for attachment and voice, inside the composer. */
body.chat-mode .composer-box #attach,body.chat-mode .composer .send-btn[aria-label="Записать голосовое"]{width:36px;height:36px;min-width:36px;flex:0 0 36px;padding:0;align-self:center;justify-self:center;display:grid;place-items:center;border:0;border-radius:50%;background:#302c37;color:#aca4ba;box-shadow:none}
body.chat-mode .composer-box #attach svg,body.chat-mode .composer .send-btn[aria-label="Записать голосовое"] svg{width:22px;height:22px}
body.chat-mode .composer-box #attach:active,body.chat-mode .composer .send-btn[aria-label="Записать голосовое"]:active{background:#3a3542;color:#fff}
/* Floating bars cover the full-height history instead of clipping its edges. */
@media(max-width:760px){  body.chat-mode .chat-layout{position:relative;display:block}
  body.chat-mode .messages{position:absolute;inset:0;width:100%;height:100%;z-index:0;padding-top:var(--chat-history-top,56px);padding-bottom:var(--chat-history-bottom,calc(64px + env(safe-area-inset-bottom)));scroll-padding-top:var(--chat-history-top,56px);scroll-padding-bottom:var(--chat-history-bottom,calc(64px + env(safe-area-inset-bottom)))}
  body.chat-mode .chat-head{position:absolute;top:0;left:9%;z-index:2;margin:0;width:82%}
  body.chat-mode .composer,body.chat-mode .composer:has(.attachment-draft:not([hidden])){position:absolute;left:9%;bottom:calc(env(safe-area-inset-bottom) + 8px);z-index:2;width:82%;margin:0}
  body.chat-mode.keyboard-open .composer,body.chat-mode.keyboard-open .composer:has(.attachment-draft:not([hidden])){bottom:6px;margin:0}
  body.chat-mode .message-selection-bar{position:absolute;left:0;right:0;bottom:0;z-index:2}
}
/* History reaches the screen edges, beneath the translucent floating bars. */
@media(max-width:760px){  body.chat-mode #main{padding:0}
  body.chat-mode .chat-head{top:6px;background:rgba(37,28,52,.84);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
  body.chat-mode .composer,body.chat-mode .composer:has(.attachment-draft:not([hidden])){background:rgba(33,29,42,.84);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
}
@media(max-width:760px) and (display-mode:standalone){  body.chat-mode .chat-head{top:calc(6px + env(safe-area-inset-top))}
}
/* Fade the entire edge region, including the gaps beside the floating bars. */
.results-label:not([hidden]){display:block;margin:12px 0 4px;font-size:13px;line-height:18px;color:var(--muted)}
@media(max-width:760px){  body.chat-mode .chat-layout::before,body.chat-mode .chat-layout::after{content:'';position:absolute;left:0;right:0;z-index:1;pointer-events:none;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
  body.chat-mode .chat-layout::before{top:0;height:calc(var(--chat-history-top,100px) + 16px);background:linear-gradient(to bottom,rgba(16,11,32,.88),rgba(16,11,32,.64) 65%,rgba(16,11,32,0));mask-image:linear-gradient(to bottom,#000 65%,transparent);-webkit-mask-image:linear-gradient(to bottom,#000 65%,transparent)}
  body.chat-mode .chat-layout::after{bottom:0;height:calc(var(--chat-history-bottom,100px) + 16px);background:linear-gradient(to top,rgba(16,11,32,.88),rgba(16,11,32,.64) 65%,rgba(16,11,32,0));mask-image:linear-gradient(to top,#000 65%,transparent);-webkit-mask-image:linear-gradient(to top,#000 65%,transparent)}
}
#support-send textarea{margin:10px 0}
/* Compact support entry beside the chats heading. */
.dialogs-view .page-head{align-items:center;justify-content:space-between}
/* Keep timestamp clearance identical to the rendered delivery receipt. */
.message .bubble .message-time,.message-time-space{display:inline-flex;align-items:center;gap:4px}
.message-receipt{display:inline-flex;flex-shrink:0}
.message-receipt svg{width:18px;height:13px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
/* Telegram-style receipt: one complete check and the trailing stroke of the second. */
.message .bubble .message-time,.message-time-space{gap:2px}
.message-receipt svg{width:16px;height:12px;stroke-width:1.45}
/* The chat list uses the same check geometry and size as message bubbles. */
.dialog-receipt svg{width:16px;height:12px;stroke-width:1.45}
.nav-item{position:relative}
.nav-chat-count{position:absolute;top:5px;right:8px;min-width:17px;height:17px;padding:0 4px;display:grid;place-items:center;background:#a96aff;color:#fff;border:2px solid var(--bg);border-radius:12px;font-size:10px;font-weight:700;line-height:1}
.nav-chat-count[hidden]{display:none}
.sidebar .nav-chat-count{top:50%;right:12px;transform:translateY(-50%)}
/* Active tab color is sufficient; the legacy underline must not move above the icon. */
.mobile-nav .nav-item.active::after{content:none;display:none}
/* Visible on the welcome and sign-in/registration screens. */
/* The list stays in normal flow: it cannot cover the next field or jump the iOS viewport. */
/* Support is available before registration and at the bottom of the profile. */
.support-contact{display:flex;flex-direction:column;align-items:center;gap:4px;margin:8px 0 0;padding:12px 0;color:var(--muted);font-size:12px;line-height:1.5;text-align:center}
.support-contact a{display:inline-flex;align-items:center;min-height:32px;color:#c6a6ff;text-underline-offset:3px}
.support-contact a:hover{text-decoration:underline}
.profile-redesign>.support-contact{margin-top:24px}
/* Credential dialogs need their own stacked layout, including outside auth/profile. */
.account-form{display:flex;flex-direction:column;gap:16px;min-width:0;margin:0}
.account-form>label{display:block;min-width:0;margin:0;color:#e5dbf1;font-size:14px;line-height:1.5}
.account-form .field{display:block;box-sizing:border-box;width:100%;max-width:100%;height:48px;min-height:48px;margin:8px 0 0;font-size:16px}
.account-form>.input-hint,.account-form>.auth-error,.account-form>[data-status]{margin:0;line-height:1.5;overflow-wrap:anywhere}
.account-form>[hidden],.account-form>[data-status]:empty{display:none}
.account-form>.primary{width:100%;min-height:48px}
.account-dialog .modal-head{align-items:flex-start}
.account-dialog .modal-head h2{min-width:0;line-height:1.3;overflow-wrap:anywhere}
.account-dialog .modal-head button{flex-shrink:0}
.messenger-profile .profile-actions button{width:100%}
.messenger-profile .form-grid{grid-template-columns:minmax(0,1fr)}
.messenger-profile #profile-error{color:#ffb3c7;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
.messenger-profile #reload-profile{padding:12px 16px;max-width:100%}
/* Circular preset selection. */
.avatar-options .avatar-option{border-radius:50%;aspect-ratio:1;padding:8px}
.avatar-options .avatar-option .avatar{border-radius:50%}
.avatar-options .avatar-option{padding:0;border:0;overflow:visible}
.avatar-options .avatar-option .avatar{display:block;width:100%;height:100%;margin:0;border-radius:50%}
.avatar-options .avatar-option.active{outline:2px solid var(--accent);outline-offset:3px}
.chat-open-error{padding:calc(24px + env(safe-area-inset-top)) 20px;max-width:560px;margin:auto}
.chat-open-error h1{font-size:24px}
.chat-open-error p{color:var(--muted)}
:is(#mobile-nav,.mobile-nav) [data-section] svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
:is(#mobile-nav,.mobile-nav) .active svg{filter:drop-shadow(0 0 5px #b56aff55)}
.avatar{position:relative}
.avatar-photo{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.avatar-photo[hidden]{display:none}
.avatar .presence-online{z-index:1}
.avatar-upload{display:block;text-align:center;cursor:pointer;margin-bottom:12px}
.avatar-editor{display:grid;gap:12px}
.avatar-editor canvas{width:min(100%,320px);height:auto;aspect-ratio:1;border-radius:50%;touch-action:none;justify-self:center;cursor:move}
.avatar-editor input[type=range]{width:100%}
.avatar-editor-hint{font-size:14px;color:var(--muted)}
.chat-name.chat-snow-trigger{touch-action:manipulation;-webkit-user-select:none;user-select:none;cursor:pointer}
.chat-snow-trigger:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:4px}
.chat-layout.chat-snow-active{position:relative;isolation:isolate}
.chat-snow-active>.messages{z-index:0}
.chat-snow-active>.chat-head,.chat-snow-active>.composer{z-index:2}
.chat-snow-layer{position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none}
/* The local/loading conversation reserves full height before adapter CSS arrives. */
@media(max-width:760px){  body.chat-mode #main>div:has(>.e2ee-conversation){height:100%;min-height:0}
  body.chat-mode .chat-layout.e2ee-conversation{height:100%;min-height:0;padding:0}
}
.local-conversation-error{position:absolute;top:var(--chat-history-top,70px);left:16px;right:16px;z-index:4;padding:12px 16px;border-radius:16px;background:#251c34f5;box-shadow:0 8px 28px #0005}
.local-conversation-error h1{font-size:16px;margin:0 0 8px}
.local-conversation-error p{font-size:13px;margin:8px 0}
/* Connection setup never delays or dims the local text composer. Sending stays guarded. */
.composer[data-connection-pending] button:disabled{opacity:1;cursor:default}
/* One gallery for conversation and PeerInfo; all metrics use the visual viewport. */
dialog.photo-gallery{position:fixed;inset:auto;top:var(--gallery-top,0px);left:0;width:100vw;max-width:none;height:var(--gallery-height,100dvh);max-height:none;margin:0;padding:0;border:0;border-radius:0;background:rgba(8,5,14,var(--gallery-shade,1));color:#fff;overflow:hidden;box-shadow:none;isolation:isolate}
dialog.photo-gallery[open]{display:flex;flex-direction:column}
dialog.photo-gallery::backdrop{background:transparent;backdrop-filter:none;-webkit-backdrop-filter:none}
dialog.photo-gallery .gallery-head{position:relative;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:12px;width:100%;padding:calc(env(safe-area-inset-top) + 10px) 14px 10px;flex:none;background:transparent;z-index:3}
.gallery-head>div{display:flex;flex-direction:column;align-items:center;min-width:0;padding:6px 12px;border-radius:26px;background:#251c34d9;border:1px solid #ffffff1a}
.gallery-head strong{font-size:17px;line-height:22px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gallery-head div>span{font-size:12px;line-height:17px;color:#c0b1d0}
.photo-gallery button.gallery-back,.photo-gallery button.gallery-save{display:grid;place-items:center;width:44px;height:44px;margin:0;padding:10px;border:1px solid #ffffff20;border-radius:50%;background:#251c34d9;color:#eee1ff}
.photo-gallery button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.photo-gallery .gallery-stage{position:relative;display:flex;align-items:center;justify-content:center;flex:1 1 0;min-height:0;min-width:0;overflow:hidden;touch-action:none}
.photo-gallery .gallery-stage>img{display:block;flex:none;max-width:none;max-height:none;object-fit:contain;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;will-change:transform;border-radius:0}
.gallery-footer{position:relative;flex:none;display:flex;flex-direction:column;align-items:center;gap:7px;width:100%;padding:8px 12px calc(10px + env(safe-area-inset-bottom));z-index:2;background:linear-gradient(transparent,#08050eeb)}
.photo-gallery .shared-viewer-caption{width:100%;max-height:15vh;padding:0 6px;margin:0;overflow:auto;font-size:15px;line-height:21px;white-space:pre-wrap;text-align:left}
.photo-gallery .shared-viewer-caption:empty{display:none}
.gallery-strip{display:flex;justify-content:center;gap:4px;max-width:100%;overflow:hidden;min-height:42px}
.gallery-strip[hidden]{display:none}
.photo-gallery .gallery-thumb{flex:none;display:grid;place-items:center;width:30px;height:42px;padding:0;border:2px solid transparent;border-radius:4px;background:#30213d;color:#b7a6c7;font-size:12px;overflow:hidden;transition:width .2s,border-color .2s}
.photo-gallery .gallery-thumb[aria-current=true]{width:46px;border-color:#b884ff}
.gallery-thumb img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
.gallery-counter{font-size:12px;line-height:16px;color:#c0b1d0;font-variant-numeric:tabular-nums}
.gallery-head,.gallery-footer{transition:opacity .18s ease}
.gallery-chrome-hidden .gallery-head,.gallery-chrome-hidden .gallery-footer,.gallery-closing .gallery-head,.gallery-closing .gallery-footer{opacity:0;pointer-events:none}
.photo-gallery .gallery-retry{position:absolute;left:16px;right:16px;bottom:20px;margin:auto;max-width:340px;padding:14px;border:1px solid #a478d1;border-radius:18px;background:#251c34ed;color:#eee1ff}
@media(prefers-reduced-motion:reduce){  .gallery-head,.gallery-footer,.photo-gallery .gallery-thumb{transition:none}
}
dialog.photo-gallery .gallery-head{position:absolute;top:0;left:0;background:linear-gradient(#08050ed9,transparent)}
.photo-gallery .gallery-footer{position:absolute;bottom:0;left:0}
.photo-gallery .gallery-stage{width:100%;height:100%}
/* Telegram list metrics in Anoveyl's palette; chat header/composer retain their original design. */
.dialogs-search{display:flex;align-items:center;gap:8px;flex:none;margin:0 0 10px}
.dialogs-search label{display:flex;align-items:center;flex:1;min-width:0;height:36px;gap:6px;padding:0 10px;border-radius:11px;background:#251c34;color:var(--muted)}
.dialogs-search svg{width:19px;height:19px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8}
.dialogs-search input{width:100%;min-width:0;padding:0;border:0;background:transparent;color:var(--text);font:inherit;font-size:16px;line-height:22px;outline:none;box-shadow:none}
.dialogs-search input::-webkit-search-cancel-button{display:none}
.dialogs-search input::placeholder{color:var(--muted)}
.dialogs-search button{flex:none;border:0;background:transparent;color:var(--accent);padding:6px 0;font-size:15px}
.dialogs-search [data-search-clear]{width:24px;height:28px;font-size:24px;line-height:24px;color:var(--muted)}
.dialogs-search button[hidden]{display:none}
.e2ee-chats.dialogs-view .dialog-row{grid-template-columns:60px minmax(0,1fr) auto;min-height:76px;padding:8px 0;gap:10px}
.e2ee-chats.dialogs-view .dialog-row .avatar{width:60px;height:60px}
.e2ee-chats.dialogs-view .dialog-copy strong{font-size:16px;line-height:21px;font-weight:600}
.e2ee-chats.dialogs-view .dialog-copy p{font-size:15px;line-height:20px;margin:3px 0 0}
.e2ee-chats.dialogs-view .dialog-time{font-size:13px;line-height:18px}
.e2ee-chats.dialogs-view .dialog-row:after{left:70px}
@media(max-width:359px){  .e2ee-chats.dialogs-view .dialog-row{gap:8px}
}
/* Consecutive messages share a group; round videos retain their independent circle. */
.e2ee-conversation .message[data-group-previous=true]{margin-top:-4px}
.e2ee-conversation .message[data-group-previous=true]:not(.mine) .bubble{border-top-left-radius:6px}
.e2ee-conversation .message[data-group-next=true]:not(.mine) .bubble{border-bottom-left-radius:6px}
.e2ee-conversation .message.mine[data-group-previous=true] .bubble{border-top-right-radius:6px}
.e2ee-conversation .message.mine[data-group-next=true] .bubble{border-bottom-right-radius:6px}
.e2ee-chats.dialogs-view .list-head h1{font-size:34px;line-height:41px;letter-spacing:-.8px;font-weight:700}
/* The encrypted settings form defaults must not turn search into a vertical grid. */
.e2ee-screen.e2ee-chats form.dialogs-search{display:flex;align-items:center;gap:8px;margin:0 0 10px}
.e2ee-chats .dialogs-search label{display:flex;flex-direction:row;align-items:center;gap:6px}
html:not([data-input-modality=keyboard]) :is(.gallery-back,.gallery-save,.gallery-thumb):focus{outline:none;box-shadow:none}
.pwa-update-notice{position:fixed;z-index:120;left:16px;right:16px;bottom:calc(env(safe-area-inset-bottom) + 90px);padding:12px 16px;border-radius:16px;background:#30213f;color:#f5efff;box-shadow:0 6px 24px #0006;font:14px/1.4 system-ui}
.pwa-update-notice button{border:0;border-radius:10px;background:#aa64f4;color:#fff;font:inherit;padding:8px 12px}
.connection-retry{max-width:420px;margin:20vh auto;padding:24px;text-align:center}
/* Telegram uses its regular platform message font: 17pt on iOS, 16sp on Android. */
:root{--message-font-size:16px;--message-line-height:1.25}
:root.ios-device{--message-font-size:17px}
body.chat-mode .message .bubble,body.chat-mode .message .photo-caption{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;font-size:var(--message-font-size);line-height:var(--message-line-height)}
body.chat-mode .message.photo-message{width:min(66vw,320px);max-width:86%}
body.chat-mode .message.photo-message .photo-caption{box-sizing:border-box;display:block;min-width:0;padding:8px 11px 9px;line-height:var(--message-line-height);white-space:pre-wrap;overflow-wrap:anywhere}
.photo-gallery .gallery-stage>.gallery-adjacent{position:absolute;left:50%;top:50%;pointer-events:none}
.gallery-notice{font-size:13px;line-height:18px;text-align:center;color:#eee1ff}
.gallery-notice:empty{display:none}
body.chat-mode .messages{padding-top:max(var(--chat-history-top,56px),var(--video-note-history-top,0px));padding-bottom:max(var(--chat-history-bottom,calc(64px + env(safe-area-inset-bottom))),var(--video-note-history-bottom,0px))}
/* A timestamp that wraps occupies its own 12px line, rather than another full
   line of message text. The text's inline span retains normal wrapping. */
body.chat-mode .message:not(.has-media){max-width:90%}
body.chat-mode .message .bubble:has(>.timed-message-content){line-height:0}
body.chat-mode .message .timed-message-content,body.chat-mode .message .photo-caption:has(>.message-text){font-size:0;line-height:0}
body.chat-mode .message .message-text{font-size:var(--message-font-size);line-height:var(--message-line-height)}
body.chat-mode .message .timed-message-content .message-time-space{height:12px;line-height:12px;vertical-align:baseline}
/* The frozen return page already includes its translucent dock. Painting the
   live dock over it doubles the tint until the return layer is removed. */
body.swipe-back-active>#mobile-nav{visibility:hidden}
/* Once the foreground is offscreen, its left-facing shadow must leave too. */
body.swipe-back-active.swipe-back-publishing .shell{box-shadow:none}
/* A short touch screen uses the full chat width in either orientation. */
@media (pointer:coarse) and (min-width:761px) and (max-width:1100px) and (max-height:600px){  body.chat-mode .sidebar{display:none}
  body.chat-mode .shell{display:block;position:absolute;left:0;right:0;top:var(--chat-viewport-top,0px);width:100%;max-width:none;margin:0;height:var(--chat-viewport-height,100dvh);min-height:0;overflow:hidden}
  body.chat-mode #main{position:relative;width:100%;max-width:none;height:100%;min-height:0;padding:0;overflow:hidden}
  body.chat-mode .chat-layout{width:100%;max-width:none;height:100%;min-height:0;margin:0}
  body.chat-mode .chat-head{position:absolute;top:env(safe-area-inset-top);left:50%;transform:translateX(-50%);width:min(82%,560px);z-index:5}
  body.chat-mode .messages{min-height:0;flex:1;overflow:auto;padding-top:var(--chat-history-top,64px);padding-bottom:var(--chat-history-bottom,80px)}
  body.chat-mode .composer{position:absolute;left:50%;bottom:env(safe-area-inset-bottom);transform:translateX(-50%);width:min(82%,560px);max-width:calc(100% - 32px);z-index:5}
  body.chat-mode .mobile-nav{display:none}
}
/* Legible normal-size text across the complete purple gradient. */
.primary{background:linear-gradient(120deg,#8140cc,#6221d1 75%)}
.mine .bubble{background:linear-gradient(120deg,#7935cc,#5720c5)}
.mine .message-time{color:#f2e5ff}
.dialogs-search [data-search-cancel]{background:#21182ef5;border-radius:12px;padding:6px 10px}

.about-service{font-size:15px;line-height:1.65;color:#d8cce8;overflow-wrap:anywhere}.about-service h3{font-size:19px;line-height:1.35;color:#f5f1fc;margin:26px 0 12px}.about-service p{margin:0 0 16px}.about-service a{color:#cb9aff}

/* Owner-approved home layout. Scope every rule to the welcome screen. */
body.welcome-mode #main{display:block;padding:0;min-height:100svh}
body.welcome-mode .shell{min-height:100svh}
.messenger-home{min-height:100svh;display:flex;flex-direction:column;background:#100b20;color:#f8f5ff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}
.messenger-home-center{flex:1;display:flex;align-items:center;justify-content:center;padding:48px 26px}
.messenger-home-card{width:100%;max-width:352px;text-align:center}
.messenger-home-card h1{font-size:52px;font-weight:750;line-height:1.12;letter-spacing:-2px;margin:0}
.messenger-home-emblem{display:block;width:238px;height:238px;object-fit:contain;max-width:80%;margin:43px auto 45px;filter:drop-shadow(0 12px 24px #6822ce17)}
.messenger-home-actions{display:grid;gap:13px}
.messenger-home-actions button{appearance:none;font:inherit;font-size:18px;font-weight:650;min-height:58px;width:100%;border-radius:17px;color:#fff;cursor:pointer;padding:14px 20px;letter-spacing:-.2px}
.messenger-home-actions .primary{border:1px solid #b46aff;background:linear-gradient(105deg,#aa55ff 0%,#8b2cff 85%);box-shadow:inset 0 1px 0 #ffffff22,0 8px 24px #6d20dd22}
.messenger-home-actions .secondary{font-weight:550;border:1px solid #493455;background:#181124;color:#e9e2f3;box-shadow:inset 0 1px 0 #ffffff04}
.messenger-home-actions button:focus-visible,.messenger-home-support a:focus-visible{outline:2px solid #e5ccff;outline-offset:5px}
.messenger-home-actions button:active{transform:translateY(1px)}
.messenger-home-support{padding:0 24px max(26px,env(safe-area-inset-bottom));text-align:center;font-size:13px;line-height:20px;color:#9e90b7}
.messenger-home-support a{color:inherit;text-decoration:none}
.messenger-home-support a:hover{text-decoration:underline}
@media(min-width:800px){.messenger-home-card{max-width:370px}.messenger-home-card h1{font-size:58px}.messenger-home-emblem{width:252px;height:252px}}
@media(max-height:700px){.messenger-home-center{padding:35px 26px}.messenger-home-card h1{font-size:44px}.messenger-home-emblem{width:200px;height:200px;margin:28px auto 30px}.messenger-home-actions button{min-height:54px}}
@media(max-width:340px){.messenger-home-center{padding-left:21px;padding-right:21px}.messenger-home-card h1{font-size:46px}.messenger-home-emblem{width:214px;height:214px}.messenger-home-actions button{font-size:17px}}
@media(max-height:700px){.messenger-home-center{padding:24px 24px 12px}.messenger-home-emblem{width:176px;height:176px;margin:22px auto 25px}.messenger-home-actions button{min-height:52px}.messenger-home-support{padding-bottom:20px}}
@media(max-height:450px){.messenger-home-center{padding:16px 24px 10px}.messenger-home-card h1{font-size:36px}.messenger-home-emblem{width:116px;height:116px;margin:14px auto 18px}.messenger-home-actions{gap:9px}.messenger-home-actions button{min-height:46px;padding:10px 20px}.messenger-home-support{padding-bottom:14px}}
@media(display-mode:standalone){body.welcome-mode #main,.messenger-home{min-height:calc(100svh - env(safe-area-inset-top))}}

/* Keep the ordinary chat list and chat pills while transport reconnects. */
.connection-title{display:flex;align-items:center;gap:10px;font-size:clamp(20px,6vw,28px)!important;min-height:1.5em}
.connection-title::before,.connection-chat::before{content:"";display:inline-block;width:18px;height:18px;flex:none;border:2px solid #58416e;border-top-color:#bd8bff;border-radius:50%;animation:anoveyl-connecting .85s linear infinite}
body .chat-head .status.connection-chat{display:none;align-items:center;justify-content:center;gap:6px;color:var(--muted,#b9a8ce)}
.connection-chat::before{width:10px;height:10px;border-width:1.5px}
.connection-pending #main .chat-head #chat-status{display:none}
body.connection-pending .chat-head .status.connection-chat{display:flex}
@keyframes anoveyl-connecting{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.connection-title::before,.connection-chat::before{animation:none}}

.messenger-contacts{max-width:720px;margin:0 auto;padding-bottom:28px}.messenger-contacts h2{font-size:18px;margin:28px 0 16px}.contacts-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.contacts-actions,.contacts-code-actions{display:flex;align-items:center;gap:8px}.contacts-actions{margin-left:auto;flex-shrink:0}.messenger-contacts .contacts-add.contacts-code-button{font-size:18px;font-weight:700}.messenger-contacts .contacts-add{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0;border-radius:50%;font-size:26px;line-height:1}.contacts-add span{line-height:1}.contacts-add:focus-visible{outline:2px solid #e5ccff;outline-offset:4px}.contacts-list{list-style:none;padding:0;margin:0}.contact-request{display:flex;align-items:center;gap:16px;justify-content:space-between;padding:14px 0;border-bottom:1px solid #ffffff0d}.contact-request-person{display:flex;align-items:center;gap:10px;min-width:0;flex:1}.contact-request-person .avatar{width:36px;height:36px;flex:0 0 36px}.contact-request-name{min-width:0;overflow-wrap:anywhere;font-weight:650}.contact-decisions{display:flex;gap:8px;flex-shrink:0}.contact-decisions button,.contact-request>button{padding:10px 12px;min-height:42px;font-size:13px}.contact-person{display:flex;align-items:center;gap:16px;padding:12px 0;width:100%;background:none;border:0;color:inherit;text-align:left;font-size:20px}.contact-person>span:last-child{min-width:0;overflow-wrap:anywhere}.contacts-empty{color:#b9accb;line-height:1.6}.contacts-status{line-height:1.5;color:#d3b4fb;overflow-wrap:anywhere}.contacts-status:empty{margin:0}.contact-code{display:block;font-family:monospace;font-size:18px;overflow-wrap:anywhere;user-select:text;-webkit-user-select:text;color:#f7edff;margin:16px 0}.messenger-contacts [data-contact-entry]{margin-top:24px}.messenger-contacts form label{display:block;font-size:18px}.messenger-contacts form .field{display:block;box-sizing:border-box;width:100%;margin:12px 0 20px}.messenger-contacts form button{margin:0 8px 8px 0}@media(max-width:380px){.contact-request{gap:8px}.contact-decisions{gap:5px}.contact-decisions button{padding:10px 7px;font-size:12px}}
.contacts-code-actions .profile-invitation{margin:0}.invitation-dialog{width:min(380px,calc(100% - 32px));padding:24px}.invitation-dialog .modal-head h2{font-size:20px;margin:0}.invitation-dialog [data-feedback]{font-size:14px;line-height:1.5}.invitation-dialog::backdrop{background:#090510b8;backdrop-filter:blur(6px)}.profile-invitation [data-code-details]{padding:2px 0 10px}.profile-invitation .invitation-expiry{color:#b9accb;line-height:1.5;font-size:14px}.invitation-actions{display:flex;flex-wrap:wrap;gap:10px}.invitation-actions button{padding:12px 16px;font-size:14px;min-height:44px}.profile-invitation [data-feedback]:empty{margin:0}.profile-invitation .contact-code{font-size:16px}.profile-invitation [hidden]{display:none!important}.invitation-countdown{display:block;width:100%;height:6px;margin:12px 0 16px;border:0;border-radius:999px;overflow:hidden;appearance:none;background:#30223f;accent-color:#ac65ff}.invitation-countdown::-webkit-progress-bar{background:#30223f;border-radius:999px}.invitation-countdown::-webkit-progress-value{background:linear-gradient(90deg,#8738ff,#cb8cff);border-radius:999px}.invitation-countdown::-moz-progress-bar{background:#ac65ff;border-radius:999px}

.messenger-contacts [data-contact-entry] form button{min-height:48px;padding:12px 16px;font-size:14px;line-height:20px;border-radius:14px;vertical-align:middle}
.messenger-contacts [data-contact-entry] form{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 8px}.messenger-contacts [data-contact-entry] form label{grid-column:1/-1}.messenger-contacts [data-contact-entry] form button{width:100%;margin:0 0 8px;min-width:0}

/* Contact names keep the Chats typography; presence is the quieter second line. */
.contact-copy{display:flex;flex-direction:column;flex:1;min-width:0}.contact-name,.contact-presence{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.contact-presence{min-height:20px;margin-top:2px;font-size:14px;line-height:20px;font-weight:400;color:var(--muted)}.contact-presence.online{color:var(--accent)}
.contact-person .avatar .presence-online{display:block;width:13px;height:13px;right:0;bottom:0;border:2px solid var(--bg);border-radius:50%;background:var(--green);box-shadow:none}

@media(max-width:360px){.messenger-contacts header.page-head.contacts-head h1{font-size:24px}}

.messenger-registration{width:min(100%,440px);margin:0 auto;padding:12px 0 36px;color:#f5f1fc}.messenger-registration h1{font-size:32px;line-height:1.25;margin:28px 0 42px}.registration-back{border:0;background:none;color:inherit;font-size:40px;line-height:1;padding:0 14px 0 0;min-height:44px}.messenger-registration form>label{display:block;font-size:17px;margin-top:22px}.messenger-registration .field{display:block;width:100%;box-sizing:border-box;min-height:58px;margin:10px 0 0;font-size:18px}.messenger-registration .primary{width:100%;min-height:56px;margin-top:30px;font-size:19px}.messenger-registration .registration-code{font-family:monospace;font-size:clamp(12px,4vw,19px)}.registration-hint{font-size:13px;line-height:1.5;color:#b9accb}.registration-password{display:flex;gap:8px;align-items:center}.registration-password input{min-width:0;flex:1}.registration-password button{font-size:12px;padding:12px 10px;margin-top:10px}.messenger-registration details{margin-top:24px;color:#b9accb;font-size:14px}.messenger-registration details label{display:block;margin-top:16px}.registration-avatars{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.registration-avatar{padding:8px;border:2px solid transparent;border-radius:20px;background:#ffffff08;aspect-ratio:1;min-width:0}.registration-avatar.selected{border-color:#a64bff;background:#af59ff18;box-shadow:0 0 16px #a64bff33}.registration-avatar .avatar{width:100%;height:100%;border-radius:16px;display:block}.registration-success{text-align:center;padding-top:60px}.registration-success>.avatar{display:block;width:160px;height:160px;margin:auto}.registration-check{display:block;margin:30px auto;color:#ad56ff;border:5px solid currentColor;border-radius:50%;width:80px;height:80px;font-size:60px;line-height:72px}.messenger-registration .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}@media(max-width:360px){.messenger-registration h1{font-size:28px}.registration-avatars{gap:10px}.registration-password button{padding:12px 7px}}

.messenger-registration{position:relative;padding-top:80px}.messenger-registration .registration-back{position:absolute;top:12px;left:0;width:44px;height:44px;margin:0;border:1px solid var(--line);border-radius:50%;background:#241a34;display:grid;place-items:center;font-size:32px;padding:0}

body.auth-mode #main:has(.messenger-registration){display:block;align-content:start;padding-top:env(safe-area-inset-top)}

.messenger-registration .registration-back svg{display:block;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* Settings use small grouped lists and separate pages in Anoveyl's own palette. */
.settings-page{max-width:560px;padding-bottom:24px}
.settings-head{display:flex;align-items:center;gap:12px;min-height:48px;margin:0 0 24px}
.settings-head h1{min-width:0;flex:1;overflow-wrap:anywhere;font-size:28px;line-height:1.2;margin:0;letter-spacing:-.6px}
.settings-head .icon-btn{display:grid;place-items:center;flex:0 0 40px;width:40px;height:44px;border:0;background:none;color:var(--text);padding:8px}
.settings-head:has([data-profile-back]) h1{font-size:clamp(18px,5.3vw,24px)}
.settings-head svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.settings-identity{display:flex;flex-direction:column;align-items:center;gap:12px;margin:12px 0 28px;text-align:center}
.settings-identity .avatar{width:112px;height:112px}
.settings-identity h2{font-size:26px;line-height:1.2;margin:4px 0;overflow-wrap:anywhere;max-width:100%}
.settings-group{margin:24px 0}
.settings-group>h2{font-size:13px;font-weight:500;letter-spacing:.2px;color:var(--muted);margin:0 16px 8px}
.settings-card{border:1px solid #44305288;border-radius:20px;background:#21172e;overflow:hidden}
.settings-row{display:flex;align-items:center;gap:12px;width:100%;min-height:62px;padding:14px 16px;border:0;background:none;color:var(--text);text-align:left;font:inherit;font-size:16px;cursor:pointer}
.settings-row+.settings-row{border-top:1px solid #ffffff0a}
.settings-row:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
.settings-row-icon{display:grid;place-items:center;width:32px;height:32px;flex:0 0 32px;color:#c494ff;background:#ac68ff18;border-radius:10px}
.settings-row-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.settings-row-label{min-width:0;flex:1;overflow-wrap:anywhere}
.settings-row-value{max-width:35%;font-size:13px;color:var(--muted);text-align:right;overflow-wrap:anywhere}
.settings-chevron{color:#8d759f;font-size:25px;flex-shrink:0}
.settings-logout{width:100%;padding:16px;border:0;background:none;color:#e1a3bb;font-size:16px;margin-top:8px}
.settings-note{color:var(--muted);font-size:14px;line-height:1.55;margin:16px 8px}
.settings-info{display:flex;flex-direction:column;gap:8px;padding:18px 16px;overflow-wrap:anywhere}
.settings-info+.settings-info{border-top:1px solid #ffffff0a}
.settings-info>span{color:var(--muted);font-size:13px}
.settings-info>strong{font-weight:500;font-size:17px}
.settings-info p{font-size:14px;line-height:1.55;color:var(--muted);margin:0}
.settings-info .verified{color:#b4d3b8}
.settings-action{width:100%;font-size:16px}
.settings-page .settings-form{display:flex;flex-direction:column;gap:20px;padding:0;border:0;background:none}
.settings-form label{display:flex;flex-direction:column;gap:9px;font-size:14px;color:var(--muted)}
.settings-form .field{height:52px;width:100%;font-size:16px}
.settings-form .primary{min-height:50px;font-size:16px}
.settings-form .settings-note{margin:0 4px}
.settings-form .auth-error{margin:0}
.settings-blocked{display:flex;align-items:center;gap:12px;padding:16px}
.settings-blocked>span:nth-child(2){flex:1;min-width:0;overflow-wrap:anywhere}
.settings-blocked .secondary{padding:10px;font-size:12px}
.settings-page .profile-invitations{margin:24px 0}
.settings-page [hidden]{display:none!important}
/* Only the contact/chat list scrolls. The heading and bottom navigation stay put. */
.messenger-contacts{display:flex;flex-direction:column;min-height:0;height:100%}
.contacts-head,.list-head{flex:0 0 auto;background:var(--bg);margin:0;padding:0 0 20px}
.contacts-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
.contacts-scroll>section:first-of-type h2{margin-top:12px}
.contacts-list .contact-person{font-size:var(--directory-name-size);line-height:var(--directory-name-line);font-weight:700}
.contacts-list .contact-person .avatar{flex:0 0 56px;width:56px;height:56px}
.contacts-status{padding-right:4px}
@media(max-width:760px){  body.list-mode{height:100%;overflow:hidden;overscroll-behavior-y:none}
  body.list-mode .shell{height:100dvh;min-height:0;overflow:hidden}
  body.list-mode #main{position:fixed;inset:0;display:flex;flex-direction:column;min-height:0;height:100dvh;padding:calc(20px + env(safe-area-inset-top)) 20px calc(88px + env(safe-area-inset-bottom));overflow:hidden}
  body.list-mode #main>div,body.list-mode #main>.messenger-contacts{flex:1;min-height:0;height:100%;width:100%}
  body.list-mode #mobile-nav{position:fixed;bottom:0}
  .contacts-head,.list-head{padding-bottom:20px}
  .contacts-head h1{margin:0}
  .settings-head{margin-bottom:20px}
  .settings-page{padding-top:4px}
  .settings-identity{margin-top:12px}
  .settings-row{padding:14px;min-height:62px}
  .settings-page .support-contact{margin-top:12px}
}
@media(min-width:761px){  body.list-mode #main{height:100dvh;min-height:0;overflow:hidden}
  body.list-mode #main>div{height:100%;min-height:0}
}
@media(max-width:360px){  .settings-row{gap:9px;font-size:15px;padding:12px}
  .settings-row-value{font-size:12px}
  .settings-head h1{min-width:0;flex:1;overflow-wrap:anywhere;font-size:25px}
  .settings-identity .avatar{width:100px;height:100px}
  .settings-blocked{gap:8px;padding:12px}
  .settings-blocked .avatar{width:32px;height:32px;flex:0 0 32px}
}
/* All three primary headings share the approved Chats position. */
.contacts-head,.e2ee-chats .page-head.list-head,.settings-overview>.settings-head{align-items:flex-start;min-height:64px;padding-top:0}
.contacts-head h1,.e2ee-chats.dialogs-view .list-head h1,.settings-overview>.settings-head h1{margin:0;font-size:34px;line-height:44px;letter-spacing:-.8px;font-weight:700}
@media(max-width:760px){  body.settings-mode{height:100%;overflow:hidden;overscroll-behavior:none}
  body.settings-mode #main{position:fixed;inset:0;padding:calc(20px + env(safe-area-inset-top)) 20px calc(88px + env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}
  .settings-page{padding-top:0}
  .settings-overview>.settings-head{margin-bottom:20px}
}
body.settings-swipe-back-active #main{will-change:transform;background:var(--bg);box-shadow:-8px 0 24px #0004}
.e2ee-conversation .photo-message img{outline:0;-webkit-tap-highlight-color:transparent}
.e2ee-conversation .message:focus{outline:0}
.e2ee-conversation .message:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.install-tabs{display:flex;gap:8px;margin:8px 0 20px}
.install-tabs button{flex:1;padding:12px;border:0;border-radius:14px;background:#2a2038}
.install-tabs [aria-selected="true"]{background:#9345ed;color:#fff}
/* Backup file controls are revealed by the two settings actions. */
#modal.install-dialog{height:min(640px,calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));max-height:calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom));display:flex;flex-direction:column;overflow:hidden}
#modal.install-dialog:not([open]){display:none}
#modal.install-dialog .modal-head,#modal.install-dialog .install-tabs{flex:none}
#modal.install-dialog [role=tabpanel]{overflow:auto;min-height:0;flex:1;overscroll-behavior:contain}
.install-steps{margin-top:16px}
[data-account-deletion] .danger-action{background:#b63860;color:#fff;border:1px solid #ed6088}
[data-account-deletion] .settings-action{margin-top:16px}
[data-account-deletion] form{margin-top:20px}
.settings-logout.danger{color:#f2789a}
.storage-summary{text-align:center;margin:20px auto}
.storage-summary>p{font-size:23px;font-weight:600}
.storage-ring{display:grid;place-items:center;width:200px;height:200px;margin:auto;border-radius:50%;position:relative}
.storage-ring:before{content:"";position:absolute;inset:27px;border-radius:50%;background:var(--bg)}
.storage-ring strong{position:relative;font-size:23px}
.storage-size-row{display:flex;align-items:center;gap:12px;padding:17px 16px;font-size:15px}
.storage-size-row+.storage-size-row{border-top:1px solid #ffffff0a}
.storage-size-row i{width:13px;height:13px;flex:none;border-radius:50%}
.storage-size-row span{flex:1;min-width:0;overflow-wrap:anywhere}
.storage-size-row strong{font-size:14px;font-weight:500;white-space:nowrap;color:var(--muted)}
.storage-actions{display:grid;gap:12px;margin-top:20px}
.storage-chats-title{font-size:18px;margin-top:28px}
[data-clear-confirm]:not(:empty){margin-top:20px;padding:16px;border:1px solid #785092;border-radius:16px}
[data-clear-confirm] button{width:100%;margin-top:10px}
.shared-tabs{display:flex;gap:4px;overflow-x:auto;border-radius:20px;background:#ffffff0a;padding:5px;margin:18px 0}
.shared-tabs button{flex:1;padding:10px 12px;white-space:nowrap;border:0;border-radius:16px;background:none;font:inherit;font-size:14px;color:var(--muted)}
.shared-tabs button[aria-selected=true]{color:var(--text);background:#a46cff33}
.shared-view{position:relative;min-height:80px}
.shared-view audio{width:100%;margin:10px 0}
.shared-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px}
.shared-grid>.settings-note{grid-column:1/-1}
.shared-photo{aspect-ratio:1;overflow:hidden;padding:0;border:0;border-radius:4px;background:#ffffff10;color:var(--muted);font-size:11px}
.shared-photo img{width:100%;height:100%;object-fit:cover;display:block}
.shared-link{padding:12px 3px;border-bottom:1px solid #ffffff15;display:grid;gap:8px;overflow-wrap:anywhere}
.shared-link small{color:var(--muted)}
.shared-view>.secondary{display:block;width:100%;margin:8px 0}
[data-shared-more]{margin-top:12px;width:100%}
/* Reveal controls are shaped buttons, with native vertical scroll and one spring owner. */
.dialog-swipe{position:relative;overflow:hidden;touch-action:pan-y;--dialog-reveal:0px}
.dialog-swipe>.dialog-row{position:relative;z-index:1;background:var(--bg);touch-action:pan-y;user-select:none;-webkit-user-drag:none;will-change:auto}
.dialog-swipe.swipe-moving>.dialog-row,.dialog-swipe.swipe-open>.dialog-row{will-change:transform}
.dialog-actions{position:absolute;inset:0;display:flex;justify-content:flex-end;align-items:stretch;clip-path:inset(0 0 0 max(0px,calc(100% - var(--dialog-reveal))));padding-right:4px}
.dialog-actions button{display:flex;flex:0 0 64px;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:transparent;color:#fff;padding:2px;font:inherit;font-size:10px;line-height:12px;touch-action:manipulation;transform:scale(calc(.55 + .45 * var(--action-progress,0)));opacity:var(--action-progress,0)}
.dialog-action-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#7852b1;flex:none}
.dialog-action-icon svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.dialog-actions [data-dialog-action=delete] .dialog-action-icon{background:#b34165}
.dialog-action-label{max-width:64px;min-height:12px;text-align:center}
.dialog-actions button:disabled{opacity:.4}
.dialog-action-menu{position:absolute;right:3px;top:2px;z-index:2;border:0;background:var(--bg);color:var(--muted);font-size:17px;padding:0 6px;border-radius:8px;opacity:0;pointer-events:none}
.dialog-action-menu:focus-visible{opacity:1;pointer-events:auto}
.swipe-open .dialog-action-menu{display:none}
.dialog-actions[inert]{visibility:hidden}
.storage-policy{margin-top:24px;padding:16px;display:grid;gap:18px}
.storage-policy label{display:grid;gap:10px;font-size:14px;color:var(--muted)}
.storage-policy select{width:100%;font:inherit}
.dialogs-placeholder{padding:14px 0;display:grid;gap:22px}
.dialogs-placeholder i{display:block;height:55px;border-radius:18px;background:linear-gradient(90deg,#a46cff12 0 55px,transparent 55px 70px,#a46cff09 70px 85%,transparent 85%)}
/* Match the loading header to the live list before the private stylesheet loads. */
.e2ee-screen.e2ee-chats{display:flex;flex-direction:column;min-height:0;height:100%;max-width:none;padding:0;margin:0}
.e2ee-chats .page-head h1{margin:0}
.e2ee-chats .dialogs-scroll{min-height:0;overflow:auto;overscroll-behavior-y:contain;flex:1}
.e2ee-chats .dialogs-placeholder{visibility:hidden;animation:dialogs-loading-delay 0s .18s forwards}
@keyframes dialogs-loading-delay{  to{visibility:visible}
}
.swipe-return-content>div,.swipe-return-content>.dialogs-view,.swipe-return-content>.messenger-contacts{flex:1;min-height:0;width:100%}
.dialog-settings-sheet{position:fixed;inset:auto 12px max(12px,env(safe-area-inset-bottom));margin:0 auto;width:min(420px,calc(100% - 24px));padding:18px 14px 10px;border:1px solid #ffffff18;border-radius:22px;background:#251c34;color:var(--text);box-sizing:border-box}
.dialog-settings-sheet::backdrop{background:#0006}
.dialog-settings-sheet h2{font-size:18px;text-align:center;line-height:24px;margin:0 0 12px}
.dialog-settings-sheet p{font-size:14px;line-height:20px;color:var(--muted)}
.dialog-settings-sheet button,.dialog-settings-sheet label{display:flex;align-items:center;justify-content:center;gap:10px;min-height:48px;width:100%;padding:10px;border:0;border-radius:12px;background:#ffffff08;color:var(--accent);font:inherit;font-size:16px;margin:6px 0;box-sizing:border-box}
.dialog-settings-sheet button.danger{color:#ef789d}
.dialog-settings-sheet .dialog-sheet-cancel{font-weight:600;background:#ffffff0c}
.dialog-settings-sheet[open]{animation:dialog-sheet-enter 220ms cubic-bezier(.25,.8,.25,1)}
@keyframes dialog-sheet-enter{  from{transform:translateY(40px);opacity:0}
  to{transform:none;opacity:1}
}
@media(prefers-reduced-motion:reduce){  .dialog-settings-sheet[open]{animation:none}
}
body.chat-push-active .shell{z-index:20;will-change:transform;background:#100b20 url("assets/chat-wallpaper-night-v3.png") center 6px / 260px 390px repeat;box-shadow:-8px 0 24px #0004}
@media(display-mode:standalone){  body.chat-push-active .shell{background-position:center calc(6px + env(safe-area-inset-top))}
}

/* PeerInfo hierarchy in Anoveyl's palette, with one native vertical scroller. */
#modal.person-dialog{padding:0;border:0;border-radius:26px;background:var(--bg);width:min(520px,calc(100vw - 40px));height:min(860px,calc(var(--peer-profile-height,100dvh) - 48px));max-width:none;max-height:none;overflow:hidden;color:var(--text)}
#modal.person-dialog .modal-head{display:none}
.person-dialog .peer-profile-page{height:100%;display:flex;flex-direction:column;min-height:0;overflow:hidden;background:var(--bg);isolation:isolate}
.peer-profile-nav{flex:none;display:grid;grid-template-columns:48px minmax(0,1fr) 48px;align-items:center;min-height:60px;padding:6px 12px;border-bottom:1px solid transparent;z-index:5;background:var(--bg)}
.peer-profile-nav>strong{font-size:17px;line-height:22px;text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0;transition:opacity .18s ease}
.peer-profile-collapsed .peer-profile-nav{border-bottom-color:#ffffff0b}
.peer-profile-collapsed .peer-profile-nav>strong{opacity:1}
.peer-profile-back{display:grid;place-items:center;width:44px;height:44px;padding:10px;border:1px solid #ffffff12;background:#ffffff0a;border-radius:50%;color:var(--accent)}
.peer-profile-scroll{position:relative;flex:1;min-height:0;overflow:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:0 0 max(24px,env(safe-area-inset-bottom));scroll-padding-top:8px;touch-action:auto}
.person-dialog .peer-profile-hero{gap:0;padding:10px 20px 24px}
.person-dialog .peer-profile-hero .avatar.large{width:100px;height:100px;flex:none;border:0;box-shadow:0 8px 32px #0003}
.peer-profile-hero .avatar .presence-online{width:17px;height:17px;right:2px;bottom:2px;border:3px solid var(--bg)}
.peer-profile-hero h1{font-size:28px;font-weight:650;line-height:34px;letter-spacing:-.6px;max-width:100%;overflow-wrap:anywhere;margin:14px 0 4px;text-align:center}
.person-dialog .peer-profile-hero .chat-person-presence{font-size:14px;line-height:20px;min-height:20px;color:var(--muted);margin:0}
.person-dialog .peer-profile-hero .chat-person-presence.online{color:var(--accent)}
.peer-profile-actions{position:relative;display:flex;gap:8px;padding:0 16px;margin:0 0 20px;z-index:4}
.peer-quick-action{flex:1;min-width:0;min-height:64px;border:0;border-radius:16px;background:#251d33;color:var(--accent);display:flex;align-items:center;justify-content:center;flex-direction:column;gap:6px;padding:10px 2px;font-size:11px;line-height:14px;touch-action:manipulation}
.peer-quick-action>svg{display:block;width:23px;height:23px;stroke-width:1.8}
.peer-quick-action[aria-pressed=false]{background:#251d3399;color:var(--muted)}
.peer-quick-action:active,.peer-profile-back:active{background:#a57bff24}
.peer-profile-more{position:absolute;right:16px;top:calc(100% + 8px);min-width:230px;max-width:calc(100% - 32px);border:1px solid #795b9655;border-radius:16px;background:#2b223a;box-shadow:0 12px 38px #0006;overflow:hidden}
.peer-profile-more[hidden]{display:none}
.peer-profile-more button{display:flex;align-items:center;gap:12px;min-height:50px;width:100%;padding:12px 16px;border:0;background:none;color:var(--text);text-align:left;font-size:15px}
.peer-profile-more button+button{border-top:1px solid #ffffff0a}
.peer-profile-more .danger{color:#f2789a}
.peer-profile-info{margin:0 16px 24px;border-radius:20px;background:#211a2c;overflow:hidden}
.peer-info-row{display:flex;align-items:center;gap:16px;padding:15px 17px;width:100%;min-height:72px;color:var(--text);border:0;background:transparent;text-align:left}
.peer-info-row+.peer-info-row{border-top:1px solid #ffffff0a}
.peer-info-row>span{display:flex;flex-direction:column;gap:5px;min-width:0;flex:1}
.peer-info-row small{font-size:13px;line-height:17px;color:var(--muted)}
.peer-info-row strong{font-size:17px;line-height:22px;overflow-wrap:anywhere;font-weight:400}
.peer-profile-shared{min-height:320px}
.person-dialog .shared-tabs{position:sticky;top:0;z-index:3;gap:3px;margin:0 16px 14px;padding:4px;background:#251d33;border-radius:22px;scrollbar-width:none;box-shadow:0 0 0 5px var(--bg)}
.person-dialog .shared-tabs::-webkit-scrollbar{display:none}
.person-dialog .shared-tabs button{flex:0 0 auto;min-height:36px;padding:8px 15px;border-radius:18px;font-size:14px;line-height:20px;transition:color .16s,background .16s}
.person-dialog .shared-tabs button[aria-selected=true]{background:#a57bff26;color:#e8d7ff}
.person-dialog .shared-view{margin:0 16px;min-height:120px}
.person-dialog .shared-view.shared-grid{margin:0;gap:2px}
.person-dialog .shared-photo{border-radius:0}
.person-dialog .shared-grid>.settings-note{padding:20px 24px;text-align:center}
.person-dialog [data-shared-retry]{width:calc(100% - 32px);margin:14px 16px 0}
.person-dialog [data-shared-status]{margin:8px 24px}
@media(max-width:600px){
 #modal.person-dialog{position:fixed;inset:var(--peer-profile-top,0px) 0 auto;margin:0;width:100%;height:var(--peer-profile-height,100dvh);border-radius:0;box-shadow:none}
 .peer-profile-nav{padding-top:calc(6px + env(safe-area-inset-top));min-height:calc(60px + env(safe-area-inset-top))}
}
@media(prefers-reduced-motion:reduce){.peer-profile-page *{scroll-behavior:auto!important;transition:none!important}}
/* Shared media opens as its own navigation surface above the retained profile. */
.peer-profile-actions{max-width:400px;margin-left:auto;margin-right:auto;width:100%}
.peer-profile-back:focus:not(:focus-visible),.shared-back:focus:not(:focus-visible){outline:none;box-shadow:none}
html:not([data-input-modality=keyboard]) :is(.peer-profile-back,.shared-back,.shared-photo,.shared-tabs button,.peer-avatar-button):focus{outline:none;box-shadow:none}
.shared-library,.shared-media-viewer{position:fixed;inset:0;margin:0;padding:0;border:0;border-radius:0;max-width:none;max-height:none;width:100%;height:100dvh;overflow:hidden;background:var(--bg,#100b20);color:var(--text,#f5f1fc);box-shadow:none}
.shared-library[open],.shared-media-viewer[open]{display:flex;flex-direction:column}
.shared-library::backdrop,.shared-media-viewer::backdrop{background:#0008;backdrop-filter:none}
.shared-library-head,.shared-viewer-head{flex:none;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:10px;align-items:center;padding:calc(10px + env(safe-area-inset-top)) 16px 10px;min-height:72px;background:var(--bg,#100b20);z-index:2}
.shared-library-head>div,.shared-viewer-head>div{display:flex;flex-direction:column;gap:2px;text-align:center;min-width:0}
.shared-library-head strong,.shared-viewer-head strong{font-size:18px;font-weight:650;line-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.shared-library-head [data-shared-count],.shared-viewer-head div>span{font-size:14px;line-height:20px;color:var(--muted,#b2a1c7)}
.shared-back{width:44px;height:44px;display:grid;place-items:center;border:1px solid #ffffff1c;border-radius:50%;background:#ffffff0a;color:var(--text,#f5f1fc);padding:10px;touch-action:manipulation}
.shared-back svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.shared-library [data-shared-library-body]{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.shared-library .shared-tabs{flex:none;margin:6px 16px 12px;border-radius:24px;background:#251d33;scrollbar-width:none;padding:4px;gap:2px}
.shared-library .shared-tabs::-webkit-scrollbar{display:none}
.shared-library .shared-tabs button{flex:0 0 auto;padding:9px 16px;min-height:40px;font-size:16px;border-radius:21px}
.shared-library .shared-tabs button[aria-selected=true]{background:#a57bff26}
.shared-library .shared-view{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-bottom:max(16px,env(safe-area-inset-bottom))}
.shared-library .shared-view.shared-grid{align-content:start;gap:2px}
.shared-library .shared-view.shared-rows{padding:0 16px max(16px,env(safe-area-inset-bottom));}
.shared-media-row{display:flex;align-items:center;gap:12px;min-height:64px;padding:9px 13px;background:#241c30}
.shared-media-row:first-child{border-radius:20px 20px 0 0}
.shared-media-row:last-child{border-radius:0 0 20px 20px}
.shared-media-row:only-child{border-radius:20px}
.shared-media-play{position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#5794ff;color:#fff;overflow:hidden;touch-action:manipulation}
.shared-media-play>svg{width:27px;height:27px;fill:currentColor;stroke:none;position:relative;z-index:1;pointer-events:none}
.shared-media-play:focus-visible,.shared-photo:focus-visible{outline:2px solid #dbc7ff;outline-offset:3px}
.shared-round-preview{background:#30243e}
.shared-round-preview video,.shared-round-preview canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:50%;pointer-events:none}
.shared-round-preview svg{filter:drop-shadow(0 1px 3px #0009)}
.shared-media-info{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.shared-media-info strong{font-size:17px;line-height:23px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.shared-media-info>span{font-size:14px;line-height:20px;color:#a99bb9;font-variant-numeric:tabular-nums}
.shared-playing .shared-media-info strong{color:#b791ff}
.shared-library [data-shared-retry]{flex:none;margin:8px 16px;width:calc(100% - 32px)}
.shared-library [data-shared-status]{flex:none;margin:4px 20px 8px}
.shared-photo:empty::before{content:'Фото';color:var(--muted,#b2a1c7);font-size:12px}
.shared-photo.shared-unavailable::before{content:'Недоступно'}
.shared-media-viewer{background:#08070b}
.shared-media-viewer .shared-viewer-head{background:#08070bd9}
.shared-viewer-stage{flex:1;min-width:0;min-height:0;overflow:hidden;display:grid;place-items:center;touch-action:none}
.shared-viewer-stage img{display:block;max-width:100%;max-height:100%;object-fit:contain;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;will-change:transform}
.shared-viewer-stage .shared-round-video{display:block;width:min(420px,calc(100vw - 24px));max-height:100%;aspect-ratio:1;object-fit:cover;border-radius:50%}
.shared-viewer-caption{flex:none;max-height:20vh;overflow:auto;margin:0;padding:14px 20px calc(16px + env(safe-area-inset-bottom));font-size:15px;line-height:21px;color:#e9e2f2;white-space:pre-wrap}
@media(min-width:760px){.shared-library-head,.shared-library [data-shared-library-body],.shared-viewer-head{width:min(100%,900px);align-self:center}.shared-library .shared-tabs{align-self:center;max-width:calc(100% - 32px)}.shared-library .shared-view{width:100%}}

.shared-library.shared-has-player [data-shared-library-body]{padding-top:53px}
.shared-library .voice-top-player{z-index:4}
.shared-media-row.shared-loading .shared-media-play{box-shadow:0 0 0 2px #d3c0ff55}
/* PeerInfo compact/expanded header, retaining Anoveyl's palette. */
.peer-avatar-button{display:grid;place-items:center;flex:none;width:100px;height:100px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;transform:scale(calc(1 - var(--peer-collapse,0)*.12));transform-origin:center;cursor:pointer}
.peer-avatar-button:focus-visible{outline:2px solid var(--accent);outline-offset:5px}
.peer-profile-hero h1{transform:translateY(calc(var(--peer-collapse,0)*-4px)) scale(calc(1 - var(--peer-collapse,0)*.08));transform-origin:50% 0}
.peer-profile-nav{background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
.shared-month{grid-column:1/-1;position:sticky;top:0;z-index:1;margin:0;padding:10px 14px;background:color-mix(in srgb,var(--bg) 92%,transparent);backdrop-filter:blur(12px);font-size:14px;line-height:20px;font-weight:600;text-transform:capitalize;color:var(--text)}
.shared-library .shared-view{touch-action:pan-y}
body:has(.photo-gallery[open],.shared-library[open],.person-dialog[open]){overscroll-behavior-x:none}

.peer-profile-actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;max-width:480px}
.peer-quick-action{min-width:0;padding:12px 4px}.peer-quick-action>span{font-size:12px;overflow-wrap:anywhere;text-align:center}.peer-quick-action#block-user{color:#df7f9f}

.shared-tabs{position:relative;isolation:isolate}.shared-tab-indicator{position:absolute;left:0;top:4px;bottom:4px;border-radius:24px;background:#a57bff26;z-index:-1;pointer-events:none;transition:transform 280ms cubic-bezier(.25,.8,.25,1),width 280ms cubic-bezier(.25,.8,.25,1)}
.shared-tabs button[aria-selected=true],.shared-library .shared-tabs button[aria-selected=true]{background:transparent}
.shared-pane-stack{position:relative;overflow:hidden;flex:1;min-height:0;display:flex;flex-direction:column}.shared-pane-stack>.shared-view{min-height:0;flex:1}.shared-pane-stack>.shared-outgoing{position:absolute;inset:0;z-index:1;pointer-events:none;overflow:hidden}
@media(prefers-reduced-motion:reduce){.shared-tab-indicator{transition:none}}

.shared-load-sentinel{grid-column:1/-1;flex:none;width:100%;height:1px;overflow-anchor:none;pointer-events:none}

.shared-grid{grid-auto-rows:max-content}

/* Composer geometry stays fixed; only its controls animate. */
.voice-mode{position:relative;isolation:isolate;--voice-level:0;--voice-left:0px;--voice-up:0px}
.voice-mode .composer-box{visibility:hidden;pointer-events:none}
.voice-composer-panel{position:absolute;left:8px;right:60px;bottom:4px;height:44px;color:#e4d3fa;z-index:3}
.keyboard-open .voice-composer-panel{bottom:5px}
.voice-composer-panel[hidden],.voice-composer-panel [hidden]{display:none!important}
.voice-record-line,.voice-preview-row{height:44px;display:flex;align-items:center;gap:8px}
.voice-composer-panel button{border:0;color:inherit;font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.voice-composer-panel button:disabled{opacity:.5;cursor:default}
.voice-composer-panel svg{width:22px;height:22px;display:block;flex-shrink:0}
.voice-clock{display:flex;gap:8px;align-items:center;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}
.voice-clock i{width:7px;height:7px;border-radius:50%;background:#ff4777;animation:voice-dot 1s ease-in-out infinite}
.voice-cancel{flex:1;background:transparent;font-size:12px!important;white-space:nowrap;transform:translateX(calc(-.2 * var(--voice-left)));opacity:var(--voice-cancel-opacity,1)}
[data-voice-locked=true] .voice-cancel,[data-voice-phase=paused] .voice-cancel{color:#c796ff;transform:none;opacity:1}
.voice-mode .voice-capture-button{position:relative;z-index:5;border-radius:50%!important;background:linear-gradient(135deg,#b970ff,#7828ef)!important;color:#fff!important;transform:translate(calc(-1 * var(--voice-left)),calc(-1 * var(--voice-up))) scale(1.3);transition:transform .18s ease,background .18s ease}
.voice-capture-button:before,.voice-capture-button:after{content:'';position:absolute;inset:0;z-index:-1;border-radius:var(--voice-shape-a,50%);background:#a856ff;opacity:.24;transform:var(--voice-motion-a,scale(1.1));transition:opacity .18s ease;pointer-events:none}
.voice-capture-button:after{opacity:.13;border-radius:var(--voice-shape-b,50%);transform:var(--voice-motion-b,scale(1.18))}

[data-voice-phase=paused] .voice-capture-button,[data-voice-phase=complete] .voice-capture-button{transform:none}
[data-voice-phase=paused] .voice-capture-button:before,[data-voice-phase=paused] .voice-capture-button:after,[data-voice-phase=complete] .voice-capture-button:before,[data-voice-phase=complete] .voice-capture-button:after{opacity:0}
.voice-upper{position:absolute;right:-51px;bottom:65px;display:flex;align-items:center;flex-direction:column;justify-content:center;gap:6px;min-width:36px;min-height:52px;border-radius:24px;background:#302140;box-shadow:0 0 0 1px #b98ae833;transition:transform .18s ease;transform:translateY(calc(-.15 * var(--voice-up)))}
[data-voice-locked=true] .voice-upper,[data-voice-phase=paused] .voice-upper{min-height:36px;bottom:61px;transform:none}
.voice-upper span{font-size:17px;line-height:10px}
.voice-discard{display:grid;place-items:center;width:34px;height:40px;flex-shrink:0;background:transparent;color:#d5bee9}
.voice-track{position:relative;height:32px;min-width:0;flex:1;border-radius:18px;background:#352543;touch-action:none;transition:transform .12s ease;--voice-position:0%}
.voice-track canvas{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit;pointer-events:none}
.voice-selection{position:absolute;top:0;bottom:0;border-radius:18px;background:linear-gradient(110deg,#b567ff,#7a32ec);pointer-events:none}
.voice-trim{position:absolute;top:0;height:32px;width:24px;transform:translateX(-50%);background:transparent;touch-action:none;z-index:2}
.voice-trim:after{content:'';position:absolute;left:11px;top:10px;width:3px;height:12px;border-radius:2px;background:white}
.voice-trimming{transform:scaleY(1.12)}
.voice-preview-play{position:absolute;top:6px;height:20px;padding:0 6px!important;display:flex;align-items:center;gap:3px;transform:translateX(-50%);border-radius:12px;background:#432760ce;z-index:3;white-space:nowrap;font-size:11px!important;font-variant-numeric:tabular-nums}
.voice-preview-play svg{width:11px;height:11px;stroke-width:2.5}
.voice-playing:after{content:'';position:absolute;left:var(--voice-position);top:3px;bottom:3px;width:1px;background:#fff9;pointer-events:none}
.voice-hint{position:absolute;bottom:calc(100% + 6px);left:0;right:0;text-align:center;font-size:11px;line-height:16px;color:#cbb1e5;pointer-events:none}
.voice-composer-panel button:focus-visible{outline:2px solid #d1a5ff;outline-offset:2px}
@keyframes voice-dot{50%{opacity:.2}}
@media(prefers-reduced-motion:reduce){.voice-mode *,.voice-mode *:before,.voice-mode *:after{animation:none!important;transition:none!important}.voice-capture-button:before,.voice-capture-button:after{transform:scale(1.1)!important;border-radius:50%!important}}

/* Capture readiness is shown by the clock; pending acquisition keeps the final geometry. */
[data-voice-phase=requesting] .voice-clock i{background:#b4a4c7;border:0;animation:none}
[data-voice-phase=requesting] .voice-clock span{opacity:1}
[data-voice-phase=requesting] .voice-capture-button:disabled,[data-voice-phase=requesting] .voice-upper:disabled,[data-voice-phase=requesting] .video-record-send:disabled{opacity:1}
@keyframes voice-starting-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){[data-voice-phase=requesting] .voice-clock i{animation:none}}

/* Busy work stays in the send control; no floating processing/upload labels. */
.voice-busy .voice-capture-button{transform:none}
.voice-busy .voice-capture-button svg{visibility:hidden}
.voice-busy .voice-capture-button:before{inset:11px;z-index:1;border:2px solid #ffffff44;border-top-color:#fff;background:transparent;opacity:1;transform:none;animation:voice-starting-spin .8s linear infinite}
.voice-busy .voice-capture-button:after{display:none}
.voice-busy .voice-clock i{animation:none;background:#b29bc9}
.voice-busy .voice-cancel{visibility:hidden}
@media(prefers-reduced-motion:reduce){.voice-busy .voice-capture-button:before{animation:none!important}}

/* Held controls follow the finger directly; springs run at phase boundaries. */
[data-voice-phase=held] .voice-capture-button,[data-voice-phase=requesting] .voice-capture-button{transition:background .18s ease}
.voice-preview-row{transform-origin:right center}
.recording-discard-ghost svg{width:100%;height:100%}

.video-recording-overlay{padding-top:var(--video-safe-top,env(safe-area-inset-top));padding-bottom:var(--video-safe-bottom,env(safe-area-inset-bottom));position:fixed;z-index:80;overflow:hidden;pointer-events:auto;color:#fff;background:#100b2077;backdrop-filter:blur(22px);-webkit-backdrop-filter:blur(22px);touch-action:manipulation}
.video-recording-overlay[hidden],.video-recording-overlay [hidden]{display:none!important}
.video-recording-stage{position:absolute;left:50%;top:40%;transform:translate(-50%,-50%);width:min(calc(100vw - 24px),420px);aspect-ratio:1;border-radius:50%;background:#151020;overflow:hidden;isolation:isolate;animation:video-note-reveal .28s cubic-bezier(.2,.8,.2,1)}
.video-recording-stage video{display:block;width:100%;height:100%;object-fit:cover;border-radius:50%}
.video-recording-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);pointer-events:none;fill:none;stroke:#ffffffb8;stroke-width:1.1;stroke-linecap:round}
.video-recording-ring circle{stroke-dasharray:var(--video-progress,0) 100;transition:stroke-dasharray .1s linear}
.video-recording-stage[data-video-live=true][data-video-facing=user] video{transform:scaleX(-1)}
.video-recording-overlay .video-note-panel{position:absolute;left:8px;right:8px;top:auto;bottom:var(--video-dock-bottom,8px);height:44px;border:1px solid #ffffff30;border-radius:24px;padding:0 90px 0 16px;background:#202020d9;color:white;box-sizing:border-box}
.video-note-panel .voice-record-line{position:static;width:100%;gap:16px}.video-note-panel .voice-clock{font-size:16px}.video-note-panel .voice-cancel{position:absolute;left:50%;top:0;height:44px;min-width:76px;color:#4094ff;font-size:16px!important;transform:translateX(-50%)}
.video-recording-overlay .voice-upper{position:absolute;right:6px;bottom:calc(var(--video-dock-bottom,8px) + 98px);width:44px;height:44px;min-height:44px;border-radius:50%;padding:10px;background:#20202099;box-shadow:0 0 0 1px #ffffff30;transform:none;color:white}
.video-recording-overlay button{display:grid;place-items:center;padding:0;color:inherit;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}.video-recording-overlay button:disabled{opacity:.35;cursor:default}.video-recording-overlay button:focus-visible{outline:2px solid #d7bcff;outline-offset:3px}
.video-recording-overlay button svg{display:block;width:25px;height:25px;margin:auto}.video-recording-overlay .voice-cancel{display:block}
.video-camera-switch,.video-flash{position:absolute;bottom:calc(var(--video-dock-bottom,8px) + 50px);left:26px;width:42px;height:42px;border-radius:50%;background:#20202099;box-shadow:0 0 0 1px #ffffff30}
.video-flash{left:78px}.video-recording-overlay[data-keyboard=true] .video-camera-switch{left:8px}.video-recording-overlay[data-keyboard=true] .video-flash{left:60px}.video-recording-overlay .video-record-send{position:absolute;z-index:5;right:-22px;bottom:calc(var(--video-dock-bottom,8px) - 28px);width:100px;height:100px;border-radius:50%;background:#3689ff;box-shadow:0 0 0 7px #3689ff3a,0 0 0 14px #3689ff1a;transition:transform .18s ease}
.video-recording-overlay .video-record-send svg{width:42px;height:42px}.video-record-send:active{transform:scale(.94)}
.video-recording-overlay[data-phase=held] .video-record-send{pointer-events:none}
.video-record-send.is-busy svg{visibility:hidden}.video-record-send.is-busy:after{content:'';width:28px;height:28px;position:absolute;border-radius:50%;border:3px solid #fff5;border-top-color:white;animation:voice-starting-spin .8s linear infinite}
.video-note-mode .composer-box{visibility:visible;opacity:0;pointer-events:none}
.video-note-mode #send-record{opacity:0!important}.video-draft-play{position:absolute;top:calc(50% - 26px);left:calc(50% - 26px);width:52px;height:52px;border-radius:50%;background:#21172f99}
.video-draft-seek{position:absolute;width:1px;height:1px;clip-path:inset(50%);left:50%;bottom:0}.video-draft-seek:focus-visible{width:60%;height:24px;left:20%;bottom:24px;clip-path:none}
@keyframes video-note-reveal{from{opacity:0;transform:translate(-50%,-50%) scale(.8)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}
@media(prefers-reduced-motion:reduce){.video-recording-stage{animation:none}.video-recording-ring circle,.video-record-send{transition:none}.video-record-send.is-busy:after{animation:none}}

.recording-send-ghost>svg{width:58%;height:58%}

.video-camera-switch,.video-draft-play{display:grid;place-items:center;padding:0;color:inherit;border:0;cursor:pointer}
.video-recording-stage button svg{display:block;width:24px;height:24px;margin:auto}
.media-mode-hint{position:absolute;bottom:calc(100% + 10px);left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);box-sizing:border-box;padding:8px 12px;border-radius:14px;background:#281f36f2;color:#eee0ff;font-size:12px;line-height:1.4;pointer-events:none;text-align:center;z-index:6}
.media-mode-hint[hidden]{display:none}
.video-trim-timeline{position:relative;width:100%;height:36px;border-radius:11px;isolation:isolate;touch-action:none;--trim-start:0%;--trim-end:100%}
.video-trim-timeline canvas{display:block;width:100%;height:100%;border-radius:10px;object-fit:cover;background:#30213d}
.video-trim-window{position:absolute;top:-2px;bottom:-2px;left:var(--trim-start);right:calc(100% - var(--trim-end));border:2px solid #a967ff;border-radius:10px;pointer-events:none}
.video-trim-timeline input{position:absolute;inset:-2px -8px;width:calc(100% + 16px);height:40px;margin:0;appearance:none;-webkit-appearance:none;background:transparent;pointer-events:none;outline:none}
.video-trim-timeline input::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:16px;height:40px;border:0;border-radius:9px;background:#a967ff linear-gradient(#fff,#fff) center/3px 16px no-repeat;pointer-events:auto;cursor:ew-resize;touch-action:none}
.video-trim-timeline input::-moz-range-thumb{width:16px;height:40px;border:0;border-radius:9px;background:#a967ff linear-gradient(#fff,#fff) center/3px 16px no-repeat;pointer-events:auto;cursor:ew-resize;touch-action:none}
.video-trim-timeline input:focus-visible::-webkit-slider-thumb{outline:2px solid #fff;outline-offset:2px}
.video-trim-timeline input:disabled::-webkit-slider-thumb{opacity:.5;pointer-events:none}
.video-trim-playhead{position:absolute;left:var(--trim-position,0%);top:1px;bottom:1px;width:2px;background:white;pointer-events:none}
.video-trim-timeline output{position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);font-size:12px;white-space:nowrap;text-shadow:0 1px 3px #000}
.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .video-note-panel{left:64px;right:76px;padding:4px 10px;display:flex;align-items:center}
.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .voice-record-line{position:absolute;inset:0;pointer-events:none}
.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .voice-clock{display:none}
.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .voice-cancel{left:-54px;top:0;width:44px;min-width:44px;height:44px;transform:none;border-radius:50%;border:1px solid #ffffff38;background:#20202099;color:#fff;pointer-events:auto;display:grid}
.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .video-record-send{right:10px;bottom:var(--video-dock-bottom,8px);width:50px;height:44px;box-shadow:none;background:#9b58f5}
.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .video-record-send svg{width:28px;height:28px}
.video-recording-overlay .voice-hint{position:absolute;left:0;right:0;bottom:calc(100% + 28px);text-align:center;font-size:12px}

.video-recording-overlay:is([data-phase=paused],[data-phase=complete]) .voice-cancel svg{width:22px;height:22px;stroke-width:1.5}

.send-btn[data-record-press]:not(.voice-capture-button){transform:scale(1.06);transition:transform 80ms ease-out}

.message.voice-message{width:250px;max-width:84%}
.message.voice-message .message-content{display:block;white-space:normal}
.message.voice-message .bubble{min-width:0;padding:12px 12px 23px}
.voice-message-player{display:flex;align-items:center;gap:12px;min-height:46px}
.voice-play-button{position:relative;isolation:isolate;flex:0 0 44px;width:44px;height:44px;padding:10px;border:0;border-radius:50%;background:#fff;color:#7950bd;cursor:pointer;touch-action:manipulation}
.mine .voice-play-button{color:#8b39f5}
.voice-play-button:before,.voice-play-button:after{content:"";position:absolute;z-index:-1;inset:-5px;background:#ffffff3d;border-radius:var(--voice-shape-a,50%);opacity:0;transform:scale(.82);transition:opacity .2s;pointer-events:none}
.voice-play-button:after{inset:-9px;background:#ffffff21;border-radius:var(--voice-shape-b,50%)}
.is-playing>.voice-play-button:before{opacity:1;transform:var(--voice-motion-a,scale(.94))}
.is-playing>.voice-play-button:after{opacity:1;transform:var(--voice-motion-b,scale(.89))}
.voice-play-button svg,.voice-top-toggle svg{position:relative;width:24px;height:24px;fill:currentColor;overflow:visible}
.voice-play-glyph,.voice-pause-glyph{transform-origin:center;transition:opacity .16s,transform .2s}
.voice-pause-glyph{opacity:0;transform:rotate(-65deg) scale(.6)}
.is-playing .voice-play-glyph{opacity:0;transform:rotate(65deg) scale(.6)}
.is-playing .voice-pause-glyph{opacity:1;transform:rotate(0) scale(1)}
.voice-wave-area{position:relative;min-width:0;flex:1;padding-bottom:15px;touch-action:pan-y}
.voice-wave-area canvas{display:block;width:100%;height:31px}
.voice-wave-area input{position:absolute;inset:0 0 15px;width:100%;height:31px;margin:0;opacity:0;pointer-events:none}
.voice-wave-area:focus-within{outline:2px solid #d3b7ff;outline-offset:3px;border-radius:4px}
.voice-remaining{position:absolute;left:0;bottom:0;color:#e0c7ff;font-size:11px;line-height:14px;font-variant-numeric:tabular-nums}
.voice-outbox-retry{display:block;margin-top:5px;border:0;border-radius:8px;padding:4px 7px;color:#fff;background:#ffffff20;font:inherit;font-size:11px}
.chat-layout{position:relative}
.voice-top-player{position:absolute;left:9%;width:82%;z-index:2;display:flex;align-items:center;gap:8px;height:47px;padding:4px 10px;border:1px solid #664c8266;border-radius:15px;background:#251c34f2;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);box-sizing:border-box;color:#dfc6ff;overflow:hidden;opacity:0;transform:translateY(-8px) scaleY(.85);transform-origin:top;pointer-events:none;transition:opacity .18s,transform .2s}
.voice-top-player.is-visible{opacity:1;transform:translateY(0) scaleY(1);pointer-events:auto}
.voice-top-player button{flex:0 0 32px;width:32px;height:36px;padding:4px;border:0;border-radius:8px;color:inherit;background:transparent;cursor:pointer;touch-action:manipulation}
.voice-top-title{display:flex;flex:1;min-width:0;flex-direction:column;line-height:16px}
.voice-top-title strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.voice-top-title span{font-size:10px;color:#b3a0c9}
.voice-top-player .voice-speed{font-size:11px;font-weight:700;flex-basis:36px;width:36px}
.voice-top-player .voice-close{display:grid;place-items:center;line-height:1}.voice-top-player .voice-close svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round}
.voice-top-progress{position:absolute;left:0;right:0;bottom:0;height:2px;background:#b875ff;transform-origin:left;transform:scaleX(var(--voice-progress,0))}
.voice-play-button:focus-visible,.voice-top-player button:focus-visible{outline:2px solid #e2caff;outline-offset:3px}
@media(prefers-reduced-motion:reduce){.voice-play-button:before,.voice-play-button:after,.voice-play-glyph,.voice-pause-glyph,.voice-top-player{transition:none}.voice-play-button:before,.voice-play-button:after{display:none}}

/* A local file load must not collapse every older bubble during history redraw. */
.voice-delivery-status{display:flex;align-items:center;min-height:46px;font-size:12px}

.voice-upload-glyph{opacity:0;transform:scale(.55);transform-origin:center;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;transition:opacity .16s,transform .18s}
.voice-uploading .voice-upload-glyph{opacity:1;transform:scale(1)}
.voice-uploading .voice-play-glyph,.voice-uploading .voice-pause-glyph,.voice-file-loading .voice-play-glyph{opacity:0;transform:scale(.6)}
.voice-play-button .voice-transfer-ring{position:absolute;inset:0;width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;opacity:0;transform:scale(.95);transition:opacity .18s,transform .18s;pointer-events:none}
.voice-transfer-ring circle{stroke-dasharray:100;stroke-dashoffset:calc(100 * (1 - var(--voice-transfer,0)));transform:rotate(-90deg);transform-origin:22px 22px;transition:stroke-dashoffset .1s linear}
.voice-uploading .voice-transfer-ring,.voice-file-loading .voice-transfer-ring{opacity:1;transform:scale(1)}
.voice-uploading:not(.voice-progress-known) .voice-transfer-ring circle,.voice-file-loading .voice-transfer-ring circle{stroke-dasharray:22 78;stroke-dashoffset:0;animation:voice-transfer-wait 1s linear infinite}
.voice-publishing .voice-transfer-ring{opacity:.65}
.voice-top-toggle .voice-transfer-ring{display:none}
@keyframes voice-transfer-wait{to{transform:rotate(270deg)}}
@media(prefers-reduced-motion:reduce){.voice-transfer-ring,.voice-transfer-ring circle,.voice-upload-glyph{transition:none!important;animation:none!important}}

.voice-message-enter .bubble{animation:voice-message-enter .22s cubic-bezier(.2,.65,.3,1)}
@keyframes voice-message-enter{from{opacity:.5;transform:translateY(var(--voice-entry-offset,84px))}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.voice-message-enter .bubble{animation:none}}

/* Round videos reserve their final geometry before disk/codec work. */
.message.video-note-message{width:210px;max-width:68%;min-width:120px;transition:width .28s cubic-bezier(.2,.75,.25,1),max-width .28s cubic-bezier(.2,.75,.25,1)}
.message.video-note-message.video-note-expanded{width:var(--video-note-expanded-size,min(404px,calc(100vw - 32px)));max-width:100%}
.message.video-note-message .bubble,body.chat-mode .message.video-note-message .bubble{padding:0;background:transparent;border:0;border-radius:0;overflow:visible}
.message.video-note-message .message-content{height:0;min-height:0;padding:0}
.message.video-note-message .bubble .message-time,body.chat-mode .message.video-note-message .bubble .message-time{bottom:4px;right:2px;padding:0;background:transparent;border-radius:0;color:white;font-size:12px;line-height:16px;text-shadow:0 1px 3px #000;z-index:2}
.video-note-player{position:relative;width:100%;aspect-ratio:1;border-radius:50%;background:#30213d;isolation:isolate;cursor:pointer;transform-origin:center;transition:transform .3s cubic-bezier(.2,.8,.2,1);touch-action:pan-y}
.video-note-player video{display:block;width:100%;height:100%;border-radius:50%;object-fit:cover;pointer-events:none}
.video-note-player.video-note-sounding{box-shadow:0 0 0 1.5px #b389ff}
.video-note-progress{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);fill:none;stroke:#eee7ff;stroke-width:1.4;stroke-linecap:round;pointer-events:none}
.video-note-progress circle{stroke-dasharray:100;stroke-dashoffset:calc(100 - var(--video-note-progress,0))}
.video-note-progress .video-note-progress-track{stroke:#fff4;stroke-dasharray:none;stroke-dashoffset:0}
.video-note-progress .video-note-progress-thumb{fill:#fff;stroke:none;stroke-dasharray:none;stroke-dashoffset:0}
.video-note-seek-ring{position:absolute;inset:0;width:100%;height:100%;fill:none;pointer-events:none;visibility:hidden;touch-action:none}
.video-note-seek-ring circle{stroke:transparent;stroke-width:14;pointer-events:stroke;touch-action:none}
.video-note-seek-ring .video-note-seek-thumb-hit{fill:transparent;stroke:none;pointer-events:all}
.video-note-sounding .video-note-seek-ring{visibility:visible}
.video-note-duration{position:absolute;left:10%;bottom:4px;font-size:12px;line-height:16px;font-variant-numeric:tabular-nums;color:white;text-shadow:0 1px 3px #000;pointer-events:none}
.video-note-muted{position:absolute;left:50%;bottom:8px;transform:translateX(-50%);display:grid;place-items:center;background:#19112499;color:white;width:26px;height:26px;border-radius:50%;font-size:22px;pointer-events:none}
.video-note-sounding .video-note-muted{display:none}
.video-note-accessible-seek{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);left:50%;bottom:0}
.video-note-accessible-seek:focus-visible{clip-path:none;width:60%;height:24px;left:20%;bottom:26px;accent-color:#b389ff}
.video-note-seeking{touch-action:none}
@media(prefers-reduced-motion:reduce){.video-note-player,.message.video-note-message{transition:none;transform:none!important}}

.video-note-muted svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8}
.video-note-error{position:absolute;inset:17%;z-index:3;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:6px;border-radius:18px;background:#20172ef2;color:#fff;font-size:11px;line-height:1.3;text-align:center;cursor:default}
.video-note-error[hidden]{display:none}
.video-note-error button{max-width:100%;padding:6px 8px;border:0;border-radius:12px;background:#aa69ff;color:white;font:inherit;cursor:pointer;touch-action:manipulation}
.video-note-failed .video-note-muted{display:none}

/* Telegram-style date headers and sparse calendar, without owning native history scrolling. */
.chat-layout.has-chat-timeline{position:relative}
.message.chat-day-start{margin-top:34px}
.has-chat-timeline .chat-day-separator{position:absolute;left:var(--chat-day-left,50%);top:-31px;translate:-50% 0;display:block;width:max-content;max-width:calc(100vw - 24px);height:25px;padding:2px 10px;border:0;border-radius:14px;background:#30263fdf;color:#f3edf9;font-size:12px;font-weight:600;line-height:21px;white-space:nowrap;touch-action:manipulation;z-index:1}
.chat-timeline-controls{position:absolute;inset:0;pointer-events:none;z-index:3}
.has-chat-timeline .chat-floating-date{position:absolute;left:50%;top:var(--chat-timeline-top,var(--chat-history-top,64px));translate:-50% 0;max-width:calc(100% - 24px);height:25px;padding:2px 10px;border:0;border-radius:14px;background:#30263fed;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);font-size:12px;line-height:21px;font-weight:600;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity 180ms ease;touch-action:manipulation}
.chat-timeline-scrolling .chat-floating-date,.chat-floating-date:focus-visible{opacity:1;pointer-events:auto}
.chat-jump-latest{position:absolute;right:12px;bottom:calc(var(--chat-history-bottom,76px) + 4px);display:grid;place-items:center;width:38px;height:38px;padding:7px;border:1px solid #ffffff12;border-radius:50%;background:#282232de;color:#d8c9ec;box-shadow:0 2px 10px #0003;pointer-events:auto;touch-action:manipulation}
.chat-jump-latest svg{width:22px;height:22px;stroke-width:2}
.chat-timeline-controls [hidden]{display:none}
.chat-timeline-status{position:absolute;left:20px;right:20px;bottom:calc(var(--chat-history-bottom,76px) + 48px);text-align:center;color:var(--muted,#a99dbb);font-size:12px}
.chat-timeline-status:empty{display:none}
dialog.chat-calendar{position:fixed;inset:var(--calendar-top,0px) 0 auto;margin:0;width:100%;height:var(--calendar-height,100dvh);max-width:none;max-height:none;padding:0;border:0;border-radius:0;background:#100b20;color:#f5f1fc;box-shadow:none;overflow:hidden;display:flex;flex-direction:column}
dialog.chat-calendar:not([open]){display:none}
dialog.chat-calendar::backdrop{background:#100b20}
.chat-calendar-head{flex:none;display:grid;grid-template-columns:64px minmax(0,1fr) 88px;gap:6px;align-items:center;padding:calc(env(safe-area-inset-top) + 8px) 16px 12px;background:#100b20;z-index:2}
.chat-calendar-head>strong{text-align:center;font-size:17px;font-weight:600}
.chat-calendar-close{width:44px;height:44px;padding:11px;border:1px solid #ffffff1c;border-radius:50%;background:#251c30;color:#f0e6fa}
.chat-calendar-close svg{display:block;width:22px;height:22px;stroke-width:1.5}
.chat-calendar-today{border:1px solid #ffffff1c;border-radius:22px;padding:11px 12px;background:#251c30;font-size:13px;color:#f0e6fa}
.chat-calendar-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;padding:0 max(16px,calc((100% - 500px)/2)) calc(env(safe-area-inset-bottom) + 24px);scrollbar-width:thin}
.chat-calendar-month{padding:0 0 24px;max-width:500px;margin:0 auto}
.chat-calendar-month h2{font-size:16px;line-height:22px;font-weight:600;text-align:center;text-transform:capitalize;margin:12px 0 16px}
.chat-calendar-weekdays,.chat-calendar-days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px 2px}
.chat-calendar-weekdays{margin:0 0 10px;color:#a79bb6;font-size:10px;text-align:center;text-transform:uppercase}
.chat-calendar-day{position:relative;isolation:isolate;display:grid;place-items:center;justify-self:center;width:min(42px,100%);aspect-ratio:1;min-width:0;padding:0;border:0;border-radius:50%;background:transparent;color:#e8deef;font-size:14px;line-height:1;font-variant-numeric:tabular-nums;overflow:hidden;touch-action:manipulation}
.chat-calendar-day:disabled{opacity:.45;cursor:default}
.chat-calendar-day.has-messages{background:#a9a0b2;color:#fff}
.chat-calendar-day.is-today{background:#9060dc;color:#fff;opacity:1}
.chat-calendar-day>span{position:relative;z-index:1;text-shadow:0 1px 4px #0008;pointer-events:none}
.chat-calendar-thumbnail{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:50%;filter:brightness(.8);pointer-events:none}
.chat-calendar-day[aria-busy=true]{outline:2px solid #cdaaff;outline-offset:2px}
.chat-calendar-more{display:block;width:1px;height:1px;min-height:0;margin:0 auto;padding:0;border:0;overflow:hidden;clip-path:inset(50%);background:#251c30;color:#c6addf;font-size:13px}
.chat-calendar-more:focus-visible{width:auto;height:auto;min-height:38px;margin:4px auto 16px;padding:8px 22px;border-radius:20px;clip-path:none;overflow:visible}
.chat-calendar-more[hidden]{display:none}
.chat-calendar-status{font-size:14px;color:#b4a3c8;text-align:center;padding:16px;line-height:1.5}
.chat-calendar-status:empty{display:none}
@media(min-width:761px){.chat-jump-latest{right:20px}}
@media(prefers-reduced-motion:reduce){.has-chat-timeline .chat-floating-date{transition:none}.chat-calendar-scroll{scroll-behavior:auto!important}}

.chat-calendar-day.is-today:disabled{background:transparent;color:#bc9ae7;opacity:.7}
@media(hover:hover){.chat-timeline-scrolling .chat-floating-date:hover{opacity:1;pointer-events:auto}}

/* Approved avatar artwork, clipped from the original sheets without redrawing. */
.avatar{border:0;box-shadow:none;background-repeat:no-repeat}
.avatar-art-0,.profile-top .avatar-art-0{background-image:url(assets/avatars/0.webp);background-size:100% 100%;background-position:center;}
.avatar-art-1,.profile-top .avatar-art-1{background-image:url(assets/avatars/1.webp);background-size:100% 100%;background-position:center;}
.avatar-art-2,.profile-top .avatar-art-2{background-image:url(assets/avatars/2.webp);background-size:100% 100%;background-position:center;}
.avatar-art-3,.profile-top .avatar-art-3{background-image:url(assets/avatars/3.webp);background-size:100% 100%;background-position:center;}
.avatar-art-4,.profile-top .avatar-art-4{background-image:url(assets/avatars/4.webp);background-size:100% 100%;background-position:center;}
.avatar-art-5,.profile-top .avatar-art-5{background-image:url(assets/avatars/5.webp);background-size:100% 100%;background-position:center;}
.avatar-art-6,.profile-top .avatar-art-6{background-image:url(assets/avatars/6.webp);background-size:100% 100%;background-position:center;}
.avatar-art-7,.profile-top .avatar-art-7{background-image:url(assets/avatars/7.webp);background-size:100% 100%;background-position:center;}
.avatar-art-8,.profile-top .avatar-art-8{background-image:url(assets/avatars/8.webp);background-size:100% 100%;background-position:center;}
.avatar-art-9,.profile-top .avatar-art-9{background-image:url(assets/avatars/9.webp);background-size:100% 100%;background-position:center;}
.avatar-art-10,.profile-top .avatar-art-10{background-image:url(assets/avatars/10.webp);background-size:100% 100%;background-position:center;}
.avatar-art-11,.profile-top .avatar-art-11{background-image:url(assets/avatars/11.webp);background-size:100% 100%;background-position:center;}
.avatar-art-12,.profile-top .avatar-art-12{background-image:url(assets/avatars/12.webp);background-size:100% 100%;background-position:center;}
.avatar-art-13,.profile-top .avatar-art-13{background-image:url(assets/avatars/13.webp);background-size:100% 100%;background-position:center;}
.avatar-art-14,.profile-top .avatar-art-14{background-image:url(assets/avatars/14.webp);background-size:100% 100%;background-position:center;}
.avatar-art-15,.profile-top .avatar-art-15{background-image:url(assets/avatars/15.webp);background-size:100% 100%;background-position:center;}
.avatar-art-16,.profile-top .avatar-art-16{background-image:url(assets/avatars/16.webp);background-size:100% 100%;background-position:center;}
.avatar-art-17,.profile-top .avatar-art-17{background-image:url(assets/avatars/17.webp);background-size:100% 100%;background-position:center;}
.avatar-art-18,.profile-top .avatar-art-18{background-image:url(assets/avatars/18.webp);background-size:100% 100%;background-position:center;}
.avatar-art-19,.profile-top .avatar-art-19{background-image:url(assets/avatars/19.webp);background-size:100% 100%;background-position:center;}
.avatar-art-20,.profile-top .avatar-art-20{background-image:url(assets/avatars/20.webp);background-size:100% 100%;background-position:center;}
.avatar-art-21,.profile-top .avatar-art-21{background-image:url(assets/avatars/21.webp);background-size:100% 100%;background-position:center;}
.avatar-art-22,.profile-top .avatar-art-22{background-image:url(assets/avatars/22.webp);background-size:100% 100%;background-position:center;}
.avatar-art-23,.profile-top .avatar-art-23{background-image:url(assets/avatars/23.webp);background-size:100% 100%;background-position:center;}
.avatar-art-24,.profile-top .avatar-art-24{background-image:url(assets/avatars/24.webp);background-size:100% 100%;background-position:center;}
.avatar-art-25,.profile-top .avatar-art-25{background-image:url(assets/avatars/25.webp);background-size:100% 100%;background-position:center;}
.avatar-art-26,.profile-top .avatar-art-26{background-image:url(assets/avatars/26.webp);background-size:100% 100%;background-position:center;}
.avatar-art-27,.profile-top .avatar-art-27{background-image:url(assets/avatars/27.webp);background-size:100% 100%;background-position:center;}
.avatar-art-28,.profile-top .avatar-art-28{background-image:url(assets/avatars/28.webp);background-size:100% 100%;background-position:center;}
.avatar-art-29,.profile-top .avatar-art-29{background-image:url(assets/avatars/29.webp);background-size:100% 100%;background-position:center;}
.avatar-art-30,.profile-top .avatar-art-30{background-image:url(assets/avatars/30.webp);background-size:100% 100%;background-position:center;}
.avatar-art-31,.profile-top .avatar-art-31{background-image:url(assets/avatars/31.webp);background-size:100% 100%;background-position:center;}
.avatar-art-32,.profile-top .avatar-art-32{background-image:url(assets/avatars/32.webp);background-size:100% 100%;background-position:center;}
.avatar-art-33,.profile-top .avatar-art-33{background-image:url(assets/avatars/33.webp);background-size:100% 100%;background-position:center;}
.avatar-art-34,.profile-top .avatar-art-34{background-image:url(assets/avatars/34.webp);background-size:100% 100%;background-position:center;}
.avatar-art-35,.profile-top .avatar-art-35{background-image:url(assets/avatars/35.webp);background-size:100% 100%;background-position:center;}
.avatar-art-36,.profile-top .avatar-art-36{background-image:url(assets/avatars/36.webp);background-size:100% 100%;background-position:center;}
.avatar-art-37,.profile-top .avatar-art-37{background-image:url(assets/avatars/37.webp);background-size:100% 100%;background-position:center;}
.avatar-art-38,.profile-top .avatar-art-38{background-image:url(assets/avatars/38.webp);background-size:100% 100%;background-position:center;}
.avatar-art-39,.profile-top .avatar-art-39{background-image:url(assets/avatars/39.webp);background-size:100% 100%;background-position:center;}
.avatar-art-40,.profile-top .avatar-art-40{background-image:url(assets/avatars/40.webp);background-size:100% 100%;background-position:center;}
.avatar-art-41,.profile-top .avatar-art-41{background-image:url(assets/avatars/41.webp);background-size:100% 100%;background-position:center;}
.avatar-art-42,.profile-top .avatar-art-42{background-image:url(assets/avatars/42.webp);background-size:100% 100%;background-position:center;}
.avatar-art-43,.profile-top .avatar-art-43{background-image:url(assets/avatars/43.webp);background-size:100% 100%;background-position:center;}
.avatar-art-44,.profile-top .avatar-art-44{background-image:url(assets/avatars/44.webp);background-size:100% 100%;background-position:center;}
.avatar-art-45,.profile-top .avatar-art-45{background-image:url(assets/avatars/45.webp);background-size:100% 100%;background-position:center;}
.avatar-art-46,.profile-top .avatar-art-46{background-image:url(assets/avatars/46.webp);background-size:100% 100%;background-position:center;}
 .avatar-options{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.avatar-option{padding:8px;border-radius:14px}.avatar-option .avatar{width:100%;height:auto;aspect-ratio:1}.avatar-option.active{outline:2px solid var(--accent);outline-offset:-2px}

/* Native app surfaces above a purpose-built transparent decorative scene. */
.new-year-mode { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;--new-year-dock-height:calc(78px + env(safe-area-inset-bottom,0px)); }
.new-year-mode .shell { position:relative;z-index:1; }
.new-year-mode #main,.new-year-mode .swipe-return-content { background:transparent!important; }
.new-year-mode .swipe-return-content { z-index:1; }
/* Continuous background artwork stays below the native interface. */
.new-year-scene {
  position:fixed;inset:0;z-index:0;pointer-events:none;overflow:hidden;contain:paint;
  background:radial-gradient(ellipse at 55% 0%,#39223e45,transparent 38%),radial-gradient(ellipse at 50% 100%,#39213e44,transparent 48%),#100c22;
}
.new-year-scene[data-theme="frost"] { background:radial-gradient(ellipse at 50% 90%,#36254666,transparent 65%),#110d25; }
.new-year-scene[data-theme="december"] { background:radial-gradient(ellipse at 70% 0%,#572b3544,transparent 40%),radial-gradient(ellipse at 30% 100%,#502b3c55,transparent 50%),#100c21; }
.new-year-scene[data-theme="neutral"] { background:#17171e; }
/* The frozen return page uses the full app canvas, including the PWA safe area.
   Keep the live artwork at that same size instead of rescaling at publication. */
body>.new-year-scene { bottom:auto;height:var(--app-canvas-height,100lvh); }
.new-year-scene[hidden] { display:none!important; }
.new-year-scene * { pointer-events:none!important; }
/* A single continuous surface fills the screen with uniform scaling. */
.new-year-artwork { position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;object-position:center;user-select:none; }
@media(min-width:761px) { body>.new-year-scene { left:256px; } }
.new-year-mode:is(.list-mode,.settings-mode) #main { padding-left:23px;padding-right:23px; }
.new-year-mode .contacts-head,.new-year-mode .list-head { background:transparent; }
.new-year-mode :is(.contacts-head,.list-head,.settings-overview>.settings-head) {
  min-height:38px;padding:0;margin:0 0 10px;align-items:flex-start;
}
.new-year-mode :is(.contacts-head,.list-head,.settings-overview>.settings-head) h1 {
  font-size:28px;line-height:36px;letter-spacing:-.7px;font-weight:700;text-shadow:0 2px 10px #100c22;
}
.new-year-mode .e2ee-chats form.dialogs-search { margin:0 0 4px;padding:0; }
.new-year-mode .dialogs-search>label {
  height:38px;border-radius:13px;border:1px solid #65507444;
  background:#281d35;padding:0 12px;box-shadow:none;
}
.new-year-mode .dialogs-search input { font-size:16px;line-height:24px; }
.new-year-mode .dialogs-search svg { width:21px;height:21px; }
.new-year-mode .contacts-list .contact-person .avatar { width:54px;height:54px;flex-basis:54px; }
/* Keep native scroll hit testing stable while the fixed catalog resizes. */
.new-year-mode .contacts-scroll,.new-year-mode .dialogs-scroll { transform:translateZ(0); }
/* The live list wraps rows for swipe actions; its closed state stays transparent. */
.new-year-mode .dialog-swipe>.dialog-row,.new-year-mode .dialog-action-menu { background:transparent; }
.new-year-mode .contact-person { padding:11px 0; }
.new-year-mode .contact-name { font-size:18px;line-height:23px;font-weight:700; }
.new-year-mode .contact-presence { font-size:14px;line-height:20px;margin-top:4px; }
.new-year-mode .e2ee-chats.dialogs-view .dialog-row {
  grid-template-columns:54px minmax(0,1fr) auto;gap:18px;
  min-height:72px;padding:8px 0;
}
.new-year-mode .e2ee-chats.dialogs-view .dialog-row .avatar { width:54px;height:54px; }
.new-year-mode .dialogs-view .dialog-identity strong { font-size:16px;line-height:23px;font-weight:600; }
.new-year-mode .e2ee-chats.dialogs-view .dialog-copy p { font-size:13.5px;line-height:21px;margin:4px 0 0; }
.new-year-mode .e2ee-chats.dialogs-view .dialog-row::after { left:72px;background:#74608733; }
.new-year-mode .dialogs-view .dialog-time { font-size:12px; }
.new-year-mode :is(#mobile-nav,.mobile-nav) {
  height:var(--new-year-dock-height);
  padding:13px 10px calc(17px + env(safe-area-inset-bottom,0px));
  border:0;border-top:1px solid #b899ce66;border-radius:36px 36px 0 0;
  background:linear-gradient(180deg,#30223db8,#241831b8);box-shadow:0 -3px 18px #ba9cd02b,inset 0 1px #e7c2ef22;backdrop-filter:none;-webkit-backdrop-filter:none;
}
.new-year-mode :is(#mobile-nav,.mobile-nav) .nav-item {
  position:relative;min-height:47px;gap:6px;font-size:12px;line-height:17px;
  font-weight:500;color:#b6a1ce;text-shadow:none;
}
.new-year-mode :is(#mobile-nav,.mobile-nav) [data-section]>svg { width:22px;height:22px; }
.new-year-mode :is(#mobile-nav,.mobile-nav) .nav-item.active { color:#ce9cff; }
.new-year-mode :is(#mobile-nav,.mobile-nav) .nav-item.active>svg { filter:none; }
.new-year-mode :is(#mobile-nav,.mobile-nav) .nav-item.active::after { content:none;display:none; }
/* The body preference also reaches the frozen return page during chat exit. */
body[data-new-year-theme="neutral"] .dialogs-search>label,
body[data-new-year-theme="neutral"] .settings-card { background:#24232d;border-color:#42404d; }
body[data-new-year-theme="neutral"] :is(#mobile-nav,.mobile-nav) {
  background:#24232deb;border-top-color:#56515f;box-shadow:0 -3px 18px #0003,inset 0 1px #ffffff0a;
}
body[data-new-year-theme="neutral"] :is(.contacts-head,.list-head,.settings-overview>.settings-head) h1 { text-shadow:none; }
@media(max-width:760px) {
  .new-year-mode:is(.list-mode,.settings-mode) #main { padding-top:max(64px,calc(20px + env(safe-area-inset-top,0px))); }
}
@media(min-width:761px) {
  .new-year-mode #main { padding-top:86px; }
}

/* The picker uses the same artwork and composition as the live scene. */
.theme-options { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px; }
.theme-option { min-width:0;position:relative;padding:0 0 12px;border:1px solid #7a5b8b55;border-radius:17px;background:#21172eea;color:var(--text);font:inherit;cursor:pointer;overflow:hidden; }
.theme-option:focus-visible { outline:3px solid #c393ff;outline-offset:3px; }
.theme-option[aria-checked="true"] { border-color:#c393ff;box-shadow:0 0 0 2px #b879ed44; }
.theme-option-label { display:block;min-height:43px;padding:11px 6px 0;font-size:13px;line-height:17px;font-weight:600;text-align:center; }
.theme-option-check { position:absolute;top:8px;right:7px;width:21px;height:21px;display:grid;place-items:center;border-radius:50%;background:#b76bff;color:white;font-size:14px;opacity:0; }
.theme-option[aria-checked="true"] .theme-option-check { opacity:1; }
.theme-thumbnail { position:relative;inset:auto;width:100%;aspect-ratio:390/660;display:block;border-radius:15px 15px 0 0;--new-year-dock-height:24px; }
.theme-sample { position:absolute;inset:0;display:flex;flex-direction:column;padding:28% 8% 0;gap:9px; }
.theme-sample-title { width:32%;height:4px;border-radius:2px;background:#e4d7f4; }
.theme-sample-search { height:9px;border:1px solid #7d5d8b55;border-radius:3px;background:#402c4f88; }
.theme-sample-row { position:relative;margin-left:19%;height:14px;border-bottom:1px solid #ffffff13; }
.theme-sample-row::before { content:"";position:absolute;right:105%;top:0;width:12px;height:12px;border-radius:50%;background:linear-gradient(130deg,#c8a0d7,#754d9e); }
.theme-sample-row::after { content:"";position:absolute;top:2px;left:0;width:67%;height:2px;background:#d8c9e5aa;box-shadow:0 5px #b29dc766; }
.theme-sample-nav { position:absolute;bottom:0;left:0;right:0;height:21px;border-top:1px solid #b899ce66;border-radius:7px 7px 0 0;background:#30223db8; }
.theme-option[data-theme-choice="neutral"],
.theme-thumbnail[data-theme="neutral"] .theme-sample-search { background:#24232d; }
.theme-thumbnail[data-theme="neutral"] .theme-sample-nav { background:#24232deb;border-top-color:#56515f; }
.theme-options[aria-busy="true"] .theme-option { cursor:progress; }
@media(max-width:360px) { .theme-options { gap:8px; }.theme-option-label { font-size:12px; }.theme-sample { gap:6px; } }
@media(min-width:761px) { .theme-options { grid-template-columns:repeat(4,minmax(0,1fr));gap:16px; }.theme-sample { gap:13px; } }

/* During back navigation retain the one decoded catalog background. Repainting
   an image clone in a transformed/filter layer can use a different raster and
   flashes when Safari hands it back to the fixed live scene. */
body.swipe-back-active>.new-year-scene[hidden]{display:block!important}
body.swipe-back-active>.swipe-return-preview.new-year-mode{background:transparent}
body.swipe-back-active>.swipe-return-preview.new-year-mode>.new-year-scene{visibility:hidden}

/* Keep labels readable over bright decorations. */
.new-year-mode :is(#mobile-nav,.mobile-nav){background:#21182ef5}

.watch-link{display:block;margin:10px 0 2px;padding:10px 16px;border:1px solid #c9a2ff70;border-radius:14px;background:#22162b66;color:#f5eaff;font-family:inherit;font-weight:600;font-size:14px;line-height:1.3;cursor:pointer}
.watch-link.has-preview{width:100%;max-width:360px;overflow:hidden;text-align:left;padding:12px}
/* Reserve the card width before its lazy thumbnail reveals an intrinsic size.
   Existing message max-width rules keep the bubble inside narrow histories. */
.chat-layout .message:has(.watch-link.has-preview){width:384px}
.message:has(.watch-link) .message-text:empty,.message:has(.watch-link) .message-text:empty+.message-time-space{display:none}
.bubble:has(>.message-content>.message-text:empty)>.watch-link{margin-top:0}
.chat-layout .message:has(.watch-link):focus-visible{outline:2px solid #c5a7ff;outline-offset:3px;border-radius:16px}
html:not([data-input-modality=keyboard]) :is(.watch-link,.message:has(.watch-link)):focus{outline:none;box-shadow:none}
.watch-preview-image{display:block;width:calc(100% + 24px);max-width:none;aspect-ratio:16/9;object-fit:cover;background:#130d21;margin:-12px -12px 12px;border-radius:13px 13px 0 0}
.watch-preview-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;overflow-wrap:anywhere;white-space:normal;margin-bottom:10px;font-size:15px;line-height:1.35;font-weight:600}
.watch-invitation{position:relative;margin:0 0 10px;z-index:5;border:1px solid #c19aff66;border-radius:16px;padding:12px;background:#261b38f2;color:#ede0ff;box-shadow:0 8px 25px #0004}
.watch-invitation[hidden],.watch-viewer [hidden]{display:none!important}
.watch-invitation{display:flex;align-items:center;gap:12px;text-align:left;min-height:72px;padding:10px 12px}
.watch-invitation-cover{display:block;flex:0 0 76px;width:76px;height:48px;object-fit:cover;border-radius:9px;background:#120c1d}
.watch-invitation-copy{display:flex;flex:1;min-width:0;flex-direction:column;gap:3px}
.watch-invitation-caption{font-size:10px;line-height:14px;color:#c9b1e0}
.watch-invitation-title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:13px;line-height:17px;font-weight:600}
.watch-invitation-action{font-size:11px;line-height:16px;color:#dcc3fb;white-space:nowrap}
dialog.watch-viewer{--watch-accent:#b98aef;--watch-left:max(24px,env(safe-area-inset-left,0px));--watch-right:max(24px,env(safe-area-inset-right,0px));position:fixed;inset:0;margin:0;max-width:100vw;max-height:100vh;max-height:100dvh;width:100%;height:100%;padding:0;border:0;border-radius:0;background:#050407;color:#fff;overflow:hidden;overscroll-behavior:none;font-family:Manrope,system-ui,sans-serif;touch-action:manipulation;box-sizing:border-box;color-scheme:dark}
.watch-viewer::backdrop{background:#050407}
.watch-viewer *{box-sizing:border-box}
.watch-viewer button,.watch-viewer textarea{font:inherit}
.watch-viewer button{cursor:pointer;color:inherit;-webkit-tap-highlight-color:transparent}
.watch-viewer button:disabled{opacity:.4;cursor:default}
.watch-viewer button:focus-visible,.watch-viewer input:focus-visible{outline:2px solid #cf9eff;outline-offset:3px}
.watch-viewer svg{display:block;width:22px;height:22px;flex-shrink:0}
.watch-screen,.watch-provider{position:absolute;inset:0;background:#050407}
.watch-provider iframe{display:block;width:100%;height:100%;border:0}
.watch-capture{position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;z-index:1}
.watch-header{position:absolute;z-index:3;left:0;right:0;top:0;height:calc(env(safe-area-inset-top,0px) + 74px);padding:calc(env(safe-area-inset-top,0px) + 14px) var(--watch-right) 20px var(--watch-left);display:flex;align-items:center;gap:14px;background:linear-gradient(#09061077,transparent);pointer-events:none}
.watch-header>*{pointer-events:auto}
.watch-header-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto;margin-left:auto}
.watch-icon.watch-settings{margin-left:0;width:40px;height:40px;flex:0 0 40px;border:1px solid #ffffff24;background:#251c34dd;color:#f3eafb;box-shadow:0 3px 12px #0003}
.watch-settings svg{width:22px;height:22px;stroke-width:1.8}
.watch-settings[aria-expanded="true"]{background:#a855f7;border-color:#d3a3ff;color:#fff;box-shadow:0 0 0 2px #a855f733}
.watch-settings:active{background:#443052}
.watch-settings-help{position:absolute;z-index:5;top:calc(env(safe-area-inset-top,0px) + 66px);left:var(--watch-left);right:var(--watch-right);margin:0;padding:10px 14px;border-radius:12px;background:#191124ed;font-size:11px;line-height:16px;pointer-events:none}
.watch-icon{width:32px;height:32px;flex:0 0 32px;display:grid;place-items:center;border:0;border-radius:50%;background:transparent;color:#eee9f5;font-size:26px!important;line-height:1;padding:0}
.watch-back{width:24px;flex-basis:24px}.watch-back svg{width:20px;height:20px}
.watch-avatar{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;flex:0 0 34px;overflow:hidden;border:1px solid #d2b2f25c;border-radius:50%;background:#362441;color:#efe2ff;font-size:12px;box-shadow:0 1px 5px #0005}
.watch-avatar>.avatar{display:block;position:relative;width:100%;height:100%;min-width:0;flex:none;margin:0;border:0;border-radius:50%;box-shadow:none}
.watch-avatar .presence-online{display:none}
.watch-avatar .avatar-photo{width:100%;height:100%;object-fit:cover;border-radius:50%}
.watch-state{min-width:0;max-width:180px;overflow:hidden;display:flex;align-items:center;gap:7px;margin:0;padding:6px 10px;border:1px solid #ffffff0b;border-radius:20px;background:#160f2080;color:#e3d9e9;font-size:10px;font-weight:400;line-height:16px;white-space:nowrap;box-shadow:0 2px 10px #0002}
.watch-state::before{content:'';width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:#bda6d1}
.watch-state.is-synced::before{background:#45d778;box-shadow:0 0 7px #49d77b55}
.watch-state.is-expanded{position:absolute;top:calc(env(safe-area-inset-top,0px) + 66px);left:var(--watch-left);right:var(--watch-right);max-width:580px;margin-left:auto;overflow:visible;white-space:normal;font-size:12px;border-radius:12px;padding:10px 14px;background:#160f20e8}
.watch-members{display:flex;align-items:center;flex:0 0 auto;padding:0 0 0 6px;border:0;background:transparent}
.watch-members .watch-participant{width:30px;height:30px;flex-basis:30px;border:1.5px solid #23162e;margin-left:-7px;transition:opacity .15s}
.watch-members .is-away{opacity:.45}
.watch-recovery{position:absolute;z-index:4;top:calc(env(safe-area-inset-top,0px) + 124px);left:var(--watch-left);right:var(--watch-right);display:flex;gap:12px;justify-content:center}
.watch-native .watch-screen{top:var(--watch-native-top,calc(env(safe-area-inset-top,0px) + 130px));bottom:max(12px,env(safe-area-inset-bottom,0px))}
.watch-native :is(.watch-capture,.watch-controls,.watch-composer,.watch-feed,.watch-history,.watch-recovery){display:none!important}
.watch-controls{position:absolute;z-index:3;bottom:0;left:0;right:0;padding:40px var(--watch-right) calc(env(safe-area-inset-bottom,0px) + 15px) var(--watch-left);background:linear-gradient(transparent,#100a1855);transition:opacity .15s}
.watch-control-row{display:flex;align-items:center;gap:18px;min-width:0;height:38px}
.watch-play{display:grid;place-items:center;width:36px;height:36px;flex:0 0 36px;padding:0;border:1px solid #f2e5ff65;border-radius:50%;background:#21162944;box-shadow:0 0 10px #d6b0ee12;color:#fff}
.watch-play svg{width:18px;height:18px}
.watch-time{font-size:11px;line-height:16px;white-space:nowrap;font-variant-numeric:tabular-nums;color:#ede6f1;text-shadow:0 1px 5px #0008}
.watch-progress,.watch-volume{--watch-fill:0%;appearance:none;-webkit-appearance:none;min-width:0;flex:1;width:100%;height:28px;margin:0;padding:0;background:transparent;cursor:ew-resize;outline-offset:1px}
.watch-progress::-webkit-slider-runnable-track,.watch-volume::-webkit-slider-runnable-track{height:3px;border-radius:4px;background:linear-gradient(to right,var(--watch-accent) 0 var(--watch-fill),#d8c7e15c var(--watch-fill) 100%)}
.watch-progress::-moz-range-track,.watch-volume::-moz-range-track{height:3px;border:0;border-radius:4px;background:#d8c7e15c}
.watch-progress::-moz-range-progress,.watch-volume::-moz-range-progress{height:3px;border-radius:4px;background:var(--watch-accent)}
.watch-progress::-webkit-slider-thumb,.watch-volume::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:12px;height:12px;margin-top:-4.5px;border:1px solid #ead5fd;border-radius:50%;background:var(--watch-accent);box-shadow:0 1px 5px #0003}
.watch-progress::-moz-range-thumb,.watch-volume::-moz-range-thumb{width:10px;height:10px;border:1px solid #ead5fd;border-radius:50%;background:var(--watch-accent);box-shadow:0 1px 5px #0003}
.watch-speaker{display:grid;place-items:center;flex:0 0 28px;width:28px;height:36px;padding:0;border:0;background:transparent;color:#f5effa}
.watch-volume-panel{position:absolute;right:var(--watch-right);bottom:calc(env(safe-area-inset-bottom,0px) + 64px);display:flex;flex-direction:column;gap:8px;width:210px;padding:10px 16px;border:1px solid #ffffff22;border-radius:18px;background:#1c1429ef;box-shadow:0 6px 24px #0004}
.watch-audio-toggle{border:0;background:transparent;text-align:left;padding:4px 0;font-size:13px!important}
.watch-volume-help{font-size:11px;line-height:16px;color:#c9b1e0}
.watch-writing .watch-volume-panel{bottom:calc(env(safe-area-inset-bottom,0px) + 134px)}
.watch-volume{--watch-fill:100%;width:118px;height:24px}
.watch-volume-panel .watch-volume{flex:0 0 24px;width:100%;min-height:24px}
.watch-pill{border:1px solid #ffffff30;background:#241a32cc;border-radius:22px;padding:10px 15px;font-size:12px!important;white-space:nowrap}
.watch-feed{position:absolute;z-index:2;left:var(--watch-left);right:var(--watch-right);bottom:calc(env(safe-area-inset-bottom,0px) + 77px);display:flex;flex-direction:column;align-items:flex-start;gap:8px;pointer-events:none}
.watch-message,.watch-message.mine{display:flex;align-items:center;align-self:flex-start;flex-direction:row;gap:8px;max-width:min(76%,560px);animation:watch-appear .18s ease-out,watch-disappear .3s 4.7s forwards}
.watch-message-avatar{width:28px;height:28px;flex-basis:28px;border-color:#c7a5e566}
.watch-message-text,.watch-message.mine .watch-message-text{display:block;background:#120b1d38;border:0;border-radius:6px;padding:5px 8px;line-height:1.4;font-size:12px;font-weight:400;color:#fff;text-shadow:0 1px 4px #000b;white-space:pre-wrap;overflow-wrap:anywhere;max-height:72px;overflow:hidden}
.watch-composer{position:absolute;z-index:6;bottom:calc(env(safe-area-inset-bottom,0px) + 76px);left:max(66px,calc(env(safe-area-inset-left,0px) + 16px));right:max(66px,calc(env(safe-area-inset-right,0px) + 16px));display:flex;align-items:center;gap:10px;min-height:45px;padding:5px 6px 5px 12px;border:1px solid #cfabfa2c;border-radius:24px;background:#191124e8;box-shadow:0 2px 14px #08040e66}
.watch-composer textarea{min-width:0;flex:1;resize:none;max-height:100px;min-height:24px;line-height:24px;background:transparent!important;border:0!important;outline:none!important;color:#fff;box-shadow:none!important;padding:0!important;font-size:16px}
.watch-composer textarea::placeholder{color:#c2afcea6}
.watch-entry{position:relative;flex:1;min-width:0}
.watch-entry textarea{display:block;width:100%;margin:0}
.watch-input-hint{position:absolute;left:0;right:0;top:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;line-height:24px;font-size:16px;color:#c2afcea6}
.watch-send{display:grid;place-items:center;width:36px;height:36px;min-width:36px;flex:0 0 36px;padding:0;border:0;border-radius:50%;background:#a855f7;box-shadow:none;color:#fff}
.watch-send svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round}
.watch-send:active{background:#9341e7;color:#fff}
/* Quiet viewing shows the film and incoming messages. One tap reveals the HUD. */
.watch-viewer:not(.watch-ui-visible):not(.watch-needs-player) .watch-recovery{visibility:hidden;pointer-events:none}
.watch-viewer:not(.watch-ui-visible) .watch-feed{bottom:calc(env(safe-area-inset-bottom,0px) + 24px)}
.watch-ui-visible.watch-writing .watch-feed{bottom:calc(env(safe-area-inset-bottom,0px) + 134px)}
.watch-ui-visible .watch-message{animation:watch-appear .18s ease-out}
/* Fit the existing player above the composer while the keyboard is visible. */
.watch-keyboard-open .watch-screen{bottom:calc(var(--watch-composer-height,46px) + 16px)}
.watch-keyboard-open .watch-controls{opacity:0;visibility:hidden;pointer-events:none}
.watch-keyboard-open.watch-writing .watch-feed{bottom:calc(var(--watch-composer-height,46px) + 16px);gap:4px}
.watch-keyboard-open .watch-message-text{font-size:11px;line-height:14px;padding:2px 6px;max-height:28px}
.watch-keyboard-open .watch-composer{bottom:8px}
.watch-history{position:absolute;z-index:5;inset:calc(env(safe-area-inset-top,0px) + 68px) var(--watch-right) calc(env(safe-area-inset-bottom,0px) + 80px) var(--watch-left);max-width:560px;margin-left:auto;padding:18px;border:1px solid #d5b7f940;border-radius:20px;background:#161020f5;display:flex;flex-direction:column}
.watch-history header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:12px}
.watch-history-rows{overflow-y:auto;overscroll-behavior:contain}.watch-history-rows p{width:fit-content;max-width:88%;margin:0 0 9px;padding:10px 14px;border-radius:15px;background:#30243f;white-space:pre-wrap;overflow-wrap:anywhere}.watch-history-rows .mine{margin-left:auto;background:#64369d}
@keyframes watch-disappear{to{opacity:0}}
@keyframes watch-appear{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media(max-width:600px){dialog.watch-viewer{--watch-left:max(16px,env(safe-area-inset-left,0px));--watch-right:max(16px,env(safe-area-inset-right,0px))}.watch-header{gap:9px}.watch-state{font-size:9px;padding:5px 8px;gap:5px}.watch-avatar{width:30px;height:30px;flex-basis:30px}.watch-members .watch-participant{width:27px;height:27px;flex-basis:27px}.watch-control-row{gap:12px}.watch-time{font-size:10px}.watch-composer{left:var(--watch-left);right:var(--watch-right)}.watch-message,.watch-message.mine{max-width:90%}}
@media(max-width:360px){.watch-header{gap:7px}.watch-state{font-size:8px;padding:4px 6px}.watch-control-row{gap:10px}.watch-play{width:32px;height:32px;flex-basis:32px}.watch-members .watch-participant{width:24px;height:24px;flex-basis:24px}}
@media(orientation:landscape) and (max-height:600px){.watch-header{height:calc(env(safe-area-inset-top,0px) + 66px);padding-top:calc(env(safe-area-inset-top,0px) + 10px);padding-bottom:14px}.watch-controls{padding-top:32px;padding-bottom:calc(env(safe-area-inset-bottom,0px) + 12px)}.watch-feed{bottom:calc(env(safe-area-inset-bottom,0px) + 69px)}.watch-message-avatar{width:28px;height:28px;flex-basis:28px}.watch-recovery{top:110px}}
@media(orientation:landscape) and (max-height:600px){.watch-ui-visible .watch-message-text{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:16px;padding:4px 6px;max-height:40px;min-width:0}.watch-keyboard-open.watch-writing .watch-feed{gap:2px}.watch-keyboard-open .watch-message{gap:6px}.watch-keyboard-open .watch-message-avatar{width:18px;height:18px;flex-basis:18px}.watch-keyboard-open .watch-message-text{display:block;white-space:nowrap;text-overflow:ellipsis;line-height:14px;font-size:10px;padding:2px 6px;max-height:18px}}
@media(prefers-reduced-motion:reduce){.watch-message{animation:none}.watch-controls,.watch-members .watch-participant{transition:none}}
@media(max-width:760px){.watch-invitation{position:absolute;top:var(--chat-history-top,62px);left:20px;right:20px;margin:0}.chat-layout[data-watch-room] .messages{padding-top:calc(var(--chat-history-top,62px) + var(--watch-banner-height,80px));scroll-padding-top:calc(var(--chat-history-top,62px) + var(--watch-banner-height,80px))}}

.watch-icon.watch-end{width:40px;height:40px;flex:0 0 40px;border:1px solid #d795ab40;background:#2c1c2ddd;color:#f0b4c6;box-shadow:0 3px 12px #0003}
.watch-end svg{width:21px;height:21px;stroke-width:1.8}
.watch-end:active{background:#4a263a}

.watch-sync{display:grid;place-items:center;flex:0 0 28px;width:28px;height:36px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--watch-accent)!important}
.watch-sync svg{width:19px;height:19px}
.watch-sync[aria-busy="true"]{opacity:.5}
.watch-sync:active{background:#b98aef25}

