:root {
  --border-color: #277d88;
  --dialog-background: #081523;

  --menu-background: #081523;
  --menu-border-color: #277d88;
  --menu-font-color: #b9f9e6;
  --menu-selected-background: #174139;
}

* {
  box-sizing:border-box;
}

body {
  background: #030710;
  padding: 0;
  margin: 0;
  overflow: hidden;
  font-family: 'Courier New', monospace;
}
.how-to-play {
  position: absolute;
  left:0; right:0;
  bottom: 4px;
  margin: 0;
  line-height: 20px;
  text-align:center;
  font-size: 14px;
  color: #fff;
}

.game-container {
  position: absolute;
  top: calc(var(--viewport-top, 0px) + 4px);
  left: var(--viewport-left, 50%);
   background: #02050b;
  width: var(--game-width, 520px);
  height: var(--game-height, 300px);
  outline: 1px solid #277d88;

  transform-origin: top center;
  transform: translateX(-50%) scale(var(--game-scale, 1));
}

.game-container canvas {
  image-rendering: pixelated;
}
.game-canvas { display: block; width: 100%; height: 100%; }

.touch-controls { display: none; }
button { touch-action: manipulation; }

@media (any-pointer: coarse) {
  .how-to-play { display: none; }
  .touch-controls {
    position: absolute;
    top: calc(var(--viewport-top, 0px) + var(--viewport-height, 100dvh) - 128px);
    left: var(--viewport-left, 50%);
    transform: translateX(-50%);
    width: min(100% - 24px, 720px);
    height: 116px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    user-select: none;
  }
  .touch-directions { display: grid; grid-template-columns: repeat(3, 52px); gap: 6px; }
  .touch-directions button:first-child { grid-column: 2; }
  .touch-directions button:nth-child(2) { grid-column: 1; }
  .touch-actions { display: grid; gap: 8px; }
  .touch-controls button {
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid #488d94;
    border-radius: 8px;
    background: #102835;
    color: #b9f9e6;
    font: bold 14px 'Courier New', monospace;
    touch-action: none;
  }
  .touch-controls button.is-held { background: #246353; }
  .touch-controls button:focus-visible { outline: 2px solid #b9f9e6; outline-offset: 2px; }
}
