/* V43+ consolidated styles - previous versions removed (were completely overridden) */

:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: #000;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  position: fixed;
  inset: 0;
}

#gameWrap {
  width: 100vw;
  height: 100dvh;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  box-sizing: border-box;
}

canvas {
  display: block;
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
  border: none;
  box-shadow: none;
  background: #000;
}

#controls { display: none; }

#mobileControls {
  position: fixed;
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: max(8px, var(--safe-bottom));
  height: clamp(54px, 13vmin, 82px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 clamp(8px, 2.4vw, 26px);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 100;
}

.leftControls,
.rightControls {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 12px);
  pointer-events: none;
}

/* V43: botones con contraste alto y texto mas legible */
.controlBtn {
  position: relative;
  width: clamp(44px, 10vmin, 62px);
  height: clamp(44px, 10vmin, 62px);
  border-radius: 50%;
  border: 0;
  background: #005bff;
  color: #ffffff;
  text-shadow: none;
  font-weight: 800;
  text-align: center;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  opacity: .96;
  overflow: hidden;
  box-shadow: 0 4px 0 rgba(0,0,0,.32);
}

.controlBtn::before {
  display: none;
}

.actionBtn {
  background: #005bff;
}

.shootBtn {
  background: #005bff;
}

.punchBtn {
  background: #005bff;
}

.btnIcon {
  position: relative;
  z-index: 2;
  display: block;
  line-height: 1;
  font-size: clamp(22px, 5.1vmin, 32px);
  text-shadow: none;
  font-weight: 800;
}

.actionBtn .btnIcon {
  margin-top: clamp(4px, 1vmin, 7px);
}

.moveBtn .btnIcon {
  margin-top: clamp(9px, 2.1vmin, 14px);
}

.btnLabel {
  position: relative;
  z-index: 2;
  display: block;
  margin-top: 1px;
  font-size: clamp(7px, 1.55vmin, 10px);
  letter-spacing: .5px;
  color: #ffffff;
  text-shadow: none;
  font-weight: 800;
}

.controlBtn:active,
.controlBtn.isPressed {
  transform: scale(.90);
  filter: brightness(1.38) contrast(1.08);
  opacity: 1;
}

/* En desktop se muestra layout normal y se ocultan controles táctiles */
@media (hover: hover) and (pointer: fine) and (min-width: 901px) {
  #gameWrap {
    height: calc(100vh - 36px);
    padding: 28px 42px 16px 42px;
    background: #050505;
  }

  canvas {
    max-width: calc(100vw - 84px);
    max-height: calc(100vh - 80px);
    width: auto;
    height: auto;
    border: 2px solid rgba(255,255,255,.23);
    box-shadow: 0 0 24px rgba(0,0,0,.7);
  }

  #controls {
    display: block;
  }

  #mobileControls {
    display: none;
  }
}

/* Teléfonos muy pequeños o en horizontal bajo */
@media (max-height: 430px) and (orientation: landscape) {
  #mobileControls {
    height: 48px;
    bottom: max(4px, var(--safe-bottom));
    padding: 0 8px;
  }

  .leftControls,
  .rightControls {
    gap: 6px;
  }

  .controlBtn {
    width: clamp(38px, 10.5vh, 50px);
    height: clamp(38px, 10.5vh, 50px);
  }

  .btnIcon {
    font-size: clamp(18px, 5.3vh, 24px);
  }

  .btnLabel {
    font-size: 7px;
  }

  .moveBtn .btnIcon {
    margin-top: 9px;
  }
}


#restartButton {
  position: fixed;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  z-index: 120;
  display: none;
  min-width: clamp(190px, 38vw, 320px);
  height: clamp(64px, 12vmin, 92px);
  padding: 0 28px;
  border-radius: 10px;
  border: 0;
  background: #005bff;
  color: #ffffff;
  font-family: Arial, sans-serif;
  font-size: clamp(34px, 7vmin, 54px);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: none;
  box-shadow: 0 5px 0 rgba(0,0,0,.35);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#restartButton.show {
  display: block;
}

#restartButton:active {
  transform: translate(-50%, -50%) scale(.94);
  filter: brightness(1.25);
}
