html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #141d38;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* The stage fills the window; game.js sizes and places the canvas inside it. */
#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #1d2c55 0%, #141d38 70%);
}

#c {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  background: #18264a;
  touch-action: none;
}

/* ---------- Mute button ---------- */
#mute {
  position: absolute;
  z-index: 20;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  padding: 9px;
  border: 0;
  border-radius: 12px;
  background: rgba(16, 20, 38, 0.45);
  cursor: pointer;
  touch-action: none;
}
#mute:hover { background: rgba(16, 20, 38, 0.7); }
#mute:focus-visible { outline: 2px solid #fff; }
#mute svg { display: block; width: 100%; height: 100%; }
#mute .speaker { fill: #f4f0ff; }
#mute .waves, #mute .cross {
  fill: none;
  stroke: #f4f0ff;
  stroke-width: 2;
  stroke-linecap: round;
}
#mute .cross { display: none; stroke: #ff5268; }
#mute.muted .waves { display: none; }
#mute.muted .cross { display: inline; }

/* ---------- Touch controls (only on touch devices, only while playing) ---------- */
#touch-controls {
  display: none;
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  pointer-events: none;
}

body.touch:not(.title-screen) #touch-controls { display: block; }

.pad-button {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(20, 24, 40, 0.38);
  color: rgba(255, 255, 255, 0.9);
  font: 800 16px/1 system-ui, sans-serif;
  letter-spacing: 1px;
  pointer-events: auto;
  touch-action: none;
  transition: transform 0.05s, background-color 0.05s;
}
.pad-button svg { width: 46%; height: 46%; fill: rgba(255, 255, 255, 0.9); }
.pad-button.active {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0.94);
}

#dpad {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
}
#dpad .pad-button {
  top: 0;
  bottom: 0;
  width: calc(50% - 5px);
  border-radius: 16px;
  pointer-events: none; /* #dpad handles the pointer so a thumb can slide between arrows */
}
#dpad .pad-button[data-dir="-1"] { left: 0; }
#dpad .pad-button[data-dir="1"] { right: 0; }

#jump {
  border-radius: 50%;
}

/* In portrait the controls sit in their own band below the game view. */
body.controls-below #touch-controls {
  background: linear-gradient(180deg, rgba(10, 14, 30, 0) 0%, rgba(10, 14, 30, 0.35) 100%);
}
