:root {
  --bg-top: #fff7e4;
  --bg-bottom: #f8d58c;
  --text-main: #2f2413;
  --text-soft: #6d5531;
  --accent: #f08c32;
  --accent-strong: #da5e16;
  --shadow: 0 20px 60px rgba(89, 56, 11, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 28vw;
  height: 28vw;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.35;
  z-index: -1;
}

body::before {
  top: -8vw;
  right: -8vw;
  background: rgba(240, 140, 50, 0.4);
}

body::after {
  bottom: -10vw;
  left: -4vw;
  background: rgba(105, 181, 113, 0.28);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.board-panel {
  position: relative;
  width: min(92vmin, 860px);
  aspect-ratio: 1;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(180deg, rgba(255, 249, 232, 0.9), rgba(255, 237, 194, 0.98));
}

body.tablet-touch #game-canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(43, 29, 12, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 3;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card {
  min-width: min(320px, 80%);
  padding: 26px 28px;
  border-radius: 26px;
  text-align: center;
  background: rgba(255, 249, 236, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(110, 76, 22, 0.14);
  box-shadow: var(--shadow);
}

.overlay-card h2 {
  margin: 0 0 10px;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2rem, 5vw, 3rem);
}

.overlay-card p,
.overlay-eyebrow {
  color: var(--text-soft);
}

.difficulty-picker {
  display: grid;
  gap: 10px;
  margin: 18px 0 20px;
  text-align: left;
}

.difficulty-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(110, 76, 22, 0.12);
  background: rgba(255, 255, 255, 0.44);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.difficulty-option:hover {
  transform: translateY(-1px);
  border-color: rgba(218, 94, 22, 0.22);
}

.difficulty-option input {
  margin: 0;
  accent-color: var(--accent-strong);
}

.difficulty-copy {
  display: grid;
  gap: 2px;
}

.difficulty-copy strong {
  font-size: 1rem;
  color: var(--text-main);
}

.difficulty-copy span {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.overlay-eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 800;
}

.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 24px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 24px rgba(218, 94, 22, 0.28);
}

@media (max-width: 1024px) {
  .board-panel {
    width: min(94vmin, 820px);
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .overlay {
    padding: 14px;
  }

  .board-panel {
    width: calc(100vw - 20px);
    border-radius: 26px;
  }
}
