:root{font-family:Inter,"Segoe UI",sans-serif;color:#172B4D;background:#F5F7FB;--blue:#0068FF;--accent:#0052CC;--pale:#EAF3FF;--card:#fff;--bg:#F5F7FB;--text:#172B4D;--muted:#6C7D96;--line:#e4eaf2;color-scheme:light}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,a,input,select,textarea{outline-offset:4px}button{cursor:pointer;border:0;border-radius:12px;padding:11px 16px;background:var(--pale);color:var(--blue);font-weight:600;min-height:44px}button:hover{filter:brightness(.97)}button:disabled{opacity:.55;cursor:wait}button.primary{background:var(--blue);color:white}button.danger{background:#fff0f0;color:#bc3248}button.ghost{background:transparent;color:var(--muted)}a{color:var(--blue)}input,textarea,select{border:1px solid var(--line);border-radius:10px;padding:12px;background:var(--card);color:var(--text);width:100%}textarea{resize:vertical}label{display:block;font-size:14px;font-weight:600;margin:13px 0 6px}label.check{display:flex;align-items:center;gap:9px;font-weight:400}label.check input{width:18px;height:18px}h1,h2,h3,p{margin-top:0}h1{font-size:28px;letter-spacing:-1px}h2{font-size:22px;letter-spacing:-.6px}h3{font-size:17px}p{line-height:1.6}small,.muted{color:var(--muted);line-height:1.6}small{font-size:12px}.row{display:flex;gap:12px;align-items:center}.between{justify-content:space-between}.wrap{flex-wrap:wrap}.grow{flex:1;min-width:0}.stack{display:grid;gap:16px}.card{background:var(--card);border:1px solid var(--line);border-radius:20px;padding:24px}.badge{display:inline-block;border-radius:6px;background:var(--pale);color:var(--blue);padding:4px 8px;font-size:11px;font-weight:700}.brand{font-weight:900;letter-spacing:-2px;font-size:34px;color:var(--blue);text-decoration:none}.logo-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#64c4ff;margin-left:2px}.avatar{display:grid;place-items:center;flex-shrink:0;width:48px;height:48px;border-radius:16px;background:var(--pale);color:var(--blue);font-size:19px;font-weight:700;overflow:hidden}.avatar img{width:100%;height:100%;object-fit:cover}.avatar.big{width:66px;height:66px;font-size:27px;border-radius:22px}.ico{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle}.app-shell{min-height:100dvh;display:grid;grid-template-columns:244px 1fr}.side{position:fixed;inset:0 auto 0 0;width:244px;background:var(--card);border-right:1px solid var(--line);display:flex;flex-direction:column;padding:30px 22px;z-index:20}.side .brand{margin:0 12px 35px}.side nav{display:grid;gap:6px}.side nav button{display:flex;gap:13px;align-items:center;text-align:left;color:var(--muted);background:none;font-size:14px}.side nav button.active{background:var(--pale);color:var(--blue)}.side-bottom{margin-top:auto}.side .mini{padding:18px 0;border-top:1px solid var(--line);margin-top:20px}.main{grid-column:2;min-width:0}.topbar{height:88px;display:flex;align-items:center;justify-content:space-between;padding:0 40px;border-bottom:1px solid var(--line);background:var(--card)}.topbar h2{margin:0}.topbar .brand{display:none}.content{max-width:1240px;margin:0 auto;padding:32px 40px 50px}.intro{margin-bottom:24px}.intro h1{margin-bottom:5px}.home-grid{display:grid;grid-template-columns:1.65fr 1fr;gap:24px}.account{background:linear-gradient(120deg,#0068FF,#2486ff);color:#fff;border:0;position:relative;overflow:hidden;padding:30px}.account:after{content:'';position:absolute;width:220px;height:220px;right:-90px;top:-100px;border:32px solid #ffffff10;border-radius:50%;pointer-events:none}.account .muted,.account small{color:#d7e9ff}.account .avatar{background:#ffffff24;color:white}.account .badge{background:#ffffff22;color:white}.account button{background:white;color:var(--blue)}.functions{display:grid;grid-template-columns:repeat(4,1fr);gap:24px 14px;margin-top:28px}.function{text-align:center;background:none;padding:0;color:var(--text);font-size:13px;font-weight:500}.function>span{display:grid;place-items:center;background:var(--blue);color:white;width:64px;height:64px;border-radius:20px;margin:0 auto 11px;box-shadow:0 7px 14px #0068ff14}.function .ico{width:28px;height:28px}.section-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.section-title h3{margin:0}.section-title button{font-size:12px;padding:5px 8px;min-height:32px}.empty{padding:35px 14px;text-align:center}.empty .ico{width:40px;height:40px;color:#a2b5ce;margin-bottom:15px}.empty p{font-size:14px;color:var(--muted);margin-bottom:15px}.list-item{padding:14px 0;border-bottom:1px solid var(--line);display:flex;gap:12px;align-items:center}.list-item:last-child{border:0}.list-item strong{font-size:14px}.list-item p{font-size:13px;margin:3px 0;color:var(--muted)}.list-item button{padding:8px 12px;font-size:12px}.tip{background:var(--pale);border:0;padding:22px}.tip h3{color:var(--blue);margin:13px 0 6px}.tip p{font-size:13px;margin-bottom:0}.footnote{margin-top:24px;font-size:12px;color:var(--muted)}.bottom-nav{display:none}.auth{display:grid;grid-template-columns:1.1fr 1fr;min-height:100dvh}.auth-art{background:var(--blue);color:white;padding:55px;display:flex;flex-direction:column;justify-content:space-between;overflow:hidden}.auth-art .brand{color:white}.auth-art h1{font-size:58px;line-height:1.12;max-width:530px;letter-spacing:-3px}.auth-art p{color:#d9e9ff;max-width:390px}.auth-art .circles{display:flex;gap:15px;margin:30px 0}.circles span{background:#ffffff1a;border:1px solid #ffffff35;border-radius:25px;padding:25px}.circles .ico{width:40px;height:40px}.auth-form{display:flex;align-items:center;justify-content:center;padding:35px}.auth-form>div{width:100%;max-width:400px}.auth-form h1{margin:28px 0 8px}.auth-form form>button{width:100%;margin-top:22px}.test-note{background:#fff7e7;color:#8c651d;padding:12px;border-radius:12px;font-size:12px;margin-top:18px}.auth-links{display:flex;justify-content:space-between;gap:10px;margin-top:14px}.auth-links button{font-size:12px;padding:5px;min-height:32px}.legal-links{display:flex;flex-wrap:wrap;gap:10px;margin-top:26px}.legal-links button{font-size:11px;padding:4px;min-height:25px}.people-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.person .avatar{margin-bottom:16px}.person p{font-size:13px;min-height:40px}.person .row button{flex:1}.filters{display:flex;gap:14px;align-items:end;flex-wrap:wrap;margin:20px 0}.filters>div{flex:1;min-width:130px}.filters label{margin-top:0}.plans{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.plan{display:flex;flex-direction:column}.plan:nth-child(2){border-color:var(--blue);box-shadow:0 10px 40px #0068ff0b}.price{font-size:30px;font-weight:800;margin:18px 0}.plan ul{padding-left:20px;font-size:14px;line-height:2;color:var(--muted)}.plan button{margin-top:auto}.settings{max-width:740px}.settings .row{align-items:start}.settings .row>div{flex:1}.tabs{display:flex;gap:8px;margin-bottom:24px;flex-wrap:wrap}.tabs button{background:var(--card);color:var(--muted)}.tabs button.active{background:var(--blue);color:white}.chat-layout{display:grid;grid-template-columns:310px 1fr;height:calc(100dvh - 88px);min-height:350px}.chat-list{background:var(--card);border-right:1px solid var(--line);padding:20px;overflow:auto}.chat-list .list-item{cursor:pointer;border-radius:12px;padding:14px 8px}.chat-list .list-item.selected{background:var(--pale)}.chat-panel{display:flex;flex-direction:column;min-width:0;min-height:0}.chat-head{background:var(--card);padding:16px 24px;border-bottom:1px solid var(--line)}.messages{flex:1;overflow:auto;padding:26px;display:flex;flex-direction:column;gap:16px}.bubble{align-self:flex-start;max-width:80%;background:var(--card);border:1px solid var(--line);border-radius:16px 16px 16px 3px;padding:12px 15px;word-break:break-word}.bubble.own{align-self:flex-end;background:var(--pale);border:0;border-radius:16px 16px 3px 16px}.bubble p{margin:4px 0 5px;white-space:pre-wrap;font-size:14px}.bubble small{font-size:10px}.bubble button{font-size:10px;padding:2px 5px;min-height:24px}.composer{background:var(--card);border-top:1px solid var(--line);padding:15px 20px;display:flex;gap:10px;align-items:center}.composer input{background:var(--bg);border:0}.composer button{padding:10px}.typing{height:23px;font-size:11px;padding-left:24px;color:var(--muted)}dialog{border:1px solid var(--line);border-radius:22px;background:var(--card);color:var(--text);width:min(620px,92vw);max-height:85dvh;padding:28px}dialog::backdrop{background:#10244377;backdrop-filter:blur(4px)}dialog .close{float:right}#toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);background:#172b4d;color:white;padding:14px 20px;border-radius:12px;z-index:100;display:none;max-width:90vw;box-shadow:0 10px 40px #0003}table{width:100%;border-collapse:collapse;font-size:13px}th,td{text-align:left;padding:12px 8px;border-bottom:1px solid var(--line)}.table-wrap{overflow:auto}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:15px;margin-bottom:24px}.stats strong{display:block;font-size:30px;margin-bottom:4px}.loading{padding:40px;color:var(--muted)}.error{color:#b52e49;padding:18px;background:#ffeff2;border-radius:12px}.checkboxes{display:grid;grid-template-columns:1fr 1fr;gap:4px}.mobile-back{display:none}.unread{background:var(--blue);color:white;border-radius:20px;padding:3px 7px;font-size:11px}.dark{--card:#162337;--bg:#101a29;--text:#e7eef9;--muted:#9aadca;--line:#29384c;--pale:#183555;color-scheme:dark;background:var(--bg);color:var(--text)}.dark .danger{background:#4a2330;color:#ffb6c5}.dark .test-note{background:#3b301b;color:#edce8b}
@media(max-width:1100px){.app-shell{grid-template-columns:200px 1fr}.side{width:200px;padding:25px 13px}.content{padding:26px}.topbar{padding:0 26px}.home-grid{grid-template-columns:1fr}.people-grid{grid-template-columns:repeat(2,1fr)}.chat-layout{grid-template-columns:270px 1fr}.home-grid>aside{display:grid;grid-template-columns:1fr 1fr;gap:20px}.auth-art{padding:35px}.auth-art h1{font-size:44px}.plans{gap:12px}}
@media(max-width:720px){.app-shell{display:block}.side{display:none}.main{width:100%}.topbar{height:76px;padding:0 20px;background:var(--blue);color:white;border:0}.topbar h2{display:none}.topbar .brand{display:block;color:white;font-size:32px}.topbar button{color:white;background:#ffffff1c}.topbar .avatar{display:none}.content{padding:22px 18px 115px}.intro h1{font-size:25px}.intro{margin-bottom:20px}.home-grid{gap:22px}.home-grid>aside{display:grid;grid-template-columns:1fr;gap:18px}.card{padding:20px;border-radius:18px}.account{background:var(--card);color:var(--text);border:1px solid var(--line);box-shadow:0 8px 25px #172b4d08}.account:after{display:none}.account .muted,.account small{color:var(--muted)}.account .avatar{background:var(--pale);color:var(--blue)}.account .badge{background:var(--pale);color:var(--blue)}.account button{background:var(--blue);color:white}.functions{gap:23px 8px;margin-top:24px}.function>span{width:58px;height:58px;border-radius:18px}.function{font-size:12px;min-width:0}.bottom-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;bottom:0;left:0;right:0;background:var(--card);padding:8px 4px calc(8px + env(safe-area-inset-bottom));border-top:1px solid var(--line);z-index:30}.bottom-nav button{display:flex;flex-direction:column;align-items:center;gap:5px;font-size:10px;background:none;color:var(--muted);padding:8px 0 4px}.bottom-nav button.active{color:var(--blue)}.bottom-nav button.center span{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;background:var(--blue);color:white;margin-top:-26px;border:4px solid var(--bg);box-shadow:0 4px 12px #0068ff22}.bottom-nav .ico{width:22px;height:22px}.bottom-nav button.center .ico{width:24px;height:24px}.auth{display:block;background:var(--bg)}.auth-art{padding:28px;min-height:220px}.auth-art h1{font-size:32px;letter-spacing:-1px;margin:24px 0 5px}.auth-art p,.auth-art footer,.auth-art .circles{display:none}.auth-form{padding:30px 24px}.auth-form h1{font-size:25px;margin-top:0}.people-grid{grid-template-columns:repeat(2,1fr);gap:12px}.person{padding:17px}.person .row{flex-wrap:wrap;gap:6px}.person .row button{font-size:12px;padding:8px}.plans{grid-template-columns:1fr}.settings .row{flex-wrap:wrap}.settings .row>div{min-width:100%}.chat-layout{height:calc(100dvh - 76px - 80px);display:block}.chat-list{height:100%;border:0}.chat-panel{display:none;height:100%}.chat-layout.open .chat-list{display:none}.chat-layout.open .chat-panel{display:flex}.chat-head{padding:12px}.chat-head .avatar{width:38px;height:38px;border-radius:12px}.mobile-back{display:inline-block}.chat-layout.open{height:calc(100dvh - 76px)}body.in-chat .bottom-nav{display:none}.composer{padding:10px 8px calc(10px + env(safe-area-inset-bottom));gap:5px}.composer input{padding:12px 8px}.messages{padding:18px}.bubble{max-width:88%}.stats{grid-template-columns:1fr 1fr}.filters{gap:10px}.filters>div{min-width:100px}#toast{bottom:95px}.checkboxes{grid-template-columns:1fr}}
@media(max-width:340px){.functions{grid-template-columns:repeat(2,1fr)}.people-grid{grid-template-columns:1fr}}
.brand-image{display:block;max-width:120px;max-height:44px;object-fit:contain}.chat-image{display:block;max-width:100%;max-height:280px;border-radius:10px;margin-bottom:9px}
.apple-login{background:#000;color:#fff;border:1px solid #777;width:100%;margin-top:10px}.apple-login:hover{background:#222}
/* Compact spacing for BLU on desktop and mobile; touch controls stay 44px. */
h1{margin-bottom:12px}h2,h3{margin-bottom:10px}p{margin-bottom:10px;line-height:1.45}
.card{padding:16px;border-radius:14px}.stack{gap:12px}.row{gap:10px}
.app-shell{grid-template-columns:208px 1fr}.side{width:208px;padding:20px 14px}.side .brand{margin:0 10px 18px}.side .mini{padding:12px 0;margin-top:12px}
.topbar{height:64px;padding:0 24px}.content{padding:20px 24px 28px}.intro{margin-bottom:14px}.intro p{margin-bottom:0}
.home-grid{gap:16px;align-items:start}.home-grid>section{display:grid;gap:12px}.home-grid>aside{gap:12px;align-items:start}.account{padding:18px}.account h2{margin-bottom:6px}.account .muted{margin:6px 0 10px}.account .avatar.big{width:52px;height:52px;border-radius:16px;font-size:23px}.account .between small{flex:1;min-width:0}.account .between button{flex-shrink:0;font-size:12px;padding:9px 10px}.functions{gap:14px 10px;margin-top:14px}.function>span{width:48px;height:48px;border-radius:14px;margin-bottom:6px}.function .ico{width:24px;height:24px}
.section-title{margin-bottom:10px}.empty{padding:16px 8px}.empty .ico{width:28px;height:28px;margin-bottom:8px}.empty h3{margin-bottom:6px}.empty p{margin-bottom:10px}.footnote{margin:4px 0;font-size:11px}.tip{padding:14px}.list-item{padding:10px 0}.person .avatar{margin-bottom:10px}.person p{min-height:0}.people-grid,.plans{gap:12px}.filters{gap:10px;margin:12px 0}.tabs{margin-bottom:14px}.stats{gap:10px;margin-bottom:14px}.stats strong{font-size:26px}
label{margin:10px 0 5px}input,textarea,select{padding:10px;min-height:44px}.legal-links{gap:6px;margin-top:14px}.auth-links{margin-top:10px}.auth-form{padding:24px}.auth-form h1{margin:0 0 8px}.auth-form form>button{margin-top:14px}.auth-art{padding:32px}.auth-art h1{font-size:44px}.auth-art .circles{margin:18px 0}.test-note{margin-top:12px;padding:10px}
.chat-layout{height:calc(100dvh - 64px)}.chat-list{padding:12px}.chat-head{padding:12px 16px}.messages{padding:16px;gap:10px}.composer{padding:10px 12px}.loading{padding:24px}
@media(max-width:1100px){.home-grid>aside{gap:12px}.content{padding:18px}.topbar{padding:0 18px}}
@media(max-width:720px){
 .app-shell{display:block}.topbar{height:60px;padding:0 14px}.topbar .brand{font-size:28px}.content{padding:14px 12px calc(80px + env(safe-area-inset-bottom))}.intro{margin-bottom:12px}.intro h1{font-size:22px;margin-bottom:4px}.intro p{font-size:13px}.home-grid{gap:12px}.card{padding:14px;border-radius:14px}.account h2{font-size:19px}.account .muted{font-size:13px}.account .between{gap:8px}.functions{gap:12px 6px;margin-top:10px}.function>span{width:44px;height:44px;border-radius:12px}.function{font-size:11px}.home-grid>aside{gap:12px}.empty{padding:12px 6px}
 .bottom-nav{padding:4px 4px calc(4px + env(safe-area-inset-bottom))}.bottom-nav button{gap:3px;padding:6px 0 4px}.bottom-nav button.center span{width:44px;height:44px;margin-top:-16px}
 .auth-art{min-height:0;padding:14px 20px}.auth-art .brand{font-size:30px}.auth-art h1{display:none}.auth-form{padding:20px}.auth-form h1{font-size:23px}.auth-form .muted{font-size:14px}.auth-links{gap:6px}
 .settings .row>div{min-width:0}.settings .row .avatar{margin-bottom:0}.people-grid{gap:10px}.person{padding:12px}.filters{gap:8px}.chat-layout{height:calc(100dvh - 60px - 64px - env(safe-area-inset-bottom))}.chat-layout.open{height:calc(100dvh - 60px)}.messages{padding:12px}.composer{padding:8px 8px calc(8px + env(safe-area-inset-bottom))}
}
.side .mini{gap:8px}.side .mini .avatar{width:32px;height:32px;border-radius:10px;font-size:15px}.side .mini .grow strong,.side .mini .grow small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.side .mini .grow br{display:none}.side .mini button{padding:4px;min-width:32px;min-height:36px}
/* Phone controls fit a 9:16 viewport, including 360 x 640. */
@media(max-width:720px){
 button{max-width:100%;min-width:0;padding:8px 12px;border-radius:10px;font-size:13px}
 .topbar{height:52px;padding:0 12px}.topbar .brand{font-size:26px}.topbar .row{gap:6px}.topbar button{width:44px;padding:8px}.topbar .badge{font-size:10px;padding:4px 6px}
 .functions{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px 4px;margin-top:8px}.function{padding:2px 0;font-size:10px;min-height:60px;white-space:nowrap}.function>span{width:36px;height:36px;border-radius:10px;margin-bottom:4px;box-shadow:none}.function .ico{width:21px;height:21px}
 .bottom-nav{padding:4px 2px calc(4px + env(safe-area-inset-bottom));align-items:end}.bottom-nav button{min-height:48px;padding:3px 0;gap:3px;border-radius:0;font-size:10px}.bottom-nav button.center span{width:28px;height:24px;border:0;margin:0;background:none;color:inherit;box-shadow:none;border-radius:0}.bottom-nav button.center .ico{width:22px;height:22px}
 .content{padding:10px 10px calc(68px + env(safe-area-inset-bottom))}.intro{margin-bottom:8px}.intro h1{font-size:20px}.intro p{font-size:12px}.home-grid,.home-grid>section,.home-grid>aside{gap:10px}.card{padding:12px}.account .avatar.big{width:40px;height:40px;font-size:20px;border-radius:12px}.account h2{font-size:17px;margin-bottom:3px}.account .muted{font-size:12px;margin:4px 0 6px}.account .badge{font-size:10px;padding:3px 6px}.account .between small{font-size:10px;line-height:1.35}.account .between button{min-height:44px;padding:7px 9px;font-size:11px;white-space:nowrap}.account .between button .ico{width:18px;height:18px}.home-grid h3{font-size:15px}.footnote{font-size:10px;line-height:1.4}
 .person .row button{flex:1 1 60px;min-height:44px;padding:6px;font-size:11px}.section-title{gap:6px}.section-title button{white-space:nowrap}.tabs{gap:6px}.auth-links button{font-size:11px;padding:4px}.auth-form>div>.primary{width:100%;margin-top:8px}.chat-layout{height:calc(100dvh - 52px - 56px - env(safe-area-inset-bottom))}.chat-layout.open{height:calc(100dvh - 52px)}.chat-head{padding:8px}.chat-head button,.composer button{min-width:44px;min-height:44px;padding:8px}.composer input{min-width:0}.chat-head .row{gap:6px}
}
/* Five primary actions: Messages, Contacts, Nearby, Me and Profile. */
.primary-functions{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.primary-functions .function{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:5px;white-space:normal;line-height:1.25;min-height:76px;font-weight:600}.primary-functions .function>span{margin:0;width:42px;height:42px;border-radius:14px;background:var(--pale);color:var(--blue);box-shadow:none}.primary-functions .function:hover>span{background:var(--blue);color:#fff}
.wall-content{max-width:740px;display:grid;gap:12px}.wall-profile{overflow:hidden}.wall-cover{height:64px;margin:-16px -16px 12px;background:linear-gradient(110deg,#0068ff,#80cfff)}.wall-profile h1{font-size:22px;margin:0 0 5px}.wall-profile .muted{font-size:13px;margin:0}.wall-profile .ghost{margin-top:8px}.wall-compose label{margin-top:0}.wall-compose textarea{min-height:84px}.wall-compose .between{margin-top:8px}.wall-compose small{flex:1}.wall-compose button{flex-shrink:0}.wall-content .section-title{margin:2px 0}.wall-content .section-title h2{font-size:18px;margin:0}.wall-body{white-space:pre-wrap;overflow-wrap:anywhere;margin:12px 0 0}.wall-post .row button{font-size:11px;padding:6px 8px}.wall-posts .empty{background:var(--card);border:1px solid var(--line);border-radius:14px}
@media(max-width:720px){
 .primary-functions{gap:5px;margin-top:8px}.primary-functions .function{font-size:10px;min-height:72px}.primary-functions .function>span{width:38px;height:38px;border-radius:12px}.primary-functions .ico{width:21px;height:21px}
 .bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr));padding-top:5px;align-items:stretch}.bottom-nav button{min-height:54px;justify-content:flex-start;gap:2px;padding:0 1px;color:var(--muted)}.bottom-nav .nav-icon{display:grid;place-items:center;width:38px;height:28px;border-radius:10px}.bottom-nav .nav-label{font-size:10px;line-height:1.1;min-height:22px;display:flex;align-items:center;justify-content:center;white-space:normal;text-align:center}.bottom-nav button.active .nav-icon{background:var(--pale);color:var(--blue)}.bottom-nav button.active .nav-label{color:var(--blue);font-weight:700}
 .wall-cover{height:54px;margin:-12px -12px 10px}.wall-profile .avatar.big{width:48px;height:48px;border-radius:16px}.wall-profile h1{font-size:20px}.wall-content{gap:10px}.wall-compose .between{align-items:center}.wall-content .section-title small{font-size:10px}.chat-layout{height:calc(100dvh - 52px - 63px - env(safe-area-inset-bottom))}
}

/* Incoming message banner: independent of navigation and the chat composer. */
.chat-alert{position:fixed;z-index:1200;top:max(12px,env(safe-area-inset-top));right:16px;width:min(380px,calc(100vw - 24px));display:flex;align-items:flex-start;background:#fff;border:1px solid #dce9fb;border-radius:18px;box-shadow:0 12px 40px #133a7038;overflow:hidden;animation:chat-alert-in .2s ease-out}
.chat-alert-open{display:flex;align-items:center;gap:12px;flex:1;min-width:0;padding:14px;border:0;border-radius:0;background:transparent;color:#172b4d;text-align:left}
.chat-alert-avatar{flex:none;width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:#0068ff;color:white;font-size:19px;font-weight:700}
.chat-alert-text{display:flex;flex-direction:column;gap:4px;min-width:0;flex:1}.chat-alert-text strong,.chat-alert-text>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-alert-text strong{font-size:14px}.chat-alert-text>span{font-size:13px}.chat-alert-text small{font-size:11px;color:#667891}.chat-alert-close{flex:none;background:transparent;border:0;font-size:24px;color:#667891;width:40px;min-height:44px;padding:5px}
.dark .chat-alert{background:#172435;border-color:#304561}.dark .chat-alert-open{color:#eef5ff}.dark .chat-alert-text small,.dark .chat-alert-close{color:#a9bdd8}
@keyframes chat-alert-in{from{opacity:0;transform:translateY(-12px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:720px){.chat-alert{left:12px;right:12px;width:auto}.chat-alert-open{padding:11px;gap:10px}.chat-alert-avatar{width:38px;height:38px}}
@media(prefers-reduced-motion:reduce){.chat-alert{animation:none}}

/* Keep the five primary tabs available inside every mobile view. */
@media(max-width:720px){
 .main{padding-bottom:calc(63px + env(safe-area-inset-bottom))}
 .bottom-nav,body.in-chat .bottom-nav{display:grid;position:fixed;left:0;right:0;bottom:0;z-index:50;height:calc(63px + env(safe-area-inset-bottom));background:var(--card);border-top:1px solid var(--line)}
 .chat-layout,.chat-layout.open{height:calc(100dvh - 52px - 63px - env(safe-area-inset-bottom))}
 .composer{padding:8px;flex-shrink:0}
}

.chat-friend-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 14px;background:var(--card);border-bottom:1px solid var(--line);flex-shrink:0;font-size:12px}.chat-friend-bar button{padding:5px 12px;min-height:34px;font-size:12px}
@media(max-width:720px){
 body.in-chat{overflow:hidden}
 body.in-chat .app-shell{position:fixed;top:var(--blu-chat-top,0px);left:0;width:100%;height:var(--blu-chat-vh,100dvh);min-height:0;overflow:hidden;display:block}
 body.in-chat .main{display:flex;flex-direction:column;height:100%;min-height:0;padding-bottom:calc(63px + env(safe-area-inset-bottom))}
 body.in-chat .topbar{flex:0 0 52px;height:52px}
 body.in-chat #view{flex:1;min-height:0;overflow:hidden}
 body.in-chat .chat-layout.open{height:100%;min-height:0}
 body.in-chat .chat-panel{min-height:0;overflow:hidden}
 body.in-chat .messages{min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
 body.in-chat .bottom-nav{position:absolute;bottom:0}
 .composer input{font-size:16px}.composer{flex-shrink:0}
 .chat-head{flex-shrink:0}.chat-head .grow strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

@media(max-width:720px){
 body.in-chat .topbar{display:none}
 .chat-head{height:48px;padding:2px 6px;gap:6px}.chat-head .avatar{width:30px;height:30px;border-radius:10px}.chat-head .grow br,.chat-head .grow small{display:none}.chat-head .grow strong{font-size:14px}
 body.in-chat .chat-friend-bar{display:none}
 .typing:empty{display:none}.composer{padding:4px 6px;gap:4px;min-height:52px}.composer input{padding:9px 8px}.messages{padding:10px;gap:7px}.bubble{padding:7px 10px}.bubble p{margin:0;line-height:1.4}
 body.in-chat.chat-keyboard .main{padding-bottom:0}
 body.in-chat.chat-keyboard .bottom-nav{display:none}
}
.chat-friend-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}

.friend-tabs{display:flex;gap:4px;margin-bottom:12px}.friend-tabs button{flex:1;padding:8px 4px;font-size:12px}.friend-controls{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.friend-controls button{font-size:12px;padding:6px 10px}.friend-name{background:none;color:var(--text);padding:0;min-height:24px;text-align:left}.friend-count{background:#ed4160;color:white;border-radius:20px;padding:1px 5px;font-size:10px}.bottom-nav button{position:relative}.bottom-nav .friend-count{position:absolute;top:0;right:16%}.person .row{flex-wrap:wrap}.friend-item{align-items:flex-start}

body{font-size:var(--app-font-size,16px)}.bubble p{font-size:var(--chat-font-size,16px)}.message-meta{display:flex;align-items:center;justify-content:flex-end;gap:5px;margin-top:3px;color:var(--muted);font-size:10px;line-height:1.2}.message-meta button{background:none;min-height:26px;padding:2px 5px;font-size:15px;color:var(--muted)}.message-meta .hearted{color:#ed4160}.message-meta time{font-size:10px}.gift-bubble{display:grid;gap:5px;text-align:center}.gift-bubble>span,.gift-icon{font-size:44px}.gift-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.gift-grid .card,.gift-grid button{display:grid;gap:6px;text-align:center}.gift-admin-form{padding:10px 0;border-bottom:1px solid var(--line)}.main{touch-action:pan-y}.chat-image{overflow-anchor:none}.messages{overflow-anchor:none;scroll-behavior:auto}.composer input{font-size:max(16px,var(--app-font-size,16px))}.chat-panel{animation:chat-panel-enter .12s ease-out}@keyframes chat-panel-enter{from{opacity:.7}to{opacity:1}}@media(prefers-reduced-motion:reduce){.chat-panel{animation:none}}
