.screen { padding: 20px 0 28px; display: flex; flex-direction: column; align-items: center; }
.hero-block { text-align: center; margin-bottom: 16px; }
.hero-block h1 { font-size: 2.1rem; margin: 0 0 8px; }
.hero-block p { color: var(--text-muted); max-width: 460px; margin: 0 auto; }
.title-block { padding-top: 18px; }
.title-icon { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.title-credit { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 18px; }

.best-card {
  padding: 14px 22px; display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px; min-width: 220px;
}
.best-row { display: flex; justify-content: space-between; gap: 20px; font-size: 0.95rem; }
.best-name { color: var(--text-muted); font-weight: 600; }
.best-score { font-weight: 800; font-family: var(--mono); color: var(--accent); }

.btn-start { font-size: 1.05rem; padding: 14px 36px; }

.controls-hint {
  display: flex; gap: 24px; margin-top: 14px; color: var(--text-muted); font-size: 0.85rem;
}

#final-score-line { font-size: 1.15rem; font-weight: 600; }

/* Obstacle legend on the start screen — the three shapes are colour-coded in
   the game, so the key repeats those colours rather than naming them only. */
.legend {
  display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
  margin: 0 auto 14px; font-size: 0.84rem; color: var(--text-muted);
}
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend strong { color: var(--text); }
.legend .lg { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.legend .lg-low { background: #f2b134; }
.legend .lg-high { background: #e5484d; }
.legend .lg-solid { background: #4a6fa5; }


/* ---------------------------------------------------------------------
   Fullscreen stage
   Fixed to the viewport rather than laid out in the page, so there is no
   page left to scroll while playing — the previous version sat inside the
   document flow, which is why the page drifted/scrolled on its own on a
   phone. 100dvh (not vh) so the moving iOS browser bars can't leave a gap.
   --------------------------------------------------------------------- */
.game-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 200;
  background: #05060d;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* Locking BOTH html and body is what actually holds on iOS; either alone
   still allows a rubber-band drag. */
html.stage-open, body.stage-open {
  overflow: hidden !important;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
}

.stage-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.hud-score {
  font-weight: 800; font-size: 1.05rem; color: #fff;
  padding: 7px 15px; border-radius: 999px;
  background: rgba(8, 10, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
}
.stage-close {
  pointer-events: auto;
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 10, 22, 0.55);
  backdrop-filter: blur(8px);
  color: #fff; font-size: 1.1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.stage-close:hover { background: rgba(8, 10, 22, 0.85); }
.stage-close:active { transform: scale(0.9); }

.countdown-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(3rem, 18vw, 6rem); font-weight: 800; color: #fff;
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.stage-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 13, 0.72);
  backdrop-filter: blur(6px);
}
.stage-panel {
  width: 100%; max-width: 330px; text-align: center;
  padding: 26px 22px;
  border-radius: 20px;
  background: rgba(18, 20, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: #fff;
}
.stage-panel-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 4px; }
.stage-panel h2 { margin: 0 0 6px; font-size: 1.5rem; }
.stage-panel #final-score-line { margin: 0 0 18px; color: rgba(255, 255, 255, 0.72); font-size: 0.95rem; }
.stage-panel .btn { width: 100%; justify-content: center; }
.stage-panel .btn + .btn { margin-top: 9px; }
.stage-panel .best-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}
.stage-panel .best-name { color: rgba(255, 255, 255, 0.6); }

/* While the game's own fullscreen stage is up it already provides a close
   button in the same corner, so the shared pair would sit on top of it. */
html.stage-open .game-fs-btn,
html.stage-open .game-fs-close { display: none !important; }
