:root {
  color-scheme: light;
  --panel: rgba(255, 255, 255, 0.82);
  --ink: #3d2435;
  --accent: #d93d38;
  --sky-top: #8ed7f8;
  --sky-bottom: #fff1b8;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 16px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 34rem),
    linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: manipulation;
  user-select: none;
}

.game-shell {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(100%, 560px);
}

.game-header,
.game-footer {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid rgba(61, 36, 53, 0.12);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(61, 36, 53, 0.12);
  text-align: center;
  backdrop-filter: blur(6px);
}

.game-header h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 0.95;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.9);
}

.game-header p,
.game-footer p {
  margin: 6px 0 0;
  font-size: clamp(0.9rem, 3vw, 1rem);
}

.canvas-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  max-height: calc(100vh - 176px);
}

canvas {
  width: min(100%, calc((100vh - 176px) * 0.5625));
  max-width: 432px;
  height: auto;
  max-height: calc(100vh - 176px);
  border: 4px solid rgba(61, 36, 53, 0.18);
  border-radius: 24px;
  background: #8ed7f8;
  box-shadow: 0 18px 44px rgba(61, 36, 53, 0.22);
  image-rendering: auto;
}

@media (max-height: 680px) {
  body {
    padding: 8px;
  }

  .game-shell {
    gap: 8px;
  }

  .game-header,
  .game-footer {
    padding: 7px 12px;
  }

  .game-header p,
  .game-footer {
    display: none;
  }

  .canvas-wrap,
  canvas {
    max-height: calc(100vh - 84px);
  }

  canvas {
    width: min(100%, calc((100vh - 84px) * 0.5625));
  }
}
