:root {
  color-scheme: dark;
  background: #050606;
  font-family: "Courier New", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 20%, rgba(133, 142, 130, 0.16), transparent 28rem),
    linear-gradient(#070808, #010202);
}

.shell {
  width: min(100vw, 1280px);
  padding: 12px;
}

canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 4px solid #1d1f1f;
  border-top: 0;
  background: #070808;
  image-rendering: pixelated;
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.65);
}

.game-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 4px solid #1d1f1f;
  border-bottom: 0;
  background: #020202;
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.65);
}

.home-link {
  flex: 0 0 58px;
  width: 58px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #252929;
  background: #070808;
  cursor: pointer;
}

.home-link:hover {
  cursor: pointer;
  filter: brightness(1.15);
}

.home-link img {
  display: block;
  max-width: 48px;
  max-height: 34px;
  object-fit: contain;
}

.hud-grid {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr repeat(4, 0.9fr) 0.85fr 0.9fr;
  gap: 6px;
}

.hud-cell {
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 5px;
  border: 1px solid #252929;
  background: #070808;
  color: #f5f0dc;
  overflow: hidden;
  white-space: nowrap;
}

.hud-label {
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  color: #b9b7aa;
}

.hud-value {
  min-width: 0;
  font-size: 17px;
  line-height: 1;
  font-weight: 700;
  color: #f5f0dc;
}

.hud-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  object-fit: contain;
  image-rendering: pixelated;
}

.hud-icon.wide {
  width: 30px;
}

.game-error {
  margin-top: 10px;
  padding: 10px 12px;
  border: 2px solid #8f2d25;
  background: #1b0808;
  color: #ffd8cf;
  font-size: 13px;
  line-height: 1.4;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  padding-top: 10px;
  color: #b9b7aa;
  font-size: 13px;
}

.mobile-warning {
  display: none;
  min-height: 320px;
  padding: 28px 22px;
  border: 4px solid #2f3333;
  background: #090b0b;
  color: #f5f0dc;
  text-align: center;
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.65);
}

.mobile-warning h1 {
  margin: 0 0 14px;
  font-size: 28px;
}

.mobile-warning p {
  margin: 0 auto 20px;
  max-width: 520px;
  line-height: 1.5;
  color: #c9c5b6;
}

.mobile-warning a {
  color: #ffd35a;
  font-weight: 700;
}

body.mobile-blocked {
  overflow: auto;
}

body.mobile-blocked canvas,
body.mobile-blocked .controls,
body.mobile-blocked .game-header {
  display: none;
}

body.mobile-blocked .mobile-warning {
  display: block;
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .shell {
    padding: 6px;
  }

  .controls {
    font-size: 11px;
  }

  .game-header {
    min-height: auto;
    padding: 5px;
    gap: 5px;
  }

  .home-link {
    flex-basis: 44px;
    width: 44px;
    height: 34px;
  }

  .home-link img {
    max-width: 38px;
    max-height: 28px;
  }

  .hud-grid {
    gap: 4px;
  }

  .hud-cell {
    height: 34px;
    padding: 2px 3px;
    gap: 3px;
  }

  .hud-label {
    font-size: 8px;
  }

  .hud-value {
    font-size: 13px;
  }

  .hud-icon {
    width: 17px;
    height: 17px;
  }

  .hud-icon.wide {
    width: 22px;
  }
}
