/* GL404 Casual Builder — interact.css (Worker B: tap/select/ghost/move)
   Ring seleksi, bubble aksi melayang, ghost preview, bar mode ghost.
   File ini TIDAK menyentuh style.css (milik Builder 1). */

/* Map-wrap: jangkar layer overlay + serahkan semua gestur sentuh ke JS
   (pan & ghost ditangani pointer events di interact.js). */
#map-wrap {
  position: relative;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Layer overlay: diposisikan dari JS sehingga koordinat layer == koordinat
   Iso (mode iso: di (0,0) #map-wrap) atau padding-box #map (fallback).
   Transparan terhadap pointer kecuali bubble aksi. */
.ix-layer {
  position: absolute;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}
.ix-svg { display: block; overflow: visible; }

/* Ring seleksi: outline hijau berdenyut di sekeliling footprint. */
.ix-ring {
  fill: rgba(34, 197, 94, 0.15);
  stroke: #22c55e;
  stroke-width: 3;
  stroke-linejoin: round;
  animation: ix-ring-pulse 1.1s ease-in-out infinite;
}
@keyframes ix-ring-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Footprint ghost: hijau = petak valid, merah = tidak valid. */
.ix-ghost-poly.valid {
  fill: rgba(34, 197, 94, 0.35);
  stroke: #22c55e;
  stroke-width: 2;
  stroke-linejoin: round;
}
.ix-ghost-poly.invalid {
  fill: rgba(239, 68, 68, 0.35);
  stroke: #ef4444;
  stroke-width: 2;
  stroke-linejoin: round;
}

/* Sprite ghost: mengikuti jari/kursor, semi-transparan. */
.ix-ghost-img { position: absolute; pointer-events: none; }
.ix-ghost-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0.75;
}
.ix-ghost-img.invalid img { filter: saturate(0.4) brightness(0.9); }

/* Bubble aksi melayang di dekat bangunan terpilih. */
.ix-bubble {
  position: absolute;
  display: flex;
  gap: 6px;
  pointer-events: auto;
  background: rgba(255, 251, 235, 0.97);
  border: 2px solid #b45309;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  z-index: 6;
}
.ix-bubble button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 54px;
  padding: 6px 6px 5px;
  font-size: 16px;
  line-height: 1;
  background: #fef3c7;
  border: 1px solid #d97706;
  border-radius: 8px;
  color: #78350f;
  cursor: pointer;
  white-space: nowrap;
}
.ix-bubble button span { font-size: 10px; font-weight: 700; }
.ix-bubble button:active { background: #fde68a; }
.ix-bubble button.collect { background: #dcfce7; border-color: #22c55e; color: #166534; }

/* Bar mode ghost: petunjuk + tombol batal (fixed, di atas map). */
.ix-ghost-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 92vw;
  background: rgba(41, 26, 8, 0.92);
  color: #fffbeb;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.ix-ghost-cancel {
  flex: none;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
}
.ix-ghost-cancel:active { filter: brightness(0.9); }
