* { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  background-color: #f0f0f0;
  overscroll-behavior: none; /* Prevent iOS bounce scroll */
}

#game-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 8px;
}

#mute-btn {
  position: absolute;
  top: 6px;
  left: 14px;
  z-index: 2;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #999;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 80ms ease-out, transform 80ms ease-out;
}

#mute-btn[aria-pressed='true'] {
  background: rgba(40, 40, 40, 0.85);
  color: #f0f0f0;
  border-color: #444;
}

#mute-btn:hover { transform: scale(1.05); }
#mute-btn:active { transform: scale(0.95); }
#mute-btn:focus-visible { outline: 2px solid #4a90e2; outline-offset: 2px; }

#mode-toggle {
  position: absolute;
  top: 6px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  padding: 2px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #999;
  border-radius: 999px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#mode-toggle button {
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: transparent;
  color: #888;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}

#mode-toggle button[aria-pressed='true'] {
  background: #333;
  color: #fff;
}

#mode-toggle button:hover:not([aria-pressed='true']) { color: #555; }
#mode-toggle button:focus-visible { outline: 2px solid #4a90e2; outline-offset: 2px; }

#gameCanvas {
  border: 1px solid black;
  width: 100%;     /* Scales to screen width while keeping internal 600x200 coords */
  height: auto;
  display: block;
  touch-action: none; /* Prevent scroll/zoom while playing */
}

#gameCanvas:focus-visible {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

#jump-btn {
  display: none; /* Hidden on desktop */
  margin-top: 12px;
  padding: 16px 48px;
  font-size: 18px;
  font-weight: bold;
  background: #555;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 80ms ease-out, transform 80ms ease-out;
}

#jump-btn:active {
  background: #333;
  transform: scale(0.96);
}

#jump-btn:focus-visible {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

/* Show jump button only on touchscreen devices */
@media (hover: none) and (pointer: coarse) {
  #jump-btn { display: block; }
}

/* Visually hidden but readable by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Disable non-essential CSS transitions when the user opts out of motion.
   Gameplay animations live in the canvas and are handled in script.js. */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
