#unity-canvas, #touch-drive {
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
#touch-drive {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  --pad: clamp(10px, 2.5vmin, 24px);
  --stick: clamp(112px, 24vmin, 164px);
  --button: clamp(48px, 8.8vmin, 68px);
  --paper: #fff9e8;
  --gold: #ffd064;
  --ink: #292432;
  color: var(--paper);
  font: 750 clamp(12px, 2vmin, 17px)/1 system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
/* Unity also measures these boxes when laying out the countdown HUD. */
#touch-drive[hidden] { display: block; visibility: hidden; }
#steer-pad, #touch-drive .powers {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--pad));
}
#steer-pad {
  left: calc(env(safe-area-inset-left, 0px) + var(--pad));
  width: var(--stick);
  height: var(--stick);
  border-radius: 50%;
  pointer-events: auto;
}
.stick-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 2px solid #fff5d7a6;
  background: radial-gradient(circle, #29243299 43%, #292432b8 70%);
  box-shadow: inset 0 0 0 3px #29243273, 0 2px 4px #241e294a;
  transform: translate(var(--base-x, 0px), var(--base-y, 0px));
  pointer-events: none;
}
.stick-ring::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: inherit;
  border: 1px solid #fff4d633;
  background: linear-gradient(90deg, #ffeec4a6 7%, transparent 7% 93%, #ffeec4a6 93%) center / 100% 3px no-repeat;
}
.stick-cap {
  position: absolute;
  inset: 28%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid #fff2d2dc;
  background: linear-gradient(155deg, #827b83, #514b5a 68%);
  box-shadow: inset 0 -3px 0 #30283566, 0 3px 5px #19152180;
  transform: translate(var(--cap-x, 0px), var(--cap-y, 0px));
}
.stick-cap::after {
  content: "";
  width: 35%;
  height: 22%;
  border-block: 2px solid #fff7df99;
  background: linear-gradient(#fff7df99, #fff7df99) center / 100% 2px no-repeat;
  transform: skewX(-12deg);
}
#steer-pad.held .stick-cap { border-color: var(--gold); }
#touch-drive .powers {
  right: calc(env(safe-area-inset-right, 0px) + var(--pad));
  width: calc(var(--button) * 2.22);
  height: calc(var(--button) * 2.54);
}
#touch-drive button {
  --accent: var(--paper);
  position: absolute;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  width: var(--button);
  height: var(--button);
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: linear-gradient(155deg, #484052dd, #282431e8 80%);
  box-shadow: inset 0 -3px 0 #14121b50, 0 2px 4px #20192655;
  color: var(--paper);
  font: inherit;
  pointer-events: auto;
  touch-action: none;
}
#touch-drive button > * { pointer-events: none; }
#touch-drive button i { display: block; color: var(--accent); }
#touch-drive .brake { top: 0; right: 5%; --accent: #ffb39c; }
.brake i {
  width: 16px;
  height: 12px;
  border-inline: 5px solid currentColor;
  transform: skewX(-14deg);
}
#touch-drive .item { left: 0; top: 29%; --accent: #8ae7db; }
.item i {
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  font: 800 12px/14px system-ui, sans-serif;
  transform: rotate(-8deg);
}
#touch-drive .drift {
  --accent: var(--gold);
  right: 0; bottom: 0;
  width: calc(var(--button) * 1.22);
  height: calc(var(--button) * 1.22);
  font-size: 1.12em;
}
.drift i {
  width: 23px;
  height: 14px;
  border-inline: 4px solid currentColor;
  border-radius: 0 0 55% 30%;
  transform: skewX(-25deg);
}
#touch-drive .pause {
  top: calc(env(safe-area-inset-top, 0px) + var(--pad));
  left: calc(50% - 22px);
  width: 44px; height: 44px;
  border-color: #fff9e8a3;
}
#touch-drive .pause span { width: 13px; height: 14px; border-inline: 4px solid currentColor; }
#touch-drive button.held { background: var(--accent); color: var(--ink); }
#touch-drive button.held i { color: var(--ink); }
#touch-drive button:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  #steer-pad:not(.held) .stick-cap, #steer-pad:not(.held) .stick-ring { transition: transform 75ms ease-out; }
}
