/* Retro flip-screen platformer — chunky pixels, monospace UI, no dependencies. */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05060a;
  color: #d7d7d7;
  font-family: ui-monospace, "Courier New", Courier, monospace;
  /* The game owns every gesture; stop the browser from scrolling or zooming. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The canvas backing store stays 256x192; JS sets the CSS size to a whole
   multiple of it so nearest-neighbour scaling lands on exact pixel edges. */
#screen {
  display: block;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* On-screen controls, laid out like a console pad along the bottom. */
#pad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px clamp(12px, 4vw, 40px);
  pointer-events: none; /* only the buttons capture input, not the gaps */
}

#pad .cluster {
  display: flex;
  gap: 12px;
}

/* The action cluster: a small USE/DROP column beside the big JUMP button. */
#pad .cluster.actions {
  align-items: flex-end;
}

#pad .stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  color: #e9e9e9;
  background: rgba(30, 34, 44, 0.6);
  border: 2px solid rgba(190, 200, 220, 0.35);
  border-radius: 12px;
  min-width: 64px;
  min-height: 64px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.btn.jump {
  min-width: 96px;
  border-radius: 16px;
  letter-spacing: 0.08em;
}

/* USE and DROP are secondary, so they take less room than move and jump. */
.btn.small {
  min-width: 56px;
  min-height: 40px;
  font-size: 13px;
  border-radius: 10px;
}

/* Pressed state also fires for touch via the active class toggled in JS. */
.btn:active,
.btn.pressed {
  background: rgba(120, 130, 150, 0.75);
  transform: translateY(1px);
}

/* A mouse-and-keyboard visitor can dim the pad; it stays fully usable. */
@media (hover: hover) and (pointer: fine) {
  #pad {
    opacity: 0.55;
  }
}

/* Save / Load, parked in the top-right page corner. They overlap the window edge,
   so fit() in engine/main.js reserves a top band this panel's height (and a bottom
   one for #pad) and centres the canvas between them — that keeps the panels clear of
   the canvas HUD at any size. Their own click handlers call save()/load(). */
#meta {
  position: fixed;
  top: 0;
  right: 0;
  display: flex;
  gap: 8px;
  padding: 12px clamp(12px, 4vw, 40px);
  pointer-events: none; /* only the buttons capture input, not the gap */
  z-index: 2;
}

#meta button {
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #e9e9e9;
  background: rgba(30, 34, 44, 0.6);
  border: 2px solid rgba(190, 200, 220, 0.35);
  border-radius: 10px;
  min-width: 56px;
  min-height: 40px;
  cursor: pointer;
}

#meta button:active {
  background: rgba(120, 130, 150, 0.75);
  transform: translateY(1px);
}
