/* Between Jobs adaptive mobile panels
   25 Nov: the camera bar's bottom offset was raised (180->244px, 168->232px on narrow
   phones) because at the original height it sat on top of the Enter/Talk action button in
   portrait. Everything else in this file is unchanged. — usable gameplay, compact notifications.
   The 30% cap is applied to passive banners, NOT maps, chat or action panels. */
#modal .card{min-height:0;min-width:0;overflow:hidden}
#modal .card .card-h{flex:0 0 auto;min-width:0}
#modal .card .card-h h2{min-width:0;white-space:normal;overflow-wrap:anywhere}
#modal .card .card-b{min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#modal .card .card-f{min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
#modal .card .btn{min-width:0;max-width:100%;white-space:normal!important;overflow-wrap:anywhere;word-break:normal;line-height:1.2}
#modal .card .btn small{min-width:0;max-width:100%;white-space:normal!important;overflow-wrap:anywhere;line-height:1.23}
#modal .card .meta,#modal .card p,#modal .card .small,#modal .card .item{overflow-wrap:anywhere}
#modal .card .item{min-width:0}
#modal .card .item h3{min-width:0;overflow-wrap:anywhere}
#dialog{overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
#dialog .say{white-space:normal;overflow-wrap:anywhere}
@media (max-width:600px){
  /* HUD and camera occupy separate, non-overlapping areas. */
  #v3bar{top:auto!important;bottom:calc(env(safe-area-inset-bottom,0px) + 244px)!important;right:max(10px,env(safe-area-inset-right,0px))!important;left:auto!important;transform:none!important;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:min(240px,70vw);padding:4px;border-radius:12px;gap:3px}
  #v3bar button{white-space:normal!important;padding:5px 4px;font-size:12px;line-height:1.12;min-height:36px}
  /* Visual size limits apply to passive notifications and game prompts. */
  #tut{left:auto;right:8px;transform:none;top:calc(env(safe-area-inset-top,0px) + 106px);width:min(30vw,130px);max-height:30dvh;overflow-y:auto;display:block;flex-wrap:wrap;padding:7px;font-size:11px;gap:5px;line-height:1.25}
  #tut b,#tut span{white-space:normal;min-width:0;overflow-wrap:anywhere}
  #tut button{font-size:11px;min-height:30px}
  #goals{max-width:30vw!important;max-height:30dvh;overflow-y:auto;overflow-x:hidden;overflow-wrap:anywhere;font-size:11px;padding:6px;left:8px}
  #toasts{max-width:30vw;max-height:30dvh;overflow:auto;overflow-wrap:anywhere}
  /* Functional panels remain usable: internal scrolling and visible controls. */
  #modal{padding:8px max(8px,env(safe-area-inset-right,0px)) 8px max(8px,env(safe-area-inset-left,0px))}
  #modal .card:not(.bj-borak):not(.mapmodal){width:min(90vw,420px);max-height:min(66dvh,calc(100% - 8px));border-radius:15px}
  #modal .card .card-h{padding:8px 12px;gap:7px}
  #modal .card .card-h h2{font-size:17px;line-height:1.12}
  #modal .card .card-h .x,#modal .card .card-h .back{min-height:36px;min-width:36px}
  #modal .card .card-b{padding:9px 12px;gap:7px}
  #modal .card .card-f{padding:8px 10px;gap:6px}
  #modal .card .btn{padding:8px 10px;border-radius:11px;font-size:13px;line-height:1.2;min-height:42px}
  #modal .card .btn small{font-size:11px;color:var(--muted)}
  #modal .card .btn:disabled{opacity:.62;color:#6a645b;background:#eee9dc}
  #modal .card .card-f .btn{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;width:100%;min-height:48px;text-align:left;gap:2px}
  #modal .card .card-f .btn small{width:100%;text-align:left}
  /* Recipe choice panel: title + one-line intro + scrollable recipes. */
  #modal .card.bj-recipe{width:min(88vw,400px);height:min(49dvh,420px);max-height:calc(100% - 12px);display:flex;flex-direction:column}
  #modal .card.bj-recipe .card-b{flex:0 0 auto;max-height:70px;overflow:hidden;padding:7px 11px}
  #modal .card.bj-recipe .card-b p{font-size:12px;line-height:1.3}
  #modal .card.bj-recipe .card-f{display:grid;grid-template-columns:minmax(0,1fr);flex:1 1 0;min-height:0;max-height:none!important;align-content:start;flex-wrap:nowrap;overflow-y:auto;padding:8px 10px}
  #modal .card.bj-recipe .card-f .btn{min-height:52px;gap:2px;box-shadow:0 1px #14213d28}
  /* Map panel: scrollable city diagram above a compact travel-action list. */
  #modal .card.mapmodal{width:min(90vw,440px);height:min(59dvh,530px);max-height:calc(100% - 8px);display:flex;flex-direction:column}
  #modal .card.mapmodal .card-b{flex:1 1 56%;max-height:none;min-height:0;padding:8px 10px}
  #modal .card.mapmodal .card-f{flex:0 1 39%;max-height:39%;min-height:0;padding:7px 10px;display:grid;grid-template-columns:minmax(0,1fr);align-content:start;flex-wrap:nowrap}
  #modal .card.mapmodal .card-f .btn{min-height:42px;padding:6px 8px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,42%);text-align:left;align-items:center;gap:6px;font-size:12px;line-height:1.18}
  #modal .card.mapmodal .card-f .btn small{font-size:10.5px;text-align:right}
  #modal .card.mapmodal .cmwrap{max-width:100%;overflow:hidden}
  #modal .card.mapmodal .cmwrap canvas{width:100%;max-width:100%;height:auto;display:block}
  #modal .card.mapmodal .small{font-size:11px}
  /* Borak keeps the composer visible while its thread scrolls independently. */
  #modal .card.bj-borak{width:min(90vw,440px);height:min(60dvh,530px);max-height:calc(100% - 8px)}
  #modal .card.bj-borak .card-b{min-height:0;flex:1;display:flex;flex-direction:column;overflow:hidden}
  #modal .card.bj-borak .bkapp{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}
  #modal .card.bj-borak .bkchat{flex:1;min-height:0;max-height:none!important;overflow-y:auto;overscroll-behavior:contain}
  #modal .card.bj-borak .bkcompose{flex:0 0 auto;min-width:0}
  #modal .card.bj-borak .bkinput{font-size:16px!important;min-width:0}
  #modal.bj-typing .card.bj-borak{height:100%;max-height:100%}
  #dialog{width:min(90vw,420px);max-height:min(64dvh,calc(100% - 16px));padding:10px 12px;bottom:calc(env(safe-area-inset-bottom,0px) + 8px)}
  #dialog .say{font-size:14px;line-height:1.3}
}
@media(max-width:375px){
 #modal .card.mapmodal .card-f .btn{display:flex;flex-direction:column;align-items:flex-start;gap:2px}
 #modal .card.mapmodal .card-f .btn small{text-align:left}
 #modal .card.mapmodal .card-f{max-height:43%}
 #modal .card.bj-borak{width:min(94vw,440px)}
 #v3bar{width:min(218px,65vw);bottom:calc(env(safe-area-inset-bottom,0px) + 232px)!important}
}
@media(max-height:540px){
 #v3bar{bottom:calc(env(safe-area-inset-bottom,0px) + 120px)!important}
 /* 25 Nov: these three were calc(100% - 8px), which on a sideways phone measured 95% of the
    screen — the "terlalu besar dalam landscape" problem again. The recipe and map panels get
    most of the short side because their content needs it, and Borak keeps its larger share,
    but none of them fills the screen any more. Measured, not guessed. */
 #modal .card.bj-recipe,#modal .card.mapmodal{height:auto;max-height:min(62dvh,calc(100% - 8px))}
 #modal .card.bj-borak{height:min(78dvh,calc(100% - 8px));max-height:min(78dvh,calc(100% - 8px))}
 #modal .card .card-h{padding:4px 8px}
 #modal .card .card-f{padding:4px 7px}
}

/* Adaptive `needsroom` from Claude: apply ONLY to overflowed ordinary dialogs.
   MyMart (catalog), recipes, city map and Borak have independent scroll regions
   and MUST retain their dedicated dimensions. Avoid the MyMart regression. */
#modal .card.needsroom:not(.bj-mymart):not(.bj-recipe):not(.mapmodal):not(.bj-borak){
  max-height:min(86dvh,calc(100% - 12px));
}
@media (max-width:600px){
  #modal .card.needsroom:not(.bj-mymart):not(.bj-recipe):not(.mapmodal):not(.bj-borak){
    max-height:min(82dvh,calc(100% - 12px));
  }
}
@media (max-height:540px){
  #modal .card.needsroom:not(.bj-mymart):not(.bj-recipe):not(.mapmodal):not(.bj-borak){
    max-height:min(82dvh,calc(100% - 8px));
  }
}
