.viewport { --control-height: 0px; --control-safe: 0px; --stick-size: 120px; }
.viewport:fullscreen { --control-safe: env(safe-area-inset-bottom, 0px); }
.viewport.has-stick { --control-height: calc(140px + var(--control-safe)); }
.has-stick canvas { height: calc(100% - var(--control-height)); }
.has-stick .checkpoint-layer { bottom: var(--control-height); clip-path: inset(0); }
.mobile-controls { position: absolute; inset: auto 0 0; height: var(--control-height); z-index: 3; border-top: 1px solid #202020; background: linear-gradient(180deg, #0b0b0b, #0e0e0e); }
.mobile-controls button { -webkit-tap-highlight-color: transparent; }
.joystick-pad { position: absolute; bottom: 10px; left: 12px; width: var(--stick-size); height: var(--stick-size); padding: 0; border: 1px solid #313131; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; background: radial-gradient(ellipse at 50% 30%, #191919, #0b0b0b 72%); box-shadow: 0 1px 0 #ffffff0d, inset 0 1px 2px #ffffff0a, inset 0 -2px 6px #000; transition: border-color 160ms, opacity 160ms; }
.joystick-pad:disabled { opacity: 0.55; cursor: default; }
.joystick-pad.is-active { cursor: grabbing; border-color: #5a4934; }
.joystick-track { position: absolute; inset: 10px; border: 1px solid #252525; border-radius: 50%; box-shadow: inset 0 2px 8px #0008; background: linear-gradient(#646464, #646464) center 3px / 1px 6px no-repeat, linear-gradient(#646464, #646464) center calc(100% - 3px) / 1px 6px no-repeat, linear-gradient(#646464, #646464) 3px center / 6px 1px no-repeat, linear-gradient(#646464, #646464) calc(100% - 3px) center / 6px 1px no-repeat; pointer-events: none; }
.joystick-track::after { content: ""; position: absolute; inset: 19px; border: 1px solid #ffffff08; border-radius: 50%; }
.joystick-knob { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 1px solid #616161; border-radius: 50%; transform: translate3d(var(--stick-x, 0px), var(--stick-y, 0px), 0); background: radial-gradient(ellipse at var(--stick-light-x, 50%) var(--stick-light-y, 35%), #444, #232323 60%, #191919); box-shadow: 0 6px 12px #000b, 0 1px 3px #000, inset 0 1px 1px #ffffff40, inset 0 -2px 2px #0007; pointer-events: none; }
.joystick-knob::before { content: ""; position: absolute; inset: 3px; border: 1px solid #ffffff0a; border-radius: 50%; }
.joystick-knob::after { content: ""; position: absolute; inset: -4px; border: 1px solid rgba(255,138,0, calc(var(--stick-power, 0) * 0.65)); border-radius: 50%; }
.joystick-grip { position: absolute; inset: 14px; border-radius: 50%; background-image: radial-gradient(#ffffff45 0.6px, transparent 0.9px); background-size: 4px 4px; opacity: 0.45; }
.joystick-pad.is-blocked .joystick-knob::after { opacity: 0.35; }
.joystick-pad.is-active .joystick-knob { will-change: transform; }
.stick-hand { position: absolute; left: calc(50% - 22px); bottom: 28px; width: 44px; height: 44px; color: #737373; }
.stick-hand svg { width: 16px; height: 16px; }
.has-stick .floor-status { left: 50%; right: auto; bottom: 102px; transform: translateX(-50%); padding-left: 8px; font-size: 11px; z-index: 4; }
.has-stick .minimap { right: 12px; left: auto; bottom: 12px; width: 128px; padding: 9px; z-index: 4; }
.has-stick .minimap svg { height: 70px; }
.has-stick .map-heading { font-size: 8px; margin-bottom: 7px; }
.has-stick .ready-dock { bottom: calc(var(--control-height) + 24px); }
.has-stick[data-stick-hand="right"] .joystick-pad { left: auto; right: 12px; }
.has-stick[data-stick-hand="right"] .minimap { right: auto; left: 12px; }
.has-stick .joystick-pad { bottom: calc(10px + var(--control-safe)); }
.has-stick .stick-hand { bottom: calc(28px + var(--control-safe)); }
.has-stick .floor-status { bottom: calc(102px + var(--control-safe)); }
.has-stick .minimap { bottom: calc(12px + var(--control-safe)); }
.has-stick:fullscreen .joystick-pad { left: max(12px, env(safe-area-inset-left)); }
.has-stick:fullscreen .minimap { right: max(12px, env(safe-area-inset-right)); }
.has-stick:fullscreen[data-stick-hand="right"] .joystick-pad { left: auto; right: max(12px, env(safe-area-inset-right)); }
.has-stick:fullscreen[data-stick-hand="right"] .minimap { right: auto; left: max(12px, env(safe-area-inset-left)); }
@media (any-pointer: coarse) {
  .app-shell { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
}
@media (max-width: 360px) {
  .viewport.has-stick { --stick-size: 108px; --control-height: calc(128px + var(--control-safe)); }
  .has-stick .minimap { width: 112px; }
  .has-stick .floor-status { bottom: calc(94px + var(--control-safe)); }
  .has-stick .stick-hand { bottom: calc(23px + var(--control-safe)); }
}
@media (max-height: 500px) and (min-width: 600px) {
  .viewport.has-stick { --stick-size: 92px; --control-height: calc(112px + var(--control-safe)); }
  .has-stick .minimap { width: 112px; }
  .has-stick .minimap svg { height: 58px; }
  .has-stick .floor-status { bottom: calc(80px + var(--control-safe)); }
  .has-stick .stick-hand { bottom: calc(17px + var(--control-safe)); }
  .has-stick .ready-dock { bottom: calc(var(--control-height) + 12px); }
  .has-stick .ready-dock .luma-action { height: 44px; }
}
