/* Layout uses available CSS pixels, including browser zoom and short laptop displays. */
html{scrollbar-gutter:stable}body{overflow-x:clip}main,.explorer,.map,#map-art,#island-panel{min-width:0}
.explorer{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:18px;height:auto;min-height:0;padding:16px;align-items:start}
.explorer>.map{position:relative;height:clamp(540px,78svh,980px);min-height:0;width:100%;border-radius:18px;overflow:hidden}
.explorer>#island-panel{position:static;inset:auto;width:auto;max-width:none;max-height:none;height:auto;margin:0;overflow:visible;backdrop-filter:none;padding:22px;font-size:14px;align-self:start}
#island-panel .active-case-title{font-size:clamp(23px,2vw,32px)}#island-panel .single-objective{overflow-wrap:anywhere}#island-panel .primary{width:100%;white-space:normal;min-height:44px}
#map-art{display:grid;grid-template-rows:minmax(0,1fr) auto auto;gap:8px;padding-bottom:12px;height:100%;width:100%}.scene-viewport{grid-row:1;position:relative;min-width:0;min-height:0;overflow:hidden}
#island-canvas{position:absolute;inset:0}.scene-tools{grid-row:2;position:relative;inset:auto;left:auto;bottom:auto;transform:none;width:calc(100% - 24px)!important;max-width:none;margin:0 auto;display:flex;flex-wrap:wrap;justify-content:center;gap:4px;border-radius:16px;backdrop-filter:none;white-space:normal;box-shadow:none}
.scene-tools button,.scene-tools select{min-height:38px;font-size:12px!important;padding:8px 11px!important}.scene-tools label{display:inline-flex;align-items:center;gap:5px}.scene-tools button:nth-child(3){display:inline-block}
.scene-destinations{grid-row:3;position:relative;inset:auto;left:auto;right:auto;bottom:auto;display:flex;flex-wrap:wrap;gap:6px;padding:0 12px;max-height:none;overflow:visible}.scene-destinations button{font-size:11px;min-height:36px;backdrop-filter:none;white-space:normal}
.scene-instructions{display:none}.scene-clock{top:12px;max-width:230px;font-size:12px;pointer-events:none}.campaign-banner{max-width:38%;pointer-events:none}.campaign-banner b{font-size:clamp(17px,2vw,26px)}#island-identity{max-width:42%;left:20px;top:65px}#island-identity b{font-size:clamp(17px,2vw,26px)}.mobile-island-picker{display:none!important}
#modal{width:min(1060px,94vw);max-width:94vw}#modal-content{overflow-wrap:anywhere}.resident-chat-form textarea{min-width:0}.scroll, .audit-workbench{max-width:100%}
@media(max-width:1439px){.explorer{grid-template-columns:minmax(0,1fr);padding:12px;gap:12px}.explorer>.map{height:clamp(500px,74svh,850px)}.explorer>#island-panel{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,1fr);gap:8px 24px;padding:20px}.season-kicker,.case-number,.active-case-title,.active-case-subtitle{grid-column:1}#island-panel .single-objective{grid-column:2;grid-row:1/span 4;margin:0}#island-panel>button,#island-panel .season-save{grid-column:1/-1}.scene-tools{width:calc(100% - 20px)!important}}
@media(max-width:900px){header{height:auto;min-height:76px;flex-wrap:wrap;gap:12px;padding:15px 4%}header nav{order:3;width:100%;height:auto;display:flex;justify-content:space-between;gap:4px}header nav button{min-height:44px;padding:8px;font-size:12px}.nav.active:after{bottom:0}.explorer>.map{height:clamp(540px,78svh,800px)}.campaign-banner{max-width:42%;top:70px}.campaign-banner small,.campaign-banner span{font-size:10px}.scene-clock{left:auto;right:14px;transform:none;max-width:190px}#island-identity{max-width:48%}.scene-tools button,.scene-tools select{min-height:40px}.scene-destinations button{min-height:40px}.resident-dialog-open .resident-branch-options{min-height:0}}
@media(max-width:600px){.explorer{padding:8px;gap:8px}.explorer>.map{height:clamp(610px,88svh,820px);border-radius:12px}.explorer>#island-panel{display:block;padding:18px;border-radius:12px}#island-panel .single-objective{margin:14px 0}#island-panel .active-case-title{font-size:25px}#island-panel .active-case-subtitle,#island-panel .single-objective p{font-size:13px}#island-panel .season-kicker,#island-panel .case-number{font-size:11px}.scene-tools{gap:2px;padding:5px;width:calc(100% - 12px)!important}.scene-tools button,.scene-tools select{min-height:40px;font-size:11px!important;padding:7px 8px!important}.scene-destinations{padding:0 6px;gap:4px}.scene-destinations button{flex:1 1 42%;font-size:10px;padding:6px;min-height:34px}.campaign-banner{left:12px;top:64px;max-width:50%}.campaign-banner b{font-size:16px}.campaign-banner small,.campaign-banner span{font-size:9px}.scene-clock{top:10px;right:10px;max-width:160px;font-size:10px;padding:8px 11px}.map-head{top:12px;left:12px}.weather{max-width:120px;font-size:9px}#island-identity{left:12px;top:64px;gap:8px;max-width:52%}#island-identity>span{width:32px;height:32px;font-size:20px}#island-identity b{font-size:17px}#island-identity p{font-size:10px}#island-identity small{font-size:7px}.resident-chat-form{flex-direction:column}.resident-chat-form button,.resident-branch-options button{min-height:44px}.resident-visit-header{gap:12px}.resident-visit-header .resident-avatar.large{width:60px}.resident-dialog-open #modal-content{padding:14px}.brand{font-size:18px}.passport{font-size:10px;padding:8px}.story-layout,.workplace-layout,.position-layout,.detective-board{grid-template-columns:minmax(0,1fr)}}
@media(max-height:600px) and (min-width:601px){.explorer>.map{height:560px}.scene-clock{font-size:10px;padding:8px}.explorer>#island-panel{max-height:none}}
@media(prefers-reduced-motion:reduce){.scene-tools *,.scene-destinations *{transition:none!important}}
@media(max-width:900px){header nav{position:static;inset:auto;z-index:auto;background:transparent;border:0;box-shadow:none;transform:none;max-width:100%}.nav{flex:1;text-align:center}header{position:relative}.scene-tools{color:#365d50}.scene-tools .scene-time-picker{color:#365d50}}

/* Mobile & tablet polish — desktop layouts above these breakpoints stay unchanged. */
@media(max-width:1024px){
  #modal{width:min(1060px,96vw);max-width:96vw}
  #modal.paper-open{width:100vw!important;max-width:100vw!important;height:100dvh!important;max-height:100dvh!important;margin:0!important;border-radius:0!important}
  .stage-launchers button{min-height:44px}
  .scene-destinations button{min-height:44px!important;padding:10px 12px!important;font-size:12px!important}
  .scene-tools button,.scene-tools select{min-height:44px}
  .scene-tools button[aria-label="放大場景"],.scene-tools button[aria-label="縮小場景"]{min-width:44px;min-height:44px;padding:0!important}
  body:not(.stage-page) .stage-launchers button{min-height:44px;padding:10px 14px}
}
@media(max-width:900px){
  body:not(.stage-page)>header{height:auto;min-height:54px;padding:8px 12px!important;padding-top:max(8px,env(safe-area-inset-top,0px))!important}
  body:not(.stage-page) .scene-viewport{height:clamp(420px,68svh,720px);min-height:380px}
  body:not(.stage-page) .campaign-banner{max-width:min(180px,46vw);top:10px!important;left:12px!important}
  body:not(.stage-page) .campaign-banner b{font-size:clamp(14px,3.8vw,18px)!important}
  body:not(.stage-page) .scene-clock{max-width:min(210px,50vw);font-size:11px;padding:8px 10px}
  body:not(.stage-page) .scene-tools{width:calc(100% - 16px)!important;gap:6px;padding:8px}
  body:not(.stage-page) .scene-destinations{margin-bottom:max(16px,env(safe-area-inset-bottom,0px));gap:8px!important}
  body:not(.stage-page) .explorer>#island-panel{width:min(240px,42vw)!important;max-width:min(280px,46vw)!important}
  .cashflow-diagram,.money-flow,.txn-flow{overflow-x:auto;-webkit-overflow-scrolling:touch}
}
@media(max-width:620px){
  body:not(.stage-page) .stage-sidebar-fold{min-width:48px;min-height:44px;padding:10px 12px;right:10px;top:10px;z-index:35}
  body:not(.stage-page) .explorer.sidebar-open>#island-panel,
  body:not(.stage-page).sidebar-open .explorer>#island-panel,
  .explorer.sidebar-open>#island-panel{
    display:block!important;
    position:fixed!important;
    left:10px!important;
    right:10px!important;
    top:auto!important;
    bottom:max(10px,env(safe-area-inset-bottom,0px))!important;
    width:auto!important;
    max-width:none!important;
    max-height:min(52dvh,420px)!important;
    z-index:45!important;
    padding:14px!important;
    border-radius:18px!important;
    box-shadow:0 16px 40px #16343a33!important;
  }
  body:not(.stage-page) .campaign-banner{max-width:min(160px,48vw)}
  body:not(.stage-page) .scene-clock{left:auto!important;right:12px!important;transform:none!important;top:10px}
  .scene-destinations button{flex:1 1 calc(50% - 8px);min-height:44px!important}
}
