/* 果冻跳格 · Thạch Nhảy Ô — 界面样式（竖屏优先，电脑上居中显示）
 * 画风：明亮的天空蓝 + 云朵白 + 紫色按钮边 + 金黄主按钮 + 草莓粉果冻（参照 Logo 与宣传图） */
:root {
  --sky-1: #5bb8ff;
  --sky-2: #9fd8ff;
  --sky-3: #ffe0f4;
  --ink: #3a2172;
  --ink-2: #5d4596;
  --muted: #8b7cb8;
  --purple: #7a4cf0;
  --purple-2: #5a2fd0;
  --purple-3: #3f1fa0;
  --gold: #ffd43b;
  --gold-2: #ffab19;
  --pink: #ff6fb2;
  --cyan: #38d6ff;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-2: rgba(255, 255, 255, 0.94);
  --line: rgba(122, 76, 240, 0.22);
  --shadow: 0 14px 36px rgba(40, 30, 120, 0.22);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --round: 'Baloo 2', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--ink);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background:
    radial-gradient(ellipse at 15% 8%, rgba(255, 255, 255, 0.75), transparent 45%),
    radial-gradient(ellipse at 90% 85%, rgba(255, 190, 230, 0.55), transparent 50%),
    linear-gradient(180deg, var(--sky-1), var(--sky-2) 55%, var(--sky-3));
  background-attachment: fixed;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: 0.42; cursor: default; }
[hidden] { display: none !important; }
svg.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* GPT 背景图（竖屏 / 横屏各一张），上面再压一层很淡的白，让棋盘和文字更清楚；没有图时只显示渐变天空 */
.bgArt {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.18)), url(../assets/art/bg-portrait.jpg) center / cover no-repeat;
}
@media (orientation: landscape) {
  .bgArt { background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.18)), url(../assets/art/bg-landscape.jpg); }
}
#fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#app { position: fixed; inset: 0; max-width: 640px; margin: 0 auto; z-index: 2; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(10px + var(--safe-t)) 12px calc(10px + var(--safe-b)); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.9); background: var(--panel-2); color: var(--purple-2);
  font-family: var(--round); font-weight: 800; font-size: 17px; letter-spacing: 0.2px; line-height: 1.1;
  box-shadow: 0 5px 0 rgba(90, 47, 208, 0.25), 0 10px 22px rgba(40, 30, 120, 0.18);
}
.btn.primary {
  color: #4a1f8a; border-color: #fff3b0;
  background: linear-gradient(180deg, #fff2a0, var(--gold) 45%, var(--gold-2));
  box-shadow: 0 5px 0 #d97a00, 0 12px 26px rgba(255, 150, 20, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.7);
}
.btn.ghost { background: rgba(255, 255, 255, 0.35); box-shadow: none; color: var(--ink); }
a.btn { text-decoration: none; }
.btn.lg { min-height: 56px; font-size: 20px; border-radius: 20px; }
.btn:focus-visible, .iconBtn:focus-visible, .tool:focus-visible, .lvCard:focus-visible, .langSwitch button:focus-visible, .padBtn:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.iconBtn {
  width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9); background: var(--panel); color: var(--purple-2);
  box-shadow: 0 4px 0 rgba(90, 47, 208, 0.2), 0 8px 16px rgba(40, 30, 120, 0.15);
}
.iconSpacer { width: 46px; flex: none; }
[data-act="sound"] .ico.off, [data-act="sound"].off .ico.on, [data-act="music"] .ico.off, [data-act="music"].off .ico.on { display: none; }
[data-act="sound"].off .ico.off, [data-act="music"].off .ico.off { display: block; }
.topBtns { display: flex; gap: 8px; }

/* ---------- 首页 ---------- */
.homeScreen { align-items: center; justify-content: space-between; text-align: center; }
.homeTop { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.homeTop .topBtns { margin-left: auto; }
.langSwitch { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 6px 14px rgba(40, 30, 120, 0.14); }
.langSwitch button { border: 0; background: transparent; padding: 8px 14px; min-height: 44px; border-radius: 999px; font-weight: 800; font-size: 13px; color: var(--ink-2); }
.langSwitch button[aria-pressed="true"] { background: linear-gradient(180deg, #9a72ff, var(--purple-2)); color: #fff; }
.homeHero { display: flex; flex-direction: column; align-items: center; }
.logoWrap {
  width: min(48vw, 200px); aspect-ratio: 1; border-radius: 26%; overflow: hidden;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(122, 76, 240, 0.55), 0 18px 40px rgba(60, 30, 140, 0.35);
  animation: float 4.5s ease-in-out infinite;
}
.logoWrap img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.015); }
@keyframes float { 50% { transform: translateY(-8px); } }
.homeHero h1 {
  margin: 22px 0 0; font-family: var(--round); font-size: clamp(38px, 11vw, 56px); font-weight: 800; letter-spacing: 0; line-height: 1.05;
  color: #fff; -webkit-text-stroke: 2px var(--purple-2); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--purple-3), 0 8px 18px rgba(60, 30, 140, 0.45);
}
.homeHero h1 { background: none; }
.subtitle {
  margin: 12px 0 0; padding: 6px 16px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 14px;
  background: linear-gradient(180deg, #8f63ff, var(--purple-2)); box-shadow: 0 4px 0 var(--purple-3), 0 8px 18px rgba(60, 30, 140, 0.3);
}
.homeJelly { width: 300px; height: 120px; max-width: 80vw; margin-top: 4px; }
.homeActions { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px; }
.homeProgress { margin: 2px 0 0; color: #fff; font-weight: 800; font-size: 15px; min-height: 22px; text-shadow: 0 2px 6px rgba(60, 30, 140, 0.55); }

/* ---------- 顶栏 ---------- */
.hud { display: flex; align-items: center; gap: 10px; }
.hudTitle {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 4px 12px; border-radius: 18px; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.9); box-shadow: 0 6px 14px rgba(40, 30, 120, 0.14);
}
.hudTitle small { color: var(--purple); font-weight: 800; font-size: 12px; letter-spacing: 0.8px; text-transform: uppercase; }
.hudTitle strong { font-family: var(--round); font-size: 19px; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--ink); }
.levelsScreen .hudTitle small { text-transform: none; letter-spacing: 0; }

/* ---------- 选关 ---------- */
.levelGrid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 2px 8px; align-content: start; }
.lvCard {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  min-height: 112px; padding: 12px 14px; border-radius: 22px; border: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(236, 228, 255, 0.92)); box-shadow: 0 5px 0 rgba(90, 47, 208, 0.2), var(--shadow);
  overflow: hidden;
}
.lvCard.done { background: linear-gradient(165deg, #fffbe6, #ffeec2); border-color: #fff6cf; }
.lvNum { font-family: var(--round); font-size: 30px; font-weight: 800; color: var(--purple); line-height: 1; }
.lvCard.done .lvNum { color: #e08600; }
.lvName { font-weight: 800; font-size: 14px; line-height: 1.3; color: var(--ink); padding-right: 46px; }
.lvStars { display: flex; gap: 2px; margin-top: auto; }
.lvCard.locked { opacity: 0.62; background: rgba(230, 226, 245, 0.85); }
.lvCard.locked .lvNum { color: var(--muted); }
.lvCard .lvJelly { position: absolute; right: 8px; bottom: 8px; width: 54px; height: 54px; pointer-events: none; animation: jellyBob 2.4s ease-in-out infinite; }
.lvCard .lvJelly.ghost { opacity: 0.28; filter: grayscale(1); animation: none; }
@keyframes jellyBob { 0%, 100% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-4px) scale(0.96, 1.05); } 55% { transform: translateY(-4px) scale(0.96, 1.05); } 90% { transform: translateY(0) scale(1.08, 0.92); } }
svg.lock { position: absolute; right: 14px; top: 14px; width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg.star { width: 19px; height: 19px; fill: rgba(122, 76, 240, 0.14); stroke: rgba(122, 76, 240, 0.3); stroke-width: 1.2; stroke-linejoin: round; }
svg.star.on { fill: var(--gold); stroke: #e08600; filter: drop-shadow(0 1px 2px rgba(224, 134, 0, 0.5)); }

/* ---------- 游戏 ---------- */
.gameScreen { padding-bottom: calc(8px + var(--safe-b)); }
.hudStats { display: flex; justify-content: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.9); font-size: 13px; color: var(--ink-2); font-weight: 800; box-shadow: 0 4px 10px rgba(40, 30, 120, 0.12); }
.pill b { color: var(--ink); font-size: 16px; font-family: var(--round); }
.pill.star svg { width: 17px; height: 17px; fill: var(--gold); stroke: #e08600; stroke-width: 1.4; }
.pill.gold { color: #8a4b00; background: linear-gradient(180deg, #fff6c6, #ffe07a); border-color: #fff6cf; }
.pill.gold.lost { color: var(--muted); background: rgba(255, 255, 255, 0.6); }
.boardWrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 4px 0; touch-action: none; }
#board { display: block; touch-action: none; cursor: grab; }
.pad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 2px 0 8px; }
.padBtn {
  min-height: 50px; border-radius: 16px; display: grid; place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.95); color: #fff;
  background: linear-gradient(180deg, #a07bff, var(--purple) 55%, var(--purple-2));
  box-shadow: 0 4px 0 var(--purple-3), 0 8px 16px rgba(60, 30, 140, 0.25);
}
.padBtn .ico { width: 26px; height: 26px; stroke-width: 3; }
.padBtn.hint { animation: padHint 0.8s ease-in-out infinite; }
@keyframes padHint { 50% { background: linear-gradient(180deg, #fff2a0, var(--gold) 50%, var(--gold-2)); color: #4a1f8a; transform: scale(1.08); } }
.tools { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 58px; padding: 4px 2px; border-radius: 18px; border: 2px solid rgba(255, 255, 255, 0.9); background: var(--panel);
  font-size: 11.5px; font-weight: 700; letter-spacing: -0.1px; color: var(--ink-2); box-shadow: 0 4px 0 rgba(90, 47, 208, 0.16);
}
.tool .ico { width: 22px; height: 22px; color: var(--purple-2); }
.tool[data-act="hint"] .ico { color: #e08600; }
.tool.off .ico { color: var(--muted); }
.tool span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 弹层 ---------- */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 20px; overflow-y: auto; overscroll-behavior: contain; background: rgba(40, 24, 110, 0.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.tipCard, .winCard, .finaleCard {
  width: min(420px, 100%); border-radius: 28px; padding: 20px 22px 22px; text-align: center; margin: auto; position: relative; top: 22px;
  background: linear-gradient(175deg, #ffffff, #f3edff 60%, #ffeefa);
  border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(122, 76, 240, 0.45), 0 22px 50px rgba(40, 20, 120, 0.4);
  animation: pop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}
@keyframes pop { from { transform: scale(0.7); opacity: 0; } 60% { transform: scale(1.04); } }
.robot { width: 110px; height: 110px; margin: -76px auto 0; display: block; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(60, 30, 140, 0.35)); animation: robotBounce 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes robotBounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-10px) scale(0.95, 1.06); } 60% { transform: translateY(0) scale(1.06, 0.94); } 75% { transform: translateY(0) scale(0.98, 1.02); } }
.tipBody small, .winCard small { color: var(--purple); font-weight: 800; font-size: 12.5px; letter-spacing: 0.6px; }
.tipBody h2, .winCard h2, .finaleCard h2 { margin: 2px 0 6px; font-family: var(--round); font-size: 25px; font-weight: 800; color: var(--purple-2); line-height: 1.15; }
.tipBody p, .winCard p, .finaleCard p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.6; font-size: 15px; }
.tipDemo { display: block; width: 240px; height: 96px; max-width: 100%; margin: 2px auto 8px; border-radius: 16px; background: linear-gradient(180deg, #bfe6ff, #e8f6ff); box-shadow: inset 0 0 0 2px rgba(122, 76, 240, 0.15); }
.tipRules { font-size: 12.5px !important; color: var(--muted) !important; line-height: 1.5 !important; margin-bottom: 14px !important; }
.tipCard .btn { min-width: 170px; }
/* V004：“说明”里的机关图例（到本关为止出现过的机关：小图 + 一句话） */
.legend { text-align: left; margin: -4px 0 14px; padding: 10px 10px 4px; border-radius: 16px; background: rgba(122, 76, 240, 0.06); box-shadow: inset 0 0 0 2px rgba(122, 76, 240, 0.1); }
.legTitle { font-weight: 800; font-size: 12.5px; color: var(--purple); letter-spacing: 0.3px; margin: 0 0 6px 2px; }
.legRow { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.legIcon { flex: none; display: block; border-radius: 10px; background: linear-gradient(180deg, #bfe6ff, #e8f6ff); }
.winOverlay, .finaleOverlay { position: fixed; }
.winStars { display: flex; justify-content: center; gap: 10px; margin: 8px 0 2px; }
.winStars svg.star { width: 54px; height: 54px; }
.winStars svg.star:nth-child(2) { transform: translateY(-12px); }
.winStars svg.star.pop { animation: starPop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.6); }
.winStars svg.star:nth-child(2).pop { animation-name: starPop2; }
@keyframes starPop { from { transform: scale(0.2) rotate(-50deg); } }
@keyframes starPop2 { from { transform: translateY(-12px) scale(0.2) rotate(-50deg); } }
.winCard p { white-space: pre-line; }
.winReward { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -2px auto 14px; padding: 6px 16px 6px 8px; width: max-content; max-width: 100%;
  border-radius: 999px; background: linear-gradient(180deg, #fff8d6, #ffe9a6); color: #8a4b00; font-weight: 800; font-size: 14px; box-shadow: inset 0 0 0 2px #fff; }
.winReward canvas { width: 48px; height: 48px; animation: jellyBob 1.6s ease-in-out infinite; }
.winBtns { display: flex; flex-direction: column; gap: 10px; }
.finaleCard { padding-top: 26px; }
.finaleRobot { width: 150px; height: 150px; margin-top: -100px; }
/* V005：欢呼动图第 10–20 帧右边缘混进了别的物体碎片（x ≥ 163/180；果冻和星光都在 x ≤ 158 以内）→ 只显示左边 89% */
img.robot[src$="guide-cheer.webp"] { clip-path: inset(0 11% 0 0); }
.finaleCrown { width: 64px; height: 40px; margin: -10px auto 0; background: linear-gradient(180deg, #fff2a0, var(--gold) 50%, var(--gold-2));
  clip-path: polygon(0 100%, 0 25%, 25% 60%, 50% 0, 75% 60%, 100% 25%, 100% 100%); filter: drop-shadow(0 3px 0 #d97a00); order: -1; display: none; }
.finaleJellies { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0 auto 8px; max-width: 300px; }
.finaleJellies canvas { width: 100%; height: auto; animation: jellyBob 1.8s ease-in-out infinite; }
.finaleStars { font-family: var(--round); font-weight: 800; font-size: 20px !important; color: #e08600 !important; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); z-index: 40; transform: translate(-50%, 20px);
  width: max-content; max-width: min(92vw, 460px); padding: 11px 18px; border-radius: 16px;
  background: rgba(58, 33, 114, 0.94); border: 2px solid rgba(255, 255, 255, 0.85); color: #fff; font-weight: 700;
  font-size: 14.5px; line-height: 1.5; text-align: center; white-space: pre-line;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* V005：提示条会挡住果冻 / 它所说的那一格时，改放到棋盘上方（位置由 main.js 写入 --toast-top） */
.toast.top { top: var(--toast-top, 120px); bottom: auto; transform: translate(-50%, -20px); }
.toast.top.show { transform: translate(-50%, 0); }

/* ---------- 尺寸适配 ---------- */
@media (min-width: 560px) {
  .levelGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-height: 700px) {
  .homeHero h1 { margin-top: 12px; }
  .logoWrap { width: min(36vw, 140px); }
  .homeJelly { height: 90px; width: 225px; }
  .tool { min-height: 50px; }
  .padBtn { min-height: 44px; }
  .hudStats { margin-top: 6px; }
}
@media (max-height: 600px) {
  .homeJelly { display: none; }
  .tool span { display: none; }
  .tool { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 走不通时提醒点「撤销」 ---------- */
.tool.pulse { animation: toolPulse 0.9s ease 3; }
@keyframes toolPulse { 50% { background: #ffe58a; border-color: var(--gold); transform: scale(1.07); } }

/* ---------- 动效：按钮悬停与点击 / 画面切换 ---------- */
.btn, .iconBtn, .tool, .lvCard, .langSwitch button, .padBtn { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s, background-color 0.2s, border-color 0.2s, filter 0.2s; }
@media (hover: hover) {
  .btn:hover:not(:disabled), .iconBtn:hover, .tool:hover:not(:disabled), .lvCard:hover:not(.locked), .padBtn:hover, .langSwitch button:hover {
    transform: translateY(-3px);
    filter: brightness(1.04);
  }
  .btn:hover:not(:disabled) { box-shadow: 0 8px 0 rgba(90, 47, 208, 0.22), 0 14px 28px rgba(40, 30, 120, 0.25), 0 0 22px rgba(255, 255, 255, 0.7); }
  .btn.primary:hover:not(:disabled) { box-shadow: 0 8px 0 #d97a00, 0 16px 30px rgba(255, 150, 20, 0.45), 0 0 26px rgba(255, 230, 120, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.7); }
  .iconBtn:hover, .tool:hover:not(:disabled), .lvCard:hover:not(.locked) { box-shadow: 0 7px 0 rgba(90, 47, 208, 0.2), 0 12px 24px rgba(40, 30, 120, 0.22), 0 0 18px rgba(255, 255, 255, 0.8); }
  .padBtn:hover { box-shadow: 0 7px 0 var(--purple-3), 0 12px 22px rgba(60, 30, 140, 0.32), 0 0 18px rgba(170, 140, 255, 0.7); }
  .btn::after, .iconBtn::after, .tool::after, .lvCard::after, .padBtn::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, 0.55) 50%, transparent 68%);
    transform: translateX(-130%);
  }
  .btn:hover:not(:disabled)::after, .iconBtn:hover::after, .tool:hover:not(:disabled)::after, .lvCard:hover:not(.locked)::after, .padBtn:hover::after { animation: sheen 0.75s ease; }
  .tool:hover:not(:disabled) .ico, .padBtn:hover .ico { animation: icoBounce 0.5s ease; }
}
@keyframes sheen { to { transform: translateX(130%); } }
@keyframes icoBounce { 40% { transform: translateY(-3px) scale(1.15, 0.9); } 70% { transform: translateY(0) scale(0.95, 1.08); } }
.btn:active:not(:disabled), .iconBtn:active, .tool:active:not(:disabled), .lvCard:active:not(.locked), .langSwitch button:active, .padBtn:active, .padBtn.press {
  transform: translateY(2px) scale(0.93, 0.9); transition-duration: 0.08s;
}
/* 点击水波纹（果冻粉 + 白） */
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); z-index: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.85), rgba(255, 150, 210, 0.35) 45%, rgba(255, 150, 210, 0) 70%); animation: ripple 0.6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.screen:not([hidden]) { animation: screenIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.lvCard { animation: cardIn 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.35) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(22px) scale(0.85, 0.75); } 60% { transform: translateY(-3px) scale(1.04, 0.97); } }
.pill b.bump { display: inline-block; animation: bump 0.4s ease; }
@keyframes bump { 35% { transform: scale(1.5, 1.3); color: #e08600; } 65% { transform: scale(0.9, 1.1); } }
.logoWrap { animation: float 4.5s ease-in-out infinite, logoGlow 3.2s ease-in-out infinite; }
@keyframes logoGlow { 50% { box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(255, 111, 178, 0.7), 0 0 44px rgba(255, 255, 255, 0.9), 0 18px 40px rgba(60, 30, 140, 0.35); } }
.homeActions .btn.primary { animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.03, 0.97); } }
.homeActions .btn.primary:hover { animation: none; }

/* ===================== 加载页：果冻在漂浮地块上弹跳前进 ===================== */
body.booting #app { display: none; }
body.booting #fx, body.booting .bgArt { visibility: hidden; }
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px 20px calc(24px + var(--safe-b)); overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.7), transparent 55%),
    radial-gradient(ellipse at 85% 95%, rgba(255, 180, 225, 0.7), transparent 55%),
    linear-gradient(180deg, #58b4ff, #a6dcff 60%, #ffe3f5);
  transition: opacity 0.6s ease, transform 0.6s ease; }
.boot.leave { opacity: 0; transform: scale(1.05); pointer-events: none; }
.bootClouds i { position: absolute; width: 180px; height: 56px; border-radius: 40px; background: rgba(255, 255, 255, 0.85); filter: blur(1px);
  box-shadow: 40px -22px 0 6px rgba(255, 255, 255, 0.85), 92px -6px 0 0 rgba(255, 255, 255, 0.85); animation: cloudDrift 26s linear infinite; }
.bootClouds i:nth-child(1) { top: 9%; left: -30%; animation-duration: 30s; }
.bootClouds i:nth-child(2) { top: 24%; left: 60%; transform: scale(0.7); animation-duration: 38s; animation-delay: -12s; opacity: 0.8; }
.bootClouds i:nth-child(3) { top: 78%; left: 10%; transform: scale(1.2); animation-duration: 34s; animation-delay: -20s; }
.bootClouds i:nth-child(4) { top: 64%; left: 80%; transform: scale(0.6); animation-duration: 44s; animation-delay: -6s; opacity: 0.7; }
@keyframes cloudDrift { from { translate: -40vw 0; } to { translate: 140vw 0; } }
.bootInner { position: relative; width: min(380px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; }
.bootTitle { font-family: var(--round); font-size: clamp(38px, 11vw, 52px); font-weight: 800; line-height: 1.1; margin-bottom: 26px;
  color: #fff; -webkit-text-stroke: 2px var(--purple-2); paint-order: stroke fill; text-shadow: 0 4px 0 var(--purple-3), 0 10px 20px rgba(60, 30, 140, 0.4);
  animation: titleWobble 2.4s ease-in-out infinite; }
@keyframes titleWobble { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 0.97) translateY(2px); } }
/* 舞台：6 块漂浮地块，5 颗星星，终点旗；果冻按 --p 前进 */
.bootStage { position: relative; width: 100%; height: 150px; }
.bootTiles { position: absolute; left: 0; right: 0; bottom: 18px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.bootTiles i { height: 38px; border-radius: 9px; position: relative;
  background: linear-gradient(180deg, #8de04a 0 42%, #c39aa8 42% 100%); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.55), inset 0 -4px 0 rgba(120, 70, 100, 0.35), 0 8px 12px rgba(40, 30, 120, 0.2);
  animation: tileFloat 3s ease-in-out infinite; }
.bootTiles i:nth-child(2n) { background: linear-gradient(180deg, #eddcf2 0 42%, #c39aa8 42% 100%); animation-delay: -1.5s; }
.bootTiles i:nth-child(3) { animation-delay: -0.7s; } .bootTiles i:nth-child(5) { animation-delay: -2.2s; }
@keyframes tileFloat { 50% { transform: translateY(-4px); } }
.bootStars b { position: absolute; bottom: 74px; width: 22px; height: 22px; margin-left: -11px; background: linear-gradient(180deg, #fff3a0, var(--gold) 50%, var(--gold-2));
  clip-path: polygon(50% 0, 63% 35%, 100% 38%, 71% 61%, 81% 100%, 50% 78%, 19% 100%, 29% 61%, 0 38%, 37% 35%);
  animation: starBob 1.4s ease-in-out infinite; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.6), opacity 0.35s; }
.bootStars b:nth-child(1) { left: 25.3%; } .bootStars b:nth-child(2) { left: 41.8%; animation-delay: -0.3s; } .bootStars b:nth-child(3) { left: 58.2%; animation-delay: -0.6s; }
.bootStars b:nth-child(4) { left: 74.7%; animation-delay: -0.9s; }
.bootStars b.got { animation: starGot 0.5s ease-out forwards; }
@keyframes starBob { 50% { transform: translateY(-5px) rotate(8deg); } }
@keyframes starGot { 40% { transform: translateY(-26px) scale(1.6); opacity: 1; } 100% { transform: translateY(-44px) scale(0.4); opacity: 0; } }
.bootFlag { position: absolute; left: calc(91.2% - 2px); bottom: 52px; width: 4px; height: 52px; background: #f6f0ff; border-radius: 2px; box-shadow: 0 0 0 1px rgba(90, 47, 208, 0.3); }
.bootFlag::after { content: ""; position: absolute; left: 4px; top: 2px; width: 26px; height: 18px; background: #ff4d7a; clip-path: polygon(0 0, 100% 20%, 78% 50%, 100% 80%, 0 100%);
  transform-origin: 0 50%; animation: flagWave 0.9s ease-in-out infinite; }
.bootFlag.got::after { background: #ffd43b; }
@keyframes flagWave { 50% { transform: scaleX(0.82) skewY(6deg); } }
/* 果冻：按进度移动；每次进度跨过一格时 .hop 触发一次弹跳 */
.bootRunner { position: absolute; bottom: 50px; left: calc(8.33% + var(--p, 0) * 83.3%); width: 56px; margin-left: -28px; transition: left 0.45s cubic-bezier(0.3, 0.7, 0.3, 1); }
.bootJelly { position: relative; width: 56px; height: 48px; border-radius: 16px 16px 14px 14px; transform-origin: 50% 100%;
  background: radial-gradient(ellipse at 30% 25%, rgba(255, 255, 255, 0.9) 0 12%, transparent 13%), linear-gradient(180deg, #ffb3dc, #ff6fb2 55%, #e9449a);
  box-shadow: inset 0 -6px 10px rgba(180, 20, 100, 0.35), inset 0 5px 8px rgba(255, 255, 255, 0.55), 0 0 0 2px rgba(255, 255, 255, 0.65);
  animation: idleSquish 1.1s ease-in-out infinite; }
.bootJelly .eyes { position: absolute; left: 13px; right: 13px; top: 17px; height: 10px; }
.bootJelly .eyes::before, .bootJelly .eyes::after { content: ""; position: absolute; top: 0; width: 7px; height: 10px; border-radius: 50%; background: #3a1640;
  box-shadow: inset 2px 2px 0 -0.5px #fff; animation: blink 3.6s infinite; }
.bootJelly .eyes::before { left: 0; } .bootJelly .eyes::after { right: 0; }
.bootJelly .mouth { position: absolute; left: 50%; top: 29px; width: 12px; height: 7px; margin-left: -6px; border-radius: 0 0 8px 8px; background: #8a1e4c; }
.bootShadow { width: 44px; height: 9px; margin: 2px auto 0; border-radius: 50%; background: rgba(60, 30, 100, 0.25); }
.bootRunner.hop .bootJelly { animation: hop 0.5s cubic-bezier(0.3, 0.7, 0.4, 1); }
.bootRunner.hop .bootShadow { animation: hopShadow 0.5s ease; }
@keyframes hop { 0% { transform: scale(1.25, 0.75); } 20% { transform: translateY(-34px) scale(0.85, 1.18); } 50% { transform: translateY(-40px) scale(0.95, 1.05); }
  80% { transform: translateY(0) scale(1.28, 0.74); } 90% { transform: scale(0.94, 1.06); } 100% { transform: scale(1, 1); } }
@keyframes hopShadow { 50% { transform: scale(0.55); opacity: 0.5; } }
@keyframes idleSquish { 50% { transform: scale(1.05, 0.95); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
.bootBar { width: 100%; height: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 2px 3px rgba(60, 30, 140, 0.18); overflow: hidden; margin: 2px 0 10px; }
.bootFill { height: 100%; width: 0; border-radius: 10px; transition: width 0.35s ease; background: linear-gradient(90deg, #ff8fc8, var(--pink) 50%, var(--purple));
  box-shadow: 0 0 10px rgba(255, 111, 178, 0.6); }
.bootPct { font-family: var(--round); font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 2px 0 var(--purple-2), 0 3px 10px rgba(60, 30, 140, 0.4); font-variant-numeric: tabular-nums; }
.bootTip { margin: 4px 0 20px; min-height: 1.5em; color: var(--ink); font-weight: 700; font-size: 14.5px; }
.bootGo { min-width: 220px; animation: bootPulse 1.4s ease-in-out infinite; }
.boot.ready .bootPct { opacity: 0.7; }
@keyframes bootPulse { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(1.06, 0.95); } 60% { transform: scale(0.97, 1.04); } }
@media (prefers-reduced-motion: reduce) { .bootClouds i, .bootTiles i, .bootStars b, .bootJelly, .bootGo, .bootTitle { animation: none; } }

/* 调试截图（?debug=1&still=1）：动画直接到最后状态 */
.still *, .still *::before, .still *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
.tipRules { white-space: pre-line; }
canvas.robot { width: 110px; height: 110px; }
canvas.finaleRobot { width: 150px; height: 150px; }
/* 调试截图用（?debug=1&narrow=1）：无头浏览器窗口最窄约 500px，用这个把游戏区域压到 375px 手机宽度 */
body.narrow #app { max-width: var(--narrow, 375px); margin: 0; }
body.narrow .overlay { right: auto; width: var(--narrow, 375px); }
body.narrow .toast { left: calc(var(--narrow, 375px) / 2); max-width: calc(var(--narrow, 375px) * 0.92); }
