/* INJ Node · Official · Desktop portrait/landscape · 2026-11-03
   Geometry-only overrides for wide and tall PC viewports.
   No device zoom, data/chart recalculation, touch/wheel handlers or changes
   to wallet state, saved Workspace cards, native modals or financial logic. */

@media screen and (min-width:900px) {
  html[data-inj-page],html[data-inj-market],
  html[data-inj-page] body,html[data-inj-market] body {
    max-width:100%;
    overflow-x:clip;
  }
  html[data-inj-page] :is(
    .entry-gate-shell,.entry-overview,.entry-insights,.entry-actions,
    .treasury-shell,.treasury-main,.treasury-panel,.treasury-grid,
    .rewards-shell,.rewards-main,.rewards-layout,.reward-row,
    .cc-main,.cc-market-stage,.cc-data-stage,.cc-charts,.cc-chart,
    .live-page,.terminal-shell,.chart-stage,.chart-column,.plot,
    .cap-main,.cap-panel,.wealth-main,.wealth-results,
    .freedom-page,.freedom-overview,.freedom-lower-grid,
    .ladder-main,.ladder-overview,.ws-grid,.ws-card
  ),html[data-inj-market] :is(.shell,.inj-wm-grid,.inj-wm-stock-sector,.inj-wm-tile) {
    min-width:0;
    box-sizing:border-box;
  }
  html[data-inj-page="index"] body :is(#injMarketTabPanel,#injMarketTabPanel iframe,#injMarketPortal iframe){
    min-width:0;
    max-width:100%;
  }
}

/* A rotated desktop screen is a tall workspace, not a wide screen squeezed
   into portrait. Keep the Home in document flow with two readable launcher
   columns and one full-width data/chart column. */
@media screen and (min-width:900px) and (orientation:portrait) {
  :root{
    --inj-screen-gutter:clamp(16px,2.2vw,42px);
    --inj-screen-panel-gap:clamp(12px,1.5vw,24px);
  }
  html[data-inj-page="index"] body #entryGate
  > .entry-gate-shell:not(.first-access){
    width:calc(100% - var(--inj-screen-gutter) * 2)!important;
    max-width:none!important;
    margin-inline:auto!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-areas:"title" "wallet" "overview" "price" "metrics" "actions" "note"!important;
    grid-template-rows:repeat(7,max-content)!important;
    align-content:start!important;
    justify-items:stretch!important;
    gap:clamp(12px,1.5vw,26px)!important;
    min-height:100dvh!important;
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
    padding-bottom:clamp(34px,5vh,90px)!important;
  }
  html[data-inj-page="index"] body #entryGate
  > .entry-gate-shell:not(.first-access) > :is(
    .entry-home-top,.entry-wallet-section,.entry-overview,.entry-insights,
    .entry-desktop-metrics,.entry-actions,.entry-note
  ){
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
  }
  html[data-inj-page="index"] body #entryGate
  .entry-gate-shell:not(.first-access) > .entry-actions.entry-flat-v44{
    display:grid!important;
    grid-area:actions!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-auto-rows:auto!important;
    gap:clamp(10px,1.3vw,18px)!important;
    height:auto!important;
    max-height:none!important;
  }
  html[data-inj-page="index"] body #entryGate
  .entry-gate-shell:not(.first-access) > .entry-actions.entry-flat-v44 > .entry-action{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    grid-row:auto!important;
    align-self:stretch!important;
  }
  html[data-inj-page="index"] body #entryGate .entry-overview-main,
  html[data-inj-page="index"] body #entryGate .entry-spark-stage{
    min-width:0!important;
    max-width:100%!important;
  }

  /* Lite remains the same continuously updating chart; only its usable plot
     area changes with desktop orientation. */
  html[data-inj-page="index"] body #injLightHome .inj-light-screen{
    max-width:min(100%,1080px)!important;
    min-height:100dvh!important;
    justify-content:flex-start!important;
    padding:clamp(28px,4vh,75px) clamp(25px,4vw,60px) clamp(30px,5vh,90px)!important;
  }
  html[data-inj-page="index"] body #injLightHome .inj-light-chart-plot{
    height:clamp(230px,27vh,460px)!important;
  }

  /* Tall screens should use extra vertical space to show the complete
     Treasury/Rewards card history rather than clip a fixed 100dvh wall. */
  html[data-inj-page="live-rewards"],
  html[data-inj-page="live-rewards"] body{
    height:auto!important;
    min-height:100%!important;
    overflow-x:clip!important;
    overflow-y:auto!important;
  }
  html[data-inj-page="live-rewards"] .rewards-shell{
    height:auto!important;
    min-height:100dvh!important;
    max-height:none!important;
    overflow:visible!important;
  }
  html[data-inj-page="live-rewards"] .rewards-main{
    display:block!important;
    height:auto!important;
    min-height:0!important;
    overflow:visible!important;
  }
  html[data-inj-page="live-rewards"] .rewards-layout{
    height:auto!important;
    min-height:0!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:none!important;
    grid-auto-rows:minmax(220px,auto)!important;
    align-items:stretch!important;
    gap:clamp(12px,1.2vw,24px)!important;
    overflow:visible!important;
  }
  html[data-inj-page="live-rewards"] :is(.rewards-list-panel,.rewards-list){display:contents!important}
  html[data-inj-page="live-rewards"] .rewards-list-head{display:none!important}
  html[data-inj-page="live-rewards"] :is(.reward-row,.rewards-total-panel){
    height:auto!important;
    min-height:220px!important;
    overflow:visible!important;
  }
  html[data-inj-page="treasury"] :is(.treasury-shell,.treasury-main,.treasury-grid){
    min-width:0!important;
    max-height:none!important;
  }
  html[data-inj-page="treasury"] :is(.treasury-spark-stage,.treasury-chart-summary){
    width:100%;
    max-width:100%;
    min-width:0;
  }

  /* Tall Global Market: preserve ticker legibility, rather than forcing
     desktop-wide mosaics into undersized cells. */
  html[data-inj-market] :is(.inj-wm-grid,.inj-wm-grid.indices,.inj-wm-grid.sectors){
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  html[data-inj-market] .inj-wm-stocks{
    grid-template-columns:minmax(0,1fr)!important;
  }
  html[data-inj-market] .inj-mi-snapshot{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  html[data-inj-market] .inj-mi-tabs,
  html[data-inj-market] #injIntelRoot{
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
  }

  html[data-inj-page="comparison"] :is(.cap-picker-grid,.cap-results-grid,.cap-wallet-cards),
  html[data-inj-page="visualize-wealth"] :is(.wealth-all-grid,.wealth-income-grid){
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html[data-inj-page="financial-freedom"] :is(.freedom-overview,.freedom-lower-grid){
    grid-template-columns:minmax(0,1fr)!important;
    height:auto!important;
  }
  html[data-inj-page="reward-ladder"] .ladder-steps{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html[data-inj-page="workspace"] :is(main,.ws-grid,.ws-card,.ws-card-body){
    max-width:100%;
    min-width:0;
  }

  /* Command Center was completely display:none below 1100px, excluding
     ordinary 1080px portrait PC monitors. Restore it as a vertical dashboard
     and provide normal document scrolling for charts and operating cards. */
  html[data-inj-page="command-center"],
  html[data-inj-page="command-center"] body{
    display:block!important;
    width:100%!important;
    height:auto!important;
    min-height:100%!important;
    overflow-x:clip!important;
    overflow-y:auto!important;
  }
  html[data-inj-page="command-center"] .cc-shell{
    display:grid!important;
    position:relative!important;
    inset:auto!important;
    width:100%!important;
    height:auto!important;
    min-height:100dvh!important;
    max-height:none!important;
    overflow:visible!important;
    grid-template-rows:auto auto auto!important;
  }
  html[data-inj-page="command-center"] .cc-topbar{
    position:relative!important;
    height:auto!important;
    min-height:64px!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:10px!important;
    padding:12px var(--inj-screen-gutter)!important;
  }
  html[data-inj-page="command-center"] .cc-main{
    display:grid!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto auto auto!important;
    gap:14px!important;
    padding:16px var(--inj-screen-gutter) 24px!important;
    overflow:visible!important;
  }
  html[data-inj-page="command-center"] .cc-market-stage{
    grid-column:1!important;
    grid-row:1!important;
    width:100%!important;
    height:clamp(470px,48vh,850px)!important;
    min-height:470px!important;
    grid-template-rows:54px minmax(0,1fr)!important;
  }
  html[data-inj-page="command-center"] .cc-charts{
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    grid-template-columns:minmax(0,2.8fr) minmax(175px,.8fr)!important;
  }
  html[data-inj-page="command-center"] .cc-now{
    grid-column:1!important;
    grid-row:2!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-rows:minmax(98px,auto)!important;
  }
  html[data-inj-page="command-center"] .cc-now-heading{
    display:flex!important;
    grid-column:1/-1!important;
    grid-row:auto!important;
  }
  html[data-inj-page="command-center"] .cc-data-stage{
    grid-column:1!important;
    grid-row:3!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    grid-template-rows:38px auto!important;
  }
  html[data-inj-page="command-center"] .cc-data-deck{
    height:auto!important;
    min-height:0!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:auto!important;
    grid-auto-rows:minmax(180px,auto)!important;
    overflow:visible!important;
  }
  html[data-inj-page="command-center"] .cc-panel{
    height:auto!important;
    min-height:180px!important;
    overflow:visible!important;
  }
  html[data-inj-page="command-center"] .cc-statusbar{
    height:auto!important;
    min-height:28px!important;
  }
}

/* A 900–1499px portrait monitor has enough room for two useful values per
   row, not four shrinking mini-labels. Large 4K portrait panels keep four. */
@media screen and (min-width:900px) and (max-width:1499px) and (orientation:portrait) {
  html[data-inj-page="treasury"] :is(
    .treasury-metrics,.treasury-allocation-metrics,.treasury-velocity-grid
  ){
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html[data-inj-page="index"] body.dashboard-scroll-ready > .app-shell main#top > .analytics-grid{
    grid-template-columns:minmax(0,1fr)!important;
  }
}

/* Landscape: make good use of PC width without global scale/zoom transforms.
   Wide Lite has its own readable plotting width; Pro keeps its own tiles. */
@media screen and (min-width:1200px) and (orientation:landscape) {
  html[data-inj-page="index"] body #injLightHome .inj-light-screen{
    max-width:min(1180px,90vw)!important;
  }
  html[data-inj-page="index"] body #injLightHome .inj-light-chart-plot{
    height:clamp(190px,30vh,410px)!important;
  }
  html[data-inj-page="treasury"] .treasury-velocity-grid{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
  }
  html[data-inj-market] .inj-mi-snapshot{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
  }
  html[data-inj-page="live-charts"] :is(.chart-stage,.chart-column,.plot){
    min-width:0!important;
    max-width:100%!important;
  }
}

/* Shallow horizontal desktop windows need vertical access to the last row,
   instead of squeezing cards to unreadable heights. No wheel interception. */
@media screen and (min-width:1024px) and (orientation:landscape) and (max-height:780px) {
  html[data-inj-page="live-rewards"],
  html[data-inj-page="live-rewards"] body{
    height:auto!important;
    min-height:100%!important;
    overflow-y:auto!important;
  }
  html[data-inj-page="live-rewards"] .rewards-shell{
    height:auto!important;
    min-height:100dvh!important;
    overflow:visible!important;
  }
  html[data-inj-page="live-rewards"] .rewards-main{display:block!important;overflow:visible!important}
  html[data-inj-page="live-rewards"] .rewards-layout{
    height:auto!important;
    grid-template-rows:repeat(2,minmax(230px,auto))!important;
  }
  html[data-inj-page="command-center"],
  html[data-inj-page="command-center"] body{
    height:auto!important;
    min-height:100%!important;
    overflow-y:auto!important;
  }
  html[data-inj-page="command-center"] .cc-shell{
    position:relative!important;
    height:auto!important;
    min-height:100dvh!important;
    overflow:visible!important;
    grid-template-rows:auto auto auto!important;
  }
  html[data-inj-page="command-center"] .cc-main{
    height:auto!important;
    min-height:0!important;
    grid-template-rows:minmax(360px,auto) minmax(88px,auto) minmax(250px,auto)!important;
    overflow:visible!important;
  }
  html[data-inj-page="command-center"] :is(.cc-market-stage,.cc-data-stage){
    height:auto!important;
    min-height:0!important;
  }
  html[data-inj-page="live-charts"] .terminal-header{
    min-height:48px!important;
  }
  html[data-inj-page="live-charts"] .market-strip{min-height:40px!important}
  html[data-inj-page="live-charts"] .terminal-shell{min-height:0!important}
}
