/* 齿轮邮差 · Bưu Tá Bánh Răng — 界面样式（竖屏优先，电脑上居中显示）
 * 配色：晴空蓝紫 → 暖铜色的蒸汽朋克工坊；面板为深紫 + 金边（与介绍图的紫色横幅一致），按钮为黄铜金色。 */
:root {
  --bg-top: #3f63b8;
  --bg-mid: #4c3f8f;
  --bg-bot: #6b3f2c;
  --ink: #fff8ec;
  --ink-2: #f1dfc4;
  --muted: #b7a48c;
  --gold: #f6c75a;
  --gold-2: #d9952e;
  --brass: #c8963e;
  --teal: #8ff0e0;
  --panel: rgba(52, 36, 96, 0.8);
  --panel-2: rgba(74, 52, 128, 0.88);
  --line: rgba(255, 214, 140, 0.24);
  --shadow: 0 18px 46px rgba(20, 8, 4, 0.5);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --display: '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 20% -5%, rgba(160, 210, 255, 0.45), transparent 55%),
    radial-gradient(ellipse at 85% 25%, rgba(255, 210, 150, 0.16), transparent 50%),
    radial-gradient(ellipse at 50% 115%, rgba(255, 150, 70, 0.35), transparent 55%),
    linear-gradient(180deg, var(--bg-top), var(--bg-mid) 52%, var(--bg-bot));
  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.4; cursor: default; }
[hidden] { display: none !important; }
svg.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 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(30, 24, 70, 0.28), rgba(40, 20, 12, 0.5)), url(../assets/art/bg-portrait.jpg) center / cover no-repeat;
}
@media (orientation: landscape) {
  .bgArt { background-image: linear-gradient(180deg, rgba(30, 24, 70, 0.28), rgba(40, 20, 12, 0.5)), url(../assets/art/bg-landscape.jpg); }
}
#fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#app { position: fixed; inset: 0; max-width: 680px; margin: 0 auto; z-index: 2; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(10px + var(--safe-t)) 16px calc(10px + var(--safe-b)); }

/* ---------- 按钮（黄铜质感） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 22px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-weight: 800; font-size: 15px; letter-spacing: 0.2px;
  box-shadow: 0 8px 22px rgba(20, 8, 4, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn.primary {
  border: 0; color: #3a1d06;
  background: linear-gradient(180deg, #ffeab0, var(--gold) 45%, var(--gold-2));
  box-shadow: 0 10px 26px rgba(240, 170, 60, 0.32), inset 0 -3px 0 rgba(140, 80, 16, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.btn.ghost { background: transparent; box-shadow: none; }
a.btn { text-decoration: none; }
.btn.lg { min-height: 54px; font-size: 17px; border-radius: 16px; }
.btn:focus-visible, .iconBtn:focus-visible, .tool:focus-visible, .lvCard:focus-visible, .langSwitch button:focus-visible, .pillBtn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.iconBtn {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel);
}
.iconSpacer { width: 44px; 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: 1px solid var(--line); }
.langSwitch button { border: 0; background: transparent; padding: 10px 14px; min-height: 40px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.langSwitch button[aria-pressed="true"] { background: var(--gold); color: #3a1d06; }
.homeHero { display: flex; flex-direction: column; align-items: center; }
.logoWrap {
  width: min(48vw, 196px); aspect-ratio: 1; border-radius: 26%; overflow: hidden;
  box-shadow: 0 0 0 3px rgba(246, 199, 90, 0.75), 0 0 0 7px rgba(110, 66, 30, 0.6), 0 0 50px rgba(255, 200, 110, 0.45), 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(--display); font-size: clamp(34px, 9.5vw, 50px); font-weight: 800; letter-spacing: -0.3px; line-height: 1.1;
  background: linear-gradient(180deg, #fffdf2, #ffe08a 60%, #f0a83a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a2f12) drop-shadow(0 6px 16px rgba(60, 20, 0, 0.45));
}
.subtitle { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.45; padding: 6px 16px; border-radius: 16px; max-width: 340px; background: rgba(52, 36, 96, 0.55); border: 1px solid var(--line); }
.homeActions { width: min(340px, 100%); display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.homeProgress { margin: 4px 0 0; color: var(--gold); font-weight: 700; font-size: 14px; min-height: 20px; }
.logoBox { position: relative; }
.homeBear { position: absolute; right: -96px; bottom: -14px; width: 104px; height: 104px; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 10px 14px rgba(20, 8, 4, 0.45)); animation: float 3.2s ease-in-out 0.4s infinite; z-index: 1; }
@media (max-width: 520px) { .homeBear { width: 84px; height: 84px; right: -80px; bottom: -10px; } }
@media (max-width: 350px) { .homeBear { display: none; } }

/* ---------- 顶栏 ---------- */
.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: var(--gold); font-weight: 800; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; }
.hudTitle strong { font-family: var(--display); font-size: 21px; font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.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: 6px; text-align: left; overflow: hidden;
  min-height: 112px; padding: 14px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(92, 64, 150, 0.88), rgba(44, 30, 86, 0.92)); box-shadow: var(--shadow);
}
.lvCard::before { content: ""; position: absolute; inset: 5px; border-radius: 14px; border: 1px dashed rgba(255, 214, 140, 0.22); pointer-events: none; }
.lvCard.done { border-color: rgba(246, 199, 90, 0.55); }
.lvNum { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--gold); line-height: 1; position: relative; z-index: 1; }
.lvName { font-weight: 800; font-size: 14.5px; line-height: 1.3; position: relative; z-index: 1; max-width: 70%; }
.lvStars { display: flex; gap: 2px; margin-top: auto; position: relative; z-index: 1; }
.lvCard.locked { opacity: 0.55; background: rgba(36, 26, 70, 0.85); }
.lvCard.locked .lvNum { color: var(--muted); }
.lvCard .lvArt { position: absolute; right: 8px; top: 9px; width: 60px; height: 60px; transform: rotate(7deg); object-fit: contain; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(20, 8, 4, 0.45)); }
.lvCard.done .lvName { max-width: calc(100% - 58px); }
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; z-index: 1; }
svg.star { width: 18px; height: 18px; fill: rgba(255, 255, 255, 0.14); stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; stroke-linejoin: round; }
svg.star.on { fill: var(--gold); stroke: #fff2c4; filter: drop-shadow(0 0 6px rgba(255, 210, 110, 0.7)); }

/* ---------- 游戏 ---------- */
.gameScreen { padding-bottom: calc(8px + var(--safe-b)); }
.hudStats { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); font-weight: 700; white-space: nowrap; }
.pill b { color: var(--ink); font-size: 15px; display: inline-block; }
.pill svg { width: 15px; height: 15px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.pill.gold { color: var(--gold); border-color: rgba(246, 199, 90, 0.38); }
.pillBtn { min-height: 44px; min-width: 52px; padding: 0; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }
.pillBtn .pill { pointer-events: none; }
.pillBtn svg { fill: var(--gold); stroke: none; }
.boardWrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 0; }
#board { display: block; touch-action: none; cursor: pointer; filter: drop-shadow(0 18px 34px rgba(20, 8, 4, 0.55)); }
.tools { display: grid; grid-template-columns: 1fr 1.4fr 46px 46px; gap: 6px; }  /* V005：重来 · 暂停 / 继续 · 音效 · 音乐 */
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel);
  font-size: 11.5px; font-weight: 700; letter-spacing: -0.2px; color: var(--ink-2); padding: 0 2px;
}
.tool .ico { width: 22px; height: 22px; color: var(--ink); }
.tool[data-act="hint"] .ico { color: var(--gold); }
.tool.off .ico { color: var(--muted); }
.tool span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tool.mini { min-width: 44px; }
/* 运行按钮：黄铜大按钮 */
.runBtn { border: 0; color: #3a1d06; font-size: 15px; font-weight: 900;
  background: linear-gradient(180deg, #ffeab0, var(--gold) 45%, var(--gold-2));
  box-shadow: 0 8px 22px rgba(240, 170, 60, 0.35), inset 0 -3px 0 rgba(140, 80, 16, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.5); }
.runBtn .ico { color: #3a1d06; width: 24px; height: 24px; fill: #3a1d06; stroke: #3a1d06; }
.runBtn .ico.stop, .runBtn .ico.again, .runBtn.running .ico.play, .runBtn.retry .ico.play { display: none; }
.runBtn.running .ico.stop { display: block; }
.runBtn.retry .ico.again { display: block; fill: none; }
.runBtn.running { background: linear-gradient(180deg, #ffd0b8, #f08a5a 50%, #c8503a); }
.runBtn:not(:disabled):not(.running) { animation: runGlow 2.2s ease-in-out infinite; }
@keyframes runGlow { 50% { box-shadow: 0 0 0 3px rgba(255, 225, 140, 0.35), 0 8px 28px rgba(255, 190, 80, 0.6), inset 0 -3px 0 rgba(140, 80, 16, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.5); } }
.runBtn span { color: #3a1d06; }

/* ---------- 弹层 ---------- */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(24, 12, 30, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.tipCard, .winCard {
  position: relative; width: min(420px, 100%); border-radius: 22px; padding: 22px; text-align: center; margin-top: 34px;
  background:
    radial-gradient(circle at 14px 14px, #f6c75a 3px, transparent 4px), radial-gradient(circle at calc(100% - 14px) 14px, #f6c75a 3px, transparent 4px),
    radial-gradient(circle at 14px calc(100% - 14px), #f6c75a 3px, transparent 4px), radial-gradient(circle at calc(100% - 14px) calc(100% - 14px), #f6c75a 3px, transparent 4px),
    linear-gradient(170deg, rgba(96, 68, 168, 0.97), rgba(46, 30, 96, 0.98));
  border: 2px solid rgba(246, 199, 90, 0.7); box-shadow: var(--shadow), 0 0 0 5px rgba(110, 66, 30, 0.55), 0 0 50px rgba(255, 190, 100, 0.25);
  animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.robot { width: 104px; height: 104px; margin: -60px auto 0; display: block; object-fit: contain; filter: drop-shadow(0 10px 16px rgba(20, 8, 4, 0.5)); animation: float 3s ease-in-out infinite; }
.tipBody small, .winCard small { color: var(--gold); font-weight: 800; font-size: 12px; letter-spacing: 1px; }
.tipBody h2, .winCard h2 { margin: 4px 0 8px; font-family: var(--display); font-size: 24px; font-weight: 800; line-height: 1.2; }
.tipBody p, .winCard p { margin: 0 0 14px; color: var(--ink-2); line-height: 1.6; font-size: 15px; }
.tipBody p.tipRules { font-size: 13px; color: var(--muted); padding-top: 10px; border-top: 1px dashed rgba(255, 214, 140, 0.25); }
.tipCard .btn { min-width: 160px; }
.winOverlay { position: fixed; }
.winStars { display: flex; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.winStars svg.star { width: 52px; height: 52px; }
.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; }
.winCard p { white-space: pre-line; }
.winCardArt { width: min(150px, 42vw); aspect-ratio: 1; margin: 6px auto 0; animation: stampIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.15s both; filter: drop-shadow(0 10px 18px rgba(20, 8, 4, 0.5)); }
.winCardArt img { width: 100%; height: 100%; object-fit: contain; display: block; }
@keyframes stampIn { from { transform: scale(2.2) rotate(-25deg); opacity: 0; } 60% { transform: scale(0.92) rotate(4deg); opacity: 1; } }
.winAlbum { margin: 8px 0 2px; }
.albumGrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 6px; }
.albumGrid img { width: 100%; aspect-ratio: 1; object-fit: contain; animation: stampIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
.albumGrid img:nth-child(2) { animation-delay: 0.08s; } .albumGrid img:nth-child(3) { animation-delay: 0.16s; } .albumGrid img:nth-child(4) { animation-delay: 0.24s; }
.albumGrid img:nth-child(5) { animation-delay: 0.32s; } .albumGrid img:nth-child(6) { animation-delay: 0.4s; } .albumGrid img:nth-child(7) { animation-delay: 0.48s; }
.albumGrid img:nth-child(8) { animation-delay: 0.56s; } .albumGrid img:nth-child(9) { animation-delay: 0.64s; } .albumGrid img:nth-child(10) { animation-delay: 0.72s; }
@media (max-height: 720px) { .winCardArt { width: min(110px, 34vw); } .winStars svg.star { width: 42px; height: 42px; } }

/* ---------- 提示条 ---------- */
.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: 14px;
  background: rgba(40, 24, 70, 0.95); border: 1px solid rgba(246, 199, 90, 0.5); color: var(--ink);
  font-size: 14px; 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); }

/* ---------- 尺寸适配 ---------- */
@media (min-width: 560px) { .levelGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-height: 640px) {
  .homeHero h1 { margin-top: 12px; }
  .logoWrap { width: min(36vw, 130px); }
  .tool { min-height: 52px; }
  .hudStats { margin-top: 5px; }
}
@media (max-width: 400px) { .tool { font-size: 11px; letter-spacing: -0.3px; } .tools { gap: 5px; } }
@media (max-width: 380px) { .pill { padding: 5px 9px; font-size: 12px; } .tool { font-size: 10.5px; padding: 0; } }

/* ---------- 动效：按钮悬停与点击 / 画面切换 ---------- */
.btn, .iconBtn, .tool, .lvCard, .langSwitch button, .pillBtn { 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), .langSwitch button:hover, .pillBtn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 220, 150, 0.7);
    box-shadow: 0 10px 26px rgba(20, 8, 4, 0.45), 0 0 18px rgba(255, 210, 130, 0.4);
  }
  .btn.primary:hover, .runBtn:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 12px 30px rgba(240, 170, 60, 0.42), 0 0 22px rgba(255, 220, 140, 0.5); }
  .btn::after, .iconBtn::after, .tool::after, .lvCard::after, .pillBtn::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, 0.32) 50%, transparent 68%);
    transform: translateX(-130%);
  }
  .btn:hover:not(:disabled)::after, .iconBtn:hover::after, .tool:hover:not(:disabled)::after, .lvCard:hover:not(.locked)::after, .pillBtn:hover::after { animation: sheen 0.75s ease; }
  .tool:hover:not(:disabled) .ico { animation: icoBounce 0.5s ease; }
  .iconBtn:hover .ico { animation: cogTurn 0.6s ease; }
}
@keyframes sheen { to { transform: translateX(130%); } }
@keyframes icoBounce { 40% { transform: translateY(-3px) scale(1.12); } }
@keyframes cogTurn { 50% { transform: rotate(-14deg) scale(1.1); } }
.btn:active:not(:disabled), .iconBtn:active, .tool:active:not(:disabled), .lvCard:active:not(.locked), .langSwitch button:active, .pillBtn:active { transform: scale(0.94); 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, 245, 210, 0.65), rgba(255, 200, 110, 0.28) 45%, rgba(255, 200, 110, 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 { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.45); color: var(--gold); } }
.logoWrap { animation: float 4.5s ease-in-out infinite, logoGlow 3.2s ease-in-out infinite; }
@keyframes logoGlow { 50% { box-shadow: 0 0 0 3px rgba(255, 226, 150, 0.95), 0 0 0 7px rgba(110, 66, 30, 0.6), 0 0 80px rgba(255, 200, 110, 0.75), 0 18px 46px rgba(20, 8, 4, 0.5); } }
.tool.pulse { animation: toolPulse 0.9s ease 3; }
@keyframes toolPulse { 50% { transform: scale(1.07); box-shadow: 0 0 0 4px rgba(255, 225, 140, 0.45), 0 0 30px rgba(255, 190, 80, 0.7); } }
/* 首页入场：加载页淡出后依次出现 */
body:not(.booting) .homeScreen:not([hidden]) .logoWrap { animation: heroIn 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) both, float 4.5s ease-in-out 0.7s infinite, logoGlow 3.2s ease-in-out 0.7s infinite; }
body:not(.booting) .homeScreen:not([hidden]) h1 { animation: heroIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.12s both; }
body:not(.booting) .homeScreen:not([hidden]) .homeActions { animation: heroIn 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.24s both; }
@keyframes heroIn { from { opacity: 0; transform: translateY(24px) scale(0.9); } }

/* ===================== 加载页（蒸汽朋克工坊）：齿轮 + 信封、传送带进度条、邮筒 ===================== */
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));
  background: radial-gradient(ellipse at 50% 34%, rgba(255, 200, 120, 0.32), transparent 58%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 130, 60, 0.35), transparent 55%),
    linear-gradient(180deg, #3d5bb0, #4a3b8a 55%, #5c3524);
  transition: opacity 0.6s ease, transform 0.6s ease; }
.boot.leave { opacity: 0; transform: scale(1.04); pointer-events: none; }
.bootSky { position: absolute; inset: 0; pointer-events: none; opacity: 0.6;
  background-image: radial-gradient(2px 2px at 14% 22%, #ffe9a8, transparent), radial-gradient(1.5px 1.5px at 78% 14%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 34% 74%, #ffe9a8, transparent), radial-gradient(2px 2px at 86% 62%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60% 30%, #fff, transparent), radial-gradient(2px 2px at 24% 50%, #ffd28a, transparent);
  background-size: 300px 300px; animation: dustDrift 9s linear infinite; }
@keyframes dustDrift { to { background-position: 0 -300px; } }
.bootInner { position: relative; width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; }
.bootEmblem { position: relative; width: 190px; height: 170px; margin-bottom: 8px; }
.bootGear { position: absolute; }
.bootGear path { fill: #f2c35e; stroke: #8a5a1c; stroke-width: 2; }
.bootGear circle { fill: #8a5a1c; }
.bootGear.g1 { width: 132px; height: 132px; left: 10px; top: 4px; animation: bootSpin 6s linear infinite; filter: drop-shadow(0 8px 14px rgba(20, 8, 4, 0.5)); }
.bootGear.g2 { width: 82px; height: 82px; right: 4px; top: 76px; animation: bootSpinR 3.9s linear infinite; filter: drop-shadow(0 6px 10px rgba(20, 8, 4, 0.5)); }
.bootGear.g2 path { fill: #d4dae6; stroke: #4e566a; }
.bootGear.g2 circle { fill: #4e566a; }
@keyframes bootSpin { to { transform: rotate(360deg); } }
@keyframes bootSpinR { to { transform: rotate(-360deg); } }
.bootLetter { position: absolute; left: 62px; top: 62px; width: 92px; height: 62px; border-radius: 8px; background: linear-gradient(180deg, #fffaf0, #f3e2c2);
  border: 2px solid #c9a46e; box-shadow: 0 10px 18px rgba(20, 8, 4, 0.45); transform: rotate(-10deg); animation: letterBob 2.4s ease-in-out infinite; overflow: hidden; }
.bootLetter::after { content: ""; position: absolute; left: 0; top: 0; width: 0; height: 0; border-left: 44px solid transparent; border-right: 44px solid transparent; border-top: 34px solid #ead7b0; }
.bootLetter i { position: absolute; left: 50%; top: 24px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff7a6a, #c0392b); box-shadow: 0 2px 0 #7a1e14; z-index: 1; }
@keyframes letterBob { 50% { transform: rotate(-6deg) translateY(-6px); } }
.bootTitle { font-family: var(--display); font-size: clamp(30px, 9vw, 38px); font-weight: 800; letter-spacing: 0.3px; margin-bottom: 18px; line-height: 1.1;
  background: linear-gradient(180deg, #fffdf2, #ffe08a 60%, #f0a83a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a2f12) drop-shadow(0 4px 12px rgba(60, 20, 0, 0.4)); }
/* 进度条：一条传送带，小包裹沿着走，终点是邮筒 */
.bootTrack { position: relative; width: 100%; height: 64px; margin: 4px 0 6px; }
.bootBelt { position: absolute; left: 0; right: 34px; bottom: 6px; height: 18px; border-radius: 9px; overflow: hidden;
  background: repeating-linear-gradient(90deg, #4a3a80 0 14px, #5a4896 14px 16px), #4a3a80;
  border-top: 3px solid #f2c35e; border-bottom: 3px solid #c48a2e; box-shadow: 0 6px 12px rgba(20, 8, 4, 0.4);
  animation: beltMove 0.6s linear infinite; }
@keyframes beltMove { to { background-position: 16px 0; } }
.bootFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; transition: width 0.35s ease;
  background: repeating-linear-gradient(90deg, rgba(255, 214, 140, 0.0) 0 6px, rgba(255, 214, 140, 0.55) 6px 9px, rgba(255, 214, 140, 0) 9px 16px); }
.bootParcel { position: absolute; left: 0; bottom: 22px; width: 34px; height: 30px; border-radius: 5px; transition: left 0.35s ease;
  background: linear-gradient(135deg, #ecc283, #c08a4a); border: 2px solid #8a5a26; box-shadow: 0 5px 8px rgba(20, 8, 4, 0.35); animation: parcelHop 0.6s ease-in-out infinite; }
.bootParcel::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; margin-left: -3px; background: rgba(150, 95, 40, 0.6); }
.bootParcel i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: #fffaf0; border: 2px solid #e2453c; }
@keyframes parcelHop { 50% { transform: translateY(-3px); } }
.bootMail { position: absolute; right: 0; bottom: 0; width: 40px; height: 56px; }
.bootMail b { position: absolute; left: 4px; right: 4px; top: 4px; height: 32px; border-radius: 16px 16px 4px 4px; background: linear-gradient(90deg, #9b2620, #ff8a7a 40%, #e2453c 55%, #9b2620); border: 2px solid #3a2208; }
.bootMail b::after { content: ""; position: absolute; left: 6px; right: 6px; top: 12px; height: 5px; border-radius: 3px; background: #1e1208; }
.bootMail::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 6px; height: 18px; margin-left: -3px; background: #b9802a; }
.bootMail i { position: absolute; right: -6px; top: 14px; width: 16px; height: 3px; background: #5a3a1a; transform-origin: 0 50%; transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
.bootMail i::after { content: ""; position: absolute; right: 0; top: -8px; width: 8px; height: 8px; background: #ffd34d; }
.boot.ready .bootMail i { transform: rotate(-90deg); }
.boot.ready .bootMail b { animation: mailBounce 0.5s ease 2; }
@keyframes mailBounce { 50% { transform: translateY(-5px); } }
.boot.ready .bootParcel { opacity: 0; transition: left 0.35s ease, opacity 0.3s 0.25s; }
.bootCog { position: absolute; left: -16px; bottom: -4px; width: 30px; height: 30px; animation: bootSpin 1.8s linear infinite; }
.bootCog path { fill: #f2c35e; stroke: #8a5a1c; stroke-width: 3; }
.bootCog circle { fill: #8a5a1c; }
.bootPct { font-weight: 800; font-size: 15px; color: var(--gold); font-variant-numeric: tabular-nums; }
.bootTip { margin: 6px 0 18px; min-height: 1.5em; color: var(--ink-2); font-size: 14px; }
.bootGo { min-width: 200px; animation: bootPulse 1.6s ease-in-out infinite; }
.boot.ready .bootPct { opacity: 0.6; }
@keyframes bootPulse { 50% { box-shadow: 0 0 0 4px rgba(246, 199, 90, 0.28), 0 0 34px rgba(246, 199, 90, 0.6); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------- V005 实时分拣：心、暂停按钮、失败弹窗 ---------------- */
.pill.hearts { gap: 3px; padding: 5px 10px; }
.pill.hearts svg.heart { width: 19px; height: 19px; fill: #ff5a6e; stroke: #ffd2d8; stroke-width: 1.2; transition: transform 0.2s ease; }
.pill.hearts svg.heart.lost { fill: rgba(255, 255, 255, 0.12); stroke: rgba(255, 255, 255, 0.35); animation: heartLose 0.55s ease; }
@keyframes heartLose { 0% { transform: scale(1.5); fill: #ff5a6e; } 60% { transform: scale(0.8); } 100% { transform: scale(1); } }
#pauseBtn .ico.stop { display: block; }
#pauseBtn .ico.play { display: none; }
#pauseBtn.paused .ico.stop { display: none; }
#pauseBtn.paused .ico.play { display: block; }
#pauseBtn:not(.paused) { animation: none; }
#lose .btn + .btn { margin-top: 8px; }
#pause .tipBody h2 { margin-bottom: 14px; }
