/* Puzzle board: shared by the game (imported by src/styles.css) and the public website demo
   (copied by apps/site/demo/build.mjs). Edit here only; both surfaces render identical boards. */
.board-wrap {
  padding: clamp(2px, .65%, 5px);
  background: #fffaf0;
  border-radius: 13px;
}

.board {
  display: grid;
  width: min(100%, 580px);
  margin: 0 auto;
  aspect-ratio: 1;
  gap: clamp(1px, .42%, 4px);
  overflow: hidden;
  border-radius: 10px;
  background: #fffaf0;
  touch-action: none;
  user-select: none;
  container-type: inline-size;
}

.cell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: clamp(2px, 9%, 6px);
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  user-select: none;
  touch-action: none;
}

.cell:hover:not(:disabled) { filter: brightness(.96); }
.cell:active:not(:disabled) { filter: brightness(.92); }
.cell:disabled { cursor: default; }

.target {
  /* large boards (13x13-17x17) have cells under 25px on a phone: the glyph shrinks with the board so it never spills out of its cell */
  font-size: min(calc(76cqw / var(--board-size, 8)), 96px);
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.12));
  position: relative;
  z-index: 2;
}

.target-found {
  animation: target-found-pop 720ms cubic-bezier(.18, 1.35, .35, 1) both;
}
/* Only the actively celebrating cell may draw beyond its bounds.
   The settled target remains within the cell and other cells stay clipped. */
.cell:has(.target-found) { overflow: visible; z-index: 4; }

.target-celebration {
  position: absolute;
  inset: -14%;
  pointer-events: none;
  z-index: 3;
  display: grid;
  place-items: center;
  overflow: visible;
}

.target-callout {
  position: absolute;
  left: 50%;
  top: 4%;
  transform: translate(-50%, 12px) scale(.78);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(47, 36, 19, .9);
  color: #fff4b8;
  font-size: clamp(8px, 1.9vw, 12px);
  font-weight: 950;
  letter-spacing: .08em;
  line-height: 1;
  opacity: 0;
  white-space: nowrap;
  animation: target-callout-float 760ms ease-out forwards;
}

.target-ring {
  width: 68%;
  height: 68%;
  border-radius: 50%;
  border: 3px solid rgba(255, 215, 0, .88);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, .15), 0 0 18px rgba(255, 215, 0, .75);
  opacity: 0;
  animation: target-ring-burst 700ms ease-out forwards;
}

.target-spark {
  position: absolute;
  font-size: clamp(10px, 2.4vw, 16px);
  opacity: 0;
  animation: target-spark-burst 760ms ease-out forwards;
}

.target-spark-1 { left: 9%; top: 18%; --spark-x: -10px; --spark-y: -14px; }
.target-spark-2 { right: 8%; top: 14%; --spark-x: 12px; --spark-y: -16px; animation-delay: 55ms; }
.target-spark-3 { right: 12%; bottom: 10%; --spark-x: 14px; --spark-y: 12px; animation-delay: 105ms; }

@keyframes target-found-pop {
  0% { transform: translateY(12%) scale(.65) rotate(-10deg); opacity: .65; }
  32% { transform: translateY(-15%) scale(1.43) rotate(8deg); opacity: 1; filter: drop-shadow(0 6px 7px rgba(58, 39, 0, .38)); }
  55% { transform: translateY(4%) scale(.91) rotate(-4deg); }
  76% { transform: translateY(-4%) scale(1.08) rotate(2deg); }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; filter: drop-shadow(0 2px 1px rgba(0,0,0,.12)); }
}

@keyframes target-ring-burst {
  0% { transform: scale(.38); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: scale(1.48); opacity: 0; }
}

@keyframes target-callout-float {
  0% { transform: translate(-50%, 12px) scale(.78); opacity: 0; }
  20% { opacity: 1; }
  52% { transform: translate(-50%, -4px) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -18px) scale(.95); opacity: 0; }
}

@keyframes target-spark-burst {
  0% { transform: translate(0, 0) scale(.45) rotate(0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(var(--spark-x), var(--spark-y)) scale(1.18) rotate(32deg); opacity: 0; }
}

.xmark {
  width: 86%;
  height: 86%;
  display: block;
  position: relative;
  color: transparent;
  font-size: 0;
  line-height: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(47, 36, 19, .2));
}

.xmark::before,
.xmark::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 104%;
  height: 20%;
  border-radius: 999px;
  background: #fffdf7;
  transform-origin: center;
}

.xmark::before { transform: translate(-50%, -50%) rotate(45deg); }
.xmark::after { transform: translate(-50%, -50%) rotate(-45deg); }

.xmark.wrong-mark {
  filter: drop-shadow(0 2px 3px rgba(255, 255, 255, .55));
}

.xmark.wrong-mark::before,
.xmark.wrong-mark::after {
  background: #E11D48;
}

@media (prefers-reduced-motion: reduce) {
  .target-found,
  .target-callout,
  .target-ring,
  .target-spark {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

.xmark.wrong-mark { animation: wrong-mark-pop .4s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes wrong-mark-pop { 0% { transform: scale(.2); } 55% { transform: scale(1.45); } 100% { transform: scale(1); } }
