/* Keep status values and actions readable when space is constrained. */
.top-in { min-width:0; }.top-in .logo { min-width:0; }
.wallet { flex-shrink:0; white-space:nowrap; }.wallet b { white-space:nowrap; font-variant-numeric:tabular-nums; }
@media(max-width:360px) {
  .top-in { gap:8px; }.top-in .logo { font-size:18px; }.logo small { font-size:8px; letter-spacing:.08em; }
  .wallet { gap:6px; padding:6px 8px; font-size:11px; }.wallet b { font-size:20px; }.wallet .ring { width:20px; height:20px; flex-shrink:0; }
}
#incursion-dialog { --inc-padding:18px; scroll-padding-top:72px; scroll-padding-bottom:12px; }
#incursion-dialog .inc-heading { position:sticky; top:calc(-1 * var(--inc-padding)); z-index:2; background:#181510; margin:calc(-1 * var(--inc-padding)) calc(-1 * var(--inc-padding)) 0; padding:8px var(--inc-padding); border-bottom:1px solid #66563b; }
@media(max-height:700px) { #incursion-dialog { --inc-padding:12px; } }
@media(max-height:500px) {
  /* Landscape: keep the document unobscured and retain the normal bottom navigation. */
  .agent-home > .home-tabs { grid-row:1; }
  .agent-home > .home-pane { grid-row:2; }
  .agent-home > .agent-footer { grid-row:3; position:relative; inset:auto; transform:none; width:100%; margin-top:4px; }
  body:has(.agent-home:not([hidden])) main { padding-bottom:calc(84px + env(safe-area-inset-bottom,0px)); }
  body.lite .lite-footer { grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; }
  body.lite .lite-footer.nav-only { grid-template-columns:1fr; }
  body.lite[class] .lite-footer .lite-pull { min-height:58px; padding:10px 12px; font-size:16px; }
  body.lite .lite-footer .lite-tabs button { min-height:54px; font-size:13px; }
  body.lite .lite-footer::before { display:none; }
  body.lite main,body.intro-active main { padding-bottom:calc(100px + env(safe-area-inset-bottom,0px)); }
}
/* Let cost captions wrap inside the paper border even with wider JP font metrics. */
.gacha-scene .pulls button { min-width:0; grid-template-columns:minmax(0,1fr); }
.gacha-scene .pulls button span { min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere; word-break:normal; }
.gacha-scene .pulls .btn-paper { display:flex; flex-direction:column; align-items:stretch; justify-content:center; gap:2px; padding:6px 2px; }
@media(max-width:599px) and (max-height:700px) {
  .gacha-scene .big-env { margin-top:10px; margin-bottom:2px; }
}

/* Phone header: keep the title and balance on separate, non-overlapping tracks. */
@media(max-width:599px){
 .top-in{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding-inline:12px}
 .top-in .logo{min-width:0;max-width:100%;font-size:clamp(15px,4.5vw,20px);line-height:1.18;overflow-wrap:normal;word-break:keep-all}
 .top-in .logo small{font-size:clamp(7px,1.75vw,10px);letter-spacing:.045em;white-space:nowrap}
 .top-in .wallet{max-width:44vw;min-width:0;min-height:46px;padding:7px 9px;gap:6px}
 .top-in .wallet b{font-size:clamp(17px,4.7vw,21px);min-width:0}
 .top-in .wallet span{white-space:nowrap}
 .gacha-scene .cabinet{min-width:0}
 .gacha-scene .cab-desc{width:100%;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere}
}
