:root {
  --pink: #db4699;
  --yellow: #ffed6c;
  --sheet: #ededed;
  --ink: #111111;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

::selection {
  background: var(--yellow);
  color: #000;
}

.stripe {
  height: 14px;
  background: var(--pink);
}

.stripe.yellow {
  height: 8px;
  background: var(--yellow);
}

html, body { max-width: 100%; overflow-x: hidden; }

.wrap {
  width: min(820px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  margin: 0 auto;
  padding: 22px 0 48px;
}

.mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.mast > div { min-width: 0; }

h1 {
  margin: 0;
}

.wordmark {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
}

.smiley {
  width: 108px;
  height: auto;
}

.release {
  margin: 8px 0 0;
  color: var(--pink);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.board {
  margin-top: 18px;
  max-width: 100%;
  min-width: 0;
  padding: 14px;
  background: #000;
  border: 4px solid var(--yellow);
  box-shadow: 8px 8px 0 var(--pink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}

.stats div {
  min-height: 92px;
  padding: 8px 8px 10px;
  background: var(--sheet);
  color: var(--ink);
}

.stats strong {
  display: block;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 0.95;
}

.stats span {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  line-height: 1.2;
}

.kicker {
  margin: 0;
  color: var(--pink);
  font-size: 0.95rem;
  font-weight: 700;
}

h2 {
  margin: 4px 0 12px;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.prompt {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.pieces {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.piece {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 40px;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
  cursor: grab;
}

.grip {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  color: #000;
  font-size: 1.6rem;
  line-height: 1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.piece.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.moves {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
}

.move {
  border: 0;
  background: var(--yellow);
  color: #000;
  font: 700 0.9rem/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.move:disabled {
  background: #bdbdbd;
  color: #333;
  cursor: default;
}

.piece img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: var(--sheet);
}

.feedback {
  min-height: 1.3em;
  margin: 12px 0 0;
  font-weight: 700;
}

.feedback.bad { color: var(--pink); }
.feedback.good { color: var(--yellow); }

.go,
.textbtn {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.go {
  margin-top: 12px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  background: var(--yellow);
  color: #000;
  font-size: 1.05rem;
}

.go:disabled { opacity: 0.55; }

.pata {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin-top: 22px;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.foot p,
.textbtn {
  margin: 0;
  color: #fff;
  font-size: 0.82rem;
}

.textbtn {
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.board.shake { animation: shake 0.35s linear; }

@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@media (max-width: 640px) {
  .smiley { width: 72px; }
  .stats { gap: 6px; }
  .stats div { min-height: 0; padding: 8px 6px; }
  .stats strong { font-size: 1.7rem; }
  .stats span { font-size: 0.72rem; }
  .board { box-shadow: 5px 5px 0 var(--pink); }
  .piece { grid-template-columns: 36px minmax(0, 1fr); }
  .presents { grid-template-columns: 1fr; }
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
}

.confetti[hidden] {
  display: none !important;
}

.confetti-bit {
  position: absolute;
  top: -40px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  0% {
    top: -40px;
    opacity: 1;
  }
  100% {
    top: 110vh;
    opacity: 0.9;
  }
}

.party {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 10px 0 14px;
}

.corgi-wrap {
  display: inline-block;
  animation: dance 0.28s ease-in-out infinite;
  transform-origin: 50% 100%;
}

.corgi {
  display: block;
  width: min(260px, 70vw);
  height: auto;
  image-rendering: pixelated;
  border: 4px solid var(--yellow);
  background: #ff00ff;
}

@keyframes dance {
  0% { transform: translateY(0) rotate(-12deg) scale(1.08, 0.92); }
  50% { transform: translateY(-28px) rotate(12deg) scale(0.92, 1.12); }
  100% { transform: translateY(0) rotate(-12deg) scale(1.08, 0.92); }
}

.presents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.present {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 4px solid var(--yellow);
  background: #111;
  color: var(--yellow);
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.present img,
.picked {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 2px solid #000;
}

.present:hover { background: #2a1020; }

.picked {
  width: min(240px, 60vw);
  border: 4px solid var(--pink);
}

.jumpscare {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: #000;
  pointer-events: none;
}

.jumpscare[hidden] {
  display: none !important;
}

.jumpscare img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.jumpscare.is-flash {
  background: #fff;
}

.jumpscare.is-flash img {
  opacity: 0;
}

.jumpscare.is-shake img {
  animation: scare-pop 0.12s steps(2) infinite;
}

@keyframes scare-pop {
  0% { transform: scale(1.05) translate(-2%, 1%); }
  50% { transform: scale(1.25) translate(3%, -2%); }
  100% { transform: scale(1.1) translate(-1%, 2%); }
}

@media (prefers-reduced-motion: reduce) {
  .board.shake { animation: none; }
  .jumpscare.is-shake img { animation: none; }
}
