*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background-color: #f4f3ef;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
  display: none;
}

body, table, td, th {
  font-variant-numeric: tabular-nums lining-nums;
}

/* =========================================================
   1. BARRE A CAPSULA (APPLE PILL NAV - STILE NATIVO)
   ========================================================= */
.capsule-bar {
  background-color: rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 980px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
}

.scenario-pill {
  border-radius: 980px;
  padding: 8px 18px;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.016em;
  text-transform: none;
  text-align: center;
  border: none;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #1d1d1f;
  background-color: transparent;
  font-weight: 400;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.scenario-pill:hover:not(.active) {
  color: #000000;
  background-color: rgba(255, 255, 255, 0.5);
}

.scenario-pill:active {
  transform: scale(0.97);
}

.scenario-pill.active {
  background-color: #1d1d1f;
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Toggle Demolizioni */
.demolition-toggle-btn {
  border-radius: 980px;
  padding: 8px 18px;
  font-size: 13.5px;
  line-height: 1.25;
  letter-spacing: -0.012em;
  text-transform: none;
  cursor: pointer;
  border: 1px solid #d2d0c9;
  background-color: #f4f3ef;
  color: #6e6e73;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  font-weight: 450;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.demolition-toggle-btn:hover {
  border-color: #1d1d1f;
  color: #1d1d1f;
}

.demolition-toggle-btn:active {
  transform: scale(0.97);
}

.demolition-toggle-btn.active {
  background-color: #1d1d1f;
  color: #ffffff;
  border-color: #1d1d1f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #86868b;
  transition: all 0.24s ease;
}

.demolition-toggle-btn.active .status-dot {
  background-color: #ff3b30;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.85);
}

/* =========================================================
   2. PANTELLERIA 360 & DOCK CON SLIDER FLUIDO APPLE NATIVO
   ========================================================= */
.chaos-panorama-stage {
  width: 100%;
  position: relative;
  background-color: #eceae5;
  border: 1px solid #dedbd3;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  aspect-ratio: 16 / 9;
  min-height: 320px;
  max-height: 72vh;
  border-radius: 18px;
}

@media (max-width: 640px) {
  .chaos-panorama-stage {
    aspect-ratio: 16 / 11;
    min-height: 290px;
    border-radius: 14px;
  }
}

#panorama-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Dock esterno senza bordi e con raggio perfettamente concentrico */
.apple-glass-dock {
  position: relative;
  background: rgba(240, 239, 235, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: none;
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.18);
  border-radius: 980px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: calc(100% - 20px);
  overflow: hidden;
  height: 44px;
}

/* L'indicatore nero scivola a filo senza lasciare bordi chiari attorno */
.dock-sliding-pill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100%;
  width: 0;
  background-color: #1d1d1f;
  border-radius: 980px;
  pointer-events: none;
  z-index: 1;
  transform: translate3d(0, 0, 0);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, width;
}

.apple-dock-pill {
  position: relative;
  z-index: 2;
  border: none;
  outline: none;
  border-radius: 980px;
  padding: 0 16px;
  height: 100%;
  font-size: 13.5px;
  font-weight: 450;
  letter-spacing: -0.012em;
  text-transform: none;
  color: #1d1d1f;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.apple-dock-pill.active {
  color: #ffffff;
  font-weight: 500;
}

.apple-dock-pill:hover:not(.active) {
  color: #000000;
}

.apple-dock-pill:active {
  transform: scale(0.97);
}

.apple-dock-pill .prefix {
  opacity: 0.45;
  margin-right: 5px;
  font-size: 11px;
  transition: opacity 0.24s ease, color 0.24s ease;
}

.apple-dock-pill.active .prefix {
  opacity: 0.75;
  color: #dedbd3;
}

@media (max-width: 640px) {
  .apple-glass-dock {
    height: 38px;
    max-width: calc(100% - 14px);
  }

  .apple-dock-pill {
    padding: 0 10px;
    font-size: 12px;
  }

  .apple-dock-pill .prefix {
    margin-right: 3px;
    font-size: 10px;
  }
}

/* =========================================================
   3. BOTTONI CIRCOLARI, ZOOM E PADDLENAV
   ========================================================= */
.apple-circular-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #d2d0c9;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #1d1d1f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.apple-circular-close-btn:hover {
  background: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.apple-circular-close-btn:active {
  transform: scale(0.95);
}

.apple-zoom-capsule {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #d2d0c9;
  border-radius: 980px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.apple-zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1d1d1f;
  font-size: 16px;
  font-weight: 450;
  transition: all 0.15s ease;
  cursor: pointer;
  background: transparent;
  border: none;
}

.apple-zoom-btn:hover {
  background: #eceae5;
}

.apple-zoom-btn:active {
  transform: scale(0.92);
}

.apple-nav-arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #d2d0c9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1d1d1f;
  font-size: 18px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.apple-nav-arrow-btn:hover {
  background: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.apple-nav-arrow-btn:active {
  transform: scale(0.95);
}

.apple-nav-arrow-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* =========================================================
   4. RENDER GALLERY & CARD DI PROGETTO
   ========================================================= */
.render-frame {
  position: relative;
  background-color: #eceae5;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
  border-radius: 16px;
  transition: box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.render-frame img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.render-frame:hover {
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.12);
}

.render-frame:hover img {
  transform: scale(1.018);
  filter: contrast(102%) brightness(101%);
}

.expand-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background-color: rgba(29, 29, 31, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f4f3ef;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 980px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.render-frame:hover .expand-badge {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hero-title {
  font-size: clamp(26px, 5.8vw, 76px);
  line-height: 0.94;
  white-space: nowrap;
}

/* Hotspot 360 */
@keyframes subtleGlow {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.apple-360-marker {
  position: absolute;
  top: -14px;
  left: -14px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  z-index: 10;
}

.apple-marker-ring {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: subtleGlow 3.2s infinite ease-out;
}

.apple-marker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-360-marker:hover .apple-marker-ring {
  transform: scale(1.22);
  background: rgba(255, 255, 255, 0.75);
  border-color: #ffffff;
}

.apple-marker-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(29, 29, 31, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f4f3ef;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 4px 10px;
  border-radius: 980px;
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.apple-360-marker:hover .apple-marker-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modale Prodotto */
.apple-product-marker {
  position: absolute;
  top: -15px;
  left: -15px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  z-index: 15;
}

.apple-product-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(29, 29, 31, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: serif;
  font-style: italic;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-product-marker:hover .apple-product-ring {
  transform: scale(1.15);
  background: #000000;
  border-color: #ffffff;
}

#product-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#product-modal.open {
  display: flex;
  opacity: 1;
}

.product-card {
  background: rgba(244, 243, 239, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  transform: translateY(8px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#product-modal.open .product-card {
  transform: translateY(0) scale(1);
}

/* Modali Overlay */
#render-lightbox, #abaco-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 9999;
  background-color: rgba(29, 29, 31, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

#plan-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 9999;
  background-color: #f4f3ef;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  box-sizing: border-box;
}

#render-lightbox.open, #plan-modal.open, #abaco-modal.open {
  display: flex;
}

.apple-floating-card {
  background: #f4f3ef;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  width: 94vw;
  max-width: 1440px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}

#abaco-modal.open .apple-floating-card {
  transform: translateY(0) scale(1);
}

/* Supporto Fullscreen Tour 360 */
.chaos-panorama-stage.mobile-fullscreen-active,
.chaos-panorama-stage:fullscreen,
.chaos-panorama-stage:-webkit-full-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  aspect-ratio: auto !important;
  z-index: 999999 !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  background-color: #000000 !important;
}

.tour-top-header {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  padding: 0 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.tour-top-header > * {
  pointer-events: auto;
}

.ios-close-btn {
  display: none;
  background: rgba(244, 243, 239, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  color: #1d1d1f;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 6px 14px;
  border-radius: 980px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.ios-close-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: scale(1.03);
}

.chaos-panorama-stage.mobile-fullscreen-active .ios-close-btn,
.chaos-panorama-stage:fullscreen .ios-close-btn,
.chaos-panorama-stage:-webkit-full-screen .ios-close-btn {
  display: inline-flex !important;
  align-items: center;
}

.pnlm-title-box,
.pnlm-author-box,
.pnlm-load-box {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  pointer-events: none !important;
}

.pnlm-hotspot-base {
  visibility: visible !important;
  opacity: 1 !important;
  display: block !important;
}