/* Tablet rules use the app window, including Split View and Stage Manager. */
body.phone.tablet #game {
 position:fixed; inset:0; width:100%; height:100dvh;
 max-width:none; margin:0; padding:0; transform:none!important;
}
body.phone.tablet #game #mapViewport {
 position:absolute; inset:0; width:100%; height:100%; border:0;
 background:radial-gradient(ellipse at center,#366252,#16392f 75%);
}
/* mobile.mjs owns proportional canvas bounds and matching hit coordinates. */
body.phone.tablet #game #world { position:absolute; max-width:none; transform:none; touch-action:none; }
body.phone.tablet #game :is(#panel,#panel.wide,#panel.centered,#panel[data-kind]):not([hidden]) {
 position:absolute; left:var(--touch-left); right:var(--touch-right);
 top:calc(var(--hud-bottom,100px) + 8px); bottom:var(--touch-bottom);
 width:auto; height:auto; max-width:min(1100px,calc(100% - var(--touch-left) - var(--touch-right)));
 max-height:none; margin:0 auto; transform:none;
 display:flex; flex-direction:column; overflow:hidden;
}
body.phone.tablet #game #panel > .panel-head { flex:none; min-height:58px; height:auto; padding:8px 12px; }
body.phone.tablet #game #panelBody { flex:1; height:auto; min-height:0; overflow:auto; padding:12px; }
body.phone.tablet #game :is(#closePanel,#panelBack) { flex:none; min-width:44px; min-height:44px; }
body.phone.tablet #game #dialog { inset:0; padding:var(--touch-top) var(--touch-right) var(--touch-bottom) var(--touch-left); }
body.phone.tablet #game #dialogBody {
 width:min(980px,100%); max-width:100%; max-height:calc(100dvh - var(--touch-top) - var(--touch-bottom));
 min-width:0; overflow:auto; box-sizing:border-box;
}
body.phone.tablet #game #dock {
 left:var(--touch-left); right:var(--touch-right); bottom:var(--touch-bottom);
 width:auto; max-width:100%; transform:none; display:flex; justify-content:center; flex-wrap:wrap;
}
body.phone.tablet #game #dock button { width:clamp(72px,9vw,100px); max-width:120px; height:64px; min-height:44px; }
body.phone.tablet #game #mainAction { min-width:0; max-width:calc(100% - 24px); bottom:calc(var(--touch-bottom) + 76px); }
body.phone.tablet #game #mapShortcuts { right:var(--touch-right); max-height:calc(100dvh - var(--hud-bottom,100px) - 90px); overflow-y:auto; }
body.phone.tablet #game #globalChatDrawer { max-width:calc(100% - var(--touch-left) - var(--touch-right)); max-height:100%; }
body.phone.tablet #game .settings-tabs { flex-wrap:wrap; min-width:0; }
body.phone.tablet #game .settings-tabs button { flex:1 1 90px; min-width:0; min-height:44px; }
@media(max-width:700px) {
 body.phone.tablet #game #panelBody :is(.master-grid,.world-goods-grid,.kranen-depot-grid,.team-clipboard-grid,.elite-avatar-grid) {
  grid-template-columns:repeat(2,minmax(0,1fr));
 }
 body.phone.tablet #game .story-scene.avatar-story { grid-template-columns:84px minmax(0,1fr); gap:8px; }
 body.phone.tablet #game .story-scene .speaker-avatar { width:84px; height:104px; max-height:24dvh; }
 body.phone.tablet #game .story-speech { min-width:0; font-size:15px; line-height:1.4; }
 body.phone.tablet #game .dialog-actions { flex-wrap:wrap; }
 body.phone.tablet #game .dialog-actions button { min-height:44px; }
 body.phone.tablet #startScreen { padding-inline:18px; }
 body.phone.tablet #startScreen .start-screen-content { width:min(360px,100%); max-width:100%; }
}
/* Compact glass HUD; the tablet never inherits the old portrait header slab. */
body.phone.tablet #game #hud {
 inset:var(--touch-top) var(--touch-right) auto var(--touch-left);
 height:auto; min-height:72px; padding:0; border:0; border-radius:0;
 background:none; box-shadow:none; display:grid;
 grid-template-columns:minmax(160px,1fr) minmax(160px,1.2fr) auto auto auto 104px;
 grid-template-areas:"identity money marks gems week controls";
 grid-template-rows:auto; gap:8px; align-items:start;
}
body.phone.tablet #game #hud #identity {
 grid-area:identity; position:static; width:100%; height:58px; min-width:0;
 padding:0; gap:6px; border:0; border-radius:0; background:none; box-shadow:none;
}
body.phone.tablet #game #hud #portrait { width:52px; height:58px; flex:none; }
body.phone.tablet #game #hud #identity > span { min-width:0; flex:1; }
body.phone.tablet #game #hud #firm { display:none; }
body.phone.tablet #game #hud .level-row { margin:0; display:flex; gap:4px; flex-wrap:wrap; }
body.phone.tablet #game #hud .level-row i { width:100%; height:8px; order:3; }
body.phone.tablet #game #hud .level-row b { font-size:12px; padding:2px; }
body.phone.tablet #game #hud .level-row small { font-size:10px; }
body.phone.tablet #game #hud .money {
 grid-area:money; position:relative; width:auto; min-width:0; height:72px; margin:0;
 padding:0; border:0; background:none; box-shadow:none; display:block;
}
body.phone.tablet #game #hud .money > span { display:none; }
body.phone.tablet #game #hud .cash-counter {
 width:100%; min-width:0; height:34px; display:flex; align-items:center; gap:5px; padding:4px 8px;
 border:1px solid #b79e70; border-radius:10px; background:#183e38d9;
}
body.phone.tablet #game #hud #cash { min-width:0; overflow:hidden; text-overflow:ellipsis; font-size:clamp(13px,1.8vw,20px); }
body.phone.tablet #game #hud .money small { position:static; display:block; font-size:10px; white-space:nowrap; }
body.phone.tablet #game #hud :is(#lindenburgMarksHud,#jewelBalance) {
 position:static; width:auto; min-width:58px; max-width:104px; height:44px; margin:0; padding:5px;
 display:flex; align-items:center; justify-content:center; gap:4px; font-size:13px;
}
body.phone.tablet #game #hud #lindenburgMarksHud { grid-area:marks; }
body.phone.tablet #game #hud #jewelBalance { grid-area:gems; }
body.phone.tablet #game #hud :is(#lindenburgMarksHud,#jewelBalance) img { width:20px; height:20px; object-fit:contain; }
body.phone.tablet #game #hud .clock { grid-area:week; display:block; width:auto; height:auto; padding:0; border:0; background:none; }
body.phone.tablet #game #hud #week { display:flex; gap:2px; }
body.phone.tablet #game #hud #week span { min-width:22px; width:26px; height:26px; padding:4px 0; font-size:10px; }
body.phone.tablet #game #hud #hudControls { grid-area:controls; position:static; display:flex; flex-wrap:nowrap; gap:6px; height:58px; }
body.phone.tablet #game #hud #hudControls button { width:48px; min-width:44px; height:48px; min-height:44px; margin:0; }
body.phone.tablet #game #hud #hudControls canvas { width:44px; height:44px; }
body.phone.tablet #game #hud :is(#fullscreen,#firmAgenda) { display:none; }
body.phone.tablet #game #hud #oreStocks:not([hidden]) { position:static; display:flex; width:100%; flex-wrap:wrap; gap:3px; transform:none; }
body.phone.tablet #game #hud #oreStocks > span { min-width:0; flex:1; }
@media(max-width:1000px) {
 body.phone.tablet #game #hud { grid-template-columns:minmax(110px,1fr) minmax(120px,1fr) auto auto 104px; grid-template-areas:"identity money marks gems controls" "week week week week week"; gap:5px; }
}
@media(max-width:520px) {
 body.phone.tablet #game #hud { grid-template-columns:minmax(100px,1fr) minmax(120px,1fr) 104px; grid-template-areas:"identity money controls" "marks gems week"; gap:4px; }
 body.phone.tablet #game #hud .money { height:58px; }
 body.phone.tablet #game #hud #week span { min-width:18px; width:18px; font-size:9px; }
 body.phone.tablet #game #hud #oreStocks { max-height:24px; overflow:auto; }
 body.phone.tablet #game #panelBody :is(.grid,.more-grid,.hotel-grid,.master-grid,.shop-grid) { grid-template-columns:repeat(2,minmax(0,1fr)); }
 body.phone.tablet #game #panel .panel-head { flex-wrap:wrap; }
 body.phone.tablet #game #panel .panel-head h1 { font-size:18px; }
 body.phone.tablet #game #panel .panel-head #sectionTabs { order:3; width:100%; }
}
/* Currency buttons belong to .balance-line, not directly to the HUD grid. */
body.phone.tablet #game #hud { grid-template-columns:minmax(150px,.9fr) minmax(260px,1.6fr) auto 104px; grid-template-areas:"identity money week controls"; }
body.phone.tablet #game #hud .money { display:grid; grid-template-columns:minmax(120px,1fr) auto auto; grid-template-areas:"cash marks gems" "income income income" "depot depot depot" "ore ore ore"; align-content:start; gap:2px 4px; height:auto; }
body.phone.tablet #game #hud .balance-line { display:contents; }
body.phone.tablet #game #hud .cash-counter { grid-area:cash; }
body.phone.tablet #game #hud #income { grid-area:income; }
body.phone.tablet #game #hud #depotValue { grid-area:depot; }
body.phone.tablet #game #hud #oreStocks { grid-area:ore; }
body.phone.tablet #game #hud #hudControls > #fullscreen { display:none!important; }
body.phone.tablet #game #hud #energyMeter { display:none; }
body.phone.tablet #game #hud #identity .level-row { width:100%; }
body.phone.tablet #game #hud #portrait { border-radius:9px; }
body.phone.tablet #game #mainAction { left:50%; right:auto; transform:translateX(-50%); width:max-content; }
@media(max-width:900px) {
 body.phone.tablet #game #hud { grid-template-columns:minmax(130px,1fr) minmax(260px,1.8fr) 104px; grid-template-areas:"identity money controls" "week week week"; }
}
@media(max-width:600px) {
 body.phone.tablet #game #hud { grid-template-columns:minmax(120px,1fr) auto 104px; grid-template-areas:"identity week controls" "money money money"; }
 body.phone.tablet #game #hud .money { grid-template-columns:minmax(120px,1fr) auto auto; grid-template-areas:"cash marks gems" "income depot depot" "ore ore ore"; }
 body.phone.tablet #game #hud #oreStocks > span b { font-size:10px; }
}
body.phone.tablet #game #hud #hudShop { display:none; }
body.phone.tablet #game #hud #hudControls { width:104px; padding:0; border:0; background:none; transform:none; align-self:start; }
body.phone.tablet #game #hud #hudControls #pauseButton { position:static; }
body.phone.tablet #game #hud .cash-coin { flex:none; width:18px; height:18px; }
body.phone.tablet #game #hud .cash-counter { min-width:0; }
body.phone.tablet #game #hud #portrait img { width:100%; height:100%; object-fit:cover; }
body.phone.tablet #game #hud { grid-template-columns:200px minmax(280px,1fr) 140px 104px; }
body.phone.tablet #game #hud #hudFullscreen { display:none!important; }
body.phone.tablet #game #hud #hudControls button { padding:0; }
body.phone.tablet #game #hud #hudControls { gap:6px; justify-content:flex-end; }
body.phone.tablet #game #hud #cash { font-size:clamp(12px,1.4vw,17px); }
body.phone.tablet #game #hud .clock { min-width:0; }
body.phone.tablet #game #hud #week span { margin:0; flex:1; }
@media(max-width:900px) {
 body.phone.tablet #game #hud { grid-template-columns:minmax(130px,1fr) minmax(260px,1.8fr) 104px; }
}
@media(max-width:600px) {
 body.phone.tablet #game #hud { grid-template-columns:minmax(100px,1fr) 100px 104px; }
}
body.phone.tablet #game #pauseMenu .settings-tabs { display:flex; flex-wrap:wrap; }
body.phone.tablet #game #pauseMenu .settings-tabs button { flex:1 1 90px; }
body.phone.tablet #game #pauseMenu .settings-body { min-height:0; overflow:auto; }
body.phone.tablet #game #lithium-scene { inset:0; font-size:16px; }
body.phone.tablet #game #lithium-scene .mine-visual canvas { object-fit:cover; }
body.phone.tablet #game #lithium-scene :is(.mine-inspect,.mine-upgrades) { width:min(880px,calc(100% - 24px)); max-height:calc(100% - 24px); overflow:auto; }
body.phone.tablet #game #lithium-scene .mine-stage-list { grid-template-columns:repeat(4,minmax(0,1fr)); }
@media(max-width:600px) {
 body.phone.tablet #game #lithium-scene .mine-stage-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
 body.phone.tablet #game #lithium-scene h1 { font-size:20px; }
 body.phone.tablet #game #lithium-scene .mine-readouts { max-width:calc(100% - 24px); }
}
