/* Doughnut Run 2 – mobile play layout (run2-mobilefix copy, 31 Oct). Only applies on phones / touch,
   and only while a run or flight is in progress (body.r2-playing is set by game/mobile.js). Menus untouched. */
:root{--sa-t:env(safe-area-inset-top,0px);--sa-r:env(safe-area-inset-right,0px);--sa-b:env(safe-area-inset-bottom,0px);--sa-l:env(safe-area-inset-left,0px)}
@media (max-width:760px),(max-height:500px),(pointer:coarse){
  /* 1. Nothing but the game: site nav (logo, links, graphics select, account), grain, keyboard hints go */
  body.r2-playing .r2-nav, body.r2-playing .r2-grain, body.r2-playing #r2-flight-hint, body.r2-playing .touch-look-hint, body.r2-playing .touch-caption{display:none!important}
  /* 2. Run mode: one slim score strip at the top, challenge/streak/street name hidden */
  body.r2-playing .r2-hud{top:calc(var(--sa-t) + 8px);left:calc(var(--sa-l) + 8px);right:auto;max-width:none;gap:4px;flex-wrap:nowrap}
  body.r2-playing .r2-stat{padding:5px 9px;border-radius:8px}
  body.r2-playing .r2-stat span{font-size:8px;letter-spacing:.1em}
  body.r2-playing .r2-stat b{font-size:16px;line-height:1.1}
  body.r2-playing .r2-where, body.r2-playing .r2-objective, body.r2-playing .r2-chase{display:none!important}
  body.r2-playing .r2-turn{top:auto;bottom:calc(var(--sa-b) + 28%);font-size:15px;padding:9px 14px}
  body.r2-playing .r2-banner{top:22%;font-size:14px;padding:8px 14px}
  body.r2-playing .r2-count{font-size:84px}
  /* 3. Pause + mode switch: 48px thumb targets, top-right, inside safe area */
  body.r2-playing .r2-pause-button{top:calc(var(--sa-t) + 8px);right:calc(var(--sa-r) + 8px);width:48px;height:48px;font-size:16px}
  body.r2-playing .game-switch-btn{top:calc(var(--sa-t) + 8px);right:calc(var(--sa-r) + 64px);min-height:48px;padding:0 12px;font-size:10px;border-radius:24px}
  /* 4. Flight mode: gate timer + score as small top chips, gauges reduced to one bottom-centre strip
        between the joystick (left) and action buttons (right) */
  body.r2-playing .r2-flight-card{top:calc(var(--sa-t) + 8px);left:calc(var(--sa-l) + 8px);width:auto;padding:6px 10px;gap:3px;grid-template-columns:auto auto;align-items:baseline;column-gap:8px}
  body.r2-playing .r2-flight-card>span{font-size:8px}
  body.r2-playing .r2-flight-card>b{font-size:18px}
  body.r2-playing .r2-flight-card>small{display:none}
  body.r2-playing .r2-flight-card .r2-meter{grid-column:1/-1}
  body.r2-playing .r2-flight-gauges{left:50%;transform:translateX(-50%);bottom:calc(var(--sa-b) + 8px);width:auto;padding:6px 10px;display:flex;gap:10px;align-items:center;border-radius:10px}
  body.r2-playing .r2-flight-gauges>div:nth-child(2){display:none} /* altitude */
  body.r2-playing .r2-flight-gauges span{font-size:7px;letter-spacing:.1em}
  body.r2-playing .r2-flight-gauges b{font-size:14px}
  body.r2-playing .r2-flight-gauges em{display:none}
  body.r2-playing .r2-flight-gauges .bar{width:46px}
  body.r2-playing .r2-flight-gauges .score{display:block}
  body.r2-playing .r2-flight-gauges .score small{display:none}
  body.r2-playing #r2-gate-pointer{font-size:11px;padding:5px 9px}
  /* 5. Touch controls: bigger, thumb-reachable, inside the safe area */
  body.r2-playing #touch-controls{left:0;right:0;bottom:calc(var(--sa-b) + 10px);padding:0 calc(var(--sa-r) + 14px) 0 calc(var(--sa-l) + 14px)}
  body.r2-playing #touch-stick{width:140px;height:140px}
  body.r2-playing .touch-action{width:64px;height:64px}
}
/* phone portrait: gauges sit above the controls so they never cover a thumb */
@media (max-width:500px){
  body.r2-playing .r2-flight-gauges{bottom:calc(var(--sa-b) + 184px)}
}
/* phone landscape: very little height, so hide the run-mode sprinkles count and the switch label */
@media (max-height:500px){
  body.r2-playing .r2-stat:nth-child(3){display:none}
  body.r2-playing .r2-turn{bottom:calc(var(--sa-b) + 18%)}
  body.r2-playing #touch-stick{width:116px;height:116px}
}

/* Touch: the browser must never take a swipe for page scroll/zoom, or it cancels the pointer and the swipe is lost.
   Applies on every screen size (touch laptops too), not only while playing. */
html,body,#canvas-container,#canvas-container canvas{touch-action:none;overscroll-behavior:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
.r2-panel,.r2-panel *{touch-action:manipulation}
