/* ============================================================
   THE PHONE LAYOUT, PART TWO (js/mobile-2.js; the stop / target sheet of
   js/positions-shared.js). Loaded last, after css/locale.css.
   Part one is css/mobile.css. The @media query below is MOBILE_MQ in
   js/mobile.js - change one, change all.
   ============================================================ */

/* Phone-only pieces: nothing of them on the desktop. */
#m-acct, #m-eq-chip, #m-conn-bar, #m-tf-btn, #m-fav-btn, #m-tf-sheet, .m-sheet-money, .m-nav-count { display: none; }

/* ---------- STOP LOSS / TAKE PROFIT SHEET (any touch screen) ----------
   positions-shared.js openSlTpSheet. It covers what is visible of the
   screen (above the keyboard: the script sets top / height from the visual
   viewport) and the panel sits at its bottom, a ticket's width at most. */
#m-sltp-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1400;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
#m-sltp-sheet[hidden] { display: none; }
#m-sltp-sheet .m-sheet-backdrop {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.5); opacity: 0; transition: opacity .18s;
}
#m-sltp-sheet.open .m-sheet-backdrop { opacity: 1; }
.m-sltp-panel {
  position: relative; width: 100%; max-width: 480px; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg-secondary); color: var(--text-primary);
  border-top: 1px solid var(--border-primary); border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(0,0,0,0.45);
  padding: 8px max(16px, var(--m-safe-right, 0px)) calc(12px + var(--m-safe-bottom, 0px)) max(16px, var(--m-safe-left, 0px));
  transform: translateY(100%); transition: transform .2s ease-out;
  font-family: Inter, sans-serif;
}
#m-sltp-sheet.open .m-sltp-panel { transform: translateY(0); }
.m-sltp-panel .m-sheet-handle {
  width: 36px; height: 4px; background: var(--text-muted); opacity: .4; border-radius: 2px; margin: 0 auto 8px;
}
.m-sltp-head { display: flex; align-items: flex-start; gap: 8px; }
.m-sltp-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.m-sltp-title { font-size: 17px; font-weight: 700; }
.m-sltp-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sltp-x {
  flex: 0 0 auto; width: 44px; height: 44px; margin: -8px -10px 0 0; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer;
}
html[dir="rtl"] .m-sltp-x { margin: -8px 0 0 -10px; }
.m-sltp-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-top: 10px; }
.m-sltp-ref { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--text-secondary); }
.m-sltp-ref-v { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.m-sltp-input {
  display: block; width: 100%; box-sizing: border-box; margin-top: 10px; height: 52px; padding: 0 14px;
  border: 1px solid var(--border-secondary); border-radius: 10px;
  background: var(--bg-input, var(--bg-primary)); color: var(--text-bright);
  font-family: 'JetBrains Mono', monospace; font-size: 22px !important; font-weight: 600; text-align: center;
  -webkit-appearance: none; appearance: none; outline: none;
}
.m-sltp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.m-sltp-hint { min-height: 18px; margin-top: 6px; font-size: 12.5px; color: var(--text-secondary); text-align: center; }
.m-sltp-hint.bad { color: var(--red); font-weight: 600; }
.m-sltp-chips { display: flex; gap: 6px; margin-top: 10px; }
.m-sltp-chip {
  flex: 1 1 0; min-width: 0; min-height: 40px; padding: 0 4px;
  border: 1px solid var(--border-primary); border-radius: 20px; background: var(--bg-tertiary);
  color: var(--text-primary); font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.m-sltp-chip:active { background: var(--hover-surface-strong, var(--hover-surface)); }
.m-sltp-remove {
  display: block; width: 100%; min-height: 44px; margin-top: 12px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 10px; background: none;
  color: var(--red); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.m-sltp-remove[hidden] { display: none; }
.m-sltp-remove.armed { border-color: var(--red); background: var(--red-bg); }
.m-sltp-foot { display: flex; gap: 10px; margin-top: 12px; }
.m-sltp-btn {
  flex: 1 1 0; min-height: 50px; border: 0; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 700;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.m-sltp-cancel { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-primary); }
.m-sltp-save { background: var(--accent-fill); color: #fff; }
.m-sltp-save:disabled { opacity: .45; cursor: default; }
.m-sltp-btn:active:not(:disabled) { filter: brightness(1.12); }
#m-sltp-sheet.busy .m-sltp-save { opacity: .6; }
html[data-contrast="high"] .m-sltp-save { box-shadow: inset 0 0 0 2px var(--text-bright); }
@media (prefers-reduced-motion: reduce) {
  .m-sltp-panel, #m-sltp-sheet .m-sheet-backdrop { transition: none; }
}

@media (max-width: 767px), (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {

  /* ---------- NO ZOOM ON FOCUS ----------
     iOS Safari zooms the page in when a box under 16px gets the focus, and
     stays zoomed: the whole app then scrolls sideways. Sign-in was 14px,
     the Deposit / Withdraw / Loan / Contact forms 13px, KYC 15px, the
     support chat 13px. (Not maximum-scale=1: that would also stop a trader
     zooming at all.) */
  .login-box input, .login-box select,
  .tm-panel input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  .tm-panel select, .tm-panel textarea,
  .kyc-screen input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .kyc-screen select, .kyc-screen textarea,
  .ip-dlg input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), .ip-dlg select,
  #cw-input, #contact-subject, #contact-message { font-size: 16px !important; }

  /* ---------- A NATIVE FEEL ----------
     No double-tap zoom on a quick second tap (+ / -, SELL / BUY, the
     timeframes) - pinch zoom still works. No text selection or iOS callout
     on a long press of the app's own chrome; boxes and messages keep it. */
  html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  #top-bar, #mobile-nav, #mobile-fab, #chart-toolbar, #m-ind-bar, .m-asset-tabs, .m-asset-row,
  .panel-header-tabs, .m-sheet-item, .m-tf-panel, .bp-tab, #m-acct, button {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
  .m-asset-tab:active, .mob-nav-btn:active, .bp-tab:active, .m-tf-btn:active, .m-fav-btn:active,
  .m-eq-chip:active, .m-acct-dep:active { background: var(--hover-surface-strong, var(--hover-surface)); }
  /* A toast is only read, never tapped: for its three seconds it no longer
     swallows the taps meant for what is under it (a sheet's Remove, SELL /
     BUY). */
  #toast-container .toast { pointer-events: none !important; }

  /* ---------- TOUCH TARGETS: 44 x 44 ----------
     They were 22 - 36px: the hamburger, the chart's Back and full screen,
     the tabs, the close crosses, the position's close and its confirm. The
     chart toolbar takes 44px of height for it. */
  #mobile-hamburger-btn { width: 44px; height: 44px; margin-right: 0; }
  body[data-mobile-screen="chart"] #chart-toolbar { height: 44px; gap: 2px; padding: 0 4px; }
  .m-chart-back-btn, .m-chart-fullscreen-btn { width: 44px; height: 44px; }
  .m-asset-tab { min-height: 36px; padding: 6px 14px; }
  .m-asset-tab.active { padding: 5px 13px; }
  .m-asset-tab-fav { font-size: 15px; padding-inline: 12px; }
  .m-asset-tab-fav.active { padding-inline: 11px; }
  .m-ind-open { height: 36px; }
  /* In the chart's full screen (and so on a phone on its side) the
     Indicators and drawing buttons share the 44px tools row: 36px, not the
     26px of the old landscape row. */
  html.m-chart-fs body .m-ind-open, html.m-chart-fs body .m-draw-open { height: 36px; }
  /* Upright in full screen the tools row also holds Indicators and the
     pencil: on a phone under 420px the symbol's icon and the star step
     aside (both are there outside full screen), so the name still reads. */
  @media (max-width: 419px) {
    html.m-chart-fs body:not(.m-landscape) #m-fav-btn,
    html.m-chart-fs body:not(.m-landscape) #chart-sym-icon { display: none !important; }
    html.m-chart-fs body:not(.m-landscape) .m-tf-btn { min-width: 50px; padding: 0 8px; }
  }
  /* Under 340px (large text): the name keeps the room - the icon and the
     quote step aside (the quote is on SELL / BUY and the price scale). */
  @media (max-width: 339px) {
    body[data-mobile-screen="chart"] #chart-sym-icon,
    body[data-mobile-screen="chart"] #chart-sym-price,
    body[data-mobile-screen="chart"] #chart-sym-ext { display: none !important; }
  }
  .m-ind-pill { height: 36px; }
  .m-ind-pill-x { width: 36px; }
  .m-ind-close { width: 44px; height: 44px; }
  .m-order-close { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  #order-widget-wrap.ow-sheet .ow-unit-btn { min-height: 36px; }
  #order-widget-wrap.ow-sheet .ow-seg-btn { min-height: 36px; min-width: 44px; }
  #order-widget-wrap.ow-sheet .ow-mode-btn { min-height: 36px; }
  #order-widget-wrap.ow-sheet .ow-chip { min-height: 36px; }
  #order-widget-wrap.ow-sheet #ow-volume { min-height: 40px; }
  .tm-close { min-width: 44px; min-height: 44px; font-size: 24px; display: inline-flex; align-items: center; justify-content: center; }
  #cw-close { min-width: 44px !important; min-height: 44px !important; }
  .tm-pkg-btn { min-height: 40px; padding: 8px 16px; font-size: 13px; }
  .tm-panel input[type="checkbox"], .tm-panel input[type="radio"] { width: 22px; height: 22px; }
  #bottom-area .bp-table .bp-close-btn,
  #bottom-area .bp-table .bp-cancel-btn { width: 44px; height: 40px; }
  #bottom-area .bp-table .bp-confirm-yes,
  #bottom-area .bp-table .bp-confirm-no { min-height: 44px; padding: 10px 18px; font-size: 13px; }
  /* The stop and the target: a finger-sized strip to tap (it opens the
     stop / target sheet). */
  #bottom-area .bp-table .bp-editable {
    min-height: 36px; line-height: 20px; padding: 7px 10px; margin: 4px 0; cursor: pointer;
    border: 1px solid var(--border-primary); border-radius: 8px; background: var(--bg-secondary);
  }
  #bottom-area .bp-table .bp-editable:active { background: var(--hover-surface-strong, var(--hover-surface)); }
  #bottom-area .bp-table .bp-editable + .bp-editable { margin-inline-start: 8px; }
  .m-sheet-item { min-height: 48px; }
  .m-sheet-sub button { min-height: 36px; }

  /* ---------- CHART TOOLBAR: always fits ----------
     [Back] [Full screen] [icon Gold 4147.39] ... [star] [M5 v]
     The five timeframe chips gave way to one chip that opens all nine
     (js/mobile-2.js); the name shortens with an ellipsis rather than push
     anything off the edge; a pre / after-market price is a small second
     line under the quote. */
  body[data-mobile-screen="chart"] #chart-timeframes { display: none !important; }
  body[data-mobile-screen="chart"] #chart-toolbar { scroll-snap-type: none; }
  body[data-mobile-screen="chart"] #chart-symbol-label {
    flex: 1 1 auto; min-width: 0; overflow: hidden;
    display: grid; grid-template-columns: auto minmax(2.6em, max-content) auto; grid-template-rows: auto auto;
    column-gap: 6px; row-gap: 0; align-items: center; justify-content: start;
  }
  body[data-mobile-screen="chart"] #chart-sym-icon { grid-row: 1 / span 2; margin-inline-end: 0; }
  body[data-mobile-screen="chart"] #chart-sym-name {
    grid-column: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px;
  }
  body[data-mobile-screen="chart"] #chart-sym-price { grid-column: 3; white-space: nowrap; font-variant-numeric: tabular-nums; }
  body[data-mobile-screen="chart"] #chart-sym-ext {
    grid-column: 2 / span 2; font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  body[data-mobile-screen="chart"] #m-tf-btn,
  body[data-mobile-screen="chart"] #m-fav-btn { display: inline-flex; }
  .m-tf-btn {
    flex: 0 0 auto; align-items: center; justify-content: center; gap: 4px;
    min-width: 56px; height: 36px; margin-inline-start: 2px; padding: 0 10px;
    border: 1px solid var(--border-secondary); border-radius: 18px;
    background: var(--bg-tertiary); color: var(--text-bright);
    font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; cursor: pointer;
  }
  .m-tf-btn svg { color: var(--text-muted); }
  .m-fav-btn {
    flex: 0 0 auto; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-inline-start: auto; padding: 0; border: 0; border-radius: 50%;
    background: none; color: var(--text-muted); cursor: pointer;
  }
  .m-fav-btn.on { color: #f5b301; }
  html[data-theme="light"] .m-fav-btn.on { color: #b45309; }

  /* The timeframe sheet: nine timeframes, three to a row, 56px tall. */
  #m-tf-sheet:not([hidden]) {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1350;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  }
  #m-tf-sheet .m-sheet-backdrop { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.35); opacity: 0; transition: opacity .18s; }
  #m-tf-sheet.open .m-sheet-backdrop { opacity: 1; }
  .m-tf-panel {
    position: relative; width: 100%; max-width: 560px;
    padding: 10px max(12px, var(--m-safe-right)) calc(12px + var(--m-safe-bottom)) max(12px, var(--m-safe-left));
    background: var(--bg-secondary); border-top: 1px solid var(--border-primary);
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
    transform: translateY(100%); transition: transform .2s ease-out;
  }
  #m-tf-sheet.open .m-tf-panel { transform: translateY(0); }
  .m-tf-head { display: flex; align-items: center; padding: 0 0 8px; padding-inline-start: 4px; }
  .m-tf-title { flex: 1 1 auto; font-size: 15px; font-weight: 700; color: var(--text-primary); }
  .m-tf-close { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer; }
  .m-tf-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .m-tf-opt {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; padding: 4px; border: 1px solid var(--border-primary); border-radius: 12px;
    background: var(--bg-tertiary); color: var(--text-primary); font-family: inherit; cursor: pointer;
  }
  .m-tf-code { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700; }
  .m-tf-name { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .m-tf-opt.on { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
  .m-tf-opt.on .m-tf-name { color: rgba(255,255,255,0.85); }
  body.m-landscape .m-tf-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  body.m-landscape .m-tf-opt { min-height: 48px; }
  html[data-contrast="high"] .m-tf-opt.on { box-shadow: inset 0 0 0 2px var(--text-bright); }

  /* ---------- ACCOUNT (js/mobile-2.js) ----------
     Positions: Deposit, at the end of a strip over the tabs. The figures
     are in the account row under the top bar on every screen
     (css/mobile-stats.css). No strip on a demo account (no deposits), nor
     on a phone on its side, where the height goes to the positions (Deposit
     was already off there). */
  body[data-mobile-screen="positions"] #m-acct { display: flex; }
  #m-acct[hidden], body.m-landscape #m-acct { display: none !important; }
  .m-acct {
    flex-shrink: 0; align-items: center; justify-content: flex-end; padding: 6px 12px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border-primary);
  }
  .m-acct-l {
    font-size: 10px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .m-acct-dep {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0 16px; border: 0; border-radius: 22px;
    background: var(--accent-fill); color: #fff; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  }
  .m-acct-dep[hidden] { display: none; }
  html[data-contrast="high"] .m-acct-dep { box-shadow: inset 0 0 0 2px var(--text-bright); }

  /* The menu: equity and balance under the name, and Deposit. */
  .m-sheet-header.m-sheet-header-money { flex-wrap: wrap; }
  .m-sheet-money {
    display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 4px;
  }
  .m-sheet-money-v {
    flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline;
  }
  .m-sheet-money-v bdi { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* The top bar: the equity, a tap from the positions. */
  #m-eq-chip {
    display: inline-flex; flex-direction: column; align-items: flex-end; justify-content: center;
    min-height: 44px; max-width: 52vw; padding: 0 10px; border: 0; border-radius: 8px;
    background: none; color: var(--text-primary); font-family: inherit; cursor: pointer; line-height: 1.15;
  }
  html[dir="rtl"] #m-eq-chip { align-items: flex-start; }
  .m-eq-l { font-size: 9.5px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); }
  .m-eq-v { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-variant-numeric: tabular-nums; }
  #m-eq-chip[data-state="warn"] .m-eq-v { color: var(--orange); }
  #m-eq-chip[data-state="danger"] .m-eq-v { color: var(--red); }

  /* The bottom menu's Positions: the number open, coloured by the P&L. */
  .mob-nav-btn { position: relative; }
  .m-nav-count {
    display: block; position: absolute; top: 3px; left: calc(50% + 6px);
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--text-muted); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
    font-family: Inter, sans-serif; pointer-events: none;
  }
  html[dir="rtl"] .m-nav-count { left: auto; right: calc(50% + 6px); }
  .m-nav-count[data-sign="+"] { background: #15803d; }
  .m-nav-count[data-sign="-"] { background: #c81e3c; }
  body.m-landscape .m-nav-count { top: 1px; }

  /* On a slow network the page shows before js/mobile.js has picked a
     screen: the bottom menu stays at the bottom meanwhile, not under the
     header. */
  #mobile-nav { margin-top: auto; }

  /* ---------- CONNECTION ----------
     A bar under the top bar while the prices are not live; SELL / BUY
     dimmed meanwhile (a tap says why - js/mobile-2.js). */
  #m-conn-bar:not([hidden]) {
    display: flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; order: 1;
    min-height: 30px; padding: 4px 12px; font-size: 12.5px; font-weight: 600;
    background-color: var(--bg-secondary); background-image: linear-gradient(var(--orange-bg), var(--orange-bg));
    color: var(--orange); border-bottom: 1px solid var(--orange);
  }
  #m-conn-bar.off { background-image: linear-gradient(var(--red-bg), var(--red-bg)); color: var(--red); border-color: var(--red); }
  .m-conn-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: m-conn-pulse 1.2s ease-in-out infinite; }
  @keyframes m-conn-pulse { 50% { opacity: .3; } }
  @media (prefers-reduced-motion: reduce) { .m-conn-dot { animation: none; } }
  body.m-offline #mobile-fab .m-fab-btn { opacity: .45; filter: grayscale(.6); }

  /* ---------- POSITIONS TABS: one row ----------
     Short names (data-short, js/mobile-2.js) with the counts, sliding
     sideways if they must; the long name stays the button's text. */
  body[data-mobile-screen="positions"] .panel-header-tabs {
    flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; gap: 0;
  }
  body[data-mobile-screen="positions"] .panel-header-tabs::-webkit-scrollbar { display: none; }
  body[data-mobile-screen="positions"] .bp-tab {
    flex: 1 0 auto !important; height: 44px !important; padding: 0 12px !important; white-space: nowrap;
  }
  body[data-mobile-screen="positions"] .bp-tab[data-short] { font-size: 0 !important; letter-spacing: 0 !important; }
  body[data-mobile-screen="positions"] .bp-tab[data-short]::before {
    content: attr(data-short); font-size: 13px; font-weight: 600; letter-spacing: 0.2px; text-transform: none;
  }
  body[data-mobile-screen="positions"] .bp-tab[data-short] .tab-count { font-size: 10.5px; margin-inline-start: 5px; }

  /* ---------- LARGE TEXT, NARROW PHONES ----------
     At 130 - 150 % text a name wrapped over three lines and pushed the
     prices around; now one line each, ending in an ellipsis. The category
     row fades at its edge when there is more to slide to. */
  .m-asset-row .ar-sym, .m-asset-row .ar-class { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-asset-row .ar-bidask { white-space: nowrap; }
  .m-asset-tabs {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    padding-inline-end: 24px;
  }
  html[dir="rtl"] .m-asset-tabs {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 24px), transparent);
  }
  /* Only the rows on screen are drawn (Chrome 85+, Safari 18+). */
  .m-asset-row { content-visibility: auto; contain-intrinsic-size: auto 64px; }
  /* On its side Markets has ~300px of height: the search and category rows
     and the rows themselves give some back, so more than two markets show. */
  body.m-landscape .m-asset-search { padding-top: 4px; padding-bottom: 4px; }
  body.m-landscape .m-asset-search input { padding-top: 6px; padding-bottom: 6px; }
  body.m-landscape .m-asset-tabs { padding-top: 2px; padding-bottom: 4px; }
  body.m-landscape .m-asset-row { padding-top: 8px; padding-bottom: 8px; }
  /* Under 340px (a Fold's cover screen, large text): sell over buy. */
  @media (max-width: 340px) {
    .m-asset-row .ar-bidask { flex-direction: column; align-items: flex-end; gap: 0; }
    .m-asset-row { padding-inline: 10px; }
  }
  /* While the symbols load (on a slow network, seconds): the shape of the
     list instead of a blank screen. */
  .m-asset-list:empty {
    background:
      linear-gradient(to bottom, transparent 18px, var(--bg-tertiary) 18px 34px, transparent 34px 42px, var(--hover-surface-strong, var(--bg-tertiary)) 42px 52px, transparent 52px) 14px 0 / 46% 64px repeat-y,
      linear-gradient(to bottom, transparent 22px, var(--bg-tertiary) 22px 36px, transparent 36px) right 14px top 0 / 30% 64px repeat-y;
    animation: m-skel 1.4s ease-in-out infinite;
  }
  @keyframes m-skel { 50% { opacity: .55; } }
  @media (prefers-reduced-motion: reduce) { .m-asset-list:empty { animation: none; } }

  /* ---------- THE SUPPORT CHAT ----------
     While typing it covers what the keyboard leaves (js/mobile-2.js), and
     an empty chat says what it is for. */
  #cw-panel.m-kb { border-radius: 0 !important; }
  #cw-messages:empty::before {
    content: attr(data-empty); display: block; margin: auto; padding: 24px 20px;
    text-align: center; font-size: 13px; line-height: 1.5; color: var(--text-muted);
  }

  /* ---------- INSTALLED ON AN iPHONE'S HOME SCREEN ----------
     The status bar is see-through there (black-translucent, index.html) and
     its clock white: over the light theme's white header it could not be
     read, so the strip it sits on is dark in the light theme. */
  @media (display-mode: standalone) {
    html[data-theme="light"] #top-bar { box-shadow: inset 0 var(--m-safe-top) 0 0 #1f2937; }
    html[data-theme="light"].m-chart-fs #app { border-top-color: #1f2937; }
  }

  /* ---------- OLDER iPHONES ----------
     `inset: 0` needs iOS 14.5: the sheets and their backdrops spelled out. */
  #mobile-menu-sheet, #m-order-sheet, #m-ind-sheet:not([hidden]), .m-sheet-backdrop { top: 0; right: 0; bottom: 0; left: 0; }
  #m-order-sheet { top: var(--m-ovv-top, 0px); bottom: auto; }

  /* ---------- SHEETS END WHERE THE SCREEN ENDS ----------
     The page goes on under iOS Safari's floating bar; the app is sized to
     what is visible (--m-h, css/mobile.css), and so are the sheets that
     rise from its bottom - their last rows above the bar, not under it. */
  #mobile-menu-sheet, #m-ind-sheet:not([hidden]), #m-tf-sheet:not([hidden]) {
    bottom: auto; height: var(--m-h, 100%);
  }

  /* ---------- CONNECTION IN FULL SCREEN ----------
     The chart's full screen (a phone on its side is in it by itself) keeps
     the connection bar: over the chart upright, across the top on its side. */
  html.m-chart-fs #m-conn-bar:not([hidden]) { display: flex !important; }
  html.m-chart-fs body.m-landscape #app {
    grid-template: "conn conn" auto "banner banner" auto "center fab" minmax(0, 1fr) / minmax(0, 1fr) auto;
  }
  html.m-chart-fs body.m-landscape #m-conn-bar { grid-area: conn; }
}
