html, body {
    font-family: var(--font-title, sans-serif);
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden !important; 
    display: flex;
    flex-direction: column;
}
.configurator-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0; 
    position: relative;
}
.main-content {
    position: relative;
    display: flex;
    flex: 1;
    width: 100%;
    min-height: 0; 
    overflow: hidden;
    align-items: center; 
    justify-content: center; 
    background-color: #2a2a2a; 
}
.image-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
}
#roomCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
}
.room-selector-pills {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    background: rgba(225, 218, 212, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 4px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    gap: 2%;
    width: 40%;
    justify-content: center;
}
.room-pill {
    padding: 5px 20px;
    border-radius: 6px;
    color: var(--primary-brown, #4a2511);
    font-family: var(--font-title, sans-serif);
    font-weight: 600;
    font-size: 18px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    white-space: nowrap;
}
.room-pill:hover {
    background-color: rgba(225, 218, 212, 0.75);
}
.room-pill.active {
    background-color: var(--primary-brown, #4a2511);
    color: #ffffff;
}
.side-menu-container {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
}
.main-menu {
    display: flex;
    flex-direction: column;
    background: rgba(225, 218, 212, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    overflow: hidden;
    width: 70px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.main-menu:hover {
    width: 240px;
}
.menu-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    color: var(--primary-brown, #4a2511);
    transition: background-color 0.2s;
    white-space: nowrap;
}
.menu-item:hover {
    background-color: rgba(225, 218, 212, 0.75);
}
.menu-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-brown, #4a2511);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.menu-icon img {
    width: 45px;
    height: 45px;
    padding: 5px;
}
.menu-item span {
    margin-left: 15px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.main-menu:hover .menu-item span {
    opacity: 1;
    transition-delay: 0.1s;
}
.sub-menu {
    position: absolute;
    left: 0;
    top: 50%; 
    background: rgba(220, 215, 210, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    width: 260px;
    padding: 20px;
    display: none;
    flex-direction: column;
    transform: translate(-20px, -50%); 
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.sub-menu.active {
    display: flex;
    transform: translate(0, -50%); 
    opacity: 1;
    pointer-events: auto;
}
.sub-menu-header {
    display: flex;
    align-items: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 20px;
    cursor: pointer;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.sub-menu-header i {
    margin-right: 12px;
    font-size: 16px;
}
.finishes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    max-height: 350px;
    overflow-y: auto;
    padding: 5px;
    -webkit-overflow-scrolling: touch;
}
.finishes-grid::-webkit-scrollbar {
    width: 4px;
}
.finishes-grid::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.3); 
    border-radius: 4px;
}
.finishes-grid::-webkit-scrollbar-thumb {
    background: var(--primary-brown, #4a2511);
    border-radius: 4px;
}
.finish-card {
    background-color: var(--primary-brown, #4a2511);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}
.finish-card.active {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-brown, #4a2511);
}
.finish-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
}
.finish-img-container {
    width: calc(100% - 10px);
    margin: 5px auto 0 auto;
    height: 80px;
    border-radius: 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background-size: cover;
    background-position: center;
    position: relative;
}
.finish-name {
    padding: 10px 5px;
    text-align: center;
    font-size: 14px;
    line-height: normal;
    font-weight: 800;
    color: #ffffff;
}
.finish-name span {
    font-size: 11px;
    display: block;
    font-weight: 400;
}
.shade-finish-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 5px;
    border-radius: 8px;
}
.shade-finish-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    color: var(--primary-brown, #4a2511);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}
.shade-finish-btn.active {
    background-color: var(--primary-brown, #4a2511);
    color: white;
}
#loading-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: var(--primary-brown, #4a2511);
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 100;
    transition: opacity 0.5s;
}
#loading-overlay::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--medium-gray, #ccc);
    border-top-color: var(--primary-brown, #4a2511);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
footer { display: none; }
@keyframes spin {
    to { transform: rotate(360deg); }
}
.top-right-actions {
    position: absolute;
    top: 20px;
    right: 30px;
    display: inline-flex;
    align-items: center;
    background: rgba(225, 218, 212, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 4px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    gap: 10px;
}
.action-pill {
    padding: 5px 15px;
    border-radius: 6px;
    color: var(--primary-brown, #4a2511);
    font-family: var(--font-title, sans-serif);
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.action-pill:hover {
    background-color: var(--primary-brown, #4a2511);
    color: #ffffff;
}
.action-pill i { font-size: 14px; }
.disclaimer-note {
    position: absolute;
    bottom: 20px;
    left: 30px;
    background: rgba(225, 218, 212, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 6px 12px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: var(--primary-brown, #4a2511);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    pointer-events: none;
}
.zoom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.zoom-modal {
    background: #E6DDD5;
    padding: 20px;
    border-radius: 12px;
    width: 90vw;
    height: 90vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    flex-direction: column;
}
.zoom-modal .close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    color: var(--primary-brown, #4a2511);
    font-size: 24px;
    z-index: 10;
    background: #E6DDD5;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.zoom-image-container {
    flex: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    border-radius: 8px;
    margin-top: 10px;
}
#zoomCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
}
.modal-control-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 8px;
    background: rgba(225, 218, 212, 0.75);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.m-btn {
    background: var(--primary-brown, #4a2511);
    color: white;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.2s, transform 0.1s;
}
.m-btn:hover {
    opacity: 0.8;
}
.m-btn:active {
    transform: scale(0.95);
}
.m-btn:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
    transform: none;
}
.m-divider {
    width: 2px;
    height: 24px;
    background: rgba(74, 37, 17, 0.2);
    margin: 0 5px;
}
.share-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}
.share-modal {
    background: #E6DDD5;
    padding: 30px;
    border-radius: 12px;
    width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
}
.share-modal h3 {
    color: var(--primary-brown, #4a2511);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    text-align: center;
    text-transform: uppercase;
}
.share-modal .close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    color: var(--primary-brown, #4a2511);
    font-size: 18px;
}
.share-modal input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid rgba(74, 37, 17, 0.2);
    border-radius: 6px;
    box-sizing: border-box;
    font-family: var(--font-title, sans-serif);
}
.share-modal button {
    width: 100%;
    padding: 12px;
    background: var(--primary-brown, #4a2511);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-title, sans-serif);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
}
.share-modal button:hover { opacity: 0.9; }
.share-modal button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Desktop / Tablet Landscape Breakpoints */
@media (max-width: 1200px) and (orientation: landscape) {
    .room-selector-pills { width: 50%; }
    .room-pill { font-size: 16px; padding: 5px 16px; }
    .action-pill { font-size: 14px; padding: 5px 12px; }
}

@media (max-width: 900px) and (orientation: landscape) {
    .room-selector-pills { width: 65%; top: 15px; }
    .room-pill { font-size: 14px; padding: 5px 12px; }
    .side-menu-container { left: 15px; }
    .main-menu { width: 60px; }
    .main-menu:hover { width: 60px; }
    .main-menu:hover .menu-item span { display: none; }
    .menu-icon { width: 42px; height: 42px; }
    .menu-icon img { width: 38px; height: 38px; padding: 4px; }
    .sub-menu { width: 230px; padding: 16px; }
    .finishes-grid { gap: 12px; max-height: 300px; }
    .finish-img-container { height: 70px; }
    .finish-name { font-size: 13px; padding: 8px 4px; }
    .top-right-actions { top: 15px; right: 15px; padding: 3px; gap: 6px; }
    .action-pill { font-size: 13px; padding: 4px 10px; gap: 6px; }
    .disclaimer-note { bottom: 15px; left: 15px; font-size: 9px; padding: 5px 8px; max-width: 55%; }
    .share-modal { width: 320px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .room-selector-pills { top: 6px; }
    .room-pill { padding: 3px 8px; font-size: 11px; }
    .top-right-actions { top: 6px; }
    .disclaimer-note { position: fixed; top: auto; bottom: 10px; font-size: 8px; text-align: center; z-index: 9999; }
    .sub-menu { max-height: calc(100vh - 30px); overflow-y: auto; }
    .finishes-grid { max-height: 180px; }
}

.mobile-zoom-btn {
    display: none !important;
}

/* ========================================================= */
/* MOBILE PORTRAIT MODE                                       */
/* ========================================================= */
@media (max-width: 768px) and (orientation: portrait) {
    .mobile-zoom-btn {
        display: flex !important;
    }
    .desktop-zoom-btn {
        display: none !important;
    }
    .zoom-modal {
        width: 95vw;
        height: 70vw; 
        padding: 10px;
    }
    .zoom-modal .close-modal {
        top: 8px;
        right: 8px;
        width: 26px;
        height: 26px;
        font-size: 16px;
    }
    .modal-control-bar {
        margin-top: 8px;
        padding: 6px;
        gap: 6px;
    }
    .m-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    .m-divider {
        margin: 0 2px;
    }

    html, body {
        overflow: hidden !important;
        height: 100%;
    }
    .configurator-wrapper {
        height: 100%;
        display: flex;
        flex-direction: column;
        background-color: #efe9e2;
        overflow: hidden;
    }
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        align-items: stretch;
        justify-content: flex-start;
        min-height: 0;
        background-color: #efe9e2;
    }
    .image-panel {
        position: relative;
        top: auto;
        left: auto;
        width: 100vw;
        height: 55vw; 
        max-height: 38vh;
        flex-shrink: 0;
        order: 1;
    }
    #roomCanvas {
        width: 100%;
        height: 100%;
    }
    .top-right-actions {
        position: absolute;
        z-index: 15;
        top: 8px;
        right: 8px;
        padding: 3px 6px;
        gap: 6px;
        border-radius: 8px;
        background: rgba(225, 218, 212, 0.85);
    }
    .action-pill {
        padding: 4px 8px;
        gap: 4px;
        font-size: 12px;
    }
    .action-pill span { display: none; }
    .action-pill i { font-size: 15px; }

    .room-selector-pills {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        border-radius: 0;
        background: #e8e0d8;
        border: none;
        border-bottom: 1px solid rgba(74, 37, 17, 0.15);
        padding: 6px 8px;
        gap: 6px;
        justify-content: center;
        box-shadow: none;
        order: 2;
        flex-shrink: 0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        display: flex;
        box-sizing: border-box;
    }
    .room-pill {
        font-size: 11px;
        padding: 5px 10px;
        border-radius: 6px;
        flex: 1;
        max-width: 120px;
        text-align: center;
    }

    .side-menu-container {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 100%;
        flex-direction: column;
        order: 3;
        flex: 1;
        min-height: 0;
        display: flex;
        background: #f5f0eb;
        overflow: hidden;
    }
    .main-menu {
        display: flex !important;
        flex-direction: row;
        width: 100% !important;
        border-radius: 0;
        background: #e1d9d0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        border-bottom: 1px solid rgba(74, 37, 17, 0.15);
        overflow: visible;
        transition: none;
        flex-shrink: 0;
    }
    .main-menu:hover { width: 100% !important; }
    .menu-item {
        flex: 1;
        justify-content: center;
        padding: 8px 6px;
        gap: 6px;
        border-right: 1px solid rgba(74, 37, 17, 0.1);
    }
    .menu-item:last-child { border-right: none; }
    .menu-item:hover { background-color: rgba(74, 37, 17, 0.08); }
    .menu-item span {
        opacity: 1 !important;
        margin-left: 0;
        font-size: 11px;
        display: block !important;
        transition: none;
        text-align: center;
        white-space: normal;
    }
    .main-menu:hover .menu-item span {
        opacity: 1 !important;
        display: block !important;
    }
    .menu-icon {
        width: 30px;
        height: 30px;
    }
    .menu-icon img {
        width: 22px;
        height: 22px;
        padding: 2px;
    }

    .sub-menu {
        position: relative;
        left: auto;
        top: auto;
        transform: none !important;
        width: 100% !important;
        border-radius: 0;
        border: none;
        background: #f5f0eb;
        box-shadow: none;
        padding: 10px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transition: none;
        opacity: 1;
        flex: 1;
        min-height: 0;
        box-sizing: border-box;
    }
    .sub-menu.active {
        display: flex !important;
        flex-direction: column;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto;
    }
    .sub-menu-header {
        color: var(--primary-brown, #4a2511);
        text-shadow: none;
        font-size: 12px;
        margin-bottom: 8px;
        padding-bottom: 6px;
        border-bottom: 1px solid rgba(74, 37, 17, 0.12);
        flex-shrink: 0;
    }
    .sub-menu-header i { font-size: 13px; }

    .shade-finish-selector {
        margin-bottom: 8px;
        padding: 3px;
        border-radius: 6px;
        flex-shrink: 0;
    }
    .shade-finish-btn {
        font-size: 10px;
        padding: 5px 8px;
        border-radius: 4px;
    }

    .finishes-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        max-height: none;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        grid-auto-rows: max-content;
        padding:4px;
        -webkit-overflow-scrolling: touch;
    }
    .finish-card {
        border-radius: 6px;
        background-color: var(--primary-brown, #4a2511);
    }
    .finish-img-container {
        height: 48px;
        width: calc(100% - 6px);
        margin: 3px auto 0 auto;
        border-radius: 4px;
    }
    .finish-name {
        font-size: 10px;
        padding: 4px 2px;
        line-height: 1.25;
        text-align: center;
        word-break: break-word;
    }
    .finish-name span {
        font-size: 8px;
        display: block;
        opacity: 0.9;
        font-weight: 400;
        margin-top: 1px;
    }

    .disclaimer-note {
        display: block;
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100%;
        max-width: 100%;
        font-size: 8px;
        line-height: 1.25;
        text-align: center;
        z-index: 5;
        padding: 6px 10px;
        background: #e8e0d8;
        color: var(--primary-brown, #4a2511);
        border: none;
        border-top: 1px solid rgba(74, 37, 17, 0.12);
        box-shadow: none;
        order: 4;
        flex-shrink: 0;
        box-sizing: border-box;
    }
}