﻿/* CSS Variables & Reset */
:root {
    --bg-color: #f9f9f9;
    --sidebar-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent-gold: #D4AF37;
    --accent-gold-hover: #b5952f;
    --border-color: #e0e0e0;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Lato', sans-serif;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);

    /* Configurable */
    --frame-thickness: 1;
}

/* ... existing reset code ... */

/* FRAME STYLES - Dynamic Thickness */

/* 1. Classic */
.frame-classic img {
    border: calc(10px * var(--frame-thickness)) solid #fff;
    outline: calc(4px * var(--frame-thickness)) solid #1a1a1a;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* 2. Modern */
.frame-modern img {
    border: calc(8px * var(--frame-thickness)) solid #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* 9. Custom: Antique Gray - PURE CSS STRATEGY */
.frame-custom-gray img {
    /* "Ridge" style creates a 3D carved effect perfect for antique frames */
    /* Increased thickness to 45px for a more substantial antique look */
    border: calc(45px * var(--frame-thickness)) ridge #6e6e6e;

    /* An outline adds a second "step" to the frame profile */
    outline: calc(8px * var(--frame-thickness)) solid #4a4a4a;

    /* Inner shadow to simulate depth/recess, Outer shadow for wall lift */
    box-shadow:
        inset 0 0 20px rgba(0, 0, 0, 0.6),
        0 15px 35px rgba(0, 0, 0, 0.4);

    /* Sepia filter slightly warms the photo to match the antique vibe (optional, can be removed) */
    /* filter: sepia(0.1); */
}

/* Cleanup: Remove container styles if any remain from previous attempts */
.frame-custom-gray {
    border: none;
    box-shadow: none;
    background: none;
    padding: 0;
    display: block;
    /* Reset flex if it causes issues */
}

.frame-custom-gray::after {
    display: block;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    /* Limit size to ensure it doesn't break out of the flex container */
    max-width: 100%;
    max-height: 100%;
}

/* 3. Vintage */
.frame-vintage img {
    filter: sepia(0.4) contrast(0.9);
    border: calc(15px * var(--frame-thickness)) solid #dcd0c0;
    box-shadow: 0 5px 15px rgba(90, 70, 50, 0.3);
}

/* 4. Minimalist */
.frame-minimalist img {
    padding: calc(20px * var(--frame-thickness));
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

/* 5. Ornate */
.frame-ornate img {
    border: calc(12px * var(--frame-thickness)) solid #D4AF37;
    border-image: linear-gradient(45deg, #dfbd69, #926f34, #dfbd69) 1;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

/* 6. Wood */
.frame-wood img {
    border: calc(20px * var(--frame-thickness)) solid #5d4037;
    outline: calc(2px * var(--frame-thickness)) solid #3e2723;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* 7. Metallic */
.frame-metallic img {
    border: calc(12px * var(--frame-thickness)) solid #cfd8dc;
    background: linear-gradient(to bottom, #eceff1, #b0bec5);
    padding: calc(2px * var(--frame-thickness));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

/* 8. Shadow */
.frame-shadow img {
    /* Shadow usually doesn't scale thickness the same way, but let's scale the spread slightly */
    box-shadow: 0 calc(25px * var(--frame-thickness)) calc(50px * var(--frame-thickness)) -12px rgba(0, 0, 0, 0.5);
    border-radius: 2px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    /* Custom Background Support */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    transition: background-image 0.5s ease;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}



.controls-sidebar {
    width: 300px;
    height: 100vh;
    /* Force full viewport height */
    max-height: 100vh;
    flex-shrink: 0;
    /* Prevent shrinking */
    background: rgba(255, 255, 255, 0.85);
    /* Glassmorphism base */
    backdrop-filter: blur(10px);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 10;
}

.home-btn {
    align-self: flex-start;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.home-btn:hover {
    background: var(--text-primary);
    color: #fff;
    border-color: var(--text-primary);
}

.gallery-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 2rem;
    /* Glassmorphism for when BG is active */
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Typography & Components */
.brand h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.brand p {
    color: var(--accent-gold);
    letter-spacing: 2px;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--text-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    background: var(--accent-gold);
    transform: translateY(-2px);
}

/* Frame Selector List */
.frame-selector {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.frame-option {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-serif);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.frame-option:hover,
.frame-option.active {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.05);
    color: var(--accent-gold);
}

/* Gallery Grid */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.top-bar h2 {
    font-family: var(--font-serif);
    font-weight: 400;
}

.photo-grid {
    /* Fix for scrolling issue: Nuclear Option */
    flex: 1 1 0px !important;
    /* Force flex basis to 0 to respect parent height */
    min-height: 0 !important;
    overflow-y: auto !important;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    padding-bottom: 6rem;
    /* Extra space at bottom */
}

/* Photo Cards */
.photo-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.photo-card:hover {
    transform: translateY(-5px);
    z-index: 5;
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 200px;
    /* Restrict height to keep grid uniform-ish */
    background: #e0e0e0;
    /* Gray background for empty space */
    transition: all 0.5s ease;
}

/* FRAME STYLES */

/* FRAME STYLES - Elegant & Clean */

/* 1. Classic: Elegant double border */
.frame-classic img {
    border: calc(10px * var(--frame-thickness)) solid #fff;
    outline: calc(4px * var(--frame-thickness)) solid #1a1a1a;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* 2. Modern: Clean, rounded, floating */
.frame-modern img {
    border: calc(8px * var(--frame-thickness)) solid #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* 3. Vintage: Sepia + Rough edges simulation */
.frame-vintage img {
    filter: sepia(0.4) contrast(0.9);
    border: calc(15px * var(--frame-thickness)) solid #dcd0c0;
    box-shadow: 0 5px 15px rgba(90, 70, 50, 0.3);
}

/* 4. Minimalist: Extensive whitespace */
.frame-minimalist img {
    padding: calc(20px * var(--frame-thickness));
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

/* 5. Ornate: Gold gradient border */
.frame-ornate img {
    border: calc(12px * var(--frame-thickness)) solid #D4AF37;
    border-image: linear-gradient(45deg, #dfbd69, #926f34, #dfbd69) 1;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

/* 6. Wood: Rustic look */
.frame-wood img {
    border: calc(20px * var(--frame-thickness)) solid #5d4037;
    outline: calc(2px * var(--frame-thickness)) solid #3e2723;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* 7. Metallic: Silver/Steel */
.frame-metallic img {
    border: calc(12px * var(--frame-thickness)) solid #cfd8dc;
    background: linear-gradient(to bottom, #eceff1, #b0bec5);
    padding: calc(2px * var(--frame-thickness));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

/* 8. Shadow: Deep depth */
.frame-shadow img {
    /* Shadow usually doesn't scale thickness the same way, but let's scale the spread slightly */
    box-shadow: 0 calc(25px * var(--frame-thickness)) calc(50px * var(--frame-thickness)) -12px rgba(0, 0, 0, 0.5);
    border-radius: 2px;
}


/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    display: flex;
    width: 90%;
    height: 90%;
    max-width: 1400px;
    background: transparent;
}

.modal-frame-container {
    flex: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.modal-frame-container img {
    max-width: 100%;
    max-height: 80vh;
    transition: all 0.3s ease;
    /* Ensure image has relative positioning context if needed, 
       but we use the container for context */
    z-index: 10;
}

/* Scale Reference */
.modal-frame-container {
    position: relative;
    /* Ensure containment */
}

.scale-reference {
    position: absolute;
    bottom: 0;
    right: 10%;
    /* Place it to the right of the center/image */
    height: 45vh;
    /* Standard human height relative to "Wall" height (80vh image max) */
    /* If 80vh is roughly 2.5m wall height, then 1.7m is approx 68% of that (54vh)
       Let's assume the MaxHeight 80vh represents a ~3m wall section. 
       1.7m / 3m = ~0.56 -> 45vh is a safe bet for a "stand-in" */
    width: auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.scale-reference.visible {
    opacity: 1;
    transform: translateY(0);
}

.scale-reference svg {
    height: 100%;
    width: auto;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
}

.modal-controls {
    flex: 1;
    padding: 3rem;
    background: #fff;
    border-left: 1px solid #eee;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-controls h3 {
    margin-bottom: 2rem;
    font-family: var(--font-serif);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    cursor: pointer;
    z-index: 101;
    color: #000;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    z-index: 3000;
    /* Highest priority */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.splash-content {
    text-align: center;
    animation: pulse 3s infinite ease-in-out;
}

.splash-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.splash-text {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

/* Landing Page (Welcome) */
.landing-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.landing-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    animation: fadeIn 1s ease-out;
}

.landing-title {
    font-family: var(--font-serif);
    font-size: 4rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.landing-subtitle {
    font-size: 1.2rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 4rem;
}

.formats-guide {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-bottom: 4rem;
}

.format-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.icon-box {
    border: 2px solid var(--text-primary);
    transition: transform 0.3s ease;
}

.size-small {
    width: 40px;
    height: 50px;
}

.size-medium {
    width: 60px;
    height: 80px;
}

.size-large {
    width: 80px;
    height: 110px;
}

.format-item:hover .icon-box {
    transform: scale(1.8);
    border-color: var(--accent-gold);
}

.landing-instruction {
    margin-bottom: 3rem;
    color: #666;
    font-style: italic;
}

.enter-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0 auto;
    transition: all 0.3s ease;
}

.arrow-icon {
    width: 60px;
    height: 60px;
    border: 2px solid var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.enter-btn:hover .arrow-icon {
    background: var(--text-primary);
    color: #fff;
    transform: scale(1.1);
}

.enter-btn:hover {
    letter-spacing: 2px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Size Selector */
.size-selector {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-size {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.2s;
}

.btn-size:hover,
.btn-size.active {
    background: var(--text-primary);
    color: #fff;
    border-color: var(--text-primary);
}

/* Modal sizing Logic */
/* By default it takes max space, we adjust max-width of img */
.modal-frame-container.preview-small img {
    max-width: 40%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    /* Smaller shadow for small size */
}

.modal-frame-container.preview-medium img {
    max-width: 60%;
}

.modal-frame-container.preview-large img {
    max-width: 90%;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* --- ROOM ENVIRONMENT MODE: SALON --- */
.modal-frame-container.env-room {
    background-image: url('../bg/custom_living.jpg');
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    background-color: #f0f0f0;
    /* Fallback */
}

/* Adjust the image within the room (Living) */
.modal-frame-container.env-room img {
    /* Scale down to look realistic on the wall */
    transform: scale(0.16) translateX(-8%) translateY(-54%);
    /* Add a subtle shadow for depth on the wall */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4) !important;
    max-height: none !important;
    overflow: visible !important;
    z-index: 100;
}

/* --- ROOM ENVIRONMENT MODE: BEDROOM --- */
.modal-frame-container.env-bedroom {
    background-image: url('../bg/custom_bedroom.png');
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    background-color: #f0f0f0;
    /* Fallback */
}

.modal-frame-container.env-bedroom img {
    transform: scale(0.13) translateX(-23%) translateY(-69%);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4) !important;
    max-height: none !important;
    overflow: visible !important;
    z-index: 100;
}

/* --- ROOM ENVIRONMENT MODE: TABLETOP --- */
.modal-frame-container.env-table {
    background-image: url('../bg/table_frame.png');
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
    background-color: #f0f0f0;
    /* Transformation simplified as image is now frontal */
}

.modal-frame-container.env-table img {
    /* Position inside the new frame */
    /* Starting guess: Centered */
    transform-origin: center center;
    transform: scale(0.21) translateX(12%) translateY(-15%);
    /* No rotation needed if image is front-facing */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2) !important;
    max-height: none !important;
    overflow: visible !important;
    z-index: 100;
}

/* GLOBAL MOBILE RESET */
html,
body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
    /* Prevent bounce on iOS */
    overscroll-behavior-y: none;
}

/* --- PORTRAIT MOBILE (< 900px width) --- */
.app-container {
    flex-direction: column !important;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
}

.controls-sidebar {
    width: 100% !important;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    order: 2;
    padding: 1.5rem;
    overflow-y: visible;
    flex-shrink: 0;
}

.brand img {
    max-width: 180px !important;
    margin: 0 auto 1rem auto !important;
}

.gallery-container {
    flex: none;
    order: 1;
    height: auto;
    min-height: 60vh;
    overflow: visible;
}

/* Landing Page Mobile Fixes */
.landing-title {
    font-size: 2rem !important;
    line-height: 1.2;
}

.landing-subtitle {
    font-size: 1rem !important;
    margin-bottom: 2rem;
}

.enter-btn {
    transform: scale(0.9);
}

.formats-guide {
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* --- MODAL MOBILE (General) --- */
.modal.active {
    align-items: flex-start;
    /* Align top to allow scrolling */
    padding: 0;
    overflow-y: auto;
}

.modal-content {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border-radius: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.close-modal {
    top: 10px;
    right: 15px;
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    z-index: 200;
}

/* Default Stack (Portrait) */
.modal-frame-container {
    flex: none;
    height: 60vh;
    width: 100%;
    padding: 1rem;
    background-color: #f4f4f4;
}

.modal-frame-container img {
    max-height: 100%;
    max-width: 100%;
}

.modal-controls {
    flex: 1;
    width: 100%;
    padding: 1.5rem;
    border-left: none;
    border-top: 1px solid #eee;
    overflow-y: visible;
    /* Allow content to flow */
}

/* --- LANDSCAPE MOBILE (Height < 600px) --- */
/* This handles phones rotating to side view */
@media (max-height: 600px) and (orientation: landscape) {
    .app-container {
        flex-direction: row !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    /* Sidebar in Landscape: Compact */
    .controls-sidebar {
        width: 300px !important;
        height: 100vh !important;
        overflow-y: auto;
        order: 1;
        /* Restore sidebar to left */
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        padding: 1rem;
    }

    .gallery-container {
        flex: 1;
        order: 2;
        height: 100vh;
        overflow-y: auto;
    }

    /* Modal Landscape: Side-by-Side */
    .modal-content {
        flex-direction: row !important;
        overflow: hidden !important;
    }

    .modal-frame-container {
        height: 100vh;
        flex: 2;
        /* Give more space to image */
        padding: 0.5rem;
    }

    .modal-controls {
        flex: 1;
        height: 100vh;
        overflow-y: auto;
        border-top: none;
        border-left: 1px solid #eee;
        padding: 1rem;
        min-width: 250px;
    }

    .art-details {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .art-details h2 {
        font-size: 1.5rem !important;
    }
}





/* --- CRITICAL LAYOUT FIXES (STEP 885) --- */

/* 1. Global Logo Constraint (Desktop & Mobile) */
.brand img {
    max-width: 180px !important;
    height: auto !important;
    margin: 0 auto 1.5rem auto !important;
    display: block;
}

/* 2. Desktop Layout Order (Sidebar LEFT, Gallery RIGHT) */
@media (min-width: 901px) {
    .app-container {
        flex-direction: row !important;
    }

    .controls-sidebar {
        order: 1 !important;
        /* Left */
        width: 320px !important;
    }

    .gallery-container {
        order: 2 !important;
        /* Right */
        flex: 1;
    }
}

/* 3. Mobile Layout Order (Gallery TOP, Sidebar BOTTOM) */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column !important;
    }

    .gallery-container {
        order: 1 !important;
        /* Visor/Photo First */
        height: 65vh !important;
        /* Ensure good height */
    }

    .controls-sidebar {
        order: 2 !important;
        /* Controls Below */
        width: 100% !important;
        height: auto !important;
        max-height: 40vh !important;
        /* Limit height so it doesn't push off screen */
    }

    /* Ensure logo is small on mobile sidebar too */
    .brand img {
        max-width: 120px !important;
        margin-bottom: 0.5rem !important;
    }
}



/* FIX FRAME SELECTOR OVERFLOW */
.frame-selector-row {
    display: flex;
    flex-wrap: wrap !important;
    /* Force wrapping to next line */
    gap: 0.5rem;
    justify-content: center;
    /* Center items */
    margin-bottom: 1.5rem;
    width: 100%;
}

.frame-selector-row .frame-option {
    flex: 1 1 auto;
    /* Grow/Shrink */
    min-width: 80px;
    /* Minimum width */
    max-width: 48%;
    /* 2 per line mostly */
    text-align: center;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.5rem;
}