* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  background: #000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

#restart-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  color: #ff2c8b;
  border: 1px solid rgba(255, 44, 139, 0.5);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  touch-action: auto;
  pointer-events: all;
}
#restart-btn:hover { background: rgba(255,44,139,0.18); }

#top-center-btns {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  gap: 8px;
}

#controls-btn, #scoreboard-btn {
  background: rgba(0, 0, 0, 0.75);
  color: #ffd400;
  border: 1px solid rgba(255, 212, 0, 0.5);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  touch-action: auto;
  letter-spacing: 0.5px;
  font-family: Arial, Helvetica, sans-serif;
  white-space: nowrap;
}
#controls-btn:hover, #scoreboard-btn:hover { background: rgba(255,212,0,0.18); }

#top-right-btns {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 200;
  display: flex;
  gap: 6px;
  align-items: center;
}

#mute-btn {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  touch-action: auto;
  font-family: Arial, Helvetica, sans-serif;
}

/* Fullscreen button — only useful on mobile, hidden on desktop */
#fullscreen-btn {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  touch-action: auto;
  line-height: 1;
  display: none; /* hidden on desktop — shown only on touch devices */
}

@media (pointer: coarse) {
  /* Show fullscreen button on touch screens */
  #fullscreen-btn { display: block; }
}

#fullscreen-btn:active { background: rgba(255,255,255,0.15); }

/* ── Fullscreen prompt overlay (mobile landscape only) ── */
#fs-prompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.88);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fsPulse 0.35s ease;
}

@keyframes fsPulse {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

#fs-prompt.visible { display: flex; }

#fs-prompt-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

#fs-prompt-icon {
  font-size: 88px;
  line-height: 1;
  color: #ffd400;
  filter: drop-shadow(0 0 24px #ffd40088);
}

#fs-prompt-title {
  font-family: Arial Black, Arial, sans-serif;
  font-size: clamp(22px, 6vw, 42px);
  font-weight: 900;
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(255,212,0,0.6);
}

#fs-prompt-sub {
  font-size: clamp(13px, 3vw, 18px);
  color: #aaa;
  letter-spacing: 0.5px;
}

#fs-prompt-skip {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#rotate-msg {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  color: #ff2c8b;
  font-family: Arial, sans-serif;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  line-height: 1.4;
}

@media (max-width: 900px) and (orientation: portrait) {
  #rotate-msg { display: flex; }
  #game-container { display: none; }
}

/* ── Mobile controls: transparent overlay, controls on the sides ── */
#mobile-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: none;
}

/* ── D-pad: left side, vertically centred ── */
#dpad-wrap {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-55%);
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

#dpad-label {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  user-select: none;
}

#dpad {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
}

#dpad-mid {
  display: flex;
  align-items: center;
  gap: 4px;
}

#dpad-center {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

#dpad button {
  width: 52px;
  height: 52px;
  background: rgba(15, 15, 25, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

#dpad button:active {
  background: rgba(80, 60, 120, 0.95);
  border-color: #ff2c8b;
  transform: scale(0.92);
}

/* ── Action buttons: right side, single column, big ── */
#action-buttons {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-55%);
  pointer-events: all;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hide the second .action-row wrapper — we go single column */
.action-row {
  display: contents; /* lets buttons flow directly into the column */
}

.action-btn {
  width: 76px;
  height: 64px;
  background: rgba(15, 15, 25, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  line-height: 1.2;
  text-align: center;
  pointer-events: all;
}

.action-btn small {
  font-size: 9px;
  color: #aaa;
  margin-top: 2px;
}

.action-btn:active {
  transform: scale(0.92);
  background: rgba(80, 60, 120, 0.95);
}

.punch-btn  { border-color: #ff2c8b; color: #ff2c8b; }
.kick-btn   { border-color: #ff9f1c; color: #ff9f1c; }
.jump-btn   { border-color: #53c8ff; color: #53c8ff; }
.special-btn{ border-color: #ffd400; color: #ffd400; }

.punch-btn:active  { background: rgba(255, 44, 139, 0.3); }
.kick-btn:active   { background: rgba(255, 159, 28, 0.3); }
.jump-btn:active   { background: rgba(83, 200, 255, 0.3); }
.special-btn:active{ background: rgba(255, 212, 0, 0.3); }

@media (min-width: 900px) {
  #mobile-controls {
    display: none;
  }
}
