/* styles.css
   Layout: viewport-fit flex column. Canvas is height-bounded so it can't
   push other elements off-screen; width follows from aspect ratio. */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
}

body {
  background: #000;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 0;
  gap: 4px;
  overflow: hidden;
}

#header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 560px;
  font-size: 10px;
  padding: 0 8px;
  flex-shrink: 0;
}

#title {
  color: #FFD700;
  font-size: 13px;
  letter-spacing: 4px;
  text-shadow: 0 0 12px #FFD700;
}

#score-val, #high-val { color: #FFD700; }

/* Canvas: flex item that shrinks to fit available vertical space.
   min-height: 0 lets flex actually shrink it below its intrinsic size.
   aspect-ratio keeps width proportional to whatever height it ends up at. */
#gameCanvas {
  display: block;
  border: 2px solid #1a1aff;
  box-shadow: 0 0 30px #1a1aff88, 0 0 60px #1a1aff44;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

#lives-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

#lives-label { font-size: 9px; margin-right: 4px; }

.life-icon { width: 18px; height: 18px; }

#message {
  color: #FFD700;
  font-size: 11px;
  text-align: center;
  letter-spacing: 2px;
  min-height: 16px;
  text-shadow: 0 0 10px #FFD700;
  animation: blink 1s step-start infinite;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* D-pad + side buttons: 3-column layout, capped to canvas width */
#mobile-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 560px;
  padding: 0 8px;
  gap: 0;
  flex-shrink: 0;
}

/* Side columns: special button + tiny label stacked */
.ctrl-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

.ctrl-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  color: #555;
  letter-spacing: 1px;
}

/* D-pad: centred, takes remaining space */
.ctrl-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1 1 auto;
}

.ctrl-row { display: flex; gap: 3px; justify-content: center; }

/* Base button — direction arrows */
.ctrl-btn {
  width: 36px;
  height: 36px;
  background: #111;
  border: 2px solid #1a1aff;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px #1a1aff55;
  transition: background 0.1s;
}

.ctrl-btn:active { background: #1a1aff44; }

/* Special buttons (G / P) */
.ctrl-btn-special {
  width: 36px;
  height: 36px;
  border-color: #FFD700;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.ctrl-btn-special:active { background: rgba(255, 215, 0, 0.15); }
