/* Phone QA fixes requested before inviting beta testers. Desktop is unchanged. */
@media(max-width:420px){
 html body .site-header.site-header{grid-template-rows:46px 38px 42px!important;min-height:0!important}
 html body .site-header.site-header>.brand.brand{align-self:center!important;margin-block:0!important}
 html body .site-header.site-header>.brand.brand>.iw-prototype-badge-brand{left:calc(100% + 6px)!important;top:50%!important;right:auto!important;transform:translateY(-50%)!important;width:80px!important;min-width:0!important;height:34px!important;padding:0!important;box-sizing:border-box!important}
 html body .site-header.site-header>.brand.brand>.iw-prototype-badge-brand .iw-contact-trigger{width:100%!important;min-width:0!important;min-height:0!important;height:100%!important;grid-template-columns:minmax(0,1fr) 16px!important;padding:4px!important}
}
@media(max-width:600px){
 #iwMessagesModal.open{display:flex;flex-direction:column;height:calc(100dvh - 28px);max-height:calc(100dvh - 28px);overflow:hidden}
 #iwMessagesModal>.modal-head{flex:none}
 #iwMessagesModal>#iwMessageSafetyBanner{flex:none;max-height:84px;overflow-y:auto;box-sizing:border-box}
 #iwMessagesModal .iw-system-grid{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
 #iwMessagesModal .iw-thread-list{flex:none;max-height:min(110px,16dvh);overflow-y:auto;box-sizing:border-box}
 #iwMessagesModal .iw-message-pane{flex:1;min-height:0}
 #iwMessagesModal .iw-message-head,#iwMessagesModal .iw-message-compose{flex:none}
 #iwMessagesModal #iwGuardianStatus{flex:none;max-height:70px;overflow-y:auto}
 #iwMessagesModal .iw-message-list{flex:1;height:auto;min-height:0;overflow-y:auto}
 #iwMessagesModal .iw-message-compose{padding-bottom:max(12px,env(safe-area-inset-bottom))}
 #iwMessagesModal #iwRefreshThreads{min-height:28px}
}
/* Requested phone profile: portrait centred beside identity, counts below. */
@media(max-width:650px){
 [data-approved-profile="pre-home-20261011"] .iw-profile-hero{height:auto;min-height:0;padding-top:20px}
 [data-approved-profile="pre-home-20261011"] .iw-profile-cover{height:100%}
 [data-approved-profile="pre-home-20261011"] .iw-profile-identity,
 [data-approved-profile="pre-home-20261011"] .iw-profile-identity:has([data-profile-friend]:not([hidden])){position:relative;left:auto;right:auto;bottom:auto;margin:0;padding:18px 14px 22px;grid-template-columns:94px minmax(0,1fr);gap:6px 14px;align-items:center}
 [data-approved-profile="pre-home-20261011"] .iw-profile-identity>.iw-profile-name{display:contents}
 [data-approved-profile="pre-home-20261011"] .iw-profile-identity>img{grid-column:1;grid-row:1/4;align-self:center}
 [data-approved-profile="pre-home-20261011"] .iw-profile-name>:is(h1,p,em){grid-column:2;margin:0;min-width:0;overflow-wrap:anywhere}
 [data-approved-profile="pre-home-20261011"] .iw-profile-name>h1{grid-row:1;font-size:26px;line-height:1.08}
 [data-approved-profile="pre-home-20261011"] .iw-profile-name>p{grid-row:2}
 [data-approved-profile="pre-home-20261011"] .iw-profile-name>em{grid-row:3}
 [data-approved-profile="pre-home-20261011"] .iw-profile-contact{grid-column:1/-1;grid-row:4;margin:12px 0 2px}
 [data-approved-profile="pre-home-20261011"] .iw-profile-approved-counts,
 [data-approved-profile="pre-home-20261011"] .iw-profile-name:has([data-profile-friend]:not([hidden]))>.iw-profile-approved-counts{grid-column:1/-1;grid-row:5;display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px;margin-top:14px;width:100%}
 [data-approved-profile="pre-home-20261011"] .iw-profile-owner-actions{grid-column:1/-1;grid-row:6;margin-top:12px}
}
/* Small phones: keep Contact us in the available first-row gap. */
@media(max-width:350px){
 html body .site-header.site-header>.brand.brand>.iw-prototype-badge-brand{left:calc(100% + 3px)!important;width:64px!important}
 html body .site-header.site-header>.brand.brand>.iw-prototype-badge-brand .iw-contact-trigger{grid-template-columns:minmax(0,1fr) 10px!important;padding:3px!important}
 html body .iw-prototype-badge-brand .iw-contact-trigger strong{font-size:9px!important;letter-spacing:0!important}
}
