/* ============================================================
   甜心消消乐 · style.css
   视觉系统：圆润 + 高光 + 奶油白轮廓 + 柔和阴影
   主色：草莓粉 #FF6B9A / 浅粉 #FFD6E5 / 奶油白 #FFF9F4
         桃子色 #FFB38A / 柠檬黄 #FFD966 / 薄荷绿 #A8D98B
         葡萄紫 #A889FF / 天空蓝 #7AC8FF
   背景：#FFF8F5 / #FFF4F7（低饱和）
   ============================================================ */

:root {
  --pink: #FF6B9A;
  --pink-deep: #F4508A;
  --pink-soft: #FFD6E5;
  --pink-pale: #FFF0F5;
  --cream: #FFF9F4;
  --peach: #FFB38A;
  --lemon: #FFD966;
  --mint: #A8D98B;
  --mint-deep: #7FBF6B;
  --grape: #A889FF;
  --sky: #7AC8FF;
  --bg: #FFF8F5;
  --ink: #7A5A64;
  --ink-soft: #A98A94;
  --card-shadow: 0 8px 24px rgba(220, 130, 160, 0.14);
  --card-shadow-lg: 0 16px 40px rgba(220, 130, 160, 0.20);
  --radius-card: 24px;
  --radius-pill: 999px;
  --ease-candy: cubic-bezier(0.34, 1.45, 0.64, 1);
  --ease-soft: cubic-bezier(0.22, 0.9, 0.32, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
}

/* ================= 背景：春日糖果花园 ================= */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(1200px 500px at 50% -8%, #FFE9F1 0%, rgba(255, 233, 241, 0) 60%),
    radial-gradient(900px 420px at 8% 12%, #FFF3D6 0%, rgba(255, 243, 214, 0) 55%),
    radial-gradient(900px 420px at 92% 18%, #E3F3FF 0%, rgba(227, 243, 255, 0) 55%),
    linear-gradient(180deg, #FFF4F7 0%, #FFF8F5 55%, #FFF6EE 100%);
}
.bg-hill { position: absolute; bottom: -12%; width: 60vmax; height: 30vmax; border-radius: 50% 50% 0 0; }
.hill-left { left: -18vmax; background: radial-gradient(closest-side, #FDEBF2, #FDEBF2 60%, rgba(253, 235, 242, 0)); opacity: 0.9; }
.hill-right { right: -18vmax; background: radial-gradient(closest-side, #E9F6E2, #E9F6E2 60%, rgba(233, 246, 226, 0)); opacity: 0.9; }

.bg-cloud { position: absolute; width: clamp(90px, 18vw, 170px); filter: drop-shadow(0 6px 12px rgba(255, 182, 205, 0.25)); }
.cloud-1 { top: 6%; left: 4%; animation: drift 26s ease-in-out infinite alternate; }
.cloud-2 { top: 12%; right: 6%; animation: drift 32s ease-in-out infinite alternate-reverse; }
.cloud-3 { top: 30%; left: 12%; width: clamp(60px, 12vw, 110px); animation: drift 38s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(18px); } }

.bg-flower { position: absolute; width: clamp(34px, 8vw, 58px); opacity: 0.55; animation: sway 6s ease-in-out infinite alternate; }
.flower-1 { bottom: 9%; left: 5%; }
.flower-2 { bottom: 16%; right: 6%; animation-delay: -2s; }
.flower-3 { top: 44%; right: 3%; width: clamp(26px, 6vw, 44px); animation-delay: -4s; }
.bg-leaf { position: absolute; width: clamp(26px, 6vw, 42px); opacity: 0.6; }
.leaf-1 { bottom: 6%; right: 12%; transform: rotate(18deg); }
.leaf-2 { top: 52%; left: 4%; transform: rotate(-24deg); width: clamp(20px, 5vw, 34px); }
.bg-spark { position: absolute; width: 22px; animation: twinkle 3.2s ease-in-out infinite; }
.spark-1 { top: 20%; left: 46%; }
.spark-2 { top: 58%; right: 14%; animation-delay: -1.1s; }
.spark-3 { top: 38%; left: 8%; animation-delay: -2.2s; }
@keyframes twinkle { 0%, 100% { transform: scale(0.7) rotate(0deg); opacity: 0.4; } 50% { transform: scale(1.1) rotate(20deg); opacity: 0.8; } }
@keyframes sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.bg-butterfly { position: absolute; top: 24%; right: 16%; width: clamp(30px, 7vw, 46px); opacity: 0.55; animation: flutter 9s ease-in-out infinite; }
@keyframes flutter {
  0%, 100% { transform: translate(0, 0) rotate(-6deg); }
  25% { transform: translate(-18px, -14px) rotate(6deg); }
  50% { transform: translate(-34px, 4px) rotate(-4deg); }
  75% { transform: translate(-12px, 12px) rotate(5deg); }
}

/* ================= 应用容器 ================= */
#app {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 12px 12px calc(16px + var(--safe-bottom));
}

.screen { display: none; flex-direction: column; align-items: stretch; animation: screenIn 0.35s var(--ease-soft); }
.screen.active { display: flex; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ================= 首页 ================= */
#screen-home { align-items: center; justify-content: center; flex: 1; padding: 24px 4px; }
.home-card {
  width: 100%; max-width: 420px;
  background: rgba(255, 249, 244, 0.92);
  border: 3px solid #FFE3EE;
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow-lg);
  padding: 28px 24px 22px;
  text-align: center;
  position: relative; overflow: hidden;
}
.home-card::before {
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 10px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(90deg, var(--pink-soft), #FFE9B8, #D9F0CE, #D3E9FF, var(--pink-soft));
  opacity: 0.9;
}
.home-sprinkles { width: 170px; height: 34px; }
.home-mascots { display: flex; justify-content: center; gap: 2px; margin: 2px 0 0; min-height: 64px; }
.home-mascots svg { width: 62px; height: 62px; filter: drop-shadow(0 4px 8px rgba(220, 130, 160, 0.25)); }
.home-mascots svg:nth-child(1) { animation: bob 2.4s ease-in-out infinite; }
.home-mascots svg:nth-child(2) { animation: bob 2.4s ease-in-out -0.4s infinite; }
.home-mascots svg:nth-child(3) { animation: bob 2.4s ease-in-out -0.8s infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.game-title {
  font-size: clamp(38px, 11vw, 52px); font-weight: 900; letter-spacing: 2px;
  color: var(--pink);
  -webkit-text-stroke: 1.5px #fff;
  paint-order: stroke fill;
  text-shadow:
    0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff,
    2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff,
    0 5px 0 rgba(255, 217, 102, 0.55),
    0 10px 22px rgba(244, 80, 138, 0.28);
  margin: 2px 0 4px;
}
.game-subtitle { color: var(--ink-soft); font-size: 15px; letter-spacing: 3px; margin-bottom: 20px; }

.home-best {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 8px 18px;
  background: #fff; border: 2px solid var(--pink-soft); border-radius: var(--radius-pill);
  font-size: 14px; color: var(--ink-soft);
  box-shadow: 0 4px 12px rgba(220, 130, 160, 0.12);
}
.home-best strong { color: var(--pink-deep); font-size: 17px; }
.home-best-icon svg { width: 22px; height: 22px; display: block; }
.home-row { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.link-btn {
  background: none; border: none; color: var(--ink-soft); font-size: 13px;
  margin-top: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  font-family: inherit;
}
.home-foot { margin-top: 18px; color: #D8A9B8; font-size: 13px; letter-spacing: 2px; }

/* ================= 按钮 ================= */
.btn {
  font-family: inherit; font-weight: 800; letter-spacing: 1px;
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  color: #fff; position: relative;
  transition: transform 0.12s var(--ease-soft), box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 6px 16px rgba(244, 80, 138, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 2px rgba(180, 40, 90, 0.25);
}
.btn::after {
  content: ""; position: absolute; top: 4px; left: 12%; right: 12%; height: 38%;
  border-radius: var(--radius-pill); background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0));
  pointer-events: none;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.btn-primary { background: linear-gradient(180deg, #FF8FB4, var(--pink) 60%, var(--pink-deep)); }
.btn-secondary { background: linear-gradient(180deg, #FFC79B, var(--peach) 60%, #F59A63); box-shadow: 0 6px 16px rgba(245, 154, 99, 0.30), inset 0 2px 0 rgba(255,255,255,0.45); }
.btn-mint { background: linear-gradient(180deg, #BDE6A8, var(--mint) 60%, var(--mint-deep)); box-shadow: 0 6px 16px rgba(127, 191, 107, 0.30), inset 0 2px 0 rgba(255,255,255,0.45); }
.btn-aux { background: linear-gradient(180deg, #BFA9FF, var(--grape) 60%, #8F73F0); box-shadow: 0 6px 16px rgba(143, 115, 240, 0.30), inset 0 2px 0 rgba(255,255,255,0.45); }
.btn-big { font-size: 20px; padding: 14px 58px; }
.btn-block { width: 100%; font-size: 17px; padding: 13px 0; margin-top: 12px; }
.modal-btn-row { display: flex; gap: 10px; margin-top: 10px; }
.modal-btn-row .btn { flex: 1; font-size: 15px; padding: 11px 0; }
.btn-round { width: 100%; font-size: 14px; padding: 11px 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-round svg { width: 20px; height: 20px; }

/* ================= 图标按钮 ================= */
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--pink-soft);
  box-shadow: 0 4px 12px rgba(220, 130, 160, 0.16), inset 0 2px 0 rgba(255,255,255,0.9);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform 0.12s var(--ease-soft), filter 0.2s;
  font-family: inherit;
}
.icon-btn svg { width: 26px; height: 26px; display: block; }
.icon-btn:active { transform: scale(0.9); }
.icon-btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.icon-btn.small { width: 40px; height: 40px; }
.icon-btn.small svg { width: 22px; height: 22px; }
.icon-btn.off { filter: grayscale(0.9); opacity: 0.55; }

/* ================= 游戏页 / HUD ================= */
#screen-game { gap: 10px; }
.hud {
  background: rgba(255, 249, 244, 0.94);
  border: 3px solid #FFE3EE; border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 10px 14px 12px;
}
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-score { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-icon svg { width: 26px; height: 26px; display: block; }
.hud-score-num {
  font-size: 24px; font-weight: 900; color: var(--pink-deep);
  font-variant-numeric: tabular-nums; line-height: 1;
  transition: transform 0.15s;
}
.hud-score-num.bump { animation: scoreBump 0.3s var(--ease-candy); }
@keyframes scoreBump { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.hud-actions { display: flex; gap: 8px; }
.hud-goal { margin-top: 8px; }
.hud-goal-row { display: flex; gap: 8px; margin-bottom: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 2px solid var(--pink-soft); border-radius: var(--radius-pill);
  padding: 4px 14px; font-size: 13px; color: var(--ink-soft); white-space: nowrap;
}
.pill strong { color: var(--pink-deep); font-size: 16px; font-variant-numeric: tabular-nums; }
.pill svg { width: 16px; height: 16px; }
.pill-moves.low strong { color: #E14D6B; animation: pulseLow 1s ease-in-out infinite; }
@keyframes pulseLow { 50% { opacity: 0.55; } }
.progress {
  position: relative; height: 16px; border-radius: var(--radius-pill);
  background: #FDEBF2; border: 2px solid #fff;
  box-shadow: inset 0 2px 5px rgba(220, 130, 160, 0.18);
  overflow: visible;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #FFB3CD, var(--pink), var(--peach));
  transition: width 0.5s var(--ease-soft);
  box-shadow: 0 0 10px rgba(255, 107, 154, 0.5);
}
.progress-star svg { position: absolute; right: -6px; top: 50%; transform: translateY(-58%); width: 26px; height: 26px; filter: drop-shadow(0 2px 4px rgba(255, 180, 60, 0.5)); }
.progress.done .progress-fill { background: linear-gradient(90deg, #FFD966, #FFB38A, var(--pink)); }
.progress.done .progress-star svg { animation: starSpin 1.2s ease-in-out infinite; }
@keyframes starSpin { 0%, 100% { transform: translateY(-58%) rotate(-12deg) scale(1); } 50% { transform: translateY(-58%) rotate(12deg) scale(1.2); } }

/* ================= 棋盘 ================= */
.board-wrap { position: relative; width: 100%; }
.board-frame .frame-flower { position: absolute; width: 34px; z-index: 3; filter: drop-shadow(0 3px 5px rgba(220,130,160,0.3)); }
.ff-1 { top: -14px; left: -8px; transform: rotate(-12deg); }
.ff-2 { bottom: -12px; right: -6px; transform: rotate(14deg); }
.board-frame .frame-leaf { position: absolute; width: 30px; z-index: 3; opacity: 0.95; }
.fl-1 { top: -10px; right: 8%; transform: rotate(30deg); }
.fl-2 { bottom: -8px; left: 10%; transform: rotate(-140deg); }

.board {
  position: relative; width: 100%; max-width: 520px; margin: 0 auto;
  aspect-ratio: 1 / 1;
  background: var(--cream);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(255, 214, 229, 0.35), rgba(255, 214, 229, 0) 70%);
  border: 4px solid #FFD9E6; border-radius: var(--radius-card);
  box-shadow: var(--card-shadow-lg), inset 0 3px 10px rgba(220, 130, 160, 0.10);
  overflow: hidden;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.board.shuffling .tile { animation: shuffleWobble 0.55s var(--ease-candy); }
/* 特殊消除时的短促震动：幅度小、时间短，移动端安全 */
.board.shake { animation: boardShake 0.16s ease-out; }
@keyframes boardShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 2px); }
  50% { transform: translate(4px, -2px); }
  75% { transform: translate(-2px, -2px); }
}
@keyframes shuffleWobble {
  0% { transform-origin: center; }
  25% { rotate: -10deg; scale: 0.9; }
  50% { rotate: 8deg; scale: 1.05; }
  75% { rotate: -5deg; scale: 0.96; }
  100% { rotate: 0deg; scale: 1; }
}

/* 格子底纹 */
.cell-bg {
  position: absolute; border-radius: 10px;
  background: #FDF1EA;
  box-shadow: inset 0 2px 4px rgba(220, 150, 170, 0.10);
  pointer-events: none;
}

/* 棋子：绝对定位，用 transform 做位移动画 */
.tile {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.28s var(--ease-soft);
  /* 注意：不要加 will-change（64 常驻合成层会卡死 iOS 合成器）；transform 过渡不需要它 */
  outline: none;
  z-index: 2;
}
.tile:focus-visible { filter: drop-shadow(0 0 6px var(--sky)); }
.tile-inner {
  width: 92%; height: 92%;
  transition: transform 0.16s var(--ease-soft);
  /* 注意：不要常驻 drop-shadow（iOS 走 CPU，64 个同屏会冻结首屏绘制）；
     立体感由每颗棋子 SVG 自带的柔和阴影椭圆承担 */
  pointer-events: none;
}
.tile-inner svg { width: 100%; height: 100%; display: block; overflow: visible; }
/* 条纹棋子为双层叠加结构，保证内外层都撑满 */
.tile-inner > div { width: 100%; height: 100%; }
.tile-inner > div svg { width: 100%; height: 100%; display: block; overflow: visible; }
.board:not(.locked) .tile:hover .tile-inner { transform: scale(1.07); }
.tile.selected .tile-inner { transform: scale(1.12); animation: selectedBob 0.7s ease-in-out infinite alternate; }
.tile.selected::after {
  content: ""; position: absolute; inset: 1%;
  border-radius: 38%; border: 3px solid var(--pink);
  box-shadow: 0 0 12px rgba(255, 107, 154, 0.65), inset 0 0 8px rgba(255, 107, 154, 0.3);
  animation: ringPulse 0.7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes ringPulse { from { opacity: 0.65; transform: scale(0.96); } to { opacity: 1; transform: scale(1.03); } }
@keyframes selectedBob { from { transform: scale(1.1) translateY(0); } to { transform: scale(1.14) translateY(-2px); } }
.tile.hint-glow .tile-inner { animation: hintGlow 0.9s ease-in-out 2; }
@keyframes hintGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.14); opacity: 0.85; }
}

/* 消除动画：快、脆、爽 */
.tile.popping { z-index: 5; pointer-events: none; }
.tile.popping .tile-inner { animation: popOut 0.3s var(--ease-soft) forwards; }
@keyframes popOut {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.1); opacity: 0; }
}
/* 新棋子掉落出现 */
.tile.spawn .tile-inner { animation: spawnIn 0.3s var(--ease-candy); }
@keyframes spawnIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* 特殊棋子诞生 */
.tile.born .tile-inner { animation: bornStar 0.5s var(--ease-candy); }
@keyframes bornStar {
  0% { transform: scale(0.2) rotate(-40deg); opacity: 0.4; }
  60% { transform: scale(1.25) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
.tile .rainbow-spin { animation: rainbowSpin 5s linear infinite; transform-origin: center; transform-box: fill-box; }
@keyframes rainbowSpin { to { transform: rotate(360deg); } }

/* COMBO 弹字 */
.combo-layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 20; }
.combo-text {
  font-size: clamp(30px, 9vw, 44px); font-weight: 900; letter-spacing: 1px; color: var(--pink);
  -webkit-text-stroke: 1px #fff;
  text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff,
    0 4px 0 rgba(255, 217, 102, 0.6), 0 8px 20px rgba(244, 80, 138, 0.4);
  animation: comboPop 1s var(--ease-candy) forwards;
  white-space: nowrap;
}
@keyframes comboPop {
  0% { transform: scale(0.5); opacity: 0; }
  25% { transform: scale(1.15); opacity: 1; }
  45% { transform: scale(1); }
  75% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* 分数飘字 */
.float-layer { position: absolute; inset: 0; pointer-events: none; z-index: 15; overflow: visible; }
.float-score {
  position: absolute; transform: translate(-50%, -50%);
  font-weight: 900; font-size: 20px; color: #fff;
  text-shadow: 0 2px 0 var(--pink-deep), 0 -1px 0 var(--pink-deep), 1px 0 0 var(--pink-deep), -1px 0 0 var(--pink-deep), 0 4px 10px rgba(244,80,138,0.5);
  animation: floatUp 0.85s var(--ease-soft) forwards;
  white-space: nowrap;
}
.float-score.combo-2 { color: #FFE9F1; font-size: 22px; }
.float-score.combo-3 { color: var(--lemon); font-size: 24px; }
.float-score.combo-4 { font-size: 26px; background: linear-gradient(90deg, #FF6B9A, #FFB38A, #FFD966, #A8D98B, #7AC8FF, #A889FF); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: none; filter: drop-shadow(0 2px 3px rgba(244,80,138,0.45)); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -220%) scale(1); }
}

/* 提示 toast */
.toast {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%) translateY(-8px);
  background: rgba(255, 249, 244, 0.96); border: 2px solid var(--pink-soft); border-radius: var(--radius-pill);
  padding: 6px 18px; font-size: 14px; font-weight: 700; color: var(--pink-deep);
  box-shadow: var(--card-shadow); opacity: 0; pointer-events: none; z-index: 30;
  transition: opacity 0.3s, transform 0.3s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 底部工具栏 */
.toolbar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ================= 弹窗 ================= */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(255, 228, 238, 0.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: modalIn 0.3s var(--ease-soft);
}
.modal[hidden] { display: none; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 380px; max-height: calc(100vh - 60px); max-height: calc(100dvh - 60px); overflow-y: auto;
  background: var(--cream); border: 3px solid #FFE3EE; border-radius: var(--radius-card);
  box-shadow: var(--card-shadow-lg);
  padding: 26px 22px 20px; text-align: center; position: relative; overflow: hidden;
  animation: cardPop 0.38s var(--ease-candy);
}
@keyframes cardPop { from { transform: scale(0.85) translateY(16px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-card::before {
  content: ""; position: absolute; top: 0; left: 10%; right: 10%; height: 8px;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(90deg, var(--pink-soft), #FFE9B8, #D9F0CE, #D3E9FF, var(--pink-soft));
}
.modal-title {
  font-size: 28px; font-weight: 900; color: var(--pink); letter-spacing: 1px;
  text-shadow: 0 2px 0 #fff, 0 5px 14px rgba(244, 80, 138, 0.25);
}
.modal-sub { color: var(--ink-soft); font-size: 14px; margin: 4px 0 12px; }
.modal-score-row { display: flex; gap: 8px; justify-content: center; margin: 10px 0 2px; flex-wrap: wrap; }
.result-score-label { color: var(--ink-soft); font-size: 13px; letter-spacing: 2px; margin-top: 6px; }
.result-score { font-size: 52px; font-weight: 900; color: var(--pink-deep); font-variant-numeric: tabular-nums; line-height: 1.15; }
.result-target-pill {
  display: inline-block; margin: 4px 0 2px; padding: 5px 20px;
  border-radius: var(--radius-pill); font-size: 14px; font-weight: 800;
  background: #FFF3D6; border: 2px solid var(--lemon); color: #B07E1F;
}
.result-target-pill.win { background: #E4F5D9; border-color: var(--mint); color: #4E8A3E; animation: winGlow 1.4s ease-in-out infinite alternate; }
@keyframes winGlow { from { box-shadow: 0 0 4px rgba(168,217,139,0.4); } to { box-shadow: 0 0 16px rgba(168,217,139,0.9); } }
.result-stars { display: flex; justify-content: center; gap: 6px; min-height: 44px; margin-bottom: 2px; }
.result-stars svg { width: 44px; height: 44px; }
.result-stars svg:nth-child(2) { width: 56px; height: 56px; margin-top: -8px; }
.result-stars .star-earn { animation: starEarn 0.5s var(--ease-candy) backwards; }
.result-stars .star-earn:nth-child(2) { animation-delay: 0.18s; }
.result-stars .star-earn:nth-child(3) { animation-delay: 0.36s; }
@keyframes starEarn { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1) rotate(0); } }
#result-new-best {
  background: linear-gradient(90deg, #FF8FB4, #FFB38A); color: #fff; border-color: transparent;
  animation: bestShine 1.2s ease-in-out infinite alternate;
}
@keyframes bestShine { to { box-shadow: 0 0 14px rgba(255, 107, 154, 0.7); } }

.help-list { text-align: left; font-size: 14px; line-height: 1.75; color: var(--ink); padding-left: 20px; margin: 6px 0 4px; }
.help-list strong { color: var(--pink-deep); }

/* 粒子画布 */
/* 粒子画布：平时隐藏（少一个全屏合成层），有粒子时由 JS 显示 */
#fx-canvas { position: fixed; inset: 0; z-index: 40; pointer-events: none; display: none; }

/* ================= 响应式 ================= */
@media (min-width: 600px) {
  #app { padding-top: 20px; }
  .bg-flower, .bg-leaf, .bg-butterfly { opacity: 0.8; }
}
@media (max-width: 380px) {
  #app { padding: 8px 8px calc(12px + var(--safe-bottom)); }
  .hud { padding: 8px 10px 10px; }
  .hud-score-num { font-size: 20px; }
  .icon-btn.small { width: 36px; height: 36px; }
  .pill { padding: 3px 10px; font-size: 12px; }
  .pill strong { font-size: 14px; }
  .btn-big { padding: 13px 44px; font-size: 18px; }
  .home-mascots svg { width: 52px; height: 52px; }
}
@media (max-height: 640px) {
  .game-title { font-size: clamp(32px, 9vw, 44px); }
  .home-card { padding: 20px 18px 16px; }
  .home-mascots { min-height: 52px; }
  .home-mascots svg { width: 48px; height: 48px; }
}
/* 横屏：收紧纵向间距 */
@media (orientation: landscape) and (max-height: 500px) {
  #app { max-width: 480px; }
  .hud-goal-row { margin-bottom: 6px; }
  .toolbar { grid-template-columns: 1fr 1fr 1fr; }
}

/* 减少动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
