:root {
  --paper: #eeeeee;
  --ink: #242424;
  --pencil: #575757;
  --line: rgba(40, 40, 40, 0.17);
  --tape: #c8c8c8;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  font-family: "Courier New", Courier, monospace;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent 18%, rgba(52, 52, 52, 0.08) 51%, transparent 82%),
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.36), transparent 34%),
    radial-gradient(circle at 72% 72%, rgba(54, 54, 54, 0.12), transparent 37%),
    var(--paper);
}

.game-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-frame {
  position: relative;
  width: min(100%, 1180px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 36px);
  border: 3px solid rgba(36, 36, 36, 0.82);
  box-shadow:
    0 12px 0 rgba(36, 36, 36, 0.12),
    0 22px 48px rgba(24, 24, 24, 0.25);
  background: var(--paper);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: var(--paper);
}

.hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 8px;
  align-items: start;
  pointer-events: none;
}

.brand,
.hud-stat,
.game-over {
  color: var(--ink);
  border: 2px solid rgba(36, 36, 36, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), rgba(232, 232, 232, 0.62)),
    repeating-linear-gradient(0deg, transparent 0 9px, var(--line) 10px 11px);
  box-shadow: 4px 4px 0 rgba(36, 36, 36, 0.14);
}

.brand {
  width: max-content;
  max-width: 100%;
  padding: 8px 12px;
  font-weight: 900;
  letter-spacing: 0;
  transform: rotate(-1deg);
}

.hud-stat {
  min-width: 92px;
  padding: 7px 10px;
  text-align: center;
}

.hud-stat span,
.game-over p {
  display: block;
  color: var(--pencil);
  font-size: 12px;
  font-weight: 700;
}

.hud-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  line-height: 1;
}

.game-over {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(340px, calc(100% - 32px));
  padding: 24px;
  text-align: center;
  transform: translate(-50%, -50%) rotate(-1deg);
}

.game-over h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 52px);
  line-height: 1;
}

.game-over p {
  margin: 10px 0 18px;
  font-size: 16px;
}

button {
  appearance: none;
  min-height: 44px;
  padding: 10px 16px;
  color: var(--ink);
  font: 900 16px/1 "Courier New", Courier, monospace;
  border: 2px solid rgba(36, 36, 36, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(80, 80, 80, 0.1)),
    var(--tape);
  box-shadow: 3px 3px 0 rgba(36, 36, 36, 0.2);
  cursor: pointer;
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(36, 36, 36, 0.2);
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .game-shell {
    padding: 8px;
  }

  .game-frame {
    max-height: calc(100vh - 16px);
  }

  .hud {
    top: 8px;
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr repeat(4, minmax(46px, auto));
    gap: 5px;
  }

  .brand {
    padding: 6px 8px;
    font-size: 13px;
  }

  .hud-stat {
    min-width: 46px;
    padding: 5px 4px;
  }

  .hud-stat span {
    font-size: 9px;
  }

  .hud-stat strong {
    font-size: 16px;
  }
}
