/* INJ VERSIONE UFFICIALE · Native iOS 27 top-area compatibility.
   Do not force a separately colored status region. WebKit renders native
   status chrome automatically in newly installed standalone PWAs. */
/* INJ VERSIONE UFFICIALE · Seamless top canvas v1 (2026-10-28)
   Fix only the visual seam between iOS native chrome and app backgrounds.
   NO scroll, positioning, chart, input, touch or safe-area dimension changes. */
@media (max-width:900px), (hover:none) and (pointer:coarse) {
  /* Shared theme pages: paint the real palette from the first pixel,
     instead of a separate dark/opaque header slab. */
  html[data-theme]:is(
    [data-inj-page="index"],[data-inj-page="treasury"],[data-inj-page="live-rewards"],
    [data-inj-page="live-charts"],[data-inj-page="order-book"],
    [data-inj-page="command-center"],[data-inj-page="comparison"],
    [data-inj-page="visualize-wealth"]), 
  html[data-inj-market][data-theme] {
    background-color:var(--theme-canvas,var(--bg,#07121b))!important;
    background-image:var(--page-gradient,none)!important;
    background-position:center top!important;
    background-repeat:no-repeat!important;
    background-attachment:scroll!important;
  }
  html[data-theme]:is(
    [data-inj-page="index"],[data-inj-page="treasury"],[data-inj-page="live-rewards"],
    [data-inj-page="live-charts"],[data-inj-page="order-book"],
    [data-inj-page="command-center"],[data-inj-page="comparison"],
    [data-inj-page="visualize-wealth"]) body,
  html[data-inj-market][data-theme] body {
    background-color:var(--theme-canvas,var(--bg,#07121b))!important;
    background-image:var(--page-gradient,none)!important;
    background-position:center top!important;
    background-repeat:no-repeat!important;
    background-attachment:scroll!important;
  }
  /* The outer app shells sometimes start at the viewport edge with an
     older opaque background. Let the single themed body canvas show through.
     Real data cards, chart grids and overlays keep their own surfaces. */
  html[data-theme][data-inj-page="index"] body > .app-shell,
  html[data-theme]:is([data-inj-page="treasury"],[data-inj-page="live-rewards"],
    [data-inj-page="live-charts"],[data-inj-page="order-book"],
    [data-inj-page="command-center"],[data-inj-page="comparison"],
    [data-inj-page="visualize-wealth"]) body :is(
      .treasury-shell,.rewards-shell,.live-page,.book-page,
      .cc-shell,.cap-shell,.wealth-shell),
  html[data-inj-market][data-theme] body > .shell {
    background-color:transparent!important;
    background-image:none!important;
  }
  /* Navigation chrome is transparent, not a second painted layer.
     Do not modify headers' padding, min-height, alignment or sticky rules. */
  html[data-theme] body :is(
    .app-shell > .topbar,.treasury-header,.rewards-header,
    .terminal-header,.book-topbar,.cc-topbar,
    .cap-header,.wealth-header,.shell > .header,
    .performance-timeline-header,.converter-view-header,
    .workspace-topbar,.ws-topbar,.ws-header,.rl-topbar,.ladder-header,.cs-header,.etf-top
  ) {
    background-color:transparent!important;
    background-image:none!important;
    box-shadow:none!important;
    -webkit-backdrop-filter:none!important;
    backdrop-filter:none!important;
  }
  /* Old pseudo overlays were painting a darker 50-120 px band on some
     independently navigable screens. Keep real header children intact. */
  html[data-theme] body :is(
    .app-shell > .topbar,.treasury-header,.rewards-header,
    .terminal-header,.book-topbar,.cc-topbar,
    .cap-header,.wealth-header,.shell > .header,
    .performance-timeline-header,.converter-view-header
  )::before,
  html[data-theme] body :is(
    .app-shell > .topbar,.treasury-header,.rewards-header,
    .terminal-header,.book-topbar,.cc-topbar,
    .cap-header,.wealth-header,.shell > .header,
    .performance-timeline-header,.converter-view-header
  )::after {
    content:none!important;
    display:none!important;
  }
  /* Home overlays and embedded market view share the same canvas;
     no extra gradient stopping at the status bar / header boundary. */
  html[data-inj-page="index"] body #entryGate.entry-gate {
    background-color:var(--theme-canvas,var(--bg,#07121b))!important;
    background-image:var(--page-gradient,none)!important;
    background-position:center top!important;
    background-repeat:no-repeat!important;
    background-attachment:scroll!important;
  }
  html[data-inj-page="index"] body #injMarketPortal {
    background-color:var(--theme-canvas,var(--bg,#07121b))!important;
  }
  /* Standalone pages with their own bespoke themes should not acquire
     a generic navy gradient or an opaque safe-area overlay. */
  html[data-inj-page="workspace"],
  html[data-inj-page="reward-ladder"],
  html[data-inj-page="injc-etf"] {
    background-color:var(--theme-canvas,var(--bg,var(--ws-bg,var(--rl-bg,var(--etf-bg,#07121b)))))!important;
  }
  html[data-inj-page="workspace"] body,
  html[data-inj-page="reward-ladder"] body,
  html[data-inj-page="injc-etf"] body {
    background-attachment:scroll!important;
  }
  html[data-inj-page="admin-insights"] .admin-topnav {
    background:transparent!important;
    -webkit-backdrop-filter:none!important;backdrop-filter:none!important;
  }
}

/* INJ Node · Seamless top canvas v2 · 2026-10-28
   Avoid three independent gradient layers with different paint heights.
   Keep one root theme gradient and transparent page shells. Native status
   chrome, safe-area geometry, scrolling and content layout stay untouched. */
@media (max-width:900px), (hover:none) and (pointer:coarse) {
  html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]),
  html[data-inj-market][data-theme] {
    background-color:var(--theme-canvas,var(--bg,var(--canvas,#07121b)))!important;
    background-image:var(--page-gradient,none)!important;
    background-repeat:no-repeat!important;
    background-position:center top!important;
    background-attachment:scroll!important;
  }
  html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]) body,
  html[data-inj-market][data-theme] body {
    background-color:transparent!important;
    background-image:none!important;
  }
  html[data-theme][data-inj-page="index"] body #entryGate.entry-gate,
  html[data-theme][data-inj-page="index"] body #entryGate.entry-gate > .entry-gate-shell:not(.first-access) {
    background-color:transparent!important;
    background-image:none!important;
  }
}

/* INJ NODE · Full-bleed native-theme canvas v4 · 2026-10-28
   Replaces the former 152px dark mask. The theme's OWN gradient paints the
   page from its first web pixel; never dim it with a synthetic status fade.
   WebKit controls native PWA status chrome: CSS cannot paint that OS region.
   Keep safe-area paddings, scrolling, themes and animation unchanged. */
@media (max-width:900px), (hover:none) and (pointer:coarse) {
  /* One gradient surface at document root, full width and full height. */
  html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]),
  html[data-inj-market][data-theme] {
    background-color:var(--theme-canvas,var(--bg,var(--canvas,#07121b)))!important;
    background-image:var(--page-gradient,none)!important;
    background-repeat:no-repeat!important;
    background-position:center top!important;
    background-attachment:scroll!important;
  }
  html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]) body,
  html[data-inj-market][data-theme] body {
    background-color:transparent!important;
    background-image:none!important;
  }
  /* Home and its shell share the exact root canvas. This eliminates
     the horizontal edge caused by independently scaled page gradients. */
  html[data-theme][data-inj-page="index"] body #entryGate.entry-gate,
  html[data-theme][data-inj-page="index"] body #entryGate.entry-gate > .entry-gate-shell:not(.first-access) {
    background-color:transparent!important;
    background-image:none!important;
  }
  /* A screen-sized overlay cannot see the root paint beneath itself.
     Render the unmasked theme gradient within these genuine full screens. */
  html[data-theme][data-inj-page="index"] body #injMarketEventsOverlay.inj-events-overlay,
  html[data-theme][data-inj-page="index"] body :is(#performanceTimelineView.open,#converterView.open) {
    background-color:var(--theme-canvas,var(--bg,#07121b))!important;
    background-image:var(--page-gradient,none)!important;
    background-repeat:no-repeat!important;
    background-position:center top!important;
    background-attachment:scroll!important;
  }
}

/* v5 · Never restart the selected theme underneath scrolled content.
   One viewport-locked gradient is painted on the document root. Other
   page/shell backgrounds stay transparent; fixed ambient animations remain.
   Bespoke Workspace, Reward Ladder and ETF canvases are intentionally
   excluded and retain their own designs. */
html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]),
html[data-inj-market][data-theme]{
 background-color:var(--theme-canvas,var(--bg,#07121b))!important;
 background-image:var(--page-gradient,none)!important;
 background-position:center center!important;
 background-size:100% 100%!important;
 background-repeat:no-repeat!important;
 background-attachment:fixed!important;
}
html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]) body,
html[data-inj-market][data-theme] body{
 background:transparent!important;
 background-color:transparent!important;
 background-image:none!important;
}
html[data-theme][data-inj-page]:not([data-inj-page="workspace"]):not([data-inj-page="reward-ladder"]):not([data-inj-page="injc-etf"]) body
:is(.app-shell,.treasury-shell,.rewards-shell,.live-page,.book-page,.cc-shell,.cap-shell,.wealth-shell),
html[data-inj-market][data-theme] body > .shell{
 background:transparent!important;
 background-color:transparent!important;
 background-image:none!important;
}
/* Header chrome is not a second, darker mask. Actual market cards retain
   their surfaces, shadows, labels, data and click regions. */
html[data-theme] body :is(
 .app-shell > .topbar,.treasury-header,.rewards-header,
 .terminal-header,.book-topbar,.cc-topbar,.cap-header,
 .wealth-header,.shell > .header
){
 background-color:transparent!important;
 background-image:none!important;
}
