* { box-sizing: border-box; }

html, body {
  overscroll-behavior-y: contain; /* stop pull-to-refresh from fighting the touch buttons */
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #2b1055, #0d0621);
  font-family: 'Trebuchet MS', Arial, sans-serif;
  color: #fff;
}

#wrap {
  text-align: center;
}

h1 {
  margin: 0 0 12px;
  letter-spacing: 2px;
  text-shadow: 0 0 12px #ff5fa2, 0 0 24px #ffd23f;
}

#canvasWrap {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #87ceeb;
  border: 6px solid #ffd23f;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(255, 210, 63, 0.5);
  image-rendering: pixelated;
  touch-action: none;
}

/* on-screen controls for touch devices — hidden for mouse/keyboard players */
#touchControls {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  #touchControls {
    display: block;
    position: absolute;
    inset: 6px;
    pointer-events: none;
  }

  .touch-btn {
    position: absolute;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    border: 2px solid #ffd23f;
    border-radius: 50%;
    background: rgba(13, 6, 33, 0.55);
    color: #fff6e5;
    font-family: inherit;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .touch-btn:active {
    background: rgba(255, 210, 63, 0.35);
  }

  .touch-btn-jump {
    right: 4%;
    bottom: 6%;
    width: 22%;
    aspect-ratio: 1;
    font-size: clamp(11px, 3.2vw, 16px);
    letter-spacing: 1px;
    border-width: 3px;
    box-shadow: 0 0 16px rgba(255, 210, 63, 0.4);
  }

  .touch-btn-small {
    width: 11%;
    aspect-ratio: 1;
    font-size: clamp(12px, 3vw, 18px);
    top: 3%;
  }

  #btn-pause {
    left: 3%;
  }

  #btn-mute {
    left: calc(3% + 13%);
  }

  #btn-restart {
    right: 3%;
  }
}

.hint {
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.85;
}

/* soft suggestion, not a hard lock — the canvas already scales to fit
   portrait phones, this just nudges players toward the roomier layout */
.rotate-hint {
  display: none;
  margin: 0 0 10px;
  font-size: 13px;
  opacity: 0.85;
}

@media (orientation: portrait) and (max-width: 600px) {
  .rotate-hint {
    display: block;
  }
}

kbd {
  background: #333;
  border: 1px solid #666;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
}
