/* The phone pass: loaded after density.css. A 320 px screen has no sideways scroll, the header is two short rows (the
   page tabs, then the links), and small things on the desks stay readable and tappable. Tokens only. */

/* ---- the page tabs sit in their own tablist row; on a wide screen it is the same row as before ---- */
.tab-strip{display:flex;align-items:flex-start;align-self:stretch;gap:inherit}

/* ---- the top bar: it fits 320 px. The wordmark and the wallet button never squeeze each other off the screen; under 375
   px the crumb (the heading below says "the terminal") gives its room to them ---- */
@media(max-width:680px){
.top .bar{min-width:0}
.top .mark{flex:none}
.bar-end{min-width:0;flex:0 1 auto}
.bar-end .btn-sm{min-width:0;min-height:36px;overflow:hidden;text-overflow:ellipsis}
}
@media(max-width:400px){
.top .bar{gap:10px}
.bar-end{gap:6px}
.bar-end .theme{width:36px;height:36px}
.bar-end .btn-sm{padding:9px 11px;font-size:.72rem}
}
@media(max-width:374px){.term-crumb{display:none}}

/* ---- the header on a phone: one sideways row of page tabs with a fade at whichever end has more, then the links in
   one row of small chips, the palette at its end. Every chip keeps a 32 px tap area around a smaller face ---- */
@media(max-width:680px){
.terminal-tabs{display:block;overflow:visible;border-bottom:0;margin-bottom:14px}
.terminal-tabs .tab-strip{gap:20px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;border-bottom:1px solid var(--rule)}
.tab-strip::-webkit-scrollbar{display:none}
.terminal-tabs [role=tab]{flex:none;align-self:auto;margin:0;padding:8px 0 7px;font-size:.8rem}
.tab-strip[data-more-end]{-webkit-mask-image:linear-gradient(90deg,var(--ink) calc(100% - 36px),transparent);mask-image:linear-gradient(90deg,var(--ink) calc(100% - 36px),transparent)}
.tab-strip[data-more-start]{-webkit-mask-image:linear-gradient(90deg,transparent,var(--ink) 36px);mask-image:linear-gradient(90deg,transparent,var(--ink) 36px)}
.tab-strip[data-more-start][data-more-end]{-webkit-mask-image:linear-gradient(90deg,transparent,var(--ink) 36px,var(--ink) calc(100% - 36px),transparent);mask-image:linear-gradient(90deg,transparent,var(--ink) 36px,var(--ink) calc(100% - 36px),transparent)}
.terminal-tabs .tab-actions{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start;gap:6px;width:auto;margin:10px 0 0;padding:0}
.tab-actions .text-button{position:relative;flex:none;padding:6px 10px;font-size:.68rem}
.tab-actions .text-button::after{content:"";position:absolute;inset:-5px -3px}
.tab-actions .palette-button{margin-left:auto;padding:5px 10px}
.tab-actions .palette-button kbd{border:0;padding:0;font-size:.72rem}
}
@media(max-width:359px){
.terminal-tabs .tab-actions{gap:5px}
.tab-actions .text-button{padding:6px 8px;font-size:.66rem}
}

/* ---- the chart's timeframe row on the narrowest phones: still one line, now inside its pill (it ran 23 px past it) ---- */
@media(max-width:374px){
.chart-timeframes button{padding:5px 3px!important}
.chart-timeframes .timeframe-more{max-width:none;min-width:50px;padding-left:4px!important}
}

/* ---- desk cards on a phone ---- */
@media(max-width:600px){
/* the card bar: grip, title and the card buttons on one line, the source badges on their own line under the title (they
   were squeezed into a column over the buttons) */
.widget-bar{flex-wrap:wrap;row-gap:2px}
.widget-bar h2{flex:1 1 0}
.widget-badges{order:1;flex:1 0 100%;box-sizing:border-box;margin:0 0 3px;padding-left:26px}
.widget-badges:empty{display:none}
.widget-badges .src-badge{margin-left:0}
/* small print keeps to the page's floor of .6rem (9.6 px) on a phone; these were set at 9 to 9.4 px */
.market-stat>span,.chart-foot #chart-tool-status,.ticket-title .pill,.fuse-grid dt,.fuse-odds-watch,.fuse-odds-grid :is(dt,small),.ghost-when,.xray-rule,.ec-grid dt,.relayer-latency thead th,.traders-table thead th,.traders-table small,.xray-table thead th{font-size:.6rem}
#market-audio-desk :is(.market-audio-source,.market-audio-mute,.market-audio-volume,.market-audio-status){font-size:.6rem}
#market-audio-desk button{font-size:.62rem}
.sketch-fields label,.sketch-results span{font-size:.6rem}
/* a table wider than its desk scrolls inside it; a shadow at either edge shows there is more that way (CSS only: the
   paper-coloured covers scroll with the table and hide the shadow at an end that is reached) */
.traders-scroll,.orders-scroll,.table-scroll,.xray-table{
background:linear-gradient(90deg,var(--paper) 40%,transparent) left center/32px 100% no-repeat local,linear-gradient(270deg,var(--paper) 40%,transparent) right center/32px 100% no-repeat local,linear-gradient(90deg,color-mix(in srgb,var(--ink) 22%,transparent),transparent) left center/16px 100% no-repeat scroll,linear-gradient(270deg,color-mix(in srgb,var(--ink) 22%,transparent),transparent) right center/16px 100% no-repeat scroll;
background-color:var(--paper)}
/* the liquidity x-ray's band table: the table scrolls, not the fold with its summary */
.xray-fold{overflow:visible}
.xray-table{display:block;overflow-x:auto;overscroll-behavior-x:contain;width:auto;max-width:100%}
}
@media(max-width:400px){
/* a little more room for the desks' canvases and tables: 12 px sides instead of 16 */
.widget-body>:not(.chart-panel,.positions-panel){padding-left:12px!important;padding-right:12px!important}
.widget-body>.ticket{padding-left:12px!important;padding-right:12px!important}
.widget-body .ticket-title{right:12px}
/* the liquidity x-ray's five band buttons: three and two, so "book ends" is not cut off inside a fifth of the desk */
.xray-bands{grid-template-columns:repeat(3,minmax(0,1fr))}
.xray-bands button small{font-size:.6rem}
/* the ticket's two pills no longer run into "prompt a trade" */
.ticket-title .pill{padding:5px 8px;letter-spacing:.04em}
}

/* ---- touch screens: the fields keep their look at the 16 px floor (assets/site.css) ----
   Controls drawn larger than 16 px name their own size so the floor does not shrink them; the small pill selects and
   the ticket's leverage box take less padding and a little more width so the bigger type still fits their rows. */
.term-input input{--touch-fs:1.25rem}
.outcome-price-input input{--touch-fs:1.55rem}
.prompt-paper textarea{--touch-fs:1.18rem}
.sketch-fields input{--touch-fs:1.05rem}
@media(pointer:coarse){
.leverage-number input{width:58px;padding:2px}
:is(.fuse-pick,.ec-pick) select,#market-audio-desk .market-audio-source select,#session-atlas-desk .atlas-desk-metric select{padding-block:3px}
.chart-pick-mode select{max-width:150px;padding-block:0}
.watch-condition select,.outcome-position-label select{padding-block:4px}
.traders-search input{min-width:10em;padding-block:4px}
.cp-input{padding-block:8px}
.chart-timeframes .timeframe-more{line-height:1}
}
@media(pointer:coarse) and (max-width:600px){
.chart-timeframes .timeframe-more{max-width:4.2em;padding-block:3px!important}
}

/* ---- the margin field: one focus ring, on its box (the box's :focus-within ring), not a second one on the input ---- */
.term-input input:focus-visible{outline:0}

/* ---- the desks sheet: clear of the side safe areas in landscape and of the browser's bars (dvh) ---- */
.desk-sheet{max-height:min(86dvh,640px)}
.desk-sheet-head{padding-left:max(14px,env(safe-area-inset-left,0px));padding-right:max(14px,env(safe-area-inset-right,0px))}
.desk-sheet-body{padding-left:max(14px,env(safe-area-inset-left,0px));padding-right:max(14px,env(safe-area-inset-right,0px))}
@media(max-width:680px){.chart-notes-hint{margin:8px 0 2px}}
