body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.spatial-module-container {
    background: #ffffff;
    width: 100%;
    max-width: 800px;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.module-header {
    text-align: center;
    margin-bottom: 20px;
}

.module-header h2 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    color: #1f2937;
}

.readout {
    font-size: 0.9rem;
    color: #6b7280;
}

.readout strong {
    color: #2563eb;
}

/* Canvas & Stacking Logic */
.canvas-viewport {
    position: relative;
    width: 100%;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    /* This ensures space is reserved before images load */
    min-height: 300px; 
}

.canvas-viewport.zoomed {
    cursor: zoom-out;
}

.plan-stack {
    position: relative;
    width: 100%;
    transition: transform 0.4s ease;
    transform-origin: center center;
}

.canvas-viewport.zoomed .plan-stack {
    transform: scale(1.5);
}

.plan-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}

.base-layer {
    position: relative;
    z-index: 1;
}

.overlay-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    /* Transition ensures smooth fading */
    transition: opacity 0.1s linear; 
}

.zoom-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 20;
}

/* Controls */
.controls-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    gap: 16px;
}

.label-group {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.label-title {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.label-sub {
    font-size: 0.75rem;
    color: #9ca3af;
}

.slider-wrapper {
    flex: 2;
}

.elasticity-slider {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.elasticity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@media (max-width: 640px) {
    .controls-area {
        flex-wrap: wrap;
    }
    .slider-wrapper {
        order: 1;
        flex: 0 0 100%;
        margin-bottom: 12px;
    }
    .label-group {
        order: 2;
    }
    .label-group.left { text-align: left; }
    .label-group.right { text-align: right; }
}

/* Define the looping pulse animation */
@keyframes spatialPulse {
  0% { opacity: 1; }   /* Shows 83sqm Standard Plan */
  100% { opacity: 0; } /* Reveals 93sqm Premium Plan */
}

/* Class to trigger the loop */
.is-looping {
  animation: spatialPulse 4s infinite alternate ease-in-out;
  pointer-events: none; /* Prevents interaction during loop if desired */
}