/* APK-only portrait shell. Layout follows the usable WebView, not a fixed phone size. */
/* Build actions keep a dedicated row and explicit contrast, including disabled quotes. */
.portrait-shell #drawbar .db-actions{display:grid;grid-template-columns:44px minmax(64px,1fr);width:100%;min-width:0}
.portrait-shell #drawbar #drawdone{grid-column:1/-1;width:100%;min-width:0;min-height:46px;white-space:normal;overflow-wrap:anywhere;background:#263b42!important;color:#fff!important;opacity:1;font-weight:700}
.portrait-shell #drawbar #drawdone:disabled{background:#63726b!important;color:#fff!important;opacity:1;cursor:default}
.portrait-shell .atlas-bottom{flex-wrap:wrap}
.portrait-shell .atlas-pagination{flex:0 0 100%;justify-content:center}
.portrait-shell .atlas-start{flex:1 1 130px;min-width:0;white-space:normal}
.portrait-shell #atlas-restart{flex:1 1 100px;min-height:46px;padding:10px;background:#e4e9de;color:#263b42;font-weight:600;border:1px solid #c9d1c2;border-radius:0}
.portrait-shell{--app-w:100vw;--app-h:100dvh;--safe-t:max(env(safe-area-inset-top,0px),var(--safe-area-inset-top,0px));--safe-b:max(env(safe-area-inset-bottom,0px),var(--safe-area-inset-bottom,0px));--safe-l:max(env(safe-area-inset-left,0px),var(--safe-area-inset-left,0px));--safe-r:max(env(safe-area-inset-right,0px),var(--safe-area-inset-right,0px));--hud-bottom:110px;--dock-height:56px;--gutter:10px;--ctl:42px;--dock-btn-h:54px;--dock-bottom:calc(8px + var(--safe-b));background:#e6edda}
.portrait-shell,.portrait-shell body{width:var(--app-w);height:var(--app-h);margin:0;overflow:hidden;overscroll-behavior:none}
.portrait-shell body{position:fixed;inset:0 auto auto 0;background:#e6edda;text-size-adjust:100%;-webkit-text-size-adjust:100%}
.portrait-shell #map{position:absolute;inset:0;width:var(--app-w);height:var(--app-h)}
.portrait-shell header{position:absolute;inset:0 0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.7fr);grid-template-rows:auto auto;gap:5px 8px;height:auto;min-height:0;padding:calc(6px + var(--safe-t)) calc(10px + var(--safe-r)) 7px calc(10px + var(--safe-l));background:linear-gradient(#fffef9ed 85%,#fffef938);align-items:center;align-content:start}
.portrait-shell .brand,.portrait-shell .stat-delivered,.portrait-shell .stat-lives>small,.portrait-shell #year,.portrait-shell #date span,.portrait-shell #tasks,.portrait-shell #fullscreen,.portrait-shell .map-caption,.portrait-shell .legend{display:none!important}
.portrait-shell .calendar{grid-column:1;grid-row:1;min-width:0;border:0;padding:0}.portrait-shell #date{font-size:17px;white-space:normal}.portrait-shell #calendar-tag{font-size:10px;letter-spacing:0;white-space:normal}
.portrait-shell header .stats{grid-column:2;grid-row:1;display:flex;align-items:center;justify-content:flex-end;min-width:0;gap:8px;margin:0}.portrait-shell #finance{min-width:0;max-width:100%;overflow:hidden}.portrait-shell #points{font-size:19px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.portrait-shell .stat-lives{flex:none}.portrait-shell .stat-lives b{margin:0;font-size:15px;line-height:1}.portrait-shell #maintenance-estimate{font-size:9px;white-space:normal}
.portrait-shell header .controls{grid-column:1/-1;grid-row:2;display:flex;justify-content:flex-end;flex-wrap:wrap;gap:6px;min-width:0}.portrait-shell .ctl,.portrait-shell .playback{height:auto;min-height:42px}.portrait-shell .ctl{min-width:42px;padding:6px 10px}.portrait-shell .playback{display:flex;align-items:stretch;padding:2px}.portrait-shell .playback button{height:auto;min-height:36px;min-width:40px}.portrait-shell #atlas-menu{font-size:12px}
.portrait-shell footer{position:absolute;left:calc(8px + var(--safe-l));right:calc(8px + var(--safe-r));bottom:calc(8px + var(--safe-b));display:block;min-width:0}.portrait-shell .dock{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:4px;width:100%;margin:0}.portrait-shell .dock-btn{display:flex;min-width:0;min-height:54px;height:auto;flex-direction:column;padding:7px 2px!important;gap:3px;border-radius:12px;background:#fffdf5e8;font-size:12px;line-height:1.2}.portrait-shell .dock-btn.is-primary{background:#263b42;color:white}.portrait-shell .dock-btn svg{width:19px;height:19px;flex:none}.portrait-shell .dock-more,.portrait-shell #next-supply{display:none!important}.portrait-shell .dock-tasks{display:flex!important}
.portrait-shell .route-panel,.portrait-shell .detail-panel{position:absolute;left:calc(8px + var(--safe-l));right:calc(8px + var(--safe-r));width:auto;top:auto;bottom:calc(var(--dock-height) + 16px + var(--safe-b));min-width:0;overflow:auto;max-height:min(calc(var(--app-h)*.4),calc(var(--app-h) - var(--hud-bottom) - var(--dock-height) - var(--safe-b) - 64px));background:#fffef8f2;overscroll-behavior:contain}
.portrait-shell .route-panel{padding:9px 12px;display:block}.portrait-shell .route-panel .panel-heading{position:sticky;top:-9px;z-index:1;padding:6px 0;background:#fffef8f5;gap:5px}.portrait-shell .panel-heading>span{min-width:0;overflow-wrap:anywhere}.portrait-shell .route-panel #route-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}.portrait-shell .route-panel .add-route{width:100%;min-height:42px;margin-top:8px}.portrait-shell .route-foot{display:flex;margin-top:6px}.portrait-shell .route-foot #stock{display:none}.portrait-shell .route-foot button{margin-left:auto;width:40px;height:40px}.portrait-shell .route-panel.collapsed #route-list,.portrait-shell .route-panel.collapsed .add-route,.portrait-shell .route-panel.collapsed .route-foot{display:none!important}.portrait-shell .route-panel.collapsed .panel-heading{padding:0;position:static}.portrait-shell .route-panel.collapsed{max-height:64px}.portrait-shell .route-row .name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.portrait-shell .detail-panel{max-height:min(calc(var(--app-h)*.48),calc(var(--app-h) - var(--hud-bottom) - var(--dock-height) - var(--safe-b) - 48px));padding:12px 14px;border-radius:16px}.portrait-shell .detail-panel>.close{position:sticky;top:0;z-index:3;float:right;background:#f1f4ef;min-width:40px;min-height:40px}.portrait-shell .detail-panel::before{display:none}.portrait-shell .detail-panel h3{overflow-wrap:anywhere;margin-right:40px}.portrait-shell .detail-actions{display:flex;flex-wrap:wrap;gap:6px}.portrait-shell .detail-actions button{min-height:40px;flex:1 1 100px;white-space:normal}
.portrait-shell .overlay{position:absolute;inset:0;width:var(--app-w);height:var(--app-h);display:flex;align-items:flex-end;justify-content:center;padding:calc(var(--safe-t) + 38px) calc(6px + var(--safe-r)) calc(6px + var(--safe-b)) calc(6px + var(--safe-l));overflow:hidden}
.portrait-shell .modal,.portrait-shell .modal:has(.financial-market){width:100%;max-width:100%;max-height:100%;min-width:0;overflow:auto;overflow-x:hidden;border-radius:18px 18px 10px 10px;padding:0 14px 16px;overscroll-behavior:contain}.portrait-shell .modal-head{position:sticky;top:0;z-index:5;margin:0 -14px 8px;padding:16px 14px 10px;min-width:0}.portrait-shell .modal-head>div{min-width:0}.portrait-shell .modal h1,.portrait-shell .modal h2{font-size:22px;overflow-wrap:anywhere}.portrait-shell .modal .primary{white-space:normal;overflow-wrap:anywhere}.portrait-shell .ux-actions,.portrait-shell .construction-actions,.portrait-shell .holding-actions,.portrait-shell .market-order{flex-wrap:wrap;gap:7px}.portrait-shell .market-order label{flex:1 1 100%;min-width:0}.portrait-shell .market-order button{flex:1 1 100px}.portrait-shell .modal input{max-width:100%;min-width:0}.portrait-shell .market-tabs{flex-wrap:wrap}.portrait-shell .market-tabs button{flex:1 1 100px;min-width:0}.portrait-shell .market-stock-layout{grid-template-columns:minmax(0,1fr)}.portrait-shell .research-grid,.portrait-shell .fleet-grid,.portrait-shell .ops-grid,.portrait-shell .farm-city-list{grid-template-columns:minmax(0,1fr)}.portrait-shell .market-metrics,.portrait-shell .farm-metrics,.portrait-shell .holding-values{grid-template-columns:repeat(2,minmax(0,1fr));min-width:0}.portrait-shell .farm-metrics>div:last-child{grid-column:1/-1}.portrait-shell .market-stock-list{display:flex;overflow-x:auto;max-width:100%;max-height:none}.portrait-shell .market-stock{flex:0 0 160px}.portrait-shell .market-build-row{flex-wrap:wrap}.portrait-shell .market-build-row button{min-height:40px}.portrait-shell .market-range{flex-wrap:wrap}.portrait-shell .market-product,.portrait-shell .research-card,.portrait-shell .holding-card{padding:14px}.portrait-shell .modal svg{max-width:100%}
.portrait-shell .portrait-modal-close{position:absolute;right:calc(10px + var(--safe-r));top:calc(5px + var(--safe-t));z-index:25;width:34px;height:34px;background:#fffef8;border:1px solid #d6dfd0;border-radius:50%;font-size:22px;box-shadow:0 2px 8px #263b4222}
.portrait-shell #drawbar,.portrait-shell #drawbar.db-line{position:absolute;left:calc(8px + var(--safe-l));right:calc(8px + var(--safe-r));bottom:calc(8px + var(--safe-b));width:auto;max-width:none;transform:none;display:flex;flex-wrap:wrap;gap:8px;padding:10px}.portrait-shell .db-info{flex:1 1 100%;min-width:0}.portrait-shell .db-actions{display:flex;flex:1 1 100%;justify-content:flex-end;flex-wrap:wrap;gap:6px}.portrait-shell .db-actions button{min-height:40px;padding:0 12px}.portrait-shell .db-cost{flex-wrap:wrap}
.portrait-shell .top-stack,.portrait-shell #toast{top:calc(var(--hud-bottom) + 6px);max-width:calc(var(--app-w) - var(--safe-l) - var(--safe-r) - 20px)}.portrait-shell .undo-build{top:calc(var(--hud-bottom) + 6px);max-width:calc(var(--app-w) - 24px);right:12px}.portrait-shell #toast{white-space:normal;overflow-wrap:anywhere}
.portrait-shell .map-selection{position:absolute;inset:0;width:var(--app-w);height:var(--app-h);padding-top:var(--safe-t);padding-left:var(--safe-l);padding-right:var(--safe-r)}.portrait-shell .atlas-top{padding:10px 16px 4px}.portrait-shell .atlas-heading{padding:10px 20px 6px}.portrait-shell .atlas-heading h1{font-size:clamp(20px,6vw,27px)}.portrait-shell .atlas-rail{gap:14px;padding:8px max(20px,calc((var(--app-w) - min(280px,calc(var(--app-w) - 58px)))/2));min-height:0;touch-action:pan-x pan-y}.portrait-shell .atlas-card{flex:0 0 min(280px,calc(var(--app-w) - 58px));max-height:100%;padding:13px 15px;overscroll-behavior:contain}.portrait-shell .atlas-terrain{height:clamp(82px,calc(var(--app-h)*.18),185px)}.portrait-shell .atlas-terrain svg{width:100%;height:100%}.portrait-shell .atlas-bottom{padding:12px 16px calc(12px + var(--safe-b));gap:6px}.portrait-shell .atlas-start{font-size:20px;padding:12px;min-height:46px}.portrait-shell .atlas-pagination{gap:7px}.portrait-shell .atlas-card>p{font-size:11px;line-height:1.6;margin:8px 0}
@media(max-height:580px){.portrait-shell header{gap:2px 6px;padding-top:calc(3px + var(--safe-t));padding-bottom:4px}.portrait-shell .ctl{min-height:36px;min-width:38px}.portrait-shell .playback button{min-height:30px}.portrait-shell .dock-btn{min-height:46px;padding-top:5px!important;padding-bottom:5px!important}.portrait-shell .atlas-heading{padding-top:4px}.portrait-shell .atlas-heading h1{font-size:20px;margin:5px 0}.portrait-shell .atlas-heading p{display:none}.portrait-shell .atlas-card h2{font-size:25px;margin:8px 0}.portrait-shell .atlas-save{font-size:8px}.portrait-shell .atlas-record b{font-size:14px}.portrait-shell .atlas-bottom{padding-top:7px;padding-bottom:calc(8px + var(--safe-b))}.portrait-shell .atlas-medal{width:28px;height:28px;font-size:19px}}
