html,
body {
  margin: 0;
  height: 100%;
  background: #1e1424;
  overflow: hidden;
}

body {
  position: fixed;
  inset: 0;
  /* No scrolling, zooming, text selection or tap flashes while playing */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
}

#wrap {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  /* Size is set by js/main.js to fill the window */
  display: block;
  outline: none;
  touch-action: none;
}

/* ---------- touch controls ---------- */

#touch {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
  --pad: 16px;
  --unit: min(19vh, 84px);
}

#touch.show {
  display: block;
}

#stick {
  position: absolute;
  left: calc(env(safe-area-inset-left, 0px) + var(--pad));
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--pad));
  width: calc(var(--unit) * 1.75);
  height: calc(var(--unit) * 1.75);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 3px solid rgba(255, 255, 255, 0.45);
  box-sizing: border-box;
  pointer-events: auto;
  touch-action: none;
}

#knob {
  position: absolute;
  left: 30%;
  top: 30%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn {
  position: absolute;
  width: var(--unit);
  height: var(--unit);
  padding: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  color: #fff;
  font: bold calc(var(--unit) * 0.2) 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  opacity: 0.8;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn.on {
  transform: scale(0.9);
  opacity: 1;
  filter: brightness(1.25);
}

/* Right-hand diamond: KICK on top, PUNCH left, BLOCK right, TAUNT at the bottom.
   --gap is the distance between a button's centre and the diamond's centre.
   Neighbouring buttons are close enough for one thumb to press two at once
   (kick + block, punch + block, kick + punch) but keep a small visible gap:
   at 0.9 unit, diagonal neighbours are 1.27 units apart (buttons are 1 unit). */
#touch {
  --edge-r: calc(env(safe-area-inset-right, 0px) + var(--pad));
  --edge-b: calc(env(safe-area-inset-bottom, 0px) + var(--pad));
  --gap: calc(var(--unit) * 0.9);
}

.btn.kick {
  right: calc(var(--edge-r) + var(--gap));
  bottom: calc(var(--edge-b) + var(--gap) * 2);
  background: rgba(77, 171, 247, 0.75);
}

.btn.punch {
  right: calc(var(--edge-r) + var(--gap) * 2);
  bottom: calc(var(--edge-b) + var(--gap));
  background: rgba(255, 107, 157, 0.75);
}

.btn.block {
  right: var(--edge-r);
  bottom: calc(var(--edge-b) + var(--gap));
  background: rgba(252, 196, 25, 0.75);
}

.btn.taunt {
  right: calc(var(--edge-r) + var(--gap));
  bottom: var(--edge-b);
  background: rgba(151, 117, 250, 0.75);
}

/* TAUNT states (js/touch.js): taunting, or not usable right now. The
   cooldown is hidden information, so it isn't shown */
.btn.taunt.active {
  opacity: 1;
  filter: brightness(1.3);
  box-shadow: 0 0 14px rgba(208, 191, 255, 0.9);
}

.btn.taunt.unavailable {
  opacity: 0.45;
}

/* ---------- "turn your phone" message ---------- */

#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #1e1424;
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 20px;
  padding: 24px;
}

#rotate .phone {
  width: 54px;
  height: 92px;
  border: 5px solid #ff86b8;
  border-radius: 12px;
  animation: turn 1.8s ease-in-out infinite;
}

@keyframes turn {
  0%, 20% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate {
    display: flex;
  }
}

noscript {
  color: #fff;
}
