:root {
  --bg-space: #08101f;
  --bg-panel: rgba(10, 16, 34, 0.72);
  --line-soft: rgba(189, 219, 255, 0.22);
  --text-main: #eff7ff;
  --text-soft: rgba(239, 247, 255, 0.8);
  --accent-green: #78f8ba;
  --accent-pink: #f96cff;
  --accent-gold: #ffd26b;
  --danger: #ff4fc8;
  --shadow-strong: 0 24px 80px rgba(3, 8, 20, 0.55);
}

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

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at top, #162a4b 0%, #08101f 48%, #04070f 100%);
  font-family: "Trebuchet MS", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text-main);
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.active {
  display: block;
}

.screen-loading {
  overflow: hidden;
}

.loading-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 95, 214, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(9, 14, 30, 0.48), rgba(42, 10, 58, 0.66)),
    url("./assets/bg_farm_half infected.png") center/cover no-repeat;
  filter: blur(14px) saturate(0.94) brightness(0.84);
  transform: scale(1.08);
}

.loading-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vw, 620px);
  transform: translate(-50%, -50%);
  padding: 42px 46px;
  border: 1px solid rgba(255, 126, 229, 0.3);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(23, 28, 58, 0.91), rgba(11, 11, 30, 0.95));
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.5), inset 0 0 52px rgba(249, 108, 255, 0.07);
  text-align: center;
  backdrop-filter: blur(18px);
}

.loading-kicker {
  margin: 0 0 12px;
  color: var(--accent-pink);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.22em;
}

.loading-panel h1 {
  margin: 0 0 30px;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: 0.08em;
}

.loading-track {
  width: 100%;
  height: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 126, 229, 0.24);
  border-radius: 999px;
  background: rgba(5, 13, 28, 0.72);
}

.loading-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff61d8, #a772ff);
  box-shadow: 0 0 28px rgba(249, 108, 255, 0.62);
  transition: width 180ms ease;
}

.loading-percent {
  margin: 14px 0 0;
  color: rgba(239, 247, 255, 0.78);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.screen-start,
.screen-result {
  overflow: hidden;
}

.start-bg,
.result-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 95, 214, 0.14), transparent 22%),
    linear-gradient(135deg, rgba(9, 14, 30, 0.42), rgba(42, 10, 58, 0.58)),
    url("./assets/bg_farm_half infected.png") center/cover no-repeat;
  filter: blur(12px) saturate(0.92) brightness(0.82);
  transform: scale(1.08);
}

.start-content,
.result-panel {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(90vw, 920px);
  transform: translate(-50%, -50%);
  padding: 34px 40px 42px;
  border: 1px solid rgba(170, 228, 255, 0.22);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(18, 33, 61, 0.92), rgba(11, 18, 34, 0.94));
  box-shadow:
    0 30px 100px rgba(2, 7, 18, 0.55),
    inset 0 0 60px rgba(112, 196, 255, 0.05);
  text-align: center;
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.task-panel::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 24px;
  border: 1px solid rgba(144, 220, 255, 0.08);
  pointer-events: none;
}

.task-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(93, 192, 255, 0.12), transparent 34%),
    radial-gradient(circle at 50% 120%, rgba(108, 255, 191, 0.08), transparent 28%);
  pointer-events: none;
}

.panel-topline,
.panel-notes {
  position: relative;
  z-index: 1;
}

.panel-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-chip,
.panel-step {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-chip {
  border: 1px solid rgba(134, 212, 255, 0.24);
  color: rgba(200, 236, 255, 0.82);
  background: rgba(121, 181, 255, 0.08);
}

.panel-step {
  border: 1px solid rgba(126, 255, 174, 0.22);
  color: rgba(192, 255, 217, 0.88);
  background: rgba(92, 255, 160, 0.08);
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.start-content h1,
.result-panel h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(34px, 4.2vw, 78px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.result-panel h2 {
  font-size: clamp(30px, 3.3vw, 62px);
  line-height: 1.14;
}

.panel-lead,
.start-copy,
#resultText {
  position: relative;
  z-index: 1;
}

.panel-lead {
  margin: 18px auto 0;
  max-width: 700px;
  font-size: clamp(17px, 1.8vw, 25px);
  line-height: 1.65;
  color: rgba(224, 238, 255, 0.92);
}

.screen-start .panel-lead {
  max-width: 820px;
  font-size: clamp(14px, 1.18vw, 18px);
  line-height: 1.45;
  white-space: nowrap;
}

.start-copy,
#resultText {
  margin: 18px auto 0;
  max-width: 720px;
  font-size: clamp(16px, 1.55vw, 24px);
  line-height: 1.78;
  color: rgba(221, 232, 245, 0.84);
}

#resultText {
  max-width: 820px;
  font-size: clamp(14px, 1.18vw, 18px);
  line-height: 1.45;
}

.panel-notes {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-notes span {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(153, 214, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  color: rgba(221, 234, 245, 0.76);
}

.primary-cta {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  min-width: 220px;
  padding: 18px 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, #9af58d, #46d6af 58%, #6df0d1);
  color: #07111c;
  font-size: 22px;
  font-weight: 700;
  box-shadow:
    0 18px 44px rgba(70, 214, 175, 0.3),
    0 0 40px rgba(94, 244, 188, 0.18);
}

.result-panel.fail .panel-chip,
.result-panel.fail .panel-step {
  border-color: rgba(255, 138, 170, 0.26);
  background: rgba(255, 84, 132, 0.08);
  color: rgba(255, 220, 228, 0.84);
}

.result-notes span {
  min-width: 240px;
}

.screen-countdown {
  background: #000;
}

.countdown-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.skip-btn {
  position: absolute;
  top: 22px;
  right: 22px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(12, 18, 32, 0.72);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.screen-game {
  background: #060b17;
}

.stage-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.game-stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: #050a15;
  transform-origin: top left;
  cursor: none;
}

.scene-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 16%, rgba(240, 74, 223, 0.12), transparent 16%),
    linear-gradient(180deg, rgba(12, 10, 27, 0.2), rgba(10, 8, 23, 0.4)),
    url("./assets/bg_farm_half infected.png") center/cover no-repeat;
  filter: blur(10px) brightness(0.86) saturate(0.94);
  transform: scale(1.06);
}

.scene-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 14%, rgba(255, 91, 248, 0.28), transparent 18%),
    radial-gradient(circle at 52% 84%, rgba(160, 65, 255, 0.1), transparent 22%),
    radial-gradient(circle at 80% 86%, rgba(101, 255, 186, 0.1), transparent 18%),
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(7, 10, 18, 0.28));
}

.scene-glow.is-endgame-pulse {
  animation: endgamePurplePulse 0.78s ease-out;
}

.hud {
  position: absolute;
  top: 34px;
  left: 54px;
  right: 54px;
  display: flex;
  gap: 20px;
  z-index: 20;
}

.hud-card {
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: var(--bg-panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.hud-title {
  flex: 1 1 auto;
  padding: 18px 24px;
}

.hud-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.56);
  text-transform: uppercase;
}

.hud-title h2 {
  margin: 8px 0 10px;
  font-size: clamp(22px, 2vw, 34px);
}

.hud-tip {
  margin: 0;
  font-size: clamp(13px, 1.2vw, 17px);
  color: var(--text-soft);
  line-height: 1.55;
}

.hud-core {
  position: relative;
  width: min(42vw, 620px);
  padding: 16px 18px;
}

.core-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.core-wrap {
  position: relative;
  width: 102px;
  height: 102px;
  flex: 0 0 auto;
}

.core-wrap.is-hit {
  animation: coreHit 0.42s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.spore-core {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  animation: coreFloat 2.8s ease-in-out infinite;
}

.core-wrap.is-hit .spore-core {
  filter:
    drop-shadow(0 0 12px rgba(255, 180, 221, 0.75))
    drop-shadow(0 0 28px rgba(255, 92, 209, 0.55));
}

.core-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(245, 111, 255, 0.32);
  box-shadow:
    0 0 24px rgba(255, 64, 224, 0.25),
    inset 0 0 24px rgba(255, 64, 224, 0.12);
  animation: pulseRing 2.2s ease-out infinite;
}

.core-meter {
  min-width: 0;
  flex: 1 1 auto;
}

.core-meter-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.84);
}

.core-meter-label strong {
  font-size: 22px;
  color: #ffd1ff;
}

.meter-track {
  position: relative;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #ab5dff 0%, #ff4fc8 52%, #ff947d 100%);
  box-shadow: 0 0 28px rgba(255, 79, 200, 0.45);
  transition: width 180ms ease-out;
}

.farm-area {
  position: absolute;
  left: 60px;
  top: 282px;
  width: 1799px;
  height: 517px;
  z-index: 10;
}

.plot-bed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.plant-layer,
.fx-layer {
  position: absolute;
  inset: 0;
}

.plant {
  position: absolute;
  width: 118px;
  height: 118px;
  transform-origin: center bottom;
  transition:
    transform 240ms ease,
    filter 240ms ease,
    opacity 240ms ease;
  animation: sway var(--plant-sway-duration, 2.8s) ease-in-out infinite;
  animation-delay: var(--plant-sway-delay, 0s);
  user-select: none;
  will-change: transform, filter;
}

.plant img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 12px 18px rgba(6, 14, 16, 0.34))
    brightness(1)
    saturate(1);
  transition: filter 220ms ease;
}

.plant.is-purple {
  filter:
    drop-shadow(0 0 14px rgba(214, 92, 255, 0.45))
    drop-shadow(0 0 28px rgba(171, 78, 255, 0.28));
}

.plant.is-purple img {
  filter:
    drop-shadow(0 12px 18px rgba(18, 8, 30, 0.42))
    brightness(1.02)
    saturate(1.14);
}

.plant.hit {
  animation:
    plantImpact 0.52s cubic-bezier(0.18, 0.82, 0.18, 1),
    sway var(--plant-sway-duration, 2.8s) ease-in-out infinite;
}

.plant.saved {
  animation:
    plantHeal 0.6s cubic-bezier(0.16, 0.84, 0.24, 1),
    sway var(--plant-sway-duration, 2.8s) ease-in-out infinite;
}

.plant.saved img {
  filter:
    drop-shadow(0 12px 18px rgba(6, 14, 16, 0.34))
    brightness(1.18)
    saturate(1.26);
}

.plant.is-targeted {
  filter:
    drop-shadow(0 0 14px rgba(155, 255, 195, 0.2))
    drop-shadow(0 0 30px rgba(188, 255, 212, 0.16));
}

.fx {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
  animation: fxPop 0.72s ease forwards;
}

.fx img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}

.bottom-ui {
  position: absolute;
  left: 548px;
  top: 830px;
  z-index: 30;
}

.operation-panel {
  width: 824px;
  min-height: 140px;
  padding: 46px 36px 8px;
  border-radius: 30px;
  border: 1px solid rgba(155, 221, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(14, 28, 49, 0.88), rgba(10, 18, 34, 0.94));
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.28),
    inset 0 0 40px rgba(94, 191, 255, 0.05);
  backdrop-filter: blur(14px);
}

.operation-panel p {
  margin: 0;
  text-align: center;
  font-size: 22px;
  line-height: 1.2;
  white-space: nowrap;
  color: rgba(240, 247, 255, 0.92);
  transform: translateY(10px);
}

.robot-hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 130px;
  height: 210px;
  opacity: 0;
  pointer-events: none;
  z-index: 45;
  transform: translate(-50%, -16%);
  transition: opacity 120ms ease;
}

.robot-hand.visible {
  opacity: 1;
}

.robot-hand.is-targeting img {
  filter:
    drop-shadow(0 16px 28px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 28px rgba(168, 255, 213, 0.28))
    brightness(1.12)
    saturate(1.08);
}

.robot-hand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 16px 28px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 24px rgba(145, 226, 255, 0.12));
}

.timer-card {
  position: absolute;
  right: 56px;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding: 18px 22px;
  border-radius: 24px;
  background: rgba(8, 12, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  z-index: 25;
}

.timer-card.is-urgent {
  border-color: rgba(255, 145, 86, 0.55);
  box-shadow:
    0 0 0 2px rgba(255, 120, 76, 0.18),
    0 18px 36px rgba(255, 98, 56, 0.18);
  background:
    linear-gradient(180deg, rgba(48, 17, 12, 0.84), rgba(26, 10, 15, 0.82));
}

.timer-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.68);
  letter-spacing: 0.08em;
}

#timerValue {
  font-size: 48px;
  line-height: 1;
  color: var(--accent-gold);
}

.timer-card.is-urgent #timerValue {
  color: #ff8759;
  text-shadow:
    0 0 12px rgba(255, 126, 89, 0.55),
    0 0 28px rgba(255, 78, 55, 0.34);
  animation: urgentTimer 0.72s ease-in-out infinite;
}

.result-panel.fail {
  box-shadow: 0 24px 90px rgba(255, 88, 148, 0.18);
}

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

@keyframes pulseRing {
  0% {
    transform: scale(0.9);
    opacity: 0.18;
  }
  60% {
    opacity: 0.55;
  }
  100% {
    transform: scale(1.08);
    opacity: 0;
  }
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-1.5deg);
  }
  50% {
    transform: rotate(1.5deg);
  }
}

@keyframes plantImpact {
  0% {
    transform: scale(1);
  }
  18% {
    transform: scale(0.82) rotate(-7deg);
  }
  55% {
    transform: scale(1.13) rotate(5deg);
  }
  78% {
    transform: scale(0.96) rotate(-2deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes plantHeal {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  30% {
    transform: translateY(-8px) scale(1.1);
    filter: brightness(1.28);
  }
  60% {
    transform: scale(0.95);
    filter: brightness(1.12);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes fxPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.25);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes endgamePurplePulse {
  0% {
    opacity: 1;
    background:
      radial-gradient(circle at 50% 58%, rgba(206, 102, 255, 0.08), transparent 18%),
      radial-gradient(circle at 50% 70%, rgba(184, 98, 255, 0.05), transparent 28%),
      radial-gradient(circle at 15% 14%, rgba(255, 91, 248, 0.22), transparent 18%),
      radial-gradient(circle at 80% 86%, rgba(196, 94, 255, 0.14), transparent 18%),
      linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(7, 10, 18, 0.28));
    filter: saturate(1) brightness(1);
  }
  30% {
    opacity: 1;
    background:
      radial-gradient(circle at 50% 58%, rgba(224, 88, 255, 0.46), transparent 30%),
      radial-gradient(circle at 50% 70%, rgba(184, 98, 255, 0.28), transparent 42%),
      radial-gradient(circle at 15% 14%, rgba(255, 113, 244, 0.3), transparent 24%),
      radial-gradient(circle at 80% 86%, rgba(204, 97, 255, 0.26), transparent 28%),
      linear-gradient(180deg, rgba(157, 54, 255, 0.24), rgba(89, 20, 143, 0.18)),
      linear-gradient(0deg, rgba(213, 113, 255, 0.12), rgba(213, 113, 255, 0.12));
    filter: saturate(1.55) brightness(1.12);
    box-shadow:
      inset 0 0 180px rgba(198, 80, 255, 0.26),
      inset 0 0 320px rgba(198, 80, 255, 0.14);
  }
  55% {
    opacity: 1;
    background:
      radial-gradient(circle at 50% 58%, rgba(224, 88, 255, 0.32), transparent 36%),
      radial-gradient(circle at 50% 70%, rgba(184, 98, 255, 0.18), transparent 46%),
      radial-gradient(circle at 15% 14%, rgba(255, 113, 244, 0.22), transparent 28%),
      radial-gradient(circle at 80% 86%, rgba(204, 97, 255, 0.18), transparent 30%),
      linear-gradient(180deg, rgba(157, 54, 255, 0.14), rgba(89, 20, 143, 0.12));
    filter: saturate(1.28) brightness(1.05);
  }
  100% {
    opacity: 1;
    background:
      radial-gradient(circle at 50% 58%, rgba(206, 102, 255, 0), transparent 36%),
      radial-gradient(circle at 50% 70%, rgba(184, 98, 255, 0), transparent 46%),
      radial-gradient(circle at 15% 14%, rgba(255, 91, 248, 0.22), transparent 18%),
      radial-gradient(circle at 80% 86%, rgba(196, 94, 255, 0.14), transparent 18%),
      linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(7, 10, 18, 0.28));
    filter: saturate(1) brightness(1);
    box-shadow: none;
  }
}

@keyframes coreHit {
  0% {
    transform: translateX(0) scale(1);
  }
  18% {
    transform: translateX(-9px) rotate(-5deg) scale(0.92);
  }
  36% {
    transform: translateX(10px) rotate(5deg) scale(1.08);
  }
  58% {
    transform: translateX(-6px) rotate(-3deg) scale(0.98);
  }
  100% {
    transform: translateX(0) rotate(0deg) scale(1);
  }
}

@keyframes urgentTimer {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.14);
  }
}

@media (max-width: 900px) {
  .start-content,
  .result-panel {
    width: min(92vw, 920px);
    padding: 26px 22px 30px;
  }

  .panel-topline {
    flex-direction: column;
  }

  .panel-notes {
    flex-direction: column;
    align-items: center;
  }
}
