:root {
  --ink: #403c56;
  --muted: #78728f;
  --cream: #fffaf3;
  --pink: #ff7597;
  --pink-dark: #e9567b;
  --yellow: #ffd66b;
  --purple: #8a7cf0;
  --shadow: 0 22px 60px rgba(88, 68, 107, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Trebuchet MS", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 214, 107, 0.75) 0 6%, transparent 6.2%),
    radial-gradient(circle at 88% 82%, rgba(138, 124, 240, 0.3) 0 8%, transparent 8.2%),
    linear-gradient(145deg, #fff1f6, #eeeaff);
}

.game-card {
  width: min(100%, 500px);
  padding: 24px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 250, 243, 0.93);
  box-shadow: var(--shadow);
}

.app-shell {
  position: relative;
  overflow: hidden;
}

.app-screen {
  min-height: 650px;
  animation: screen-in 320ms ease both;
}

.app-screen.is-hidden {
  display: none;
}

.game-screen {
  min-height: 0;
}

.home-screen {
  position: relative;
  min-height: 690px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 37%, rgba(255, 255, 255, 0.95) 0 25%, transparent 52%),
    linear-gradient(155deg, #fff2f7 0%, #f0ecff 54%, #e0f7ff 100%);
}

.home-screen::before,
.home-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.home-screen::before {
  width: 260px;
  height: 260px;
  top: -130px;
  left: -100px;
  background: rgba(255, 214, 107, 0.35);
}

.home-screen::after {
  width: 220px;
  height: 220px;
  right: -110px;
  bottom: -90px;
  background: rgba(138, 124, 240, 0.2);
}

.home-content {
  position: relative;
  z-index: 2;
  width: min(82%, 330px);
  text-align: center;
}

.home-content h1 {
  margin: 18px 0 10px;
  font-size: clamp(38px, 11vw, 54px);
  letter-spacing: -0.05em;
  text-shadow: 0 5px 0 rgba(255, 255, 255, 0.85);
}

.home-subtitle {
  margin-bottom: 28px;
  color: var(--muted);
  line-height: 1.6;
}

.home-logo {
  position: relative;
  width: 94px;
  height: 94px;
  margin: 22px auto 0;
  border: 5px solid var(--ink);
  border-radius: 27px;
  background: var(--yellow);
  box-shadow: 0 11px 0 rgba(64, 60, 86, 0.13), inset 0 5px 0 rgba(255, 255, 255, 0.45);
  animation: float 2s ease-in-out infinite;
}

.home-logo .eye {
  top: 31px;
  width: 8px;
  height: 10px;
}

.home-logo .eye-left {
  left: 27px;
}

.home-logo .eye-right {
  right: 27px;
}

.home-logo .mouth {
  bottom: 22px;
  width: 23px;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.home-actions .main-action {
  grid-column: 1 / -1;
  min-height: 56px;
  font-size: 20px;
}

.home-actions .menu-action {
  min-width: 0;
  padding-inline: 14px;
}

.endless-card {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 18px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-bottom: 5px solid #33275f;
  border-radius: 18px;
  text-align: left;
  background: linear-gradient(135deg, #383065, #77559b);
  box-shadow: 0 9px 20px rgba(56, 48, 101, 0.24);
}

.endless-card strong {
  font-size: 17px;
}

.endless-card span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.purple-action {
  border-bottom-color: #6f61d4;
  background: var(--purple);
}

.soft-action {
  border: 2px solid #dcd5e5;
  border-bottom-width: 5px;
  color: var(--ink);
  background: white;
}

.home-coins {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 18px;
}

.home-best {
  position: absolute;
  z-index: 2;
  bottom: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.home-best strong {
  color: var(--purple);
}

.floating-block {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 0 rgba(64, 60, 86, 0.11);
  animation: decor-float 3.3s ease-in-out infinite;
}

.block-one {
  width: 62px;
  height: 62px;
  top: 88px;
  left: -14px;
  border-radius: 18px;
  background: #ff8da8;
  transform: rotate(12deg);
}

.block-two {
  width: 52px;
  height: 52px;
  top: 155px;
  right: 18px;
  border-radius: 15px;
  background: #8a7cf0;
  animation-delay: -1.1s;
}

.block-three {
  width: 70px;
  height: 70px;
  left: 20px;
  bottom: 72px;
  border-radius: 21px;
  background: #79d7cf;
  animation-delay: -2.2s;
}

.coin-badge,
.run-coin-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border: 2px solid rgba(174, 125, 25, 0.2);
  border-radius: 999px;
  color: #8c6415;
  background: rgba(255, 248, 213, 0.95);
  box-shadow: 0 5px 12px rgba(174, 125, 25, 0.12);
}

.coin-icon,
.mini-coin {
  color: #ffc531;
  text-shadow: 0 1px 0 #a87010;
}

.menu-screen {
  padding: 5px 2px 0;
}

.screen-header {
  min-height: 66px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.screen-header h2 {
  margin: 0;
  font-size: 28px;
}

.screen-header .eyebrow {
  margin-bottom: 3px;
}

.icon-button {
  min-width: 46px;
  width: 46px;
  height: 46px;
  padding: 0;
  border-bottom-width: 4px;
  font-size: 24px;
}

.header-spacer {
  width: 46px;
}

.screen-intro {
  margin: 0 4px 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.level-grid {
  display: block;
  max-height: 545px;
  padding: 3px 5px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.level-chapter {
  padding: 14px;
  border: 2px solid rgba(126, 112, 154, 0.13);
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.5);
}

.level-chapter + .level-chapter {
  margin-top: 16px;
}

.level-chapter.chapter-two {
  border-color: rgba(128, 118, 213, 0.2);
  background: linear-gradient(145deg, rgba(242, 236, 255, 0.86), rgba(224, 247, 249, 0.78));
}

.chapter-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 2px 10px;
}

.chapter-heading strong {
  color: var(--purple);
  font-size: 16px;
}

.chapter-heading span {
  color: var(--muted);
  font-size: 12px;
}

.chapter-level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 11px;
}

.level-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-bottom-width: 6px;
  border-radius: 17px;
  color: var(--ink);
  background: white;
  box-shadow: none;
}

.level-card strong {
  font-size: 22px;
}

.level-card .level-stars {
  min-height: 14px;
  margin-top: 3px;
  color: #f5b91d;
  font-size: 11px;
  letter-spacing: -1px;
}

.level-name {
  max-width: 100%;
  min-height: 2.35em;
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.level-card.is-complete {
  background: #fff8d9;
}

.level-card.chapter-two-card {
  border-color: #68618d;
  background: #f7f5ff;
}

.level-card.chapter-two-card.is-complete {
  background: linear-gradient(145deg, #fff6d9, #eeeaff);
}

.level-card.is-locked {
  border-color: #b8b3c3;
  color: #9a95aa;
  cursor: not-allowed;
  background: #eeeaf1;
  filter: none;
}

.level-card.is-locked:hover {
  transform: none;
}

.level-card .lock-icon {
  font-size: 19px;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12px;
}

.skin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-height: 515px;
  padding: 3px 4px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.current-skin-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  margin: -8px 4px 12px;
  padding: 12px 18px;
  border: 2px solid rgba(255, 117, 151, 0.2);
  border-radius: 19px;
  background: linear-gradient(135deg, rgba(255, 245, 224, 0.94), rgba(244, 235, 255, 0.94));
  box-shadow: 0 8px 20px rgba(88, 68, 107, 0.08);
}

.current-skin-panel span,
.current-skin-panel strong {
  display: block;
}

.current-skin-panel span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.current-skin-panel strong {
  font-size: 17px;
}

.current-skin-preview {
  width: 78px;
  display: grid;
  place-items: center;
}

.current-skin-preview .skin-preview {
  scale: 1.08;
}

.collection-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -8px 4px 14px;
  padding: 11px 14px;
  border: 2px solid rgba(138, 124, 240, 0.18);
  border-radius: 15px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(244, 239, 255, 0.88);
}

.collection-progress strong {
  color: var(--purple);
}

.skin-card {
  position: relative;
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 2px solid #e7e0eb;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.8);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.skin-card.is-equipped {
  border-color: var(--purple);
  box-shadow: 0 7px 18px rgba(138, 124, 240, 0.15);
}

.skin-card.is-locked-skin {
  position: relative;
  border-color: rgba(138, 124, 240, 0.2);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(244, 239, 255, 0.84));
}

.skin-card.is-locked-skin::after {
  content: "🔒";
  position: absolute;
  top: 8px;
  right: 9px;
  font-size: 13px;
  filter: drop-shadow(0 2px 2px rgba(64, 60, 86, 0.12));
}

.skin-card.is-new::before {
  content: "NEW";
  position: absolute;
  z-index: 3;
  top: -7px;
  left: -5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: white;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ff7597, #a678e8);
  box-shadow: 0 4px 10px rgba(233, 86, 123, 0.28);
  animation: new-badge-pop 700ms ease both;
}

.skin-card:hover {
  transform: translateY(-2px);
}

.skin-preview {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 16px;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(64, 60, 86, 0.11);
}

.default-skin {
  background: var(--yellow);
}

.jelly-skin {
  border-radius: 19px 19px 15px 15px;
  background: rgba(196, 140, 244, 0.68);
  box-shadow: 0 6px 0 rgba(117, 70, 160, 0.15), inset 7px 7px 0 rgba(255, 255, 255, 0.3);
  animation: jelly-wobble 2s ease-in-out infinite;
}

.ice-skin {
  overflow: hidden;
  border-color: #4c7c9c;
  color: #365f79;
  background: rgba(167, 228, 255, 0.62);
  box-shadow: 0 6px 0 rgba(76, 124, 156, 0.15), inset 0 0 12px rgba(255, 255, 255, 0.8);
}

.ice-skin::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 30px;
  top: 3px;
  left: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.7);
  transform: rotate(38deg);
  animation: ice-shimmer 2.8s ease-in-out infinite;
}

.mahjong-skin {
  height: 64px;
  border-radius: 11px;
  color: #d85050;
  font-family: serif;
  font-size: 27px;
  background: #fffbed;
  box-shadow: 0 7px 0 #cfd6c8;
}

.cat-skin {
  z-index: 1;
  width: 52px;
  height: 50px;
  margin: 7px 3px 0;
  border-color: var(--skin-outline, #5b4b5d);
  border-radius: 17px 17px 16px 16px;
  color: var(--skin-face, #574756);
  background: linear-gradient(145deg, var(--skin-highlight, #ffe0cf), var(--skin-fill, #ffc6ad));
}

.cat-skin::before,
.cat-skin::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -9px;
  width: 12px;
  height: 14px;
  border: 2px solid var(--skin-outline, #5b4b5d);
  border-radius: 70% 25% 58% 36%;
  background: linear-gradient(135deg, var(--skin-highlight, #ffd7c2) 0 52%, var(--skin-accent, #f2a8a5) 54% 72%, var(--skin-highlight, #ffd7c2) 74%);
  transform: rotate(27deg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.cat-skin span {
  position: relative;
  z-index: 1;
}

.cat-skin::before { left: 5px; }
.cat-skin::after { right: 5px; transform: rotate(-27deg); }

.cat-tail {
  position: absolute;
  z-index: -1;
  right: -11px;
  bottom: 7px;
  width: 15px;
  height: 17px;
  border: 2px solid var(--skin-outline, #5b4b5d);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  transform-origin: left bottom;
  animation: cat-tail-sway 2.8s ease-in-out infinite;
}

.strawberry-skin {
  margin-top: 4px;
  border-color: var(--skin-outline, #6c4c57);
  color: var(--skin-face, #5e3542);
  background: radial-gradient(circle, var(--skin-detail, #ffe0a4) 0 1.5px, transparent 2px) 8px 10px / 18px 18px, var(--skin-fill, #ff7892);
}

.strawberry-leaves {
  position: absolute;
  z-index: 2;
  top: -8px;
  left: 50%;
  width: 31px;
  height: 15px;
  transform: translateX(-50%);
}

.strawberry-leaves b {
  position: absolute;
  top: 3px;
  left: 11px;
  width: 10px;
  height: 13px;
  border: 2px solid var(--skin-leaf-outline, #3f6952);
  border-radius: 80% 25% 75% 30%;
  background: var(--skin-accent, #72c58c);
  transform-origin: 50% 90%;
}

.strawberry-leaves b:first-child { transform: translateX(-8px) rotate(-55deg); }
.strawberry-leaves b:nth-child(2) { transform: translateY(-3px) rotate(-4deg); }
.strawberry-leaves b:last-child { transform: translateX(8px) rotate(55deg); }

.strawberry-skin span {
  position: relative;
  z-index: 3;
}

.pudding-skin {
  overflow: hidden;
  border-color: var(--skin-outline, #59453a);
  border-radius: 19px 19px 15px 15px;
  color: var(--skin-face, #59453a);
  background: linear-gradient(180deg, var(--skin-highlight, #ffedaa), var(--skin-fill, #ffe08a));
}

.pudding-skin::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: -1px -1px auto;
  height: 20px;
  border-bottom: 2px solid var(--skin-caramel-outline, #784f34);
  background: linear-gradient(180deg, var(--skin-caramel-highlight, #ce8555), var(--skin-accent, #b86f43));
  clip-path: polygon(0 0, 100% 0, 100% 63%, 82% 65%, 75% 92%, 67% 92%, 61% 62%, 39% 64%, 34% 80%, 25% 80%, 20% 63%, 0 66%);
}

.pudding-skin span {
  position: relative;
  z-index: 2;
  padding-top: 8px;
}

.ghost-skin {
  height: 58px;
  border: 0;
  border-radius: 0;
  color: var(--skin-face, #4e4269);
  background: linear-gradient(145deg, var(--skin-highlight, rgba(239, 235, 255, 0.9)), var(--skin-fill, rgba(205, 196, 250, 0.84)));
  clip-path: polygon(2% 46%, 7% 24%, 22% 7%, 50% 1%, 78% 7%, 93% 24%, 98% 73%, 80% 83%, 67% 76%, 50% 90%, 33% 76%, 20% 83%, 2% 73%);
  clip-path: path("M 29 1 C 45 1 56 11 56 27 L 56 42 C 55 49 49 51 45 44 C 41 52 34 52 29 44 C 24 52 17 52 13 44 C 9 51 3 49 2 42 L 2 27 C 2 11 13 1 29 1 Z");
  filter: drop-shadow(0 2px 1px var(--skin-outline, #665f80)) drop-shadow(0 6px 4px rgba(78, 66, 105, 0.13));
  box-shadow: inset 7px 7px 0 rgba(255, 255, 255, 0.25);
  animation: ghost-float 3.1s ease-in-out infinite;
}

.frog-skin {
  margin-top: 5px;
  color: #31543d;
  background: #8edc91;
}

.frog-skin::before,
.frog-skin::after {
  content: "•";
  position: absolute;
  top: -12px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: #8edc91;
}

.frog-skin::before { left: 2px; }
.frog-skin::after { right: 2px; }

.cloud-skin {
  width: 62px;
  height: 43px;
  margin: 8px -2px 0;
  overflow: visible;
  border: 0;
  border-radius: 48% 52% 30% 28% / 62% 65% 34% 34%;
  color: var(--skin-face, #5d5a75);
  background: linear-gradient(180deg, var(--skin-highlight, #ffffff) 0%, #f5fbff 62%, var(--skin-fill, #dfe9fb) 100%);
  filter: drop-shadow(0 2px 1px var(--skin-outline, #87819c)) drop-shadow(0 6px 4px rgba(101, 119, 137, 0.13));
  box-shadow: inset 0 -5px 8px rgba(143, 154, 205, 0.13);
  animation: cloud-drift 2.9s ease-in-out infinite;
}

.cloud-skin::before,
.cloud-skin::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50% 50% 42% 45%;
  background: linear-gradient(160deg, var(--skin-highlight, #ffffff), #edf6ff);
}

.cloud-skin::before { left: 9px; top: -11px; width: 28px; height: 30px; }
.cloud-skin::after { right: 7px; top: -5px; width: 22px; height: 23px; }

.cloud-skin span::before,
.cloud-skin span::after {
  content: "";
  position: absolute;
  top: 30px;
  width: 7px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 165, 185, 0.34);
}

.cloud-skin span::before { left: 10px; }
.cloud-skin span::after { right: 10px; }

.weird-skin {
  color: #514968;
  border-color: #655d7a;
  background: linear-gradient(135deg, #ffb6ce, #ffe7a3 32%, #aee9d5 62%, #c7c2ff);
  box-shadow: inset 8px 8px 0 rgba(255, 255, 255, 0.24), 0 6px 0 rgba(91, 76, 122, 0.18);
}

.weird-skin::before {
  content: "✦";
  position: absolute;
  top: 3px;
  right: 6px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
}

.secret-skin-card:not(.is-discovered) .secret-silhouette {
  color: transparent;
  border-color: #777184;
  background: linear-gradient(145deg, rgba(70, 65, 82, 0.82), rgba(107, 97, 122, 0.58));
  filter: saturate(0.3);
}

.secret-skin-card:not(.is-discovered) .secret-silhouette::before {
  content: "?";
  top: 50%;
  right: auto;
  left: 50%;
  color: rgba(255, 255, 255, 0.78);
  font-size: 24px;
  transform: translate(-50%, -50%);
}

.tv-skin {
  margin-top: 4px;
  border-width: 5px;
  border-color: #50466c;
  border-radius: 13px;
  color: #3d3650;
  background: #9fe0db;
  box-shadow: 0 6px 0 rgba(80, 70, 108, 0.2);
}

.tv-skin::before {
  content: "⌁";
  position: absolute;
  top: -23px;
  color: #50466c;
  font-size: 28px;
}

.star-skin {
  border-color: #765b1f;
  color: #fff8cf;
  font-size: 25px;
  background: #ffc93f;
  box-shadow: 0 6px 0 rgba(118, 91, 31, 0.18), inset 7px 7px 0 rgba(255, 255, 255, 0.28);
}

.neon-skin {
  border-color: #2c2348;
  color: #eaffff;
  background: #34274f;
  box-shadow: 0 0 12px #30e9dd, inset 0 0 12px rgba(255, 76, 195, 0.55);
}

.glitch-skin {
  border-radius: 8px;
  color: #f5f5ff;
  font-family: monospace;
  background: linear-gradient(90deg, #40345f 0 38%, #ef5c9a 38% 45%, #40345f 45% 72%, #45d9d3 72% 79%, #40345f 79%);
  box-shadow: 5px 0 0 rgba(69, 217, 211, 0.35), -5px 0 0 rgba(239, 92, 154, 0.3);
}

.cosmic-skin {
  border-color: #c7b2ff;
  color: #ffe986;
  font-size: 22px;
  background: radial-gradient(circle at 28% 25%, #fff 0 1px, transparent 2px), radial-gradient(circle at 70% 62%, #fff 0 1px, transparent 2px), linear-gradient(145deg, #261d4e, #704c91);
  box-shadow: 0 0 14px rgba(167, 124, 240, 0.62);
}

.rarity {
  display: inline-flex;
  margin-bottom: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
}

.normal-rarity { color: #617066; background: #e8f0e9; }
.rare-rarity { color: #6557bb; background: #ece9ff; }
.special-rarity { color: #ad5b72; background: #ffe4ec; }

.skin-info h3 {
  margin: 0 0 5px;
  font-size: 14px;
  line-height: 1.25;
}

.skin-info p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.skin-action {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 8px 12px;
  border-bottom-width: 4px;
  font-size: 13px;
}

.skin-action.is-owned {
  border-bottom-color: #6f61d4;
  background: var(--purple);
}

.skin-action:disabled {
  border-bottom-color: #bbb5c4;
  cursor: default;
  background: #c9c4d0;
  transform: none;
  filter: none;
}

.shop-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--pink-dark);
  text-align: center;
  font-size: 13px;
}

.settings-card {
  display: grid;
  gap: 12px;
}

.settings-card > div,
.toggle-row,
.save-note {
  padding: 18px;
  border: 2px solid #e8e1ed;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.settings-card p,
.toggle-row small {
  display: block;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.volume-row {
  display: grid;
  gap: 12px;
}

.volume-row > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.volume-row output {
  min-width: 42px;
  color: var(--purple);
  font-weight: 900;
  text-align: right;
}

.volume-row input[type="range"] {
  width: 100%;
  height: 8px;
  margin: 2px 0;
  border-radius: 999px;
  accent-color: var(--purple);
  cursor: pointer;
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #d6d0dc;
  transition: background 180ms ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  top: 4px;
  left: 4px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(64, 60, 86, 0.22);
  transition: transform 180ms ease;
}

.toggle-row input:checked + .toggle-ui {
  background: var(--purple);
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(22px);
}

.save-note {
  margin-top: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  background: #fff8d9;
}

.tiny-home-button {
  min-width: 0;
  margin-bottom: 4px;
  padding: 3px 0;
  border: 0;
  color: var(--pink-dark);
  font-size: 12px;
  background: transparent;
  box-shadow: none;
}

.tiny-home-button:hover {
  transform: none;
}

.run-coin-pill {
  min-height: 33px;
  padding: 5px 9px;
  font-size: 13px;
}

.powerup-status {
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 2px solid rgba(70, 151, 174, 0.22);
  border-radius: 999px;
  color: #447b8e;
  font-size: 12px;
  font-weight: 900;
  background: rgba(226, 250, 255, 0.9);
}

.powerup-status.is-empty {
  display: none;
}

.graze-hud,
.dash-hud {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 2px solid rgba(90, 76, 130, 0.15);
  border-radius: 999px;
  color: #6a57a7;
  font-size: 10px;
  font-weight: 900;
  background: rgba(250, 246, 255, 0.9);
  box-shadow: 0 4px 10px rgba(68, 53, 103, 0.08);
}

.graze-hud strong {
  color: #e85f91;
  font-size: 13px;
}

.graze-hud small {
  color: #8a7cf0;
  font-size: 9px;
}

.dash-hud i {
  width: 34px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(108, 94, 145, 0.16);
}

.dash-hud b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #79d7cf, #8a7cf0);
  transform-origin: left;
}

.dash-hud > strong {
  min-width: 31px;
  color: #4d9f91;
  font-size: 8px;
}

.graze-hud.is-hidden,
.dash-hud.is-hidden {
  display: none;
}

.bonus-line,
.unlock-notice {
  margin: -10px 0 10px !important;
  padding: 7px 12px;
  border-radius: 10px;
  color: #996714 !important;
  font-size: 13px;
  background: #fff4bd;
}

.unlock-notice {
  color: #6557bb !important;
  background: #eeebff;
}

.bonus-line.is-hidden,
.unlock-notice.is-hidden {
  display: none;
}

.achievement-grid {
  display: grid;
  gap: 10px;
  max-height: 555px;
  padding: 3px 4px 10px;
  overflow-y: auto;
}

.achievement-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 13px;
  border: 2px solid #e7e0eb;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.82);
}

.achievement-card.is-complete {
  border-color: #e8c151;
  background: #fff9df;
}

.achievement-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  font-weight: 900;
  background: #c9c4d0;
}

.achievement-card.is-complete .achievement-mark {
  color: #79570e;
  background: var(--yellow);
}

.achievement-info strong,
.achievement-info small {
  display: block;
}

.achievement-info small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.achievement-state {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.achievement-card.is-complete .achievement-state {
  color: #a36d11;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 15px;
  border: 2px solid #e7e0eb;
  border-radius: 18px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.stat-card strong {
  margin-top: 5px;
  color: var(--purple);
  font-size: 23px;
}

.wind-indicator,
.mechanic-alert,
.boss-bar {
  position: absolute;
  z-index: 1;
}

.wind-indicator {
  top: 55px;
  left: 50%;
  padding: 6px 12px;
  border: 2px solid rgba(61, 132, 162, 0.28);
  border-radius: 999px;
  color: #3d84a2;
  font-size: 13px;
  font-weight: 900;
  background: rgba(232, 250, 255, 0.9);
  transform: translateX(-50%);
}

.mechanic-alert {
  top: 103px;
  left: 50%;
  padding: 8px 15px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 900;
  background: rgba(78, 66, 105, 0.82);
  box-shadow: 0 7px 18px rgba(43, 34, 65, 0.22);
  transform: translateX(-50%);
  animation: alert-pop 220ms ease both;
  white-space: nowrap;
}

.mechanic-alert.is-warning {
  background: rgba(217, 76, 102, 0.9);
}

.wind-indicator.is-hidden,
.mechanic-alert.is-hidden,
.boss-bar.is-hidden {
  display: none;
}

.boss-bar {
  inset: 56px 16px auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.boss-bar > div {
  height: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(34, 24, 54, 0.5);
}

.boss-bar i {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7597, #ffd66b);
  transition: width 120ms linear;
}

.upgrade-panel {
  background: rgba(42, 32, 76, 0.92);
  color: white;
}

.upgrade-panel p {
  color: rgba(255, 255, 255, 0.7);
}

.upgrade-icon {
  margin-bottom: 8px;
  color: var(--yellow);
  font-size: 46px;
}

.upgrade-choices {
  width: min(100%, 320px);
  display: grid;
  gap: 10px;
}

.upgrade-choice {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-bottom-color: #6f61d4;
  border-radius: 14px;
  font-size: 14px;
  background: var(--purple);
}

.endless-result-grid {
  width: min(100%, 300px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.endless-result-grid span {
  padding: 9px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 11px;
  background: white;
}

.endless-result-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--purple);
  font-size: 15px;
}

.victory-player {
  position: relative;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  margin-bottom: 5px;
  border: 3px solid var(--ink);
  border-radius: 13px;
  color: var(--ink);
  font-weight: 900;
  background: var(--yellow);
}

.victory-player.is-happy {
  animation: victory-hop 650ms ease-in-out 2;
}

.victory-player.is-happy::before,
.victory-player.is-happy::after {
  content: "★ ✦";
  position: absolute;
  top: 4px;
  width: 42px;
  color: #f5b91d;
  font-size: 12px;
  letter-spacing: 5px;
  text-shadow: 0 2px 0 white;
  animation: star-sparkle 850ms ease-in-out infinite alternate;
}

.victory-player.is-happy::before { right: 100%; }
.victory-player.is-happy::after { left: 100%; transform: scaleX(-1); }

#levelCompletePanel.boss-victory::before,
#levelCompletePanel.boss-victory::after {
  content: "✦  ●  ✦  ●  ✦";
  position: absolute;
  top: 14%;
  color: var(--yellow);
  font-size: 18px;
  animation: confetti-fall 1.2s ease-in-out infinite alternate;
}

#levelCompletePanel.boss-victory::before { left: 8%; }
#levelCompletePanel.boss-victory::after { right: 8%; }

#levelCompletePanel.weird-perfect-victory .earned-stars {
  text-shadow: 0 3px 0 white, 0 0 16px rgba(138, 124, 240, 0.55);
  animation: star-pop 520ms ease both, star-sparkle 900ms 520ms ease-in-out infinite alternate;
}

#levelCompletePanel.weird-perfect-victory {
  background-image: radial-gradient(circle at 18% 25%, rgba(121, 215, 207, 0.16) 0 8px, transparent 9px), radial-gradient(circle at 83% 32%, rgba(138, 124, 240, 0.14) 0 7px, transparent 8px);
}

.reward-text {
  color: #9a6d0d;
}

.secondary-button {
  min-width: 130px;
  margin-top: 10px;
  padding: 8px 16px;
  border: 2px solid #d8d1df;
  border-bottom-width: 4px;
  color: var(--ink);
  font-size: 13px;
  background: white;
  box-shadow: none;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--pink);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.22em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(25px, 6vw, 34px);
  line-height: 1;
}

.score-board {
  display: flex;
  gap: 10px;
}

.score-board div {
  min-width: 68px;
  padding: 8px 10px;
  border: 2px solid #eee7f1;
  border-radius: 14px;
  text-align: center;
  background: white;
}

.score-board span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.score-board strong {
  display: block;
  margin-top: 2px;
  color: var(--purple);
  font-size: 18px;
}

.game-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: #dff7ff;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.45);
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}

.touch-hints {
  position: absolute;
  z-index: 1;
  right: 12px;
  bottom: 6px;
  left: 12px;
  display: none;
  justify-content: space-between;
  color: rgba(64, 60, 86, 0.4);
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}

.game-transition {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: white;
  text-align: center;
  background: rgba(49, 42, 72, 0.84);
  backdrop-filter: blur(3px);
  opacity: 1;
  transition: opacity 180ms ease;
}

.game-transition.is-hidden {
  display: none;
}

.game-transition.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.game-transition[data-theme="sky"] { background: linear-gradient(155deg, rgba(88, 148, 190, 0.86), rgba(132, 108, 192, 0.84)); }
.game-transition[data-theme="sweet"] { background: linear-gradient(155deg, rgba(211, 112, 135, 0.88), rgba(179, 112, 178, 0.86)); }
.game-transition[data-theme="night"] { background: linear-gradient(155deg, rgba(33, 39, 72, 0.94), rgba(74, 50, 98, 0.94)); }
.game-transition[data-theme="boss"] { background: linear-gradient(155deg, rgba(50, 24, 61, 0.96), rgba(135, 39, 78, 0.94)); }
.game-transition[data-theme="weird"] { background: linear-gradient(155deg, rgba(183, 139, 219, 0.92), rgba(115, 196, 194, 0.9)); }

.transition-center {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  transform: translateY(8px) scale(0.9);
  opacity: 0;
}

.game-transition.show-message .transition-center {
  animation: ready-center-in 260ms ease-out both;
}

.ready-cube {
  position: relative;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border: 4px solid var(--ink);
  border-radius: 19px;
  background: var(--yellow);
  box-shadow: 0 8px 0 rgba(28, 24, 43, 0.2), inset 0 4px 0 rgba(255, 255, 255, 0.35);
  animation: ready-cube-hop 520ms ease-out both;
}

.ready-cube i {
  position: absolute;
  top: 22px;
  width: 6px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.ready-cube i:first-child { left: 16px; }
.ready-cube i:nth-child(2) { right: 16px; }

.ready-cube b {
  position: absolute;
  bottom: 13px;
  left: 50%;
  width: 17px;
  height: 8px;
  border-bottom: 3px solid var(--ink);
  border-radius: 50%;
  transform: translateX(-50%);
}

.transition-kicker,
.transition-title,
.transition-subtitle {
  display: block;
  text-shadow: 0 3px 0 rgba(42, 32, 65, 0.25);
}

.transition-kicker {
  display: none;
  margin-bottom: 7px;
  color: #ffd66b;
  font-size: 14px;
  letter-spacing: 0.16em;
}

.transition-title {
  font-size: clamp(38px, 11vw, 54px);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.transition-subtitle {
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.game-transition.is-chapter .ready-cube {
  display: none;
}

.game-transition.is-chapter .transition-kicker {
  display: block;
}

.game-transition.is-boss .transition-kicker {
  color: #ffb0bd;
  animation: warning-flash 240ms steps(2, end) 3;
}

.transition-block {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 13px;
  background: var(--yellow);
  box-shadow: 0 6px 0 rgba(31, 25, 47, 0.16);
}

.block-one { top: 13%; left: -52px; background: #ff819e; animation: transition-block-left 760ms ease-out both; }
.block-two { top: 27%; right: -52px; background: #8e82ee; animation: transition-block-right 720ms 60ms ease-out both; }
.block-three { bottom: 18%; left: -52px; background: #79d7d0; animation: transition-block-left 700ms 90ms ease-out both; }
.block-four { right: -52px; bottom: 11%; background: #ffd66b; animation: transition-block-right 780ms 30ms ease-out both; }

.game-transition.is-scattering .block-one,
.game-transition.is-scattering .block-three {
  animation: transition-block-scatter-left 180ms ease-in both;
}

.game-transition.is-scattering .block-two,
.game-transition.is-scattering .block-four {
  animation: transition-block-scatter-right 180ms ease-in both;
}

.game-hud {
  position: absolute;
  inset: 12px 12px auto;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.hud-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.lives,
.level-pill,
.timer-pill {
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(64, 60, 86, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 10px rgba(64, 60, 86, 0.1);
}

.level-pill.is-hidden {
  display: none;
}

.lives {
  gap: 3px;
  padding: 4px 10px;
}

.heart {
  color: var(--pink);
  font-size: 19px;
  line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(233, 86, 123, 0.16));
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

.heart.is-lost {
  opacity: 0.22;
  filter: grayscale(1);
  transform: scale(0.78);
}

.level-pill,
.timer-pill {
  padding: 5px 10px;
  color: var(--ink);
  font-size: 13px;
}

.timer-pill {
  min-width: 52px;
  color: var(--purple);
}

.pause-button {
  min-width: 64px;
  min-height: 34px;
  padding: 5px 12px;
  border-bottom-width: 3px;
  font-size: 13px;
  pointer-events: auto;
  box-shadow: 0 4px 10px rgba(233, 86, 123, 0.2);
}

.pause-button:disabled {
  opacity: 0.45;
  cursor: default;
  filter: grayscale(0.45);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 7 / 10;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(255, 250, 243, 0.87);
  backdrop-filter: blur(5px);
  transition: opacity 180ms ease;
}

.overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.overlay h2 {
  margin-bottom: 10px;
  font-size: 29px;
}

.overlay p {
  max-width: 280px;
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.7;
}

kbd {
  display: inline-grid;
  min-width: 30px;
  min-height: 28px;
  place-items: center;
  border: 2px solid #dcd5e5;
  border-bottom-width: 4px;
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  background: white;
}

button {
  min-width: 150px;
  padding: 13px 24px;
  border: 0;
  border-bottom: 5px solid var(--pink-dark);
  border-radius: 999px;
  color: white;
  font: inherit;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  background: var(--pink);
  box-shadow: 0 8px 18px rgba(233, 86, 123, 0.25);
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

button:active {
  border-bottom-width: 2px;
  transform: translateY(2px) scale(0.98);
}

button:focus-visible {
  outline: 4px solid rgba(138, 124, 240, 0.45);
  outline-offset: 3px;
}

.mascot {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: var(--yellow);
  box-shadow: 0 8px 0 rgba(64, 60, 86, 0.12);
  animation: float 1.8s ease-in-out infinite;
}

.eye {
  position: absolute;
  top: 23px;
  width: 7px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
}

.eye-left {
  left: 20px;
}

.eye-right {
  right: 20px;
}

.mouth {
  position: absolute;
  bottom: 16px;
  left: 50%;
  width: 19px;
  height: 10px;
  border-bottom: 4px solid var(--ink);
  border-radius: 50%;
  transform: translateX(-50%);
}

.game-over-icon {
  margin-bottom: 14px;
  color: var(--pink-dark);
  font-size: 48px;
  font-weight: 900;
}

.earned-stars {
  margin-bottom: 12px;
  color: var(--yellow);
  font-size: clamp(42px, 12vw, 62px);
  font-weight: 900;
  letter-spacing: 5px;
  line-height: 1;
  -webkit-text-stroke: 2px var(--ink);
  filter: drop-shadow(0 6px 0 rgba(64, 60, 86, 0.12));
  animation: star-pop 500ms ease both;
}

.pause-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border: 4px solid var(--ink);
  border-radius: 22px;
  color: white;
  font-size: 32px;
  font-weight: 900;
  background: var(--purple);
  box-shadow: 0 8px 0 rgba(64, 60, 86, 0.12);
}

.pause-panel {
  background: rgba(244, 231, 255, 0.9);
}

footer {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding-top: 17px;
  color: var(--muted);
  font-size: 14px;
}

footer kbd {
  min-width: 25px;
  min-height: 23px;
  margin-right: 4px;
  font-size: 12px;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}

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

@keyframes decor-float {
  0%, 100% { translate: 0 0; rotate: -3deg; }
  50% { translate: 0 -12px; rotate: 4deg; }
}

@keyframes jelly-wobble {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.05, 0.95); }
}

@keyframes cat-tail-sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(8deg); }
}

@keyframes cloud-drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes ghost-float {
  0%, 100% { translate: 0 0; opacity: 0.9; }
  50% { translate: 0 -3px; opacity: 1; }
}

@keyframes ice-shimmer {
  0%, 100% { translate: -2px 0; opacity: 0.52; }
  50% { translate: 7px 0; opacity: 0.86; }
}

@keyframes new-badge-pop {
  0% { opacity: 0; transform: scale(0.55) rotate(-8deg); }
  65% { transform: scale(1.13) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes star-sparkle {
  from { opacity: 0.35; translate: 0 3px; scale: 0.85; }
  to { opacity: 1; translate: 0 -4px; scale: 1.08; }
}

@keyframes transition-block-left {
  0% { translate: -20px 0; rotate: -18deg; }
  48% { translate: 92px 0; rotate: 8deg; }
  75% { translate: 82px 0; rotate: -3deg; }
  100% { translate: 88px 0; rotate: 0; }
}

@keyframes transition-block-right {
  0% { translate: 20px 0; rotate: 18deg; }
  48% { translate: -92px 0; rotate: -8deg; }
  75% { translate: -82px 0; rotate: 3deg; }
  100% { translate: -88px 0; rotate: 0; }
}

@keyframes transition-block-scatter-left {
  to { translate: -120px -18px; rotate: -22deg; opacity: 0; }
}

@keyframes transition-block-scatter-right {
  to { translate: 120px 18px; rotate: 22deg; opacity: 0; }
}

@keyframes ready-center-in {
  from { opacity: 0; transform: translateY(10px) scale(0.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ready-cube-hop {
  0% { transform: translateY(16px) scale(0.84); }
  58% { transform: translateY(-12px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes warning-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@keyframes alert-pop {
  from { opacity: 0; transform: translateX(-50%) scale(0.7); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes victory-hop {
  0%, 100% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-17px) rotate(-7deg); }
  70% { transform: translateY(2px) rotate(5deg); }
}

@keyframes confetti-fall {
  from { transform: translateY(-8px) rotate(-5deg); }
  to { transform: translateY(28px) rotate(6deg); }
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

body.reduced-motion .game-transition .transition-block {
  display: none;
}

body.reduced-motion .game-transition.show-message .transition-center {
  animation: none !important;
  opacity: 1;
  transform: none;
}

body.reduced-motion .game-transition .ready-cube {
  animation: none !important;
}

@keyframes star-pop {
  0% { opacity: 0; transform: scale(0.5) rotate(-8deg); }
  70% { transform: scale(1.12) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@media (max-width: 520px) {
  body {
    padding: 12px;
  }

  .game-card {
    padding: 15px;
    border-radius: 22px;
  }

  .app-screen {
    min-height: calc(100vh - 54px);
  }

  .home-screen {
    min-height: calc(100vh - 54px);
  }

  .screen-header {
    grid-template-columns: 45px 1fr auto;
  }

  .coin-badge {
    padding-inline: 9px;
  }

  .level-grid {
    max-height: calc(100vh - 230px);
  }

  .chapter-level-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .level-card {
    border-radius: 13px;
  }

  .level-card strong {
    font-size: 18px;
  }

  .skin-grid {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 285px);
  }

  .skin-card {
    grid-template-columns: 62px 1fr auto;
  }

  .skin-action {
    grid-column: auto;
    min-width: 76px;
  }

  .current-skin-panel {
    min-height: 80px;
    padding: 9px 14px;
  }

  .game-header {
    align-items: flex-end;
    gap: 8px;
  }

  .score-board div {
    min-width: 56px;
    padding: 6px;
  }

  .score-board strong {
    font-size: 15px;
  }

  .game-hud {
    inset: 8px 8px auto;
    gap: 5px;
  }

  .hud-status {
    gap: 4px;
  }

  .lives {
    padding-inline: 8px;
  }

  .heart {
    font-size: 17px;
  }

  .level-pill,
  .timer-pill {
    padding-inline: 8px;
    font-size: 12px;
  }

  .run-coin-pill {
    padding-inline: 8px;
    font-size: 12px;
  }

  .powerup-status {
    min-height: 28px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .pause-button {
    min-width: 55px;
    min-height: 32px;
    padding-inline: 9px;
    font-size: 12px;
  }

  .boss-bar {
    inset: 50px 10px auto;
    gap: 5px;
    font-size: 9px;
  }

  button:not(.icon-button):not(.tiny-home-button) {
    min-height: 44px;
  }

  footer {
    padding-top: 12px;
    gap: 14px;
  }
}

@media (pointer: coarse) {
  .touch-hints {
    display: flex;
  }

  footer {
    display: none;
  }
}

@media (max-width: 390px) {
  .chapter-level-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .floating-block {
    opacity: 0.72;
  }

  .home-content {
    width: 88%;
  }
}

@media (max-height: 780px) and (min-width: 521px) {
  .game-card {
    width: 400px;
    padding: 16px;
  }

  .game-header {
    margin-bottom: 10px;
  }

  footer {
    padding-top: 10px;
  }
}
