:root {
  --ink: #17202a;
  --milk: #fff8e8;
  --leaf: #2f8f64;
  --leaf-dark: #1f6349;
  --sun: #f9b233;
  --water: #77c9e8;
  --berry: #e45d72;
  --shadow: rgba(31, 45, 58, 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(249, 178, 51, 0.24), transparent 24rem),
    linear-gradient(135deg, #71c8e7 0%, #e9f7ef 48%, #f8e8ae 100%);
  color: var(--ink);
  font-family:
    Trebuchet MS,
    Arial,
    sans-serif;
}

button {
  font: inherit;
}

.phone-shell {
  position: relative;
  width: min(100vw, 480px, calc(100vh * 9 / 16));
  aspect-ratio: 9 / 16;
  height: auto;
  max-height: 100vh;
  overflow: hidden;
  background: #1a3d2c;
  box-shadow: 0 20px 60px rgba(24, 47, 67, 0.32);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 4.4vh, 34px);
}

.screen[hidden] {
  display: none;
}

.screen-start {
  padding: 0;
}

.screen-mode {
  padding: 0;
}

.mode-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center center;
  pointer-events: none;
  user-select: none;
}

.mode-grid-2x2 {
  position: absolute;
  z-index: 4;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: clamp(8px, 2vw, 12px);
  width: 88%;
  max-width: 380px;
  max-height: 66%;
  align-content: start;
}

.mode-grid-5 {
  grid-template-rows: auto auto auto;
  top: 16%;
  max-height: 70%;
}

.mode-card-wide {
  grid-column: auto;
  justify-self: stretch;
  width: 100%;
}

.mode-card {
  position: relative;
  z-index: 5;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease;
  filter: drop-shadow(0 8px 14px rgba(20, 60, 40, 0.3));
  touch-action: manipulation;
}

.mode-card:nth-child(1) {
  animation: modePop 1.8s ease-in-out infinite;
}

.mode-card:nth-child(2) {
  animation: modePop 1.8s ease-in-out 0.15s infinite;
}

.mode-card:nth-child(3) {
  animation: modePop 1.8s ease-in-out 0.3s infinite;
}

.mode-card:nth-child(4) {
  animation: modePop 1.8s ease-in-out 0.45s infinite;
}

.mode-card:nth-child(5) {
  animation: modePop 1.8s ease-in-out 0.55s infinite;
}

.mode-card:nth-child(6) {
  animation: modePop 1.8s ease-in-out 0.65s infinite;
}

.mode-card-wide img {
  max-height: min(18vh, 120px);
  aspect-ratio: 1;
}

.mode-card img {
  width: 100%;
  height: auto;
  max-height: min(28vh, 170px);
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  pointer-events: none;
  border-radius: 18px;
}

.mode-card:active {
  transform: scale(0.96);
  animation: none;
}

.mode-card:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 4px;
  border-radius: 22px;
}

.mode-card-learn {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 6px solid #ffc65b;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 35%),
    linear-gradient(180deg, #cf8246, #8f512d);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.24),
    inset 0 -8px 0 rgba(0, 0, 0, 0.16),
    0 7px 0 #9b5c1e,
    0 12px 18px rgba(20, 60, 40, 0.3);
  overflow: hidden;
}

.mode-learn-preview {
  display: flex;
  gap: 5px;
  margin-top: 10%;
}

.mode-learn-preview span {
  width: clamp(26px, 7vw, 42px);
  aspect-ratio: 0.72;
  border: 4px solid #ffe1a0;
  border-radius: 9px;
  background:
    repeating-linear-gradient(
      0deg,
      #d99a58 0 7px,
      #c98545 8px 12px
    );
  box-shadow: 0 4px 0 rgba(75, 43, 20, 0.28);
}

.mode-learn-preview span:nth-child(1) {
  transform: rotate(-10deg);
}

.mode-learn-preview span:nth-child(3) {
  transform: rotate(10deg);
}

.mode-learn-title {
  color: #ffffff;
  font-size: clamp(21px, 5.4vw, 34px);
  font-weight: 900;
  line-height: 0.92;
  text-align: center;
  text-shadow:
    0 3px 0 rgba(55, 32, 18, 0.6),
    0 6px 10px rgba(40, 35, 30, 0.28);
}

.mode-back-btn {
  position: absolute;
  z-index: 5;
  left: 3.5%;
  top: 2.4%;
  width: 52px;
  height: 52px;
}

@keyframes modePop {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.02);
  }
}

.home-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center center;
  pointer-events: none;
  user-select: none;
}

.home-btn {
  position: absolute;
  z-index: 4;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.home-btn img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

.home-btn:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 3px;
  border-radius: 999px;
}

.home-btn:active {
  transform: scale(0.96);
}

.home-btn-close,
.home-btn-settings {
  top: 2.4%;
  width: 12%;
  max-width: 56px;
}

.home-btn-close {
  left: 3.5%;
}

.home-btn-settings {
  right: 3.5%;
}

.home-btn-play {
  left: 12%;
  width: 76%;
  bottom: 16%;
  animation: playBounce 1.45s ease-in-out infinite;
  filter: drop-shadow(0 0 0 rgba(255, 200, 40, 0));
}

.home-btn-play::after {
  content: "";
  position: absolute;
  inset: 8% 4%;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255, 200, 40, 0.7);
  animation: playPulse 1.45s ease-out infinite;
}

.home-btn-play:active {
  animation: none;
  transform: scale(0.96);
}

@keyframes playBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.03);
  }
}

@keyframes playPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 200, 40, 0.7);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(255, 200, 40, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 200, 40, 0);
  }
}

.screen-overlay {
  z-index: 5;
  justify-content: center;
  align-items: center;
  background: rgba(12, 40, 28, 0.72);
}

.overlay-card {
  display: grid;
  gap: 14px;
  width: min(86%, 340px);
  padding: 24px 20px;
  border: 8px solid rgba(255, 255, 255, 0.88);
  border-radius: 32px;
  background: rgba(255, 248, 232, 0.95);
  text-align: center;
  box-shadow: 0 14px 0 rgba(47, 143, 100, 0.26), 0 24px 38px var(--shadow);
}

.overlay-card h2 {
  color: var(--leaf-dark);
  font-size: clamp(36px, 9vw, 48px);
  line-height: 0.95;
}

.overlay-card p {
  margin: 0;
  color: #224231;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
}

.overlay-card .asset-btn {
  width: 100%;
}

.eyebrow,
.prompt-kicker {
  margin: 0;
  color: var(--leaf-dark);
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

.photo-frame img,
.collection img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.pause-card p {
  margin: 0;
  color: #224231;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  line-height: 1.15;
}

.asset-btn {
  min-height: 58px;
  border: 0;
  border-radius: 22px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.55),
    inset 0 -7px 0 rgba(0, 0, 0, 0.18),
    0 10px 0 rgba(32, 100, 74, 0.28),
    0 18px 24px var(--shadow);
  transform: translateY(0);
  transition:
    transform 120ms ease,
    filter 120ms ease;
}

.asset-btn:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.44),
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 5px 0 rgba(32, 100, 74, 0.28),
    0 12px 20px var(--shadow);
}

.asset-btn:focus-visible {
  outline: 5px solid #ffffff;
  outline-offset: 4px;
}

.asset-btn.primary {
  width: min(88%, 360px);
  justify-self: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 38%),
    linear-gradient(180deg, #ffcf4d, #ee8d2f);
  font-size: clamp(30px, 7vw, 42px);
}

.asset-btn.secondary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 38%),
    linear-gradient(180deg, #48bddc, #267ca9);
  font-size: clamp(24px, 5.5vw, 34px);
}

.asset-btn.small {
  min-height: 44px;
  padding: 0 18px 5px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 40%),
    linear-gradient(180deg, #f47b8c, #c84762);
  font-size: 17px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.48),
    inset 0 -5px 0 rgba(0, 0, 0, 0.17),
    0 6px 0 rgba(109, 47, 70, 0.24);
}

.screen-game {
  gap: clamp(6px, 1.2vh, 12px);
  padding: clamp(12px, 2.6vh, 20px);
}

.game-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
}

.screen-game > *:not(.game-art) {
  position: relative;
  z-index: 1;
}

.top-hud {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 8px;
  min-height: 52px;
}

.hud-icon-btn {
  width: 52px;
  height: 52px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 4px 8px rgba(20, 60, 40, 0.22));
  transition: transform 120ms ease;
}

.hud-icon-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.hud-icon-btn:active {
  transform: scale(0.92);
}

.hud-icon-btn:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  border-radius: 50%;
}

.round-chip {
  display: grid;
  justify-self: center;
  min-width: 88px;
  min-height: 44px;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 42%),
    linear-gradient(180deg, #fff4c8, #f5d26a);
  color: #5a3a00;
  font-size: 22px;
  font-weight: 900;
  box-shadow:
    0 6px 0 rgba(180, 120, 20, 0.28),
    0 10px 18px rgba(20, 60, 40, 0.18);
}

.ask-line {
  margin: 0;
  text-align: center;
  color: #ffffff;
  font-size: clamp(30px, 7.4vw, 42px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow:
    0 3px 0 #1f6b45,
    0 8px 16px rgba(20, 60, 40, 0.35);
}

.help-line {
  margin: 0;
  text-align: center;
  color: #fff8e8;
  font-size: clamp(18px, 4.4vw, 22px);
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 2px 0 rgba(20, 60, 40, 0.4);
  background: rgba(20, 70, 45, 0.35);
  border-radius: 16px;
  padding: 8px 12px;
}

.help-line[hidden] {
  display: none !important;
}

.prompt-zone {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  text-align: center;
}

.screen-game.is-sound-mode .prompt-zone {
  flex: 1.15 1 auto;
}

.screen-game.is-sound-mode .choices {
  margin-top: 4px;
}

.prompt-name {
  display: grid;
  place-items: center;
  margin: 0;
  min-width: 70%;
  min-height: clamp(90px, 16vh, 140px);
  padding: 12px 22px;
  border: 8px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 40%),
    linear-gradient(180deg, #ffe082, #f0a830);
  color: #5a3200;
  font-size: clamp(44px, 12vw, 68px);
  font-weight: 900;
  line-height: 0.95;
  box-shadow: 0 10px 0 rgba(160, 90, 20, 0.28), 0 16px 28px rgba(20, 60, 40, 0.22);
}

.prompt-name[hidden],
.prompt-sound-word[hidden],
.photo-frame[hidden],
.hear-prompt[hidden] {
  display: none !important;
}

.prompt-sound-word {
  display: grid;
  place-items: center;
  margin: 0 0 8px;
  min-width: 70%;
  min-height: clamp(72px, 12vh, 110px);
  padding: 10px 20px;
  border: 8px solid rgba(255, 255, 255, 0.95);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 40%),
    linear-gradient(180deg, #7ec8ff, #2e86ab);
  color: #ffffff;
  font-size: clamp(40px, 11vw, 60px);
  font-weight: 900;
  line-height: 0.95;
  text-shadow: 0 3px 0 rgba(20, 60, 90, 0.35);
  box-shadow: 0 10px 0 rgba(30, 90, 130, 0.28), 0 16px 28px rgba(20, 60, 40, 0.22);
}

.hear-prompt {
  display: grid;
  place-items: center;
  gap: 10px;
  width: min(58%, 200px);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  animation: hearPulse 1.5s ease-in-out infinite;
}

.hear-prompt img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 10px 16px rgba(20, 60, 40, 0.28));
}

.hear-label {
  color: #ffffff;
  font-size: clamp(18px, 4.4vw, 22px);
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(20, 60, 40, 0.45);
}

.hear-prompt:active {
  animation: none;
  transform: scale(0.94);
}

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

.photo-frame {
  position: relative;
  width: min(92%, 360px);
  aspect-ratio: 1;
  max-height: min(46vh, 360px);
  border: clamp(8px, 2vw, 12px) solid rgba(255, 255, 255, 0.98);
  border-radius: 36px;
  overflow: hidden;
  background: var(--photo-tint, #fff4d6);
  box-shadow: 0 12px 0 rgba(47, 143, 100, 0.28), 0 18px 30px rgba(20, 60, 40, 0.25);
  flex: 0 1 auto;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.screen-game.is-photo-mode .prompt-zone {
  flex: 1.3 1 auto;
}

.screen-game.is-photo-mode .choices {
  gap: 10px;
}

.screen-game.is-photo-mode .choice-btn {
  min-height: clamp(52px, 8vh, 68px);
}

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  flex: 0 0 auto;
}

.choices.is-pictures {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 12px);
  align-items: stretch;
}

.choice-btn {
  min-height: clamp(58px, 9.5vh, 78px);
  width: 100%;
  padding: 0 14px 6px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 36%),
    linear-gradient(180deg, #ffffff, #ffdc78 54%, #f3a43d);
  color: #244135;
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: choicePop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.choice-pic {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: clamp(5px, 1.4vw, 8px) solid rgba(255, 255, 255, 0.98);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 40%),
    var(--choice-tint, #d7eef3);
  overflow: hidden;
  box-shadow:
    0 8px 0 rgba(47, 143, 100, 0.28),
    0 14px 22px rgba(20, 60, 40, 0.2);
  animation: choicePop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  transition: transform 120ms ease;
}

.choice-pic:active {
  transform: translateY(3px) scale(0.97);
}

.choice-pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 18px;
  pointer-events: none;
}

.choice-pic.is-fallback {
  display: grid;
  place-items: center;
  color: #244135;
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.choice-btn.is-correct,
.choice-pic.is-correct {
  filter: saturate(1.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 36%),
    linear-gradient(180deg, #9ff0b2, #34b96f);
}

.choice-btn.is-wrong,
.choice-pic.is-wrong {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 36%),
    linear-gradient(180deg, #ffb2bd, #e45d72);
}

.choice-pic.is-correct {
  border-color: #34b96f;
  box-shadow: 0 0 0 4px rgba(52, 185, 111, 0.35), 0 8px 0 rgba(47, 143, 100, 0.28);
}

.choice-pic.is-wrong {
  border-color: #e45d72;
}

@keyframes choicePop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.feedback {
  display: grid;
  min-height: 42px;
  place-items: center;
  color: #ffffff;
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(30, 100, 74, 0.45);
}

.feedback.is-yes {
  color: #fff36a;
}

.feedback.is-no {
  color: #ffe0e6;
}

.animal-card-board {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(12px, 3.4vw, 18px);
  row-gap: clamp(14px, 3.8vw, 22px);
  width: 100%;
  max-height: 100%;
  min-height: 0;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px 24px;
  border-radius: 22px;
  touch-action: pan-y;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.animal-card-board::-webkit-scrollbar {
  display: none;
}

.animal-card-board[hidden] {
  display: none !important;
}

.screen-game.is-card-mode {
  gap: clamp(6px, 1vh, 9px);
  padding: clamp(10px, 2vh, 16px);
}

.screen-game.is-card-mode .prompt-zone,
.screen-game.is-card-mode .choices,
.screen-game.is-card-mode .half-board {
  display: none !important;
}

.screen-game.is-card-mode .ask-line {
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1;
}

.screen-game.is-card-mode .help-line {
  display: block;
  margin-top: -2px;
  padding: 6px 10px;
  font-size: clamp(15px, 3.8vw, 18px);
  background: rgba(20, 70, 45, 0.28);
}

.learn-card {
  position: relative;
  aspect-ratio: 0.78;
  min-width: 0;
  min-height: 132px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 800px;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.learn-card-inner {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.learn-card.is-open .learn-card-inner {
  transform: rotateY(180deg);
}

.learn-card-face {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  backface-visibility: hidden;
  border: 5px solid #d08a43;
  border-radius: 18px;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.3),
    0 6px 0 rgba(87, 58, 27, 0.26),
    0 11px 18px rgba(20, 60, 40, 0.24);
}

.learn-card-back {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 36%),
    repeating-linear-gradient(
      0deg,
      #d79958 0 9px,
      #c98748 10px 18px,
      #e0a66a 19px 24px
    );
}

.learn-card-back::after {
  content: "?";
  place-self: center;
  color: rgba(89, 48, 18, 0.32);
  font-size: clamp(40px, 11vw, 68px);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 230, 180, 0.5);
}

.learn-card-front {
  grid-template-rows: 1fr auto;
  transform: rotateY(180deg);
  background: var(--choice-tint, #d7eef3);
}

.learn-card-front img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.learn-card-name {
  display: grid;
  place-items: center;
  min-height: clamp(28px, 5.2vh, 42px);
  padding: 0 4px 4px;
  background:
    linear-gradient(180deg, #fff4c8, #f5c457);
  color: #5a3200;
  font-size: clamp(16px, 4.2vw, 23px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.learn-card:active .learn-card-inner {
  transform: scale(0.96);
}

.learn-card.is-open:active .learn-card-inner {
  transform: rotateY(180deg) scale(0.96);
}

.learn-card:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 3px;
  border-radius: 20px;
}

.screen-game.is-half-mode {
  gap: clamp(4px, 0.8vh, 8px);
  padding-bottom: clamp(8px, 1.6vh, 14px);
}

.screen-game.is-half-mode .prompt-zone,
.screen-game.is-half-mode .choices {
  display: none !important;
}

.screen-game.is-half-mode .help-line {
  display: block;
  margin: 0;
  padding: 4px 10px;
  font-size: clamp(14px, 3.6vw, 17px);
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(20, 60, 40, 0.35);
}

.screen-game.is-half-mode .feedback {
  position: absolute;
  bottom: clamp(6px, 1.2vh, 12px);
  left: 0;
  right: 0;
  z-index: 6;
  min-height: 34px;
  pointer-events: none;
}

.screen-game.is-half-mode .ask-line {
  font-size: clamp(22px, 5.6vw, 30px);
  line-height: 1.05;
}

.half-board {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 14px);
  width: 100%;
  min-height: 0;
}

.half-board[hidden] {
  display: none !important;
}

.half-preview {
  flex: 0 0 clamp(118px, 24vh, 190px);
  min-height: clamp(118px, 24vh, 190px);
  width: 100%;
}

.half-puzzle-frame {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 100%;
  height: 100%;
  min-height: clamp(118px, 24vh, 190px);
  overflow: hidden;
  border: 4px solid #5aa8d8;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 8px 0 rgba(47, 100, 140, 0.22),
    inset 0 2px 10px rgba(20, 60, 40, 0.1);
}

.half-puzzle-frame.has-pieces {
  border-color: #7ec0e8;
}

.half-puzzle-frame.is-complete {
  border-color: #34b96f;
  box-shadow:
    0 0 0 4px rgba(52, 185, 111, 0.35),
    0 8px 0 rgba(47, 143, 100, 0.22);
}

.half-preview-slot {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 100%;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  touch-action: manipulation;
}

.half-preview-slot.is-filled {
  cursor: default;
}

.half-preview-slot.is-left {
  border-right: 2px dashed rgba(255, 255, 255, 0.45);
}

.half-preview-slot.is-filled {
  background: #ffffff;
}

.half-preview-slot.is-filled.is-left {
  border-right-color: rgba(90, 168, 216, 0.45);
}

.half-puzzle-frame.is-complete .half-preview-slot.is-filled.is-left {
  border-right-color: transparent;
}

.half-preview-slot.is-match {
  animation: previewPop 520ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.half-preview-slot.is-wrong {
  animation: halfShake 360ms ease;
}

.half-preview-hint {
  margin: 0;
  padding: 0 8px;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 2px 0 rgba(20, 60, 40, 0.28);
}

.half-preview-slot.is-filled .half-preview-hint {
  display: none;
}

.half-clip-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.half-puzzle-complete {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  border-radius: 18px;
  animation: puzzleReveal 520ms cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.half-puzzle-complete[hidden] {
  display: none !important;
}

.half-puzzle-complete img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}

.half-picker {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.2vw, 14px);
  min-height: 0;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: 6px;
}

.half-picker.needs-right .half-col:first-child .half-card:not(.is-picked) {
  opacity: 0.42;
}

.half-picker.needs-left .half-col:last-child .half-card:not(.is-picked) {
  opacity: 0.42;
}

.half-picker.needs-right .half-col:last-child .half-card:not(.is-matched) {
  animation: hintColumn 1.1s ease-in-out infinite;
}

.half-picker.needs-left .half-col:first-child .half-card:not(.is-matched) {
  animation: hintColumn 1.1s ease-in-out infinite;
}

.half-col {
  display: grid;
  grid-template-rows: repeat(var(--half-rows, 3), minmax(78px, auto));
  gap: clamp(8px, 1.6vh, 12px);
  min-height: 0;
  align-content: start;
}

.half-card {
  position: relative;
  z-index: 1;
  min-height: 78px;
  border: 4px solid #5aa8d8;
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 5px 0 rgba(47, 100, 140, 0.22);
  transition: transform 120ms ease, border-color 160ms ease, box-shadow 160ms ease;
  touch-action: manipulation;
  user-select: none;
}

.half-card:active:not(.is-matched) {
  transform: scale(0.97);
}

.half-card.is-selected {
  border-color: #f5c542;
  box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.45), 0 5px 0 rgba(47, 100, 140, 0.22);
}

.half-card.is-hint {
  border-color: #8fd4ff;
  box-shadow:
    0 0 0 3px rgba(143, 212, 255, 0.42),
    0 5px 0 rgba(47, 100, 140, 0.22);
  animation: hintPulse 1.1s ease-in-out infinite;
}

.half-card.is-matched {
  display: none;
}

.half-card.is-wrong {
  border-color: #e45d72;
  animation: halfShake 360ms ease;
}

.half-clip {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.half-clip img {
  width: 200%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.half-clip.is-left img,
.half-card.is-left .half-clip img,
.half-preview-slot.is-left .half-clip img {
  margin-left: 0;
}

.half-clip.is-right img,
.half-card.is-right .half-clip img,
.half-preview-slot.is-right .half-clip img {
  margin-left: -100%;
}

.half-confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

.half-drag-line {
  position: absolute;
  z-index: 6;
  height: 10px;
  border-radius: 999px;
  background: rgba(102, 218, 91, 0.42);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.28),
    0 0 14px rgba(67, 207, 74, 0.55);
  pointer-events: none;
  transform-origin: 0 50%;
}

.half-confetti span {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall 900ms ease-out forwards;
}

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

@keyframes hintPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(143, 212, 255, 0.35),
      0 5px 0 rgba(47, 100, 140, 0.22);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(143, 212, 255, 0.55),
      0 5px 0 rgba(47, 100, 140, 0.22);
  }
}

@keyframes previewPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

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

@keyframes puzzleReveal {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes snapIntoPlace {
  0% {
    transform: scale(1.08);
  }
  55% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes swapAway {
  0% {
    transform: scale(0.94);
    opacity: 0.65;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(70vh) rotate(240deg);
    opacity: 0;
  }
}

.screen-result {
  justify-content: space-between;
  align-items: center;
  gap: clamp(10px, 2vh, 18px);
  padding: clamp(14px, 3vh, 24px);
  background: #1a3d2c;
}

.result-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
}

.screen-result > *:not(.result-art) {
  position: relative;
  z-index: 1;
}

.result-back {
  align-self: flex-start;
}

.result-hero {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
  animation: resultBounce 700ms cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

.result-cheer {
  margin: 0;
  color: #fff36a;
  font-size: clamp(42px, 11vw, 64px);
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 4px 0 #1f6b45,
    0 10px 18px rgba(20, 60, 40, 0.35);
}

.result-score {
  margin: 0;
  color: #ffffff;
  font-size: clamp(88px, 24vw, 128px);
  font-weight: 900;
  line-height: 0.9;
  text-shadow:
    0 6px 0 #1f6b45,
    0 14px 24px rgba(20, 60, 40, 0.35);
}

.result-label {
  margin: 0;
  color: #fff8e8;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(20, 60, 40, 0.4);
}

.collection {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2.5vw, 14px);
  width: 100%;
  min-height: clamp(88px, 16vh, 120px);
}

.collection-item {
  width: min(28vw, 112px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 6px solid rgba(255, 255, 255, 0.96);
  border-radius: 28px;
  background: var(--choice-tint, #d7eef3);
  box-shadow:
    0 8px 0 rgba(47, 143, 100, 0.28),
    0 14px 22px rgba(20, 60, 40, 0.2);
  padding: 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  animation: choicePop 480ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  transition: transform 120ms ease;
}

.collection-item:active {
  transform: scale(0.94);
}

.collection-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.collection-more {
  min-width: 56px;
  min-height: 56px;
  display: grid;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 40%),
    linear-gradient(180deg, #ffe082, #f0a830);
  color: #5a3200;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(160, 90, 20, 0.28);
}

.result-actions {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  margin-top: auto;
}

.result-again-btn {
  width: min(88%, 360px);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  animation: hearPulse 1.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 14px rgba(20, 60, 40, 0.25));
}

.result-again-btn img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

.result-again-btn:active {
  animation: none;
  transform: scale(0.96);
}

.result-modes-btn {
  min-height: 48px;
  padding: 0 28px 4px;
  border: 5px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 40%),
    linear-gradient(180deg, #48bddc, #267ca9);
  color: #ffffff;
  font-size: clamp(22px, 5.5vw, 28px);
  font-weight: 900;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    0 6px 0 rgba(30, 90, 120, 0.28);
}

.result-modes-btn:active {
  transform: translateY(2px);
}

@keyframes resultBounce {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.screen-pause {
  justify-content: center;
  gap: 22px;
  background:
    linear-gradient(180deg, rgba(166, 224, 241, 0.92), rgba(116, 192, 129, 0.96)),
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.48), transparent 24rem);
}

.pause-card {
  display: grid;
  gap: 10px;
  padding: 24px;
  border: 8px solid rgba(255, 255, 255, 0.88);
  border-radius: 32px;
  background: rgba(255, 248, 232, 0.92);
  text-align: center;
  box-shadow: 0 14px 0 rgba(47, 143, 100, 0.26), 0 24px 38px var(--shadow);
}

.pause-card h2 {
  color: var(--leaf-dark);
  font-size: clamp(42px, 11vw, 64px);
  line-height: 0.95;
}

@media (max-height: 680px) {
  .screen:not(.screen-start):not(.screen-mode) {
    padding: 12px;
  }

  .photo-frame {
    max-height: min(40vh, 300px);
  }

  .choice-btn {
    min-height: 52px;
  }

  .home-btn-play {
    bottom: 14%;
  }

  .mode-grid-2x2 {
    top: 18%;
    gap: 8px;
    width: 86%;
    max-height: 66%;
  }

  .mode-card img {
    max-height: min(24vh, 140px);
  }
}

@media (min-width: 700px) {
  .phone-shell {
    /* border: 12px solid rgba(255, 255, 255, 0.24);
    border-radius: 36px; */
  }
}
