/* ============================================================
 * 《帮姐姐带娃》界面样式
 * 竖屏优先：浅暖色底 + 卡通场景 + 圆角卡片 + 轻阴影
 * ============================================================ */

:root {
  --blue: #3D7EFF;
  --blue-deep: #2F62D8;
  --ink: #3A2E24;
  --ink-2: #6C5948;
  --muted: #9A8673;
  --cream: #FFFBF3;
  --line: #EADCC9;
  --pink: #FF8FB1;
  --yellow: #FFC94D;
  --mint: #8BD3A2;
  --purple: #B7A7FF;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 212, 166, .55), transparent 42%),
    radial-gradient(circle at 82% 88%, rgba(164, 208, 255, .55), transparent 46%),
    #EFE6D9;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  align-items: center;
  justify-content: center;
}

button {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  outline: 0;
}

button:focus-visible {
  outline: 3px solid rgba(61, 126, 255, .5);
  outline-offset: 2px;
}

/* ---------------- 手机外框 ---------------- */
.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #CDE9FF;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 560px) and (min-height: 680px) {
  body { padding: 18px; }
  .app {
    height: min(920px, calc(100dvh - 36px));
    border-radius: 38px;
    box-shadow:
      0 32px 90px rgba(77, 50, 28, .32),
      0 3px 12px rgba(77, 50, 28, .12),
      0 0 0 1px rgba(255, 255, 255, .55);
  }
}

/* ---------------- 场景区 ---------------- */
.playfield {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #CDE9FF;
}

.scene,
.ambient,
.scene-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene { z-index: 0; }
.scene svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ambient { z-index: 1; overflow: hidden; }

.scene-shade {
  z-index: 2;
  background: linear-gradient(180deg,
    rgba(62, 42, 26, .16) 0%,
    rgba(62, 42, 26, 0) 15%,
    rgba(62, 42, 26, 0) 80%,
    rgba(62, 42, 26, .18) 100%);
}

/* 场景切换淡入 */
.playfield.enter .scene { animation: sceneIn .5s ease both; }
.playfield.enter .baby { animation: babyFade .45s ease both; }
.playfield.enter .baby:nth-child(2) { animation-delay: .06s; }
.playfield.enter .baby:nth-child(3) { animation-delay: .12s; }
.playfield.enter .baby:nth-child(4) { animation-delay: .18s; }

@keyframes sceneIn {
  from { opacity: .35; transform: scale(1.035); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes babyFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.level-pill {
  min-width: 128px;
  padding: 8px 13px 9px;
  border-radius: 19px;
  background: rgba(255, 252, 246, .94);
  border: 1.5px solid rgba(96, 72, 54, .16);
  box-shadow: 0 5px 16px rgba(70, 45, 25, .16), inset 0 1px 0 #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.level-line {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.level-no {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #33281F;
}

.level-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #C9B59F;
  flex: none;
}

.level-name {
  font-size: 12px;
  font-weight: 700;
  color: #8B7765;
  white-space: nowrap;
}

.level-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #A18D79;
  line-height: 1;
  transform-origin: left center;
}

.level-sub .mp-icon {
  width: 12px;
  height: 12px;
  color: #FF7A90;
}

.level-sub b {
  color: #E5667F;
  font-size: 12px;
  font-weight: 900;
}

.level-sub.pop { animation: countPop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes countPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

.timer-pill {
  position: relative;
  min-width: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 19px;
  background: rgba(255, 252, 246, .95);
  border: 1.5px solid rgba(96, 72, 54, .16);
  box-shadow: 0 5px 16px rgba(70, 45, 25, .16), inset 0 1px 0 #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .22s ease, border-color .22s ease;
}

.timer-pill .mp-icon {
  width: 20px;
  height: 20px;
  color: var(--blue);
  flex: none;
}

.timer-cap {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #9A8673;
  white-space: nowrap;
}

.timer-text {
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .6px;
  font-variant-numeric: tabular-nums;
  color: #2F3B52;
}

.timer-pill.urgent {
  background: #FFF0F0;
  border-color: #FFB9C1;
  animation: timerPulse 1s ease-in-out infinite;
}
.timer-pill.urgent .mp-icon,
.timer-pill.urgent .timer-text { color: #E5484D; }

.timer-pill.boost { animation: timerBoost .6s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes timerBoost {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes timerPulse {
  0%, 100% { box-shadow: 0 5px 16px rgba(70, 45, 25, .16), 0 0 0 0 rgba(229, 72, 77, .24); }
  55% { box-shadow: 0 5px 16px rgba(70, 45, 25, .16), 0 0 0 8px rgba(229, 72, 77, 0); }
}

.timer-add {
  position: absolute;
  right: 6px;
  top: calc(100% + 6px);
  padding: 3px 9px;
  border-radius: 99px;
  background: #3DBE52;
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(50, 150, 60, .28);
  opacity: 0;
  pointer-events: none;
}
.timer-add.show { animation: floatAdd 1s ease forwards; }
@keyframes floatAdd {
  0% { opacity: 0; transform: translateY(-5px) scale(.8); }
  22% { opacity: 1; transform: translateY(0) scale(1.08); }
  70% { opacity: 1; transform: translateY(5px) scale(1); }
  100% { opacity: 0; transform: translateY(14px) scale(.96); }
}

/* ---------------- 宝宝 ---------------- */
.babies {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.baby {
  position: absolute;
  left: var(--x);
  bottom: var(--b);
  width: clamp(74px, 23%, 97px);
  transform: rotate(var(--rot));
  transform-origin: 50% 100%;
  cursor: grab;
  touch-action: manipulation;
}

.baby.front { z-index: 4; }
.baby:active { cursor: grabbing; }

.baby svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.baby-inner {
  position: relative;
  transform-origin: 50% 95%;
  animation: idleBob 3.4s ease-in-out infinite;
  animation-delay: var(--delay);
  filter: drop-shadow(0 4px 4px rgba(70, 45, 25, .10));
}

@keyframes idleBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2.5px) rotate(.7deg); }
}

/* 哭/笑两套表情与手臂 */
.baby-svg .face-happy,
.baby-svg .arms-happy { display: none; }
.baby.solved .baby-svg .face-cry,
.baby.solved .baby-svg .arms-cry { display: none; }
.baby.solved .baby-svg .face-happy,
.baby.solved .baby-svg .arms-happy { display: block; }

.baby .tear {
  animation: tearDrop 1.9s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center top;
}
.baby .tear2 { animation-delay: .55s; }
@keyframes tearDrop {
  0%, 100% { transform: translateY(0) scale(1); opacity: .9; }
  50% { transform: translateY(3px) scale(1.04); opacity: .55; }
}

.baby.solved .baby-inner {
  animation: cheer .68s cubic-bezier(.18, 1.5, .4, 1) both;
}
@keyframes cheer {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-12px) scale(1.08, .94); }
  62% { transform: translateY(1px) scale(.96, 1.05); }
  82% { transform: translateY(-4px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

.baby.solved { cursor: default; }

/* 拖动悬停 / 提示高亮 */
.drop-ring {
  position: absolute;
  left: 2%;
  right: 2%;
  top: 3%;
  bottom: 1%;
  border-radius: 48% 48% 42% 42%;
  border: 3px dashed transparent;
  opacity: 0;
  transform: scale(.94);
  transition: opacity .15s ease;
  pointer-events: none;
}
.baby.hover .drop-ring {
  opacity: 1;
  border-color: var(--blue);
  background: rgba(61, 126, 255, .11);
  animation: ringPulse .8s ease-in-out infinite;
}
.baby.hint .drop-ring {
  opacity: 1;
  border-color: #FFAE1F;
  background: rgba(255, 209, 102, .18);
  animation: hintPulse .85s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(.96); }
  50% { transform: scale(1.02); }
}
@keyframes hintPulse {
  0%, 100% { transform: scale(.97); opacity: .65; }
  50% { transform: scale(1.04); opacity: 1; }
}

/* 配错时轻轻摇头，不扣时间 */
.baby.wrong .baby-inner { animation: wrongShake .4s ease; }
@keyframes wrongShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-4px) rotate(-2deg); }
  45% { transform: translateX(4px) rotate(2deg); }
  70% { transform: translateX(-2px) rotate(-1deg); }
}

/* 完成徽章 */
.solved-badge {
  position: absolute;
  z-index: 3;
  top: -2px;
  right: 4px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #FF7A90;
  border: 2.5px solid #FFF9F0;
  box-shadow: 0 3px 7px rgba(180, 60, 80, .28);
  opacity: 0;
  transform: scale(0) rotate(-25deg);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2, 1.6, .4, 1);
  pointer-events: none;
}
.solved-badge .mp-icon { width: 13px; height: 13px; color: #FFF9F0; }
.baby.solved .solved-badge { opacity: 1; transform: scale(1) rotate(0); transition-delay: .1s; }

/* 礼花星星 */
.joy {
  position: absolute;
  font-size: 15px;
  font-weight: 900;
  color: #FFC94D;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .9);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.joy.j1 { left: -4%; top: 5%; }
.joy.j2 { right: 3%; top: -3%; font-size: 12px; color: #FF8FB1; }
.joy.j3 { right: -5%; top: 22%; font-size: 11px; color: #7CC8F2; }
.baby.solved .joy.j1 { animation: joyPop 1.3s ease-out both; }
.baby.solved .joy.j2 { animation: joyPop 1.3s .1s ease-out both; }
.baby.solved .joy.j3 { animation: joyPop 1.3s .2s ease-out both; }
@keyframes joyPop {
  0% { opacity: 0; transform: scale(.3) translateY(6px); }
  32% { opacity: 1; transform: scale(1.18) translateY(-4px); }
  100% { opacity: 0; transform: scale(.9) translateY(-15px); }
}

/* 哄好时头顶的小气泡 */
.praise {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 6%;
  transform: translate(-50%, 0);
  padding: 3px 9px;
  border-radius: 99px;
  border: 1.5px solid #FFD3DC;
  background: #FFF9EC;
  color: #E5667F;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(180, 60, 80, .16);
  pointer-events: none;
  animation: praiseUp 1.2s ease forwards;
}
@keyframes praiseUp {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.8); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -28px) scale(.98); }
}

/* ---------------- 环境粒子 ---------------- */
.amb { position: absolute; pointer-events: none; }

.amb-bubble {
  bottom: -24px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .9);
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .9), rgba(190, 235, 255, .12) 70%);
  animation: bubbleUp var(--dur) linear infinite;
  animation-delay: var(--delay);
  opacity: 0;
}
@keyframes bubbleUp {
  0% { transform: translate3d(0, 0, 0) scale(.7); opacity: 0; }
  12% { opacity: .75; }
  55% { transform: translate3d(10px, -42vh, 0) scale(1); }
  100% { transform: translate3d(-8px, -92vh, 0) scale(1.1); opacity: 0; }
}

.amb-snow {
  top: -14px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 5px rgba(255, 255, 255, .9);
  animation: snowFall var(--dur) linear infinite;
  animation-delay: var(--delay);
  opacity: .85;
}
@keyframes snowFall {
  0% { transform: translate3d(0, -20px, 0); }
  50% { transform: translate3d(12px, 46vh, 0); }
  100% { transform: translate3d(-10px, 96vh, 0); }
}

.amb-fly {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FFE9A8;
  box-shadow: 0 0 12px 4px rgba(255, 225, 120, .65);
  animation: flyWander var(--dur) ease-in-out infinite alternate;
  animation-delay: var(--delay);
  opacity: .3;
}
@keyframes flyWander {
  0% { transform: translate3d(0, 0, 0) scale(.8); opacity: .2; }
  50% { opacity: 1; }
  100% { transform: translate3d(18px, -22px, 0) scale(1.1); opacity: .35; }
}

/* ---------------- 提示条 / 关卡提示 ---------------- */
.toast {
  position: absolute;
  z-index: 8;
  top: calc(env(safe-area-inset-top, 0px) + 78px);
  left: 50%;
  transform: translate(-50%, -8px);
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 40px);
  padding: 9px 14px;
  border-radius: 99px;
  background: rgba(40, 30, 22, .84);
  color: #FFF8EC;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(40, 25, 15, .22);
}
.toast .mp-icon { width: 16px; height: 16px; flex: none; color: #FFE08B; }
.toast.show { animation: toastIn 1.9s ease forwards; }
@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, -10px) scale(.96); }
  12%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -5px) scale(.99); }
}

.level-flash {
  position: absolute;
  z-index: 7;
  top: 24%;
  left: 50%;
  transform: translate(-50%, -10px);
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 99px;
  background: rgba(44, 32, 23, .72);
  color: #FFF8EC;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 8px 20px rgba(40, 25, 15, .18);
}
.level-flash b { font-size: 16px; font-weight: 900; color: #FFE08B; }
.level-flash.show { animation: flashInOut 1.5s ease forwards; }
@keyframes flashInOut {
  0% { opacity: 0; transform: translate(-50%, -14px) scale(.92); }
  15%, 70% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -8px) scale(.98); }
}

/* ---------------- 底部操作区 ---------------- */
.dock {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  margin-top: -22px;
  padding: 13px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-radius: 27px 27px 0 0;
  background: linear-gradient(180deg, #FFFCF6 0%, #FFF9F0 100%);
  box-shadow: 0 -10px 26px rgba(70, 45, 25, .12), inset 0 1px 0 #fff;
}

.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 4px 9px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .3px;
  color: #3A2E24;
  white-space: nowrap;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(160deg, #EAF2FF, #D9E8FF);
  color: var(--blue);
  transform: rotate(-6deg);
  box-shadow: inset 0 1px 0 #fff;
}
.brand-mark .mp-icon { width: 15px; height: 15px; }

.tray-tip {
  max-width: 60%;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  color: #A18D79;
  text-align: right;
  transition: color .2s ease;
}

.tray {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.item-card {
  position: relative;
  height: clamp(76px, 10.4vh, 90px);
  padding: 7px 2px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  border-radius: 18px;
  background: #FFFFFF;
  border: 1.5px solid #EEE1CF;
  box-shadow: 0 3px 0 #E8DAC6, 0 5px 10px rgba(90, 65, 40, .05);
  color: var(--ink-2);
  cursor: grab;
  touch-action: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, opacity .24s ease;
}

.item-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 58%);
  pointer-events: none;
}

.item-hold {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
}

.item-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.item-name {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  color: #6C5948;
  white-space: nowrap;
}

.item-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(61, 126, 255, .16), 0 3px 0 #C9DDFF;
  transform: translateY(-4px);
}
.item-card.selected .item-name { color: var(--blue-deep); }

.item-card.lifting { opacity: .26; transform: scale(.94); }
.item-card.used {
  background: #FBF6EC;
  border-style: dashed;
  border-color: #E3D3BD;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}
.item-card.used .item-hold,
.item-card.used .item-name { opacity: 0; }
.used-mark {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #C0AB93;
}
.used-mark .mp-icon { width: 22px; height: 22px; color: #C9B69F; }
.used-mark small { font-size: 9px; font-weight: 700; letter-spacing: .2px; }
.item-card.used .used-mark { display: flex; }
.item-card:active:not(.used) {
  transform: translateY(2px) scale(.97);
  box-shadow: 0 1px 0 #E8DAC6;
}

/* 三个广告按钮 */
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 10px;
}

.act {
  position: relative;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 7px;
  overflow: hidden;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}

.act::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 3px;
  height: 43%;
  border-radius: 12px 12px 8px 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.act-ic {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.act-ic .mp-icon { width: 18px; height: 18px; color: #fff; }

.act-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.12;
}
.act-copy b {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .3px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .08);
  white-space: nowrap;
}
.act-copy small {
  font-size: 8.5px;
  font-weight: 600;
  opacity: .92;
  white-space: nowrap;
}

.act-time {
  background: linear-gradient(180deg, #86E175, #4BBE43);
  box-shadow: 0 4px 0 #339B2C, 0 7px 14px rgba(60, 170, 50, .28);
}
.act-hint {
  background: linear-gradient(180deg, #FFD166, #F2A51F);
  box-shadow: 0 4px 0 #C9820B, 0 7px 14px rgba(230, 150, 30, .28);
}
.act-skip {
  background: linear-gradient(180deg, #6CB9FF, #3D7EFF);
  box-shadow: 0 4px 0 #2B5DCC, 0 7px 14px rgba(50, 110, 230, .3);
}

.act:active { transform: translateY(3px); }
.act-time:active { box-shadow: 0 1px 0 #339B2C; }
.act-hint:active { box-shadow: 0 1px 0 #C9820B; }
.act-skip:active { box-shadow: 0 1px 0 #2B5DCC; }

/* ---------------- 拖动跟随 ---------------- */
.drag-ghost {
  position: fixed;
  z-index: 9999;
  width: 76px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  border: 2px solid var(--blue);
  box-shadow: 0 14px 28px rgba(40, 25, 15, .26), 0 0 0 5px rgba(61, 126, 255, .1);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -68%) scale(.9) rotate(-5deg);
  transition: opacity .12s ease, transform .12s ease;
  will-change: left, top, transform;
}
.drag-ghost.show { opacity: 1; transform: translate(-50%, -74%) scale(1.05) rotate(-4deg); }
.drag-ghost.return { opacity: 0; transform: translate(-50%, -60%) scale(.72); }
.drag-ghost-inner { width: 58px; height: 58px; display: grid; place-items: center; }
.drag-ghost-inner .item-art { width: 100%; height: 100%; }
body.dragging { cursor: grabbing; }

/* 配对成功粒子（悬浮在屏幕层） */
.burst {
  position: fixed;
  z-index: 9998;
  width: 0;
  height: 0;
  pointer-events: none;
}
.burst span {
  position: absolute;
  left: -7px;
  top: -7px;
  font-size: 15px;
  font-weight: 900;
  transform-origin: center;
  animation: burstOut var(--d) ease-out forwards;
  text-shadow: 0 2px 0 #fff;
}
@keyframes burstOut {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(2px) scale(.35); }
  35% { opacity: 1; transform: rotate(var(--a)) translateX(28px) scale(1.12); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(54px) scale(.9); }
}

/* ---------------- 弹窗 ---------------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: rgba(44, 31, 22, .42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: opacity .22s ease, visibility .22s;
}
.modal-layer.show { opacity: 1; visibility: visible; }

.confetti {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.confetti span {
  position: absolute;
  top: -24px;
  width: 9px;
  height: 14px;
  border-radius: 3px;
  background: var(--c);
  opacity: 0;
  animation: confettiFall var(--dur) ease-in var(--d) forwards;
}
@keyframes confettiFall {
  0% { opacity: 0; transform: translateY(-30px) rotate(var(--r)); }
  8% { opacity: 1; }
  100% { opacity: 0; transform: translateY(88vh) rotate(calc(var(--r) + 520deg)); }
}

.modal {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 332px;
  overflow: visible;
  padding: 34px 20px 20px;
  border-radius: 28px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF7EC 100%);
  box-shadow: 0 24px 60px rgba(35, 22, 14, .35), inset 0 0 0 1.5px rgba(255, 255, 255, .8);
  text-align: center;
  transform: scale(.88) translateY(18px);
  transition: transform .32s cubic-bezier(.2, 1.4, .4, 1);
}
.modal-layer.show .modal { transform: scale(1) translateY(0); }

.modal::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 22px;
  border: 1.5px dashed rgba(198, 168, 128, .34);
  pointer-events: none;
}

.modal-badge {
  position: absolute;
  z-index: 3;
  top: -38px;
  left: 50%;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 4px solid #FFFDF8;
  transform: translateX(-50%);
  box-shadow: 0 9px 22px rgba(140, 90, 25, .24);
}
.modal-badge .mp-icon { width: 37px; height: 37px; color: #fff; }
.badge-win { background: linear-gradient(160deg, #FFDE8A, #FFAE1F); }
.badge-all { background: linear-gradient(160deg, #FFB3D0, #FF7AA2); }
.badge-fail { background: linear-gradient(160deg, #9CC8FF, #5D9BF5); }
.badge-hint { background: linear-gradient(160deg, #FFE39A, #F5A623); }

.modal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 4px 10px;
  border-radius: 99px;
  background: #FFF0D8;
  color: #B08A5B;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}
.modal-kicker .mp-icon { width: 13px; height: 13px; color: #E5A03B; }

.modal h2 {
  margin: 10px 0 5px;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1.28;
  color: #3A2A1E;
}

.modal-sub {
  margin: 0 0 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #8E7B69;
}

.level-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 18px;
}
.ldot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: #EBDCC8;
  transition: background .2s ease, width .2s ease;
}
.ldot.done { background: #FFC94D; }
.ldot.current { width: 20px; background: var(--blue); }

.btn-primary {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 16px;
  background: linear-gradient(180deg, #6BA5FF, #3D7EFF);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .3px;
  cursor: pointer;
  box-shadow: 0 4px 0 #285AC4, 0 9px 16px rgba(50, 100, 220, .28);
  transition: transform .1s ease, box-shadow .1s ease;
}
.btn-primary .mp-icon { width: 18px; height: 18px; color: #fff; }
.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #285AC4;
}

.modal-close {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #F4EADB;
  color: #9C8977;
  cursor: pointer;
}
.modal-close .mp-icon { width: 16px; height: 16px; }

/* 提示弹窗 */
.hint-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px 0 18px;
  padding: 10px 8px 12px;
  border-radius: 20px;
  border: 1.5px dashed #EAD1A9;
  background: #FFF6E7;
}

.hint-baby {
  width: 62px;
  height: 78px;
  flex: none;
  filter: drop-shadow(0 4px 5px rgba(90, 60, 30, .13));
}
.hint-baby svg { display: block; width: 100%; height: 100%; }

.hint-arrow {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #FFE7B0;
  color: #D08A17;
}
.hint-arrow .mp-icon { width: 16px; height: 16px; }

.hint-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.hint-item-art {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1.5px solid #F0DFC6;
  background: #fff;
  box-shadow: 0 3px 0 #EFE2CD;
}
.hint-item-art .item-art { width: 44px; height: 44px; }
.hint-item b { font-size: 12px; font-weight: 800; color: #6C5948; }

/* 时间到屏幕轻微震动 */
.app.time-up { animation: screenShake .45s ease; }
@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-6px); }
  38% { transform: translateX(5px); }
  58% { transform: translateX(-4px); }
  78% { transform: translateX(2px); }
}

/* ---------------- 小屏适配 ---------------- */
@media (max-height: 700px) {
  .dock { padding-top: 10px; }
  .tray-head { padding-bottom: 7px; }
  .brand { font-size: 13px; }
  .brand-mark { width: 22px; height: 22px; }
  .item-card { height: 74px; border-radius: 16px; }
  .item-hold { width: 40px; height: 40px; }
  .item-name { font-size: 9.5px; }
  .actions { margin-top: 8px; gap: 8px; }
  .act { height: 52px; border-radius: 14px; }
  .act-ic { width: 23px; height: 23px; }
  .act-ic .mp-icon { width: 16px; height: 16px; }
  .act-copy b { font-size: 13px; }
  .act-copy small { font-size: 7.5px; }
  .level-pill { min-width: 118px; padding: 7px 11px 8px; }
  .timer-pill { min-width: 96px; padding: 7px 11px; }
  .timer-text { font-size: 19px; }
  .toast { top: calc(env(safe-area-inset-top, 0px) + 70px); }
  .level-flash { top: 21%; }
  .modal { padding-top: 30px; }
  .modal-badge { width: 68px; height: 68px; top: -33px; }
  .modal-badge .mp-icon { width: 32px; height: 32px; }
  .modal h2 { font-size: 21px; }
}

@media (max-width: 360px) {
  .act-copy small { display: none; }
  .act { height: 54px; }
  .tray-tip { font-size: 9.5px; }
  .item-name { font-size: 9.5px; }
  .level-pill { min-width: 108px; }
  .timer-pill { min-width: 92px; }
  .timer-text { font-size: 18px; }
}

/* 尊重系统减少动效设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
