.espm-wrapper {
  --espm-pink: #ecb7b7;
  --espm-green: #87d69b;
  --espm-cyan: #00ffff;
  --espm-border: #9d9d9d;
  --espm-teal: #2ba4a6;
  --espm-accent: #1f6feb;
  --espm-warn: #e0972d;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.espm-wrapper * { box-sizing: border-box; }

.espm-logo-wrap { text-align: center; margin-bottom: 16px; }
.espm-logo-wrap img { max-width: 320px; height: auto; }

.espm-intro { max-width: 800px; margin: 0 auto 24px; text-align: center; font-size: 16px; line-height: 1.6; color: #333; }

.espm-teaser-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  position: relative;
}
.espm-teaser-btn img { display: block; width: 100%; height: auto; }
.espm-teaser-overlay {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(20,20,20,0.55);
  color: #fff;
  padding: 12px;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transition: opacity .2s ease;
}
.espm-teaser-btn:hover .espm-teaser-overlay,
.espm-teaser-btn:focus .espm-teaser-overlay { opacity: 1; }

/* ------------ Popup fullscreen ------------ */
.espm-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #f4f5f7;
  display: none;
  flex-direction: column;
  padding: 16px;
}
.espm-overlay.espm-open { display: flex; }
body.espm-noscroll { overflow: hidden; }

.espm-popup { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }

.espm-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 20;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.espm-close-btn:hover { background: var(--espm-accent); }

.espm-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 56px 8px 0;
}
.espm-toolbar input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}
.espm-zoom-controls { display: flex; gap: 6px; }
.espm-zoom-controls button {
  width: 38px; height: 38px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  color: #333;
}
.espm-zoom-controls button:hover { border-color: var(--espm-accent); color: var(--espm-accent); }
.espm-reset-btn { font-size: 13px !important; width: auto !important; padding: 0 12px; }

.espm-search-results { font-size: 13px; margin-bottom: 8px; }
.espm-search-results .espm-res-item {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 14px;
  cursor: pointer;
}
.espm-search-results .espm-res-item:hover { border-color: var(--espm-accent); color: var(--espm-accent); }

.espm-map-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.espm-map-wrapper.espm-dragging { cursor: grabbing; }

.espm-map-viewport { width: 100%; height: 100%; overflow: hidden; position: relative; }

.espm-map-inner {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  line-height: 0;
  transform-origin: 0 0;
  backface-visibility: hidden;
}
.espm-map-inner img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; }

.espm-stand {
  position: absolute;
  cursor: pointer;
  border: 1px solid var(--espm-border);
  overflow: hidden;
  container-type: size;
  container-name: espm-stand;
  pointer-events: auto;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.espm-stand[data-category="pink"]  { background: var(--espm-pink); }
.espm-stand[data-category="green"] { background: var(--espm-green); }
.espm-stand[data-category="cyan"]  { background: var(--espm-cyan); }
.espm-stand[data-category="pink"]:hover  { background: rgba(214,90,90,0.35); }
.espm-stand[data-category="green"]:hover { background: rgba(40,150,70,0.30); }
.espm-stand[data-category="cyan"]:hover  { background: rgba(0,160,180,0.30); }

.espm-stand-label {
  position: absolute;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  backface-visibility: hidden;
}
.espm-lbl-bold { color: #000; font-weight: 700; }
.espm-lbl-teal { color: var(--espm-teal); font-weight: 500; }
.espm-lbl-top    { top: 0; left: 50%; font-size: 3px; transform: translateX(-50%) scale(var(--espm-label-scale, 1)); transform-origin: top center; }
.espm-lbl-bottom { bottom: 1px; left: 50%; font-size: 3px; transform: translateX(-50%) scale(var(--espm-label-scale, 1)); transform-origin: bottom center; }
.espm-lbl-left   { left: -3px; top: 50%; font-size: 3px; transform: translateY(-50%) rotate(-90deg) scale(var(--espm-label-scale, 1)); transform-origin: center; }
.espm-lbl-right  { right: -3px; top: 50%; font-size: 3px; transform: translateY(-50%) rotate(90deg) scale(var(--espm-label-scale, 1)); transform-origin: center; }
.espm-lbl-tl { top: 1px; left: 0; font-size: 5px; transform: scale(var(--espm-label-scale, 1)); transform-origin: top left; }
.espm-lbl-tr { top: 1px; right: 1px; font-size: 5px; transform: scale(var(--espm-label-scale, 1)); transform-origin: top right; }
.espm-lbl-bl { bottom: 0; left: 0; font-size: 5px; transform: scale(var(--espm-label-scale, 1)); transform-origin: bottom left; }
.espm-lbl-br { bottom: 0; right: 0; font-size: 5px; transform: scale(var(--espm-label-scale, 1)); transform-origin: bottom right; }

.espm-stand-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  line-height: 1.15;
  color: #1a1a1a;
  font-weight: 600;
  max-width: 92%;
  padding: 0 2%;
}
@container espm-stand (min-width: 1px) {
  .espm-stand-center { font-size: 9cqw; }
}
.espm-stand-center .espm-mq-line { display: block; }
.espm-stand-center .espm-name-line { display: block; font-weight: 400; }

/* ------------ Scheda stand ------------ */
.espm-stand-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,20,20,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100010;
  padding: 20px;
}
.espm-stand-popup-overlay.espm-open { display: flex; }
.espm-stand-popup {
  background: #fff;
  border-radius: 10px;
  max-width: 420px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  position: relative;
}
.espm-stand-popup .espm-close-btn { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; font-size: 18px; }
.espm-stand-popup h2 { font-size: 18px; margin: 0 0 10px 0; line-height: 1.3; }
.espm-stand-popup .espm-popup-line { font-size: 14px; color: #444; margin: 0 0 6px 0; }
.espm-stand-popup .espm-popup-label {
  display: inline-block;
  font-weight: 600;
  color: #1a1a1a;
}
.espm-stand-popup .espm-popup-label::after { content: ": "; font-weight: 400; }
.espm-stand-popup .espm-popup-nazione { color: #555; }
.espm-stand-popup .espm-popup-padiglione { color: #444; }
.espm-stand-popup .espm-popup-codice {
  color: var(--espm-accent);
  font-weight: 500;
}
.espm-stand-popup .espm-popup-superficie { color: #666; margin-bottom: 14px; }
.espm-stand-popup .espm-link {
  display: inline-block; margin-top: 6px; font-size: 14px;
  color: var(--espm-accent); text-decoration: none; font-weight: 500;
}
.espm-stand-popup .espm-link:hover { text-decoration: underline; }
