.touch-controls{position:absolute;inset:0;pointer-events:none;z-index:3;--touch-opacity:.7;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.touch-controls button{pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;border:1px solid #c6d9df80;background:rgb(17 33 41 / var(--touch-opacity));color:#f0f5f4;border-radius:16px;font:700 12px/1.3 Manrope,sans-serif;min-height:44px;min-width:44px;box-shadow:0 2px 6px #0005}.touch-controls button.pressed{background:#eeb750df;border-color:#ffe8b1;color:#17262c}.touch-toolbar{position:absolute;top:max(10px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));display:flex;justify-content:space-between;pointer-events:none}.touch-toolbar button{min-height:42px;padding:8px 13px;font-size:15px}.touch-toolbar span{font-size:10px}.touch-steering{position:absolute;left:max(14px,env(safe-area-inset-left));bottom:max(15px,env(safe-area-inset-bottom));display:grid;grid-template-columns:1fr 1fr;width:calc(180px * var(--touch-size));height:calc(84px * var(--touch-size));gap:5px;pointer-events:auto;touch-action:none}.touch-steering>span{position:absolute;bottom:7px;left:0;right:0;text-align:center;font-size:8px;letter-spacing:1.5px;pointer-events:none;color:#b5cbd3}.touch-steering button{font-size:29px;padding-bottom:15px}.touch-steering button:first-child{border-radius:24px 10px 10px 24px}.touch-steering button:last-child{border-radius:10px 24px 24px 10px}.touch-pedals{position:absolute;right:max(14px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));display:grid;gap:7px;width:calc(178px * var(--touch-size))}.touch-pedal-row,.touch-aux{display:grid;grid-template-columns:1fr 1fr;gap:7px}.touch-pedal-row button{height:calc(78px * var(--touch-size))}.touch-aux button{height:calc(44px * var(--touch-size));font-size:10px}.touch-controls .touch-gas{font-size:22px;border-color:#b9e8d2;background:rgb(35 85 69 / var(--touch-opacity))}.touch-controls .touch-nitro{color:#ffd47d;border-color:#ddb76d}.touch-brake small{font-size:8px;font-weight:400}.touch-utilities{position:absolute;left:50%;bottom:max(14px,env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;gap:5px}.touch-utilities button{width:44px;height:44px;font-size:17px}.touch-utilities span{display:block;font-size:6px;line-height:1.7}.touch-controls[data-hand=left] .touch-pedals{right:auto;left:max(14px,env(safe-area-inset-left))}.touch-controls[data-hand=left] .touch-steering{left:auto;right:max(14px,env(safe-area-inset-right))}.touch-rotate{display:none;position:absolute;top:65px;left:50%;transform:translateX(-50%);background:#152c36e8;border:1px solid #8aabb7;padding:8px 9px 8px 14px;max-width:90%;width:max-content;font-size:10px;border-radius:8px}.touch-rotate button{min-height:30px;min-width:30px;margin-left:10px;border:0;background:transparent}.touch-rotate.dismissed{display:none!important}.touch-settings .setting-select{margin-bottom:16px}.touch-settings .range{margin-bottom:18px}.touch-input-available #screen{touch-action:none}.touch-input-available #screen canvas{touch-action:none}.touch-input-available .spectator-panel{bottom:calc(55px + env(safe-area-inset-bottom))}.touch-input-available .spectator-panel button{min-height:44px;min-width:44px}
@media(orientation:portrait){.touch-input-available .touch-rotate{display:block}.touch-utilities{bottom:calc(120px * var(--touch-size) + env(safe-area-inset-bottom))}.touch-steering{width:calc(156px * var(--touch-size));height:calc(78px * var(--touch-size))}.touch-pedals{width:calc(156px * var(--touch-size))}.touch-input-available .touch-rotate{top:120px}}
@media(max-height:460px) and (orientation:landscape){.touch-utilities{bottom:10px}}

body.touch-input-available:has(#play:not([hidden])){overscroll-behavior:none}.touch-settings{grid-column:1/-1}@media(pointer:coarse){input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea{font-size:16px!important}button,.text-button{min-height:44px}.arena-pick{min-height:44px}}

@media(orientation:landscape) and (min-width:701px){.touch-toolbar{left:50%;right:auto;transform:translateX(-50%);width:520px}}@media(orientation:landscape) and (max-width:700px){.touch-toolbar{top:68px}}.touch-pedals{bottom:max(38px,env(safe-area-inset-bottom))}

/* Thumb controls use the whole steering area, including its neutral centre. */
.touch-steering{width:calc(180px * var(--touch-size));height:calc(104px * var(--touch-size));gap:0;border:1px solid #d5e0dc80;border-radius:18px;background:rgb(17 33 41 / var(--touch-opacity));overflow:hidden}
.touch-steering button,.touch-steering button:first-child,.touch-steering button:last-child{border:0;border-radius:0;background:transparent;box-shadow:none;font-size:23px;padding:0 0 16px;color:#e8edeb}
.touch-steering button.pressed{background:#ffbc532b;color:#ffd69a}.touch-steering>span{bottom:9px;font-size:10px;letter-spacing:0;line-height:1.3}
.touch-steering-track{position:absolute;left:25px;right:25px;top:43%;height:3px;background:#a5c1c580;pointer-events:none;display:block;font-style:normal}.touch-steering-track>i{position:absolute;left:calc(50% + var(--steer,0) * 44%);top:50%;transform:translate(-50%,-50%);width:23px;height:23px;border:2px solid #ffce80;border-radius:50%;background:#c49043;box-shadow:0 0 0 5px #f4bb5520;pointer-events:none}
.touch-controls[data-steering=buttons] .touch-steering-track{display:none}.touch-controls[data-steering=buttons] .touch-steering{gap:4px;background:none;border:0;overflow:visible}.touch-controls[data-steering=buttons] .touch-steering button{border:1px solid #c6d9df80;border-radius:16px;background:rgb(17 33 41 / var(--touch-opacity))}
.touch-pedals{width:calc(184px * var(--touch-size));bottom:max(16px,env(safe-area-inset-bottom))}.touch-pedal-row{grid-template-columns:.85fr 1.15fr}.touch-pedal-row button{height:calc(86px * var(--touch-size));font-size:13px}.touch-controls .touch-gas{font-size:24px}.touch-aux button{font-size:11px;min-height:44px}.touch-brake small{font-size:10px}.touch-utilities span{font-size:9px}.touch-utilities button{width:48px;height:48px}
.touch-toolbar{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));top:max(10px,env(safe-area-inset-top));width:auto;transform:none}.touch-toolbar button{min-height:44px}
@media(orientation:portrait){.touch-steering{width:calc(154px * var(--touch-size));height:calc(100px * var(--touch-size))}.touch-pedals{width:calc(154px * var(--touch-size))}.touch-utilities{bottom:calc(160px * var(--touch-size) + env(safe-area-inset-bottom))}.touch-rotate{top:130px!important}}
@media(max-width:700px) and (orientation:landscape){.touch-steering{width:calc(154px * var(--touch-size));height:calc(90px * var(--touch-size))}.touch-pedals{width:calc(158px * var(--touch-size))}.touch-pedal-row button{height:calc(66px * var(--touch-size))}.touch-aux button{height:44px}.touch-toolbar button span{display:none}.touch-toolbar button{width:44px;padding:8px}.touch-utilities{bottom:12px}.touch-utilities button{width:44px;height:44px}}
@media(orientation:landscape) and (min-height:360px){.touch-pedals{bottom:max(88px,env(safe-area-inset-bottom))}}

/* Touch driving stays in the margins of the native picture and instruments. */
.touch-frame {
  --touch-size: 1;
  --deck: min(230px, calc(64px + 145px * var(--touch-size)));
  --steer-block: min(106px, calc(88px * var(--touch-size)), 36%);
  --touch-pedal-height: min(94px, calc(73px * var(--touch-size)));
  --touch-aux-height: max(44px, calc(44px * var(--touch-size)));
}
.touch-frame canvas { place-self: start center; }
.touch-frame .touch-rotate { display: none; }
@media (orientation: portrait) {
  .touch-frame { --touch-sides: calc(max(14px, env(safe-area-inset-left)) + max(14px, env(safe-area-inset-right))); }
  #match-surface #screen.touch-frame canvas,
  #play .solo-race-frame.touch-frame canvas { height: calc(100% - var(--deck) - env(safe-area-inset-bottom)); }
  #screen.touch-frame .spectator-view { height: calc(100% - var(--deck) - env(safe-area-inset-bottom)); }
  .touch-frame .touch-steering,
  .touch-frame .touch-pedals { width: min(calc(156px * var(--touch-size)), calc((100% - var(--touch-sides) - 6px) / 2)); }
  .touch-frame .touch-steering { height: var(--steer-block); }
  .touch-frame .touch-pedal-row button { height: var(--touch-pedal-height); }
  .touch-frame .touch-aux button { height: var(--touch-aux-height); }
  .touch-frame .touch-utilities { bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--touch-pedal-height) + var(--touch-aux-height) + 15px); }
}
@media (orientation: landscape) {
  .touch-frame {
    --touch-safe-inline: max(7px, env(safe-area-inset-left), env(safe-area-inset-right));
    --rail: calc(min(21vw, calc(198px * var(--touch-size))) + var(--touch-safe-inline) - 7px);
    --touch-rail-content: calc(var(--rail) - 6px - var(--touch-safe-inline));
  }
  #match-surface #screen.touch-frame canvas,
  #play .solo-race-frame.touch-frame canvas { width: calc(100% - var(--rail) * 2); position: relative; margin-inline: auto; }
  #screen.touch-frame .spectator-view { width: calc(100% - var(--rail) * 2); inset-inline: var(--rail); }
  .touch-frame .touch-steering,
  .touch-frame .touch-pedals {
    width: var(--touch-rail-content);
    bottom: max(9px, env(safe-area-inset-bottom));
  }
  .touch-frame .touch-steering { left: var(--touch-safe-inline); height: var(--steer-block); }
  .touch-frame .touch-pedals { right: var(--touch-safe-inline); }
  .touch-frame .touch-controls[data-hand="left"] .touch-steering { left: auto; right: var(--touch-safe-inline); }
  .touch-frame .touch-controls[data-hand="left"] .touch-pedals { left: var(--touch-safe-inline); right: auto; }
  .touch-frame .touch-pedal-row,
  .touch-frame .touch-aux { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .touch-frame .touch-pedal-row button { padding: 3px 1px; border-radius: 12px; }
  .touch-frame .touch-aux button { padding: 3px 1px; border-radius: 10px; white-space: normal; }
  .touch-frame .touch-utilities {
    bottom: calc(max(9px, env(safe-area-inset-bottom)) + var(--steer-block) + 7px);
    left: var(--touch-safe-inline);
    width: var(--touch-rail-content);
    transform: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }
  .touch-frame .touch-controls[data-hand="left"] .touch-utilities { left: auto; right: var(--touch-safe-inline); }
  .touch-frame .touch-utilities button { width: 100%; padding: 0 1px; border-radius: 10px; }
  .touch-frame .touch-aux button, .touch-frame .touch-brake { font-size: clamp(9px, 1.4vw, 13px); }
  .touch-frame .touch-driving .touch-gas { font-size: clamp(16px, 3vw, 24px); }
}
.touch-frame .touch-controls[data-context="flight"] :is(.touch-gas,.touch-brake) { font-size:clamp(11px,3.8vw,15px);line-height:1.15 }
@media (orientation: landscape) and (max-width: 760px) {
  .touch-frame .touch-utilities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .touch-frame .touch-utilities button { height: 44px; }
  .touch-frame .touch-aux button { overflow-wrap: anywhere; }
}
