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

:root {
    --bg-dark: #0a0a12;
    --bg-gradient-1: #12121f;
    --bg-gradient-2: #1a1a2e;
    --text-primary: #f0e68c;
    --text-secondary: #98fb98;
    --accent-1: #ff6b6b;
    --accent-2: #4ecdc4;
    --shadow-color: rgba(0, 0, 0, 0.8);
}

body {
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-gradient-1) 50%, var(--bg-gradient-2) 100%);
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
    image-rendering: pixelated;
}

/* CRT effects disabled */
#scanlines,
#crt-overlay {
    display: none;
}

/* Cheesy 2000s scrolling banner */
#mint-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background: linear-gradient(90deg, 
        #ff0000, #ff7700, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    background-size: 200% 100%;
    animation: rainbow-bg 3s linear infinite;
    z-index: 2000;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid #000;
}

#mint-banner a {
    display: block;
    width: 100%;
    text-decoration: none;
}

.banner-text {
    display: inline-block;
    white-space: nowrap;
    font-family: 'Comic Sans MS', 'Press Start 2P', cursive, sans-serif;
    font-size: 14px;
    font-weight: bold;
    color: #000;
    text-shadow: 
        1px 1px 0 #fff,
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff;
    animation: marquee 15s linear infinite;
    padding: 4px 0;
}

@keyframes rainbow-bg {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Adjust header position to account for banner */
#header-container {
    top: 38px;
}

@media (max-width: 768px) {
    #mint-banner {
        height: 24px;
    }
    
    .banner-text {
        font-size: 11px;
    }
    
    #header-container {
        top: 32px;
    }
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

#header-container {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    text-align: center;
}

.header-logo {
    height: 86px;
    width: auto;
    image-rendering: pixelated;
    filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.5));
}

.subtitle {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
    animation: subtitle-flicker 3s infinite;
}

@keyframes title-wobble {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(1px); }
    75% { transform: translateX(-1px); }
}

@keyframes subtitle-flicker {
    0%, 90%, 100% { opacity: 1; }
    92% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.7; }
}

/* Action button - centered below cube */
#action-btn {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    transition: background 0.3s ease;
}

#action-btn.reset-mode {
    background: linear-gradient(180deg, #5a3a6a 0%, #3a1a4a 100%);
    border-color: #8a5a9a;
}

.retro-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 12px 20px;
    background: linear-gradient(180deg, #444 0%, #222 100%);
    color: var(--text-primary);
    border: 3px solid #666;
    border-bottom-color: #111;
    border-right-color: #111;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}

.retro-btn:hover {
    background: linear-gradient(180deg, #555 0%, #333 100%);
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.retro-btn:active {
    transform: translate(4px, 4px);
    box-shadow: none;
    border-top-color: #111;
    border-left-color: #111;
    border-bottom-color: #666;
    border-right-color: #666;
}


/* Clean image overlay - above scanlines */
#clean-image {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    image-rendering: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

#clean-image.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Layer Editor - appears after reveal */
#layer-editor {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(310px, -60%);
    z-index: 1002;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid var(--accent-2);
    box-shadow: 
        inset 0 0 20px rgba(78, 205, 196, 0.1),
        4px 4px 0 rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#layer-editor.visible {
    opacity: 1;
    pointer-events: auto;
}

#export-btn {
    margin-top: 15px;
    width: 100%;
}

.retro-btn.export {
    background: linear-gradient(180deg, #3a5a3a 0%, #1a3a1a 100%);
    border-color: var(--text-secondary);
    border-bottom-color: #151;
    border-right-color: #151;
}

/* Desktop export button */
#desktop-export-btn {
    margin-top: 15px;
    width: 100%;
}

/* Mobile button row - hidden on desktop */
.mobile-button-row {
    display: none;
}

#mobile-randomize-btn {
    display: none;
}

/* Mobile reveal button - hidden on desktop */
#mobile-reveal-btn {
    display: none;
}

/* Layer controls row - stacked on desktop (default) */
.layer-controls-row {
    display: contents; /* Don't affect desktop layout */
}

/* ==================== MOBILE LAYOUT ==================== */
/* Dedicated mobile layout: upper 2/3 for content, bottom 1/3 for controls */
@media (max-width: 768px) {
    /* Header - compact at top */
    #header-container {
        top: 5px;
    }
    
    .header-logo {
        height: 90px;
    }
    
    /* Canvas stays full screen - 3D scene visible everywhere */
    #canvas-container {
        height: 100%;
    }
    
    /* Clean image - position and size controlled by JavaScript based on 3D projection */
    
    /* Hide desktop buttons on mobile */
    #action-btn,
    #desktop-export-btn {
        display: none;
    }
    
    /* Mobile reveal button - bottom of screen, hidden after reveal */
    #mobile-reveal-btn {
        display: block;
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        padding: 12px 28px;
        font-size: 10px;
        z-index: 100;
    }
    
    #mobile-reveal-btn.hidden {
        display: none;
    }
    
    /* Layer editor - bottom control panel */
    #layer-editor {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        padding: 10px 8px;
        background: rgba(0, 0, 0, 0.9);
        border: none;
        border-top: 2px solid var(--accent-2);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        opacity: 0;
        transition: transform 0.4s ease, opacity 0.4s ease;
        pointer-events: none;
    }
    
    #layer-editor.visible {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    
    /* Layer controls wrapper - holds all 3 rows side by side */
    .layer-controls-row {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    /* Layer rows - side by side on mobile */
    #layer-editor .layer-row {
        display: flex;
        flex-direction: row;
        margin: 0;
        gap: 3px;
        flex-shrink: 0;
        padding: 5px 8px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
    }
    
    #layer-editor .layer-row label {
        font-size: 5px;
        width: auto;
        min-width: 24px;
    }
    
    #layer-editor .layer-row .arrow-btn {
        padding: 5px 8px;
        font-size: 9px;
    }
    
    #layer-editor .layer-value {
        font-size: 9px;
        min-width: 20px;
    }
    
    /* Button row - Export and Randomize side by side underneath */
    .mobile-button-row {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }
    
    #export-btn {
        padding: 10px 18px;
        font-size: 7px;
        margin: 0;
        width: auto;
    }
    
    /* Mobile randomize button (inside layer editor) */
    #mobile-randomize-btn {
        display: inline-block;
        padding: 10px 18px;
        font-size: 7px;
        background: linear-gradient(180deg, #5a3a6a 0%, #3a1a4a 100%);
        border-color: #8a5a9a;
    }
}

.layer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 8px 0;
    gap: 10px;
}

.layer-row label {
    font-size: 8px;
    color: var(--text-secondary);
    width: 45px;
    text-shadow: 1px 1px 0 #000;
}

.layer-value {
    font-size: 12px;
    color: var(--accent-1);
    min-width: 24px;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
}

.arrow-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    color: var(--text-primary);
    border: 2px solid #555;
    border-bottom-color: #111;
    border-right-color: #111;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
}

.arrow-btn:hover {
    background: linear-gradient(180deg, #444 0%, #222 100%);
    color: var(--accent-2);
}

.arrow-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

/* Pixelated cursor */
canvas {
    cursor: crosshair;
}

/* Very small screens (iPhone SE, etc) */
@media (max-width: 400px) {
    .header-logo {
        height: 70px;
    }
    
    /* Clean image positioning handled by JavaScript */
    
    #layer-editor {
        padding: 8px 5px;
        gap: 6px;
    }
    
    .layer-controls-row {
        gap: 5px;
    }
    
    #layer-editor .layer-row {
        padding: 4px 5px;
        gap: 2px;
    }
    
    #layer-editor .layer-row label {
        font-size: 4px;
        min-width: 20px;
    }
    
    #layer-editor .layer-row .arrow-btn {
        padding: 4px 6px;
        font-size: 8px;
    }
    
    #layer-editor .layer-value {
        font-size: 8px;
        min-width: 16px;
    }
    
    .mobile-button-row {
        gap: 8px;
    }
    
    #export-btn,
    #mobile-randomize-btn {
        padding: 8px 14px;
        font-size: 6px;
    }
}

/* Loading screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-gradient-1) 50%, var(--bg-gradient-2) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    height: 100px;
    width: auto;
    image-rendering: pixelated;
    filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
}

.progress-container {
    width: 200px;
    height: 16px;
    background: #111;
    border: 3px solid #444;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-2) 0%, var(--text-secondary) 100%);
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--accent-2);
}

#loading-text {
    font-size: 10px;
    color: var(--text-secondary);
    animation: loading-blink 0.8s infinite;
}

@keyframes loading-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Twitter/X button */
#twitter-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    color: var(--text-primary);
    border: 3px solid #555;
    border-bottom-color: #111;
    border-right-color: #111;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
    text-decoration: none;
    transition: all 0.1s;
}

#twitter-btn:hover {
    background: linear-gradient(180deg, #444 0%, #222 100%);
    color: var(--accent-2);
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

#twitter-btn:active {
    transform: translate(3px, 3px);
    box-shadow: none;
    border-top-color: #111;
    border-left-color: #111;
    border-bottom-color: #555;
    border-right-color: #555;
}

@media (max-width: 768px) {
    .loading-logo {
        height: 70px;
    }
    
    .progress-container {
        width: 150px;
        height: 12px;
    }
    
    #loading-text {
        font-size: 8px;
    }
}

