/* TP Context HOME02 — responsive-only polish; desktop (>= 961px) unchanged.
   1) Retire duplicate bottom navigation.
   2) Three-line hamburger left, brand centered, language right.
   3) Reveal the existing illustrative chart in the mobile home hero.
   No mock quotes are represented as real-time data. */
@media (max-width: 960px) {
  /* HOME02B: Never display the legacy bottom navigation on mobile.
     Avoid depending on the JavaScript-generated body ready class. */
  html body nav.mobile-nav.mobile-nav {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Keep the bottom bar if the shared top nav failed to initialize. */
  body.tp-v6-nav-ready .mobile-nav {
    display: none !important;
  }
  body.tp-v6-nav-ready .app-main,
  body.tp-v6-nav-ready .app-content,
  body.tp-v6-nav-ready .tpx-home-shell {
    padding-bottom: 0 !important;
  }

  /* Shared header: reuse its real controls rather than duplicating routing. */
  body.tp-v6-nav-ready #tpGlobalNavV6 {
    position: sticky !important;
    top: 0 !important;
    min-height: 70px !important;
    height: 70px !important;
    padding: 10px 13px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    isolation: isolate;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-menu-toggle {
    order: 1 !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: grid !important;
    place-items: center !important;
    font-size: 0 !important; /* Text remains accessible to screen readers. */
    border: 1px solid rgba(95, 162, 205, .30) !important;
    border-radius: 12px !important;
    background: #11283d !important;
    color: #e7f6ff !important;
    cursor: pointer;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-menu-toggle::before {
    content: "";
    width: 20px;
    height: 16px;
    display: block;
    background: linear-gradient(currentColor,currentColor) 0 0 / 20px 2px no-repeat,
      linear-gradient(currentColor,currentColor) 0 7px / 20px 2px no-repeat,
      linear-gradient(currentColor,currentColor) 0 14px / 20px 2px no-repeat;
    transition: transform .18s ease;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6.is-open .tp-v6-menu-toggle::before {
    transform: scaleX(.78);
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand {
    order: 2 !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 7px !important;
    max-width: calc(100% - 175px) !important;
    white-space: nowrap !important;
    z-index: 2;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand-symbol {
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand-name strong {
    font-size: clamp(12px, 3.45vw, 15px) !important;
    letter-spacing: -.025em !important;
    white-space: nowrap;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand-name small {
    display: none !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v7-nav-language {
    order: 3 !important;
    margin-left: auto !important;
    z-index: 3;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-primary-navigation {
    order: 4 !important;
    position: absolute !important;
    top: calc(100% - 1px) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: min(72vh, 580px) !important;
    overflow-y: auto !important;
    grid-column: auto !important;
    gap: 7px !important;
    padding: 12px 14px 17px !important;
    margin: 0 !important;
    background: rgba(6, 19, 32, .985) !important;
    border: 1px solid rgba(81, 155, 201, .30) !important;
    border-radius: 0 0 18px 18px !important;
    box-shadow: 0 20px 34px rgba(0, 0, 0, .45) !important;
    z-index: 30 !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6:not(.is-open) .tp-v6-primary-navigation {
    display: none !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6.is-open .tp-v6-primary-navigation {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-primary-navigation a {
    min-height: 47px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 11px 12px !important;
    border-radius: 10px;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-menu-toggle:focus-visible,
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-primary-navigation a:focus-visible {
    outline: 2px solid #6bd3ff !important;
    outline-offset: 2px !important;
  }
}

/* HOME ONLY: show the ORIGINAL chart component at mobile scale. */
@media (max-width: 720px) {
  body.tpx-home-active .tpx-hero {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 18px !important;
    width: calc(100% - 24px) !important;
    overflow: visible !important;
  }
  body.tpx-home-active .tpx-hero-visual {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    transform: none !important;
  }
  /* The large desktop image is intentionally desktop-only: use its real
     underlying animated demo chart on mobile, not a downscaled 1355px image. */
  body.tpx-home-active .tpx-hero-visual::before,
  body.tpx-home-active .tpx-hero-visual::after,
  body.tpx-home-active .tpx-phone,
  body.tpx-home-active .tpx-hand-note {
    display: none !important;
    content: none !important;
  }
  body.tpx-home-active .tpx-terminal {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    border: 1px solid rgba(91, 174, 223, .32) !important;
    border-radius: 15px !important;
    box-shadow: 0 15px 35px rgba(0,0,0,.3) !important;
  }
  body.tpx-home-active .tpx-terminal-top {
    display: flex !important;
    gap: 5px !important;
    padding: 0 9px !important;
    height: 38px !important;
    overflow: hidden !important;
  }
  body.tpx-home-active .tpx-terminal-logo {
    font-size: 10px !important;
    margin-right: auto !important;
  }
  body.tpx-home-active .tpx-terminal-tab,
  body.tpx-home-active .tpx-terminal-gear,
  body.tpx-home-active .tpx-terminal-select {
    display: none !important;
  }
  body.tpx-home-active .tpx-terminal-tab.is-active {
    display: inline-flex !important;
    padding: 0 9px !important;
    font-size: 10px !important;
  }
  body.tpx-home-active .tpx-terminal-marketbar {
    display: flex !important;
    height: 32px !important;
    padding: 0 10px !important;
    overflow: hidden !important;
  }
  body.tpx-home-active .tpx-terminal-marketbar strong { font-size: 10px !important; white-space: nowrap; }
  body.tpx-home-active .tpx-terminal-marketbar > span { display: none !important; }
  body.tpx-home-active .tpx-chart-slot,
  body.tpx-home-active .tpx-chart-slot .tp-hero-demo,
  body.tpx-home-active .tpx-chart-slot .tp-demo-chart-shell,
  body.tpx-home-active .tpx-chart-slot .tp-demo-chart-wrap,
  body.tpx-home-active .tpx-chart-slot .tp-hero-chart-root,
  body.tpx-home-active .tpx-chart-slot .tpx-r31-market-chart {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 232px !important;
    min-height: 232px !important;
    max-height: 232px !important;
    overflow: hidden !important;
  }
  body.tpx-home-active .tpx-chart-overlays {
    display: grid !important;
    top: 87px !important;
    left: 12px !important;
    font-size: 9px !important;
  }
  body.tpx-home-active .tpx-setup-detected {
    top: 98px !important;
    right: 9px !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: 145px !important;
    min-height: 0 !important;
    padding: 6px 8px !important;
    font-size: 9px !important;
    transform: none !important;
  }
  body.tpx-home-active .tpx-setup-detected small { font-size: 8px !important; }
}
@media (max-width: 360px) {
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand { max-width: calc(100% - 161px) !important; }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand-symbol { width: 29px !important; height: 29px !important; flex-basis: 29px !important; }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand-name strong { font-size: 12px !important; }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v7-nav-language button { width: 29px !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.tpx-home-active .tpx-chart-slot * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* HOME02C — Correct two regressions discovered on real 342px mobile.
   Keep all changes mobile-only and leave the desktop hero untouched. */
@media (max-width: 960px) {
  /* Three stable header columns, no absolute positioning of the centered brand. */
  body.tp-v6-nav-ready #tpGlobalNavV6 {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr) !important;
    grid-template-rows: 44px !important;
    align-items: center !important;
    justify-items: stretch !important;
    column-gap: 7px !important;
    padding: 10px 12px !important;
    height: 70px !important;
    min-height: 70px !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-menu-toggle {
    position: relative !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: center !important;
    order: initial !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    border-radius: 11px !important;
    box-shadow: none !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-menu-toggle::before {
    margin: 0 !important;
    flex: 0 0 20px !important;
    width: 20px !important;
    height: 16px !important;
    background-position: 0 0, 0 7px, 0 14px !important;
    transform: none !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-menu-toggle:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v6-brand {
    position: static !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    align-self: center !important;
    order: initial !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    width: max-content !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 6px !important;
    margin: 0 !important;
    z-index: 2 !important;
  }
  body.tp-v6-nav-ready #tpGlobalNavV6 .tp-v7-nav-language {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
    order: initial !important;
    margin: 0 !important;
    z-index: 3 !important;
  }
}

@media (max-width: 720px) {
  /* The reference PC graphic is an ARTWORK layer, not the DOM chart beneath it.
     Show the original whole composition, including the mobile notification. */
  body.tpx-home-active .tpx-hero-visual {
    display: block !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1139 / 463 !important;
    margin: 8px auto 18px !important;
    padding: 0 !important;
    overflow: hidden !important;
    background-color: rgba(5,18,31,.60) !important;
    border-radius: 10px !important;
  }
  body.tpx-home-active .tpx-hero-visual::before { display: none !important; content: none !important; }
  body.tpx-home-active .tpx-hero-visual::after {
    content: '' !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-image: url('/home-reference/hero-right-reference.png') !important;
    background-position: center !important;
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    transform: none !important;
    pointer-events: none !important;
    z-index: 5 !important;
  }
  body.tpx-home-active .tpx-hero-visual .tpx-terminal,
  body.tpx-home-active .tpx-hero-visual .tpx-phone,
  body.tpx-home-active .tpx-hero-visual .tpx-hand-note {
    display: none !important;
    visibility: hidden !important;
  }
}
