/* Full-viewport 3D court (100vw x 100svh) in both landscape & portrait with floating corner thumb controls */
[data-game-surface],[data-game-surface] *{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:none}
html,body{margin:0;padding:0;width:100%;height:100svh;height:100dvh;overflow:hidden;overscroll-behavior:none;background:#192b35;position:fixed;inset:0}

/* Stage & Canvas: always 100% full screen */
#stage{
  position:fixed;
  inset:0;
  width:100vw;
  height:100svh;
  height:100dvh;
  max-width:none;
  aspect-ratio:auto;
  margin:0;
  z-index:1;
  background:#192b35;
}
#unity-canvas{width:100%;height:100%;display:block;outline:none;touch-action:none}

/* Touch Controls Overlay: anchored to bottom corners over the sand surround */
#controls{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:20;
  max-width:none;
  min-height:0;
  margin:0;
  padding:0 max(16px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:16px;
  pointer-events:none;
  touch-action:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
}

/* Touch geometry stays in CSS pixels: menu rem scaling must not shrink hit areas. */
.joystick-group{pointer-events:none;flex:1;max-width:200px;min-width:88px;height:160px}
.joystick-label{position:absolute;top:calc(100% + 6px);left:50%;transform:translateX(-50%);font-size:11px;line-height:14px;color:#F3E9CF;pointer-events:none}
#joystick{--pad:108px;box-sizing:border-box;width:100%;height:100%;position:relative;touch-action:none;pointer-events:auto;cursor:grab}
#joystick-base{position:absolute;left:var(--base-x,calc(var(--pad)/2 + 4px));top:var(--base-y,50%);transform:translate(-50%,-50%);width:var(--pad);height:var(--pad);box-sizing:border-box;border-radius:50%;pointer-events:none}
body.hand-left #joystick-base{left:var(--base-x,calc(100% - var(--pad)/2 - 4px))}
#joystick-base::before,#joystick-base::after{content:'';position:absolute;background:rgba(243,233,207,.2);pointer-events:none}
#joystick-base::before{width:1px;height:54%;left:50%;top:23%}
#joystick-base::after{height:1px;width:54%;top:50%;left:23%}
#stick{position:absolute;box-sizing:border-box;width:38%;height:38%;left:31%;top:31%;border-radius:50%;transform:translate(var(--stick-x,0px),var(--stick-y,0px));pointer-events:none;z-index:1}
#joystick.pressed{cursor:grabbing}

/* A thumb arc: primary low/outside, lob above/inside; auxiliaries remain separate. */
.actions{--cluster:232px;--primary:92px;--secondary:76px;position:relative;width:var(--cluster);height:160px;flex:none;pointer-events:none;touch-action:none}
.actions button{position:absolute;box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:4px;width:64px;height:44px;min-height:44px;padding:4px;line-height:1.1;font-size:12px;touch-action:none;pointer-events:auto;-webkit-tap-highlight-color:transparent;user-select:none}
.actions button[hidden]{display:none}
.actions .switch{left:0;top:0;width:44px}
.actions .switch svg{width:23px;height:23px}
.actions .control{left:0;bottom:0}
.actions .pass{right:8px;top:0}
.actions .strike{flex-direction:column;padding:8px;border-radius:50%;font-size:16px}
.actions .flat{right:0;bottom:0;width:var(--primary);height:var(--primary)}
.actions .lob{right:104px;bottom:52px;width:var(--secondary);height:var(--secondary);font-size:13px}
.actions .shot-glyph{width:30px;height:22px;flex:none;pointer-events:none}
.actions .strike span{pointer-events:none}
.actions .strike small,.actions .charge{display:none}
.actions button:disabled{opacity:.4;cursor:not-allowed}
.actions button:focus-visible,#joystick:focus-visible{outline:3px solid #F3E9CF;outline-offset:4px}

@media (min-width:1024px) and (min-height:600px){
 #controls{padding-right:max(28px,env(safe-area-inset-right));padding-left:max(28px,env(safe-area-inset-left));padding-bottom:max(24px,env(safe-area-inset-bottom))}
 #joystick{--pad:120px}
}
@media (orientation:landscape) and (max-height:420px){
 #controls{padding-bottom:max(10px,env(safe-area-inset-bottom))}
 #joystick{--pad:104px}
}
@media (orientation:portrait) and (max-width:420px){
 #controls{gap:8px;padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
 .actions{--cluster:200px;--primary:80px;--secondary:64px;height:156px}
 .actions .lob{right:88px;bottom:60px;font-size:12px}
 .actions .pass{right:0}
 #joystick{--pad:96px}
}
@media (max-width:359px){
 .actions{--cluster:192px;--primary:76px}
 .actions .lob{right:80px}
 #joystick{--pad:88px}
}

/* Slide to aim (touch-controls.js buttonMove, Roger 2026-11-07): four small chevrons round PLANO and GLOBO say the button
   can be dragged; held, a ring appears; dragging moves its label with the thumb while the court's target follows. */
body[data-virtua="true"] .actions .strike::after{content:"";position:absolute;inset:-10px;border-radius:50%;pointer-events:none;opacity:.6;
 background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23F3E9CF' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M44 7l6-5 6 5M44 93l6 5 6-5M7 44l-5 6 5 6M93 44l5 6-5 6'/%3E%3C/svg%3E") center/100% 100% no-repeat;
 transition:inset .12s,opacity .12s}
body[data-virtua="true"] .actions .strike.pressed::after{inset:-16px;opacity:1;border:2px solid rgba(255,210,63,.85)}
body[data-virtua="true"] .actions .strike > *{transition:transform .05s linear}
body[data-virtua="true"] .actions .strike[data-sliding] > *{transform:translate(var(--slide-x,0),var(--slide-y,0))}
