/* ============================================================
   AXIONOVA mobile enhancement layer
   Pure override layer — the app bundle (assets/index-*.js) is
   untouched. Works together with mobile.js.
   ============================================================ */

/* Elements injected by mobile.js are mobile-only */
@media (min-width: 768px) {
  .axn-mobile-only {
    display: none !important;
  }
}

@media (max-width: 767px) {

  /* ----------------------------------------------------------
     0. Fit the whole chart card in the phone viewport so the
        chip strip and zoom controls are visible together with
        the chart (the app forces a 720px minimum card height).
     ---------------------------------------------------------- */
  section[class*="100svh-1rem"] {
    height: calc(100vh - 16px) !important;
    height: calc(100svh - 16px) !important;
    min-height: 540px;
  }

  /* ----------------------------------------------------------
     1. Give the chart the reserved-but-empty bottom zone back.
        The app reserves 156px under the chart on phones but
        renders nothing there; keep just enough for the block
        chip strip injected by mobile.js.
     ---------------------------------------------------------- */
  section div[class*="bottom-[156px]"] {
    bottom: 58px !important;
  }

  /* ----------------------------------------------------------
     2. Node/block details: the app ships its own mobile bottom
        card (h-[62vh] md:hidden), so the desktop side panel
        stays hidden below md — no override needed here.
     ---------------------------------------------------------- */

  /* ----------------------------------------------------------
     3. Block navigation chip strip (injected by mobile.js)
     ---------------------------------------------------------- */
  .axn-chipbar {
    position: absolute;
    left: 8px;
    right: 60px;
    bottom: 8px;
    z-index: 25;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px;
    pointer-events: auto;
  }
  .axn-chipbar::-webkit-scrollbar {
    display: none;
  }
  .axn-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 200px;
    padding: 7px 12px;
    border: 1px solid #dce9ed;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(14, 42, 51, 0.08);
    color: #14383f;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
  }
  .axn-chip .axn-chip-num {
    color: #0090a3;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
  }
  .axn-chip.axn-active {
    background: #00c8e0;
    border-color: #00c8e0;
    color: #ffffff;
  }
  .axn-chip.axn-active .axn-chip-num {
    color: #eafcff;
  }

  /* ----------------------------------------------------------
     4. Fullscreen chart mode (toggled by mobile.js)
     ---------------------------------------------------------- */
  html.axn-noscroll,
  html.axn-noscroll body {
    overflow: hidden !important;
    height: 100%;
  }
  section.axn-fs {
    position: fixed !important;
    inset: 0 !important;
    z-index: 60;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
  }
  /* In fullscreen keep only the chart region (marked by mobile.js) */
  section.axn-fs > *:not(.axn-fs-keep) {
    display: none !important;
  }
  section.axn-fs > .axn-fs-keep {
    top: 0 !important;
  }

  /* The app's "Blocks" pill is replaced by the chip strip on phones */
  .axn-hide-mobile {
    display: none !important;
  }

  /* Fullscreen toggle button injected into the zoom control stack */
  .axn-fs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #14383f;
    cursor: pointer;
  }
  .axn-fs-btn:active {
    background: #eef6f8;
  }
}
