/* ── Guppy game page ── */

.game-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  background: #082040;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.game-viewport {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 400 / 225;
  margin: 0 auto;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid rgba(255, 140, 0, 0.15);
}

/* Settings button */
.game-settings-btn {
  position: absolute;
  z-index: 10;
  bottom: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  background: rgba(8, 32, 64, 0.7);
  border: 1px solid rgba(255, 140, 0, 0.4);
  color: #FF8C00;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.game-settings-btn:hover {
  background: rgba(255, 140, 0, 0.15);
}

/* ── Touch controls ── */
.touch-controls {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
  z-index: 5;
}

.touch-dpad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 2px;
  pointer-events: auto;
}

.touch-dpad-btn {
  background: rgba(255, 140, 0, 0.15);
  border: 1px solid rgba(255, 140, 0, 0.3);
  color: #FF8C00;
  font-size: 16px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
       user-select: none;
  touch-action: manipulation;
}
.touch-dpad-btn.active {
  background: rgba(255, 140, 0, 0.35);
  border-color: #FF8C00;
}

.touch-dpad-empty {
  pointer-events: none;
}

.touch-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: flex-end;
  pointer-events: auto;
}

.touch-action-btn {
  background: rgba(0, 180, 216, 0.15);
  border: 1px solid rgba(0, 180, 216, 0.3);
  color: #00B4D8;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
       user-select: none;
  touch-action: manipulation;
}
.touch-action-btn.active {
  background: rgba(0, 180, 216, 0.35);
  border-color: #00B4D8;
}

/* ── Mobile adjustments ── */
@media (max-width: 820px) {
  .game-wrap {
    min-height: calc(100vh - 50px);
    padding-bottom: 140px;
  }
  .game-viewport {
    max-width: 100%;
  }
  .touch-controls {
    bottom: -130px;
  }
  .touch-dpad {
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
  }
  .touch-action-btn {
    font-size: 8px;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .touch-dpad {
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(3, 36px);
  }
}

/* Hide touch controls on non-touch devices */
@media (hover: hover) and (pointer: fine) {
  .touch-controls {
    display: none;
  }
}
