:root {
  --ink: #221426;
  --paper: #fff7dc;
  --sky: #61c7f3;
  --sky-deep: #2f79d9;
  --grass: #4abf45;
  --grass-dark: #23713b;
  --brick: #d85036;
  --brick-dark: #8f2d2d;
  --coin: #ffd75a;
  --rose: #f66f8d;
  --indigo: #4b56d2;
  --mint: #64dca8;
  --shadow: rgba(31, 21, 32, 0.28);
  --white: #ffffff;
  --focus: #101820;
  --pixel: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 16px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #14324b;
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 4px;
}

.app,
.screen {
  min-height: 100dvh;
  width: 100%;
}

.screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.22);
  transform: translateY(0);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 6px;
  background: var(--coin);
  border: 3px solid var(--ink);
}

.secondary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 5px;
  background: var(--paper);
  border: 3px solid var(--ink);
}

.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
}

.primary-button:active,
.secondary-button:active {
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
  transform: translateY(4px);
}

.asset-frame {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.asset-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.face-frame img {
  object-fit: cover;
  image-rendering: auto;
}

.asset-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 48%),
    var(--paper);
  border: 3px dashed rgba(34, 20, 38, 0.55);
  color: var(--ink);
  text-align: center;
  line-height: 1;
}

.image-missing img {
  display: none;
}

.image-missing .asset-fallback {
  display: grid;
}

.dialogue-panel p,
.speaker-chip,
.overline,
.game-header h1,
.complete-panel h1,
.gift-reveal h1,
.game-status,
.progress-dot,
.prize-item strong {
  font-family: var(--pixel);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro-screen {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.9) 0 42px, transparent 44px),
    linear-gradient(var(--sky), var(--sky-deep));
}

.sky-stripes {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px) 0 0 / 38px 38px,
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px) 0 0 / 38px 38px;
  opacity: 0.42;
  z-index: -2;
}

.cloud {
  position: absolute;
  width: 130px;
  height: 46px;
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: 6px;
  box-shadow: 8px 8px 0 rgba(255, 255, 255, 0.45);
  opacity: 0.94;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 18px;
  width: 54px;
  height: 54px;
  background: var(--white);
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.cloud::before {
  left: 16px;
}

.cloud::after {
  right: 12px;
  width: 42px;
  height: 42px;
}

.cloud-one {
  top: 9vh;
  left: 8vw;
  animation: cloudDrift 14s linear infinite;
}

.cloud-two {
  top: 18vh;
  right: 8vw;
  transform: scale(0.78);
  animation: cloudDrift 18s linear infinite reverse;
}

.platform-stage {
  position: relative;
  align-self: end;
  display: grid;
  grid-template-columns: 1fr minmax(88px, 12vw) minmax(160px, 22vw) minmax(88px, 12vw) 1fr;
  align-items: end;
  gap: clamp(12px, 3vw, 28px);
  min-height: 67dvh;
  padding: 18vh clamp(12px, 5vw, 60px) 9vh;
}

.platform-stage::before,
.platform-stage::after {
  content: "";
  position: absolute;
  bottom: 0;
  z-index: -1;
}

.platform-stage::before {
  left: -4vw;
  right: -4vw;
  height: 26vh;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25%) 0 0 / 46px 46px,
    linear-gradient(-45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%) 0 0 / 46px 46px,
    var(--grass);
  border-top: 6px solid var(--ink);
}

.platform-stage::after {
  left: 0;
  right: 0;
  height: 9vh;
  background:
    linear-gradient(90deg, var(--brick-dark) 3px, transparent 3px) 0 0 / 48px 32px,
    linear-gradient(var(--brick-dark) 3px, transparent 3px) 0 0 / 48px 32px,
    var(--brick);
}

.floor-line {
  position: absolute;
  bottom: 26vh;
  left: 0;
  right: 0;
  border-top: 5px solid rgba(34, 20, 38, 0.52);
}

.case-preview {
  grid-column: 3;
  justify-self: center;
  position: relative;
  width: min(24vw, 160px);
  aspect-ratio: 1.25;
  margin-bottom: 4vh;
  animation: idleBounce 1.6s ease-in-out infinite;
}

.mini-case {
  position: absolute;
  inset: 12% 4% 0;
  background:
    linear-gradient(90deg, transparent 47%, rgba(255, 255, 255, 0.28) 47% 53%, transparent 53%),
    #2f5adf;
  border: 5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.22);
}

.mini-case::before {
  content: "";
  position: absolute;
  top: 26%;
  left: -5px;
  right: -5px;
  border-top: 5px solid var(--ink);
}

.case-lock,
.case-lock-large {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 30px;
  height: 34px;
  transform: translateX(-50%);
  background: var(--coin);
  border: 4px solid var(--ink);
  border-radius: 4px;
}

.case-lock::before,
.case-lock-large::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 24px;
  height: 22px;
  transform: translateX(-50%);
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
}

.character {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: end;
  width: clamp(92px, 12vw, 140px);
  animation: idleBounce 1.4s steps(2, end) infinite;
  z-index: 2;
}

.character-left {
  grid-column: 2;
}

.character-right {
  grid-column: 4;
}

.character.is-talking {
  animation-duration: 0.76s;
}

.pixel-hat {
  position: relative;
  z-index: 3;
  width: 72%;
  height: 22px;
  margin-bottom: -8px;
  background: var(--coin);
  border: 4px solid var(--ink);
  border-radius: 4px 4px 0 0;
}

.pixel-hat::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -14px;
  width: 26px;
  height: 16px;
  transform: translateX(-50%);
  background: inherit;
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.head {
  position: relative;
  width: 82%;
  aspect-ratio: 1;
  background: #f7c18c;
  border: 5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 2;
}

.face-frame {
  width: 100%;
  height: 100%;
}

.face-frame .asset-fallback {
  border: 0;
  font-size: clamp(2rem, 6vw, 4.25rem);
}

.body {
  position: relative;
  display: flex;
  justify-content: center;
  width: 74%;
  height: clamp(56px, 7vw, 78px);
  margin-top: -2px;
}

.torso {
  width: 58%;
  height: 100%;
  background: var(--indigo);
  border: 5px solid var(--ink);
  border-radius: 5px;
}

.suit-rose .torso,
.suit-rose .arm {
  background: var(--rose);
}

.suit-indigo .torso,
.suit-indigo .arm {
  background: var(--indigo);
}

.arm {
  position: absolute;
  top: 4px;
  width: 24%;
  height: 74%;
  border: 5px solid var(--ink);
  border-radius: 5px;
  transform-origin: top center;
}

.arm-left {
  left: 0;
  transform: rotate(12deg);
}

.arm-right {
  right: 0;
  transform: rotate(-12deg);
}

.is-talking .arm-right {
  animation: talkWave 420ms steps(2, end) infinite;
}

.feet {
  width: 62%;
  height: 20px;
  background:
    linear-gradient(90deg, var(--ink) 0 44%, transparent 44% 56%, var(--ink) 56%);
}

.dialogue-panel {
  position: relative;
  width: min(760px, calc(100% - 28px));
  min-height: 142px;
  margin: 0 auto clamp(18px, 3vw, 34px);
  padding: 28px clamp(18px, 4vw, 34px) 22px;
  background: var(--paper);
  border: 5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.26);
  z-index: 5;
}

.dialogue-panel::before {
  content: "";
  position: absolute;
  top: -24px;
  width: 34px;
  height: 34px;
  background: var(--paper);
  border-top: 5px solid var(--ink);
  border-left: 5px solid var(--ink);
  transform: rotate(45deg);
}

.dialogue-panel.from-left::before {
  left: 22%;
}

.dialogue-panel.from-right::before {
  right: 22%;
}

.speaker-chip {
  position: absolute;
  top: -18px;
  left: 22px;
  padding: 6px 12px;
  background: var(--mint);
  border: 4px solid var(--ink);
  border-radius: 5px;
  font-size: 0.82rem;
}

.dialogue-panel p {
  max-width: 620px;
  margin: 0 0 18px;
  font-size: clamp(1.06rem, 2.8vw, 1.55rem);
  line-height: 1.34;
}

.dialogue-panel .primary-button {
  float: right;
}

.game-screen,
.complete-screen {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(12px, 2.6vw, 26px);
  min-height: 100dvh;
  padding: clamp(16px, 3.2vw, 40px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(#55c7ee 0 58%, #4abf45 58% 100%);
  overflow-x: hidden;
  overflow-y: auto;
}

.game-screen::after,
.complete-screen::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(54px, 8vh, 84px);
  background:
    linear-gradient(90deg, var(--brick-dark) 3px, transparent 3px) 0 0 / 48px 32px,
    linear-gradient(var(--brick-dark) 3px, transparent 3px) 0 0 / 48px 32px,
    var(--brick);
  border-top: 5px solid var(--ink);
  z-index: -1;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.overline {
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: rgba(34, 20, 38, 0.78);
}

.game-header h1,
.complete-panel h1,
.gift-reveal h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 3.1rem);
  line-height: 0.96;
  text-shadow: 3px 3px 0 rgba(255, 255, 255, 0.55);
}

.game-progress {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.progress-dot {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.7);
  border: 3px solid var(--ink);
  border-radius: 5px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.progress-dot.is-current {
  background: var(--coin);
}

.progress-dot.is-done {
  background: var(--mint);
}

.game-board {
  align-self: start;
  justify-self: center;
  display: grid;
  gap: 16px;
  width: min(980px, 100%);
  min-height: min(620px, calc(100dvh - 150px));
  padding: clamp(14px, 2.8vw, 24px);
  background: rgba(255, 247, 220, 0.9);
  border: 5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.26);
}

.game-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  color: rgba(34, 20, 38, 0.86);
}

.game-status strong {
  min-width: 58px;
  padding: 5px 10px;
  text-align: center;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 5px;
}

.game-mount {
  display: grid;
  place-items: center;
  min-height: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(64px, 1fr));
  gap: clamp(8px, 2vw, 14px);
  width: min(620px, 100%);
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 7px;
  backface-visibility: hidden;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.2);
  transition: transform 260ms ease;
}

.card-back {
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%) 0 0 / 18px 18px,
    #2f5adf;
}

.card-front {
  background: #ffffff;
  transform: rotateY(180deg);
}

.memory-card.is-flipped .card-back {
  transform: rotateY(180deg);
}

.memory-card.is-flipped .card-front {
  transform: rotateY(360deg);
}

.memory-card.is-matched .card-front {
  background: #d7ffe3;
}

.card-mark {
  width: 42%;
  aspect-ratio: 1;
  background: var(--coin);
  border: 4px solid var(--ink);
  border-radius: 5px;
  box-shadow:
    18px 18px 0 rgba(255, 255, 255, 0.28),
    -18px -18px 0 rgba(255, 255, 255, 0.18);
}

.game-piece {
  width: min(70%, 78px);
  aspect-ratio: 1;
  border-radius: 7px;
}

.game-piece .asset-fallback {
  font-size: clamp(1rem, 4vw, 2rem);
}

.card-piece img,
.platform-player-art img,
.platform-collectible-art img {
  object-fit: cover;
  image-rendering: auto;
}

.platform-goal-art img {
  object-fit: contain;
  image-rendering: pixelated;
}

.crush-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(620px, 100%);
}

.crush-grid {
  display: grid;
  grid-template-columns: repeat(var(--crush-size), minmax(42px, 1fr));
  gap: clamp(5px, 1.4vw, 10px);
  width: min(560px, 100%);
}

.crush-cell {
  --piece-accent: rgba(34, 20, 38, 0.28);
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  background: #ffffff;
  border: 4px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.2);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    filter 140ms ease;
}

.crush-cell::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 3px solid var(--piece-accent);
  border-radius: 5px;
  pointer-events: none;
}

.crush-cell.is-selected {
  transform: translateY(-6px);
  box-shadow: 0 13px 0 rgba(0, 0, 0, 0.18);
  background: #fff0a9;
}

.crush-cell.is-matched {
  animation: crushPop 260ms ease-in-out 1;
  filter: brightness(1.18);
}

.crush-cell.is-invalid {
  background: #ffb1b1;
  animation: wrongShake 220ms linear 1;
}

.crush-cell.piece-0 {
  --piece-accent: #12825a;
  background: #c9ffe8;
}

.crush-cell.piece-1 {
  --piece-accent: #1379a7;
  background: #c8f0ff;
}

.crush-cell.piece-2 {
  --piece-accent: #5751c8;
  background: #ddd9ff;
}

.crush-cell.piece-3 {
  --piece-accent: #c82562;
  background: #ffd0df;
}

.crush-cell.piece-4 {
  --piece-accent: #a56c00;
  background: #ffeb90;
}

.crush-piece {
  width: 74%;
}

.crush-piece img {
  object-fit: cover;
  image-rendering: auto;
}

.photo-catch-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(620px, 100%);
}

.photo-catch-target {
  display: grid;
  place-items: center;
  width: clamp(86px, 18vw, 118px);
  aspect-ratio: 1;
  background: var(--coin);
  border: 4px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
  animation: activePulse 900ms ease-in-out infinite;
}

.photo-catch-field {
  position: relative;
  display: grid;
  width: min(560px, 100%);
  height: min(420px, 54vh);
  min-height: 320px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(#8ee4ff 0 68%, #75d66b 68% 100%);
  border: 5px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 -18px 0 rgba(0, 0, 0, 0.08);
  touch-action: manipulation;
}

.photo-catch-field::before,
.photo-catch-field::after {
  content: "";
  position: absolute;
  bottom: 68px;
  width: 92px;
  height: 34px;
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: 7px;
  opacity: 0.74;
}

.photo-catch-field::before {
  left: 12%;
}

.photo-catch-field::after {
  right: 14%;
  bottom: 210px;
}

.photo-catch-drop {
  position: absolute;
  top: 0;
  display: grid;
  place-items: center;
  width: clamp(62px, 15vw, 82px);
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  background: #ffffff;
  border: 4px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
  transition:
    filter 140ms ease,
    background 140ms ease;
  z-index: 2;
}

.photo-catch-drop:active {
  filter: brightness(1.08);
}

.photo-catch-drop.is-wrong {
  background: #ffb1b1;
  animation: wrongShake 180ms linear 1;
}

.photo-catch-target-art,
.photo-catch-piece {
  width: 76%;
}

.photo-catch-target-art img,
.photo-catch-piece img {
  object-fit: cover;
  image-rendering: auto;
}

.platformer-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
}

.platform-viewport {
  position: relative;
  width: min(760px, 100%);
  height: min(340px, 58vh);
  min-height: 270px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(#67d2f4 0 70%, #9be15d 70% 100%);
  border: 5px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 -18px 0 rgba(0, 0, 0, 0.08);
  touch-action: none;
}

.platform-world {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateX(0);
  transition: transform 90ms linear;
}

.platform-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 110px 64px, rgba(255, 255, 255, 0.92) 0 26px, transparent 28px),
    radial-gradient(circle at 350px 98px, rgba(255, 255, 255, 0.86) 0 20px, transparent 22px),
    radial-gradient(circle at 650px 58px, rgba(255, 255, 255, 0.86) 0 24px, transparent 26px);
  pointer-events: none;
}

.platform-block {
  position: absolute;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 25%, transparent 25%) 0 0 / 24px 24px,
    var(--brick);
  border: 4px solid var(--ink);
  border-radius: 5px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
}

.platform-player,
.platform-collectible,
.platform-goal {
  position: absolute;
  display: grid;
  place-items: center;
}

.platform-player {
  left: 0;
  top: 0;
  z-index: 4;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.24));
  transition: transform 48ms linear;
}

.platform-player.is-left .platform-player-art {
  transform: scaleX(-1);
}

.platform-player-art,
.platform-collectible-art,
.platform-goal-art {
  width: 100%;
  height: 100%;
}

.platform-collectible {
  z-index: 3;
  animation: activePulse 900ms ease-in-out infinite;
}

.platform-collectible.is-collected {
  opacity: 0;
  transform: translateY(-14px) scale(0.35);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.platform-goal {
  z-index: 2;
  padding: 4px;
  background: rgba(255, 215, 90, 0.46);
  border: 4px solid var(--ink);
  border-radius: 7px;
  filter: grayscale(1);
}

.platform-goal.is-open {
  filter: none;
  animation: activePulse 780ms ease-in-out infinite;
}

.platform-controls {
  display: grid;
  grid-template-columns: 54px 62px 54px minmax(112px, auto);
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.control-button {
  display: grid;
  place-items: center;
  width: 54px;
  height: 48px;
  padding: 0;
  cursor: pointer;
  background: var(--coin);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.2);
  color: var(--ink);
}

.jump-button {
  width: 62px;
  height: 56px;
  background: var(--mint);
}

.unlock-screen {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 54%, rgba(255, 255, 255, 0.34) 0 0, transparent 1px),
    linear-gradient(#17375b, #102235);
}

.unlock-scene {
  position: relative;
  display: grid;
  place-items: center;
  width: min(720px, calc(100% - 24px));
  min-height: min(680px, 94dvh);
}

.unlock-case {
  position: relative;
  display: grid;
  place-items: center;
  width: min(420px, 78vw);
  aspect-ratio: 1;
}

.case-shell {
  position: absolute;
  inset: 22% 8% 20%;
  display: grid;
  place-items: center;
  transform-origin: 50% 78%;
  transition:
    opacity 240ms ease 420ms,
    transform 320ms ease 420ms;
  z-index: 3;
}

.case-art {
  width: 100%;
  height: 100%;
  border-radius: 9px;
}

.case-art .asset-fallback {
  background:
    linear-gradient(90deg, transparent 47%, rgba(255, 255, 255, 0.3) 47% 53%, transparent 53%),
    #385be7;
  font-size: clamp(1.5rem, 7vw, 3.8rem);
}

.case-lid {
  position: absolute;
  left: 0;
  right: 0;
  top: 2%;
  height: 32%;
  background: rgba(255, 255, 255, 0.14);
  border: 5px solid var(--ink);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  transform-origin: 50% 100%;
  transition: transform 520ms cubic-bezier(0.2, 0.86, 0.2, 1.24);
}

.case-lock-large {
  width: 48px;
  height: 54px;
  top: 52%;
  z-index: 4;
  transition:
    transform 360ms ease,
    opacity 220ms ease;
}

.case-lock-large::before {
  width: 36px;
  height: 30px;
  bottom: 41px;
}

.gift-reveal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: start;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding-top: clamp(0px, 1vw, 8px);
  opacity: 0;
  transform: translateY(58px) scale(0.72);
  transition:
    transform 780ms cubic-bezier(0.2, 0.86, 0.2, 1.1),
    opacity 220ms ease;
  z-index: 2;
}

.gift-reveal h1 {
  max-width: min(520px, 88vw);
  text-align: center;
  z-index: 6;
}

.gift-art {
  align-self: center;
  width: min(260px, 52vw);
  aspect-ratio: 1;
  filter: drop-shadow(0 20px 0 rgba(0, 0, 0, 0.24));
}

.gift-art .asset-fallback {
  border-style: solid;
  background: var(--coin);
  font-size: clamp(1.5rem, 8vw, 4rem);
}

.flash-layer {
  position: absolute;
  inset: -20vh -20vw;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.unlock-next {
  position: absolute;
  bottom: clamp(10px, 4vh, 34px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition:
    transform 260ms ease,
    opacity 260ms ease,
    box-shadow 160ms ease;
  z-index: 12;
}

.unlock-screen.is-shaking .case-shell {
  animation: unlockShake 680ms steps(2, end) 2;
}

.unlock-screen.is-flashing .flash-layer {
  animation: flashPop 560ms ease-out 1;
}

.unlock-screen.is-open .case-lid {
  transform: translateY(-34%) rotateX(72deg);
}

.unlock-screen.is-open .case-lock-large {
  opacity: 0;
  transform: translate(-50%, 44px) rotate(18deg);
}

.unlock-screen.is-open .case-shell {
  opacity: 0;
  transform: translateY(42px) scale(0.88);
}

.unlock-screen.is-open .gift-reveal {
  opacity: 1;
  transform: translateY(-36px) scale(1);
  z-index: 5;
}

.unlock-screen.is-ready .unlock-next {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.complete-screen {
  place-items: center;
  grid-template-rows: 1fr;
}

.complete-panel {
  display: grid;
  justify-items: center;
  gap: 22px;
  width: min(820px, 100%);
  padding: clamp(20px, 5vw, 44px);
  background: rgba(255, 247, 220, 0.94);
  border: 5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.26);
  text-align: center;
}

.prize-shelf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

.prize-item {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: #ffffff;
  border: 4px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.16);
}

.gift-small {
  width: min(118px, 25vw);
  aspect-ratio: 1;
}

.gift-small .asset-fallback {
  background: var(--coin);
}

@keyframes idleBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes cloudDrift {
  0% {
    translate: -10px 0;
  }
  100% {
    translate: 18px 0;
  }
}

@keyframes talkWave {
  0%,
  100% {
    transform: rotate(-12deg);
  }
  50% {
    transform: rotate(-38deg) translateY(-3px);
  }
}

@keyframes activePulse {
  0%,
  100% {
    transform: translateY(-5px);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-12px);
    filter: brightness(1.1);
  }
}

@keyframes crushPop {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.72);
  }
}

@keyframes wrongShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@keyframes unlockShake {
  0%,
  100% {
    transform: rotate(0) translateX(0);
  }
  20% {
    transform: rotate(-5deg) translateX(-10px);
  }
  40% {
    transform: rotate(4deg) translateX(8px);
  }
  60% {
    transform: rotate(-4deg) translateX(-8px);
  }
  80% {
    transform: rotate(5deg) translateX(10px);
  }
}

@keyframes flashPop {
  0% {
    opacity: 0;
  }
  25% {
    opacity: 0.94;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .intro-screen {
    min-height: 100svh;
  }

  .platform-stage {
    grid-template-columns: minmax(72px, 1fr) minmax(120px, 1.3fr) minmax(72px, 1fr);
    gap: 8px;
    min-height: 60svh;
    padding: 14vh 12px 8vh;
  }

  .character-left {
    grid-column: 1;
  }

  .case-preview {
    grid-column: 2;
    width: min(30vw, 128px);
  }

  .character-right {
    grid-column: 3;
  }

  .character {
    width: clamp(76px, 24vw, 112px);
  }

  .dialogue-panel {
    min-height: 154px;
    padding-bottom: 18px;
  }

  .dialogue-panel .primary-button {
    float: none;
    width: 100%;
  }

  .game-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-board {
    min-height: auto;
  }

  .card-grid {
    grid-template-columns: repeat(3, minmax(64px, 1fr));
  }

  .crush-grid {
    grid-template-columns: repeat(var(--crush-size), minmax(36px, 1fr));
    width: min(500px, 100%);
  }

  .platform-controls {
    grid-template-columns: 54px 62px 54px;
  }

  .platform-controls .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .prize-shelf {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .game-screen,
  .complete-screen {
    padding: 12px;
  }

  .game-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .crush-grid {
    gap: 7px;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
