@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
  *, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

  body {
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
  }

  /* ── Boot / Loading Screen ── */
  #boot-screen {
    position: fixed; inset: 0;
    background: #000;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 28px;
    z-index: 999;
    transition: opacity 0.6s ease;
  }
  #boot-screen.fade-out { opacity: 0; pointer-events: none; }

  .boot-logo {
    font-size: 22px;
    color: #e84010;
    text-shadow: 4px 4px 0 #781800;
    letter-spacing: 2px;
    animation: pulse 1s infinite alternate;
  }
  .boot-sub {
    font-size: 9px;
    color: #ffbd00;
    letter-spacing: 1px;
  }
  .boot-status {
    font-size: 8px;
    color: #5c94fc;
    min-width: 320px;
    text-align: center;
  }
  .progress-wrap {
    width: 320px;
    height: 18px;
    border: 3px solid #555;
    background: #111;
    position: relative;
    overflow: hidden;
  }
  .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e84010, #ffbd00);
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px #ffbd0088;
  }
  .progress-pct {
    font-size: 7px;
    color: #aaa;
  }
  .json-preview {
    font-size: 6px;
    color: #3a8;
    width: 360px;
    height: 52px;
    overflow: hidden;
    background: #0a0a0a;
    border: 1px solid #1a4a1a;
    padding: 4px 6px;
    font-family: monospace;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.3s;
  }
  .json-preview.show { opacity: 1; }

  @keyframes pulse {
    from { transform: scale(1); }
    to   { transform: scale(1.04); }
  }

  /* ── Game Container ── */
  #game-wrap { display: none; flex-direction: column; align-items: center; }
  #game-wrap.visible { display: flex; }

  /* ── HUD ── */
  #hud {
    width: 896px;
    background: #5c94fc;
    color: #fff;
    font-size: 10px;
    padding: 5px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 1px;
    user-select: none;
  }
  #hud span { display: flex; flex-direction: column; gap: 2px; }
  #hud .label { font-size: 7px; opacity: 0.85; }
  #hud .value { font-size: 11px; }

  #game-canvas {
    display: block;
    image-rendering: pixelated;
    border-bottom: 4px solid #333;
  }

  /* ── Controls hint ── */
  #controls {
    margin-top: 6px;
    font-size: 6px;
    color: #555;
    letter-spacing: 0.5px;
  }

  /* ── Overlay messages ── */
  #overlay {
    position: absolute;
    top: 0; left: 0;
    width: 896px; height: 336px;
    display: none;
    flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.72);
    gap: 18px;
    z-index: 10;
  }
  #overlay.show { display: flex; }
  .ov-title { font-size: 22px; color: #fff; text-shadow: 3px 3px 0 #e84010; }
  .ov-sub   { font-size: 9px;  color: #ffbd00; }
  .ov-hint  { font-size: 7px;  color: #888; }

  #canvas-wrap { position: relative; }