/* =====================================================================
   PADDOCK · Carbon theme · shell
   Owns: .tfapp, .tfmainw, .tfmainc, the HUD (.cbhud, built by js/carbon/hud.js),
   the sidebar drawer .tfsd and its overlay #tfov, and the padding / max-width of
   .tfbody for every view except the simulator (.tfbody.sim belongs to cockpit.css).
   Not ours: the boot intro (css/intro.css + js/intro/lights-out.js) and the screen
   change slide on .tfbody.enter (css/fx.css). Every rule is scoped to .tf.cb.

   HUD CONTRACT (other Carbon areas rely on this)
   - Desktop (>= 861px): sticky <header class="cbhud cbcf"> at the top of the #tf
     scroll container, z-index 30 (below .tftoasts 40 and .tfmodal 45).
       .cbhud-bar (64px): .cbhud-brand, .cbhud-modes, .cbhud-center (.cbhud-cmd with
       #tfsq + #tfsr, and the empty slot #cbarena.cbhud-arena), telemetry .cbhud-eq,
       .cbhud-risk, .cbhud-tilt, .cbhud-sess, rank chip button#tfgst.cbhud-rank, then the
       assistant launcher button.cbhud-ai[data-ai-launch] (label from 1700px, orb below).
       The floating .aifab is hidden on desktop; phones keep it and get no launcher.
       .cbhud-modes and .cbhud-center sit in .cbhud-row2 (display: contents on desktop).
       .cbhud-sub (34px): the active mode's pages, then a market readout.
   - Phone (<= 860px): row 1 menu button + brand + equity + rank (tablets add the rev
     counter, tilt trace and session dial), row 2 the four modes + a search button that
     widens into the command bar while you type, row 3 the sub-nav (scrolls sideways).
   - --cb-hud-h on .tf.cb = full sticky header height (bar + sub-nav + top safe area):
     98px desktop, 122px phone. Layouts below the header use calc(100dvh - var(--cb-hud-h)).
   - #cbarena is hidden unless #tf has class "cbarena-on"; while it is set .cbhud-cmd is
     hidden and #cbarena is display: flex. This file owns only those two rules;
     compete.css owns everything inside #cbarena.
   - #tf carries data-cbmode="learn|trade|compete|review" (set by hud.js on render).
   - The sidebar .tfsd is hidden on desktop (the rail's reserved space is removed); on
     phones it is the drawer opened by the HUD menu button (data-tfmenu).
   ===================================================================== */

/* ---------- layout contract ---------- */
.tf.cb,
.tf.cb[data-tfth] { --cb-hud-h: calc(98px + env(safe-area-inset-top, 0px)); }
@media (max-width: 860px) {
  .tf.cb,
  .tf.cb[data-tfth] { --cb-hud-h: calc(122px + env(safe-area-inset-top, 0px)); }
}

/* screen-reader-only text */
.tf.cb .cbsr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- app frame: no rail, full-width main column ---------- */
.tf.cb .tfapp,
.tf.cb .tfapp.pin { padding-top: 0; min-height: 100%; }
.tf.cb .tfmainw,
.tf.cb .tfapp.pin .tfmainw { flex: 1; min-width: 0; padding-left: 0; }
/* never scroll the page sideways (e.g. while a screen slides in); clip is not a scroll
   container, so the sticky HUD keeps working, and fixed layers are not clipped */
.tf.cb .tfmainw { overflow-x: clip; }
.tf.cb .tfmainc,
.tf.cb .tfmainc.wide { max-width: none; margin: 0; padding: 0; }

/* page container for every view except the simulator */
.tf.cb .tfbody:not(.sim) {
  max-width: 1328px; margin: 0 auto;
  padding: 28px max(24px, env(safe-area-inset-right, 0px)) 104px max(24px, env(safe-area-inset-left, 0px));
}

/* ====================================================================
   HUD
   ==================================================================== */
.tf.cb .cbhud {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top, 0px);
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .9);
}
.tf.cb .cbhud-bar {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--tline2);
  overflow-x: clip; /* safety net: never wider than the window (results still drop below) */
}
/* thin orange underline glow along the bottom of the bar */
.tf.cb .cbhud-bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 2%, var(--cb-accent-lo) 28%, var(--cb-accent-hi) 50%, var(--cb-accent-lo) 72%, transparent 98%);
  box-shadow: 0 0 10px 0 var(--cb-accent-a50);
  opacity: .85;
}
/* effects layer: a soft glow from below and the speed streaks (behind everything) */
.tf.cb .cbhud-fx { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.tf.cb .cbhud-fx::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(42% 150% at 50% 135%, var(--cb-accent-a10), transparent 70%);
}
.tf.cb[data-cbmode="compete"] .cbhud-fx::before { background: radial-gradient(48% 160% at 50% 135%, var(--cb-accent-a25), transparent 70%); }
.tf.cb .cbhud-fx i {
  position: absolute; left: calc(var(--w, 38%) * -1); top: var(--y); width: var(--w, 38%); height: 1px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--cb-accent) 75%, #FFE1D2);
}
/* a streak runs from just off the left edge until its bright head meets the right edge,
   fading as it goes: it never reaches past the window (no phantom overflow), and
   "backwards" (not "both") drops it back to its hidden start once it has run */
.tf.cb .cbhud-sweep .cbhud-fx i { animation: cbhud-streak 1.1s cubic-bezier(.25, .6, .2, 1) var(--d) backwards; }
@keyframes cbhud-streak {
  0% { left: calc(var(--w, 38%) * -1); opacity: 0; }
  25% { opacity: .85; }
  100% { left: calc(100% - var(--w, 38%)); opacity: 0; }
}

/* menu button (phones only) */
.tf.cb .cbhud-menu { display: none; }

/* brand */
.tf.cb .cbhud-brand {
  flex: none; display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 6px 0 2px; border: 0; background: none; color: var(--tink);
}
.tf.cb .cbhud-brand .cbmark { width: 26px; height: 18px; flex: none; filter: drop-shadow(0 0 7px rgba(255, 90, 31, .35)); transition: transform .4s var(--cb-ease), filter .3s; }
.tf.cb .cbhud-brand:hover .cbmark { transform: translateX(2px); filter: drop-shadow(0 0 12px rgba(255, 90, 31, .65)); }
.tf.cb .cbhud-word { font: 400 13px/1 var(--cb-brand); letter-spacing: .2em; color: var(--tink); white-space: nowrap; margin-right: -.2em; }

/* modes + center: a plain pass-through on desktop */
.tf.cb .cbhud-row2 { display: contents; }

/* modes */
.tf.cb .cbhud-modes { flex: none; display: flex; gap: 3px; padding: 0 4px 0 12px; border-left: 1px solid var(--tline); height: 32px; align-items: center; }
.tf.cb .cbhud-mode {
  height: 32px; padding: 0 12px; border: 1px solid var(--tline); border-radius: 0;
  background: var(--tpan2); color: var(--tt2);
  font: 500 12.5px/1 var(--tsans); white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s;
}
.tf.cb .cbhud-mode > span { display: block; }
.tf.cb .cbhud-mode:hover { color: var(--tink); border-color: var(--cb-line-3); }
.tf.cb .cbhud-mode.on {
  color: var(--tink); border-color: var(--cb-accent);
  background: linear-gradient(180deg, var(--cb-accent-a25), var(--cb-accent-a10));
  box-shadow: 0 0 16px -4px var(--cb-accent-a50);
}

/* command bar (search) */
.tf.cb .cbhud-center { flex: 1 1 0; min-width: 190px; height: 44px; display: flex; align-items: center; justify-content: center; }
.tf.cb .cbhud-cmd {
  position: relative; flex: 1 1 auto; min-width: 0; width: 100%; max-width: 380px;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 5px 0 13px;
  border: 1px solid var(--tline2); border-radius: 18px;
  background: var(--cb-glass); color: var(--tmut); box-shadow: none;
  transition: border-color .2s, box-shadow .2s;
}
.tf.cb .cbhud-cmd:hover { border-color: var(--cb-line-3); }
.tf.cb .cbhud-cmd:focus-within { border-color: var(--cb-accent-a50); box-shadow: none; outline: 2px solid var(--cb-focus); outline-offset: 2px; }
.tf.cb .cbhud-cmd > .tfi { width: 15px; height: 15px; color: var(--tmut); stroke-width: 2; }
.tf.cb .cbhud-cmd input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none;
  font: 400 12.5px/1 var(--tsans); color: var(--tink); text-overflow: ellipsis;
}
.tf.cb .cbhud-cmd input::placeholder { color: var(--tmut); opacity: 1; }
.tf.cb .cbhud-cmd input:focus-visible { outline: none; }
.tf.cb .cbhud-cmd kbd {
  flex: none; padding: 3px 8px; border: 1px solid var(--tline2); border-radius: 10px;
  font: 500 10.5px/1.2 var(--tmono); color: var(--tt2); white-space: nowrap; background: transparent;
}
.tf.cb .cbhud-cmd:focus-within kbd { opacity: 0; }

/* search results */
.tf.cb .cbhud-cmd .tfsr {
  position: absolute; top: calc(100% + 10px); left: 50%; right: auto; z-index: 31;
  width: max(100%, 440px); max-width: calc(100vw - 32px); transform: translateX(-50%);
  max-height: min(460px, 70vh); overflow-y: auto; padding: 6px;
  border-radius: 4px; background: var(--tpan2); border: 1px solid var(--tline2);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .03);
}
.tf.cb .cbhud-cmd .tfsr::before {
  content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cb-accent), transparent); opacity: .7;
}
.tf.cb .cbhud-cmd .tfsr button {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 2px; background: none; color: var(--tink); text-align: left;
}
.tf.cb .cbhud-cmd .tfsr button:hover { background: var(--tp4); }
.tf.cb .cbhud-cmd .tfsr button.on { background: linear-gradient(90deg, var(--cb-accent-a10), transparent 70%); }
.tf.cb .cbhud-cmd .tfsr button.on::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; background: var(--cb-accent); box-shadow: 0 0 8px var(--cb-accent-a50); }
.tf.cb .cbhud-cmd .tfsr .ic {
  display: grid; place-items: center; width: 32px; height: 30px; flex: none; border-radius: 0;
  background: var(--tp4); border: 1px solid var(--tline); color: var(--cb-accent);
  transform: skewX(var(--cb-skew));
}
.tf.cb .cbhud-cmd .tfsr .ic .tfi { width: 16px; height: 16px; transform: skewX(calc(var(--cb-skew) * -1)); }
.tf.cb .cbhud-cmd .tfsr .tx { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tf.cb .cbhud-cmd .tfsr b { font: 600 13.5px/1.3 var(--tsans); color: var(--tink); }
.tf.cb .cbhud-cmd .tfsr em { font: 400 12px/1.3 var(--tsans); font-style: normal; color: var(--tmut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf.cb .cbhud-cmd .tfsr .tfempty { padding: 16px; font-size: 13px; color: var(--tmut); }

/* desktop: the command bar widens over its neighbours while you type */
@media (min-width: 861px) {
  .tf.cb .cbhud-center { position: relative; }
  .tf.cb .cbhud-cmd:focus-within {
    position: absolute; top: 4px; left: 50%; z-index: 3; transform: translateX(-50%);
    width: max(100%, 460px); max-width: calc(100vw - 32px);
    background: var(--tpan2); box-shadow: 0 12px 30px rgba(0, 0, 0, .65);
  }
}

/* compete arena slot: shell owns only show / hide */
.tf.cb .cbhud-arena { display: none; }
.tf.cb.cbarena-on .cbhud-cmd { display: none; }
.tf.cb.cbarena-on .cbhud-arena { display: flex; }

/* ---------- telemetry ---------- */
.tf.cb .cbhud-tele {
  flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 9px;
  height: 40px; padding-left: 12px; border-left: 1px solid var(--tline);
}
.tf.cb .cbhud-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; white-space: nowrap; }
/* safety net for long values (a seven-figure equity, a long time string): the text
   columns give way with an ellipsis before anything is pushed off the bar */
.tf.cb .cbhud-txt > * { overflow: hidden; text-overflow: ellipsis; }
.tf.cb .cbhud-txt .cblbl { line-height: 1; }
.tf.cb .cbhud-val { font: 600 14px/1.1 var(--tmono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--tink); }
.tf.cb .cbhud-s { font: 400 10.5px/1.1 var(--tsans); color: var(--tmut); }
.tf.cb .cbhud-eq .cbhud-val { font-size: 15px; }
.tf.cb .cbhud-eq .cbhud-s { font-family: var(--tmono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tf.cb .cbhud-eq .cbhud-s.up { color: var(--tup); }
.tf.cb .cbhud-eq .cbhud-s.dn { color: var(--tdn); }
.tf.cb .cbhud-sess .cbhud-val { font-size: 13px; }

/* risk shield: rev counter */
.tf.cb .cbhud-rev,
.tf.cb .cbhud-dial { width: 40px; height: 40px; flex: none; overflow: visible; }
.tf.cb .cbhud-rev path,
.tf.cb .cbhud-dial path,
.tf.cb .cbhud-dial circle.d-track { fill: none; stroke-linecap: round; }
.tf.cb .cbhud-rev .r-track { stroke: rgba(226, 232, 240, .13); stroke-width: 3.5; }
.tf.cb .cbhud-rev .r-val { stroke: var(--tt2); stroke-width: 3.5; transition: stroke .3s; }
.tf.cb .cbhud-rev .r-red { stroke: var(--tdn); stroke-width: 1.6; }
.tf.cb .cbhud-rev .r-tick { stroke: var(--cb-line-3); stroke-width: 1; }
.tf.cb .cbhud-rev .r-needle,
.tf.cb .cbhud-dial .d-needle { stroke: var(--tink); stroke-width: 1.4; stroke-linecap: round; }
.tf.cb .cbhud-rev .r-hub,
.tf.cb .cbhud-dial .d-hub { fill: var(--cb-accent); }
.tf.cb .cbhud-risk.hot .r-val { stroke: var(--tdn); }
.tf.cb .cbhud-risk.hot .cbhud-val { color: var(--tdn); }

/* tilt pulse: ECG trace, faster and taller as tilt rises */
.tf.cb .cbhud-ecg {
  width: 58px; height: 26px; flex: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%); mask-image: linear-gradient(90deg, transparent, #000 45%);
}
.tf.cb .cbhud-ecg line { stroke: var(--tline); stroke-width: 1; }
.tf.cb .cbhud-ecg path { fill: none; stroke: var(--tt2); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.tf.cb .cbhud-trace { animation: cbhud-ecg 2.6s linear infinite; }
@keyframes cbhud-ecg { to { transform: translateX(-36px); } }
.tf.cb .cbhud-state { font: 600 13px/1.1 var(--tsans); color: var(--tink); }
.tf.cb .cbhud-tilt[data-lv="1"] .cbhud-trace { animation-duration: 1.5s; }
.tf.cb .cbhud-tilt[data-lv="1"] .cbhud-ecg path { stroke: var(--cb-accent); }
.tf.cb .cbhud-tilt[data-lv="1"] .cbhud-state { color: var(--cb-accent); }
.tf.cb .cbhud-tilt[data-lv="2"] .cbhud-trace { animation-duration: .85s; }
.tf.cb .cbhud-tilt[data-lv="2"] .cbhud-ecg path { stroke: #FFE1D2; stroke-width: 1.5; filter: drop-shadow(0 0 2.5px var(--cb-accent)); }
.tf.cb .cbhud-tilt[data-lv="2"] .cbhud-state { color: #FFE1D2; text-shadow: 0 0 10px var(--cb-accent); }
.tf.cb .cbhud-tilt[data-lv="2"] .cbhud-s { color: var(--cb-accent-hi); }

/* session dial */
.tf.cb .cbhud-dial .d-tick { stroke: var(--cb-line-3); stroke-width: 1; }
.tf.cb .cbhud-dial .d-major { stroke: var(--tt2); stroke-width: 1.2; }
.tf.cb .cbhud-dial .d-asia { stroke: var(--cb-steel); stroke-width: 2.2; }
.tf.cb .cbhud-dial .d-lon { stroke: var(--cb-accent); stroke-width: 2.2; }
.tf.cb .cbhud-dial .d-ny { stroke: var(--tink); stroke-width: 2.2; }
.tf.cb .cbhud-dial .d-track { stroke: rgba(226, 232, 240, .13); stroke-width: 2.2; }
.tf.cb .cbhud-dial .d-prog { stroke: var(--cb-accent); stroke-width: 2.2; }

/* rank chip (angled) */
.tf.cb .cbhud-rank {
  flex: none; position: relative; height: 36px; padding: 0 13px 0 5px; margin-left: 2px;
  border: 1px solid var(--tline2); border-radius: 0; background: var(--tpan2); color: var(--tink);
  box-shadow: none; transition: border-color .2s, background .2s;
}
.tf.cb .cbhud-rank:hover { border-color: var(--cb-accent-a50); background: var(--tp4); }
.tf.cb .cbrk { position: relative; display: flex; align-items: center; gap: 9px; height: 100%; }
.tf.cb .cbrk .tfrb {
  width: 30px; height: 26px; border-radius: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rc) 82%, #fff), color-mix(in srgb, var(--rc) 55%, #000));
  color: #050505;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.tf.cb .cbrk .tfrb .tfi { width: 15px; height: 15px; stroke-width: 2.2; }
.tf.cb .cbrk-t { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.tf.cb .cbrk-t b { font: 600 12.5px/1.1 var(--tsans); color: var(--tink); white-space: nowrap; }
.tf.cb .cbrk-t em { font: 500 10.5px/1.1 var(--tmono); font-style: normal; color: var(--tmut); white-space: nowrap; }
/* XP progress: a hairline along the chip's bottom edge, clear of the "XP" text */
.tf.cb .cbrk-bar { position: absolute; left: 39px; right: 0; bottom: 1px; height: 2px; background: var(--tline2); }
.tf.cb .cbrk-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cb-ember), var(--cb-accent)); }

/* ---------- sub-nav row ---------- */
.tf.cb .cbhud-sub {
  display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
  height: 34px; padding: 0 18px 0 12px;
  background: linear-gradient(180deg, var(--tpan), var(--tp0));
  border-bottom: 1px solid var(--tline);
}
.tf.cb .cbhud-subl { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tf.cb .cbhud-subl::-webkit-scrollbar { display: none; }
.tf.cb .cbhud-subl.cbov:not(.cbend) { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.tf.cb .cbhud-pg {
  position: relative; flex: none; display: flex; align-items: center; gap: 7px;
  height: 100%; padding: 0 12px; border: 0; border-radius: 0; background: none;
  color: var(--tmut); font: 500 12.5px/1 var(--tsans); white-space: nowrap;
  transition: color .2s, background .2s;
}
.tf.cb .cbhud-pg .tfi { width: 14px; height: 14px; stroke-width: 1.8; }
.tf.cb .cbhud-pg:hover { color: var(--tink); background: rgba(255, 255, 255, .025); }
.tf.cb .cbhud-pg:focus-visible { outline-offset: -3px; }
.tf.cb .cbhud-pg.on { color: var(--tink); }
.tf.cb .cbhud-pg.on .tfi { color: var(--cb-accent); }
.tf.cb .cbhud-pg.on::after {
  content: ""; position: absolute; left: 9px; right: 9px; bottom: 0; height: 2px;
  background: var(--cb-accent); box-shadow: 0 0 10px var(--cb-accent-a50);
  transform: skewX(var(--cb-skew));
}
.tf.cb .cbhud-pg .tfdot { position: absolute; top: 7px; left: 21px; width: 6px; height: 6px; background: var(--cb-accent); box-shadow: 0 0 0 2px var(--tpan), 0 0 8px var(--cb-accent); }
.tf.cb .cbhud-mkt { flex: none; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.tf.cb .cbhud-mkt > i { width: 6px; height: 6px; background: var(--cb-steel); transform: skewX(var(--cb-skew)); }
.tf.cb .cbhud-mkt.live > i { background: var(--cb-accent); box-shadow: 0 0 8px var(--cb-accent); animation: cbhud-blink 1.6s ease-in-out infinite; }
@keyframes cbhud-blink { 50% { opacity: .3; } }
.tf.cb .cbhud-mkt b { font: 600 12px/1 var(--tsans); color: var(--tt1); }

/* ---------- assistant launcher (desktop): a molten orb, with its name from 1700px ---------- */
.tf.cb .cbhud-ai {
  flex: none; display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 4px; border: 1px solid var(--tline2); border-radius: 0;
  background: var(--tpan2); color: var(--tink);
  font: 600 12.5px/1 var(--tsans); white-space: nowrap;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.tf.cb .cbhud-ai:hover { border-color: var(--cb-accent-a50); background: var(--tp4); box-shadow: 0 0 18px -6px var(--cb-accent-a50); }
.tf.cb .cbhud-ai[aria-expanded="true"] { border-color: var(--cb-accent); background: linear-gradient(180deg, var(--cb-accent-a25), var(--cb-accent-a10)); }
.tf.cb .cbhud-orb {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--cb-ink);
  background: radial-gradient(circle at 36% 30%, #FFE6D6 0 7%, var(--cb-accent-hi) 22%, var(--cb-accent) 45%, var(--cb-ember) 76%, var(--cb-ember-deep));
  box-shadow: 0 0 0 1px var(--cb-accent-a25), 0 0 12px var(--cb-accent-a25);
  animation: cbhud-breathe 4.8s ease-in-out infinite;
}
.tf.cb .cbhud-orb .tfi { width: 14px; height: 14px; stroke-width: 2.1; }
@keyframes cbhud-breathe { 50% { box-shadow: 0 0 0 1px var(--cb-accent-a50), 0 0 20px var(--cb-accent-a50); } }
.tf.cb .cbhud-ail { display: none; }
/* from 1700px: below that the name would squeeze the command bar (crypto adds "Miami") */
@media (min-width: 1700px) {
  .tf.cb .cbhud-ai { padding: 0 14px 0 4px; }
  .tf.cb .cbhud-ail { display: block; }
}
/* the HUD launcher replaces the floating button on desktop; phones keep the floating button */
@media (min-width: 861px) {
  .tf.cb .aifab { display: none; }
}

/* the FX pit board (css/fx.css) sits just under the HUD and its sub-nav */
.tf.cb .fx-pit { top: calc(var(--cb-hud-h) + 12px); }

/* ---------- desktop: progressive compaction so the bar never overflows ---------- */
/* each tier keeps the most useful reading and drops the rest (titles keep the full text) */
@media (max-width: 1599px) and (min-width: 861px) {
  .tf.cb .cbhud-bar { gap: 10px; }
  .tf.cb .cbhud-tele { padding-left: 10px; }
  .tf.cb .cbhud-mode { padding: 0 11px; }
  .tf.cb .cbhud-ecg { width: 48px; }
  .tf.cb .cbhud-city { display: none; }
}
@media (max-width: 1439px) and (min-width: 861px) {
  .tf.cb .cbhud-cmd kbd,
  .tf.cb .cbhud-risk .cblbl,
  .tf.cb .cbhud-tilt .cblbl,
  .tf.cb .cbhud-tilt .cbhud-s,
  .tf.cb .cbhud-sess .cblbl,
  .tf.cb .cbhud-sess .cbhud-s,
  .tf.cb .cbhud-city { display: none; }
}
@media (max-width: 1409px) and (min-width: 861px) {
  .tf.cb .cbrk-t { display: none; }
  .tf.cb .cbhud-rank { padding: 0 9px 0 5px; }
  .tf.cb .cbrk-bar { left: 5px; right: 5px; }
  .tf.cb .cbhud-mode { padding: 0 10px; }
}
@media (max-width: 1309px) and (min-width: 861px) {
  .tf.cb .cbhud-risk .cbhud-s,
  .tf.cb .cbhud-tilt .cbhud-txt,
  .tf.cb .cbhud-mkt .cblbl { display: none; }
}
@media (max-width: 1209px) and (min-width: 861px) {
  .tf.cb .cbhud-word { display: none; }
  .tf.cb .cbhud-brand { padding-right: 2px; }
}
@media (max-width: 1110px) and (min-width: 861px) {
  .tf.cb .cbhud-sess .cbhud-txt { display: none; }
  .tf.cb .cbhud-modes { padding-left: 10px; }
  .tf.cb .cbhud-mode { padding: 0 9px; font-size: 12px; }
}
@media (max-width: 1050px) and (min-width: 861px) {
  .tf.cb .cbhud-tilt { display: none; }
  .tf.cb .cbhud-center { min-width: 150px; }
}
@media (max-width: 990px) and (min-width: 861px) {
  .tf.cb .cbhud-risk .cbhud-txt,
  .tf.cb .cbhud-eq .cbhud-s { display: none; }
  .tf.cb .cbhud-center { min-width: 130px; }
}

/* ====================================================================
   Phone HUD (<= 860px)
   ==================================================================== */
@media (max-width: 860px) {
  /* row 1 is one line that never wraps (a wrapped item would land on the modes row);
     row 2 is pinned under it */
  .tf.cb .cbhud-bar {
    flex-wrap: nowrap; align-items: flex-start; gap: 10px;
    height: 88px; padding: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
  }
  .tf.cb .cbhud-menu {
    order: 0; display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
    border: 1px solid var(--tline2); border-radius: 0; background: var(--tpan2); color: var(--tt1);
    transform: skewX(var(--cb-skew));
  }
  .tf.cb .cbhud-menu .tfi { width: 17px; height: 17px; transform: skewX(calc(var(--cb-skew) * -1)); }
  .tf.cb .cbhud-menu:hover { transform: skewX(var(--cb-skew)); border-color: var(--cb-accent-a50); color: var(--tink); }
  .tf.cb .cbhud-menu[aria-expanded="true"] { border-color: var(--cb-accent); color: var(--tink); }
  /* the wordmark is what gives way if row 1 is ever short of room (a very large equity) */
  .tf.cb .cbhud-brand { order: 1; flex: 0 1 auto; min-width: 0; height: 36px; margin-right: auto; gap: 10px; }
  .tf.cb .cbhud-word { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .tf.cb .cbhud-tele { height: 36px; }
  .tf.cb .cbhud-eq { order: 2; flex: none; border: 0; padding: 0; }
  .tf.cb .cbhud-eq .cbhud-txt { align-items: flex-end; gap: 2px; }
  .tf.cb .cbhud-eq .cblbl { display: none; }
  .tf.cb .cbhud-eq .cbhud-val { font-size: 14px; }
  .tf.cb .cbhud-eq .cbhud-s { display: block; font-size: 10.5px; }
  .tf.cb .cbhud-risk { order: 3; }
  .tf.cb .cbhud-tilt { order: 4; }
  .tf.cb .cbhud-sess { order: 5; }
  .tf.cb .cbhud-risk,
  .tf.cb .cbhud-tilt,
  .tf.cb .cbhud-sess { display: none; }
  .tf.cb .cbhud-rank { order: 6; height: 34px; padding: 0 7px 0 5px; margin: 1px 0 0; }
  .tf.cb .cbhud-ai { display: none; }
  .tf.cb .cbrk-t { display: none; }
  .tf.cb .cbrk-bar { left: 5px; right: 5px; }
  .tf.cb .cbrk .tfrb { width: 26px; height: 22px; }

  /* row 2: the four modes fill the row; the command bar is a search button that
     widens over them while you type */
  .tf.cb .cbhud-row2 {
    position: absolute; top: 46px;
    left: calc(max(16px, env(safe-area-inset-left, 0px)) - 3px); right: calc(max(16px, env(safe-area-inset-right, 0px)) - 3px);
    display: flex; align-items: center; gap: 8px; height: 38px; min-width: 0; padding: 0 3px;
  }
  .tf.cb .cbhud-modes {
    flex: 1 1 auto; min-width: 0; height: 32px; padding: 0 0 0 4px; border: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  }
  .tf.cb .cbhud-mode { min-width: 0; height: 32px; padding: 0 6px; font-size: 12.5px; }
  .tf.cb .cbhud-mode > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tf.cb .cbhud-center { position: static; flex: none; min-width: 0; height: 38px; }
  .tf.cb .cbhud-cmd { position: relative; width: 44px; max-width: none; height: 32px; padding: 0; border-radius: 16px; }
  .tf.cb .cbhud-cmd > .tfi { position: absolute; left: 14px; top: 50%; margin-top: -7.5px; pointer-events: none; color: var(--tt2); }
  .tf.cb .cbhud-cmd input { position: absolute; inset: 0; width: 100%; padding: 0 12px 0 36px; border-radius: 16px; color: transparent; font-size: 16px; }
  .tf.cb .cbhud-cmd input::placeholder { color: transparent; }
  .tf.cb .cbhud-cmd:focus-within {
    position: absolute; top: 3px; left: 3px; right: 3px; z-index: 2; width: auto;
    background: var(--tpan2); outline-offset: -2px;
  }
  .tf.cb .cbhud-cmd:focus-within input { color: var(--tink); }
  .tf.cb .cbhud-cmd:focus-within input::placeholder { color: var(--tmut); }
  /* kept separate: a browser without :has() then just ignores this rule */
  .tf.cb .cbhud-cmd:has(input:not(:placeholder-shown)) { position: absolute; top: 3px; left: 3px; right: 3px; z-index: 2; width: auto; background: var(--tpan2); }
  .tf.cb .cbhud-cmd:has(input:not(:placeholder-shown)) input { color: var(--tink); }
  .tf.cb .cbhud-cmd kbd { display: none; }
  .tf.cb .cbhud-cmd .tfsr {
    position: fixed; top: calc(92px + env(safe-area-inset-top, 0px));
    left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
    width: auto; max-width: none; transform: none; max-height: min(440px, 62vh);
  }

  /* row 3: sub-nav */
  .tf.cb .cbhud-sub { height: 34px; padding: 0 max(6px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px)); }
  .tf.cb .cbhud-mkt { display: none; }
  .tf.cb .cbhud-pg { padding: 0 11px; }

  .tf.cb .tfbody:not(.sim) { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 104px max(16px, env(safe-area-inset-left, 0px)); }
}
/* tablets: room for the rev counter and the session dial in row 1 */
@media (min-width: 640px) and (max-width: 860px) {
  .tf.cb .cbhud-risk,
  .tf.cb .cbhud-sess { display: flex; padding-left: 10px; }
  .tf.cb .cbhud-risk .cbhud-txt,
  .tf.cb .cbhud-sess .cbhud-txt { display: none; }
  .tf.cb .cbhud-rev,
  .tf.cb .cbhud-dial { width: 34px; height: 34px; }
}
@media (min-width: 720px) and (max-width: 860px) {
  .tf.cb .cbhud-tilt { display: flex; padding-left: 10px; }
  .tf.cb .cbhud-tilt .cbhud-txt { display: none; }
}
@media (max-width: 380px) {
  .tf.cb .cbhud-word { letter-spacing: .14em; font-size: 11px; }
  .tf.cb .cbhud-mode { padding: 0 4px; font-size: 12px; }
}
/* the smallest phones: the mark alone carries the brand */
@media (max-width: 359px) {
  .tf.cb .cbhud-word { display: none; }
  .tf.cb .cbhud-modes { gap: 3px; }
  .tf.cb .cbhud-mode { padding: 0 2px; font-size: 11.5px; }
}
/* compete arena on phones: it takes the search button's place and may grow, but the
   four modes keep at least 40% of the row */
@media (max-width: 860px) {
  .tf.cb.cbarena-on .cbhud-center { flex: 0 1 auto; min-width: 0; max-width: 60%; }
}
@media (hover: none) {
  .tf.cb .cbhud-cmd kbd { display: none; }
}

/* ====================================================================
   Sidebar: hidden on desktop, a carbon drawer on phones
   ==================================================================== */
@media (min-width: 861px) {
  .tf.cb .tfsd,
  .tf.cb .tfov { display: none; }
}
@media (max-width: 860px) {
  .tf.cb .tfsd {
    top: 0; bottom: 0; z-index: 38; padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, var(--tpan) 0, var(--tp0) 55%, var(--tbg));
    color: var(--tt1); border-right: 1px solid var(--tline2);
  }
  .tf.cb .tfsd.open { box-shadow: 30px 0 70px rgba(0, 0, 0, .75); }
  /* closed, the drawer only slides off-screen: also take it out of the tab order and away
     from screen readers (visibility flips after the slide finishes) */
  .tf.cb .tfsd { visibility: hidden; transition: transform .38s var(--cb-ease), visibility 0s linear .38s; }
  .tf.cb .tfsd.open { visibility: visible; transition: transform .38s var(--cb-ease), visibility 0s; }
  .tf.cb .tfsd::before { display: none; }
  .tf.cb .tfov { z-index: 36; background: rgba(0, 0, 0, .68); }

  /* carbon header with the brand */
  .tf.cb .tfsdb {
    position: relative; flex-direction: row; align-items: center; gap: 12px; text-align: left;
    height: calc(64px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 18px 0;
    margin: 0 0 8px; border-bottom: 1px solid var(--tline2);
  }
  .tf.cb .tfsdb::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, var(--cb-accent-hi), var(--cb-accent) 40%, transparent);
    box-shadow: 0 0 10px var(--cb-accent-a50);
  }
  .tf.cb .tfsdseal { filter: drop-shadow(0 0 8px rgba(255, 90, 31, .4)); }
  .tf.cb .tfsdb:hover .tfsdseal { transform: none; }
  .tf.cb .tfsdseal svg { width: 30px; height: 21px; }
  .tf.cb .tfsdt b { font: 400 13px/1 var(--cb-brand); letter-spacing: .2em; color: var(--tink); }
  .tf.cb .tfsdt small { margin-top: 7px; font: 400 8px/1.2 var(--cb-brand); letter-spacing: .1em; color: var(--tmut); }
  .tf.cb .tfpin { display: none; }

  /* groups and links */
  .tf.cb .tfsdn { padding: 0 12px; }
  .tf.cb .tfsdh { height: auto; padding: 16px 8px 7px; gap: 10px; font: 400 8.5px/1 var(--cb-brand); letter-spacing: .14em; color: var(--tmut); }
  .tf.cb .tfsdh::after { background: var(--tline); }
  .tf.cb .tfsdn button {
    height: 42px; padding: 0 12px; gap: 12px; border-radius: 0;
    color: var(--tt1); font: 500 14px/1 var(--tsans);
  }
  .tf.cb .tfsdn button .ic { width: 22px; color: var(--tmut); }
  .tf.cb .tfsdn button .ic .tfi { width: 18px; height: 18px; stroke-width: 1.7; }
  .tf.cb .tfsdn button:hover { background: rgba(255, 255, 255, .04); color: var(--tink); }
  .tf.cb .tfsdn button:focus-visible { outline-offset: -2px; }
  .tf.cb .tfsdn button.on {
    background: linear-gradient(90deg, var(--cb-accent-a25), var(--cb-accent-a10) 45%, transparent);
    box-shadow: none; color: var(--tink);
  }
  .tf.cb .tfsdn button.on::before {
    left: -12px; top: 0; bottom: 0; width: 3px; border-radius: 0;
    background: var(--cb-accent); box-shadow: 0 0 12px var(--cb-accent);
  }
  .tf.cb .tfsdn button.on .ic { color: var(--cb-accent); }
  .tf.cb .tfsdn .tfdot { left: 30px; top: 9px; width: 6px; height: 6px; background: var(--cb-accent); box-shadow: 0 0 0 2px var(--tpan), 0 0 8px var(--cb-accent); }

  /* account card: graphite, chamfered, mono numbers */
  .tf.cb .tfsdc { margin: 18px 12px 10px; }
  .tf.cb .tfbc {
    padding: 14px 16px 13px; border-radius: 0;
    background: linear-gradient(150deg, var(--tp4), var(--tpan2) 45%, var(--tp0));
    border: 1px solid var(--tline2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 14px 30px rgba(0, 0, 0, .5);
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  }
  .tf.cb .tfbc::before { background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .04) 50%, transparent 65%); }
  .tf.cb .tfbch { font: 400 8.5px/1 var(--cb-brand); letter-spacing: .1em; color: var(--tmut); }
  .tf.cb .tfchip {
    width: 26px; height: 18px; border-radius: 0;
    background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(0, 0, 0, .3) 6px 7px), linear-gradient(135deg, var(--cb-accent-hi), var(--cb-accent) 50%, var(--cb-ember));
    transform: skewX(var(--cb-skew));
  }
  .tf.cb .tfbce { margin: 12px 0 8px; font: 600 21px/1.1 var(--tmono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--tink); }
  .tf.cb .tfbcr { color: var(--tmut); font-size: 12px; }
  .tf.cb .tfbcr em { font: 600 12px var(--tmono); font-variant-numeric: tabular-nums; color: var(--tt1); }
  .tf.cb .tfbc .up { color: var(--tup); }
  .tf.cb .tfbc .dn { color: var(--tdn); }
  .tf.cb .tfxpb.sm { height: 3px; margin-top: 11px; background: var(--tp4); }
  .tf.cb .tfxpb.sm i { border-radius: 0; background: linear-gradient(90deg, var(--cb-ember), var(--cb-accent) 70%, var(--cb-accent-hi)); }
  .tf.cb .tfsdo { margin: 14px 18px 4px; padding-top: 12px; border-top: 1px solid var(--tline); font: 400 11px/1.55 var(--tsans); color: var(--tmut); }
  .tf.cb .tfsdo b { color: var(--tt1); font-weight: 600; }
}
