/* The hit areas use the same bottom-centered canvas as object-fit: contain.
   The insets follow the opaque pixels of each stage with a small tap margin. */
.game #scene .illustrated-building {
  container-type:size;
  pointer-events:none !important;
}
/* A hover or touch highlights the building without lifting it off its plot. */
#game #scene :is(.house-object, .illustrated-building):is(:hover, :active) {
  transform:none;
}
.game #scene .illustrated-building .building-art {
  display:block !important;
  object-fit:contain !important;
  object-position:center bottom !important;
  transform:none !important;
  pointer-events:none !important;
}
.game #scene .illustrated-building > .touch-hit {
  display:block !important;
  position:absolute !important;
  z-index:3 !important;
  background:transparent !important;
  pointer-events:auto !important;
  cursor:pointer;
  touch-action:manipulation;
  transform:translateX(-50%) !important;
  left:50% !important;
  top:auto !important;
  bottom:0 !important;
  width:min(100cqw,150cqh) !important;
  height:min(66.6667cqw,100cqh) !important;
  clip-path:inset(var(--village-hit-inset));
}

/* A clear entrance below each sprite. The workshop status is a separate row. */
#game #scene .illustrated-building .building-sign,
#game #scene .house-object .object-tag {
  top:100% !important;
  bottom:auto !important;
  transform:translateX(-50%) !important;
  z-index:12;
  pointer-events:auto !important;
  cursor:pointer;
}
#game #scene .workshop .building-caption {
  position:absolute;
  z-index:12;
  top:calc(100% + 13cqh);
  left:50%;
  transform:translateX(-50%);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:3px;
}
#game #scene .house-object .object-tag {
  top:calc(100% + 10cqh) !important;
}
#game #scene .workshop .building-caption > span {
  position:static !important;
  transform:none !important;
  max-width:none;
}

.game #scene [data-object="workshop"] { --village-hit-inset:40% 27% 2% 27%; }
.game #scene [data-object="workshop"][data-visual-phase="2"] { --village-hit-inset:30% 23% 2% 23%; }
.game #scene [data-object="workshop"][data-visual-phase="3"] { --village-hit-inset:20% 19% 2% 19%; }
.game #scene [data-object="workshop"][data-visual-phase="4"] { --village-hit-inset:30% 15% 2% 17%; }
.game #scene [data-object="workshop"][data-visual-phase="5"] { --village-hit-inset:20% 9% 2% 12%; }
.game #scene [data-object="workshop"][data-visual-phase="6"] { --village-hit-inset:11% 4% 2% 8%; }
.game #scene [data-object="nursery"] { --village-hit-inset:43% 27% 2% 27%; }
.game #scene [data-object="nursery"][data-visual-phase="2"] { --village-hit-inset:37% 18% 2% 18%; }
.game #scene [data-object="nursery"][data-visual-phase="3"] { --village-hit-inset:19% 8% 2% 8%; }
.game #scene [data-object="post"] { --village-hit-inset:38% 28% 2% 28%; }
.game #scene [data-object="post"][data-visual-phase="2"] { --village-hit-inset:27% 19% 2% 19%; }
.game #scene [data-object="post"][data-visual-phase="3"] { --village-hit-inset:11% 8% 2% 8%; }

@media (max-height:500px) and (orientation:landscape) {
  #game #scene .illustrated-building .building-sign,
  #game #scene .house-object .object-tag {
    font-size:10px !important;
    padding:3px 6px !important;
  }
  /* Leave room for the progress bars above the fixed bottom navigation. */
  #game #scene :is([data-object="post"], [data-object="nursery"]) .building-sign {
    top:auto !important;
  }
  #game #scene [data-object="post"] .building-sign {
    bottom:max(2%, calc(74px - 16.2dvh)) !important;
  }
  #game #scene [data-object="nursery"] .building-sign {
    bottom:max(-20px, calc(74px - 23.15dvh)) !important;
  }
  #scene :is([data-magic-meter="post"], [data-magic-meter="nursery"]) {margin-top:-4px;}
  #scene :is([data-magic-meter="post"], [data-magic-meter="nursery"])::before {top:-3px;}
}

@media (prefers-reduced-motion: reduce) {
  .game #scene .illustrated-building .building-art { transition:none !important; }
}
