@media(max-width:760px){
  .rail nav{display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr));gap:2px;overflow:visible!important}
  .rail nav button{width:auto!important;min-width:0!important;flex:none!important;padding-inline:2px!important}
  .rail nav button>span{font-size:8px!important;white-space:nowrap}
  .pulse-reference .terminal-toolbar{display:grid;gap:10px;padding:12px}
  .pulse-reference .terminal-source{display:grid!important;grid-template-columns:minmax(0,1fr) 145px;gap:8px;width:100%}
  .pulse-reference .terminal-source input,.pulse-reference .terminal-source select{width:100%!important;min-width:0;min-height:44px}
  .pulse-reference .terminal-toolbar-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;width:100%;margin:0}
  .pulse-reference .terminal-toolbar-actions>*{min-width:0;min-height:44px!important;padding-inline:5px!important}
  .pulse-reference .terminal-health{padding:0 12px 12px;line-height:1.55}
  .pulse-reference .terminal-market-row,.pulse-reference.terminal-compact .terminal-market-row,.pulse-reference.terminal-table .terminal-market-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 92px!important;gap:10px 12px!important;padding:14px 12px!important;min-height:0!important}
  .pulse-reference .terminal-market-row .terminal-token-main{grid-column:1/3!important;grid-row:1!important;align-self:start}
  .pulse-reference .terminal-market-row .terminal-artwork{flex-basis:48px}.pulse-reference .terminal-market-row .terminal-artwork button{width:48px;height:48px}
  .pulse-reference .terminal-market-row .ticket-order{grid-column:3!important;grid-row:1/3!important;align-self:start}
  .pulse-reference .terminal-market-row .terminal-values>.terminal-buy-controls:not(.terminal-flow){width:92px}
  .pulse-reference .terminal-market-row .ticket-price-box>span:first-child{grid-column:1!important;grid-row:2!important;text-align:left}.pulse-reference .terminal-market-row .ticket-price-box>span:last-child{grid-column:2!important;grid-row:2!important;text-align:right}
  .pulse-reference .terminal-market-row .ticket-stats>span:nth-child(1){grid-column:1!important;grid-row:3!important;text-align:left}.pulse-reference .terminal-market-row .ticket-stats>span:nth-child(2){grid-column:2!important;grid-row:3!important;text-align:right}.pulse-reference .terminal-market-row .ticket-stats>span:nth-child(3){grid-column:3!important;grid-row:3!important;text-align:right;display:block!important}
  .pulse-reference .ticket-market small{display:block!important;margin-bottom:3px;color:#91adbf;font-size:10px!important}
  .pulse-reference .terminal-market-row .ticket-footer{grid-column:1/-1!important;grid-row:4!important;display:flex!important;flex-wrap:wrap!important;gap:7px!important;padding:10px 0 0!important;border-top:1px solid #264054;overflow:visible!important}
  .pulse-reference .ticket-footer .terminal-socials{flex-wrap:wrap!important}.pulse-reference .ticket-footer .terminal-row-actions{margin-left:0!important}
  .pulse-reference .terminal-market-row .terminal-expanded-research{grid-column:1/-1!important;grid-row:5!important;padding:0!important}
  .pulse-reference .terminal-market-row .terminal-buy-controls>.terminal-buy{min-height:46px!important}.pulse-reference .terminal-market-row .terminal-quick-presets>button{min-height:40px!important}
  .pulse-reference .terminal-market-row .terminal-project-links{margin-left:0;flex-wrap:wrap}
}
@media(max-width:390px){
  .rail nav button>span{font-size:7px!important}
  .pulse-reference .terminal-source{grid-template-columns:1fr 128px}
  .pulse-reference .terminal-toolbar-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .pulse-reference .terminal-market-row,.pulse-reference.terminal-compact .terminal-market-row,.pulse-reference.terminal-table .terminal-market-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 82px!important;gap-inline:8px!important}
  .pulse-reference .terminal-market-row .terminal-values>.terminal-buy-controls:not(.terminal-flow){width:82px}
}

/* Mobile workspace: preserve the dense terminal while making every primary action
   reachable, readable and safe around notches and the browser home indicator. */
@media(max-width:760px){
  html{overflow-x:hidden;scroll-padding-bottom:calc(88px + env(safe-area-inset-bottom))}
  body{min-width:320px;overflow-x:hidden;padding-bottom:calc(78px + env(safe-area-inset-bottom))}
  .product-main{padding-right:max(12px,env(safe-area-inset-right));padding-left:max(12px,env(safe-area-inset-left))}

  .rail{padding-right:max(6px,env(safe-area-inset-right));padding-left:max(6px,env(safe-area-inset-left));box-shadow:0 -12px 32px #0008}
  .rail nav{grid-template-columns:repeat(6,minmax(52px,1fr));overflow-x:auto!important;overscroll-behavior-x:contain;scrollbar-width:none}
  .rail nav::-webkit-scrollbar{display:none}
  .rail nav button{min-height:56px!important;touch-action:manipulation}
  .rail nav button>svg{width:20px!important;height:20px!important}
  .rail nav button>span{font-size:9px!important;line-height:1;letter-spacing:-.01em}

  .product-header,.topbar:has(.reference-top-nav){height:auto;min-height:118px;padding-top:max(9px,env(safe-area-inset-top));align-content:center}
  .product-header>div:first-child{min-width:0}
  .product-header h1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .product-header p{max-width:30ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .product-header>.product-build-note{display:block;top:62px;left:12px;max-width:calc(100% - 24px);transform:none;color:#b9cad8;font-size:9px;line-height:12px;letter-spacing:.015em}
  .header-actions{flex:0 0 auto}
  .header-actions #connect-header{width:40px;min-width:40px;height:40px;padding:0;font-size:0}
  .header-actions #connect-header i{margin:0}
  .header-actions .icon-button{min-width:40px;min-height:40px}
  .reference-top-nav{order:3;flex:1 0 100%;height:42px!important;margin-top:16px}
  .reference-top-nav button{min-height:42px;font-size:12px}

  #ticker{margin-right:calc(-1 * max(12px,env(safe-area-inset-right)));margin-left:calc(-1 * max(12px,env(safe-area-inset-left)))}
  #ticker .ticker-group{gap:22px;padding-inline:14px}
  #ticker button.ticker-watch{width:40px;min-width:40px;height:40px}

  .market-strip{align-items:flex-start;flex-wrap:wrap;padding:11px 12px}
  .market-strip>div:first-child{gap:9px;min-height:32px}
  #market-status{line-height:1.45}
  .segmented{width:100%;display:grid;grid-template-columns:repeat(3,1fr)}
  .segmented button{min-height:40px}
  .product-bastion{grid-template-columns:1fr 1fr}
  .summary-card{min-height:72px}

  .pulse-reference,.pulse-reference *{min-width:0}
  .pulse-reference .terminal-toolbar{padding-inline:10px}
  .pulse-reference .terminal-source{grid-template-columns:minmax(0,1fr) minmax(118px,38%)}
  .pulse-reference .terminal-toolbar-actions button{white-space:normal;line-height:1.15}
  .pulse-reference .terminal-health{overflow-wrap:anywhere}
  .pulse-reference .terminal-market-row .terminal-token-main{overflow:hidden}
  .pulse-reference .terminal-market-row .terminal-token-main b,
  .pulse-reference .terminal-market-row .terminal-token-main small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .pulse-reference .terminal-market-row .ticket-market{font-variant-numeric:tabular-nums}
  .pulse-reference .ticket-footer{font-size:11px;line-height:1.45}
  .pulse-reference .ticket-footer button,
  .pulse-reference .ticket-footer a{min-height:40px}
  .pulse-reference .terminal-row-actions button{min-width:40px}

  .product-inspector,.reference-side-shell{max-width:none}
  .reference-side-shell{right:max(8px,env(safe-area-inset-right));left:max(8px,env(safe-area-inset-left));bottom:calc(78px + env(safe-area-inset-bottom));border-radius:14px}
  .reference-side-tabs{min-height:48px}
  .reference-side-tabs button{min-width:44px;min-height:44px}

  .section-head{gap:9px}
  .section-head h2{font-size:22px!important;line-height:1.2}
  .section-head p{font-size:12px;line-height:1.5}
  .leaderboard-toolbar input,.leaderboard-toolbar select{min-height:46px;font-size:16px}
  .leaderboard-card{min-height:330px}

  .position-table{margin-inline:-2px;padding:10px;border-radius:14px}
  .position-card-grid{gap:10px}
  .position-card{padding:15px;border-radius:14px}
  .position-card-head{gap:10px}
  .position-card .position-identity{display:flex;align-items:center;gap:10px;overflow:hidden}
  .position-card .position-identity img{width:42px;height:42px;flex-basis:42px}
  .position-card .position-identity b{font-size:14px}
  .position-card-value{padding:13px 0 11px}
  .position-card-value strong{font-size:27px}
  .position-card-metrics{gap:11px 13px;padding:12px 0}
  .position-links{margin:11px 0 10px;gap:7px}
  .position-links a{min-height:44px;padding-inline:11px}
  .position-quick-sell{gap:8px}
  .position-quick-sell button{min-height:46px}
  .lifetime-hero{padding:17px;border-radius:14px}
  .lifetime-hero>div>strong{font-size:clamp(30px,10vw,42px)}
  .lifetime-hero dl{margin-bottom:14px}
  .lifetime-panel{border-radius:14px}
  .lifetime-project-list,.recent-trade-list{max-height:none}

  .vault-layout{border-radius:14px}
  .product-main .vault-main,.vault-note{padding:24px 18px}
  .wallet-option{min-height:58px}

  dialog{inset:auto 8px max(8px,env(safe-area-inset-bottom));width:auto;max-width:none;max-height:calc(100dvh - max(16px,env(safe-area-inset-top)) - max(16px,env(safe-area-inset-bottom)));margin:0;border-radius:14px}
  dialog button,dialog a{min-height:44px}
}

@media(max-width:380px){
  .product-main{padding-inline:10px}
  .product-header #page-subtitle{display:none}
  .product-header>.product-build-note{top:41px}
  .product-header,.topbar:has(.reference-top-nav){min-height:108px}
  .reference-top-nav{margin-top:10px}
  .rail nav{grid-template-columns:repeat(6,minmax(50px,1fr))}
  .rail nav button>span{font-size:8px!important}
  .product-bastion{grid-template-columns:1fr}
  .pulse-reference .terminal-source{grid-template-columns:1fr}
  .pulse-reference .terminal-market-row,.pulse-reference.terminal-compact .terminal-market-row,.pulse-reference.terminal-table .terminal-market-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 78px!important;padding-inline:10px!important}
  .pulse-reference .terminal-market-row .terminal-values>.terminal-buy-controls:not(.terminal-flow){width:78px}
  .position-card-metrics{grid-template-columns:1fr}
  .lifetime-hero dl{grid-template-columns:1fr}
}

@media(max-width:760px) and (orientation:landscape) and (max-height:520px){
  body{padding-bottom:calc(64px + env(safe-area-inset-bottom))}
  .rail{min-height:60px;padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}
  .rail nav button{min-height:52px!important}
  .reference-side-shell{bottom:calc(66px + env(safe-area-inset-bottom))}
}

@media(pointer:coarse){
  button,a,input,select,summary{touch-action:manipulation}
  .pulse-reference button,.position-card button,.position-card a{min-height:44px}
}
