* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #071e12;
  font-family: 'Inter', sans-serif;
  touch-action: none;
}
#game-canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
}
/* Floating HUD Layer */
#ui-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.interactive {
  pointer-events: auto;
}
/* Floating 3D-projected Badges */
.world-label {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: none;
  transition: opacity 0.15s ease;
  will-change: transform, left, top;
}
/* Custom floating combat text animation */
@keyframes floatUpFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.7); }
  25% { opacity: 1; transform: translate(-50%, -90%) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.95); }
}
.floating-callout {
  position: absolute;
  pointer-events: none;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: floatUpFade 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  text-shadow: 0 3px 10px rgba(0,0,0,0.65);
  white-space: nowrap;
  z-index: 25;
}
/* Tactile Arcade Buttons */
.arcade-btn {
  background: linear-gradient(180deg, #d9ff43 0%, #9ed815 100%);
  color: #0b2215;
  border: 3px solid #ffffff;
  box-shadow: 0 6px 0 #5b8205, 0 12px 24px rgba(0,0,0,0.45);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.arcade-btn:active, .arcade-btn.active-press {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #5b8205, 0 5px 12px rgba(0,0,0,0.4);
}
.arcade-btn-secondary {
  background: linear-gradient(180deg, #8aa4c4 0%, #53708f 100%);
  color: #ffffff;
  border: 2.5px solid #e2e8f0;
  box-shadow: 0 5px 0 #3b5068, 0 10px 20px rgba(0,0,0,0.45);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.arcade-btn-secondary:active, .arcade-btn-secondary.active-press {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #3b5068, 0 4px 10px rgba(0,0,0,0.4);
}
.arcade-btn-smash {
  background: linear-gradient(180deg, #ffb02e 0%, #e8590c 100%);
  color: #ffffff;
  border: 2.5px solid #ffedd5;
  box-shadow: 0 5px 0 #9a3412, 0 10px 20px rgba(0,0,0,0.45);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.arcade-btn-smash:active, .arcade-btn-smash.active-press {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #9a3412, 0 4px 10px rgba(0,0,0,0.4);
}
/* Virtual Joystick Styling */
#joystick-zone {
  touch-action: none;
}
.mono-num {
  font-family: 'JetBrains Mono', monospace;
}

/* ===================== Reference-style HUD ===================== */
/* Scoreboard */
#scoreboard {
  background: linear-gradient(180deg, rgba(22, 27, 36, 0.92) 0%, rgba(12, 15, 21, 0.92) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  padding: 8px 0;
}
.score-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 96px;
}
.score-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  min-width: 82px;
}
.score-name {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.02em;
  line-height: 1;
}
.score-num {
  font-weight: 900;
  font-size: 30px;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.serve-tag {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #4ade80;
  line-height: 1;
}
@media (max-width: 640px) {
  .score-name { font-size: 16px; }
  .score-num { font-size: 22px; }
  .score-side { min-width: 70px; }
  .score-mid { min-width: 64px; }
}

/* Joystick */
.joystick-wrap { margin: 0 0 6px 38px; }
#joystick-zone {
  width: 132px;
  height: 132px;
  background: radial-gradient(circle, rgba(15, 20, 28, 0.35) 0%, rgba(15, 20, 28, 0.55) 100%);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.45), 0 4px 14px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
}
#joystick-knob {
  width: 50px;
  height: 50px;
  background: radial-gradient(circle at 40% 35%, #ffffff 0%, #eef1f5 55%, #c9cfd8 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

/* Action button cluster (SWING bottom-right, SMASH to its left, LOB above-between) */
.action-cluster {
  width: 268px;
  height: 214px;
  margin: 0 6px 4px 0;
  transform-origin: bottom right;
}
#btn-swing { right: 0; bottom: 0; width: 124px; height: 124px; }
#btn-smash { right: 146px; bottom: 6px; width: 98px; height: 98px; }
#btn-lob   { right: 116px; bottom: 120px; width: 90px; height: 90px; }
.btn-label {
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.01em;
  line-height: 1;
  margin-top: 3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.btn-label-lg {
  font-weight: 900;
  font-size: 25px;
  letter-spacing: 0.01em;
  line-height: 1;
}
#btn-lob .btn-label { font-size: 18px; }

/* Richer button finishes */
.arcade-btn {
  background: radial-gradient(circle at 50% 30%, #e4ff5c 0%, #c3f02c 45%, #8fcf12 100%);
  border: 4px solid #5d8f0a;
  box-shadow: 0 6px 0 #3f6406, 0 14px 26px rgba(0, 0, 0, 0.5), inset 0 3px 0 rgba(255, 255, 255, 0.45);
}
.arcade-btn-secondary {
  background: radial-gradient(circle at 50% 30%, #8fb0d0 0%, #6688ab 55%, #4a6888 100%);
  border: 3px solid #c8d6e6;
  box-shadow: 0 5px 0 #34495f, 0 12px 22px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.arcade-btn-smash {
  background: radial-gradient(circle at 50% 30%, #ffa53a 0%, #ff7a1a 50%, #e2440c 100%);
  border: 3px solid #a83208;
  box-shadow: 0 5px 0 #7c2306, 0 12px 22px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

/* Shrink controls on short / narrow screens (zoom shrinks layout too, so nothing overflows) */
@media (max-height: 520px), (max-width: 640px) {
  .action-cluster { zoom: 0.72; }
  .joystick-wrap { zoom: 0.78; margin-left: 8px; }
}
@media (max-height: 400px), (max-width: 420px) {
  .action-cluster { zoom: 0.6; }
  .joystick-wrap { zoom: 0.68; }
}
