/* VELAEA EA LAB mobile production containment v25 */
@media (max-width:760px){
html,body.ea-lab-page{width:100%;max-width:100%;overflow-x:hidden!important;overflow-x:clip!important}
body.ea-lab-page *,body.ea-lab-page *:before,body.ea-lab-page *:after{box-sizing:border-box}
.lab-shell,.hero-grid,.builder-layout,.builder-layout>*,.builder-card,.builder-card>*,.ea-preview-section,.ea-preview-section>*,.result-panel,.access-card,.ea-qb-v186,.ea-qb-v186 *,.backtest-grid,.backtest-grid>*,.project-grid,.project-grid>*,.ea-auto-build-v16-resume-workspace,.ea-auto-build-v16-review{min-width:0!important;max-width:100%}
.builder-layout,.ea-builder-premium{grid-template-columns:minmax(0,1fr)!important}
.builder-card,.result-panel,.access-card,.ea-qb-v186,.ea-qb-shell{width:100%!important}
.section-head,.ea-preview-section-head,.ea-auto-acknowledgement-text,.ea-auto-generation-confirm-desc,.ea-auto-generation-confirm-meta,.ea-auto-build-v16-review-head,.ea-auto-build-v16-security{overflow-wrap:anywhere;word-break:break-word}
input,select,textarea,button{max-width:100%}
pre,code,.ea-auto-build-v16-code,.ea-auto-generation-confirm-meta,.ea-auto-build-v16-review-head{min-width:0!important;max-width:100%!important;overflow-wrap:anywhere;word-break:break-word}
.ea-auto-acknowledgement,.ea-auto-ready,.ea-auto-generation-confirm-panel,.ea-auto-generation-confirm-status,.ea-auto-build-v16-review,.ea-auto-build-v16-review-head,.ea-auto-build-v16-code,.ea-auto-build-v16-copyright,.ea-auto-build-v16-review-actions,.ea-auto-build-v16-report{width:100%!important;min-width:0!important;max-width:100%!important}
.ea-qb-head,.ea-qb-head>*,.ea-qb-head-actions,.ea-qb-state,.ea-qb-state>*,.ea-qb-purpose,.ea-qb-purpose-copy,.ea-qb-purpose-stats,.ea-qb-run-row,.ea-qb-run-btn,.ea-qb-run-help,.ea-qb-meta,.ea-qb-metrics,.ea-qb-history-switcher,.ea-qb-history-switcher-head,.ea-qb-chart-grid,.ea-qb-chart,.ea-qb-chart-wrap,.ea-qb-chart-card{width:100%!important;min-width:0!important;max-width:100%!important}
.ea-qb-head,.ea-qb-state,.ea-qb-purpose,.ea-qb-run-row{align-items:stretch!important;flex-direction:column!important}
.ea-qb-head-actions,.ea-qb-purpose-stats{display:flex!important;flex-wrap:wrap!important}
.ea-qb-meta,.ea-qb-metrics,.ea-qb-chart-grid{grid-template-columns:minmax(0,1fr)!important}
.ea-qb-meta>*,.ea-qb-metrics>*{width:auto!important;min-width:0!important;max-width:100%!important}
.ea-qb-price-canvas,.ea-qb-equity-canvas,.ea-qb-chart canvas,.ea-qb-chart-wrap canvas,.chart-wrap canvas,canvas,svg{max-width:100%!important}
.ea-qb-price-canvas,.ea-qb-equity-canvas{width:100%!important;height:auto!important;min-height:220px}
table{max-width:100%}
.table-wrap,.ea-qb-table-wrap,.ea-qb-trades,.ea-qb-history-table{width:100%;max-width:100%;overflow-x:auto!important;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
.ea-ai-advisor{right:max(4px,env(safe-area-inset-right,0px))!important;bottom:max(4px,env(safe-area-inset-bottom,0px))!important;width:clamp(96px,31vw,124px)!important;height:clamp(128px,39vw,164px)!important}
.ea-ai-advisor .ea-advisor-chat-button{right:72%!important;max-width:min(190px,calc(100vw - 116px))!important;white-space:normal!important;text-align:center;line-height:1.25}
.ea-ai-advisor .ea-advisor-speech{max-width:min(180px,calc(100vw - 124px))!important;white-space:normal;overflow-wrap:anywhere}
.ea-advisor-chat{left:8px!important;right:8px!important;bottom:calc(112px + env(safe-area-inset-bottom,0px))!important;width:auto!important;max-width:none!important;max-height:calc(100dvh - 132px)!important}
.ea-advisor-chat header,.ea-advisor-chat form{min-width:0;max-width:100%}
.ea-advisor-chat form{grid-template-columns:minmax(0,1fr) 42px!important}
.ea-advisor-messages{min-height:120px;max-height:min(42dvh,290px)}
}
@media (max-width:420px){
.lab-shell{width:calc(100% - 20px)!important}
.builder-card,.result-panel,.access-card{padding:14px!important;border-radius:18px}
.ea-preview-section{padding:12px!important}
.hero-copy h1{font-size:clamp(30px,10vw,38px);overflow-wrap:anywhere}
.ea-qb-head,.ea-qb-state,.ea-qb-purpose,.ea-qb-run-row,.ea-qb-history-switcher{padding-left:10px!important;padding-right:10px!important}
.ea-qb-price-canvas,.ea-qb-equity-canvas{min-height:180px}
}

/* v25.1 narrow-screen edge polish */
@media (max-width:760px){.ea-qb-state{width:auto!important;margin-left:16px!important;margin-right:16px!important}.ea-qb-history-table,.ea-qb-table-wrap,.ea-qb-trades{overflow-x:auto!important}}
@media (max-width:360px){.community-menu{gap:3px!important}.community-menu a{padding-left:5px!important;padding-right:5px!important;font-size:11px!important}.ea-qb-state{margin-left:12px!important;margin-right:12px!important}}

/* v25.2 specificity guards for late-loaded community/backtest styles */
@media (max-width:760px){html body.ea-lab-page .ea-qb-v186 .ea-qb-state{width:auto!important;max-width:none!important;margin-left:16px!important;margin-right:16px!important}}
@media (max-width:360px){html body.ea-lab-page .community-header .community-menu{gap:3px!important}html body.ea-lab-page .community-header .community-menu>a{padding-left:5px!important;padding-right:5px!important;font-size:11px!important}html body.ea-lab-page .ea-qb-v186 .ea-qb-state{margin-left:12px!important;margin-right:12px!important}}

/* iOS/mobile hero clearance: keep a compact, intentional gap below the
   in-flow mobile navigation without pushing the hero too far down. */
@media (max-width:760px){
html body.ea-lab-page .lab-hero{padding-top:clamp(22px,6vw,32px)!important}
html body.ea-lab-page .lab-hero .hero-grid{min-width:0!important;max-width:100%!important;transform:none!important;translate:none!important}
html body.ea-lab-page .lab-hero .hero-copy{width:100%!important;min-width:0!important;max-width:100%!important;transform:none!important;translate:none!important}
html body.ea-lab-page .lab-hero .hero-copy>.eyebrow{margin-top:0!important;padding-top:2px!important;visibility:visible!important}
html body.ea-lab-page .lab-hero .hero-copy h1,
html body.ea-lab-page .lab-hero .hero-lead{width:100%!important;max-width:100%!important;white-space:normal!important;overflow-wrap:anywhere!important;word-break:normal!important;line-break:auto!important}
}

/* The shared navigation becomes two rows at 820px. Keep it sticky and in the
   EA LAB document flow so every mobile width uses its measured height. */
@media (max-width:820px){
html body.ea-lab-page.community-template-page #velaeaCommunityTopbar.velaea-community-template-slot[data-velaea-template="community"]{position:sticky!important;top:0!important}
html body.ea-lab-page.community-template-page:has(#velaeaCommunityTopbar.velaea-community-template-slot[data-velaea-template="community"]){padding-top:0!important}
}
