:root {
  --bg: #05060a;
  --fg: #c8d0f0;
  --dim: #5a6284;
  --accent: #ff7b1c;
  --cyan: #00e5ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1100px 640px at 50% -10%, #0d1022 0%, var(--bg) 62%) fixed,
    var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 18px;
  user-select: none;
  -webkit-user-select: none;
}

header { text-align: center; }

h1 {
  font-size: clamp(18px, 3.2vw, 30px);
  letter-spacing: 0.38em;
  color: #fff;
  font-weight: 700;
  text-indent: 0.38em; /* balance tracking */
}

h1 b { color: var(--accent); }

header p {
  margin-top: 7px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--dim);
}

main { display: flex; flex-direction: column; align-items: center; }

#wrap {
  position: relative;
  width: min(94vw, 1180px, calc((100vh - 190px) * 16 / 9));
  aspect-ratio: 16 / 9;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  border: 1px solid #1c2140;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px #0a0c18,
    0 0 46px rgba(0, 229, 255, 0.13),
    0 24px 60px rgba(0, 0, 0, 0.55);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: crosshair;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--dim);
  pointer-events: none;
}

#err {
  display: none;
  margin-top: 10px;
  max-width: 90vw;
  color: #ff5c5c;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
}

footer {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

.nojs {
  color: #ff5c5c;
  font-size: 12px;
  letter-spacing: 0.1em;
  margin-top: 8px;
}
