/* Jungle Rally - mobile landscape. Everything here is scoped to html.touch (set by src/touch.js on touch devices),
   so the desktop layout is unchanged. */
#touch, #rotate, .touchhelp { display: none; }
html.touch, html.touch body { position: fixed; inset: 0; height: 100dvh; overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.touch canvas.game { touch-action: none; }
html.touch { --sl: max(10px, env(safe-area-inset-left)); --sr: max(10px, env(safe-area-inset-right)); --sb: max(10px, env(safe-area-inset-bottom)); --b: min(78px, 20vh); }

/* compact HUD: lap top left, speed + NOS top centre, time top right, map under the time */
html.touch .tag { padding: 3px 9px; gap: 5px; border-radius: 5px; box-shadow: 2px 3px 0 rgba(58, 40, 14, .35); }
html.touch .tag b { font-size: 17px; margin-right: 6px; }
html.touch .lbl { font-size: 9px; }
html.touch .tl { left: var(--sl); top: 8px; }
html.touch .tr { right: var(--sr); top: 8px; }
html.touch .bl { left: 50%; top: 8px; bottom: auto; transform: translateX(-50%); flex-direction: row; align-items: center; min-width: 0; gap: 10px; }
html.touch .speed b { font-size: 24px; margin-right: 3px; }
html.touch .nos .bar { width: 84px; flex: none; height: 11px; }
html.touch .br { right: var(--sr); top: 44px; bottom: auto; width: min(92px, 24vh); height: min(92px, 24vh); padding: 2px; }
html.touch #msg { top: 26%; font-size: 19px; padding: 5px 14px; }
html.touch #count { top: 46%; font-size: min(150px, 38vh); }

/* controls */
html.touch #touch { display: block; }
#touch > * { position: absolute; pointer-events: auto; touch-action: none; }
#pad { left: var(--sl); bottom: var(--sb); width: min(210px, 30vw); height: var(--b); border-radius: 999px; background: rgba(242, 227, 192, .62);
       border: 2px solid #4a3220; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; box-sizing: border-box;
       font-size: 22px; color: #4a3220; }
#knob { position: absolute; left: 50%; top: 50%; width: calc(var(--b) * .72); height: calc(var(--b) * .72); margin: calc(var(--b) * -.36) 0 0 calc(var(--b) * -.36);
        border-radius: 50%; background: #2f6b4f; border: 2px solid #4a3220; box-shadow: 2px 3px 0 rgba(58, 40, 14, .4); box-sizing: border-box; pointer-events: none; }
#tbtns { right: var(--sr); bottom: var(--sb); display: grid; grid-template-columns: repeat(2, var(--b)); grid-auto-rows: var(--b); gap: 9px; }
#tutil { left: 50%; bottom: var(--sb); transform: translateX(-50%); display: flex; gap: 7px; }
#touch button { font: bold 12px Georgia, serif; letter-spacing: .04em; padding: 0; color: #2b2416; background: rgba(242, 227, 192, .78);
                border: 2px solid #4a3220; border-radius: 14px; box-shadow: 2px 3px 0 rgba(58, 40, 14, .4); }
#touch button.gasb { background: rgba(47, 107, 79, .88); color: #f2e3c0; font-size: 15px; }
#touch button.nosb { background: rgba(60, 143, 176, .9); color: #f2e3c0; font-size: 15px; }
#touch button.down { transform: translate(2px, 3px); box-shadow: none; filter: brightness(1.18); }
#touch button.nosb.down { background: #e2503a; }
#tutil button { width: 46px; height: 30px; border-radius: 8px; font-size: 10px; }

/* the menu sheet on a short screen */
html.touch .sheet { padding: 12px 22px 16px; max-height: 92dvh; overflow: auto; box-sizing: border-box; width: min(560px, 90vw); }
html.touch .sheet h1 { font-size: 34px; }
html.touch .sheet .sub { margin-bottom: 8px; font-size: 14px; }
html.touch .sheet table { display: none; }
html.touch .touchhelp { display: block; margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #2b2416; }
html.touch .sheet button { font-size: 20px; padding: 8px 34px; }

/* held upright: ask for landscape (the race waits) */
#rotate { position: fixed; inset: 0; z-index: 10; background: #2f6b4f; color: #f2e3c0; align-items: center; justify-content: center; flex-direction: column;
          gap: 14px; text-align: center; font: bold 22px Georgia, serif; padding: 24px; }
#rotate i { font-style: normal; font-size: 64px; display: block; animation: turn 1.8s ease-in-out infinite; }
@keyframes turn { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
@media (orientation: portrait) { html.touch #rotate { display: flex; } }
