:root { --gap: 10px; --card-radius: 10px; --card-size: 200px; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", Arial; color: #111; background: #fff; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid #eee; }
.topbar h1 { font-size: 20px; margin: 0; }
.controls { display: flex; gap: 12px; align-items: center; }
select, .btn { padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; background: #fff; cursor: pointer; }
.btn:hover { border-color: #bbb; }
#playPauseBtn {
  padding: 16px 24px; /* 2x size */
  font-size: 32px;
  background: #28a745;
  border-color: #28a745;
}
#playPauseBtn:hover { border-color: #25ac9e; }

#playPauseBtn.playing {
  background: #28a745;
  border-color: #28a745;
}
#playPauseBtn.playing:hover { border-color: #c10717; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 16px; }
.stat { display: flex; justify-content: space-between; padding: 8px 12px; border: 1px solid #eee; border-radius: 8px; }
.board { display: grid; justify-content: center; gap: var(--gap); padding: 16px; position: relative; }
.card { width: var(--card-size); height: var(--card-size); perspective: 800px; }
.card button { width: 100%; height: 100%; border: 0; background: transparent; padding: 0; cursor: pointer; }
.flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 280ms ease; }
.card[data-state="faceup"] .flip { transform: rotateY(180deg); }
.face, .back { position: absolute; inset: 0; border-radius: var(--card-radius); display: grid; place-items: center; font-size: 36px; user-select: none; }
.back { background: #111; color: #fff; transform: rotateY(0deg); backface-visibility: hidden; }
.face { background: #f7f7f7; border: 1px solid #eee; transform: rotateY(180deg); backface-visibility: hidden; }
.card.matched .face { background: #e9ffe9; border-color: #cce8cc; }
.card:focus-within .back { outline: 2px solid #333; }

/* Back image sizing */
.back img { width: 60%; height: 60%; object-fit: contain; }

/* Confetti animation */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  display: grid;
  place-items: center;
}

.confetti .celebration-img {
  width: 440px;
  height: auto;
}

.confetti .celebration-msg {
  background: #ff0000;
  color: #fff;
  font-size: 36px;
  padding: 16px 24px;
  border-radius: 12px;
}

@media (max-width: 600px) { :root{ --card-size: 100px; --gap: 8px; } .topbar{ flex-direction: column; align-items: flex-start; gap: 8px; } }