/* Screen geometry only. No scripts, colors, icons, radii or storage changes. */
:is(#app,[data-snapshot-id="app"]) .profile h2{min-width:0;max-width:calc(100% - 26px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:is(#app,[data-snapshot-id="app"]) :is(.home-qr-profile,.sd-qr-identity,.cp-profile-head)>div{min-width:0}
:is(#app,[data-snapshot-id="app"]) :is(.home-qr-profile,.sd-qr-identity) strong{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:is(#app,[data-snapshot-id="app"]) .lc-person strong{max-width:90%;margin-left:auto;margin-right:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-height:600px){:is(#app,[data-snapshot-id="app"]) :is(.sd-avatar-sheet,.sd-discover-sheet,.home-avatar-sheet>section){max-height:100%;overflow-y:auto;overscroll-behavior:contain}}
:is(#app,[data-snapshot-id="app"]) .dialog{min-width:0;max-height:100%;overflow-y:auto}
:is(#app,[data-snapshot-id="app"]) .ext-fields{min-width:0}
:is(#app,[data-snapshot-id="app"]) :is(.cp-profile-head,.home-qr-profile,.sd-qr-identity){overflow-wrap:anywhere}
/* Avoid a keyboard-reduced viewport trapping the bottom of an editor. */
:is(#app,[data-snapshot-id="app"]) :is(.editor-page,.sd-editor,.ff-edit-form,.cp-remarks-editor){min-height:0}
:is(#app,[data-snapshot-id="app"]) .sd-editor{overflow-y:auto;overscroll-behavior:contain}
/* Wide phones/foldables keep readable content columns. The real canvas and
   navigation frame keep their existing width; no page scaling is applied. */
@media(min-width:600px){
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>:is(.body,.header,.search-header,.tabs,.composer,.nc-panel,.wallet-feature-header,.customer-composer,.business-fixed-footer){width:min(100%,480px);max-width:480px;margin-left:auto;margin-right:auto}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>.body{container-type:inline-size}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>:is(.header,.tabs,.composer,.nc-panel){container-type:inline-size}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) :is(.nc-page,.wf-layer,.pwa-chat-media,.pwa-avatar-crop,.editor-overlay,.pf-page,.packet-detail-page){max-width:480px;margin-inline:auto;container-type:inline-size}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>.alphabet{right:calc((100% - min(100%,480px))/2 + 3px)}
}
/* Short/landscape canvas: retain each control and make its region reachable. */
@media(max-height:600px){
 :is(#app,[data-snapshot-id="app"]) :is(.sd-avatar-sheet,.sd-discover-sheet){max-height:100%;overflow-y:auto}
 :is(#app,[data-snapshot-id="app"]) .home-group-alphabet{top:60px!important;bottom:8px;height:auto!important;max-height:calc(100% - 68px);transform:none!important;overflow-y:auto;overscroll-behavior:contain}
 :is(#app,[data-snapshot-id="app"]) .home-group-alphabet button{flex-shrink:0}
 :is(#app,[data-snapshot-id="app"]) .cm-photo-sheet{height:100%;min-height:0}
 :is(#app,[data-snapshot-id="app"]) .cm-photo-grid{min-height:0}
}
@media(orientation:landscape) and (max-height:600px){
 html:not([data-pwa-layout="native"]) body{padding:0}
 html:not([data-pwa-layout="native"]) :is(#app,[data-snapshot-id="app"]):not(.navigation-screen){height:var(--app-height,100dvh);max-height:100dvh;min-height:0;border:0;border-radius:0;box-shadow:none}
 /* Existing negative native offsets assume portrait status-bar spacing. */
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>.header,
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-header,
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .wf-layer .wf-header,
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .pf-outgoing>.pf-transfer-head{margin-top:0!important}
 :is(#app,[data-snapshot-id="app"])>.header,:is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-header,:is(#app,[data-snapshot-id="app"]) .wf-header{min-height:44px;height:44px}
 :is(#app,[data-snapshot-id="app"])>.nc-panel{--fit-row:clamp(54px,calc((var(--app-height,100dvh) - 164px - var(--screen-bottom-inset,0px))/2),84px);height:calc(var(--fit-row)*2 + 30px + var(--screen-bottom-inset,0px));padding-top:6px;padding-bottom:var(--screen-bottom-inset,0px);overflow:hidden}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid,:is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid{grid-auto-rows:var(--fit-row)}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid button,:is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid button{gap:4px}
 :is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid button>span{width:40px;height:40px;min-height:40px}
 :is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid button>span svg{max-width:28px;max-height:28px}
 :is(#app,[data-snapshot-id="app"])>.nc-panel .nc-panel-grid .nc-reference-tool-icon{width:28px;height:28px}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"])>.nc-panel nav,:is(#app,[data-snapshot-id="app"])>.nc-panel nav{margin-top:6px}
 /* Calls: identity and controls use separate columns, never overlap. */
 :is(#app,[data-snapshot-id="app"]) .lc-screen .lc-top{top:8px!important;height:32px}
 :is(#app,[data-snapshot-id="app"]) .lc-screen .lc-person,:is(#app,[data-snapshot-id="app"]) .lc-screen.video .lc-person{left:3%;right:68%;top:50%!important;transform:translateY(-50%)}
 :is(#app,[data-snapshot-id="app"]) .lc-person>.avatar,:is(#app,[data-snapshot-id="app"]) .lc-screen.video .lc-person>.avatar{width:64px;height:64px}
 :is(#app,[data-snapshot-id="app"]) .lc-person strong{white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-width:100%;margin-top:8px!important}
 :is(#app,[data-snapshot-id="app"]) .lc-dots{margin-top:8px}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .lc-controls.video,:is(#app,[data-snapshot-id="app"]) .lc-controls.video{left:37%;right:4%;top:44px;bottom:max(8px,var(--screen-bottom-inset,0px));row-gap:8px;align-content:center}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video .lc-control{width:56px;min-width:0}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video .lc-button{width:56px;height:56px}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video .lc-button .lc-icon{width:38px;height:38px}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video .lc-button.lc-hangup .lc-icon{width:36px;height:36px}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video small{white-space:normal;overflow-wrap:anywhere;margin-top:4px}
 html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .lc-controls.audio,:is(#app,[data-snapshot-id="app"]) .lc-controls.audio{left:36%;right:4%;top:50%;bottom:auto;transform:translateY(-50%)}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.audio .lc-control{width:64px}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.audio .lc-button{width:64px;height:64px}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.audio .lc-icon{max-width:42px;max-height:42px}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.audio small{white-space:normal}
 :is(#app,[data-snapshot-id="app"]) .lc-screen .lc-status{left:3%;right:68%;top:auto!important;bottom:8px;margin:0}
 /* Transfer amount/notes and keys remain visible in separate columns. */
 :is(#app,[data-snapshot-id="app"]) .nc-pay-editor:not(.nc-packet-editor){display:grid;grid-template-columns:minmax(0,54%) minmax(0,46%);grid-template-rows:44px minmax(0,1fr)}
 :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.status{grid-column:1/-1}
 :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-header{grid-column:1/-1;grid-row:1;margin-top:0!important}
 :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-recipient{grid-column:1;grid-row:2;align-self:start;height:76px;min-height:0;margin:0;padding:8px 12px}
 :is(#app,[data-snapshot-id="app"]) .nc-recipient>.avatar{width:40px;height:40px;flex-shrink:0}
 :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-transfer-fields{grid-column:1;grid-row:2;min-height:0;overflow:auto;align-self:stretch;margin:76px 0 0;padding:8px 12px}
 :is(#app,[data-snapshot-id="app"]) .nc-transfer-amount{max-width:100%;min-width:0}
 :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-keypad:not(.nc-pin-pad){grid-column:2;grid-row:2;position:static;min-height:0;height:auto;width:100%;padding:4px 4px calc(4px + var(--screen-bottom-inset,0px));gap:4px}
 /* Packet total/send remain below a scrollable field region beside the keys. */
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor{display:grid;grid-template-columns:minmax(0,54%) minmax(0,46%);grid-template-rows:44px minmax(0,1fr) 36px 40px 24px}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-fields{grid-column:1;grid-row:2;min-height:0;overflow:auto;margin:0;padding:8px}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-warning{grid-column:1;grid-row:2;align-self:end;margin:0;max-width:100%}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-total{grid-column:1;grid-row:3;margin:0;align-self:center;line-height:1;height:auto}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-send{grid-column:1;grid-row:4;align-self:center;justify-self:stretch;margin:0 8px;max-width:calc(100% - 16px);height:36px}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-tip{grid-column:1;grid-row:5;align-self:center;margin:0;max-width:100%;text-align:center}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-keypad:not(.nc-pin-pad){grid-column:2;grid-row:2/6}
 /* Funding uses its original scrolling editor above a bounded keypad. */
 :is(#app,[data-snapshot-id="app"]) .wf-keypad{height:calc(min(42cqw,42dvh) + var(--screen-bottom-inset,0px));gap:4px;padding:4px 4px calc(4px + var(--screen-bottom-inset,0px))}
 :is(#app,[data-snapshot-id="app"]) .wf-fund-keyboard{flex-shrink:0;max-height:55%;overflow:auto}
 :is(#app,[data-snapshot-id="app"]) .wf-fund-keyboard>.wf-keypad{height:calc(36dvh + var(--screen-bottom-inset,0px))}
 :is(#app,[data-snapshot-id="app"]) .wf-quick-amounts{height:40px}
 /* Move the crop stage itself, so pointer coordinates and exported square
    still use the same rectangle. Tools paint over out-of-frame photo pixels. */
 :is(#app,[data-snapshot-id="app"]) .pwa-avatar-crop:not(.pa-qr-crop) .pa-stage{overflow:visible;transform:translateY(-35px)}
 :is(#app,[data-snapshot-id="app"]) .pa-tools{height:46px;position:relative;z-index:1;background:#000}
 :is(#app,[data-snapshot-id="app"]) .pa-footer{height:calc(48px + var(--screen-bottom-inset,0px));position:relative;z-index:1;background:#000;padding-bottom:var(--screen-bottom-inset,0px)}
 :is(#app,[data-snapshot-id="app"]) .pa-tools button,:is(#app,[data-snapshot-id="app"]) .pa-qr-crop .pa-zoom{transform:none}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-video{bottom:100px;height:calc(100% - 100px)}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-close{top:8px;left:12px}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-controls{height:72px;bottom:max(8px,var(--screen-bottom-inset,0px));left:20%;right:20%}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-controls .cm-shutter{width:64px;height:64px}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-controls>button{width:44px;height:44px}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-hint{bottom:108px}
}
@media(orientation:landscape) and (max-height:600px){
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video>.lc-control{width:100%}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video .lc-video-bottom .lc-control{width:33.333333%}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.audio .lc-control{width:30%}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor{grid-template-rows:44px minmax(0,1fr) 72px 40px 24px}
 :is(#app,[data-snapshot-id="app"]) .nc-transfer-amount{overflow-x:auto;white-space:nowrap}
}
/* A real top inset consumes the old portrait overlap, never adds a second inset.
   At the accepted zero-top-inset reference these expressions keep the old value. */
html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]):is([data-page="设置"],[data-page="发现"],[data-page="微信"],[data-page="聊天"],[data-page="联系人资料"],[data-page="好友朋友圈"])>.header,
html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .nc-pay-editor>.nc-header,
html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .wf-layer[data-funding-kind="recharge"] .wf-header{margin-top:min(0px,calc(env(safe-area-inset-top,0px) - 3.095238cqw))}
html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .wf-layer[data-funding-kind="fund-in"] .wf-header{margin-top:min(0px,calc(env(safe-area-inset-top,0px) - 1.904762cqw))}
html[data-pwa-layout="native"] :is(#app,[data-snapshot-id="app"]) .lc-screen .lc-top{top:max(calc(14.285714cqw - var(--pwa-call-external-top,0px)),env(safe-area-inset-top,0px))}
:is(#app,[data-snapshot-id="app"]) .pa-tools,:is(#app,[data-snapshot-id="app"]) .pa-footer{padding-left:max(24px,env(safe-area-inset-left,0px));padding-right:max(24px,env(safe-area-inset-right,0px))}
@media(orientation:landscape) and (max-height:600px){
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video{grid-template-columns:repeat(3,minmax(0,1fr))}
 :is(#app,[data-snapshot-id="app"]) .cm-camera-close{left:max(12px,env(safe-area-inset-left,0px));top:max(8px,env(safe-area-inset-top,0px))}
 :is(#app,[data-snapshot-id="app"]) .lc-screen .lc-top{left:max(16px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px))}
 :is(#app,[data-snapshot-id="app"])>.header>.back{translate:env(safe-area-inset-left,0px) 0}
 :is(#app,[data-snapshot-id="app"])>.header>button:last-child{translate:calc(-1 * env(safe-area-inset-right,0px)) 0}
}

:is(#app,[data-snapshot-id="app"]) .profile p{max-width:calc(100% - 26px)}
:is(#app,[data-snapshot-id="app"]) .nc-recipient>div{min-width:0;min-height:0;max-height:100%;overflow-y:auto;overflow-wrap:anywhere;overscroll-behavior:contain}
@media(orientation:landscape) and (max-height:600px){
 :is(#app,[data-snapshot-id="app"])>:is(.body,.composer,.nc-panel),:is(#app,[data-snapshot-id="app"]) :is(.nc-page:not(.lc-screen),.wf-layer,.editor-overlay){border-left:env(safe-area-inset-left,0px) solid transparent;border-right:env(safe-area-inset-right,0px) solid transparent}
 :is(#app,[data-snapshot-id="app"]) .lc-screen .lc-person,:is(#app,[data-snapshot-id="app"]) .lc-screen.video .lc-person{left:max(3%,env(safe-area-inset-left,0px))}
 :is(#app,[data-snapshot-id="app"]) .lc-controls.video,:is(#app,[data-snapshot-id="app"]) .lc-controls.audio{right:max(4%,env(safe-area-inset-right,0px))}
 :is(#app,[data-snapshot-id="app"]) :is(.cm-photo-sheet>header,.cm-photo-sheet>footer,.cm-file-preview>footer,.cm-capture-review>footer){padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
 :is(#app,[data-snapshot-id="app"]) .cm-photo-grid{border-left:env(safe-area-inset-left,0px) solid transparent;border-right:env(safe-area-inset-right,0px) solid transparent}
}
@media(max-height:600px){
 :is(#app,[data-snapshot-id="app"]) .pwa-avatar-crop:not(.pa-qr-crop) .pa-stage{overflow:visible;transform:translateY(-35px)}
 :is(#app,[data-snapshot-id="app"]) .pa-tools,:is(#app,[data-snapshot-id="app"]) .pa-footer{position:relative;z-index:1;background:#000}
 :is(#app,[data-snapshot-id="app"]) .pa-footer{padding-bottom:var(--screen-bottom-inset,0px)}
}
@media(orientation:portrait) and (max-height:560px){
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:36px minmax(0,1fr) auto 40px 20px calc(55.24cqw + var(--screen-bottom-inset,0px))}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.status{display:none}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-header{grid-column:1;grid-row:1;height:36px;margin-top:0!important}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-fields{grid-column:1;grid-row:2;min-height:0;overflow:auto;margin:0;padding:8px}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-warning{grid-column:1;grid-row:2;align-self:end;margin:0;max-width:100%}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-total{grid-column:1;grid-row:3;margin:0;height:auto}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-send{grid-column:1;grid-row:4;align-self:center;justify-self:center;margin:0;height:36px}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-packet-tip{grid-column:1;grid-row:5;align-self:center;margin:0;text-align:center}
 :is(#app,[data-snapshot-id="app"]) .nc-packet-editor>.nc-keypad:not(.nc-pin-pad){grid-column:1;grid-row:6;position:static;height:100%;min-height:0}
}
@media(max-height:600px){
 :is(#app,[data-snapshot-id="app"]) .pwa-avatar-crop:not(.pa-qr-crop) .pa-stage:after{content:"";position:absolute;left:0;right:0;bottom:-35px;height:35px;pointer-events:auto}
}
@media(max-height:600px){
 :is(#app,[data-snapshot-id="app"])[data-page="群二维码"]>.body{overflow-y:auto;touch-action:pan-y;overscroll-behavior:contain}
 :is(#app,[data-snapshot-id="app"]) .gf-group-qr{height:auto;min-height:100%;padding-top:16px;padding-bottom:calc(16px + var(--screen-bottom-inset,0px))}
 :is(#app,[data-snapshot-id="app"]) .gf-group-qr>button{margin-top:16px;flex-shrink:0}
}
