/* 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 {
  position: relative;
  isolation: isolate;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 15px !important;
  background: color-mix(in srgb, var(--soil) 62%, #3e2418) !important;
  box-shadow:
    0 5px 0 color-mix(in srgb, var(--soil) 55%, #321d14) !important,
    0 8px 8px rgba(45, 31, 20, .14) !important;
}

.plot::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 5px;
  border: 2px solid color-mix(in srgb, var(--soil) 70%, #5b3522);
  border-radius: 14px;
  background:
    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%);
  box-shadow:
    inset 0 3px rgba(255, 226, 181, .2),
    inset 0 -5px rgba(48, 25, 15, .2);
  transform: none;
  pointer-events: none;
}

.plot:hover {
  transform: translateY(-3px) scale(1.015) !important;
}

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

.plot .soil-badge {
  z-index: 5;
  bottom: 2px;
}

.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 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;
}

.building-hit b {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  padding: 5px 11px;
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 12px;
  background: rgba(255, 253, 238, .92);
  box-shadow: 0 4px 12px rgba(36, 65, 33, .18);
  color: #31583d;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.building-hit:hover,
.building-hit:focus-visible {
  z-index: 12;
  outline: none;
  transform: translateY(-6px) scale(1.04);
  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: 3px 7px;
    border-width: 1px;
    border-radius: 8px;
    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: 11px !important;
    box-shadow:
      0 4px 0 color-mix(in srgb, var(--soil) 55%, #321d14) !important,
      0 6px 5px rgba(45, 31, 20, .12) !important;
  }

  .plot::before {
    inset: 0 0 4px;
    border-width: 2px;
    border-radius: 10px;
    background: 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%);
    box-shadow:
      inset 0 2px rgba(255, 226, 181, .18),
      inset 0 -3px rgba(48, 25, 15, .18);
  }

  .plot .crop { transform: translateY(-2px) rotate(-6deg); }
  .plot .soil-badge { transform: translateX(-50%) rotate(-6deg); }

  .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; }
}
