:root {
  --orange: #FF8A3D;
  --orange-deep: #F26B1D;
  --gold: #FFC93C;
  --gold-deep: #E89A12;
  --cream: #FFF7E3;
  --cream-2: #FFEDC4;
  --wood: #B97843;
  --wood-2: #8E552B;
  --wood-3: #6B3C1B;
  --brown: #5E3517;
  --brown-2: #7B4A22;
  --green: #7DC84A;
  --green-deep: #4E9E28;
  --sky: #8FD4F5;
  --ink: #4A2A12;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --dock-h: max(136px, 20vh);
  --bar-h: calc(64px + var(--sab));
  --radius: 18px;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: #20351c;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
  color: var(--ink);
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #8FD4F5;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ---------- 牧场场景 ---------- */
.world {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.world-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 46%;
  transform: scale(1.012);
}

.world-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 55% at 50% 38%, rgba(255, 236, 170, 0.16) 0%, rgba(255, 236, 170, 0) 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 30%);
  pointer-events: none;
}

.veil {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.veil-top {
  top: 0;
  height: 250px;
  background: linear-gradient(180deg, rgba(108, 195, 238, 0.72) 0%, rgba(146, 213, 245, 0.4) 52%, rgba(172, 225, 248, 0) 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 100%);
}

.veil-bottom {
  bottom: 0;
  height: 48vh;
  background: linear-gradient(180deg, rgba(58, 100, 40, 0) 0%, rgba(58, 100, 40, 0.1) 45%, rgba(52, 84, 32, 0.28) 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 100%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* ---------- 顶部玩家栏 ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: calc(9px + var(--sat)) 13px 0;
  pointer-events: none;
}

.hud::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(86px + var(--sat));
  z-index: -1;
  background: linear-gradient(180deg, rgba(16, 63, 98, 0.42) 0%, rgba(16, 63, 98, 0.2) 52%, rgba(16, 63, 98, 0) 100%);
  border-radius: 0 0 26px 26px;
  pointer-events: none;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.avatar-frame {
  position: relative;
  width: 53px;
  height: 53px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #BFE3FA;
  border: 2.5px solid #FFFDF5;
  box-shadow:
    0 3px 0 rgba(52, 83, 110, 0.35),
    0 7px 14px rgba(30, 70, 100, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.avatar-default {
  position: absolute;
  inset: 0;
  background-image: url("images/pets/avatar.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 -10px 14px rgba(20, 50, 80, 0.24), inset 0 2px 4px rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.avatar-frame:active { transform: scale(0.95); }

.player-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.lv-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  padding: 2px 8px 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6EA3D8 0%, #3F6FA6 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.76);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1px;
  box-shadow: 0 2px 0 rgba(28, 66, 104, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 1px rgba(20, 50, 80, 0.45);
}

.lv-pill b { font-size: 13px; }

.player-name {
  display: block;
  max-width: 84px;
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(15, 55, 85, 0.75);
}

.exp-track {
  display: block;
  width: 84px;
  height: 7px;
  margin-top: 3px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(28, 60, 88, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 2px rgba(15, 40, 60, 0.35);
}

.exp-fill {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(180deg, #FFE473 0%, #FFB31F 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: width 0.35s ease;
}

.currencies {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  pointer-events: auto;
}

.currency {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 35px;
  padding: 3px 9px 3px 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(76, 109, 145, 0.96) 0%, rgba(40, 69, 100, 0.97) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.44);
  color: #fff;
  box-shadow:
    0 3px 0 rgba(25, 52, 80, 0.4),
    0 6px 12px rgba(20, 50, 75, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.currency:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(25, 52, 80, 0.4); }

.coin-ico,
.gem-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 12px;
}

.coin-ico {
  color: #9A5B00;
  background: radial-gradient(circle at 34% 26%, #FFF8C4 0%, #FFD84E 42%, #F7A816 100%);
  border: 1.5px solid #FFE98C;
  box-shadow: inset 0 -2px 0 rgba(154, 91, 0, 0.28), 0 1px 2px rgba(0, 0, 0, 0.18);
}

.gem-ico {
  color: #FFF1FF;
  background: radial-gradient(circle at 32% 24%, #FFC7F4 0%, #F05FC9 46%, #C22E9A 100%);
  border: 1.5px solid #FFC7F4;
  box-shadow: inset 0 -2px 0 rgba(120, 15, 95, 0.28), 0 1px 2px rgba(0, 0, 0, 0.18);
}

.coin-ico .mp-icon { width: 16px; height: 16px; }
.gem-ico .mp-icon { width: 15px; height: 15px; }

.cur-num {
  display: block;
  max-width: 60px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1px;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
}

.currency.pop { animation: coinPop 0.28s ease; }
@keyframes coinPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ---------- 繁育目标卡 ---------- */
.goal-card {
  position: absolute;
  top: calc(10.7vh + var(--sat));
  left: 13px;
  right: 13px;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 9px;
  height: clamp(62px, 8.8vh, 82px);
  padding: 0 10px 0 9px;
  border-radius: 17px;
  background: linear-gradient(180deg, #FFFDF2 0%, #FFF0CE 100%);
  border: 2px solid #E9B965;
  box-shadow:
    0 4px 0 rgba(150, 97, 35, 0.3),
    0 8px 16px rgba(89, 58, 18, 0.16),
    inset 0 1px 0 #fff;
}

.goal-ico {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #8A4E05;
  background: linear-gradient(180deg, #FFDF8A 0%, #FFB63C 100%);
  border: 1.5px solid #F3CB70;
  box-shadow: inset 0 -2px 0 rgba(168, 98, 8, 0.22), 0 2px 4px rgba(150, 97, 35, 0.18);
}

.goal-ico .mp-icon { width: 23px; height: 23px; }

.goal-main { flex: 1; min-width: 0; }

.goal-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.goal-title {
  font-size: 13px;
  font-weight: 800;
  color: #6A3A10;
  letter-spacing: 0.2px;
}

.goal-num {
  font-size: 11.5px;
  font-weight: 800;
  color: #9B6828;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(226, 180, 100, 0.28);
}

.goal-track {
  height: 9px;
  margin-top: 5px;
  border-radius: 7px;
  overflow: hidden;
  background: #E8D2A8;
  border: 1px solid #D9B77A;
  box-shadow: inset 0 1px 2px rgba(120, 79, 20, 0.22);
}

.goal-fill {
  display: block;
  width: 33.3%;
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(180deg, #B4EE7A 0%, #6FC237 55%, #50A525 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: width 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.goal-reward {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: #D18A16;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #FFF6C9, #FFD567);
  border: 1.5px solid #EBBF5A;
  box-shadow: 0 2px 4px rgba(150, 97, 35, 0.2);
}

.goal-reward .mp-icon { width: 17px; height: 17px; }

.goal-card.complete {
  animation: goalFlash 0.6s ease 2;
  border-color: #FFD258;
}
@keyframes goalFlash {
  50% { box-shadow: 0 0 0 5px rgba(255, 212, 88, 0.55), 0 4px 0 rgba(150, 97, 35, 0.3); }
}

/* ---------- 抚摸层 ---------- */
.tap-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: 150px;
  bottom: calc(var(--bar-h) + var(--dock-h) - 4px);
  z-index: 12;
  outline: none;
  cursor: pointer;
}

.tap-layer:active .tap-hint { transform: scale(0.96); }

.tap-hint {
  position: absolute;
  left: 16px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px 6px 8px;
  border-radius: 999px;
  background: rgba(46, 74, 38, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 3px 8px rgba(20, 40, 15, 0.25);
  color: #FFFBE9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 0.4s ease, transform 0.15s ease;
}

.tap-hint .mp-icon { width: 16px; height: 16px; color: #FFE27D; }
.tap-hint.hide { opacity: 0; transform: translateY(6px); pointer-events: none; }

.tap-ripple {
  position: absolute;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 234, 140, 0.9);
  background: radial-gradient(circle, rgba(255, 249, 207, 0.65) 0%, rgba(255, 232, 130, 0) 70%);
  pointer-events: none;
  animation: tapRipple 0.55s ease-out forwards;
}

@keyframes tapRipple {
  from { transform: scale(0.35); opacity: 1; }
  to { transform: scale(1.35); opacity: 0; }
}

/* ---------- 浮动金币 ---------- */
.float-layer {
  position: absolute;
  inset: 0;
  z-index: 42;
  pointer-events: none;
  overflow: hidden;
}

.float-coin {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px 4px 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 252, 223, 0.98), rgba(255, 222, 116, 0.98));
  border: 1.5px solid #F6C045;
  box-shadow: 0 2px 6px rgba(101, 64, 12, 0.28);
  color: #9B5D08;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  animation: floatUp 0.95s cubic-bezier(0.15, 0.65, 0.3, 1) forwards;
}

.float-coin .mp-icon { width: 14px; height: 14px; }
.float-coin.spark { color: #E2478F; border-color: #FFB3D8; background: linear-gradient(180deg, #FFF4FA, #FFD7EB); }

@keyframes floatUp {
  0% { transform: translate(-50%, -50%) scale(0.55); opacity: 0; }
  18% { transform: translate(-50%, -66%) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -180%) scale(0.92); opacity: 0; }
}

/* ---------- 升级面板 ---------- */
.upgrade-card {
  position: absolute;
  right: 0;
  top: 46vh;
  z-index: 26;
  width: 178px;
  height: clamp(136px, 22vh, 230px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 9px 12px 10px 9px;
  border-radius: 19px 9px 9px 19px;
  background:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.045) 0 2px, rgba(0, 0, 0, 0.035) 2px 6px),
    linear-gradient(180deg, #B97C46 0%, #93602F 55%, #7B4A22 100%);
  border: 2px solid #E8B56C;
  box-shadow:
    0 5px 0 rgba(66, 38, 13, 0.38),
    0 12px 20px rgba(50, 28, 8, 0.24),
    0 22px 26px -8px rgba(46, 27, 8, 0.42),
    6px 4px 18px rgba(50, 28, 8, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.upgrade-card::after {
  content: "";
  position: absolute;
  left: 4%;
  right: -1px;
  bottom: -31px;
  height: 36px;
  z-index: -1;
  border-radius: 0 0 48% 48%;
  background: radial-gradient(ellipse at 52% 8%, rgba(62, 38, 14, 0.58) 0%, rgba(62, 38, 14, 0.3) 46%, rgba(62, 38, 14, 0) 78%);
  filter: blur(2px);
  pointer-events: none;
}

.up-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 0 0 auto;
}

.up-portrait {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #FFE7B0;
  background: #D9C29B;
  box-shadow: 0 2px 4px rgba(50, 28, 8, 0.28);
}

.up-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.up-meta { flex: 1; min-width: 0; }

.up-name-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.up-name-row b {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #FFF8E7;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(50, 28, 8, 0.4);
}

.up-lv {
  flex: 0 0 auto;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(46, 26, 9, 0.32);
  color: #FFDF95;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 15px;
}

.up-rate {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  color: #FFE0A2;
  font-size: 9.5px;
  font-weight: 700;
  opacity: 0.95;
}

.up-rate .mp-icon { width: 12px; height: 12px; }

.up-next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
  margin-top: 5px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: rgba(47, 25, 7, 0.22);
  border: 1px solid rgba(255, 227, 168, 0.16);
  color: #FFE6B5;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.up-next .mp-icon { width: 12px; height: 12px; color: #FFD45E; }
.up-next b { color: #A8F078; font-size: 10.5px; font-weight: 900; }

.up-badge {
  position: absolute;
  right: 4px;
  top: 34px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: linear-gradient(180deg, #C6F58F 0%, #75C93E 55%, #4E9E22 100%);
  border: 2px solid #F0FFD8;
  color: #2E690B;
  box-shadow:
    0 2px 0 rgba(48, 93, 14, 0.6),
    0 4px 9px rgba(35, 70, 8, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.up-badge:active { transform: translateY(2px) scale(0.95); }
.up-badge .mp-icon { width: 19px; height: 19px; }

.up-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 47px;
  min-height: 44px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFD766 0%, #FFB532 48%, #F28A12 100%);
  border: 2px solid #FFEBA0;
  box-shadow:
    0 3px 0 #B25F08,
    0 5px 10px rgba(70, 38, 5, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  color: #7A3F00;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.up-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #B25F08, 0 2px 5px rgba(70, 38, 5, 0.3), inset 0 2px 4px rgba(160, 90, 0, 0.25);
}

.up-btn-arrow {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFF7D4, #FFD75F);
  border: 1px solid #FFF0B0;
  box-shadow: 0 1px 2px rgba(130, 75, 0, 0.25), inset 0 -1px 0 rgba(190, 120, 0, 0.2);
}

.up-btn-arrow .mp-icon { width: 17px; height: 17px; }
.up-btn-label { font-size: 19px; font-weight: 900; letter-spacing: 1.5px; text-shadow: 0 1px 0 rgba(255, 244, 198, 0.7); }

.up-cost {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px 2px 4px;
  border-radius: 999px;
  background: rgba(105, 58, 0, 0.17);
  color: #7B4300;
  font-size: 10.5px;
  font-weight: 900;
}

.up-cost .mp-icon { width: 12px; height: 12px; color: #9C5A00; }

.up-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 14px;
  color: #FFE4AC;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.up-foot .mp-icon { width: 10px; height: 10px; color: #FFB6EA; }

.up-btn.cant {
  filter: saturate(0.72) brightness(0.97);
  background: linear-gradient(180deg, #F7D78C 0%, #EFBE58 48%, #D99A2C 100%);
}

.up-btn.maxed {
  background: linear-gradient(180deg, #C9F1A1 0%, #8ED45A 48%, #5EA92C 100%);
  border-color: #E8FFC8;
  color: #2F600C;
  box-shadow:
    0 3px 0 #3F7A17,
    0 5px 10px rgba(35, 64, 5, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.up-btn.maxed .up-cost { display: none; }
.up-btn.maxed .up-btn-arrow {
  background: linear-gradient(180deg, #F2FFD9, #B8E97E);
  border-color: #E2FFC0;
}

.up-btn.shake { animation: btnShake 0.4s ease; }
@keyframes btnShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.up-shine {
  position: absolute;
  left: -40%;
  bottom: 10px;
  width: 30%;
  height: 47px;
  transform: skewX(-22deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
  animation: upShine 4.6s ease-in-out infinite;
}

@keyframes upShine {
  0%, 65% { left: -45%; opacity: 0; }
  72% { opacity: 1; }
  92%, 100% { left: 125%; opacity: 0; }
}

/* ---------- 牧场宠物栏 ---------- */
.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--bar-h);
  z-index: 24;
  height: var(--dock-h);
  padding: 7px 12px 9px;
  border-radius: 20px 20px 0 0;
  background:
    repeating-linear-gradient(93deg, rgba(255, 255, 255, 0.05) 0 3px, rgba(0, 0, 0, 0.04) 3px 9px),
    linear-gradient(180deg, #D19B5F 0%, #B4763F 18%, #96592D 100%);
  border-top: 2.5px solid #F0C88A;
  box-shadow:
    0 -5px 16px rgba(57, 34, 12, 0.26),
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 -20px 30px rgba(82, 45, 15, 0.2);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dock::before,
.dock::after {
  content: "";
  position: absolute;
  top: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F3CE93, #B97B43);
  box-shadow: 0 1px 2px rgba(60, 35, 10, 0.3);
}
.dock::before { left: 9px; }
.dock::after { right: 9px; }

.dock-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 17px;
  padding: 0 3px;
  color: #FFF2D4;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 1px rgba(70, 40, 12, 0.5);
}

.dock-title-l { display: inline-flex; align-items: center; gap: 3px; }
.dock-title-l .mp-icon { width: 13px; height: 13px; color: #FFE19A; }
#dockCap { color: #FFE19A; font-size: 10px; opacity: 0.95; }

.dock-scroll {
  display: flex;
  align-items: stretch;
  gap: 7px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 2px 3px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.dock-scroll::-webkit-scrollbar { display: none; }

.dock-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 17px;
  padding: 0 3px;
  flex: 0 0 auto;
  color: #FFEDC6;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 1px rgba(70, 40, 12, 0.5);
}

.dock-rate, .dock-tip { display: inline-flex; align-items: center; gap: 2px; }
.dock-rate .mp-icon, .dock-tip .mp-icon { width: 11px; height: 11px; color: #FFE19A; }
.dock-rate b { color: #C8F58E; font-size: 10px; font-weight: 900; }
.dock-tip { opacity: 0.72; font-size: 8px; }

.pet-tile {
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  min-width: 0;
  padding: 4px 4px 3px;
  border-radius: 12px;
  background: linear-gradient(180deg, #FFF9E9 0%, #FFE9C1 100%);
  border: 2px solid #E1B16D;
  box-shadow: 0 2px 0 rgba(80, 46, 14, 0.28), inset 0 1px 0 #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  scroll-snap-align: start;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.pet-tile:active { transform: translateY(1px) scale(0.97); }

.pet-tile.active {
  border-color: #FFD45E;
  background: linear-gradient(180deg, #FFFDF2 0%, #FFE7A6 100%);
  box-shadow:
    0 0 0 2px #FFB52E,
    0 3px 0 rgba(80, 46, 14, 0.28),
    0 0 14px rgba(255, 195, 60, 0.65),
    inset 0 1px 0 #fff;
}

.pet-tile.active::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #FFD45E;
  filter: drop-shadow(0 1px 0 rgba(130, 78, 10, 0.45));
}

.pet-face {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: #CBE6F5;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), inset 0 -6px 9px rgba(80, 50, 20, 0.12);
}

.pet-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pet-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 55%, rgba(73, 43, 16, 0.16) 100%);
  pointer-events: none;
}

.pet-lv {
  position: absolute;
  left: 2px;
  bottom: 2px;
  z-index: 2;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(61, 37, 14, 0.8);
  color: #FFF4D8;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 13px;
  letter-spacing: 0.1px;
}

.pet-tile .mini-up {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(180deg, #B8EF7C, #5FB92B);
  border: 1px solid #E5FFC1;
  color: #2F6B0C;
  box-shadow: 0 1px 2px rgba(40, 70, 10, 0.3);
}

.pet-tile .mini-up .mp-icon { width: 10px; height: 10px; }

.pet-name {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #6B3D13;
  font-size: 8px;
  font-weight: 700;
  line-height: 10px;
}

.pet-tile.rare .pet-face { box-shadow: inset 0 0 0 1.5px #FFB800, 0 0 10px rgba(255, 190, 30, 0.8); }

.pet-add {
  flex: 0 0 auto;
  width: 66px;
  border-radius: 12px;
  border: 2px dashed rgba(255, 241, 208, 0.66);
  background: rgba(87, 50, 20, 0.22);
  box-shadow: inset 0 2px 5px rgba(50, 28, 8, 0.16);
  color: #FFF0CE;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.pet-add:active { background: rgba(87, 50, 20, 0.34); transform: scale(0.97); }
.pet-add .mp-icon { width: 21px; height: 21px; }
.pet-add b { font-size: 9px; font-weight: 800; }
.pet-add span { font-size: 7.5px; opacity: 0.8; }

/* ---------- 底部操作栏 ---------- */
.actionbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: var(--bar-h);
  padding: 0 26px var(--sab);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:
    linear-gradient(180deg, #7E4A23 0%, #643718 60%, #552C11 100%);
  border-top: 2px solid #C58C50;
  box-shadow: 0 -4px 14px rgba(40, 22, 6, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.actionbar::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 3px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 224, 168, 0.45), transparent);
}

.act {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 62px;
  height: 56px;
  color: #FFE8BD;
}

.act:active { transform: translateY(1px) scale(0.94); }

.act-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #B98147 0%, #8B5428 100%);
  border: 1.5px solid #D9A76B;
  box-shadow: 0 2px 0 rgba(35, 19, 5, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #FFE7B6;
}

.act-ico .mp-icon { width: 20px; height: 20px; }

.act-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 11px;
  text-shadow: 0 1px 1px rgba(30, 15, 3, 0.6);
}

.act-main {
  width: 78px;
  height: 62px;
  margin-top: -14px;
  gap: 0;
  color: #6B3A00;
}

.act-main-ico {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, #FFF2A8 0%, #FFD44D 42%, #F5A212 100%);
  border: 2.5px solid #FFF0AF;
  box-shadow:
    0 0 0 3px rgba(119, 68, 15, 0.55),
    0 4px 0 rgba(80, 45, 8, 0.45),
    0 6px 14px rgba(40, 22, 4, 0.4),
    inset 0 -3px 0 rgba(177, 100, 6, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.65);
  color: #8B4A00;
}

.act-main:active .act-main-ico {
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 0 0 3px rgba(119, 68, 15, 0.55), 0 1px 0 rgba(80, 45, 8, 0.45), inset 0 -2px 0 rgba(177, 100, 6, 0.35);
}

.act-main-ico .mp-icon { width: 29px; height: 29px; }

.act-main .act-label {
  color: #FFDFA1;
  font-size: 9px;
  margin-top: 1px;
}

.gem-tag {
  position: absolute;
  top: -3px;
  right: 2px;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 1px 5px 1px 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FF9BE0, #E63FB8);
  border: 1px solid #FFD4F1;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  box-shadow: 0 1px 3px rgba(97, 12, 76, 0.4);
}

.gem-tag .mp-icon { width: 9px; height: 9px; }

/* ---------- 提示 ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: 37%;
  z-index: 55;
  max-width: 78%;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(68, 40, 16, 0.92);
  border: 1.5px solid rgba(255, 219, 148, 0.55);
  box-shadow: 0 6px 18px rgba(30, 15, 3, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #FFF4D9;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- 孵化弹层 ---------- */
.hatch {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(38, 21, 6, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hatch.on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hatch-card {
  position: relative;
  width: min(286px, 100%);
  padding: 20px 20px 17px;
  border-radius: 25px;
  text-align: center;
  background:
    radial-gradient(120% 80% at 50% 0%, #FFFDF4 0%, rgba(255, 253, 244, 0) 55%),
    linear-gradient(180deg, #FFF9E7 0%, #FFE9B8 60%, #FFD98A 100%);
  border: 3px solid #F6C75D;
  box-shadow:
    0 16px 0 rgba(84, 48, 10, 0.3),
    0 24px 40px rgba(30, 15, 3, 0.4),
    inset 0 2px 0 #fff,
    inset 0 -6px 16px rgba(191, 124, 27, 0.16);
  transform: scale(0.82) translateY(14px);
  transition: transform 0.36s cubic-bezier(0.18, 1.3, 0.4, 1);
}

.hatch.on .hatch-card { transform: scale(1) translateY(0); }

.hatch-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 19px;
  border: 1.5px dashed rgba(202, 145, 45, 0.35);
  pointer-events: none;
}

.hatch-portrait {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #FFFCF1;
  background: #D5E8F5;
  box-shadow:
    0 0 0 3px #F5B93F,
    0 8px 16px rgba(121, 71, 12, 0.26),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.hatch-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hatch-title {
  color: #9A5A08;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
}

.hatch-name {
  margin-top: 2px;
  color: #62350D;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hatch-desc {
  margin-top: 4px;
  color: #9A6B2D;
  font-size: 11.5px;
  font-weight: 700;
}

.hatch-btn {
  position: relative;
  width: 100%;
  height: 45px;
  margin-top: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFD563 0%, #FFAD2A 55%, #F0830C 100%);
  border: 2px solid #FFEBA2;
  box-shadow: 0 3px 0 #AD5B06, inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: #783E00;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
}

.hatch-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #AD5B06, inset 0 2px 4px rgba(150, 80, 0, 0.2);
}

.hatch-spark {
  position: absolute;
  color: #F2B323;
  filter: drop-shadow(0 2px 3px rgba(160, 100, 0, 0.25));
  animation: sparkFloat 2.4s ease-in-out infinite;
}

.hatch-spark .mp-icon { width: 24px; height: 24px; }
.hatch-spark-a { top: 24px; left: 26px; }
.hatch-spark-b { top: 46px; right: 24px; animation-delay: 0.7s; }
.hatch-spark-b .mp-icon { width: 19px; height: 19px; }

@keyframes sparkFloat {
  0%, 100% { transform: translateY(0) rotate(-6deg); opacity: 0.85; }
  50% { transform: translateY(-6px) rotate(8deg); opacity: 1; }
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 360px) {
  .upgrade-card { width: 164px; }
  .avatar-frame { width: 47px; height: 47px; }
  .player-name { max-width: 68px; font-size: 10px; }
  .exp-track { width: 70px; }
  .currency { height: 32px; padding-right: 7px; }
  .coin-ico, .gem-ico { width: 23px; height: 23px; }
  .cur-num { font-size: 11.5px; max-width: 48px; }
  .goal-title { font-size: 12px; }
  .dock { padding-left: 9px; padding-right: 9px; }
}

@media (min-width: 481px) {
  body { background: radial-gradient(circle at 50% 35%, #3E5B33 0%, #1B2917 80%); }
  .app {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 70px rgba(0, 0, 0, 0.5);
  }
}

@media (max-height: 600px) {
  :root {
    --bar-h: calc(58px + var(--sab));
    --dock-h: max(124px, 22vh);
  }
  .upgrade-card {
    top: 43vh;
    width: 158px;
    height: 140px;
    padding: 7px;
  }
  .up-next, .up-foot { display: none; }
  .up-btn { height: 47px; min-height: 44px; }
  .up-portrait { width: 32px; height: 32px; }
  .up-name-row b { font-size: 11px; }
  .up-rate { font-size: 9px; }
  .up-badge { right: 3px; top: 27px; width: 28px; height: 28px; }
  .up-badge .mp-icon { width: 17px; height: 17px; }
  .dock-tip { display: none; }
  .actionbar { padding-left: 18px; padding-right: 18px; }
  .act { width: 56px; height: 52px; }
  .act-ico { width: 33px; height: 33px; }
  .act-main { width: 72px; height: 58px; margin-top: -12px; }
  .act-main-ico { width: 50px; height: 50px; }
  .act-main-ico .mp-icon { width: 26px; height: 26px; }
  .act-label { font-size: 8.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .world-art,
  .up-shine,
  .hatch-spark { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
