#world { touch-action:none; user-select:none; -webkit-user-select:none; }
button,input,select,summary { touch-action:manipulation; }
.build-preview { overflow:hidden; }
.build-preview>.model-image { position:absolute; inset:0; width:100%; height:92px; min-height:0; }
.mobile-controls { display:none; }
[hidden] { display:none!important; }
.touch-ui .mobile-controls { display:contents; }
.touch-ui body { overscroll-behavior:none; }
.touch-ui button { min-height:44px; }
.touch-ui input,.touch-ui select { min-height:46px; font-size:16px; }
.touch-ui .hud-top { top:max(8px,env(safe-area-inset-top)); left:max(8px,env(safe-area-inset-left)); right:max(8px,env(safe-area-inset-right)); height:103px; grid-template-columns:1fr; padding:8px 11px; }
.touch-ui .hud-brand { display:none; }
.touch-ui .resource-bar { border:0; padding:0; gap:4px; }
.touch-ui .resource { padding:0 2px; font-size:17px; }
.touch-ui .resource small { font-size:10px; }
.touch-ui .resource .item-icon { display:none; }
.touch-ui .power { padding:5px 0 0; margin-top:4px; min-height:36px; border-top:1px solid #41554a; display:flex; align-items:center; justify-content:space-between; }
.touch-ui .power>.eyebrow { font-size:9px; }
.touch-ui .power>.eyebrow .ui-icon { display:none; }
.touch-ui .power>.energy-reading { font-size:14px; }
.touch-ui .power>small { font-size:10px; }
.touch-ui .left-tools { position:absolute; top:auto; bottom:0; left:0; right:0; width:auto; display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:0; padding:5px max(3px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(3px,env(safe-area-inset-left)); border-radius:14px 14px 0 0; z-index:12; }
.touch-ui .left-tools button { display:flex; flex-direction:column; justify-content:center; align-items:center; height:53px; min-width:0; padding:4px 0; gap:5px; font-size:9px; }
.touch-ui .left-tools button>span { display:block; }
.touch-ui .left-tools button>.ui-icon { width:20px; height:20px; }
.touch-ui .left-tools kbd { display:none; }
.touch-ui .left-tools button:nth-last-child(2) { margin:0; border-top-color:transparent; }
.touch-ui .quickbar,.touch-ui .statusbar,.touch-ui .hint,.touch-ui .map-panel,.touch-ui #tooltip { display:none!important; }
.touch-ui .objective { top:calc(max(8px,env(safe-area-inset-top)) + 111px); left:8px; right:65px; width:auto; padding:11px 13px; max-height:140px; overflow:auto; }
.touch-ui .objective h3 { font-size:15px; margin-top:5px!important; }
.touch-ui .objective p { font-size:11px; margin-top:3px; line-height:1.5; }
.touch-ui .objective .progress { margin-top:8px; }
.touch-ui .objective-footer { margin-top:5px; }
.touch-ui .objective-footer button { min-height:30px; font-size:10px; }
.touch-ui .objective-footer small { font-size:9px; }
.touch-ui .camera-tools { position:absolute; top:calc(max(8px,env(safe-area-inset-top)) + 111px); right:max(8px,env(safe-area-inset-right)); display:grid; gap:3px; padding:3px; z-index:5; }
.camera-tools button { width:44px; height:44px; padding:0; border:0; font-size:22px; background:transparent; }
.touch-ui .build-panel,.touch-ui .inspector { left:max(8px,env(safe-area-inset-left)); right:max(8px,env(safe-area-inset-right)); top:auto; bottom:calc(72px + env(safe-area-inset-bottom)); width:auto; max-height:calc(100dvh - 195px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding:17px; border-radius:17px; z-index:7; overflow:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.touch-ui .inspector::before,.touch-ui .build-panel::before { content:""; display:block; width:38px; height:4px; border-radius:6px; background:#72867a; margin:0 auto 12px; }
.touch-ui #app:has(.build-panel) .objective,.touch-ui #app:has(.inspector) .objective { display:none; }
.touch-ui .build-panel h3,.touch-ui .inspector h3 { font-size:22px; }
.touch-ui .build-panel .categories { gap:6px!important; }
.touch-ui .categories button { min-height:38px; font-size:11px; padding:8px 11px; }
.touch-ui .build-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.touch-ui .build-card-body>b { font-size:13px; }
.touch-ui .build-card-body>small { font-size:11px; }
.touch-ui .build-state,.touch-ui .build-cost { font-size:10px; }
.touch-ui .machine-hero img { width:72px; height:72px; }
.touch-ui .inspector>.row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.touch-ui .inspector>.row button { padding:10px 7px; font-size:12px; }
.touch-ui .modal-backdrop { padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); z-index:30; }
.touch-ui .modal { width:min(680px,100%); max-height:100%; padding:20px; border-radius:17px; overflow:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.touch-ui .modal-header { margin-bottom:20px; }
.touch-ui .modal-header button { min-width:44px; height:44px; }
.touch-ui .modal-header h2 { font-size:25px; }
.touch-ui .modal .grid2,.touch-ui .modal .metrics { grid-template-columns:1fr; }
.touch-ui .modal .row>button { flex:1 1 auto; }
.touch-ui .inventory-toolbar { flex-direction:column; align-items:stretch; gap:10px; margin-bottom:12px; }
.touch-ui .inventory-toolbar .pill { align-self:flex-start; }
.touch-ui .inventory-grid { grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:9px; }
.touch-ui .inventory-slot { min-height:136px; padding-bottom:24px; }
.touch-ui .inventory-slot img { height:88px; }
.touch-ui .inventory-slot strong { bottom:auto; top:5px; font-size:13px; padding:1px 5px; right:5px; }
.touch-ui .inventory-name { display:block; position:static; transform:none; border:0; background:none; padding:2px 5px; white-space:normal; text-align:center; font-size:10px; line-height:1.3; pointer-events:none; }
.touch-ui .inventory-grid.compact { grid-template-columns:repeat(auto-fill,minmax(83px,1fr)); }
.touch-ui .inventory-grid.compact .inventory-slot { min-height:113px; }
.touch-ui .inventory-grid.compact img { height:68px; }
.touch-ui .inventory-grid.compact .inventory-slot strong { bottom:auto; top:5px; }
.placement-dock { position:absolute; left:max(8px,env(safe-area-inset-left)); right:max(8px,env(safe-area-inset-right)); bottom:calc(72px + env(safe-area-inset-bottom)); z-index:9; padding:13px; border-radius:15px; }
.placement-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.placement-heading small { display:block; font-size:9px; color:#b7d4b6; letter-spacing:.08em; }
.placement-heading b { display:block; margin-top:4px; font-size:16px; }
.placement-heading>button { width:44px; padding:8px; background:none; border:0; }
.placement-dock>p { font-size:11px; margin:7px 0 12px; min-height:16px; }
.placement-actions { display:flex; gap:8px; align-items:center; }
.placement-actions>button { flex:1; min-height:48px; padding:8px; font-size:12px; font-weight:600; }
.nudge-pad { display:grid; grid-template-columns:repeat(2,44px); gap:3px; }
.nudge-pad button { width:44px; height:44px; min-height:44px; padding:0; font-size:11px; }
.placing-mobile .objective,.placing-mobile .inspector { display:none!important; }
.touch-ui .overlay-label { left:8px; top:273px; right:65px; font-size:10px; }
.touch-ui #notifications { top:calc(max(8px,env(safe-area-inset-top)) + 112px); width:max-content; max-width:calc(100vw - 28px); }
.touch-ui .menu { overflow:auto; padding:85px 23px 65px; align-items:center; }
.touch-ui .menu-topline { top:calc(22px + env(safe-area-inset-top)); left:23px; right:23px; }
.touch-ui .menu-topline>span:last-child,.touch-ui .menu-art-label,.touch-ui .menu-footer>span:last-child { display:none; }
.touch-ui .menu-content { max-width:520px; width:100%; gap:20px; }
.touch-ui .menu h1 { font-size:clamp(40px,10vw,62px); letter-spacing:-2px; }
.touch-ui .menu-actions { width:100%; }
.touch-ui .menu-footer { left:23px; bottom:calc(20px + env(safe-area-inset-bottom)); }
@media (max-height:520px) and (orientation:landscape) {
  .touch-ui .hud-top { height:66px; grid-template-columns:1fr 170px; gap:12px; }
  .touch-ui .power { display:grid; border-top:0; border-left:1px solid #405447; padding:0 0 0 10px; margin:0; }
  .touch-ui .power>.eyebrow { display:none; }
  .touch-ui .objective { top:82px; width:250px; right:auto; max-height:120px; }
  .touch-ui .camera-tools { top:82px; grid-template-columns:repeat(4,44px); }
  .touch-ui .left-tools button { height:44px; flex-direction:row; font-size:10px; gap:5px; }
  .touch-ui .build-panel,.touch-ui .inspector { top:82px; bottom:64px; max-height:none; right:auto; width:360px; }
  .touch-ui .placement-dock { left:auto; width:350px; bottom:64px; padding:9px 12px; }
  .touch-ui .placement-dock>p { margin:5px 0; }
  .touch-ui .nudge-pad { grid-template-columns:repeat(2,44px); }
  .touch-ui .menu { align-items:flex-start; padding:70px 35px; }
  .touch-ui .menu-footer { position:static; margin-top:25px; }
  .touch-ui .menu { display:block; }
}

/* World-first controls: only three thumb-sized actions remain during play. */
.mobile-launchers { display:none; }
.play-launchers { pointer-events:none; }
.play-launchers button { pointer-events:auto; }
.focus-toggle { position:absolute; right:18px; bottom:210px; z-index:15; }
.focus-play .hud-top,.focus-play .left-tools,.focus-play .objective,.focus-play .quickbar,.focus-play .map-panel,.focus-play .statusbar,.focus-play .hint { display:none!important; }
.touch-ui .focus-toggle { display:none; }
.touch-ui .hud-top,.touch-ui .left-tools,.touch-ui .objective,.touch-ui .camera-tools { display:none!important; }
.touch-ui .mobile-launchers { display:contents; }
.touch-ui .play-actions { position:absolute; bottom:max(12px,env(safe-area-inset-bottom)); left:max(12px,env(safe-area-inset-left)); right:max(12px,env(safe-area-inset-right)); display:flex; gap:10px; justify-content:center; z-index:12; }
.touch-ui .play-actions button { min-width:0; flex:1; max-width:180px; min-height:60px; padding:10px 12px; display:flex; align-items:center; justify-content:center; gap:8px; font-size:16px; font-weight:650; border-radius:18px; background:#192e2bf5; box-shadow:0 4px 20px #0005; }
.touch-ui .play-actions button.primary { background:#b4dfbd; color:#13271e; }
.touch-ui .play-actions .ui-icon { width:22px; height:22px; flex-shrink:0; }
.touch-ui .goal-chip { position:absolute; top:max(12px,env(safe-area-inset-top)); left:max(12px,env(safe-area-inset-left)); max-width:calc(100vw - 24px); min-height:48px; display:flex; gap:9px; align-items:center; padding:10px 14px; font-size:15px; border-radius:24px; background:#192e2bf2; }
.touch-ui .goal-chip span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.touch-ui .goal-chip .ui-icon { width:20px; height:20px; }
.touch-ui .build-panel,.touch-ui .inspector { top:auto; bottom:0; left:0; right:0; width:auto; max-height:82dvh; padding:20px max(18px,env(safe-area-inset-right)) max(22px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left)); border-radius:24px 24px 0 0; z-index:18; font-size:16px; }
.touch-ui .build-panel::before,.touch-ui .inspector::before { display:none; }
.touch-ui #app:has(.build-panel) .mobile-launchers,.touch-ui #app:has(.inspector) .mobile-launchers,.touch-ui #app:has(.modal-backdrop) .mobile-launchers,.touch-ui.placing-mobile .mobile-launchers { display:none; }
.touch-ui .build-panel .between>button,.touch-ui .inspector .between>button { min-width:48px; min-height:48px; }
.touch-ui .build-panel .categories button { min-height:48px; font-size:16px; }
.touch-ui .build-list { grid-template-columns:1fr; }
.touch-ui .build-card { display:grid; grid-template-columns:100px minmax(0,1fr); text-align:left; min-height:145px; }
.touch-ui .build-preview { height:100%; min-height:120px; }
.touch-ui .build-preview>.model-image { height:120px; top:12px; }
.touch-ui .build-card-body { padding:13px 10px; }
.touch-ui .build-card-body>b { font-size:18px; }
.touch-ui .build-card-body>small,.touch-ui .build-state,.touch-ui .build-cost,.touch-ui .build-explainer { font-size:14px; line-height:1.5; }
.touch-ui .modal { font-size:16px; padding:22px; }
.touch-ui .modal p,.touch-ui .inspector p { font-size:16px; line-height:1.6; }
.touch-ui .modal button,.touch-ui .inspector button { min-height:50px; font-size:16px; }
.hub-grid { display:grid; grid-template-columns:1fr; gap:12px; margin-top:18px; }
.hub-grid button { text-align:left; min-height:64px!important; padding:16px 18px; font-size:18px!important; border-radius:14px; }
.hub-grid button::after { content:'›'; float:right; margin-left:12px; color:#b4dfbd; }
.touch-ui .inventory-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.touch-ui .inventory-slot { min-height:160px; padding-bottom:8px; }
.touch-ui .inventory-slot img { height:112px; }
.touch-ui .inventory-name { font-size:14px; line-height:1.4; overflow-wrap:anywhere; }
.touch-ui .inventory-slot strong { font-size:17px; }
.touch-ui .inventory-grid.compact { grid-template-columns:repeat(2,minmax(0,1fr)); }
.touch-ui .inventory-grid.compact .inventory-slot { min-height:135px; }
.touch-ui .inventory-grid.compact .inventory-slot strong { font-size:16px; }
.touch-ui .inventory-help { font-size:14px; }
.touch-ui .placement-dock { bottom:max(8px,env(safe-area-inset-bottom)); left:8px; right:8px; width:auto; padding:14px; }
.touch-ui .placement-heading b { font-size:19px; }
.touch-ui .placement-heading small { font-size:12px; }
.touch-ui .placement-dock>p { font-size:14px; }
.touch-ui .placement-actions>button { min-height:56px; font-size:16px; }
.touch-ui .nudge-pad { grid-template-columns:repeat(2,48px); }
.touch-ui .nudge-pad button { width:48px; height:48px; font-size:14px; }
.touch-ui .overlay-label { top:72px; left:12px; font-size:13px; }
.touch-ui #notifications { top:72px; font-size:15px; }
@media (orientation:landscape) and (max-height:520px) {
  .touch-ui .build-panel,.touch-ui .inspector { left:auto; right:0; top:0; bottom:0; width:min(440px,70vw); max-height:100dvh; border-radius:20px 0 0 20px; }
  .touch-ui .placement-dock { left:auto; right:8px; width:min(420px,65vw); }
  .touch-ui .play-actions { left:auto; max-width:440px; }
  .touch-ui .modal { max-width:620px; }
  .touch-ui .hub-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
.touch-ui .build-panel>.between,.touch-ui .inspector>.between,.touch-ui .modal-header { position:sticky; top:-22px; z-index:3; background:#1b302d; padding:10px 0; }
.touch-ui .tier-badge { font-size:12px; }
@media (max-width:360px) {
  .touch-ui .play-actions { gap:6px; }
  .touch-ui .play-actions button { padding:10px 7px; font-size:15px; gap:5px; }
  .touch-ui .placement-actions { flex-wrap:wrap; }
  .touch-ui .nudge-pad { width:100%; grid-template-columns:repeat(4,1fr); }
  .touch-ui .nudge-pad button { width:100%; }
}

/* Screen-sized flow indicators stay legible at any camera distance. */
#app>#flow-markers { position:absolute; inset:0; pointer-events:none!important; z-index:6; }
.flow-port { position:absolute; transform:translate(-50%,-50%); display:flex; flex-direction:column; align-items:center; gap:1px; color:#69d9ff; filter:drop-shadow(0 2px 2px #000); }
.flow-port b { background:#10232cf2; border:2px solid currentColor; border-radius:7px; padding:3px 7px; font-size:14px; letter-spacing:.08em; }
.flow-out { color:#ffad55; }
.flow-arrow { font-size:34px; line-height:36px; font-weight:900; text-shadow:0 0 4px #000; }
.flow-diagram { display:flex; align-items:center; gap:7px; font-size:11px; line-height:1.5; }
.flow-diagram svg { width:64px; height:64px; flex-shrink:0; }
.flow-diagram b { color:#d8eee8; font-size:11px; }
.touch-ui .inspector.quick-inspector { top:auto; bottom:max(8px,env(safe-area-inset-bottom)); left:8px; right:8px; width:auto; max-height:180px; padding:12px 14px; border-radius:18px; }
.touch-ui .quick-inspector>.between { position:static; padding:0; background:none; align-items:center; }
.touch-ui .quick-inspector b { font-size:18px; }
.touch-ui .quick-inspector p { font-size:14px; margin:4px 0 8px; }
.quick-actions { display:flex; gap:10px; }
.quick-actions button { flex:1; min-height:52px; }
.touch-ui .flow-diagram,.touch-ui .flow-diagram b { font-size:12px; }
@media (orientation:landscape) and (max-height:520px) {
 .touch-ui .inspector.quick-inspector { left:auto; width:340px; right:8px; bottom:8px; padding:8px 12px; }
}
