/* Global styles for all pages */
:root {
    --brand-black: #e6e7e8;
    --brand-white: #262e2e;
    --brand-black-rgb: 230, 231, 232;
    --brand-white-rgb: 38, 46, 46; 
}

html {
    font-family: 'Roboto', monospace;
    overscroll-behavior: none; /* Stops the page from bouncing/shifting */
}

body {
    margin: 0;
    background-color: var(--brand-black);
    color: var(--brand-white);
    overscroll-behavior: none; 
    text-transform: lowercase; /* NEW: Enforce site-wide lowercase by default */
}

button, input, select, textarea {
    font-family: inherit;
    touch-action: manipulation; /* Disables double-tap zoom, keeps scrolling */
}

button {
    user-select: none; /* Prevents blue text highlight on rapid taps */
    -webkit-user-select: none; /* Safari support */
}

/* This special rule ONLY applies to your 3D gallery page to disable scrolling */
body#gallery-body {
    overflow: hidden;
    height: 100vh;
}

a {
    color: var(--brand-white);
    font-weight: bold;     /* Embolden */
    font-size: 1.1em;      /* Increase size relative to surrounding text */
    text-decoration: none; /* Ensure no default underline interferes */
}

/* --- New Animated Button Styles --- */
.btn {
    /* Reset and Basic Setup */
    background-color: transparent;
    border: none;
    padding: 10px 5px;
    margin: 5px 15px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    /* New Text Styling */
    color: var(--brand-white);
    font-family: 'Roboto', sans-serif;
    font-weight: 800; /* Extra-bold font weight */
    text-decoration: none;
    text-align: center;
    display: inline-block;
}

/* This creates the underline for the animation */
.btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--brand-white);
    
    /* Start with the line hidden to the left */
    transform: translateX(-101%);
    transition: transform 0.3s ease-out;
}

/* This triggers the animation on hover */
.btn:hover::after {
    /* Slide the line into view */
    transform: translateX(0);
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--brand-black);
    display: flex;
    flex-direction: column;
    
    /* LAYOUT FIX: Push content down below the header */
    justify-content: flex-start; 
    padding-top: 120px; 
    
    align-items: center;
    z-index: 300; 
    overflow-y: auto; 
    
    transition: opacity 0.75s ease;
    padding-bottom: 50px; /* Extra bottom space for scrolling */
    box-sizing: border-box;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#loading-title {
    font-size: 2.5em;
    margin-bottom: 25px;
    font-weight: normal;
}

.spinner {
    border: 4px solid rgba(var(--brand-white-rgb), 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--brand-white);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
}

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

#instructions-content {
    background-color: rgba(var(--brand-black-rgb), 0.9);
    padding: 20px;
    border-radius: 10px;
    border: 0px solid var(--brand-white);
    width: 90%;
    color: var(--brand-white);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.5s ease;
}


#container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border: 1px solid var(--brand-white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

#info-panel {
    position: absolute;
    top: 20px; /* Back to original */
    left: 20px;
    right: auto;
    width: 250px;
    max-width: 90%;
    background-color: var(--brand-black);
    color: var(--brand-white);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(var(--brand-white-rgb), 0.5);
    transform: translateX(-120%);
    transition: transform 0.5s ease-in-out, opacity 0.3s ease, visibility 0.3s;
    visibility: hidden;
    opacity: 0;
    z-index: 100;
}

#info-panel.visible {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
}

#info-panel h2 {
    margin-top: 0;
    font-size: 1.3em;
}

.joystick-zone {
    position: absolute;
    bottom: 30px;
    width: 150px;
    height: 150px;
    display: none;
    z-index: 50;
}

#joystick-zone-left {
    left: 30px;
}

#persistent-info-panel {
    position: absolute;
    top: 80px; /* Moved down to clear the header */
    right: 20px;
    max-width: 110px;
    min-width: 80px;
    
    /* COLORS SWAPPED */
    background-color: var(--brand-black); /* Off-white background */
    color: var(--brand-white); /* Off-black text */
    
    border-radius: 10px;
    padding: 10px;
    z-index: 90;
    display: none;
    flex-direction: column;
    gap: 10px;
}

#persistent-logo {
    width: 100%;
    height: auto;
    border-radius: 5px;
    object-fit: contain;
    margin-right: 0;
}

#persistent-button {
    background: none;
    border: none;
    padding: 0;
    margin-top: 8px;
    color: var(--brand-black);
    font-weight: bold;
    font-size: 0.9em;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

#persistent-text-content {
    flex-grow: 1;
}

#persistent-info-panel p {
    margin: 0;
    font-size: 0.8em;
    opacity: 0.8;
}

#info-panel a, #persistent-info-panel a {
    color: var(--brand-black);
    font-weight: bold;
}

#close-btn {
    position: absolute;
    bottom: 5px;
    right: 10px;
    background: none;
    border: none;
    color: var(--brand-black);
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
}

#mobile-controls-right {
    display: none;
    position: absolute;
    bottom: 30px;
    right: 30px;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.mobile-action-button {
    width: 70px;
    height: 70px;
    border: 1px solid var(--brand-white);
    background-color: rgba(var(--brand-black-rgb), 0.5);
    color: var(--brand-white);
    font-size: 0;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-position: center;
}

#desktop-instructions {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 200px;
    background-color: rgba(var(--brand-black-rgb), 0.5);
    color: var(--brand-white);
    padding: 10px;
    border-radius: 8px;
    display: none;
    z-index: 99;
}

#loading-text {
    color: var(--brand-white);
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
    letter-spacing: 2px;
    min-height: 1.5em;
}

@keyframes pulse {
    0%   { opacity: 0.2; }
    40%  { opacity: 1.0; }
    100% { opacity: 0.2; }
}

.loading-letter {
    animation-name: pulse;
    animation-duration: 1.4s;
    animation-iteration-count: infinite;
    animation-fill-mode: both;
}

.status-complete {
    color: #4CAF50;
    font-weight: bold;
}

#selector-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Starts from top, allows natural scrolling */
    align-items: center;
    gap: 25px;
    padding: 120px 20px 50px 20px; /* Added side padding for mobile safety */
    box-sizing: border-box;
}

#selector-logo {
    width: 200px;
    max-width: 50%;
}

.gallery-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 350px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid rgba(var(--brand-white-rgb), 0.25);
    border-radius: 5px;
}

.edit-link {
    color: rgba(var(--brand-white-rgb), 0.7);
    font-size: 0.9em;
    text-decoration: none;
}

.edit-link:hover {
    text-decoration: underline;
}

.artwork-entry {
    border: 1px solid rgba(var(--brand-white-rgb), 0.25);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    width: 90%;
    max-width: 400px;
}

.artwork-entry h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.artwork-entry input, .artwork-entry select {
    display: block;
    width: calc(100% - 20px);
    margin-bottom: 10px;
    padding: 8px;
    background-color: var(--brand-black);
    color: var(--brand-white);
    border: 1px solid var(--brand-white);
}

#logo-upload, #font-selection {
    margin-top: 20px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.delete-btn {
    background-color: #8f2d2d;
    color: var(--brand-black);
    border: none;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 0.8em;
    cursor: pointer;
    margin-left: 10px;
}

.delete-btn:hover {
    background-color: #b73838;
}

.dashboard-nav-btn {
    color: rgba(var(--brand-white-rgb), 0.7);
    font-size: 0.9em;
    margin-top: 20px;
    text-decoration: none;
}

@media (max-width: 768px) {
    #persistent-info-panel {
        display: block;
        left: 20px;
        right: auto;
        top: 80px; /* Enforce the top position on mobile */
    }
    .joystick-zone { display: block; }
    
    #info-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0; /* Smoothed top corners */
        padding: 20px;
        box-sizing: border-box;
        transform: translateY(100%); /* Start hidden below the screen */
        transition: transform 0.4s ease-in-out;
        visibility: hidden;
        opacity: 1; /* Opacity is handled by visibility and transform */
    }

    #info-panel.visible {
        transform: translateY(0);
        visibility: visible;
        opacity: 1;
    }
    
    #close-btn {
        top: 15px;
        right: 15px;
        bottom: auto;
        font-size: 1.5em;
        padding: 0;
        line-height: 0.5;
    }

    #artwork-sidebar {
        width: 90px;
        padding: 10px;
        left: 0;
        right: auto;
        border-right: 1px solid rgba(var(--brand-white-rgb), 0.25);
        border-left: none;
    }

    #info-panel img {
        display: none;
    }

    #mobile-controls-right {
        display: flex;
        flex-direction: row;
        gap: 15px;
    }
}

#shoot-button-mobile {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e6e7e8'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v2.14c1.72.45 3 2 3 3.86 0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86V7z'/%3E%3C/svg%3E");
    background-size: 55%;
}

#artwork-sidebar {
    position: fixed;
    /* UPDATED: Start 60px down to sit below the header bar */
    top: 60px; 
    left: 0;
    width: 280px;
    /* UPDATED: Calculate height so it doesn't go off the bottom */
    height: calc(100dvh - 60px); 
    background-color: rgba(var(--brand-black-rgb), 0.95);
    z-index: 150;
    display: none;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
    border-right: 1px solid rgba(var(--brand-white-rgb), 0.25);
    transition: transform 0.3s ease-in-out;
    transform: translateX(0);
}

#artwork-sidebar h3 {
    margin-top: 0;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(var(--brand-white-rgb), 0.25);
}

/* COLLAPSED STATE */
#artwork-sidebar.collapsed {
    transform: translateX(-100%);
    box-shadow: none;
    left: 0; /* Override legacy left property */
}

/* DISABLE HOVER EXPANSION */
#artwork-sidebar.collapsed:hover {
    transform: translateX(-100%);
}


#artwork-list {
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-artwork-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: background-color 0.2s, border-color 0.2s;
}

.sidebar-artwork-item:hover {
    background-color: rgba(var(--brand-white-rgb), 0.1);
    border-color: rgba(var(--brand-white-rgb), 0.5);
}

.sidebar-artwork-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 15px;
    border-radius: 3px;
}

.sidebar-artwork-item span {
    font-size: 0.9em;
}

#editor-controls {
    position: relative; 
    top: auto; 
    right: auto; 
    z-index: 160;
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    align-items: flex-end;
}

#edit-mode-btn, #add-more-art-btn {
    padding: 8px 16px;
    font-size: 1em;
    font-weight: bold;
    background-color: rgba(var(--brand-black-rgb), 0.8);
    color: var(--brand-white);
    border: 1px solid var(--brand-white);
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    display: block;
    margin-top: 10px;
}

#edit-mode-btn:hover, #add-more-art-btn:hover {
    background-color: var(--brand-white);
    color: var(--brand-black);
}

#scale-control-container {
    background-color: rgba(var(--brand-black-rgb), 0.8);
    color: var(--brand-white);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.sidebar-artwork-item.placed {
    opacity: 0.6;
    cursor: default;
    background-color: rgba(var(--brand-white-rgb), 0.05);
}

.sidebar-select-btn {
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid rgba(var(--brand-white-rgb), 0.5);
    background-color: rgba(var(--brand-white-rgb), 0.1);
    color: var(--brand-white);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-select-btn:hover {
    background-color: rgba(var(--brand-white-rgb), 0.2);
}


#mode-control-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.mode-btn {
    flex-grow: 1;
    padding: 8px;
    font-size: 0.9em;
    font-weight: bold;
    background-color: rgba(var(--brand-white-rgb), 0.1);
    color: var(--brand-white);
    border: 1px solid rgba(var(--brand-white-rgb), 0.5);
    cursor: pointer;
    transition: background-color 0.2s;
}

.mode-btn:hover {
    background-color: rgba(var(--brand-white-rgb), 0.2);
}

/* ========================================= */
/* --- MAIN HEADER BAR --- */
/* ========================================= */

#top-right-ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: rgba(var(--brand-black-rgb), 0.5);
    z-index: 1000;
    
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 20px; 
    box-sizing: border-box;
    box-shadow: 0 0px 0px rgba(0,0,0,0.1);
    
    justify-content: flex-end; 
}

#header-row {
    display: flex;
    align-items: center;
    /* We still need a small gap between the logo and the icon group. */
    gap: 15px; 
    /* Remove width: 100% and use flex-end to push the content to the right edge */
    justify-content: flex-end; 
}

/* Push the editor controls (slider) below the white bar */
#editor-controls {
    position: absolute;
    top: 90px; 
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}
#main-menu-container {
    position: relative;
    z-index: 210;
}

#menu-toggle-btn {
    width: 40px;
    height: 40px;
    background-color: var(--brand-black);
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

#menu-toggle-btn:hover {
    background-color: rgba(var(--brand-white-rgb), 0.1);
}

.menu-icon .bar1, .menu-icon .bar2, .menu-icon .bar3 {
    width: 25px;
    height: 3px;
    background-color: #000000; /* EDIT HERE: Hamburger Icon Color */
    transition: all 0.3s ease;
}

.menu-icon.active .bar1 {
    transform: translateY(11px) rotate(45deg);
}

.menu-icon.active .bar2 {
    opacity: 0;
}

.menu-icon.active .bar3 {
    transform: translateY(-11px) rotate(-45deg);
}

#dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background-color: rgba(var(--brand-black-rgb), 0.5); 
    
    border: none; 
    border-radius: 0 0 8px 8px;
    padding: 10px 0;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0,0,0,0.15); 
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 200;
}

#dropdown-menu.menu-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    background: none;
    border: none;
    color: #000000; 
    padding: 12px 15px;
    text-align: right;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    
    /* Force consistency between links and buttons */
    font-family: inherit;
    font-weight: normal;
    font-size: 1.0em;    
    
    /* ADDED: Force lowercase on buttons, as they don't inherit from body */
    text-transform: lowercase;
}

.menu-item:hover {
    background-color: rgba(var(--brand-white-rgb), 0.1);
}

#in-game-instructions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--brand-black-rgb), 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
}

#in-game-instructions-overlay.visible {
    visibility: visible;
    opacity: 1;
}

#in-game-instructions-content {
    background-color: var(--brand-black);
    border: 1px solid var(--brand-white);
    border-radius: 10px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    color: var(--brand-white);
    text-align: center;
    box-shadow: 0 5px 20px rgba(var(--brand-black-rgb), 0.7);
    box-sizing: border-box;
}

#in-game-instructions-content h2,
#in-game-instructions-content h3,
#in-game-instructions-content p {
    margin: 0 0 10px 0;
}

#in-game-instructions-content h2 {
    font-size: 1.8em;
}

#in-game-instructions-content h3 {
    font-size: 1.3em;
}

#info-panel img {
    display: none !important;
}

#gallery-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    width: 90%;
    max-width: 1100px;
    padding: 20px 0;
}

/* Tablet View (Portrait) */
@media (max-width: 1024px) {
    #gallery-showcase {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile View */
@media (max-width: 768px) {
    #gallery-showcase {
        grid-template-columns: 1fr;
    }
}

.gallery-showcase-item {
    text-decoration: none;
    color: var(--brand-white);
    background-color: rgba(var(--brand-white-rgb), 0.05);
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.2s ease-out;
    border: 1px solid rgba(var(--brand-white-rgb), 0.1);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
}

.gallery-showcase-item:hover {
    transform: scale(1.03);
    border-color: rgba(var(--brand-white-rgb), 0.3);
}

.gallery-showcase-image-container {
    width: 100%;
    flex-grow: 1;
    overflow: hidden;
    background-color: var(--brand-black);
}

.gallery-showcase-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-showcase-name {
    display: block;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    flex-shrink: 0;
}

/* --- Tab Interface Styles --- */
.tab-container {
    display: flex;
    border-bottom: 1px solid rgba(var(--brand-white-rgb), 0.25);
    margin-bottom: 20px;
    width: 100%;
    max-width: 400px; /* Or adjust to fit your form width */
}

.tab-btn {
    background: none;
    border: none;
    color: rgba(var(--brand-white-rgb), 0.6);
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1em;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--brand-white);
    border-bottom: 3px solid var(--brand-white);
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 400px; /* Or adjust to fit your form width */
}

.tab-content.active {
    display: block;
}

/* --- Sidebar Select Button Highlight --- */
.sidebar-select-btn.selected {
    background-color: rgba(var(--brand-white-rgb), 0.3);
    border-color: var(--brand-white);
}

/* --- New Header Logo Styles (Corrected) --- */
#top-right-ui-container .header-logo-link {
    display: block;
    line-height: 0;
}

#top-right-ui-container .header-logo-img {
    height: 60px;
    width: auto;
}

/* --- Mobile Edit UI Controls --- */
#mobile-edit-controls {
    display: none; /* Hidden by default, JS will show it */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(var(--brand-black-rgb), 0.9);
    border-top: 1px solid rgba(var(--brand-white-rgb), 0.25);
    padding: 10px;
    box-sizing: border-box;
    z-index: 160;
    flex-direction: column;
    gap: 10px;
}

#mobile-edit-controls.visible {
        display: flex;
    }

.mobile-edit-main-controls,
.mobile-edit-rotation-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 10px;
}

.mobile-edit-btn {
    flex-grow: 1;
    padding: 12px;
    font-size: 1em;
    font-weight: bold;
    background-color: rgba(var(--brand-white-rgb), 0.1);
    color: var(--brand-white);
    border: 1px solid rgba(var(--brand-white-rgb), 0.5);
    border-radius: 5px;
}

.mobile-edit-btn.delete {
    background-color: #8f2d2d;
    flex-grow: 0.5; /* Make delete button a bit smaller */
}

.mobile-edit-rotation-controls {
    display: none; /* Hidden by default, shown when in rotate mode */
}

.mobile-edit-rotation-controls label {
    flex-shrink: 0;
}

#rotation-slider {
    flex-grow: 1;
}

#rotation-value {
    font-variant-numeric: tabular-nums;
    min-width: 45px;
    text-align: right;
}

/* --- New Minimal Builder UI --- */

/* Hide the desktop info banner on mobile devices */
.is-mobile #info {
    display: none;
}

/* This is the container for our new JavaScript-driven mobile controls */
#mobile-controls-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 15px;
    align-items: center;
    background-color: rgba(38, 46, 46, 0.8);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(230, 231, 232, 0.2);
}

/* Style for the mobile color picker */
#mobile-block-color {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 8px;
    padding: 0;
    background-color: transparent;
    cursor: pointer;
}
#mobile-block-color::-webkit-color-swatch-wrapper { padding: 0; }
#mobile-block-color::-webkit-color-swatch { border: 2px solid var(--brand-black); border-radius: 8px; }

/* Style for the mobile save button */
#mobile-save-btn {
    padding: 10px 25px;
    font-size: 1em;
    font-weight: bold;
    background-color: var(--brand-black);
    color: var(--brand-white);
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Add this to the end of style.css */

#mobile-mode-controls {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid rgba(230, 231, 232, 0.2);
    margin-top: 10px;
}

.mobile-mode-btn {
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: bold;
    background-color: transparent;
    color: var(--brand-black);
    border: 1px solid var(--brand-black);
    border-radius: 5px;
    cursor: pointer;
}

.mobile-mode-btn.active {
    background-color: var(--brand-black);
    color: var(--brand-white);
}

body.is-desktop #mobile-controls-container {
    display: none;
}

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* --- Styles for the Mobile Resize Panel --- */
#builder-resize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(38, 46, 46, 0.8); /* Using var(--brand-white-rgb) with opacity */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#builder-resize-panel {
    background-color: var(--brand-black);
    color: var(--brand-white);
    border: 1px solid var(--brand-white);
    border-radius: 10px;
    padding: 20px;
    width: 90%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
}

#builder-resize-panel h3 {
    margin: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(var(--brand-white-rgb), 0.25);
}
/* ----------------------------------------------------------------- */

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* --- Styles for Mobile Resize Panel Controls --- */
#resize-controls-container {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between each X, Y, Z row */
}

.resize-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.resize-row > span {
    font-weight: bold;
}

.resize-row-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.resize-value-display {
    min-width: 25px;
    text-align: center;
    font-size: 1.2em;
    font-variant-numeric: tabular-nums;
}

.resize-btn {
    padding: 5px 15px; /* A little more padding for easier tapping */
}
/* ----------------------------------------------------------------- */

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* This makes the buttons inside the mobile resize panel visible */
#builder-resize-panel .mobile-mode-btn {
    color: var(--brand-white);
    border-color: var(--brand-white);
}

/* Adds a press effect for better feedback */
#builder-resize-panel .mobile-mode-btn:active {
    background-color: var(--brand-white);
    color: var(--brand-black);
}
/* ----------------------------------------------------------------- */

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* --- Styles for the Builder Settings Panel --- */
#builder-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(38, 46, 46, 0.8); /* Semi-transparent dark background */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#builder-settings-panel {
    background-color: var(--brand-black);
    color: var(--brand-white);
    border: 1px solid var(--brand-white);
    border-radius: 10px;
    padding: 20px;
    width: 90%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: center;
}

#builder-settings-panel h3 {
    margin: 0;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(var(--brand-white-rgb), 0.25);
}
/* ----------------------------------------------------------------- */

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* --- Styles for Mobile Settings Panel Rows --- */
#builder-settings-panel .setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#builder-settings-panel .setting-row label {
    font-weight: bold;
}

#builder-settings-panel .setting-row input[type="color"] {
    width: 60px;
    height: 35px;
    border: 1px solid var(--brand-white);
    border-radius: 5px;
    padding: 2px;
    background-color: transparent;
    cursor: pointer;
}
/* ----------------------------------------------------------------- */

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* Fix for invisible close button on light-background info panel */
#info-panel #close-btn {
    color: var(--brand-white); /* Use the dark color variable */
}
/* ----------------------------------------------------------------- */

/* ADD THIS NEW BLOCK TO style.css */
/* ----------------------------------------------------------------- */
/* --- Styles for Sidebar Add Buttons --- */
.sidebar-button-container {
    /* This pushes the button container to the bottom of the sidebar flexbox */
    margin-top: auto; 
    padding-top: 15px;
    border-top: 1px solid rgba(var(--brand-white-rgb), 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0; /* Prevents the container from shrinking */
}

.sidebar-add-btn {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    font-weight: bold;
    background-color: rgba(var(--brand-white-rgb), 0.1);
    color: var(--brand-white);
    border: 1px solid rgba(var(--brand-white-rgb), 0.5);
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
    box-sizing: border-box; /* Ensures padding is included in the width */
}

.sidebar-add-btn:hover {
    background-color: rgba(var(--brand-white-rgb), 0.2);
}
/* ----------------------------------------------------------------- */

/* Updated to ensure Active line matches Hover line position */
.btn.active {
    text-decoration: none;
}

.btn.active::after {
    transform: translateX(0); /* Keeps the hover line visible */
}

.sidebar-button-group {
    display: flex;
    flex-direction: column; /* This stacks the buttons vertically */
    gap: 5px;               /* This adds a small space between them */
    margin-left: auto;      /* This pushes the buttons to the far right */
    align-items: flex-end;  /* This aligns the buttons neatly if they have different widths */
}

/* ========================================= */
/* --- MODERN IMMERSIVE UI OVERRIDES --- */
/* ========================================= */

/* 1. The "Glass" Card Style */
.artwork-entry, .section-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(38, 46, 46, 0.05); 
    padding: 25px;
    margin-bottom: 30px;
    
    /* RESPONSIVE FIXES */
    width: 90%; /* Prevents horizontal scrolling on mobile */
    max-width: 600px; 
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;

    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#desktop-key-hint {
    position: fixed;
    bottom: 30px;
    left: 30px;
    
    /* Simple Semi-Transparent Style */
    background: rgba(255, 255, 255, 0.2); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--brand-white);
    
    padding: 8px 16px;
    border-radius: 20px; 
    
    /* Font Correction: Inherit Roboto from body */
    font-family: inherit; 
    font-size: 0.9em;      
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    
    pointer-events: none; 
    z-index: 90;
    opacity: 0.7; 
    transition: opacity 0.3s;
}

/* Hide on mobile, tablets, and touch devices */
@media (max-width: 1200px), (hover: none) {
    #desktop-key-hint {
        display: none;
    }
}

/* ========================================= */
/* --- MOBILE GESTURE LOCKS --- */
/* ========================================= */

.mobile-edit-btn, 
.mobile-action-button, 
.resize-btn, 
.mobile-mode-btn {
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* ========================================= */
/* --- TEMPLATE SELECTION GRID (Create Page) --- */
/* ========================================= */

#template-selection-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    max-height: 300px; /* Scrollable if many templates */
    overflow-y: auto;
    padding: 5px;
    margin-top: 15px;
}

.mini-template-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80px;
}

.mini-template-card h5 {
    margin: 0;
    font-size: 0.9em;
    font-weight: bold;
    pointer-events: none;
}

.mini-template-card p {
    margin: 5px 0 0 0;
    font-size: 0.7em;
    opacity: 0.7;
    pointer-events: none;
}

.mini-template-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Selected State */
.mini-template-card.selected {
    background: var(--brand-white);
    color: var(--brand-black);
    border-color: var(--brand-white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}

/* 3. The New "Action Cards" (Replacing Radio Buttons) */
.model-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

.action-card {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 120px;
    position: relative;
}

/* Ensure text allows pointer events so the .btn animation works */
.action-card .btn, .action-card p {
    pointer-events: auto;
    color: var(--brand-white);
    position: relative;
    z-index: 2;
}

.action-card:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.02);
    border-color: rgba(38, 46, 46, 0.3);
}

/* Active State */
.action-card.selected {
    background: #fff;
    border-color: var(--brand-white);
    box-shadow: 0 5px 15px rgba(38, 46, 46, 0.1);
}

/* Responsive adjustment */
@media (max-width: 600px) {
    .model-selection-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================= */
/* --- LIGHT MODE HEADER OVERRIDES --- */
/* ========================================= */

/* 1. Menu Items turn Dark */
body.light-mode .menu-item {
    color: #000000;
}

/* 2. Hamburger Icon bars turn Dark */
body.light-mode .menu-icon .bar1,
body.light-mode .menu-icon .bar2,
body.light-mode .menu-icon .bar3 {
    background-color: #000000;
}

/* 3. Dropdown background becomes Light */
body.light-mode #dropdown-menu {
    background-color: rgba(var(--brand-black-rgb), 0.5);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    top: 60px;
}

/* 4. Hover effects for light mode */
body.light-mode .menu-item:hover {
    background-color: rgba(0,0,0,0.05);
}

body.light-mode #menu-toggle-btn:hover {
    background-color: rgba(0,0,0,0.05);
}

#street-hero-container {
    width: 100%;
    height: 350px;
    margin-bottom: 0;
    /* FIXED: Push it down by the height of the header (60px) so it's visible */
    margin-top: 60px; 
    position: relative;
    z-index: 1;
}

/* Styling for the new inline icon buttons */
.header-icon-btn {
    /* Base size for the icon area */
    width: 35px;
    height: 35px;
    padding: 0;
    
    /* ADDED: Margin right creates the 'small gap' between icons in the right-to-left flow */
    margin-right: 10px; 
    margin-left: 0;
    margin-top: 0;
    margin-bottom: 0;
    
    /* ADDED: Ensures any text content (like "Login / Register") is hidden */
    text-transform: none; 
    font-size: 0; 
    
    /* Center the icon image/SVG */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Inherit the text color (var(--brand-white)) for the SVG fill color */
    color: var(--brand-white); 
    
    /* Remove the standard .btn underline animation */
    overflow: hidden;
    position: relative;
}

/* Ensure the .btn::after underline is hidden for the icons */
.header-icon-btn::after {
    content: none !important;
}

/* Style for the SVG inside the button */
.header-icon-btn svg {
    fill: currentColor; /* Uses the button's 'color' property */
    width: 24px;
    height: 24px;
}

/* Container for all new inline icons: Manages right-to-left flow and tight grouping */
#inline-icon-menu {
    display: flex;
    align-items: center;
    /* Reverses the order of the icons so they flow left from the logo */
    flex-direction: row-reverse;
    /* Sets the gap between icons to 0, the small gap will be added next using margin */
    gap: 0; 
}

@media (max-width: 500px) {
    
    /* 1. Scale Down Logo (Original height was 60px) */
    #top-right-ui-container .header-logo-img {
        height: 40px; 
        width: auto;
    }

    /* 2. Scale Down Icon Buttons (Further reduced size and margin) */
    .header-icon-btn {
        width: 30px;
        height: 30px;
        /* CRITICAL: Reduce the small gap margin further for tighter fit */
        margin-right: 3px; 
    }
    
    /* 3. Scale Down SVG Icons */
    .header-icon-btn svg {
        width: 20px;
        height: 20px;
    }

    /* 4. Shrink Header Bar Height */
    #top-right-ui-container {
        height: 50px; 
    }

    /* 5. Adjust Header Padding */
    #top-right-ui-container {
        padding: 0 5px; /* CRITICAL: Further reduced overall padding */
    }
    
    /* 6. Tighten Gap between Icon Group and Logo */
    #header-row {
        gap: 10px; /* Reduced spacing between the #inline-icon-menu and the logo */
    }
    
    /* 7. Ensure Logo Link container doesn't have extra padding */
    .header-logo-link {
        padding: 0;
    }

    #artwork-sidebar {
        top: 50px;
        height: calc(100dvh - 50px);
    }
}

/* ========================================= */
/* --- STREET SHOWCASE RESPONSIVENESS --- */
/* ========================================= */

#street-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    width: 90%;
    max-width: 1100px;
    padding: 20px 0;
    margin: 0 auto;
}

/* Tablet View */
@media (max-width: 1024px) {
    #street-showcase {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile View */
@media (max-width: 768px) {
    #street-showcase {
        grid-template-columns: 1fr;
    }
}

