/* ============ 休闲2 · 农场收菜 ============ */
:root {
  --orange: #FF8A3D;
  --orange-deep: #EE6C1B;
  --orange-dark: #B44B0E;
  --gold: #FFC53D;
  --gold-soft: #FFE08A;
  --cream: #FFF8EA;
  --cream-2: #FFEAC9;
  --brown: #5A3A1C;
  --brown-2: #7A4C24;
  --ink: #3E2A16;
  --muted: #9A7A55;
  --green: #63B33B;
  --green-deep: #367A21;
  --shadow: 0 8px 20px rgba(24, 14, 2, .28);
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at 50% 8%, #4a7133 0%, #2d4720 46%, #16240e 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.game {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #3d6426;
  box-shadow: 0 0 60px rgba(0, 0, 0, .55);
}

/* ---------- 农场场景 ---------- */
.scene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("images/gen/scene.jpg");
  background-position: 50% 40%;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.015);
  filter: saturate(1.04) contrast(1.015);
}

.sunbeam {
  position: absolute;
  z-index: 1;
  top: -130px;
  right: -90px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 235, 168, .40) 0%, rgba(255, 216, 128, .13) 48%, transparent 72%);
}

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(20, 40, 10, .36) 0%,
      rgba(20, 40, 10, .12) 17%,
      rgba(20, 40, 10, 0) 34%,
      rgba(20, 40, 10, 0) 56%,
      rgba(22, 17, 4, .18) 72%,
      rgba(19, 18, 3, .58) 100%),
    radial-gradient(125% 78% at 50% 34%, transparent 54%, rgba(11, 22, 4, .32) 100%);
}

.floaties {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.floaties i {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 10px;
  border-radius: 55% 45% 60% 40%;
  background: linear-gradient(160deg, #FFE99A, #FFC466);
  opacity: 0;
  filter: blur(.2px);
  animation: petalFall linear infinite;
}

.floaties i:nth-child(2n) {
  width: 7px;
  height: 7px;
  background: linear-gradient(160deg, #D7F29C, #8ACB53);
  border-radius: 60% 40% 55% 45%;
}

.floaties i:nth-child(3n) {
  width: 5px;
  height: 5px;
  background: #FFF6D4;
  border-radius: 50%;
}

/* ---------- 顶部 HUD ---------- */
.hud {
  position: relative;
  z-index: 7;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.player {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 50px;
  padding: 4px 12px 4px 4px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 252, 243, .98) 0%, rgba(255, 237, 208, .95) 100%);
  border: 2px solid rgba(255, 255, 255, .86);
  box-shadow:
    0 5px 14px rgba(27, 20, 5, .26),
    inset 0 -2px 0 rgba(196, 137, 67, .20),
    inset 0 2px 0 rgba(255, 255, 255, .92);
}

.avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #FFD9A3;
  background-image: url("images/gen/avatar.png");
  background-position: 50% 34%;
  background-size: 122%;
  border: 2px solid #FFD18C;
  box-shadow:
    0 2px 6px rgba(83, 45, 8, .32),
    inset 0 0 0 2px rgba(255, 255, 255, .52);
}

.online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(180deg, #9CE15E, #58A82D);
  border: 2px solid #FFF8E9;
  box-shadow: 0 1px 3px rgba(40, 70, 10, .4);
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  line-height: 1;
}

.nick {
  display: block;
  max-width: 80px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 800;
  color: #6B4A2A;
  letter-spacing: .1px;
}

.level {
  flex: 0 0 auto;
  font-size: 8.5px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #FFAE50 0%, #F0771B 100%);
  padding: 2px 5px;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 1px 2px rgba(140, 65, 0, .25);
  letter-spacing: .1px;
  line-height: 1.15;
}

.xp {
  width: 82px;
  height: 6px;
  border-radius: 99px;
  background: #E7D0AF;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(90, 50, 10, .25);
}

.xp i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFCE58 0%, #FF8A3D 100%);
  box-shadow: 0 0 6px rgba(255, 160, 60, .7);
  transition: width .45s cubic-bezier(.2, .8, .3, 1);
}

.wallet {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(255, 251, 240, .98) 0%, rgba(255, 232, 192, .95) 100%);
  border: 2px solid rgba(255, 255, 255, .84);
  box-shadow:
    0 4px 10px rgba(27, 20, 5, .24),
    inset 0 -2px 0 rgba(193, 133, 61, .18),
    inset 0 2px 0 rgba(255, 255, 255, .8);
}

.coin-pill {
  gap: 3px;
  padding: 2px 10px 2px 3px;
}

.coin-pill .coin-ic {
  width: 27px;
  height: 27px;
  filter: drop-shadow(0 2px 2px rgba(130, 70, 0, .30));
}

.coin-pill b {
  font-size: 16px;
  font-weight: 900;
  color: #7B400D;
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.basket-pill {
  gap: 2px;
  padding: 2px 9px 2px 4px;
}

.basket-pill .basket-ic {
  width: 21px;
  height: 21px;
  filter: drop-shadow(0 1px 1px rgba(120, 70, 10, .25));
}

.basket-pill b {
  font-size: 13px;
  font-weight: 900;
  color: #7B400D;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.coin-pill.bump { animation: hudBump .32s ease-out; }
.basket-pill.bump { animation: hudBump .32s ease-out; }

/* ---------- 中景 / 成熟提示 / toast ---------- */
.stage {
  position: relative;
  z-index: 4;
  flex: 1 1 auto;
  min-height: 54px;
  display: flex;
  align-items: flex-start;
  padding: 10px 14px 0;
  pointer-events: none;
}

.ripe-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 29px;
  padding: 0 11px 0 8px;
  margin-top: 4px;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 249, 233, .97) 0%, rgba(255, 226, 173, .94) 100%);
  border: 2px solid rgba(255, 255, 255, .74);
  box-shadow:
    0 4px 10px rgba(28, 17, 4, .24),
    inset 0 1px 0 rgba(255, 255, 255, .86);
  color: #6F4519;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .4px;
  opacity: .96;
  transition: opacity .25s ease, transform .25s ease;
}

.ripe-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #C7F58A, #59A62E 70%);
  box-shadow: 0 0 7px rgba(139, 220, 82, .95);
  animation: dotPulse 1.7s ease-in-out infinite;
}

.ripe-chip b {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  color: #E56A14;
  font-variant-numeric: tabular-nums;
}

.ripe-chip.is-empty {
  opacity: .82;
  filter: saturate(.6);
}

.ripe-chip.is-empty .ripe-dot {
  background: #B9A68B;
  box-shadow: none;
  animation: none;
}

.ripe-chip.bump { animation: hudBump .32s ease-out; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translate(-50%, 10px) scale(.97);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  max-width: calc(100% - 28px);
  padding: 8px 14px;
  border-radius: 99px;
  background: rgba(255, 249, 236, .97);
  border: 2px solid rgba(255, 219, 156, .95);
  box-shadow: 0 6px 16px rgba(22, 12, 0, .28), inset 0 1px 0 #fff;
  color: #5E3C1B;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .1px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease, transform .24s cubic-bezier(.2, .9, .3, 1.2);
}

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

.toast svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: #FFA630;
}

/* ---------- 菜地 ---------- */
.field {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  padding: 0 12px;
}

.plots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.plot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.14;
  padding: 0;
  overflow: visible;
  border-radius: 16px;
  border: 2px solid rgba(79, 49, 20, .58);
  background: #5C3A1D;
  box-shadow:
    0 5px 13px rgba(15, 22, 4, .36),
    0 1px 0 rgba(255, 240, 208, .18),
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -3px 8px rgba(28, 15, 3, .38);
  color: #fff;
  transform-origin: 50% 60%;
  transition: transform .12s ease, filter .12s ease, box-shadow .3s ease, border-color .3s ease;
}

.plot:active {
  transform: scale(.955);
  filter: brightness(.95);
}

.plot .bed {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--bed);
  background-size: cover;
  background-position: 50% 48%;
  background-repeat: no-repeat;
  border-radius: 14px;
  clip-path: inset(0 round 14px);
  transform: scale(1.055);
  transition: filter .5s ease, opacity .5s ease, transform .7s ease;
}

.plot::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: 14px;
  border: 1px solid rgba(255, 238, 201, .18);
  box-shadow: inset 0 0 18px rgba(29, 18, 5, .28);
  pointer-events: none;
}

.plot > * { position: relative; z-index: 2; }

/* 成熟 */
.plot.ripe {
  border-color: #FFD36B;
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 207, .55),
    0 0 0 2px rgba(255, 168, 60, .20),
    0 5px 14px rgba(60, 28, 0, .36),
    0 0 20px rgba(255, 186, 73, .46);
  animation: ripeGlow 2.5s ease-in-out infinite;
}

.plot.ripe .bed {
  filter: saturate(1.07) contrast(1.02);
  transform: scale(1.085);
}

.ready-tag {
  position: absolute;
  z-index: 4;
  top: 5px;
  left: 5px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  padding: 0 6px 0 4px;
  border-radius: 99px;
  background: linear-gradient(180deg, #FFF3A8 0%, #FFC53D 100%);
  border: 1px solid #E29B20;
  box-shadow: 0 2px 5px rgba(80, 40, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .7);
  color: #6B3906;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1;
  white-space: nowrap;
}

.ready-tag .mp-icon {
  width: 10px;
  height: 10px;
}

.reward-tag {
  position: absolute;
  z-index: 4;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 19px;
  padding: 0 7px 0 4px;
  border-radius: 99px;
  background: rgba(40, 22, 7, .78);
  border: 1px solid rgba(255, 220, 150, .40);
  box-shadow: 0 2px 5px rgba(30, 15, 0, .3);
  color: #FFE49B;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.reward-tag svg {
  width: 10px;
  height: 10px;
}

.twinkle {
  position: absolute;
  z-index: 5;
  width: 8px;
  height: 8px;
  background: #FFF3B0;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 4px rgba(255, 210, 90, .95));
  pointer-events: none;
  animation: twinkle 1.6s ease-in-out infinite;
}

.twinkle.t1 { top: 25%; right: 10%; animation-delay: .1s; }
.twinkle.t2 { bottom: 28%; left: 10%; width: 5px; height: 5px; animation-delay: .75s; }

/* 生长中 */
.plot.growing .bed {
  filter: brightness(.52) saturate(.68) contrast(.96);
  transform: scale(1.02);
}

.plot.growing::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(85% 62% at 50% 72%, rgba(112, 74, 32, .35), transparent 70%),
    linear-gradient(180deg, rgba(26, 16, 4, .06), rgba(26, 16, 4, .30));
  pointer-events: none;
}

.timer {
  position: absolute;
  z-index: 5;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 21px;
  padding: 0 8px 0 5px;
  border-radius: 99px;
  background: linear-gradient(180deg, #FFFDF5 0%, #FFEFD2 100%);
  border: 1px solid #EBC98F;
  box-shadow: 0 2px 5px rgba(50, 28, 4, .30), inset 0 1px 0 #fff;
  color: #6A4721;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.plot[data-row="0"] .timer {
  top: -11px;
}

.timer .mp-icon {
  width: 12px;
  height: 12px;
  color: #E99422;
}

.sprout {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: 46%;
  height: auto;
  z-index: 3;
  transform-origin: 50% 92%;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .36));
  transition: transform .45s ease-out;
  will-change: transform;
}

.sprout svg {
  display: block;
  width: 100%;
  height: auto;
}

.growbar {
  position: absolute;
  z-index: 4;
  left: 9px;
  right: 9px;
  bottom: 6px;
  height: 5px;
  border-radius: 99px;
  background: rgba(18, 9, 2, .66);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .55);
  overflow: hidden;
}

.growbar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #B7E56C 0%, #FFC24A 62%, #FF8A3D 100%);
  box-shadow: 0 0 6px rgba(255, 190, 80, .65);
  transition: width .25s linear;
}

/* 空地 */
.plot.empty .bed {
  filter: brightness(.44) saturate(.42) contrast(.94);
  transform: scale(1.02);
}

.plot.empty::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(80% 64% at 50% 42%, rgba(139, 93, 44, .28), transparent 74%),
    linear-gradient(180deg, rgba(30, 18, 5, .18), rgba(24, 14, 4, .38));
  pointer-events: none;
}

.empty-wrap {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-top: 2px;
}

.seed-ring {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 231, 188, .44);
  background: radial-gradient(circle at 50% 40%, rgba(255, 217, 152, .16), rgba(255, 190, 110, 0) 72%);
  margin-bottom: 1px;
}

.seed-ring svg {
  width: 29px;
  height: 29px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35));
  animation: seedBob 3.2s ease-in-out infinite;
}

.empty-wrap b {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .8px;
  color: #FFF1D8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  line-height: 1.1;
}

.cost {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-style: normal;
  font-size: 9.5px;
  font-weight: 800;
  color: #FFD88A;
  background: rgba(30, 17, 6, .50);
  border: 1px solid rgba(255, 220, 160, .20);
  border-radius: 99px;
  padding: 1px 6px 1px 4px;
  line-height: 1.3;
  white-space: nowrap;
}

.cost svg {
  width: 10px;
  height: 10px;
}

/* ---------- 底部收获 ---------- */
.actions {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  padding: 11px 16px calc(10px + env(safe-area-inset-bottom));
}

.harvest-wrap {
  position: relative;
}

.harvest-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border-radius: 29px;
  border: 3px solid #FFF1D2;
  background: linear-gradient(180deg, #FFCB72 0%, #FFA24A 36%, #F78125 70%, #EC6A16 100%);
  box-shadow:
    0 5px 0 #B24A0C,
    0 12px 22px rgba(27, 14, 0, .38),
    inset 0 2px 0 rgba(255, 255, 255, .58),
    inset 0 -2px 0 rgba(150, 55, 0, .28);
  color: #FFF9EC;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 1.6px;
  text-shadow: 0 2px 1px rgba(133, 49, 0, .55);
  overflow: hidden;
  transition: transform .1s ease, filter .18s ease;
}

.harvest-btn::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 7%;
  right: 7%;
  height: 44%;
  border-radius: 20px 20px 50% 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.harvest-btn .shine {
  position: absolute;
  top: -60%;
  left: -35%;
  width: 26%;
  height: 220%;
  transform: rotate(22deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .46), transparent);
  opacity: 0;
  pointer-events: none;
}

.harvest-btn.has-ripe .shine {
  opacity: 1;
  animation: buttonShine 2.8s ease-in-out infinite;
}

.btn-basket {
  position: relative;
  z-index: 2;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 2px rgba(100, 44, 0, .32));
}

.btn-label {
  position: relative;
  z-index: 2;
}

.harvest-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 #B24A0C,
    0 5px 12px rgba(30, 15, 0, .32),
    inset 0 2px 0 rgba(255, 255, 255, .45);
}

.harvest-btn.waiting {
  filter: saturate(.84) brightness(.97);
}

.harvest-btn.waiting .shine {
  opacity: 0;
  animation: none;
}

.harvest-btn.has-ripe {
  animation: buttonBreathe 2.6s ease-in-out infinite;
}

.harvest-btn.has-ripe:active {
  animation: none;
  transform: translateY(4px);
}

.btn-badge {
  position: absolute;
  z-index: 3;
  top: -8px;
  right: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #FF7A66 0%, #E6362C 100%);
  border: 2px solid #FFF3D9;
  box-shadow: 0 3px 7px rgba(122, 0, 0, .34);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}

.btn-badge.hide {
  transform: scale(0);
  opacity: 0;
}

.hint {
  margin: 8px 0 0;
  text-align: center;
  color: #FFF5D9;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .5px;
  text-shadow: 0 1px 3px rgba(20, 12, 0, .7);
  opacity: .92;
}

/* ---------- 飘字 / 粒子 ---------- */
.fx {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.float-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #FFF9E8;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .5px;
  text-shadow: 0 2px 0 rgba(82, 40, 0, .55), 0 0 12px rgba(255, 200, 80, .5);
  animation: floatUp .92s cubic-bezier(.16, .8, .3, 1) forwards;
  white-space: nowrap;
}

.float-pop.gold {
  color: #FFE482;
  -webkit-text-stroke: .7px #8A4700;
  text-shadow: 0 2px 0 rgba(90, 42, 0, .55), 0 0 14px rgba(255, 190, 60, .75);
}

.spark {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFBD8, #FFC53D 62%, #FF8A3D);
  box-shadow: 0 0 7px rgba(255, 190, 70, .9);
  animation: sparkFly .7s cubic-bezier(.15, .7, .3, 1) forwards;
}

.spark.leaf {
  background: linear-gradient(180deg, #B7E56C, #5CA832);
  box-shadow: 0 0 6px rgba(120, 200, 80, .6);
  border-radius: 2px 8px 2px 8px;
}

/* ---------- 加载层 ---------- */
.loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(31, 49, 16, .44);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  transition: opacity .45s ease;
}

.loading.hide {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  width: 190px;
  padding: 21px 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFFCF2 0%, #FFEDCD 100%);
  border: 2px solid rgba(255, 255, 255, .88);
  box-shadow: 0 16px 36px rgba(12, 22, 3, .38), inset 0 2px 0 #fff;
}

.loading-sprout {
  width: 58px;
  height: 58px;
  animation: loaderBob 1.7s ease-in-out infinite;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, .2));
}

.loading-sprout svg {
  width: 100%;
  height: 100%;
}

.loading-card p {
  margin: 1px 0 0;
  color: #6E4A22;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.6px;
}

.loading-bar {
  width: 112px;
  height: 5px;
  margin-top: 1px;
  border-radius: 99px;
  background: #E9D6B6;
  overflow: hidden;
}

.loading-bar i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFD36B, #FF8A3D);
  animation: loadingSlide 1.15s ease-in-out infinite;
}

/* ---------- 结束弹层 ---------- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(12, 18, 7, .62);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: fadeIn .2s ease-out;
}

.modal[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 310px;
  padding: 23px 22px 19px;
  border-radius: 25px;
  background: linear-gradient(180deg, #FFFCF2 0%, #FFEECF 100%);
  border: 3px solid #FFC46B;
  box-shadow:
    0 20px 46px rgba(0, 0, 0, .42),
    inset 0 2px 0 #fff,
    inset 0 -3px 0 rgba(196, 137, 67, .22);
  text-align: center;
  animation: modalPop .28s cubic-bezier(.2, 1.1, .3, 1.15);
}

.modal-art {
  width: 66px;
  height: 66px;
  margin: -3px auto 7px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #FFE7A6, #FFC96A);
  border: 2px solid #FFF6DD;
  box-shadow: 0 5px 12px rgba(170, 100, 20, .26), inset 0 2px 0 rgba(255, 255, 255, .7);
}

.modal-art svg {
  width: 40px;
  height: 40px;
}

.modal-card h2 {
  margin: 0 0 7px;
  font-size: 22px;
  font-weight: 900;
  color: #5E3A17;
  letter-spacing: .5px;
}

.modal-card p {
  margin: 0 0 13px;
  font-size: 13px;
  line-height: 1.7;
  color: #9A744A;
  font-weight: 600;
}

.modal-stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 15px;
}

.modal-stats span {
  flex: 1 1 0;
  padding: 7px 4px;
  border-radius: 11px;
  background: rgba(255, 236, 197, .72);
  border: 1px solid rgba(219, 172, 104, .36);
  color: #9A744A;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
}

.modal-stats b {
  color: #D96C12;
  font-size: 13px;
  font-weight: 900;
}

.primary-btn {
  width: 100%;
  height: 49px;
  border-radius: 25px;
  border: 3px solid #FFF1D2;
  background: linear-gradient(180deg, #FFBB5B 0%, #FF8A3D 60%, #EE6C1B 100%);
  box-shadow: 0 4px 0 #A8470D, inset 0 2px 0 rgba(255, 255, 255, .5);
  color: #FFF9EC;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 1px rgba(133, 49, 0, .45);
  transition: transform .1s ease;
}

.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #A8470D, inset 0 2px 0 rgba(255, 255, 255, .4);
}

/* ---------- 动画 ---------- */
@keyframes hudBump {
  0% { transform: scale(1); }
  42% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.28); opacity: .82; }
}

@keyframes seedBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}

@keyframes ripeGlow {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 245, 205, .55),
      0 0 0 2px rgba(255, 168, 60, .16),
      0 5px 14px rgba(60, 28, 0, .36),
      0 0 13px rgba(255, 186, 73, .28);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 225, .75),
      0 0 0 3px rgba(255, 178, 70, .30),
      0 6px 16px rgba(60, 28, 0, .40),
      0 0 26px rgba(255, 196, 84, .62);
  }
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.35) rotate(0deg); }
  45% { opacity: 1; transform: scale(1) rotate(35deg); }
}

@keyframes buttonBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}

@keyframes buttonShine {
  0% { left: -40%; opacity: 0; }
  18% { opacity: .85; }
  55% { left: 115%; opacity: 0; }
  100% { left: 115%; opacity: 0; }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  16% { opacity: 1; transform: translate(-50%, -58%) scale(1.1); }
  32% { transform: translate(-50%, -66%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(.94); }
}

@keyframes sparkFly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.15) rotate(var(--rot)); }
}

@keyframes petalFall {
  0% { transform: translate3d(0, -30px, 0) rotate(0deg); opacity: 0; }
  12% { opacity: .75; }
  70% { opacity: .5; }
  100% { transform: translate3d(var(--drift, 40px), 108vh, 0) rotate(320deg); opacity: 0; }
}

@keyframes loaderBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.03); }
}

@keyframes loadingSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(.88) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 360px) {
  .hud { padding-left: 9px; padding-right: 9px; gap: 6px; }
  .player { padding-right: 9px; }
  .avatar-wrap, .avatar { width: 37px; height: 37px; }
  .player-info { gap: 3px; }
  .nick { max-width: 68px; font-size: 11px; }
  .xp { width: 64px; }
  .wallet { gap: 5px; }
  .pill { height: 36px; }
  .coin-pill .coin-ic { width: 25px; height: 25px; }
  .coin-pill b { font-size: 15px; }
  .basket-pill b { font-size: 12.5px; }
  .field { padding-left: 9px; padding-right: 9px; }
  .plots { gap: 6px; }
  .plot { border-radius: 14px; }
  .seed-ring { width: 37px; height: 37px; }
  .seed-ring svg { width: 26px; height: 26px; }
  .empty-wrap b { font-size: 10.5px; }
  .harvest-wrap { padding: 0 1px; }
  .harvest-btn { height: 54px; font-size: 18px; }
  .actions { padding-left: 12px; padding-right: 12px; }
  .toast { font-size: 11.5px; }
}

@media (max-height: 720px) {
  .hud { padding-top: calc(7px + env(safe-area-inset-top)); }
  .stage { min-height: 42px; padding-top: 7px; }
  .ripe-chip { margin-top: 0; height: 27px; }
  .field { padding-left: 10px; padding-right: 10px; }
  .plots { gap: 7px; }
  .actions { padding-top: 9px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .harvest-btn { height: 53px; font-size: 18px; }
  .hint { margin-top: 6px; font-size: 10px; }
}

@media (max-height: 640px) {
  .hud { padding-top: calc(6px + env(safe-area-inset-top)); }
  .player { height: 46px; }
  .avatar-wrap, .avatar { width: 36px; height: 36px; }
  .stage { min-height: 34px; padding-top: 4px; }
  .ripe-chip { height: 25px; font-size: 10.5px; }
  .plots { gap: 6px; }
  .field { padding-left: 9px; padding-right: 9px; }
  .seed-ring { width: 33px; height: 33px; }
  .seed-ring svg { width: 23px; height: 23px; }
  .empty-wrap b { font-size: 10px; }
  .cost { font-size: 9px; }
  .actions { padding-top: 8px; }
  .harvest-btn { height: 49px; font-size: 17px; }
  .btn-basket { width: 27px; height: 27px; }
  .hint { display: none; }
  .timer { height: 19px; font-size: 9.5px; }
  .reward-tag { height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
