/* [20-scene] Zone centrale : scènes isométriques, bâtiments du Domaine et pastilles de niveau */
/* ==========================================================================
   3. ZONE CENTRALE : SCÈNES ISOMÉTRIQUES & HUD SURIMPOSÉ
   ========================================================================== */
#scene-viewport {
  position: absolute;
  /* Contexte d'empilement propre : les z-index du décor (points du Domaine calculés d'après leur position, jusqu'à ~200 ;
     avant-plan du Quartier à 5000) restent entre eux et ne passent jamais devant le HUD (z-index 100), ex. le Portail sur l'alerte */
  isolation: isolate;
  inset: 0;
  overflow: hidden;
  background: #060708;
}

.scene-layer {
  position: absolute;
  inset: 0;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.3s ease;
}

#scene-estate-layer {
  background-color: #1d1b18; /* l'image du Domaine actif est posée par render.js */
  display: block;
}

#scene-neighborhood-layer.scene-neighborhood-pan-container {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  background: #060708;
  position: relative;
  overflow: hidden;
  display: none;
}

#neighborhood-pan-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #151311;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

/* Fond du quartier : l'image elle-même, floue et assombrie, pour les bandes autour de la carte dézoomée */
#neighborhood-pan-viewport::before {
  content: '';
  position: absolute;
  inset: -40px;
  background: var(--neighborhood-backdrop) center / cover no-repeat;
  filter: blur(14px) brightness(0.6);
  pointer-events: none;
}

#neighborhood-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1200px;
  height: 1080px;
  background-image: url('../assets/images/backgrounds/neighborhoods/neighborhood_bg.webp');
  background-size: 1200px 1080px;
  background-repeat: no-repeat;
  background-position: 0 0;
  transform-origin: 0 0;
  will-change: transform;
}

#scene-city-layer {
  background: #282b2d;
  display: none;
}

.interactive-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ==========================================================================
   BÂTIMENTS DU DOMAINE (ESTATE HOTSPOTS & ROUND LEVEL BADGES)
   ========================================================================== */
.estate-building-hotspot {
  position: absolute;
  cursor: pointer;
  pointer-events: auto !important;
  z-index: 10;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.estate-building-hotspot img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.estate-building-hotspot:hover {
  transform: scale(1.02);
  filter: drop-shadow(0 0 12px rgba(207, 138, 48, 0.6));
  z-index: 40;
}

/* Pastilles de niveau sur la scène : disque noir brillant à liseré clair */
.estate-building-badge,
.slot-level-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #5a5a5a 0%, #1a1a1a 45%, #000 100%);
  border: 1px solid #c8c8c8;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: 'Josefin Sans', 'Gill Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 1px #000;
  pointer-events: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.slot-level-badge { top: 4px; right: 8px; }
/* Jardinerie (sprite dessiné, plus bas que les sprites peints) : badge collé au toit de la serre */
.neighborhood-ground-slot[data-building="gardenCenter"] .slot-level-badge { top: 30px; right: 10px; }

/* bâtiment verrouillé : cadenas or à la place du chiffre */
.estate-building-badge.badge-locked {
  font-size: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 7V5a3 3 0 0 1 6 0v2' fill='none' stroke='%23e8c25a' stroke-width='1.8'/%3E%3Crect x='3.5' y='7' width='9' height='7' rx='1' fill='%23e8c25a' stroke='%236b4a08' stroke-width='.8'/%3E%3Ccircle cx='8' cy='10.3' r='1.1' fill='%235a3a06'/%3E%3C/svg%3E") center / 13px no-repeat,
    radial-gradient(circle at 38% 30%, #5a5a5a 0%, #1a1a1a 45%, #000 100%);
}

.estate-building-hotspot:hover .estate-building-badge,
.neighborhood-ground-slot:hover .slot-level-badge {
  transform: scale(1.12);
  border-color: #fff;
}

/* Chantier en cours : plaque noire au nom du bâtiment + bouton SPEED UP rouge */
.building-upgrading-ribbon {
  position: absolute;
  top: -42px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.build-plate-name {
  min-width: 72px;
  padding: 2px 10px;
  box-sizing: border-box;
  background: linear-gradient(180deg, #2a2a2a 0%, var(--ink-black) 100%);
  border: 1px solid #9a9a9a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  color: #fff;
  font-family: 'Josefin Sans', 'Gill Sans', sans-serif;
  font-size: 10.5px;
  text-align: center;
  text-shadow: 0 1px 1px #000;
}
.btn-ribbon-speedup {
  height: 17px;
  padding: 0 9px;
  background: linear-gradient(180deg, #d65344 0%, #a43528 50%, #7a241a 100%);
  border: 1px solid #e8b0aa;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(243, 225, 202, 0.5), 0 0 0 1px #0f2e24, 0 2px 4px rgba(0, 0, 0, 0.8);
  color: #fff;
  font-family: 'Josefin Sans', 'Gill Sans', sans-serif;
  font-size: 10px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}
.btn-ribbon-speedup:hover { filter: brightness(1.15); }
