/* Tablet and touch interaction layer. Desktop layout and controls remain intact. */
:root{--touch-target:48px}
html{-webkit-text-size-adjust:100%}
button{-webkit-tap-highlight-color:transparent}
.tablet-controls-toggle,.tablet-controls-head{display:none}
.route-draw-cancel{display:none}
.route-touch-hit{fill:none!important;stroke:#000!important;stroke-width:28px!important;stroke-opacity:.001!important;pointer-events:stroke!important;cursor:pointer}
.nurse-touch-hit{fill:transparent;stroke:transparent;stroke-width:12px;pointer-events:all;cursor:pointer}
.touch-pressed{filter:brightness(1.15) drop-shadow(0 0 8px #fff)!important}

@media (hover:none),(pointer:coarse){
  body{min-width:0;overscroll-behavior:none}
  .game-shell{height:100dvh;min-height:0;overflow:hidden;padding-top:env(safe-area-inset-top);padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
  .game-shell>header{height:74px;min-height:74px;padding:8px 12px;gap:10px;flex-wrap:nowrap}
  .brand-mark{font-size:28px}.brand b{font-size:17px}.brand small{font-size:8px}
  .resources{min-width:0;gap:6px;overflow:hidden}.resource,.goal{min-width:0;padding:6px 9px}.resource>span{font-size:18px}.resource small,.goal small{font-size:8px}.resource b,.goal b{font-size:12px}.goal{max-width:240px}
  #layoutEditorToggle{display:none}
  .tablet-controls-toggle{display:flex;flex:0 0 auto;align-items:center;justify-content:center;gap:5px;min-width:var(--touch-target);height:var(--touch-target);padding:0 12px;border:2px solid #2f6f48;border-radius:24px;background:#173f29;color:#fff;font-weight:900}.tablet-controls-toggle span{font-size:20px}.tablet-controls-toggle b{font-size:11px}
  .play-area{display:flex;align-items:center;justify-content:center;min-height:0;padding:8px;gap:0}
  .world{flex:0 1 auto;width:min(100%,calc((100dvh - 98px - env(safe-area-inset-top) - env(safe-area-inset-bottom))*45/31));max-width:100%;max-height:calc(100dvh - 98px - env(safe-area-inset-top) - env(safe-area-inset-bottom));touch-action:manipulation;user-select:none;-webkit-user-select:none}
  .controls{position:fixed;z-index:80;top:calc(74px + env(safe-area-inset-top));right:env(safe-area-inset-right);bottom:env(safe-area-inset-bottom);width:min(360px,88vw);padding:14px 18px 30px;overflow:auto;border-radius:16px 0 0 16px;transform:translateX(calc(100% + env(safe-area-inset-right)));transition:transform .22s ease;box-shadow:-18px 0 42px #10291466;overscroll-behavior:contain}
  body.tablet-controls-open .controls{transform:translateX(0)}
  body.tablet-controls-open:after{content:"";position:fixed;z-index:79;inset:calc(74px + env(safe-area-inset-top)) 0 0;background:#14201880}
  body.tablet-layout-editor-open:after{display:none}
  .tablet-controls-head{position:sticky;z-index:2;top:-14px;display:flex;align-items:center;justify-content:space-between;margin:-14px -18px 12px;padding:12px 16px;border-bottom:1px solid var(--line);background:#fffdf8}.tablet-controls-head>b{font:700 20px Georgia,serif}.tablet-controls-head button{display:grid;place-items:center;width:var(--touch-target);height:var(--touch-target);border:0;border-radius:50%;background:#eee6d6;font-size:28px}
  .controls button,.cell-action-menu button{min-height:var(--touch-target)}
  .tablet-editor-button{display:block}
  .cell-action-menu{width:220px;padding:10px}.cell-action-menu button{padding:9px}.cell-action-menu b{font-size:13px}.cell-action-menu em{font-size:10px}
  .route-handle{width:56px;height:56px;border-width:4px;font-size:25px;touch-action:none}.route-handle:before{content:"";position:absolute;inset:-10px;border:2px solid currentColor;border-radius:50%;opacity:.35}
  .map-delete-route{width:52px;height:52px;font-size:31px;touch-action:manipulation}
  .nurse-marker{font-size:34px}
  .cell{touch-action:manipulation}
  .flower.individual-flower{min-width:28px;min-height:28px;touch-action:manipulation}
  .world.drawing,.world.layout-editing{touch-action:none}
  .world,.world *{-webkit-touch-callout:none}
  .world.drawing .route-handle{display:none!important}
  .route-draw-cancel{position:absolute;z-index:30;right:14px;bottom:14px;min-width:124px;height:48px;padding:0 16px;border:3px solid #fff;border-radius:24px;background:#2c2923;color:#fff;font-weight:900;box-shadow:0 5px 18px #0007}.route-draw-cancel:not([hidden]){display:block}
  .active-route{animation:none!important}
  .flying,.nurse-marker,.perf-enemy-body{will-change:transform}
  .landscape-item,.flower img{will-change:auto!important}
  .toast{bottom:max(18px,env(safe-area-inset-bottom));max-width:80%;text-align:center}
  .lesson-card{width:min(620px,90vw);max-height:88dvh;overflow:auto;padding:28px}.lesson-card p{font-size:16px}
}

@media (hover:none) and (pointer:coarse) and (orientation:portrait){
  body:not(.landing-active) .play-area:before{content:"Rotate your iPad to landscape for the best hive experience.";position:fixed;z-index:120;inset:0;display:grid;place-items:center;padding:40px;background:#173f29ee;color:#fff;text-align:center;font:700 24px/1.35 Georgia,serif}
}

@media (prefers-reduced-motion:reduce){.controls{transition:none}.route-handle:before{animation:none}}
