:root {
  --bg-top: #fff1df;
  --bg-bottom: #ffd6cf;
  --ink: #582f45;
  --accent: #ff6f7d;
  --accent-deep: #d94b69;
  --cream: #fff9f1;
  --chocolate: #7a4a39;
  --strawberry: #ff8eb5;
  --shadow: rgba(122, 74, 57, 0.22);
  --panel: rgba(255, 249, 241, 0.72);
  --panel-border: rgba(255, 255, 255, 0.8);
}

* {
  box-sizing: border-box;
}

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

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(4px);
  z-index: -1;
  opacity: 0.55;
}

body::before {
  top: -8rem;
  right: -6rem;
  background: rgba(255, 189, 203, 0.5);
}

body::after {
  bottom: -9rem;
  left: -7rem;
  background: rgba(255, 229, 168, 0.55);
}

.app-shell {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 2.5rem;
}

.hud,
.play-area {
  display: grid;
  gap: 1.25rem;
}

.hud {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-deep);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Chewy", cursive;
  font-weight: 400;
  letter-spacing: 0.03em;
}

h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.92;
}

.subcopy {
  width: min(42rem, 100%);
  margin: 0.7rem 0 0;
  font-size: 1.02rem;
  line-height: 1.5;
}

.scoreboard {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.score-card,
.legend-card,
.board-frame {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 50px var(--shadow);
  backdrop-filter: blur(14px);
}

.score-card {
  min-width: 9rem;
  padding: 1rem 1.1rem;
  border-radius: 1.4rem;
  text-align: center;
}

.score-card span {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
}

.score-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 2rem;
}

.play-area {
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: start;
}

.board-column {
  display: grid;
  gap: 0.95rem;
  align-content: start;
}

.board-frame {
  position: relative;
  overflow: hidden;
  border-radius: 2rem;
  padding: 1rem;
  max-width: 620px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1.4rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #ffe9db, #ffcfc6);
}

.board-overlay {
  position: absolute;
  inset: 1rem;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.9rem;
  padding: 2rem;
  text-align: center;
  background: rgba(88, 47, 69, 0.2);
  color: #fffefc;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.board-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.board-overlay h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.board-overlay p {
  max-width: 28rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.5rem;
  font: inherit;
  font-weight: 800;
  color: #fffefc;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(217, 75, 105, 0.28);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(217, 75, 105, 0.35);
}

button:active {
  transform: translateY(1px);
}

.legend {
  display: grid;
  gap: 1rem;
}

.legend-card {
  border-radius: 1.5rem;
  padding: 1.1rem 1.15rem;
}

.legend-card h3 {
  margin-bottom: 0.45rem;
  font-size: 1.6rem;
}

.legend-card p {
  margin: 0;
  line-height: 1.5;
}

.mobile-controls {
  display: none;
  gap: 0.65rem;
  justify-items: center;
  width: min(100%, 620px);
}

.control-row {
  display: flex;
  gap: 0.65rem;
}

.control-button {
  min-width: 5.2rem;
  padding: 0.9rem 1rem;
  touch-action: manipulation;
}

.control-button.pause {
  background: linear-gradient(180deg, #ffa44f, #ef7f3f);
}

@media (max-width: 920px) {
  .hud,
  .play-area {
    grid-template-columns: 1fr;
  }

  .scoreboard {
    justify-content: flex-start;
  }

  .board-frame {
    max-width: 100%;
  }

  .board-column,
  .legend {
    order: unset;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 1rem, 100%);
    padding-top: 1rem;
    padding-bottom: 1.25rem;
  }

  .board-frame {
    padding: 0.65rem;
    border-radius: 1.35rem;
  }

  .board-overlay {
    inset: 0.65rem;
    padding: 1rem;
  }

  .board-overlay p,
  .legend-card p,
  .subcopy {
    font-size: 0.95rem;
  }

  .legend {
    gap: 0.8rem;
    order: 2;
  }

  .legend-card {
    padding: 1rem;
  }

  .mobile-controls {
    display: grid;
    order: 1;
    margin-top: 0.05rem;
  }
}
