:root {
  --bg-1: #fff7f0;
  --bg-2: #ffd8ba;
  --bg-3: #ffe5a3;
  --card-bg: rgba(255, 255, 255, 0.86);
  --card-border: rgba(221, 129, 82, 0.34);
  --text-main: #4f2e26;
  --text-soft: #7f5546;
  --accent: #ff8338;
  --accent-strong: #e46220;
  --accent-soft: #ffe2cc;
  --button-text: #fff9fb;
  --field-border: rgba(226, 98, 32, 0.3);
  --shadow: 0 18px 55px rgba(166, 95, 52, 0.24);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  display: grid;
  place-items: center;
  padding: clamp(8px, 2vw, 16px);
  font-family: "Manrope", "Trebuchet MS", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 20% 15%, #fffef7 0%, transparent 43%),
    radial-gradient(circle at 88% 82%, #ffe9cf 0%, transparent 42%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-size: 130% 130%, 130% 130%, 120% 120%;
  animation: bg-pan 22s ease-in-out infinite alternate;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  inset: -20%;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.34;
  animation: aura-drift 20s ease-in-out infinite;
}

.ambient::before {
  background: radial-gradient(circle, rgba(255, 176, 92, 0.9) 0%, rgba(255, 176, 92, 0) 68%);
}

.ambient::after {
  background: radial-gradient(circle, rgba(255, 142, 76, 0.8) 0%, rgba(255, 142, 76, 0) 70%);
  animation-delay: -10s;
}

.blob {
  position: absolute;
  border-radius: 999px;
  opacity: 0.38;
  animation: drift 12s ease-in-out infinite;
  filter: blur(2px);
}

.blob-a {
  width: 44vw;
  height: 44vw;
  min-width: 220px;
  min-height: 220px;
  top: -9vh;
  right: -7vw;
  background: #ffd39d;
}

.blob-b {
  width: 35vw;
  height: 35vw;
  min-width: 180px;
  min-height: 180px;
  left: -9vw;
  bottom: -12vh;
  background: #ffc4a0;
  animation-delay: -6s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: radial-gradient(#8a5861 0.55px, transparent 0.55px);
  background-size: 3px 3px;
  animation: grain-shift 8s steps(2) infinite;
}

.card {
  position: relative;
  z-index: 1;
  width: min(95vw, 560px);
  max-height: min(94dvh, 760px);
  padding: clamp(12px, 2.8vw, 24px);
  border-radius: 26px;
  border: 1px solid var(--card-border);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 252, 0.8)),
    var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
  animation: enter 0.8s ease-out both;
}

.eyebrow {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(0.82rem, 2.1vw, 1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  will-change: opacity, transform;
  animation: screen-in var(--dur-base) var(--ease-out);
}

.screen[hidden] {
  display: none;
}

.title {
  margin: 0;
  font-family: "Marck Script", "Brush Script MT", cursive;
  font-weight: 400;
  line-height: 1.04;
  font-size: clamp(2rem, 8vw, 3.4rem);
  color: #b24d1d;
}

.message {
  margin: 0 auto;
  max-width: 32ch;
  font-size: clamp(0.98rem, 3vw, 1.15rem);
  line-height: 1.42;
  color: var(--text-main);
}

.section-title {
  margin: 0;
  color: #ad4a1b;
  font-size: clamp(1.2rem, 4.8vw, 1.7rem);
  line-height: 1.18;
}

.section-text {
  margin: 0;
  max-width: 34ch;
  color: var(--text-soft);
  font-size: clamp(0.92rem, 2.9vw, 1rem);
  line-height: 1.36;
}

#screenPreview {
  gap: 9px;
}

.preview-pill {
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a84a1c;
  background: linear-gradient(135deg, rgba(255, 233, 208, 0.9), rgba(255, 246, 223, 0.92));
  border: 1px solid rgba(205, 120, 71, 0.22);
}

.preview-title {
  font-size: clamp(1.95rem, 8.2vw, 3rem);
}

.preview-subtitle {
  max-width: 31ch;
}

.stage-progress {
  margin: 0;
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #a24b20;
  background: rgba(255, 234, 213, 0.92);
  border: 1px solid rgba(198, 118, 71, 0.25);
}

.game {
  width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(214, 102, 84, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 250, 246, 0.95), rgba(255, 240, 244, 0.78));
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hud-item {
  margin: 0;
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(255, 237, 220, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.95rem;
}

.hud-label {
  color: var(--text-soft);
}

.hud-value {
  min-width: 28px;
  text-align: right;
  font-weight: 700;
  color: #ab4f22;
}

.game-field {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--field-border);
  height: clamp(170px, 30vh, 240px);
  background:
    radial-gradient(circle at 32% 18%, #fffaf6 0%, transparent 45%),
    linear-gradient(180deg, #fffdf9 0%, #ffe9d4 100%);
  touch-action: manipulation;
}

.story--attempt1 .game-field {
  box-shadow: inset 0 0 0 1px rgba(223, 112, 50, 0.2);
}

.game-btn,
.music-btn {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  color: var(--button-text);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(180, 97, 43, 0.32);
  transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}

.game-btn--ghost {
  color: #8f471f;
  background: linear-gradient(135deg, #fff0de, #ffe2c4);
  box-shadow: 0 8px 18px rgba(178, 103, 56, 0.2);
}

.game-btn--secondary {
  color: #8f3f1e;
  background: linear-gradient(135deg, #ffedd8, #ffdcb6);
  box-shadow: 0 8px 18px rgba(178, 99, 48, 0.2);
}

.game-btn:disabled {
  cursor: default;
  opacity: 0.6;
  filter: grayscale(0.08);
}

.game-btn:active,
.music-btn:active {
  transform: translateY(0) scale(0.985);
  filter: brightness(0.95);
}

.game-btn:hover,
.music-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

#previewStartButton,
#proveButton,
#openCardButton,
#kissButton {
  animation: cta-glow 3.8s ease-in-out infinite;
}

.screen-actions {
  width: 100%;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 4px;
}

.screen-actions .game-btn {
  min-width: min(230px, 100%);
}

.screen-actions .game-btn--secondary {
  min-width: min(230px, 100%);
}

.quiz-progress,
.memory-progress {
  margin: 0;
  color: #a64f1f;
  font-size: 0.9rem;
  font-weight: 700;
}

.quiz-question {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(0.95rem, 2.8vw, 1.04rem);
  line-height: 1.34;
}

.quiz-options {
  width: 100%;
  display: grid;
  gap: 8px;
}

.quiz-option {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(185, 84, 66, 0.35);
  background: rgba(255, 245, 240, 0.94);
  color: var(--text-main);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.3;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.quiz-option--selected {
  border-color: rgba(222, 112, 44, 0.72);
  background: rgba(255, 233, 210, 0.96);
  box-shadow: inset 0 0 0 1px rgba(222, 112, 44, 0.25);
}

.quiz-option:active {
  transform: scale(0.996);
}

.analyzing-dots {
  display: inline-flex;
  gap: 6px;
}

.analyzing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cc6a2d;
  animation: pulse 1.05s ease-in-out infinite;
}

.analyzing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.analyzing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.screen--secret-intro,
.screen--secret-reward,
.screen--skip-tease,
.screen--skip-cat,
.screen--skip-fail {
  justify-content: center;
}

.screen--secret-rhythm,
.screen--skip-challenge,
.screen--memory {
  gap: 8px;
}

.challenge-hud {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.challenge-progress {
  margin: 0;
  color: #ac5022;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
}

.challenge-time {
  margin: 0;
  min-width: 72px;
  border-radius: 12px;
  background: rgba(255, 233, 211, 0.92);
  color: #9f4a21;
  border: 1px solid rgba(195, 116, 69, 0.26);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.challenge-pad {
  width: min(320px, 100%);
  min-height: 98px;
  border-radius: 22px;
  border: 0;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fffaf4;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
  box-shadow: 0 14px 24px rgba(166, 95, 52, 0.26);
}

.challenge-pad--secret {
  background: linear-gradient(145deg, #ff9440, #e6672b);
}

.challenge-pad--skip {
  background: linear-gradient(145deg, #ff8a4f, #db5928);
}

.challenge-pad:active {
  transform: scale(0.987);
  filter: brightness(0.95);
}

.skip-cat-emoji {
  margin: 0;
  font-size: clamp(3rem, 16vw, 5rem);
  line-height: 1;
  transform-origin: 50% 70%;
  animation: cat-cry 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 12px rgba(175, 107, 65, 0.22));
}

.memory-board {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  touch-action: manipulation;
  max-width: 500px;
  margin: 0 auto;
}

.memory-board--paused {
  pointer-events: none;
  opacity: 0.72;
}

.memory-card {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  min-height: 56px;
  aspect-ratio: 5 / 4;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
}

.memory-card:active .memory-card__inner {
  transform: translateZ(0) scale(0.985);
}

.memory-card__inner {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  transform: translateZ(0);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(190, 101, 58, 0.34);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.memory-card__face--back {
  background:
    linear-gradient(145deg, #fff8e8, #ffe8d0);
  color: #b45522;
  box-shadow: 0 5px 12px rgba(163, 88, 53, 0.16);
  opacity: 1;
  transform: scale(1);
}

.memory-card__face--front {
  background:
    linear-gradient(145deg, #ffffff, #fff0dc);
  box-shadow: 0 8px 16px rgba(166, 89, 58, 0.2);
  opacity: 0;
  transform: scale(0.96);
}

.memory-card--matched .memory-card__face--front {
  border-color: rgba(97, 181, 128, 0.8);
  box-shadow:
    0 8px 18px rgba(91, 171, 122, 0.23),
    inset 0 0 0 1px rgba(91, 171, 122, 0.4);
}

.memory-card--selected .memory-card__face--back {
  border-color: rgba(222, 112, 44, 0.72);
  box-shadow:
    0 7px 15px rgba(196, 109, 63, 0.2),
    inset 0 0 0 1px rgba(222, 112, 44, 0.3);
}

.memory-card--mismatch {
  animation: shake-x 180ms var(--ease-out);
}

.memory-card--matched {
  animation: card-pop var(--dur-fast) var(--ease-out);
}

.memory-card--face-up .memory-card__face--back,
.memory-card--matched .memory-card__face--back {
  opacity: 0;
  transform: scale(0.96);
}

.memory-card--face-up .memory-card__face--front,
.memory-card--matched .memory-card__face--front {
  opacity: 1;
  transform: scale(1);
}

.screen--card {
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.screen--card::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.screen--card .screen-actions {
  margin-top: 10px;
  padding-top: 0;
}

.screen--kiss-overlay {
  position: absolute;
  inset: clamp(10px, 2.2vw, 16px);
  z-index: 40;
  border-radius: 20px;
  justify-content: center;
  background: rgba(255, 246, 235, 0.78);
  backdrop-filter: blur(7px);
  border: 1px solid rgba(204, 132, 88, 0.25);
  box-shadow: 0 12px 24px rgba(152, 92, 56, 0.22);
}

.kiss-panel {
  width: min(100%, 420px);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.photo-frame {
  --photo-size: clamp(112px, 34vw, 164px);
  --frame-radius: 22px;
  position: relative;
  width: var(--photo-size);
  height: var(--photo-size);
  flex: 0 0 var(--photo-size);
  aspect-ratio: 1 / 1;
  border-radius: var(--frame-radius);
  padding: 6px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 252, 246, 0.97), rgba(255, 236, 214, 0.94));
  box-shadow:
    0 12px 24px rgba(162, 92, 50, 0.22),
    0 0 0 1px rgba(198, 125, 78, 0.18);
  transform: translateZ(0);
}

.photo-frame::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: calc(var(--frame-radius) - 4px);
  border: 1px solid rgba(255, 255, 255, 0.74);
  pointer-events: none;
  z-index: 4;
}

.photo-frame::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(243, 140, 93, 0.34) 0%, rgba(243, 140, 93, 0) 70%);
  filter: blur(14px);
  opacity: 0.64;
  z-index: 0;
  pointer-events: none;
}

.photo-frame img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--frame-radius) - 7px);
  background: #ffe8ef;
}

.photo-fallback {
  position: absolute;
  inset: 6px;
  z-index: 2;
  display: none;
  align-content: center;
  justify-items: center;
  gap: 6px;
  border-radius: calc(var(--frame-radius) - 7px);
  padding: 10px;
  text-align: center;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.22;
  background:
    linear-gradient(160deg, rgba(255, 250, 244, 0.98), rgba(255, 234, 214, 0.94));
  box-shadow: inset 0 0 0 1px rgba(202, 124, 87, 0.2);
}

.photo-fallback strong {
  color: #ac4a1e;
  font-size: 0.9rem;
  line-height: 1.15;
}

.photo-fallback__emoji {
  font-size: 1.22rem;
}

.photo-frame--fallback img {
  opacity: 0;
  visibility: hidden;
}

.photo-frame--fallback .photo-fallback {
  display: grid;
}

.photo-frame--preview {
  --photo-size: clamp(132px, 42vw, 210px);
  cursor: pointer;
}

.photo-frame--card {
  --photo-size: clamp(96px, 28vw, 132px);
}

.screen--win .section-title,
.screen--win .section-text,
.screen--win .game-btn {
  opacity: 0;
  transform: translateY(8px) scale(0.99);
}

.screen--win.screen--win-live .section-title,
.screen--win.screen--win-live .section-text,
.screen--win.screen--win-live .game-btn {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.screen--win.screen--win-live .section-title {
  animation: win-reveal var(--dur-slow) var(--ease-out) 30ms forwards;
}

.screen--win.screen--win-live .section-text {
  animation: win-reveal var(--dur-slow) var(--ease-out) 130ms forwards;
}

.screen--win.screen--win-live .game-btn {
  animation: win-reveal var(--dur-slow) var(--ease-out) 230ms forwards;
}

.card-decor {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 1.1rem;
}

.card-title {
  margin: 0;
  font-family: "Marck Script", "Brush Script MT", cursive;
  font-weight: 400;
  line-height: 1.08;
  font-size: clamp(1.7rem, 6.8vw, 2.7rem);
  color: #9f4a22;
}

.card-line {
  margin: 0;
  max-width: 35ch;
  font-size: clamp(0.9rem, 2.7vw, 1rem);
  line-height: 1.28;
  color: var(--text-main);
}

.card-line--special {
  font-weight: 700;
  color: #a44b1f;
}

.signature {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.from,
.date {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.story--kiss #screenCard {
  filter: blur(2px) saturate(0.92);
}

.music-controls {
  margin-top: 8px;
  flex: 0 0 auto;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 2px);
}

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

.confetti-piece {
  position: absolute;
  top: -18px;
  width: 8px;
  height: 16px;
  border-radius: 8px;
  opacity: 0.96;
  animation: confetti-fall 1.6s ease-out forwards;
}

.candy {
  position: absolute;
  top: -66px;
  left: 0;
  width: var(--candy-size, 54px);
  height: var(--candy-size, 54px);
  border: 0;
  padding: 0;
  background: transparent;
  font-size: calc(var(--candy-size, 54px) * 0.72);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transform: translateY(0) scale(1);
  animation-name: candy-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.candy--collectible {
  filter: drop-shadow(0 5px 8px rgba(214, 105, 60, 0.3));
}

.candy--evader {
  filter: drop-shadow(0 5px 9px rgba(159, 93, 54, 0.3));
}

.candy--caught {
  animation: none;
  transform: scale(1.25);
  opacity: 0;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.candy--paused {
  animation-play-state: paused;
}

.candy--evade {
  transition: left 0.22s ease;
  filter: drop-shadow(0 6px 10px rgba(170, 85, 40, 0.34)) saturate(1.16);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.65;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(14px) translateX(8px);
  }
}

@keyframes bg-pan {
  0% {
    background-position: 18% 12%, 82% 86%, 50% 50%;
  }
  100% {
    background-position: 24% 18%, 76% 80%, 58% 42%;
  }
}

@keyframes aura-drift {
  0%,
  100% {
    transform: translate3d(-4%, -3%, 0) scale(1);
  }
  50% {
    transform: translate3d(5%, 4%, 0) scale(1.06);
  }
}

@keyframes grain-shift {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-1.5%, 0.5%);
  }
  50% {
    transform: translate(0.8%, -1%);
  }
  75% {
    transform: translate(-0.5%, 1.2%);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes candy-fall {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(340px) scale(1.03);
  }
}

@keyframes confetti-fall {
  from {
    transform: translateY(0) rotate(0deg);
    opacity: 0.95;
  }
  to {
    transform: translateY(420px) rotate(540deg);
    opacity: 0;
  }
}

@keyframes cta-glow {
  0%,
  100% {
    box-shadow: 0 10px 24px rgba(198, 98, 45, 0.31);
  }
  50% {
    box-shadow: 0 12px 28px rgba(198, 98, 45, 0.45);
  }
}

@keyframes cat-cry {
  0%,
  100% {
    transform: rotate(0deg) translateY(0);
  }
  25% {
    transform: rotate(-5deg) translateY(-2px);
  }
  50% {
    transform: rotate(0deg) translateY(0);
  }
  75% {
    transform: rotate(5deg) translateY(-2px);
  }
}

@keyframes shake-x {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes card-pop {
  0% {
    transform: scale(1);
  }
  60% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes win-reveal {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 420px) {
  .card {
    border-radius: 22px;
    gap: 8px;
    padding: 11px 10px 12px;
  }

  .title {
    font-size: clamp(1.76rem, 8.2vw, 2.6rem);
  }

  .message {
    font-size: 0.94rem;
  }

  .section-title {
    font-size: clamp(1.08rem, 5vw, 1.45rem);
  }

  .section-text,
  .card-line,
  .quiz-question,
  .quiz-option {
    font-size: 0.88rem;
  }

  .game {
    padding: 8px;
  }

  .game-field {
    height: clamp(142px, 27vh, 186px);
  }

  .hud-item {
    padding: 7px 8px;
    font-size: 0.86rem;
  }

  .game-btn,
  .music-btn,
  .quiz-option {
    min-height: 46px;
    padding: 10px 14px;
  }

  .challenge-pad {
    min-height: 84px;
    font-size: 0.95rem;
  }

  .stage-progress {
    font-size: 0.74rem;
    padding: 4px 8px;
  }

  .memory-board {
    gap: 7px;
  }

  .memory-card {
    min-height: 52px;
  }

  .card-title {
    font-size: clamp(1.36rem, 6.8vw, 2.05rem);
    line-height: 1.06;
  }

  .card-line {
    line-height: 1.24;
  }

  .card-decor {
    font-size: 1rem;
  }

  .photo-frame--preview {
    --photo-size: clamp(124px, 41vw, 180px);
  }

  .photo-frame--card {
    --photo-size: clamp(92px, 27vw, 122px);
  }

  .photo-fallback {
    font-size: 0.72rem;
    padding: 8px;
  }

  .photo-fallback strong {
    font-size: 0.82rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  body,
  .screen,
  .blob,
  .ambient::before,
  .ambient::after,
  .grain,
  .analyzing-dots span,
  .confetti-piece,
  .skip-cat-emoji,
  #proveButton,
  #openCardButton,
  #previewStartButton,
  #kissButton,
  .memory-card--mismatch,
  .memory-card--matched {
    animation: none !important;
  }

  .game-btn,
  .music-btn,
  .memory-card__face,
  .memory-card__inner {
    transition-duration: 0.01ms !important;
  }

  .screen--win.screen--win-live .section-title,
  .screen--win.screen--win-live .section-text,
  .screen--win.screen--win-live .game-btn {
    opacity: 1;
    transform: none;
  }
}
