* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at top, #505050 0%, #272727 45%, #121212 100%);
  color: #f7f2d3;
  font-family: "Press Start 2P", monospace;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.game-shell {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.canvas-wrap {
  position: relative;
  width: min(100vw - 32px, 480px);
  aspect-ratio: 160 / 284;
  border: 4px solid #181818;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  image-rendering: pixelated;
  background: #2f2f2f;
  touch-action: none;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  touch-action: none;
}

.hud-dom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: "Press Start 2P", monospace;
  color: #ffffff;
  text-transform: uppercase;
}

.hud-score,
.hud-word,
.hud-article {
  position: absolute;
  line-height: 1;
  text-shadow: 2px 0 #111, -2px 0 #111, 0 2px #111, 0 -2px #111;
  image-rendering: pixelated;
  transform: translateZ(0);
}

.hud-score {
  left: 14px;
  top: 14px;
  font-size: clamp(12px, 2.1vw, 19px);
}

.hud-word {
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  font-size: clamp(12px, 2.2vw, 20px);
}

.hud-article {
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  font-size: clamp(8px, 1.4vw, 12px);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(11, 11, 11, 0.8);
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: 100%;
  padding: 16px;
  background: rgba(43, 43, 43, 0.96);
  border: 3px solid #e3cc65;
  box-shadow: 0 0 0 3px #222;
}

.overlay-title {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #fff5aa;
}

.overlay-text {
  margin: 0 0 12px;
  font-size: 8px;
  line-height: 1.9;
  white-space: pre-line;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 8px;
}

.checkbox-row input {
  width: 14px;
  height: 14px;
  accent-color: #c53030;
}

#overlayButton {
  width: 100%;
  padding: 12px 10px;
  border: 0;
  background: #dcb742;
  color: #211600;
  font: inherit;
  font-size: 8px;
  cursor: pointer;
}

#overlayButton:hover,
#overlayButton:focus-visible {
  background: #f3d462;
}

.status-row {
  width: min(100vw - 32px, 480px);
  display: flex;
  align-items: center;
  gap: 12px;
}

.pause-button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 2px solid #111;
  background: #d7bb5a;
  color: #231700;
  font: inherit;
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
}

.pause-button:hover,
.pause-button:focus-visible {
  background: #efd174;
}

.status-line {
  flex: 1 1 auto;
  margin: 0;
  text-align: right;
  font-size: 8px;
  line-height: 1.8;
  color: #f0e8ba;
}

@media (max-width: 560px) {
  .status-row {
    width: min(100vw - 32px, 480px);
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
  }

  .pause-button {
    min-width: 72px;
    padding: 10px 12px;
    font-size: 9px;
  }

  .status-line {
    font-size: 8px;
  }
}
