:root {
  color-scheme: light;
  --sky: #6bd0ff;
  --sunset: #ffd06f;
  --sand: #ffd985;
  --grass: #45bd4f;
  --ink: #172033;
  --muted: #5d6a7a;
  --panel: #ffffff;
  --button: #ff5a3d;
  --button-dark: #d93e27;
  --button-text: #ffffff;
  --shadow: 0 12px 28px rgba(23, 32, 51, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(107, 208, 255, 0.7), transparent 48%),
    #f9e4a8;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font: inherit;
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(100%, 760px);
  min-height: 100svh;
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hud > div {
  min-width: 0;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 10px 8px;
  text-align: center;
}

.label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  font-size: clamp(1.25rem, 5.8vw, 2.1rem);
  line-height: 1;
}

.stage {
  position: relative;
  align-self: center;
  justify-self: center;
  width: 100%;
  aspect-ratio: 900 / 506;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 4px solid #16304d;
  border-radius: 8px;
  background: var(--sky);
  box-shadow:
    var(--shadow),
    inset 0 0 0 3px rgba(255, 255, 255, 0.62);
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.18));
  text-align: center;
  pointer-events: none;
}

.overlay.is-hidden {
  display: none;
}

.overlay h1 {
  margin: 0 0 8px;
  color: #10233f;
  font-size: clamp(2.2rem, 12vw, 4.2rem);
  line-height: 0.95;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.7);
}

.overlay p {
  max-width: 24rem;
  margin: 0;
  color: #26364e;
  font-size: clamp(1rem, 3.8vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
}

.jump-button {
  width: 100%;
  min-height: 86px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ff734f, var(--button));
  color: var(--button-text);
  box-shadow: var(--shadow);
  font-size: clamp(1.45rem, 7vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.jump-button:active {
  background: var(--button-dark);
  transform: translateY(1px);
}

@media (orientation: landscape) and (max-height: 520px) {
  .game-shell {
    grid-template-columns: minmax(0, 1fr) minmax(118px, 22vw);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .hud {
    grid-column: 1 / -1;
  }

  .jump-button {
    min-height: 100%;
  }
}
