/* 雨滴花园 · Khu Vườn Giọt Mưa — 界面样式（竖屏优先，电脑上居中显示）
 * 明亮的白天花园配色：天蓝 → 嫩绿草地，奶油色卡片，黄绿色主按钮（与 Logo 一致）。 */
:root {
  --sky: #bfe6ff;
  --sky-2: #e3f6ff;
  --meadow: #a8df85;
  --meadow-2: #79c35a;
  --ink: #23401f;
  --ink-2: #44683d;
  --muted: #7d9a75;
  --gold: #ffc83d;
  --gold-2: #f29a14;
  --leaf: #5cbf3f;
  --leaf-2: #3e9a2c;
  --water: #3aa6ee;
  --water-2: #8fd8ff;
  --pink: #ff8fbd;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-2: rgba(255, 255, 255, 0.94);
  --cream: #fffaf0;
  --line: rgba(70, 130, 50, 0.2);
  --shadow: 0 14px 34px rgba(40, 95, 40, 0.22);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --title: 'Baloo 2', 'Be Vietnam Pro', system-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 80% -5%, rgba(255, 246, 200, 0.95), transparent 45%),
    radial-gradient(ellipse at 10% 105%, rgba(255, 190, 220, 0.45), transparent 50%),
    linear-gradient(180deg, var(--sky) 0%, var(--sky-2) 38%, #d6f2c4 62%, var(--meadow) 100%);
  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.2; 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.08), rgba(255, 255, 255, 0.22)), url(../assets/art/bg-portrait.jpg) center / cover no-repeat;
}
@media (orientation: landscape) {
  .bgArt { background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.22)), 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)) 14px calc(10px + var(--safe-b)); }

/* ---------- 按钮 ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 11px 22px; border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.9); background: var(--panel-2); color: var(--leaf-2);
  font-family: var(--title); font-weight: 800; font-size: 17px; letter-spacing: 0.2px; line-height: 1.1;
  box-shadow: 0 6px 0 rgba(70, 140, 50, 0.25), 0 10px 22px rgba(40, 95, 40, 0.18);
}
.btn.primary {
  border-color: #fff8c4; color: #1f4a12;
  background: linear-gradient(180deg, #f2ff9a 0%, #c6ef55 45%, #86cf35 100%);
  box-shadow: 0 6px 0 #4f9a25, 0 12px 26px rgba(80, 160, 40, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.btn.ghost { background: rgba(255, 255, 255, 0.45); box-shadow: none; border-color: rgba(255, 255, 255, 0.7); }
a.btn { text-decoration: none; }
.btn.lg { min-height: 56px; font-size: 20px; border-radius: 18px; }
.btn:focus-visible, .iconBtn:focus-visible, .tool:focus-visible, .lvCard:focus-visible, .langSwitch button:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; }
.iconBtn {
  position: relative; overflow: hidden;
  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(--leaf-2);
  box-shadow: 0 4px 0 rgba(70, 140, 50, 0.2), 0 6px 14px rgba(40, 95, 40, 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 4px 12px rgba(40, 95, 40, 0.15); }
.langSwitch button { position: relative; overflow: hidden; border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.langSwitch button[aria-pressed="true"] { background: linear-gradient(180deg, #d9f77a, #8fd43c); color: #1f4a12; }
.homeHero { display: flex; flex-direction: column; align-items: center; }
.logoWrap {
  width: min(48vw, 200px); aspect-ratio: 1; border-radius: 28%; overflow: hidden;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(140, 210, 90, 0.7), 0 0 50px rgba(255, 240, 160, 0.9), var(--shadow);
}
.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(--title); font-size: clamp(36px, 10.5vw, 54px); font-weight: 800; letter-spacing: -0.5px; line-height: 1.05;
  color: #f4ff9c;
  background: linear-gradient(180deg, #ffffff 0%, #f1ffa0 45%, #b9ec4b 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 #2f7a24) drop-shadow(0 -2px 0 #2f7a24) drop-shadow(2px 0 0 #2f7a24) drop-shadow(-2px 0 0 #2f7a24) drop-shadow(0 6px 10px rgba(30, 80, 20, 0.35));
}
.subtitle { margin: 12px 0 0; padding: 6px 16px; border-radius: 999px; background: linear-gradient(90deg, #7a6cf0, #9a7cf5); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 6px 16px rgba(110, 90, 220, 0.3); }
.homeActions { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px; }
.homeProgress { margin: 2px 0 0; color: var(--leaf-2); font-weight: 800; font-size: 14px; min-height: 20px; text-shadow: 0 1px 0 #fff; }

/* ---------- 顶栏 ---------- */
.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; }
.hudTitle small { color: #fff; background: #8a6a3e; padding: 1px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; letter-spacing: 0.5px; }
.hudTitle strong { font-family: var(--title); font-size: 21px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--ink); text-shadow: 0 2px 0 #fff; line-height: 1.25; }
.levelsScreen .hudTitle small { background: none; color: var(--ink-2); padding: 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; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  min-height: 112px; padding: 14px; border-radius: 20px; border: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(236, 250, 222, 0.92)); box-shadow: 0 5px 0 rgba(70, 140, 50, 0.22), var(--shadow);
  color: var(--ink);
}
.lvCard.done { background: linear-gradient(160deg, #fffbe6, #e5f8cf); }
.lvNum { font-family: var(--title); font-size: 30px; font-weight: 800; color: var(--leaf-2); line-height: 1; }
.lvName { font-weight: 800; font-size: 14.5px; line-height: 1.3; max-width: 70%; }
.lvStars { display: flex; gap: 2px; margin-top: auto; }
.lvCard.locked { opacity: 0.62; background: rgba(240, 245, 235, 0.85); }
.lvCard.locked .lvNum { color: var(--muted); }
.lvCard .lvArt { position: absolute; right: -6px; bottom: -6px; width: 84px; height: 84px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(40, 90, 30, 0.25)); }
.lvCard .lvNum, .lvCard .lvName, .lvCard .lvStars { position: relative; z-index: 1; }
.lvCard .lock { z-index: 1; }
svg.lock { position: absolute; right: 12px; top: 12px; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.star { width: 18px; height: 18px; fill: rgba(120, 150, 110, 0.22); stroke: rgba(120, 150, 110, 0.35); stroke-width: 1; stroke-linejoin: round; }
svg.star.on { fill: var(--gold); stroke: #e08a00; filter: drop-shadow(0 1px 3px rgba(240, 160, 20, 0.6)); }

/* ---------- 游戏 ---------- */
.gameScreen { padding-bottom: calc(8px + var(--safe-b)); }
.hudStats { display: flex; justify-content: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: var(--panel-2); border: 2px solid rgba(255, 255, 255, 0.95); font-size: 12.5px; color: var(--ink-2); font-weight: 700; box-shadow: 0 3px 10px rgba(40, 95, 40, 0.12); }
.pill b { color: var(--ink); font-size: 16px; font-family: var(--title); line-height: 1; }
.pill svg { width: 15px; height: 15px; }
.pill.water svg { fill: var(--water); }
.pill.steps svg { fill: #8a6a3e; }
.pill.steps.low { background: #fff0d6; border-color: #ffd28a; }
.pill.steps.low b { color: #e06a00; }
.pill.gold { color: #a36400; background: #fff6d6; }
/* V004：已经拿不到 3 星（多用了步数或用过提示）时，3★ 目标变淡 */
.pill.gold.lost { color: #9a8a6a; background: #f4efe2; opacity: 0.8; }
.boardWrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 4px 0; }
#board { display: block; touch-action: none; cursor: pointer; filter: drop-shadow(0 14px 24px rgba(40, 90, 30, 0.28)); }
.tools { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tool {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 60px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, 0.95); background: var(--panel-2);
  font-size: 12px; font-weight: 800; color: var(--ink-2); box-shadow: 0 4px 0 rgba(70, 140, 50, 0.2);
}
.tool .ico { width: 22px; height: 22px; color: var(--leaf-2); }
.tool[data-act="hint"] .ico { color: var(--gold-2); }
.tool.off .ico { color: var(--muted); }
.tool span { white-space: nowrap; }
.tool.pulse { animation: toolPulse 0.9s ease 3; }
/* V004：提示正在后台求解（“Mít đang nghĩ…”）时，提示按钮的灯泡轻轻闪 */
.tool.busy .ico { animation: hintBusy 0.8s ease-in-out infinite alternate; }
@keyframes hintBusy { from { opacity: 1; transform: scale(1); } to { opacity: 0.45; transform: scale(0.88); } }
@keyframes toolPulse { 50% { background: #fff1b8; border-color: var(--gold); transform: scale(1.07); } }

/* ---------- 弹层 ---------- */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; align-items: safe center; overflow-y: auto; justify-content: center; padding: 20px; background: rgba(40, 80, 50, 0.35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.tipCard, .winCard, .finCard {
  width: min(420px, 100%); border-radius: 26px; padding: 20px 22px 22px; text-align: center; margin-top: 40px;
  background: linear-gradient(175deg, #fffef6, #f1fbe4);
  border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(130, 200, 90, 0.55), var(--shadow), 0 0 50px rgba(255, 250, 200, 0.6);
  animation: pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.guideBox { position: relative; width: 104px; height: 104px; margin: -66px auto 2px; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 8px 12px rgba(40, 90, 30, 0.3)); }
.guideBox .catSvg, .guideBox .guide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.guideBox.loaded .catSvg { display: none; }
/* V005：三花猫动图有一半的帧尾巴伸出画面、被原片切成平直的一刀 → 左边缘渐隐（只对动图，退回静态图时不影响） */
.guideBox .guide[src$="guide-idle.webp"] { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10%); mask-image: linear-gradient(90deg, transparent 0, #000 10%); }
.guideBox.sad { animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.tipBody small, .winCard small { display: inline-block; color: #fff; background: #8a6a3e; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.tipBody h2, .winCard h2, .tipCard h2, .finCard h2 { margin: 8px 0 6px; font-family: var(--title); font-size: 25px; font-weight: 800; color: var(--leaf-2); line-height: 1.15; }
.tipBody p, .winCard p, .tipCard p, .finCard p { margin: 0 0 16px; color: var(--ink-2); line-height: 1.6; font-size: 15px; white-space: pre-line; }
.tipRules { text-align: left; background: rgba(140, 210, 100, 0.14); border-radius: 14px; padding: 10px 12px; font-size: 14px !important; }
.tipCard .btn { min-width: 170px; }
.winOverlay { position: fixed; }
.winPlant { width: min(140px, 40vw); aspect-ratio: 1; margin: 4px auto 0; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, #fffbe0 30%, rgba(200, 240, 160, 0.9) 70%); box-shadow: 0 0 0 4px #fff, 0 0 30px rgba(255, 230, 120, 0.8);
  animation: pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.1s both; }
.winPlant img { width: 82%; height: 82%; object-fit: contain; }
.winStars { display: flex; justify-content: center; gap: 10px; margin: 10px 0 2px; }
.winStars svg.star { width: 50px; height: 50px; }
.winStars svg.star:nth-child(2) { transform: translateY(-10px); }
.winStars svg.star.pop { animation: starPop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
.winStars svg.star:nth-child(2).pop { animation-name: starPop2; }
@keyframes starPop { from { transform: scale(0.2) rotate(-40deg); } }
@keyframes starPop2 { from { transform: translateY(-10px) scale(0.2) rotate(-40deg); } }
.winBtns { display: flex; flex-direction: column; gap: 10px; }
.failCard h2 { color: #d9731a !important; }

/* ---------- 终曲 ---------- */
.finale { position: fixed; z-index: 30; background: linear-gradient(180deg, rgba(190, 232, 255, 0.92), rgba(220, 248, 200, 0.94)); overflow: hidden; }
.finSky { position: absolute; inset: 0; pointer-events: none; }
.finSky .rb { position: absolute; left: 50%; top: 32%; width: 150vmax; height: 150vmax; margin-left: -75vmax; border-radius: 50%;
  background: radial-gradient(circle, transparent 54%, rgba(255, 107, 107, 0.45) 54.5%, rgba(255, 169, 77, 0.45) 56%, rgba(255, 224, 102, 0.45) 57.5%, rgba(140, 233, 154, 0.45) 59%, rgba(116, 192, 252, 0.45) 60.5%, rgba(177, 151, 252, 0.45) 62%, transparent 62.5%);
  animation: rbIn 1.6s ease-out both; }
@keyframes rbIn { from { opacity: 0; transform: translateY(18%) scale(0.9); } }
.finSky .sun { position: absolute; right: 10%; top: 6%; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, #fff7c2, #ffd84a 60%, rgba(255, 216, 74, 0) 72%); animation: sunGlow 3s ease-in-out infinite; }
@keyframes sunGlow { 50% { transform: scale(1.12); } }
.finSky .pt { position: absolute; top: -20px; width: 12px; height: 8px; border-radius: 50%; background: #ffb3d1; animation: petal 6s linear infinite; }
.finSky .pt:nth-child(3) { left: 8%; animation-delay: -1s; } .finSky .pt:nth-child(4) { left: 22%; animation-delay: -3s; background: #fff0a6; }
.finSky .pt:nth-child(5) { left: 35%; animation-delay: -5s; } .finSky .pt:nth-child(6) { left: 48%; animation-delay: -2s; background: #ffd3e6; }
.finSky .pt:nth-child(7) { left: 60%; animation-delay: -4s; } .finSky .pt:nth-child(8) { left: 72%; animation-delay: -0.5s; background: #fff0a6; }
.finSky .pt:nth-child(9) { left: 84%; animation-delay: -2.5s; } .finSky .pt:nth-child(10) { left: 93%; animation-delay: -4.5s; background: #ffd3e6; }
.finSky .pt:nth-child(11) { left: 15%; animation-delay: -3.5s; } .finSky .pt:nth-child(12) { left: 66%; animation-delay: -1.5s; }
@keyframes petal { to { transform: translate(40px, 110vh) rotate(720deg); } }
.finCard { position: relative; margin-top: 70px; }
.finGarden { display: flex; align-items: flex-end; justify-content: center; gap: 2px; margin: -100px auto 4px; height: 120px; }
.finPlant { width: 74px; height: 74px; animation: grow 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.5) both; }
.finPlant:nth-child(1) { animation-delay: 0.4s; } .finPlant:nth-child(3) { animation-delay: 0.65s; } .finPlant:nth-child(4) { animation-delay: 0.9s; }
.finPlant img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
@keyframes grow { from { transform: scale(0) translateY(30px); opacity: 0; } }
.guideBox.big { width: 130px; height: 130px; margin: 0; }
.finStars { font-family: var(--title); font-weight: 800; color: #a36400 !important; font-size: 18px !important; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + 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(255, 255, 255, 0.97); border: 2px solid rgba(110, 190, 80, 0.6); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1.5; text-align: center; white-space: pre-line;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; 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: 680px) {
  .homeHero h1 { margin-top: 12px; }
  .logoWrap { width: min(36vw, 140px); }
  .tool { min-height: 52px; }
  .hudStats { margin-top: 5px; }
  .finGarden { transform: scale(0.8); }
}
@media (max-width: 360px) { .pill { padding: 4px 8px; font-size: 11.5px; } .pill b { font-size: 14px; } }

/* ---------- 动效：按钮悬停与点击 / 画面切换 ---------- */
.btn, .iconBtn, .tool, .lvCard, .langSwitch button { -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), .langSwitch button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0 rgba(70, 140, 50, 0.22), 0 14px 28px rgba(40, 95, 40, 0.25), 0 0 20px rgba(255, 245, 160, 0.8);
  }
  .btn.primary:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 8px 0 #4f9a25, 0 16px 30px rgba(80, 160, 40, 0.4), 0 0 24px rgba(240, 255, 150, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.7); }
  .btn::after, .iconBtn::after, .tool::after, .lvCard::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, 0.65) 50%, transparent 68%);
    transform: translateX(-130%);
  }
  .btn:hover:not(:disabled)::after, .iconBtn:hover::after, .tool:hover:not(:disabled)::after, .lvCard:hover:not(.locked)::after { animation: sheen 0.75s ease; }
  .tool:hover:not(:disabled) .ico { animation: icoBounce 0.5s ease; }
}
@keyframes sheen { to { transform: translateX(130%); } }
@keyframes icoBounce { 40% { transform: translateY(-3px) scale(1.15) rotate(-6deg); } }
.btn:active:not(:disabled), .iconBtn:active, .tool:active:not(:disabled), .lvCard:active:not(.locked), .langSwitch button:active { transform: scale(0.94) translateY(2px); 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.7), rgba(120, 200, 255, 0.35) 45%, rgba(120, 200, 255, 0) 70%); animation: ripple 0.6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.screen:not([hidden]) { animation: screenIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } }
.lvCard { animation: cardIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(0.92); } }
.pill b.bump { display: inline-block; animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.5); color: var(--water); } }
.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(140, 210, 90, 0.9), 0 0 70px rgba(255, 240, 160, 1), 0 14px 34px rgba(40, 95, 40, 0.22); } }
/* 首页入场：Logo 落下、标题弹出、按钮依次出现 */
body.entered .homeScreen:not([hidden]) .logoWrap { animation: dropIn 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.3) both, float 4.5s ease-in-out 0.8s infinite, logoGlow 3.2s ease-in-out infinite; }
body.entered .homeScreen:not([hidden]) h1 { animation: popIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.25s both; }
body.entered .homeScreen:not([hidden]) .subtitle { animation: popIn 0.5s ease 0.4s both; }
body.entered .homeScreen:not([hidden]) .homeActions > * { animation: popIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
body.entered .homeScreen:not([hidden]) .homeActions > *:nth-child(1) { animation-delay: 0.5s; }
body.entered .homeScreen:not([hidden]) .homeActions > *:nth-child(2) { animation-delay: 0.6s; }
body.entered .homeScreen:not([hidden]) .homeActions > *:nth-child(3) { animation-delay: 0.7s; }
body.entered .homeScreen:not([hidden]) .homeActions > *:nth-child(4) { animation-delay: 0.8s; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-60px) scale(0.8); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.7) translateY(10px); } }

/* ===================== 加载页（雨滴花园风格）：雨云落雨 → 花盆里的小芽随进度长高 → 开花 ===================== */
body.booting #app { display: none; }
body.booting #fx, body.booting .bgArt { visibility: hidden; }
.boot { --p: 0; position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px 20px calc(24px + var(--safe-b));
  background: radial-gradient(ellipse at 50% 110%, #b8e88e 0%, rgba(184, 232, 142, 0) 55%), linear-gradient(180deg, #a9dcff 0%, #d9f2ff 45%, #e8f9dc 75%, #b8e88e 100%);
  transition: opacity 0.6s ease, transform 0.6s ease; overflow: hidden; color: var(--ink); }
.boot.leave { opacity: 0; transform: scale(1.04); pointer-events: none; }
.bootSun { position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, #fff9cf 0%, rgba(255, 236, 140, 0.8) 35%, rgba(255, 236, 140, 0) 70%); animation: sunGlow 4s ease-in-out infinite; }
.bootInner { position: relative; width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; }
.bootScene { position: relative; width: 220px; height: 230px; margin-bottom: 8px; }
.bootCloud { position: absolute; left: 50%; top: 6px; width: 150px; height: 60px; margin-left: -75px; border-radius: 40px; background: linear-gradient(180deg, #fff, #e3eef8); box-shadow: 0 8px 18px rgba(80, 140, 190, 0.25); animation: cloudBob 3s ease-in-out infinite; }
.bootCloud i { position: absolute; border-radius: 50%; background: inherit; background: #fff; }
.bootCloud i:nth-child(1) { width: 62px; height: 62px; left: 18px; top: -28px; }
.bootCloud i:nth-child(2) { width: 78px; height: 78px; left: 52px; top: -40px; }
.bootCloud i:nth-child(3) { width: 48px; height: 48px; left: 94px; top: -18px; }
@keyframes cloudBob { 50% { transform: translateY(-5px) scale(1.02); } }
.bootRain { position: absolute; left: 50%; top: 66px; width: 110px; height: 96px; margin-left: -55px; overflow: hidden; }
.bootRain b { position: absolute; top: -16px; width: 4px; height: 14px; border-radius: 4px; background: linear-gradient(180deg, rgba(90, 175, 240, 0), #4aaef0); animation: drop 0.9s linear infinite; }
.bootRain b:nth-child(1) { left: 8%; animation-delay: -0.1s; } .bootRain b:nth-child(2) { left: 22%; animation-delay: -0.5s; }
.bootRain b:nth-child(3) { left: 36%; animation-delay: -0.3s; } .bootRain b:nth-child(4) { left: 50%; animation-delay: -0.7s; }
.bootRain b:nth-child(5) { left: 64%; animation-delay: -0.2s; } .bootRain b:nth-child(6) { left: 78%; animation-delay: -0.6s; }
.bootRain b:nth-child(7) { left: 90%; animation-delay: -0.4s; }
@keyframes drop { to { transform: translateY(112px); } }
.bootPot { position: absolute; left: 50%; bottom: 0; width: 96px; height: 62px; margin-left: -48px; border-radius: 6px 6px 22px 22px;
  background: linear-gradient(180deg, #f08b56, #d4683a); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08), 0 8px 16px rgba(120, 60, 20, 0.25); }
.bootPot::before { content: ""; position: absolute; left: -7px; right: -7px; top: -4px; height: 16px; border-radius: 8px; background: linear-gradient(180deg, #f6a273, #e07444); }
.bootPot::after { content: ""; position: absolute; left: 4px; right: 4px; top: 2px; height: 8px; border-radius: 50%; background: #7a4a24; }
/* 小芽：高度随 --p（0..1）长高 */
.bootPlant { position: absolute; left: 50%; bottom: 56px; width: 0; height: 0; }
.bootStem { position: absolute; left: -3px; bottom: 0; width: 6px; height: calc(18px + var(--p) * 92px); border-radius: 6px; background: linear-gradient(90deg, #4fa83a, #7ed05c); transition: height 0.35s ease; transform-origin: bottom; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(3deg); } }
.bootStem .lf { position: absolute; width: 30px; height: 15px; border-radius: 15px 0; background: linear-gradient(135deg, #a6e374, #5cb843); }
.bootStem .lf.l { right: 4px; top: 40%; transform: rotate(-20deg) scale(calc(0.4 + var(--p) * 0.6)); transform-origin: right center; border-radius: 0 15px; }
.bootStem .lf.r { left: 4px; top: 62%; transform: rotate(20deg) scale(calc(0.5 + var(--p) * 0.5)); transform-origin: left center; }
.bootStem .bud { position: absolute; left: 50%; top: -6px; width: 0; height: 0; }
.bootStem .bud i { position: absolute; width: 22px; height: 16px; margin: -8px 0 0 -11px; border-radius: 50%; background: #ff9cc7; transform: rotate(calc(var(--k) * 72deg)) translateX(0) scale(0.2); opacity: 0; transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.5), opacity 0.3s; }
.bootStem .bud i:nth-child(1) { --k: 0; } .bootStem .bud i:nth-child(2) { --k: 1; } .bootStem .bud i:nth-child(3) { --k: 2; } .bootStem .bud i:nth-child(4) { --k: 3; } .bootStem .bud i:nth-child(5) { --k: 4; }
.bootStem .bud::after { content: ""; position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #ffd34d; transform: scale(0); transition: transform 0.5s 0.2s; }
.boot.ready .bootStem .bud i { opacity: 1; transform: rotate(calc(var(--k) * 72deg)) translateX(13px) scale(1); }
.boot.ready .bootStem .bud::after { transform: scale(1); }
.bootTitle { font-family: var(--title); font-size: clamp(30px, 9vw, 40px); font-weight: 800; line-height: 1.1; margin: 6px 0 14px;
  background: linear-gradient(180deg, #ffffff, #efff9a 50%, #b4e64a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #c9ef5a;
  filter: drop-shadow(0 2px 0 #2f7a24) drop-shadow(0 -2px 0 #2f7a24) drop-shadow(2px 0 0 #2f7a24) drop-shadow(-2px 0 0 #2f7a24); }
/* 进度条：一条石砌水渠慢慢灌满水，五片叶子依次变绿 */
.bootTrack { position: relative; width: 100%; height: 16px; border-radius: 10px; background: #e9dcc0; box-shadow: inset 0 2px 4px rgba(120, 90, 40, 0.35), 0 0 0 3px #fffaf0; margin: 10px 0 14px; }
.bootFill { position: absolute; left: 3px; top: 3px; bottom: 3px; width: 0; max-width: calc(100% - 6px); border-radius: 8px; transition: width 0.35s ease;
  background: repeating-linear-gradient(110deg, #6fd0ff 0 10px, #4ab6f4 10px 20px); background-size: 40px 100%; animation: waterFlow 0.8s linear infinite; box-shadow: 0 0 10px rgba(80, 180, 250, 0.6); }
@keyframes waterFlow { to { background-position: 40px 0; } }
.bootTrack i { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 0 50%; background: #cfc3a6; transform: rotate(45deg) scale(0.7); transition: transform 0.35s, background 0.35s; }
.bootTrack i:nth-of-type(1) { left: 0; } .bootTrack i:nth-of-type(2) { left: 25%; } .bootTrack i:nth-of-type(3) { left: 50%; }
.bootTrack i:nth-of-type(4) { left: 75%; } .bootTrack i:nth-of-type(5) { left: 100%; }
.bootTrack i.on { background: linear-gradient(135deg, #b4ec7c, #4fae38); transform: rotate(45deg) scale(1.1); box-shadow: 0 0 8px rgba(120, 220, 80, 0.8); }
.bootPct { font-family: var(--title); font-weight: 800; font-size: 18px; color: var(--leaf-2); font-variant-numeric: tabular-nums; }
.bootTip { margin: 4px 0 18px; min-height: 1.5em; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.bootGo { min-width: 210px; animation: bootPulse 1.6s ease-in-out infinite; }
.boot.ready .bootPct { opacity: 0.6; }
@keyframes bootPulse { 50% { box-shadow: 0 6px 0 #4f9a25, 0 0 0 6px rgba(200, 245, 110, 0.4), 0 0 34px rgba(220, 255, 140, 0.9); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* 调试截图用（?debug=1&still=1）：CSS 动画直接跳到结束状态 */
body.still *, body.still *::before, body.still *::after { animation-delay: 0s !important; animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition: none !important; }
/* 调试截图用（?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); }

/* V002：只放 SVG 定义的隐藏容器（原来写在 style 属性里，服务器 CSP 不允许内联样式） */
.svgDefs { position: absolute; width: 0; height: 0; overflow: hidden; }
