/* Shared layout for every game page: stage, canvas, prompt, overlays and panels. */

.game-main {
  max-width: 1000px;
  padding-top: 18px;
}

.game-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #0a1a12;
}

.stage canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.prompt {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  margin: 0;
  max-width: calc(100% - 24px);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-weight: 700;
  font-size: clamp(0.72rem, 2vw, 0.95rem);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.prompt:empty {
  display: none;
}

/* ---------- Overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 12, 8, 0.72);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}

.overlay[hidden] {
  display: none;
}

.panel {
  width: 100%;
  max-width: 460px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}

.panel h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.02em;
}

.howto {
  margin: 0 0 16px;
  padding-left: 20px;
  text-align: left;
  color: var(--muted);
  font-size: 0.92rem;
}

.howto li + li {
  margin-top: 4px;
}

.howto strong {
  color: var(--text);
}

.green {
  color: var(--accent);
  font-weight: 700;
}

.seg {
  display: inline-flex;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.seg button {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 0.9rem var(--font-body);
  cursor: pointer;
}

.seg button[aria-checked="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent-2);
}

.btn-lg {
  display: flex;
  width: 100%;
  min-height: 50px;
  font-size: 1.05rem;
}

.keys {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.final-score {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.6rem;
  font-variant-numeric: tabular-nums;
}

.over-stats {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.over-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- "About this game" text under the game (also helps search engines) ---------- */

.about {
  max-width: 68ch;
  margin-top: 32px;
  color: var(--muted);
}

.about h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}

.about p {
  margin: 0 0 12px;
}

/* On small screens the stage is too short to hold the panels, so overlays go full screen. */
@media (max-width: 640px) {
  .overlay {
    position: fixed;
    z-index: 20;
  }
}

@media (max-width: 520px) {
  .panel {
    padding: 16px;
  }

  .howto {
    font-size: 0.82rem;
  }
}
