/* 农场收菜13 · 竖屏休闲农场游戏 */
* { box-sizing: border-box; }

:root {
  --orange: #FF8A3D;
  --orange-deep: #E96F1F;
  --orange-dark: #C85A12;
  --cream: #FFF8EC;
  --cream-deep: #FFEFD8;
  --ink: #3C2A1B;
  --ink-soft: #8A6A4F;
  --ink-faint: #A08368;
  --green: #69BE45;
  --green-deep: #4E9F3B;
  --line: #EFE0C8;
  --shadow-card: 0 4px 0 rgba(150, 108, 62, .12), 0 10px 22px rgba(70, 45, 15, .12);
}

html, body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
  background: radial-gradient(circle at 50% 0%, #F7EEDC 0%, #DCCFB8 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.game {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  min-height: 540px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #8BD8F2 0%, #BCEAF7 34%, #EAF7D9 44%, #A6D96E 45%, #79BE4C 100%);
  box-shadow: 0 0 60px rgba(50, 40, 20, .22);
  isolation: isolate;
}

/* ---------- 场景插画 ---------- */
.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sun {
  position: absolute;
  top: 5%;
  right: 7%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #FFFBD2 0%, #FFE37B 42%, #FFC844 72%, #FFB52E 100%);
  box-shadow: 0 0 0 10px rgba(255, 226, 120, .18), 0 0 44px rgba(255, 205, 80, .65);
  animation: sunBreath 6s ease-in-out infinite;
}

.cloud {
  position: absolute;
  width: 76px;
  height: 24px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 6px 14px rgba(90, 140, 160, .12);
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}
.cloud::before { width: 36px; height: 36px; left: 12px; top: -17px; }
.cloud::after { width: 26px; height: 26px; right: 12px; top: -11px; }
.cloud-a { top: 11%; left: -22px; animation: drift 16s ease-in-out infinite alternate; }
.cloud-b { top: 19%; right: -10px; transform: scale(.74); opacity: .8; animation: drift 20s ease-in-out infinite alternate-reverse; }
.cloud-c { top: 30%; left: 32%; transform: scale(.56); opacity: .65; animation: drift 24s ease-in-out infinite alternate; }

.hill {
  position: absolute;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform-origin: bottom center;
}
.hill-back {
  left: -30%;
  width: 150%;
  height: 26%;
  top: 30%;
  background: linear-gradient(180deg, #C9E99C 0%, #AFD97A 100%);
  transform: rotate(-2deg);
}
.hill-mid {
  left: 10%;
  width: 115%;
  height: 23%;
  top: 35%;
  background: linear-gradient(180deg, #A9D873 0%, #8BCA5A 100%);
  transform: rotate(2.5deg);
}
.hill-front {
  left: -35%;
  width: 170%;
  height: 22%;
  top: 39%;
  background: linear-gradient(180deg, #8CCB5B 0%, #73B846 100%);
  transform: rotate(-1deg);
}

.barn {
  position: absolute;
  left: 8px;
  top: 72px;
  width: 104px;
  height: auto;
  filter: drop-shadow(0 10px 12px rgba(59, 89, 30, .18));
}
.tree-left {
  position: absolute;
  left: -22px;
  top: 138px;
  width: 84px;
  height: auto;
  opacity: .96;
}
.tree-right {
  position: absolute;
  right: -16px;
  top: 158px;
  width: 72px;
  height: auto;
  opacity: .9;
}

.fence {
  position: absolute;
  left: -2%;
  width: 104%;
  top: 43.5%;
  height: 54px;
  opacity: .9;
}

.field-lines {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 48%;
  bottom: 0;
  background:
    repeating-linear-gradient(180deg, rgba(50, 100, 26, .10) 0 2px, transparent 2px 30px),
    radial-gradient(ellipse at 50% 15%, rgba(255, 255, 220, .22) 0%, transparent 58%);
  transform: perspective(260px) rotateX(22deg);
  transform-origin: top center;
  opacity: .85;
}

.meadow {
  position: absolute;
  left: -2%;
  width: 104%;
  top: 60%;
  height: 96px;
  height: clamp(96px, 14vh, 150px);
  opacity: .92;
}

.chick {
  position: absolute;
  left: 6%;
  top: calc(60% + 2px);
  width: 62px;
  height: auto;
  filter: drop-shadow(0 4px 5px rgba(47, 80, 24, .18));
  transform-origin: 50% 100%;
  animation: chickBob 3.4s ease-in-out infinite;
}

/* ---------- 顶部 HUD ---------- */
.hud {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0;
}

.hud-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.coin-pill,
.timer-pill,
.level-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 250, 238, .95);
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(120, 80, 30, .14), 0 8px 18px rgba(50, 60, 20, .12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.coin-pill {
  gap: 6px;
  padding: 5px 12px 5px 5px;
}
.coin-pill.bump { animation: coinBump .38s ease; }

.coin-ico {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #8A4B00;
  background: linear-gradient(180deg, #FFDE73 0%, #FFC23E 55%, #F0A012 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(160, 90, 0, .25);
}
.coin-ico .mp-icon { width: 18px; height: 18px; }
.coin-pill b {
  font-size: 20px;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--ink);
  min-width: 26px;
  text-align: left;
}
.coin-label { font-size: 10px; font-weight: 700; color: var(--ink-faint); margin-top: 2px; }

.timer-pill {
  gap: 5px;
  padding: 8px 12px;
  color: #8A4B00;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.timer-pill .mp-icon { width: 17px; height: 17px; color: var(--orange-deep); }
.timer-pill.is-low {
  color: #D33A2C;
  background: rgba(255, 240, 232, .97);
  animation: timerPulse .9s ease-in-out infinite;
}
.timer-pill.is-low .mp-icon { color: #D33A2C; }

.hud-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.level-pill {
  flex: none;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.level-pill b { color: var(--orange-deep); font-size: 14px; }

.target-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.target-bar {
  position: relative;
  flex: 1;
  height: 13px;
  border-radius: 99px;
  background: rgba(47, 79, 26, .28);
  border: 2px solid rgba(255, 250, 238, .9);
  box-shadow: inset 0 2px 4px rgba(30, 50, 10, .25);
  overflow: hidden;
}
.target-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .35s cubic-bezier(.2, .8, .3, 1);
  background: linear-gradient(90deg, #FFC95B 0%, #FF9A3D 55%, #FF7A1F 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
}
.target-bar span.is-full { animation: barGlow 1.1s ease-in-out infinite; }

.target-text {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 250, 238, .95);
  border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 3px 0 rgba(120, 80, 30, .12);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}
.target-text .mp-icon { width: 13px; height: 13px; color: var(--orange-deep); margin-right: 1px; }
.target-text b { font-size: 15px; color: var(--ink); }
.target-text .slash { margin: 0 1px; opacity: .55; }

/* ---------- 农场地块 ---------- */
.stage {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 16px 8px;
}

.plots {
  --plot: min(27vw, 13.4vh, 106px);
  display: grid;
  grid-template-columns: repeat(3, var(--plot));
  grid-auto-rows: auto;
  gap: 11px;
  justify-content: center;
  width: 100%;
  max-width: calc(var(--plot) * 3 + 22px);
}

.plot {
  position: relative;
  width: var(--plot);
  aspect-ratio: 1 / 1.05;
  padding: 0;
  border-radius: 18px;
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, .18) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 42%, rgba(255, 255, 255, .12) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 44% 74%, rgba(40, 20, 5, .18) 0 2px, transparent 3px),
    linear-gradient(180deg, #AE7A4C 0%, #97633A 58%, #7E4F2C 100%);
  background-size: 21px 21px, 17px 17px, 23px 23px, 100% 100%;
  box-shadow:
    inset 0 5px 0 rgba(255, 226, 183, .22),
    inset 0 -9px 16px rgba(47, 24, 6, .32),
    0 7px 0 #5C381C,
    0 13px 20px rgba(45, 30, 10, .24);
  transition: transform .12s ease, box-shadow .2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.plot::before {
  content: "";
  position: absolute;
  inset: 8px 8px 25px;
  border-radius: 12px;
  border: 1px solid rgba(255, 224, 178, .14);
  background: repeating-linear-gradient(180deg, rgba(255, 235, 205, .07) 0 3px, transparent 3px 12px);
  pointer-events: none;
}

.plot:active {
  transform: translateY(4px) scale(.99);
  box-shadow:
    inset 0 3px 0 rgba(255, 226, 183, .18),
    inset 0 -6px 12px rgba(47, 24, 6, .35),
    0 2px 0 #5C381C,
    0 4px 8px rgba(45, 30, 10, .2);
}

.plot.is-empty {
  background:
    radial-gradient(circle at 28% 26%, rgba(255, 255, 255, .12) 0 2px, transparent 3px),
    linear-gradient(180deg, #B88758 0%, #9C6C41 60%, #875835 100%);
  background-size: 23px 23px, 100% 100%;
  box-shadow:
    inset 0 5px 0 rgba(255, 232, 194, .2),
    inset 0 -9px 16px rgba(47, 24, 6, .28),
    0 7px 0 #623D20,
    0 13px 20px rgba(45, 30, 10, .22);
}

.plot-crop {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 7%;
  bottom: 17%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.plot-crop svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 2px rgba(40, 24, 8, .22));
  transform-origin: 50% 92%;
}
.plot.is-ready .plot-crop svg { animation: readySway 1.8s ease-in-out infinite; }

.plot-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 11px;
  text-align: center;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  color: #FFE9C9;
  text-shadow: 0 1px 0 rgba(52, 28, 6, .55);
  letter-spacing: .02em;
  pointer-events: none;
}
.plot.is-empty .plot-label { bottom: 9px; font-size: 9px; color: rgba(255, 236, 208, .82); }

.plot-bar {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 6px;
  height: 4px;
  border-radius: 99px;
  background: rgba(40, 22, 6, .4);
  overflow: hidden;
  pointer-events: none;
}
.plot-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #C8F57D 0%, #7AD33E 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .18s linear;
}
.plot.is-empty .plot-bar { display: none; }

.plot-plus {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #FFE4BE;
  background: rgba(85, 50, 22, .28);
  border: 2px dashed rgba(255, 226, 185, .55);
  pointer-events: none;
}
.plot-plus .mp-icon { width: 20px; height: 20px; }
.plot.is-empty:active .plot-plus { background: rgba(85, 50, 22, .42); }

.ready-chip {
  position: absolute;
  top: -8px;
  right: -3px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #8A4B00;
  background: linear-gradient(180deg, #FFF6D2 0%, #FFD55F 100%);
  border: 2px solid #FFFDF4;
  box-shadow: 0 3px 0 rgba(150, 90, 10, .32), 0 5px 12px rgba(120, 80, 0, .2);
  opacity: 0;
  transform: scale(.55);
  transition: opacity .2s ease, transform .2s cubic-bezier(.2, 1.4, .4, 1);
  pointer-events: none;
  white-space: nowrap;
}
.plot.is-ready .ready-chip {
  opacity: 1;
  transform: scale(1);
  animation: chipPulse 1.25s ease-in-out infinite;
}

.plot.is-ready {
  box-shadow:
    inset 0 5px 0 rgba(255, 236, 200, .28),
    inset 0 -9px 16px rgba(47, 24, 6, .3),
    0 7px 0 #5C381C,
    0 0 0 3px rgba(255, 231, 154, .95),
    0 0 26px rgba(255, 205, 80, .72),
    0 14px 22px rgba(45, 30, 10, .22);
}

.spark {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFF3B0;
  box-shadow: 0 0 8px #FFD65C;
  opacity: 0;
  pointer-events: none;
}
.spark-a { left: -6px; top: 18%; }
.spark-b { right: -5px; bottom: 24%; }
.plot.is-ready .spark-a { animation: twinkle 1.3s ease-in-out infinite .1s; }
.plot.is-ready .spark-b { animation: twinkle 1.3s ease-in-out infinite .6s; }

.hint {
  flex: none;
  margin: 10px 0 0;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #42681F;
  background: rgba(255, 252, 238, .78);
  border: 2px solid rgba(255, 255, 255, .66);
  box-shadow: 0 3px 0 rgba(60, 90, 25, .12);
  text-align: center;
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .2s ease;
}
.hint.is-alert { color: #9A4A00; background: rgba(255, 244, 213, .94); }

/* ---------- 底部操作区 ---------- */
.dock {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  padding: 8px 14px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: linear-gradient(180deg, #FFFBF1 0%, #FFF3DE 100%);
  border-top: 2px solid rgba(255, 255, 255, .9);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -8px 24px rgba(60, 40, 12, .16);
}

.seed-panel { margin-bottom: 8px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 6px;
}
.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.panel-title .mp-icon { width: 15px; height: 15px; color: var(--orange-deep); }
.panel-tip { font-size: 9.5px; font-weight: 600; color: var(--ink-faint); }

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

.seed {
  position: relative;
  min-width: 0;
  min-height: 74px;
  padding: 3px 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #FFFCF4;
  box-shadow: 0 2px 0 rgba(150, 108, 62, .1);
  color: var(--ink);
  overflow: hidden;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.seed:active { transform: scale(.96); }
.seed.is-selected {
  border-color: var(--orange);
  background: linear-gradient(180deg, #FFF6E8 0%, #FFE8CE 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 0 rgba(225, 110, 35, .22), 0 7px 12px rgba(225, 110, 35, .12);
}
.seed.is-locked {
  opacity: .9;
  background: #F4ECDD;
  filter: saturate(.35);
}
.seed.is-locked .seed-meta { display: none; }
.seed.is-locked .seed-name { visibility: hidden; }
.seed.is-locked .seed-art { opacity: .52; }

.seed-art {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.seed-art svg { width: 100%; height: 100%; overflow: visible; }
.seed-name {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.seed-meta {
  max-width: 100%;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seed.is-selected .seed-meta { color: #B26A2B; }

.seed-check {
  position: absolute;
  z-index: 2;
  top: 2px;
  right: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: none;
  place-items: center;
  color: #FFF;
  background: linear-gradient(180deg, #FF9F49, #F0781F);
  border: 2px solid #FFFCF4;
  box-shadow: 0 2px 4px rgba(180, 90, 20, .3);
}
.seed-check .mp-icon { width: 10px; height: 10px; }
.seed.is-selected .seed-check { display: grid; }

.seed-lock {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: rgba(244, 236, 221, .86);
  color: #8F7B63;
  font-size: 8px;
  font-weight: 800;
  text-align: center;
}
.seed-lock .mp-icon { width: 14px; height: 14px; }
.seed-lock em {
  max-width: 100%;
  font-style: normal;
  font-size: 9px;
  line-height: 1.1;
  color: #755C43;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seed-lock b {
  font-size: 8px;
  line-height: 1.1;
  color: #A08368;
  white-space: nowrap;
}

.upgrades {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.upg-card {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 46px;
  padding: 6px 7px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #FFFCF4;
  box-shadow: 0 2px 0 rgba(150, 108, 62, .1);
  text-align: left;
  transition: transform .14s ease, border-color .14s ease;
}
.upg-card:active { transform: scale(.975); }
.upg-card.affordable { border-color: #F4C98A; }
.upg-card.affordable .upg-cost { animation: costGlow 2.4s ease-in-out infinite; }

.upg-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #FFF;
  background: linear-gradient(180deg, #85D063 0%, #55A93B 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .38), 0 3px 0 #3E812A;
}
.upg-icon.tool {
  background: linear-gradient(180deg, #FFAB61 0%, #F07A28 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .38), 0 3px 0 #B95815;
}
.upg-icon .mp-icon { width: 18px; height: 18px; }

.upg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.upg-title {
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upg-title b { color: var(--orange-deep); font-size: 10px; }
.upg-desc {
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upg-cost {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px 6px;
  border-radius: 99px;
  background: #FFE9B8;
  color: #8A4B00;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.upg-cost .mp-icon { width: 11px; height: 11px; }
.upg-cost.no { background: #F0E7D8; color: #A89B8B; }
.upg-cost.max { background: #DDF1CE; color: #4E7B30; font-size: 9px; }

/* ---------- 提示条 ---------- */
.toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 96px);
  transform: translate(-50%, -8px);
  max-width: 84%;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(58, 39, 21, .9);
  color: #FFF6E6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 8px 20px rgba(30, 18, 4, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 过关 / 本局结束 ---------- */
.result {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 22px;
  background: rgba(40, 27, 12, .52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.result[hidden] { display: none; }

.result-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 24px 18px 18px;
  border-radius: 28px;
  border: 3px solid #FFFDF6;
  background: linear-gradient(180deg, #FFFCF3 0%, #FFEED7 100%);
  box-shadow: 0 26px 52px rgba(26, 16, 5, .38);
  text-align: center;
  animation: cardIn .42s cubic-bezier(.2, .9, .3, 1.15);
}

.result-badge {
  width: 66px;
  height: 66px;
  margin: -52px auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #8A4B00;
  background: linear-gradient(180deg, #FFDE73 0%, #FFC23E 55%, #F0A012 100%);
  border: 4px solid #FFFDF6;
  box-shadow: 0 8px 16px rgba(175, 105, 10, .35), inset 0 2px 0 rgba(255, 255, 255, .55);
}
.result-badge .mp-icon { width: 34px; height: 34px; }
.result-card.is-fail .result-badge {
  color: #56697A;
  background: linear-gradient(180deg, #E3ECF4 0%, #B8C8D6 55%, #93A9BC 100%);
  box-shadow: 0 8px 16px rgba(60, 80, 100, .28), inset 0 2px 0 rgba(255, 255, 255, .55);
}

.result-kicker {
  margin: 0 0 2px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .24em;
  color: #C89A60;
}
.result-card.is-fail .result-kicker { color: #93A3B2; }

.result-card h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--ink);
}

.result-sub {
  margin: 7px 0 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  padding: 10px 6px;
  border-radius: 16px;
  border: 2px dashed #EBD3AE;
  background: #FFF8E8;
}
.stat-cell span {
  display: block;
  margin-bottom: 2px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-faint);
}
.stat-cell b {
  font-size: 18px;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.primary-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #FFF;
  background: linear-gradient(180deg, #FFA34F 0%, #F57A1F 100%);
  box-shadow: 0 5px 0 var(--orange-dark), 0 10px 20px rgba(220, 110, 30, .3), inset 0 2px 0 rgba(255, 255, 255, .35);
  transition: transform .1s ease, box-shadow .1s ease;
}
.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--orange-dark), 0 3px 8px rgba(220, 110, 30, .25);
}

.confetti {
  position: absolute;
  top: 38%;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiFall 1.3s ease-out forwards;
}

/* ---------- 浮动数字 ---------- */
.float-text {
  position: absolute;
  left: 50%;
  top: 22%;
  z-index: 5;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 900;
  color: #FFF4B8;
  text-shadow: 0 2px 0 #B76800, 0 0 10px rgba(255, 200, 60, .7);
  pointer-events: none;
  animation: floatUp .95s cubic-bezier(.2, .7, .4, 1) forwards;
  white-space: nowrap;
}
.float-text.is-coin { color: #FFF0A6; font-size: 18px; }

/* ---------- 动画 ---------- */
@keyframes sunBreath {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 226, 120, .18), 0 0 44px rgba(255, 205, 80, .65); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(255, 226, 120, .12), 0 0 58px rgba(255, 205, 80, .78); }
}
@keyframes drift {
  0% { transform: translateX(0) scale(.8); }
  100% { transform: translateX(26px) scale(.84); }
}
@keyframes coinBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  70% { transform: scale(.98); }
  100% { transform: scale(1); }
}
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes barGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
@keyframes readySway {
  0%, 100% { transform: rotate(-2.2deg) scale(1); }
  50% { transform: rotate(2.2deg) scale(1.035); }
}
@keyframes chipPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.4); }
  45% { opacity: 1; transform: scale(1.15); }
}
@keyframes chickBob {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50% { transform: translateY(-3px) rotate(1.2deg); }
}
@keyframes costGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 170, 70, 0); }
  50% { box-shadow: 0 0 0 3px rgba(255, 170, 70, .22); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.75); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -38px) scale(1); }
}
@keyframes cardIn {
  0% { opacity: 0; transform: scale(.82) translateY(16px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(-20px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(150px) rotate(280deg); }
}

/* ---------- 小屏适配 ---------- */
@media (max-height: 720px) {
  .hud { padding-top: calc(env(safe-area-inset-top, 0px) + 7px); }
  .hud-sub { margin-top: 7px; }
  .coin-pill b { font-size: 18px; }
  .coin-ico { width: 27px; height: 27px; }
  .stage { padding-top: 3px; padding-bottom: 4px; }
  .plots { --plot: min(27vw, 12.6vh, 98px); gap: 9px; }
  .hint { margin-top: 7px; font-size: 10px; }
  .dock { padding-top: 6px; }
  .seed { min-height: 66px; }
  .seed-art { width: 30px; height: 30px; }
  .seed-panel { margin-bottom: 6px; }
  .panel-head { padding-bottom: 4px; }
  .upg-card { padding: 5px 6px; }
  .upg-icon { width: 27px; height: 27px; }
}

@media (max-width: 350px) {
  .coin-label { display: none; }
  .coin-pill { padding-right: 9px; }
  .hud { padding-left: 12px; padding-right: 12px; }
  .stage { padding-left: 12px; padding-right: 12px; }
  .dock { padding-left: 10px; padding-right: 10px; }
  .plot-label { font-size: 9px; }
  .seed-meta { font-size: 7px; }
  .seed-name { font-size: 9px; }
  .seed-lock em { font-size: 8px; }
  .seed-lock b { font-size: 7.5px; }
  .barn { top: 88px; width: 60px; }
  .tree-left { top: 146px; width: 76px; }
  .tree-right { top: 164px; width: 64px; }
  .chick { left: 4%; width: 48px; }
  .upg-desc { display: none; }
  .upg-card { gap: 4px; min-height: 44px; }
}

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