.controls-inline-row {
    display: flex;
    gap: 15px; /* Space between the two columns */
    margin-bottom: 10px;
}

.controls-inline-row .control-group {
    flex: 1; /* Makes both columns equal width */
    margin-bottom: 10px; /* Overriding the default 20px to save space */
}

/* Optional: adjust the display labels so they don't wrap weirdly */
.controls-inline-row label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    /* Base lock for desktop views */
    overflow: hidden; 
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: rgb(210, 210, 210);
    display: flex; 
    flex-direction: row; 
}

#container {
    position: relative;
    flex-grow: 1; 
    min-width: 0; 
    min-height: 0;
    z-index: 0;
    outline: none;
}

#loading-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 15px 25px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    z-index: 1000;
    pointer-events: none;
    display: none; 
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

#loading-overlay::before {
    content: '';
    width: 16px; height: 16px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* --- ROTATION HINT --- */
#rotate-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.6s ease;
    color: white;
    text-align: center;
}

.rotate-icon {
    width: 80px;
    height: 80px;
    background: #e5673d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 10px;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.2);
    animation: pulseHint 2s infinite ease-in-out;
}

#rotate-hint span {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@keyframes pulseHint {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* --- CONFIRMATION MODAL --- */
#confirmation-modal {
    position: absolute; 
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 300px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
}

.modal-content p {
    margin-top: 0;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 20px;
    font-weight: 600;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s;
}

#modal-ok { background-color: #222; color: #fff; }
#modal-ok:hover { background-color: #000; }

#modal-cancel { background-color: #e0e0e0; color: #333; }
#modal-cancel:hover { background-color: #d0d0d0; }
/* -------------------------- */

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#home-btn {
    position: absolute;
    top: 20px; right: 20px;
    width: 44px; height: 44px;
    background-color: #ffffff;
    border: 2px solid #222222;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    color: #222222;
}
#home-btn:hover {
    background-color: #222222; color: #ffffff;
    transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#home-btn:active { transform: scale(0.95); }

#volume-indicator {
    position: absolute;
    bottom: 15px;
    left: 15px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
    z-index: 20;
    pointer-events: none;
}

canvas { display: block; width: 100%; height: 100%; }

#ui {
    position: relative;
    width: 380px;
    height: 100%; 
    background: #ffffff; 
    border-left: 1px solid #e0e0e0; 
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    box-sizing: border-box;
    z-index: 100; flex-shrink: 0; 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* --- NEW LAYOUT ROLES --- */
#ui-scroll-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0; 
}

#ui-fixed-footer {
    position: relative;
    flex-shrink: 0;
    border-top: 2px solid #e0e0e0;
    background-color: #fafafa;
    padding-bottom: 10px;
    z-index: 110;
}

/* --- SCROLL PROMPT --- */
#scroll-prompt {
    position: absolute;
    bottom: 100%; 
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(255,255,255,1) 40%, rgba(255,255,255,0));
    padding: 50px 0 15px 0; 
    text-align: center;
    font-size: 22px; 
    font-weight: 900; 
    color: #9eb37a;
    text-transform: uppercase;
    pointer-events: none;
    z-index: 105;
    transition: opacity 0.4s ease;
    opacity: 0; 
}

#scroll-prompt span {
    display: block;
    font-size: 36px; 
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-5px);}
    60% {transform: translateY(-3px);}
}

.accordion-section {
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.accordion-header {
    padding: 15px 15px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.section-header:first-of-type { margin-top: 0; }
.accordion-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.accordion-content {
    padding: 0 25px 25px 25px;
    display: block; 
}

.accordion-header::after {
    display: none;
}

/* --- MOBILE / PORTRAIT OVERRIDE: ABSOLUTE LOCK --- */
@media (orientation: portrait) {
    html, body {
        display: block;
        height: 100% !important; /* Strict lock */
        width: 100%;
        overflow: hidden !important; /* Prevent page-level scrolling entirely */
        position: relative;
    }
    
    #container { 
        position: absolute;
        top: 0;
        left: 0;
        width: 100%; 
        height: 35vh; 
        min-height: 170px;
        z-index: 5;
    }
    
    #ui {
        position: absolute;
        top: max(35vh, 170px); /* Start immediately below canvas */
        bottom: 0; /* Anchor strictly to the bottom of the window/iframe */
        left: 0;
        width: 100%; 
        height: auto; /* Let top/bottom dictate height */
        display: flex; 
        flex-direction: column;
        border-left: none; 
        border-top: 1px solid #e0e0e0;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
        z-index: 10; 
    }
	
	 @media only screen and (max-height: 768px) {
		#container {
			height: 35vh; 
			min-height: 170px;
		}
		#ui {
			top: max(35vh, 170px); /* Start immediately below canvas */			
		}
		 
	 }
	
	

    #ui-scroll-container {
        flex: 1; /* Take up all space inside #ui */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 20px;
    }
    
    #home-btn { top: 15px; right: 15px; }
    
    #ui-fixed-footer {
        flex-shrink: 0;
        position: relative;
        padding-bottom: 12px; 
        z-index: 20;
    }

    #scroll-prompt {
        display: none; 
    }
}

.control-group { margin-bottom: 20px; }
label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 13px; color: #444; }
select, input[type=text] { width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #ccc; box-sizing: border-box; }
.input-row { display: flex; align-items: center; gap: 10px; }

input[type=range] { 
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 1; 
    cursor: pointer; 
    height: 6px;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: linear-gradient(to right, var(--slider-color, #9eb37a) var(--slider-val, 50%), #ffffff var(--slider-val, 50%));
    outline: none;
}
input[type=range]:hover {
    --slider-color: #233409;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--slider-color, #9eb37a);
    cursor: pointer;
    border: none;
}
input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--slider-color, #9eb37a);
    cursor: pointer;
    border: none;
}

input[type=number] { width: 50px; padding: 5px; border: 1px solid #ddd; border-radius: 4px; }

input[type=checkbox] { 
    appearance: none;
    -webkit-appearance: none;
    width: 18px; 
    height: 18px; 
    cursor: pointer; 
    background-color: transparent; 
    border: 2px solid #9eb37a; 
    border-radius: 3px;
    transition: all 0.2s; 
    position: relative;
    margin: 0;
    outline: none;
    flex-shrink: 0;
}
input[type=checkbox]:hover { 
    border-color: #233409; 
}
input[type=checkbox]:checked {
    background-color: #9eb37a;
    border-color: #9eb37a;
}
input[type=checkbox]:checked:hover {
    background-color: #233409;
    border-color: #233409;
}
input[type=checkbox]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

span.val-display { float: right; font-weight: normal; color: #777; font-size: 12px; }
.section-header { 
    font-size: 11px; text-transform: uppercase; color: #999; 
    margin-top: 12px; margin-bottom: 12px; border-bottom: 1px solid #eee; 
    padding-bottom: 5px; letter-spacing: 1px; font-weight: 700;
}
.checkbox-row { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 8px; font-weight: normal; }

.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 5px; }

.stepper-row button {
    width: 32px; height: 32px;
    background: #f5f5f5; border: 1px solid #ccc;
    border-radius: 4px; font-weight: bold; cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
}
.stepper-row button:hover { 
    background: #233409; 
    color: #ffffff; 
    border-color: #233409; 
}

.stepper-row input { text-align: center; flex-grow: 1; }

#vignette-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 50;
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,0.1) 100%);
}

/* --- ESTIMATION TABLE STYLES --- */
.estimation-block {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eee;
    margin-bottom: 15px;
}
.estimation-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 10px;
    color: #222;
}
.est-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px; 
}
.est-table th {
    text-align: left;
    border-bottom: 2px solid #ddd;
    padding: 5px;
    color: #555;
    white-space: nowrap;
}
.est-table td {
    padding: 5px;
    border-bottom: 1px solid #eee;
    color: #333;
}
.est-table tr:last-child td {
    border-bottom: none;
}
.est-table tbody tr {
    transition: background-color 0.2s;
    cursor: pointer;
}
.est-table tbody tr:hover {
    background-color: #e6f7ff;
}
.price-col { text-align: right; }

/* --- WIDE SCREEN LAYOUT (> 3/2 ASPECT RATIO) --- */
@media (min-aspect-ratio: 3/2) {
    body {
        display: block; 
    }

    #container {
        position: absolute;
        top: 0;
        left: 380px;
        right: 380px;
        bottom: 0;
        width: auto;
        height: auto;
    }

    #ui {
        position: absolute;
        top: 0; 
        left: 0;
        width: 100%;
        height: 100%;
        background: transparent;
        border-left: none;
        box-shadow: none;
        pointer-events: none;
        
        display: grid;
        grid-template-columns: 380px 1fr 380px;
        grid-template-rows: 1fr auto;
        grid-template-areas: 
            "left main right-top"
            "left main right-bottom";
    }

    #ui-scroll-container {
        display: contents; 
    }

    #config-section {
        grid-area: left;
        pointer-events: auto;
        background: #ffffff;
        overflow-y: auto;
        border-right: 1px solid #e0e0e0;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    }

    #estimation-section {
        grid-area: right-top;
        pointer-events: auto;
        background: #ffffff;
        overflow-y: auto;
        border-left: 1px solid #e0e0e0;
        box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    }

    #ui-fixed-footer {
        grid-area: right-bottom;
        pointer-events: auto;
        background: #fafafa;
        border-left: 1px solid #e0e0e0;
        box-shadow: -4px 0 15px rgba(0,0,0,0.1);
        position: static; 
    }

    #scroll-prompt {
        width: 380px;
        position: absolute; 
        bottom: 0;
        left: 0;
        right: auto;
    }

    input[type="hidden"] {
        display: none !important;
    }
}

/* 1. Force the canvas to allow vertical page scrolling */
canvas {
    touch-action: pan-y !important;
    outline: none;
}