/* TanQuant shared mobile hardening — desktop styles remain authoritative. */
html{width:100%;max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{width:100%;max-width:100%;overflow-x:hidden}
img,video,canvas,svg{max-width:100%}
iframe{max-width:100%;border:0}

/* TanQuant wordmark fallback. bottomnav.js upgrades this to the inline SVG version. */
.xa-brand:not([data-t2bm]),.brand:not([data-t2bm]){
  display:inline-flex!important;align-items:center;gap:8px;color:#fff!important;
  font-weight:900!important;letter-spacing:-.01em!important;text-transform:uppercase;
  white-space:nowrap;text-decoration:none
}
.xa-brand:not([data-t2bm])::before,.brand:not([data-t2bm])::before{
  content:"";width:29px;height:29px;flex:none;border-radius:8px;background-color:#0d1017;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.5 2L5 13.2h5.2L8.6 22 19 9.6h-5.4L15 2z' fill='%23f7c948'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:center;background-size:17px 17px
}

@media(max-width:760px){
  body{padding-bottom:calc(66px + env(safe-area-inset-bottom))!important}
  html.embed body{padding-bottom:0!important}
  .wrap,.sp-wrap,.xa-mw,.stsw,.t2ex{max-width:100%!important;padding-left:14px!important;padding-right:14px!important}
  button,.btn,[role="button"],input,select,textarea{min-height:44px}
  input,select,textarea{font-size:16px!important}
  input[type="checkbox"],input[type="radio"]{min-height:22px;width:22px;height:22px}
  button,.btn,a{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
  .xa-bar,.bar-in{padding-left:14px!important;padding-right:14px!important}
  .xa-brand,.brand{white-space:nowrap}
  .xa-brand:not([data-t2bm]),.brand:not([data-t2bm]){gap:7px!important;font-size:17px!important;letter-spacing:-.015em!important}
  .xa-brand:not([data-t2bm])::before,.brand:not([data-t2bm])::before{width:27px;height:27px;background-size:16px 16px}
  .xa-go{min-height:40px;display:inline-flex;align-items:center}
  .hero{padding-top:26px!important}
  .hero h1{font-size:clamp(29px,9vw,38px)!important;line-height:1.12!important;word-break:keep-all}
  .hero p,.hero .sub,.hero-desc{font-size:14px!important;line-height:1.72!important;max-width:none!important}
  .demos.solo{width:auto!important;max-width:100%!important;margin-left:0!important;margin-right:0!important}
  .demo,.democ-card,.card,.panel{max-width:100%!important;min-width:0!important}
  .d-title,.democ-title{line-height:1.35}
  .demo-head,.sim-head{min-width:0;flex-wrap:wrap}
  .d-set-main{grid-template-columns:1fr!important}
  .d-set-sub{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .d-set-cell,.d-set-mini{min-width:0!important}
  .stswx-tabs button{padding:12px 7px!important}
  .stswx-tabs button .t1{font-size:15px!important;line-height:1.35;justify-content:center}
  .chip-row{flex-wrap:nowrap!important;overflow-x:auto;padding-bottom:7px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
  .chip-row .chip{flex:0 0 auto;min-height:44px;scroll-snap-align:start}
  .tv-box{height:430px!important;min-width:0!important}
  .democ{padding:24px 0!important}
  .selection{padding:38px 0 12px!important}
  .selection h2{font-size:23px!important}
  .cv-modes,.tur-structure{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .cv-modes button,.tur-structure button{width:100%;min-height:48px}
  .cv-modes-tip,.tur-structure-tip{line-height:1.55;text-align:center}
  .chart-action-nudge{width:100%!important;font-size:12px!important}
  .mode-help::after{position:fixed!important;left:14px!important;right:14px!important;bottom:calc(76px + env(safe-area-inset-bottom))!important;transform:none!important;width:auto!important}
  .final-btns,.democ-cta{width:100%}
  .btn-primary,.btn-ghost,.democ-cta a{width:100%;min-height:48px;display:flex!important;align-items:center;justify-content:center;text-align:center}
  .grid,.main{gap:14px!important}
  .controls,.results,.panel{padding:14px!important}
  .stats,.summary,.st-kgrid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .seg,.bseg{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px!important}
  .seg button,.bseg button{min-width:0!important;min-height:44px}
  .tbl-wrap,.tbl-scroll{overflow-x:auto!important;-webkit-overflow-scrolling:touch;max-width:100%}
  table{max-width:none}
  .sticky-run,.fab{bottom:calc(72px + env(safe-area-inset-bottom))!important}
  .help-modal,.tip-card,.mt-card,.ap-mod{max-height:calc(100dvh - 32px)!important;overflow-y:auto!important}
  .toolbar{flex-wrap:nowrap!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .toolbar::-webkit-scrollbar{display:none}
  .toolbar .tb{flex:0 0 52px;min-height:48px}
  .toolbar .tb.sep{min-height:0!important;height:36px!important;flex:0 0 1px}
  .toprow{display:grid!important;grid-template-columns:1fr!important}
  .toprow input.title,.toprow select{width:100%;min-width:0!important}
  .editor{min-height:48dvh!important;padding:14px!important}
  .body{font-size:15.5px!important;line-height:1.82!important}
  /* Mobile copy legibility: profile strategies, shared strategy posts and detail */
  .saved-title{align-items:flex-start!important;gap:10px!important}
  .saved-title b{font-size:20px!important;line-height:1.35!important}
  .saved-title span{font-size:13px!important;line-height:1.55!important;color:#a9b2c4!important}
  .saved-title em{flex:none;font-size:11px!important;padding:6px 9px!important}
  .saved-card{padding:16px!important;border-radius:16px!important}
  .saved-top{min-height:48px!important;align-items:center!important}
  .saved-top img{width:44px!important;height:44px!important}
  .saved-top b{font-size:15px!important;line-height:1.4!important;white-space:normal!important}
  .saved-top span{font-size:12.5px!important;line-height:1.45!important;color:#a3adbf!important}
  .saved-top em{font-size:11px!important;padding:5px 8px!important}
  .saved-card>p{font-size:13.5px!important;line-height:1.65!important;color:#c6cedc!important;word-break:keep-all!important}
  .saved-metrics span{padding:11px 7px!important;font-size:11.5px!important;line-height:1.4!important;color:#8f9aae!important}
  .saved-metrics b{font-size:13.5px!important;line-height:1.4!important}
  .saved-backtest{min-height:68px!important;padding:12px 13px!important;column-gap:10px!important}
  .saved-backtest span{font-size:20px!important}
  .saved-backtest b{font-size:14px!important;line-height:1.4!important;color:#d5dfff!important}
  .saved-backtest small{font-size:11.5px!important;line-height:1.5!important;opacity:.9!important;color:#aebeff!important}
  .saved-launchers{grid-template-columns:1fr!important;gap:9px!important}
  .saved-launchers button,.saved-launchers a{min-height:68px!important;padding:12px 13px!important}
  .saved-launchers span{font-size:20px!important}
  .saved-launchers b{font-size:14px!important;line-height:1.4!important}
  .saved-launchers small{font-size:11.5px!important;line-height:1.5!important;opacity:.9!important}
  .saved-actions{flex-wrap:wrap!important;row-gap:6px!important}
  .saved-actions button,.saved-actions a{min-height:44px!important;display:inline-flex!important;align-items:center!important;font-size:13px!important;padding:7px 5px!important}

  .qs-card,.editor .qs-card,.body .qs-card{padding:16px!important;border-radius:16px!important}
  .qs-head,.editor .qs-head,.body .qs-head{align-items:center!important;gap:11px!important}
  .qs-logo,.editor .qs-logo,.body .qs-logo{width:46px!important;height:46px!important}
  .qs-kicker,.editor .qs-kicker,.body .qs-kicker{font-size:10px!important;line-height:1.4!important}
  .qs-name h2,.editor .qs-name h2,.body .qs-name h2{font-size:17px!important;line-height:1.4!important;word-break:keep-all!important}
  .qs-name>span:last-child,.editor .qs-name>span:last-child,.body .qs-name>span:last-child{font-size:12px!important;color:#a2adc0!important}
  .qs-badge,.editor .qs-badge,.body .qs-badge{font-size:11px!important;padding:6px 8px!important}
  .qs-settings,.editor .qs-settings,.body .qs-settings{padding:13px!important}
  .qs-settings>b,.editor .qs-settings>b,.body .qs-settings>b{font-size:12px!important}
  .qs-settings p,.editor .qs-settings p,.body .qs-settings p{font-size:13px!important;line-height:1.7!important;color:#d1d7e2!important;word-break:keep-all!important}
  .qs-metrics span,.editor .qs-metrics span,.body .qs-metrics span{font-size:11px!important;line-height:1.4!important;color:#8d99ad!important}
  .qs-metrics b,.editor .qs-metrics b,.body .qs-metrics b{font-size:13.5px!important;line-height:1.45!important}
  .qs-guide b,.editor .qs-guide b,.body .qs-guide b{font-size:13.5px!important}
  .qs-guide span,.editor .qs-guide span,.body .qs-guide span{font-size:12px!important;line-height:1.6!important;color:#9ca7ba!important}
  .qs-actions,.editor .qs-actions,.body .qs-actions{grid-template-columns:1fr!important;gap:10px!important}
  .qs-cta,.editor .qs-cta,.body .qs-cta{min-height:68px!important;padding:13px 14px!important}
  .qs-cta b,.editor .qs-cta b,.body .qs-cta b{font-size:14px!important;line-height:1.4!important}
  .qs-cta small,.editor .qs-cta small,.body .qs-cta small{font-size:11.5px!important;line-height:1.5!important;color:#d7e0ff!important}
  .qs-disc,.editor .qs-disc,.body .qs-disc{font-size:11.5px!important;line-height:1.6!important;color:#8894a8!important}

  .hero .top h1,.top h1{font-size:19px!important;line-height:1.4!important;word-break:keep-all!important}
  .hero .top p,.top p{font-size:13px!important;line-height:1.5!important}
  .metrics .metric span,.metric span{font-size:11.5px!important;line-height:1.4!important}
  .metrics .metric b,.metric b{font-size:15px!important;line-height:1.4!important;overflow-wrap:anywhere}
  .setting{font-size:13px!important;line-height:1.5!important;align-items:flex-start!important}
  .setting b{text-align:right!important;overflow-wrap:anywhere}
  .actions a{font-size:14px!important;line-height:1.45!important;min-height:50px!important;display:flex!important;align-items:center!important;justify-content:center!important}
  .cwrite{flex-direction:column}
  .cwrite textarea,.cwrite button{width:100%}
  .backrow{flex-wrap:wrap}
  .backrow .btn{flex:1;text-align:center}
  .site-nav{padding-left:14px!important;padding-right:14px!important}
  .ns-origin .wrap,.ns-manual .wrap{padding-left:16px!important;padding-right:16px!important}
  .ns-origin section,.ns-manual section{padding-top:64px!important;padding-bottom:64px!important}
  .ns-origin .portraits,.ns-origin .feat{flex-direction:column!important}
  .xa-foot .in{grid-template-columns:1fr!important}
  .tg-body{height:calc(100dvh - 190px)!important;min-height:430px!important}
}

/* Backtest result → profile save CTA */
.save-strategy{margin:14px 0 20px;padding:16px 18px;border:1px solid rgba(41,98,255,.48);border-radius:14px;background:linear-gradient(135deg,rgba(41,98,255,.15),rgba(22,255,166,.055));display:flex;align-items:center;gap:16px}
.save-strategy>div{flex:1;min-width:0}.save-strategy b,.save-strategy span{display:block}.save-strategy b{font-size:15px;color:#eef3ff}.save-strategy span{margin-top:4px;color:#9ca7ba;font-size:12px;line-height:1.5}.save-strategy button{min-height:46px;padding:0 20px;border:0;border-radius:11px;background:#2962ff;color:#fff;font:800 14px inherit;cursor:pointer;box-shadow:0 8px 22px rgba(41,98,255,.32)}.save-strategy button:disabled{opacity:.75}.save-strategy small{font-size:11px;color:#16ffa6}.save-strategy small a{color:#16ffa6}
@media(max-width:600px){.save-strategy{align-items:stretch;flex-direction:column;padding:15px}.save-strategy button{width:100%}.save-strategy small{text-align:center}}
.shared-strategy-notice{max-width:1100px;margin:0 auto 16px;padding:14px 17px;border:1px solid rgba(22,255,166,.45);border-radius:13px;background:rgba(22,255,166,.08);color:#e7ebf3}.shared-strategy-notice b,.shared-strategy-notice span{display:block}.shared-strategy-notice b{color:#16ffa6;font-size:14px}.shared-strategy-notice span{margin-top:4px;color:#9ca7ba;font-size:12px}

@media(max-width:390px){
  .wrap,.sp-wrap,.xa-mw,.stsw,.t2ex{padding-left:12px!important;padding-right:12px!important}
  .demo,.democ-card,.card,.panel{border-radius:12px!important}
  .d-set-sub{grid-template-columns:1fr!important}
  .stats,.summary,.st-kgrid{gap:8px!important}
  .tv-box{height:400px!important}
  .hero h1{font-size:28px!important}
  .saved-card{padding:14px!important}
  .saved-metrics{grid-template-columns:1fr!important}
  .saved-metrics span{border-bottom:1px solid rgba(255,255,255,.045)}
  .qs-metrics,.editor .qs-metrics,.body .qs-metrics{grid-template-columns:1fr!important}
  .qs-name h2,.editor .qs-name h2,.body .qs-name h2{font-size:16px!important}
  .metrics{grid-template-columns:1fr 1fr!important}
}
