/* 叠叠鹅消消 —— 3D 玩具堆叠三消 */
:root {
  --ink: #4A2C12;
  --ink-soft: #8B6338;
  --cream: #FFF7E4;
  --cream-deep: #F3DFB5;
  --wood: #C4864E;
  --wood-dark: #8B5627;
  --orange: #FF8A3D;
  --orange-deep: #E96A1D;
  --green: #8DBE4E;
  --toy: clamp(56px, 17.8vw, 96px);
  --app-h: 100dvh;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #6FAFDF;
  overscroll-behavior: none;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus { outline: none; }
img { -webkit-user-drag: none; user-select: none; }
svg { display: block; }

#app {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: var(--app-h);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 6px);
  overflow: hidden;
  isolation: isolate;
  background: #8CC7EC;
}

/* ---------------- 场景背景 ---------------- */
.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    #3E9FE3 0%, #58B1EC 14%, #7FC7F2 28%,
    #ABDDF7 40%, #CFEFFB 50%, #DFF6E8 56%,
    #C7E69C 62%, #A9D46C 74%, #93C455 88%, #7FB347 100%);
}

.sun {
  position: absolute;
  right: -18%;
  top: -14%;
  width: 68%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255, 248, 196, .95) 0%, rgba(255, 243, 170, .5) 36%, rgba(255, 243, 170, 0) 68%);
  border-radius: 50%;
}

.cloud {
  position: absolute;
  height: 28px;
  background: #fff;
  border-radius: 999px;
  opacity: .94;
  filter: blur(1px);
  box-shadow: 0 4px 18px rgba(70, 140, 190, .12);
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud::before { width: 46%; height: 150%; left: 12%; bottom: 8%; }
.cloud::after { width: 58%; height: 200%; right: 12%; bottom: 6%; }
.cloud-a { left: -6%; top: 8%; width: 40%; }
.cloud-b { right: -8%; top: 6%; width: 46%; opacity: .88; }
.cloud-c { left: 24%; top: 3%; width: 26%; height: 20px; opacity: .72; }
.cloud-b::before { bottom: 18%; }

.hill {
  position: absolute;
  border-radius: 50% 50% 0 0;
  filter: blur(1.5px);
}
.hill-a { left: -24%; bottom: 45%; width: 82%; height: 16%; background: #A4CD78; opacity: .9; }
.hill-b { right: -28%; bottom: 44%; width: 90%; height: 20%; background: #96C46A; opacity: .95; }

.ground {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 56%;
  border-radius: 50% 50% 0 0 / 9% 9% 0 0;
  background: linear-gradient(180deg, #BCDF80 0%, #A6CE66 24%, #91BE52 58%, #7FAE45 100%);
  box-shadow: inset 0 10px 26px rgba(255, 255, 255, .4);
  overflow: hidden;
}
.ground::before {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  top: 1.5%;
  height: 14%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
  border-radius: 50%;
}
.ground::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, .5) 0 2px, transparent 2.6px),
    radial-gradient(circle at 72% 48%, rgba(255, 255, 255, .38) 0 1.8px, transparent 2.4px),
    radial-gradient(circle at 42% 78%, rgba(255, 244, 170, .5) 0 2px, transparent 2.6px),
    radial-gradient(circle at 88% 82%, rgba(255, 255, 255, .4) 0 2px, transparent 2.6px);
  background-size: 118px 96px, 96px 82px, 140px 118px, 108px 90px;
  opacity: .55;
}
.ground-light {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 16%;
  height: 45%;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 255, 210, .38), rgba(255, 255, 210, 0) 62%);
}

.house {
  position: absolute;
  left: -5%;
  top: 15%;
  width: 34%;
  max-width: 190px;
  opacity: .95;
  filter: blur(.4px) saturate(.96) drop-shadow(0 8px 12px rgba(50, 90, 30, .16));
}

.tree {
  position: absolute;
  filter: blur(.6px) drop-shadow(0 10px 12px rgba(50, 90, 30, .18));
}
.tree-a { right: -7%; top: 16%; width: 33%; }
.tree-b { left: -9%; top: 40%; width: 27%; opacity: .92; }

.fence {
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 0;
  height: 13%;
  opacity: .22;
  background: repeating-linear-gradient(90deg,
    #E0BE88 0 3.2vw, #C9A26C 3.2vw 3.7vw, #E0BE88 3.7vw 3.9vw);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 38%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 38%);
}
.fence::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 30%;
  height: 9px;
  background: #D8B078;
  border-radius: 6px;
  box-shadow: 0 5px 0 rgba(160, 115, 65, .5);
}

.flower {
  position: absolute;
  width: 18px;
  height: 18px;
  opacity: .92;
  filter: drop-shadow(0 1px 1px rgba(60, 100, 30, .2));
}
.f1 { left: 5%; bottom: 30%; width: 15px; }
.f2 { right: 6%; bottom: 24%; width: 20px; }
.f3 { left: 9%; bottom: 12%; width: 13px; opacity: .8; }
.f4 { right: 12%; bottom: 38%; width: 14px; opacity: .75; }

/* ---------------- 顶部 HUD ---------------- */
.hud {
  position: absolute;
  z-index: 20;
  left: 12px;
  right: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 9px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.pause-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: block;
  transition: transform .12s ease;
  filter: drop-shadow(0 3px 5px rgba(40, 70, 20, .22));
}
.pause-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pause-btn:active { transform: scale(.9); }

.hud-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.level-chip {
  height: 34px;
  padding: 0 18px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .06em;
  color: #FFF6DE;
  background: linear-gradient(180deg, #BD8450 0%, #A06A38 46%, #855428 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .34), inset 0 -2px 0 rgba(70, 35, 10, .4),
    0 3px 0 #683C19, 0 7px 12px rgba(50, 30, 10, .24);
  text-shadow: 0 1px 0 rgba(90, 48, 14, .55);
}
.level-chip span { margin: 0 3px; }

.star-chip {
  height: 30px;
  min-width: 74px;
  padding: 0 14px 0 8px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 16px;
  font-weight: 900;
  color: #FFF6DE;
  background: linear-gradient(180deg, #B07A46 0%, #96602F 50%, #7A4820 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .28), 0 3px 0 #5E3718, 0 6px 10px rgba(50, 30, 10, .2);
  text-shadow: 0 1px 0 rgba(90, 48, 14, .55);
}
.star-chip svg { width: 22px; height: 22px; flex: 0 0 auto; filter: drop-shadow(0 1px 0 rgba(120, 70, 10, .45)); }
.star-chip.bump { animation: scoreBump .32s cubic-bezier(.2, 1.5, .4, 1); }

/* ---------------- 玩具堆 ---------------- */
.arena {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
}
.arena.shake { animation: boardShake .42s ease-in-out; }

.pile { position: absolute; inset: 0; z-index: 2; }
.pile::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 1%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(50, 76, 20, .28) 0%, rgba(50, 76, 20, .12) 46%, rgba(50, 76, 20, 0) 72%);
  filter: blur(3px);
  z-index: 0;
  pointer-events: none;
}

.toy {
  position: absolute;
  width: calc(var(--toy) * var(--k, 1));
  height: auto;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  transform-origin: 50% 62%;
  transition: transform .16s cubic-bezier(.2, .8, .3, 1), opacity .18s ease, filter .16s ease, visibility .18s;
  line-height: 0;
  filter: drop-shadow(0 5px 3px rgba(42, 70, 18, .3));
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.toy .toy-img { width: 100%; height: auto; pointer-events: none; display: block; }
.toy:active { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(.9); }
.toy.returning { animation: toyReturn .42s cubic-bezier(.2, 1.25, .4, 1) both; }
.pile.shuffling .toy {
  transition: left .42s cubic-bezier(.3, .8, .35, 1), top .42s cubic-bezier(.3, .8, .35, 1),
    transform .42s cubic-bezier(.3, .8, .35, 1), filter .2s ease;
}
.toy.hidden { visibility: hidden; }

@keyframes toyReturn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.35) rotate(var(--rot, 0deg)); }
  62% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(var(--rot, 0deg)); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(var(--rot, 0deg)); }
}

/* ---------------- 卡槽 ---------------- */
.tray-wrap {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  padding: 4px 13px 0;
}

.tray {
  position: relative;
  width: 100%;
  aspect-ratio: 904 / 158;
  background: url("images/gen/tray.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 7px 7px rgba(45, 70, 18, .22));
}

.slot {
  position: absolute;
  top: 11.5%;
  height: 76%;
  width: 10.9%;
  transform: translateX(-50%);
  border-radius: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.slot:nth-child(1) { left: 8.0%; }
.slot:nth-child(2) { left: 22.1%; }
.slot:nth-child(3) { left: 35.95%; }
.slot:nth-child(4) { left: 49.8%; }
.slot:nth-child(5) { left: 63.6%; }
.slot:nth-child(6) { left: 77.4%; }
.slot:nth-child(7) { left: 91.3%; }

.slot.filled { background: radial-gradient(ellipse at 50% 40%, rgba(255, 244, 210, .18), rgba(255, 244, 210, 0) 70%); }

.tray-toy {
  position: absolute;
  inset: 1% 4% 0;
  display: grid;
  place-items: center;
}
.tray-toy img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(55, 30, 8, .35)); }
.tray-toy.enter { animation: trayIn .3s cubic-bezier(.2, 1.5, .4, 1) both; }
.tray-toy.matching { animation: matchOut .3s ease-in forwards; }
.tray-toy.leaving { animation: trayOut .26s ease-in forwards; }

@keyframes trayIn {
  0% { opacity: 0; transform: scale(.35) rotate(-22deg); }
  70% { opacity: 1; transform: scale(1.1) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes matchOut {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(1.28); opacity: 1; filter: brightness(1.35); }
  100% { transform: scale(.2); opacity: 0; }
}
@keyframes trayOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.3) translateY(-16px); opacity: 0; }
}

/* ---------------- 道具 ---------------- */
.tools {
  --circle: clamp(58px, 17vw, 76px);
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(26px, 9.2vw, 48px);
  padding: 8px 0 2px;
}

.tool {
  position: relative;
  width: var(--circle);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform .12s ease;
}
.tool:active { transform: scale(.93); }

.tool-circle {
  position: relative;
  width: var(--circle);
  height: var(--circle);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 34% 24%, #FFFDF4 0%, #FBF0D2 46%, #EFD9A9 76%, #DFC188 100%);
  border: 2px solid #FFFAEA;
  box-shadow: inset 0 -5px 0 rgba(180, 140, 80, .24), inset 0 4px 0 #fff,
    0 5px 0 rgba(120, 80, 35, .3), 0 10px 15px rgba(45, 75, 18, .24);
}
.tool-circle::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 11%;
  height: 26%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.tool-circle .icon3d {
  width: 56%;
  height: 56%;
  filter: drop-shadow(0 2px 1px rgba(80, 40, 10, .25));
  position: relative;
  z-index: 1;
}

.tool-label {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #77471B;
  text-shadow: 0 1px 0 #FFF6DA;
}

.tool-badge {
  position: absolute;
  top: calc(var(--circle) - 20px);
  right: -2px;
  min-width: 23px;
  height: 23px;
  padding: 0 4px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 900;
  color: #FFF4DC;
  background: linear-gradient(180deg, #966135, #5E3718);
  border: 2px solid #FFEDC8;
  box-shadow: 0 2px 4px rgba(40, 20, 5, .32);
  z-index: 3;
}

.ad-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  z-index: 4;
  width: 25px;
  height: 25px;
  border-radius: 9px;
  display: none;
  place-items: center;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(180deg, #FFB04A, #F26A12);
  border: 2px solid #FFF2D4;
  box-shadow: 0 2px 5px rgba(150, 60, 0, .35);
}
.tool.is-empty .ad-badge { display: grid; }
.tool.is-empty .tool-circle { filter: saturate(.75) brightness(.98); }
.tool.is-empty .tool-badge { background: linear-gradient(180deg, #B4743F, #7A4820); }
.tool.disabled { opacity: .45; }

/* ---------------- 大鹅 ---------------- */
.goose-scene[hidden] { display: none; }
.goose-scene {
  position: absolute;
  inset: -6px 0 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  animation: fadeIn .45s ease both;
}
.goose-star {
  position: absolute;
  width: 26px;
  height: 26px;
  z-index: 1;
  filter: drop-shadow(0 2px 1px rgba(140, 90, 10, .3));
  animation: twinkle 1.7s ease-in-out infinite;
}
.gs1 { left: 12%; top: 31%; }
.gs2 { right: 11%; top: 42%; width: 20px; animation-delay: .45s; }
.gs3 { left: 20%; bottom: 24%; width: 16px; animation-delay: .85s; }
@keyframes twinkle {
  0%, 100% { transform: scale(.78) rotate(-10deg); opacity: .55; }
  50% { transform: scale(1.14) rotate(10deg); opacity: 1; }
}
.goose-hint {
  padding: 8px 18px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #FFB25A, #FF7A1F);
  border: 2px solid #FFE0B4;
  box-shadow: 0 4px 0 #C4550D, 0 8px 14px rgba(120, 60, 10, .28);
  text-shadow: 0 1px 0 rgba(150, 60, 0, .35);
  animation: hintBob 1.3s ease-in-out infinite;
  z-index: 3;
}
.goose-btn {
  position: relative;
  width: min(60vw, 250px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  line-height: 0;
  border-radius: 50%;
  animation: gooseFloat 2.2s ease-in-out infinite;
  filter: drop-shadow(0 18px 12px rgba(40, 70, 15, .3));
  z-index: 2;
}
.goose-btn svg { width: 100%; height: 100%; position: relative; z-index: 2; }
.goose-btn:active { animation-play-state: paused; transform: scale(.94); }
.goose-glow {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 252, 205, .95) 0%, rgba(255, 247, 180, .5) 42%, rgba(255, 247, 180, 0) 70%);
  animation: glowPulse 1.7s ease-in-out infinite;
}
.goose-tip {
  font-size: 13px;
  font-weight: 800;
  color: #6A4418;
  text-shadow: 0 1px 0 rgba(255, 255, 220, .8);
  z-index: 3;
}
.goose-btn.caught { animation: gooseCaught .55s cubic-bezier(.3, .8, .4, 1) forwards; }

@keyframes gooseFloat {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}
@keyframes hintBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.03); }
}
@keyframes glowPulse {
  0%, 100% { transform: scale(.92); opacity: .75; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes gooseCaught {
  0% { transform: scale(1); }
  35% { transform: scale(1.16) rotate(6deg); }
  70% { transform: scale(.86) rotate(-6deg); }
  100% { transform: scale(.1) rotate(18deg); opacity: 0; }
}

/* ---------------- 弹层 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(24, 48, 16, .52);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.overlay[hidden] { display: none; }
.overlay.show { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 334px;
  max-height: 92dvh;
  overflow: auto;
  padding: 20px 20px 18px;
  border-radius: 28px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% -10%, #FFFBEC 0%, rgba(255, 251, 236, 0) 60%),
    linear-gradient(180deg, #FFFCF3 0%, #FFF4DC 100%);
  border: 3px solid #F6E1B4;
  box-shadow: inset 0 2px 0 #fff, 0 10px 0 rgba(107, 62, 28, .3), 0 26px 46px rgba(20, 40, 10, .42);
  transform: translateY(18px) scale(.94);
  transition: transform .26s cubic-bezier(.2, 1.32, .4, 1);
}
.overlay.show .modal { transform: none; }
.modal-sm { max-width: 306px; }

.modal h2 {
  margin: 6px 0 4px;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: .02em;
  color: #5A3313;
  text-shadow: 0 1px 0 #fff;
}
.modal p {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #9A7443;
  font-weight: 600;
}
.modal p b { color: var(--orange-deep); font-size: 20px; margin: 0 2px; }

.modal-badge {
  width: 76px;
  height: 76px;
  margin: 0 auto 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 34% 24%, #FFFDF4, #F7EACB 60%, #EAD1A0);
  border: 2px solid #FFF9E8;
  box-shadow: inset 0 -4px 0 rgba(180, 140, 80, .22), 0 4px 0 rgba(120, 80, 35, .22);
}
.modal-badge .icon3d { width: 48%; height: 48%; }

.fail-art { width: 158px; margin: 0 auto 2px; filter: drop-shadow(0 5px 6px rgba(120, 70, 20, .18)); }

.win-banner {
  position: relative;
  height: 116px;
  margin: -6px 0 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 0 0 3px #FFF4D8, 0 6px 12px rgba(120, 80, 30, .18);
}
.win-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 32%;
  display: block;
  transform: scale(1.04);
}
.win-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(30, 60, 10, 0) 30%, rgba(30, 50, 8, .62) 100%);
}
.win-banner span {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  padding: 4px 11px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #FFF8E2;
  background: rgba(74, 48, 18, .58);
  box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .2);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  text-shadow: 0 1px 3px rgba(30, 20, 0, .5);
}
.win-goose {
  width: 92px;
  height: 92px;
  margin: -40px auto 0;
  position: relative;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #FFFDF2, #F7E9C5);
  border: 3px solid #FFF9E8;
  box-shadow: 0 5px 0 rgba(120, 80, 35, .22), 0 10px 18px rgba(90, 60, 20, .18);
}
.win-goose svg { width: 82%; height: 82%; }
.win-stars { display: flex; justify-content: center; gap: 4px; margin: -2px 0 8px; }
.win-stars svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 0 rgba(150, 100, 10, .25)); }
.modal-win h2 { margin-top: 2px; }

.btn {
  width: 100%;
  min-height: 50px;
  margin-top: 9px;
  padding: 0 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .04em;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: translateY(2px) scale(.98); }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #FFB259 0%, #FF8A2E 48%, #F5731A 100%);
  border: 2px solid #FFD9AC;
  text-shadow: 0 1px 0 rgba(160, 62, 0, .42);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 5px 0 #C4550D, 0 10px 16px rgba(180, 80, 10, .26);
}
.btn-primary .mp-icon { width: 23px; height: 23px; color: #fff; }
.btn-ghost {
  min-height: 42px;
  margin-top: 3px;
  font-size: 13.5px;
  font-weight: 800;
  color: #A07A49;
  box-shadow: none;
  background: transparent;
}
.btn-ghost:active { background: rgba(160, 120, 60, .08); }

/* ---------------- 广告 ---------------- */
.ad-layer {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 34, 12, .72);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.ad-layer[hidden] { display: none; }
.ad-card {
  width: 100%;
  max-width: 300px;
  padding: 18px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, #2C3A2A, #1B261A);
  border: 2px solid rgba(255, 255, 255, .16);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
}
.ad-screen {
  position: relative;
  height: 118px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3D5740, #223024);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ad-play {
  width: 0;
  height: 0;
  border-left: 20px solid #fff;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  opacity: .92;
  margin-left: 5px;
}
.ad-bars { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; gap: 4px; }
.ad-bars i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); overflow: hidden; position: relative; }
.ad-bars i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #FFC94A;
  transform-origin: left;
  animation: adBar 1.6s linear infinite;
}
.ad-bars i:nth-child(2)::after { animation-delay: .2s; }
.ad-bars i:nth-child(3)::after { animation-delay: .4s; }
.ad-bars i:nth-child(4)::after { animation-delay: .6s; }
@keyframes adBar { 0% { transform: scaleX(0); } 70%, 100% { transform: scaleX(1); } }
.ad-title { margin: 13px 0 4px; color: #FFF6DE; font-size: 15px; font-weight: 900; letter-spacing: .04em; }
.ad-sub { margin: 0; color: rgba(255, 246, 222, .55); font-size: 11.5px; }

/* ---------------- 特效 ---------------- */
.fly-layer { position: fixed; inset: 0; z-index: 300; pointer-events: none; overflow: hidden; }
.fly-toy {
  position: fixed;
  transform-origin: center;
  transition: transform .32s cubic-bezier(.32, .72, .35, 1);
  will-change: transform;
  z-index: 300;
}
.fly-toy img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 9px 6px rgba(40, 60, 15, .3)); }

.fx-layer { position: fixed; inset: 0; z-index: 310; pointer-events: none; overflow: hidden; }
.spark {
  position: fixed;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff, #FFD54A 54%, #FF9A1F 100%);
  animation: sparkFly .66s ease-out forwards;
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.15); }
}
.gain {
  position: fixed;
  z-index: 312;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: .04em;
  text-shadow: 0 2px 0 #E96A1D, 0 0 10px rgba(255, 190, 70, .9);
  pointer-events: none;
  animation: gainUp .8s ease-out forwards;
}
@keyframes gainUp {
  0% { opacity: 0; transform: translate(-50%, 4px) scale(.7); }
  25% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(196px + env(safe-area-inset-bottom, 0px));
  z-index: 320;
  transform: translate(-50%, 14px);
  max-width: 80vw;
  padding: 9px 17px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #FFF6DE;
  background: rgba(54, 36, 16, .92);
  box-shadow: 0 6px 18px rgba(20, 20, 5, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes scoreBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes boardShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px) rotate(-1deg); }
  38% { transform: translateX(6px) rotate(1deg); }
  58% { transform: translateX(-4px); }
  78% { transform: translateX(3px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 360px) {
  #app { padding-left: 0; padding-right: 0; }
  :root { --toy: clamp(50px, 17.2vw, 66px); }
  .level-chip { height: 31px; padding: 0 14px; font-size: 15px; }
  .star-chip { height: 28px; min-width: 68px; font-size: 15px; }
  .pause-btn { width: 40px; height: 40px; }
  .modal h2 { font-size: 21px; }
}

@media (min-height: 900px) {
  :root { --toy: clamp(60px, 18.2vw, 100px); }
}

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