* { box-sizing: border-box; margin: 0; padding: 0; }

.visualizer-2d-wrapper {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    background: #0f1117;
}

/* Canvas viewport */
.canvas-viewport {
    position: relative;
    flex: 1;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1a1d2e 0%, #0f1117 100%);
    overflow: hidden;
    padding: 20px;
}

.canvas-viewport canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Controls Panel */
.controls-panel-2d {
    background: #1a1d2e;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 20px;
    overflow-y: auto;
    max-height: 50vh;
}

.controls-panel-2d h3 {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(59,130,246,0.4);
}

.control-group-2d {
    margin-bottom: 22px;
}

.control-group-2d h4 {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* House set selector */
.house-set-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 transparent;
}
.house-set-scroll::-webkit-scrollbar { height: 4px; }
.house-set-scroll::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 4px; }

.house-set-card {
    flex-shrink: 0;
    width: 140px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: #252836;
}
.house-set-card img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
.house-set-card span {
    display: block;
    text-align: center;
    padding: 6px 4px;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
}
.house-set-card:hover {
    border-color: rgba(59,130,246,0.5);
    transform: translateY(-2px);
}
.house-set-card.active {
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59,130,246,0.3);
}
.house-set-card.active span {
    color: #3b82f6;
}

/* Texture cards */
.texture-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 transparent;
}
.texture-scroll::-webkit-scrollbar { height: 4px; }
.texture-scroll::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 4px; }

.tex-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 10px;
    background: #252836;
    border: 2px solid transparent;
    padding: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 95px;
}
.tex-card img {
    width: 75px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
}
.tex-card span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    line-height: 1.2;
}
.tex-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59,130,246,0.4);
}
.tex-card.active {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.1);
}
.tex-card.active span {
    color: #3b82f6;
}

/* Sliders */
.slider-row {
    padding: 0 4px;
}
.slider-row input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: #3b82f6;
    height: 6px;
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 5px;
    font-weight: 600;
}
.slider-labels .live-value {
    color: #3b82f6;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,17,23,0.85);
    z-index: 10;
    transition: opacity 0.4s ease;
}
.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59,130,246,0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Desktop layout */
@media (min-width: 1024px) {
    .visualizer-2d-wrapper {
        flex-direction: row;
        height: calc(100vh - 80px);
    }
    .canvas-viewport {
        flex: 1;
        min-height: auto;
    }
    .controls-panel-2d {
        width: 380px;
        max-height: none;
        overflow-y: auto;
        border-top: none;
        border-left: 1px solid rgba(255,255,255,0.06);
    }
}
