/* Ground-level fields and clickable 2.5D buildings. Loaded last on purpose. */
.land {
  isolation: isolate;
}

.plots {
  z-index: 6;
  gap: 5px !important;
  transform: rotate(3deg) !important;
  transform-origin: center;
}

.plot {
  --edge: polygon(5% 3%, 28% 0, 67% 2%, 94% 5%, 100% 19%, 98% 76%, 93% 95%, 66% 100%, 27% 98%, 5% 94%, 0 76%, 2% 21%);
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 18% 13% 20% 15% / 16% 19% 14% 18% !important;
  background: color-mix(in srgb, var(--soil) 58%, #3a2418) !important;
  box-shadow: none !important;
  clip-path: var(--edge);
  filter:
    drop-shadow(0 2px 0 color-mix(in srgb, var(--soil) 48%, #2c1b12))
    drop-shadow(0 7px 4px rgba(37, 30, 18, .28));
}

.plot::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 7px;
  border: 2px solid color-mix(in srgb, var(--soil) 72%, #6e442c);
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 27%, rgba(72, 40, 24, .18) 0 1.5px, transparent 2px),
    radial-gradient(circle at 72% 67%, rgba(255, 210, 155, .13) 0 1px, transparent 1.7px),
    radial-gradient(circle at 45% 83%, rgba(76, 42, 25, .14) 0 1.3px, transparent 2px),
    radial-gradient(ellipse at 50% 40%,
      color-mix(in srgb, var(--soil) 88%, #dd9960) 0 22%,
      color-mix(in srgb, var(--soil) 82%, #b86f42) 57%,
      color-mix(in srgb, var(--soil) 70%, #5b3422) 100%);
  background-size: 37px 31px, 43px 39px, 51px 47px, auto;
  box-shadow:
    inset 0 3px rgba(255, 226, 181, .16),
    inset 0 -6px rgba(48, 25, 15, .23),
    0 1px rgba(255, 226, 181, .12);
  clip-path: var(--edge);
  transform: none;
  pointer-events: none;
}

.plot:nth-child(3n + 2) {
  --edge: polygon(3% 7%, 22% 1%, 72% 0, 97% 8%, 100% 27%, 97% 81%, 88% 97%, 55% 99%, 18% 96%, 1% 84%, 0 31%);
}

.plot:nth-child(3n) {
  --edge: polygon(7% 2%, 41% 0, 79% 3%, 98% 13%, 100% 68%, 95% 93%, 73% 99%, 31% 97%, 4% 91%, 0 71%, 2% 18%);
}

.plot:hover {
  transform: none !important;
  filter:
    brightness(1.06)
    drop-shadow(0 2px 0 color-mix(in srgb, var(--soil) 48%, #2c1b12))
    drop-shadow(0 7px 4px rgba(37, 30, 18, .28));
}

.plot .crop {
  position: relative;
  z-index: 3;
  transform: translateY(-2px) rotate(-3deg);
}

.plot .soil-badge {
  z-index: 5;
  bottom: 2px;
  opacity: 0;
  transition: opacity .18s ease;
}

@media (hover: hover) {
  .plot:hover .soil-badge { opacity: .88; }
}

.plot.empty::after,
.plot.locked::after {
  z-index: 4;
}

.building-hotspots {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

.building-hit {
  position: absolute;
  display: block;
  width: 190px;
  height: 195px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.building-hit::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 13%;
  right: 13%;
  bottom: 8%;
  height: 13%;
  border-radius: 50%;
  background: rgba(35, 51, 25, .34);
  filter: blur(6px);
  transform: scaleX(.88);
  pointer-events: none;
}

.building-hit img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 13px 8px rgba(33, 53, 27, .25));
  pointer-events: none;
  z-index: 1;
}

.building-hit b {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  padding: 2px 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fffdf0;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 2px rgba(28, 48, 25, .9), 0 0 3px rgba(28, 48, 25, .75);
  pointer-events: none;
}

.building-hit:hover,
.building-hit:focus-visible {
  z-index: 12;
  outline: none;
  transform: translateY(-2px) scale(1.025);
  filter: saturate(1.08);
}

.building-hit:active {
  transform: translateY(-1px) scale(.98);
}

.barn-hit { left: 0; top: 17%; }
.mill-hit { right: 0; top: 16%; }
.orchard-hit { right: 1%; top: 42%; width: 165px; height: 170px; }
.board-hit { left: 2%; top: 44%; width: 145px; height: 150px; }
.club-hit { right: 1%; top: 66%; width: 155px; height: 160px; }

@media (min-width: 821px) {
  .scene-actions,
  .bottom-game-nav {
    display: none !important;
  }
}

@media (max-width: 820px) {
  .land {
    padding: 0 !important;
    background-position: center top !important;
  }

  .building-hotspots {
    display: block !important;
    z-index: 12;
  }

  .building-hit {
    width: 112px;
    height: 116px;
  }

  .building-hit img {
    filter: drop-shadow(0 7px 4px rgba(31, 55, 27, .25));
  }

  .building-hit b {
    bottom: 0;
    padding: 1px 3px;
    font-size: 7px;
  }

  .barn-hit { left: -4px; top: 148px; }
  .mill-hit { right: -4px; top: 146px; }
  .board-hit { left: 50%; top: 151px; width: 76px; height: 84px; transform: translateX(-50%); }
  .board-hit:hover,
  .board-hit:focus-visible { transform: translateX(-50%) translateY(-3px) scale(1.03); }
  .orchard-hit { left: -8px; top: 247px; width: 101px; height: 105px; }
  .club-hit { right: -8px; top: 247px; width: 101px; height: 105px; }

  .plots {
    position: absolute !important;
    z-index: 7;
    top: 268px;
    right: 54px;
    bottom: 180px;
    left: 54px;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    transform: rotate(6deg) !important;
  }

  .plot {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 18% 13% 20% 15% / 16% 19% 14% 18% !important;
  }

  .plot::before {
    inset: 0 0 6px;
    border-width: 2px;
    border-radius: inherit;
    background:
      radial-gradient(circle at 18% 27%, rgba(72, 40, 24, .18) 0 1.2px, transparent 1.8px),
      radial-gradient(circle at 72% 67%, rgba(255, 210, 155, .13) 0 1px, transparent 1.6px),
      radial-gradient(ellipse at 50% 40%,
      color-mix(in srgb, var(--soil) 88%, #dd9960) 0 22%,
      color-mix(in srgb, var(--soil) 82%, #b86f42) 57%,
      color-mix(in srgb, var(--soil) 70%, #5b3422) 100%);
    background-size: 31px 27px, 39px 35px, auto;
    box-shadow:
      inset 0 2px rgba(255, 226, 181, .18),
      inset 0 -5px rgba(48, 25, 15, .22);
  }

  .plot .crop { transform: translateY(-2px) rotate(-6deg); }
  .plot .soil-badge { display: none; }

  .crop-emoji { font-size: 28px; }
  .crop.growing .crop-emoji { font-size: 22px; }

  .bottom-game-nav {
    display: none !important;
  }

  .seed-dock {
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }
}

@media (max-width: 380px) {
  .building-hit { width: 101px; height: 106px; }
  .barn-hit { left: -5px; }
  .mill-hit { right: -5px; }
  .orchard-hit,
  .club-hit { width: 91px; height: 98px; }
  .plots { right: 48px; left: 48px; }
}

/* v15: terrain-integration pass — plots are soil cut into the meadow, not cards. */
.plots {
  perspective: 900px;
  gap: 2px 4px !important;
}

.plot {
  --depth-scale: 1;
  --edge: polygon(7% 3%, 29% 1%, 68% 2%, 93% 5%, 98% 20%, 100% 78%, 94% 94%, 72% 98%, 31% 99%, 8% 96%, 2% 82%, 1% 23%);
  transform: scale(var(--depth-scale)) !important;
  transform-origin: center bottom;
  border-radius: 0 !important;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, #6f873d 76%, var(--soil)) 0 20%,
      color-mix(in srgb, var(--soil) 48%, #747059) 58%,
      color-mix(in srgb, var(--soil) 48%, #5c5947) 100%) !important;
  box-shadow: none !important;
  clip-path: var(--edge);
  filter: drop-shadow(0 4px 3px rgba(43, 48, 25, .16));
}

.plot::before {
  inset: 3px 2px 5px;
  border: 0;
  border-radius: 0;
  clip-path: var(--edge);
  background:
    radial-gradient(circle at 16% 26%, rgba(67, 51, 35, .18) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 76% 67%, rgba(226, 201, 151, .12) 0 1px, transparent 1.6px),
    radial-gradient(circle at 43% 84%, rgba(70, 52, 35, .15) 0 1.3px, transparent 2px),
    radial-gradient(ellipse at 50% 46%,
      color-mix(in srgb, var(--soil) 53%, #8a8065) 0 25%,
      color-mix(in srgb, var(--soil) 50%, #736c56) 66%,
      color-mix(in srgb, var(--soil) 47%, #5e6247) 100%);
  background-size: 31px 27px, 41px 37px, 47px 43px, auto;
  box-shadow:
    inset 0 2px rgba(235, 220, 180, .08),
    inset 0 -3px rgba(57, 48, 33, .1);
}

.plot::after {
  background-image:
    linear-gradient(74deg, transparent 45%, rgba(75, 105, 41, .78) 47% 53%, transparent 55%),
    linear-gradient(103deg, transparent 45%, rgba(91, 121, 48, .7) 47% 52%, transparent 54%),
    radial-gradient(ellipse, rgba(73, 50, 33, .22) 0 18%, transparent 22%);
  background-position: 3px calc(100% - 1px), 10px 100%, 0 calc(100% - 4px);
  background-size: 18px 10px, 21px 9px, 23px 8px;
  background-repeat: repeat-x;
  color: rgba(255, 246, 224, .28);
  font-weight: 300;
  text-shadow: none;
}

.plot:nth-child(3n + 2) {
  --edge: polygon(4% 7%, 23% 2%, 71% 1%, 96% 8%, 99% 27%, 98% 80%, 89% 95%, 57% 99%, 19% 97%, 2% 85%, 1% 32%);
}

.plot:nth-child(3n) {
  --edge: polygon(8% 3%, 40% 1%, 78% 3%, 96% 12%, 99% 68%, 95% 91%, 74% 98%, 32% 97%, 5% 92%, 1% 72%, 3% 18%);
}

.plot:nth-child(-n + 5) { --depth-scale: .90; }
.plot:nth-child(n + 6):nth-child(-n + 10) { --depth-scale: .95; }
.plot:nth-child(n + 11):nth-child(-n + 15) { --depth-scale: 1; }
.plot:nth-child(n + 16) { --depth-scale: 1.055; }

.plot:hover {
  transform: scale(var(--depth-scale)) !important;
  filter: brightness(1.035) drop-shadow(0 4px 3px rgba(43, 48, 25, .16));
}

.plot.empty::after {
  font-size: 22px;
  opacity: 1;
}

@media (max-width: 820px) {
  .plots { gap: 1px 3px !important; }
  .plot::before { inset: 2px 1px 4px; }
  .plot.empty::after { font-size: 18px; }

  .plot:nth-child(-n + 4) { --depth-scale: .88; }
  .plot:nth-child(n + 5):nth-child(-n + 8) { --depth-scale: .93; }
  .plot:nth-child(n + 9):nth-child(-n + 12) { --depth-scale: .98; }
  .plot:nth-child(n + 13):nth-child(-n + 16) { --depth-scale: 1.03; }
  .plot:nth-child(n + 17) { --depth-scale: 1.08; }
}

@media (max-width: 820px) and (min-height: 700px) {
  .plots { bottom: 225px; }
}
