/* Fit on short panels and with larger text: the browser's text-size setting can make labels much bigger
   than the chart panel was sized for. Views grow downward (never clip upward), rows keep a usable height,
   and secondary text drops out when the panel itself is short. */
.stage-body{container:stagebody / size}
@media (max-width:899px){
  .stage{height:min(66vh,max(56vh,440px));height:min(66svh,max(56svh,440px))}
  .step,.step:not(.on){padding-top:calc(min(66svh,max(56svh,440px)) + 6px)}
  .v{justify-content:safe center}
  .rows{min-height:calc(var(--n) * 21px)}
  .readout{-webkit-line-clamp:1;margin:3px 0 6px}
  #feelFacts,#gainFacts,.feel-sub{display:none}
  .row .you{display:none}
  .stage[data-view="vTopC"] .legend{display:none}
}
@container stagebody (max-height:420px){
  .v-bars .lab small,.v-scale .lab small,.v-layers .lab small,.v-feel .lab small,.v-topr .lab small,.v-gain .lab small,.v-wealth .lab small{display:none}
  .lab b{font-size:.8rem}
  .bar .val,.end{font-size:.74rem}
  .v-feel .rows.few{grid-template-rows:repeat(var(--n),34px)}
  .pay-sub{display:none}
  .brk-eq{display:none}
  .v-def .mult,.v-nw .mult{font-size:2.6rem}
  .mult-sub{font-size:.74rem}
  .topr-stat .mult{font-size:2rem}
  .topr-stat .mult-sub{display:none}
  .v-st .mult{font-size:1.9rem}
  .v-st .mult-sub{font-size:.72rem}
  .cols{min-height:90px;padding-top:26px}
  .tc-400{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;padding-bottom:0;border-bottom:8px solid transparent}
  .tcr{grid-template-columns:84px 1fr 46px}
  .tcr-l{line-height:1.1}
  .card .big{font-size:1.1rem}
  .chips button{padding:4px 9px;font-size:.76rem}
  .feel-head .big,.feel-pair .big{font-size:2rem}
}

/* narrow screens (small phones, or Android's page zoom for larger text) */
.stage-title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
@media (max-width:899px){
  #feelCtl{display:flex;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;max-width:100%;align-self:stretch}
  #feelCtl::-webkit-scrollbar{display:none}
  #feelCtl button{flex:none;padding-left:8px;padding-right:8px}
}
@container stagebody (max-height:420px){
  #youOut{gap:8px}
  #youOut .fine{display:none}
  #youOut .card{padding:9px 12px}
  #youOut .card p:not(.big){font-size:.8rem;line-height:1.35}
  #youOut[data-card="bill"] .card p:not(.big){display:none}
  .split{height:22px;margin:6px 0 8px}
  .split-key{gap:4px}
}

/* phones: charts sit at the top of the panel (no floating gap above short charts),
   and story cards slide under the chart panel instead of over it */
@media (max-width:899px){
  .v{justify-content:flex-start}
  .story .stage-wrap{z-index:20}
  .story .steps{z-index:4}
  .stage{background:color-mix(in srgb,var(--surface) 96%,transparent)}
}

/* whitespace: views built around one big number sit centered; short tax-tab charts stretch on phones */
.v-def,.v-nw,.v-topc,.v-you,.v-dots{justify-content:safe center}
@media (max-width:899px){
  .v-feel .rows.few{flex:1;max-height:260px;grid-template-rows:repeat(var(--n),1fr)}
  .v-feel .rows.few .seg.fb{height:24px;top:calc(50% - 12px)}
}

/* net worth and "three ways": spread the pieces over the panel and grow the bars, instead of one small block in the middle */
.v-nw,.v-def{justify-content:space-evenly}
.v-nw .mult,.v-def .mult{font-size:clamp(3rem,9vh,5.4rem)}
.nw-bars{gap:clamp(10px,3vh,26px)}
.nw-bars .track,.v-def .defrow .track{height:clamp(30px,9vh,80px)}
.nw-bars .bar,.v-def .defrow .bar{height:100%;top:0}
.nw-bars .lab b{font-size:1rem}
@container stagebody (max-height:420px){.v-nw .mult,.v-def .mult{font-size:2.6rem}.nw-bars .track,.v-def .defrow .track{height:24px}}
