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

html,
body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1b1f2e;
  font-family: "Press Start 2P", monospace;
  color: #fff;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: relative;
  width: min(96vw, calc(96dvh * 2 / 3));
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  text-align: center;
  background: rgba(10, 20, 40, 0.35);
}

.hidden {
  display: none;
}

h1 {
  font-size: clamp(28px, 9vmin, 48px);
  line-height: 1.3;
  color: #ffd84a;
  text-shadow: 4px 4px 0 #d9581f, 7px 7px 0 #000;
}

h2 {
  font-size: clamp(20px, 6vmin, 32px);
  color: #ffd84a;
  text-shadow: 3px 3px 0 #000;
}

p {
  font-size: 12px;
  line-height: 1.8;
  text-shadow: 2px 2px 0 #000;
}

button {
  font-family: inherit;
  font-size: 16px;
  padding: 16px 32px;
  color: #fff;
  background: #e8722b;
  border: 4px solid #000;
  border-radius: 8px;
  box-shadow: 0 5px 0 #000;
  cursor: pointer;
  transition: transform 0.05s;
}

button:hover {
  background: #f5843e;
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #000;
}

button.secondary {
  font-size: 11px;
  padding: 10px 18px;
  background: #3a8fd8;
}

button.secondary:hover {
  background: #4c9fe6;
}

.msg {
  min-height: 1.8em;
  color: #ffb3a7;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 6px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffd84a;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
