/* AVZ — full-bleed Phaser canvas; only the HUD, loader and d-pad carry the Lyons.io theme */

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1b2a;
  color: #e8f0e8;
  font-family: "Space Grotesk", system-ui, sans-serif;
}
#game-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* mobile URL bar must not clip the canvas */
  line-height: 0;
  touch-action: none;
}
#game-container canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#game-container:focus-visible {
  outline: 3px solid #ffd23f;
  outline-offset: -3px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sr-only a { color: inherit; }

/* ---- HUD ---- */
.overlay {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.overlay .back {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  line-height: 1.6;
  color: #1a1a1a;
  text-decoration: none;
  padding: 8px 14px;
  border: 3px solid #1a1a1a;
  background: #7c3aed;
  box-shadow: 3px 3px 0 #1a1a1a;
  transition: transform .1s, box-shadow .1s;
}
@media (hover: hover) and (pointer: fine) {
  .overlay .back:hover, .overlay .back:focus-visible {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 #1a1a1a;
  }
}
.overlay .back:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.controls-hint {
  font-size: 12px;
  padding: 8px 12px;
  border: 2px solid #1a1a1a;
  background: rgba(255, 255, 255, .92);
  color: #1a1a1a;
}

/* ---- Boot / loading / failure overlay ---- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0d1b2a;
  transition: opacity .25s ease;
}
.boot[hidden] { display: none; }
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-box {
  width: min(420px, 100%);
  padding: 24px 26px;
  background: #fdfaf3;
  color: #1a1a1a;
  border: 4px solid #1a1a1a;
  box-shadow: 8px 8px 0 #7c3aed;
}
.boot-label {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.boot-bar {
  height: 18px;
  border: 3px solid #1a1a1a;
  background: #fff;
  overflow: hidden;
}
.boot-bar-fill {
  height: 100%;
  width: 0;
  background: #7c3aed;
  transition: width .18s linear;
}
.boot-msg {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: #4a463c;
}
.boot-msg:empty { display: none; }
.boot-back {
  display: inline-block;
  margin-top: 16px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: #1a1a1a;
  text-decoration: none;
  padding: 8px 14px;
  border: 2px solid #1a1a1a;
  background: #ffd23f;
  box-shadow: 3px 3px 0 #1a1a1a;
}
.boot-back[hidden] { display: none; }

/* ---- Touch d-pad: coarse pointers only ---- */
.dpad { display: none; }

@media (pointer: coarse) {
  .dpad {
    position: fixed;
    z-index: 15;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 4px;
    touch-action: none;
  }
  .dpad-btn {
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    color: #1a1a1a;
    background: rgba(253, 250, 243, .88);
    border: 3px solid #1a1a1a;
    box-shadow: 3px 3px 0 rgba(26, 26, 26, .5);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .dpad-btn.is-active {
    background: #7c3aed;
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 #1a1a1a;
  }
  .dpad-up    { grid-area: 1 / 2; }
  .dpad-left  { grid-area: 2 / 1; }
  .dpad-right { grid-area: 2 / 3; }
  .dpad-down  { grid-area: 3 / 2; }

  /* The hint is about keys nobody has on a touch device */
  .controls-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .boot, .boot-bar-fill, .overlay .back { transition: none; }
}
