/* Kyle Cart 3D Game - Fullscreen Styles */

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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    cursor: crosshair;
}

/* Overlay UI on top of the game */
#game-ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    pointer-events: all;
    gap: 1rem;
}

#connection-status {
    margin-left: auto;
}

.back-button {
    text-decoration: none;
    color: white;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 1rem;
}

.back-button:hover {
    background: rgba(102, 126, 234, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.connection-status {
    color: white;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    background: rgba(255, 165, 0, 0.6);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 1rem;
    white-space: nowrap;
}

.connection-status.connected {
    background: rgba(0, 255, 0, 0.8);
}

.connection-status.disconnected {
    background: rgba(255, 0, 0, 0.6);
}

#score-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.menu-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(79, 70, 229, 0.8));
    border: 2px solid rgba(167, 139, 250, 0.5);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    pointer-events: all;
}

.menu-btn:hover {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.9), rgba(102, 126, 234, 0.9));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Menu Modal Styles */
#menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 20, 60, 0.95));
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    text-align: center;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.menu-option-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 8px;
    color: white;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-option-btn:hover {
    background: rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Full Page Modal Styles */
#modal1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.full-page-modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 20, 60, 0.95));
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 16px;
    padding: 2rem;
    width: 95vw;
    height: 95vh;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.modal1-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    text-align: center;
}

#instructions-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 10px;
    text-align: center;
    pointer-events: all;
    animation: fadeInOut 0.5s ease forwards;
}

#instructions-overlay p {
    color: white;
    margin: 0.5rem 0;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#instructions-overlay strong {
    color: #FFD700;
}

#loading-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem 3rem;
    font-size: 1.5rem;
    color: white;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    z-index: 1000;
}

#error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem 3rem;
    font-size: 1.2rem;
    color: #ff0000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 2px solid #ff0000;
    z-index: 1000;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* Mobile Controls */
#mobile-controls {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    z-index: 200;
    display: none; /* Hidden on desktop, shown on touch devices */
    pointer-events: none;
    width: 100%;
}

/* Rocket Button - bottom left corner */
#btn-rocket {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 140px;  /* 2x bigger! */
    height: 140px;
    background: rgba(255, 68, 68, 0.3);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 100, 100, 0.6);
    border-radius: 50%;
    color: white;
    font-size: 4rem;  /* 2x bigger font! */
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rocketPulse 2s ease-in-out infinite;
    z-index: 300;  /* On top of joystick! */
}

#btn-rocket:active {
    background: rgba(255, 68, 68, 0.7);
    border-color: rgba(255, 68, 68, 0.9);
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(255, 68, 68, 0.8);
}

@keyframes rocketPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 68, 68, 0.7);
    }
}

/* Tree Button - above rocket button */
#btn-tree {
    position: fixed;
    bottom: 190px;  /* Above rocket button */
    left: 30px;
    width: 140px;
    height: 140px;
    background: rgba(34, 139, 34, 0.3);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(50, 205, 50, 0.6);
    border-radius: 50%;
    color: white;
    font-size: 4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 20px rgba(34, 139, 34, 0.4);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: treePulse 2s ease-in-out infinite;
    z-index: 300;
}

#btn-tree:active {
    background: rgba(34, 139, 34, 0.7);
    border-color: rgba(50, 205, 50, 0.9);
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(34, 139, 34, 0.8);
}

@keyframes treePulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(34, 139, 34, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(50, 205, 50, 0.7);
    }
}

/* Brick Button - above tree button */
#btn-brick {
    position: fixed;
    bottom: 350px;  /* Above tree button */
    left: 30px;
    width: 140px;
    height: 140px;
    background: rgba(178, 34, 34, 0.3);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(205, 92, 92, 0.6);
    border-radius: 50%;
    color: white;
    font-size: 4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 20px rgba(178, 34, 34, 0.4);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: brickPulse 2s ease-in-out infinite;
    z-index: 300;
}

#btn-brick:active {
    background: rgba(178, 34, 34, 0.7);
    border-color: rgba(205, 92, 92, 0.9);
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(178, 34, 34, 0.8);
}

@keyframes brickPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(178, 34, 34, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(205, 92, 92, 0.7);
    }
}

/* Joystick for camera control */
#joystick-container {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: all;
    z-index: 200;  /* Below rocket button */
}

#joystick-base {
    position: relative;
    width: 1200px;  /* 10x bigger! */
    height: 1200px;
    background: transparent;  /* Totally transparent! */
    backdrop-filter: none;
    border: none;
    border-radius: 50%;
    box-shadow: none;
}

#joystick-stick {
    position: absolute;
    width: 500px;  /* 10x bigger! */
    height: 500px;
    background: transparent;  /* Totally transparent! */
    border: none;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
    box-shadow: none;
}

#joystick-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    pointer-events: none;
}

/* D-pad positioning - bottom right corner */
#dpad {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 180px;
    height: 180px;
    pointer-events: all;
    z-index: 250;  /* Above joystick, below rocket button */
}

.dpad-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dpad-btn:active {
    background: rgba(102, 126, 234, 0.6);
    border-color: rgba(102, 126, 234, 0.9);
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
}

#btn-up {
    top: 0;
    left: 60px;
}

#btn-down {
    bottom: 0;
    left: 60px;
}

#btn-left {
    top: 60px;
    left: 0;
}

#btn-right {
    top: 60px;
    right: 0;
}

/* Show mobile controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobile-controls {
        display: block;
    }
}

/* Responsive Design */
/* Object Builder Modal */
#object-builder-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 20, 60, 0.95));
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 0;
    padding: 2rem;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h2 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.modal-subtitle {
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 68, 68, 0.8);
    border-color: rgba(255, 68, 68, 1);
    transform: rotate(90deg);
}

.modal-body {
    color: white;
    display: flex;
    gap: 2rem;
    height: calc(100% - 80px);
}

.modal-left-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* LLM to LLM Design Button */
.llm-design-btn-container {
    margin-bottom: 0.5rem;
}

.llm-design-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.8), rgba(79, 70, 229, 0.8));
    border: 2px solid rgba(167, 139, 250, 0.5);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.llm-design-btn:hover {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.9), rgba(99, 102, 241, 0.9));
    border-color: rgba(167, 139, 250, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.5);
}

.llm-design-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
}

/* Section titles */
.section-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
}

/* JSON Display Container */
.json-display-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.json-display {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    padding: 1rem;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: none;
    overflow-y: auto;
    min-height: 120px;
}

.json-display::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

/* Conversation Container */
.conversation-container {
    display: flex;
    flex-direction: column;
    flex: 2;
    min-height: 0;
}

.modal-right-side {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Conversation History - Basic text style */
.conversation-history {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.history-message {
    padding: 0.25rem 0;
    margin: 0.25rem 0;
    border-radius: 0;
    animation: none;
    background: transparent;
    border: none;
}

.system-message {
    color: rgba(150, 150, 150, 0.9);
    background: transparent;
    border: none;
}

.user-message {
    color: rgba(0, 255, 200, 0.95);
    background: transparent;
    border: none;
}

.user-message strong {
    color: rgba(0, 255, 200, 1);
}

.assistant-message {
    color: rgba(200, 150, 255, 0.95);
    background: transparent;
    border: none;
}

.assistant-message strong {
    color: rgba(200, 150, 255, 1);
}

.loading-message {
    color: rgba(255, 165, 0, 0.9);
    background: transparent;
    border: none;
    font-style: italic;
}

/* Preview Container */
.preview-container {
    position: relative;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-canvas {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: none; /* Hidden until Step 3 */
}

.preview-placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    text-align: center;
}

.preview-controls-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    display: flex;
    gap: 1rem;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.preview-container:hover .preview-controls-hint {
    opacity: 1;
}

.control-hint-item {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Input Area */
.input-area {
    display: flex;
    gap: 0.5rem;
}

#user-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#user-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.8);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
}

#user-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.send-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(138, 43, 226, 0.8));
    border: 2px solid rgba(102, 126, 234, 0.6);
    border-radius: 10px;
    padding: 0.875rem 1.5rem;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 1), rgba(138, 43, 226, 1));
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-icon {
    font-size: 1.2rem;
}

/* Custom Data Section */
.custom-data-section {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(138, 43, 226, 0.4);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0 1rem;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding: 1rem;
    }
}

.custom-data-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.data-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.data-field label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: bold;
}

.data-field input,
.data-field textarea {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(138, 43, 226, 0.4);
    border-radius: 8px;
    padding: 0.5rem;
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.data-field input:focus,
.data-field textarea:focus {
    outline: none;
    border-color: rgba(138, 43, 226, 0.8);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.data-field input::placeholder,
.data-field textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.data-field textarea {
    resize: vertical;
    min-height: 60px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.save-btn {
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.6), rgba(0, 150, 80, 0.6));
    border-color: rgba(0, 200, 100, 0.4);
    color: white;
}

.save-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.8), rgba(0, 150, 80, 0.8));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 200, 100, 0.4);
}

.save-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.clear-btn {
    background: rgba(255, 68, 68, 0.3);
    border-color: rgba(255, 68, 68, 0.4);
    color: white;
}

.clear-btn:hover {
    background: rgba(255, 68, 68, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.4);
}

.toggle-data-btn {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.4);
    color: white;
}

.toggle-data-btn:hover {
    background: rgba(138, 43, 226, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.4);
}

.toggle-data-btn.active {
    background: rgba(138, 43, 226, 0.8);
    border-color: rgba(138, 43, 226, 1);
}

/* Scrollbar styling for conversation history */
.conversation-history::-webkit-scrollbar {
    width: 8px;
}

.conversation-history::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.conversation-history::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.conversation-history::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Scrollbar for JSON display */
.json-display::-webkit-scrollbar {
    width: 8px;
}

.json-display::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.json-display::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

@media (max-width: 768px) {
    #top-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .back-button,
    #score-display {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }

    #instructions-overlay {
        bottom: 230px; /* Move up to avoid D-pad */
        padding: 0.75rem 1.5rem;
        left: 50%;
        right: auto;
        max-width: 300px;
    }

    #instructions-overlay p {
        font-size: 0.85rem;
        margin: 0.3rem 0;
    }
    
    #mobile-controls {
        display: block;
    }
    
    #btn-rocket {
        bottom: 20px;
        left: 20px;
        width: 120px;  /* 2x bigger for mobile! */
        height: 120px;
        font-size: 3.2rem;  /* 2x bigger font! */
    }
    
    #btn-tree {
        bottom: 160px;  /* Above rocket on mobile */
        left: 20px;
        width: 120px;
        height: 120px;
        font-size: 3.2rem;
    }
    
    #btn-brick {
        bottom: 300px;  /* Above tree on mobile */
        left: 20px;
        width: 120px;
        height: 120px;
        font-size: 3.2rem;
    }
    
    #joystick-container {
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }
    
    #joystick-base {
        width: 1000px;  /* 10x bigger for mobile too! */
        height: 1000px;
    }
    
    #joystick-stick {
        width: 420px;  /* 10x bigger for mobile too! */
        height: 420px;
    }
    
    #joystick-label {
        font-size: 0.8rem;
        top: -22px;
    }
    
    #dpad {
        width: 150px;
        height: 150px;
        bottom: 20px;
        right: 20px;
    }
    
    .dpad-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    #btn-up {
        left: 50px;
    }
    
    #btn-down {
        left: 50px;
    }
    
    #btn-left {
        top: 50px;
    }
    
    #btn-right {
        top: 50px;
    }
}

/* AI Pipeline Status */
.pipeline-status-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
}

.pipeline-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pipeline-stage {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.pipeline-stage.active {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    }
}

.stage-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.stage-icon {
    font-size: 1.2rem;
}

.stage-name {
    flex: 1;
    font-weight: 600;
    color: #fff;
}

.stage-status {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.stage-details {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: monospace;
    color: #aaa;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.4;
    word-wrap: break-word;
}

.pipeline-arrow {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    margin: 0.25rem 0;
    transition: color 0.3s ease;
}

.pipeline-arrow.active {
    color: rgba(76, 175, 80, 0.8);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(5px);
    }
}

/* ========================================
   FLUX AI IMAGE LAB MODAL STYLES
   ======================================== */

.flux-modal {
    background: linear-gradient(135deg, rgba(15, 15, 35, 0.98), rgba(35, 15, 50, 0.98));
    border: 2px solid rgba(236, 72, 153, 0.4);
    box-shadow: 0 20px 60px rgba(236, 72, 153, 0.25);
}

.flux-modal h2 {
    color: white;
    margin: 0 0 0.25rem 0;
    font-size: 1.8rem;
    text-shadow: 0 0 15px rgba(236, 72, 153, 0.6);
    background: linear-gradient(90deg, #ec4899, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.flux-modal .modal-subtitle {
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
    font-style: italic;
}

.flux-modal-body {
    display: flex;
    gap: 2rem;
    flex: 1;
    min-height: 0;
    color: white;
}

/* Left Side - Controls */
.flux-left-side {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Input Area */
.flux-input-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.flux-prompt-textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: all 0.3s ease;
}

.flux-prompt-textarea:focus {
    outline: none;
    border-color: rgba(236, 72, 153, 0.7);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.2);
}

.flux-prompt-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.flux-generate-btn {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.8), rgba(139, 92, 246, 0.8));
    border: 2px solid rgba(236, 72, 153, 0.5);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.flux-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(236, 72, 153, 1), rgba(139, 92, 246, 1));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(236, 72, 153, 0.4);
}

.flux-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.flux-generate-btn .btn-icon {
    font-size: 1.2rem;
}

/* Status Section */
.flux-status-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

.flux-status-section .section-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    margin: 0 0 0.75rem 0;
    font-weight: bold;
}

.flux-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flux-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(100, 100, 100, 0.8);
    transition: all 0.3s ease;
}

.status-dot.ready {
    background: rgba(34, 197, 94, 0.8);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.status-dot.generating {
    background: rgba(234, 179, 8, 0.8);
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.error {
    background: rgba(239, 68, 68, 0.8);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.status-dot.success {
    background: rgba(34, 197, 94, 0.8);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

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

.status-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.flux-progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    overflow: hidden;
}

.flux-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ec4899, #8b5cf6);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* History Section */
.flux-history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

.flux-history-section .section-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    margin: 0 0 0.75rem 0;
    font-weight: bold;
}

.flux-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flux-history-empty {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    text-align: center;
    padding: 2rem 1rem;
    font-style: italic;
}

.flux-history-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flux-history-item:hover {
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.4);
}

.flux-history-item.active {
    border-color: rgba(236, 72, 153, 0.6);
    background: rgba(236, 72, 153, 0.15);
}

.flux-history-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.flux-history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}

.flux-history-prompt {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.flux-history-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

/* Action Buttons */
.flux-action-buttons {
    display: flex;
    gap: 0.75rem;
}

.flux-action-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.flux-download-btn {
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid rgba(34, 197, 94, 0.4);
    color: rgba(34, 197, 94, 1);
}

.flux-download-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.6);
    transform: translateY(-2px);
}

.flux-download-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.flux-clear-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 1);
}

.flux-clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
    transform: translateY(-2px);
}

.flux-describe-btn {
    background: rgba(139, 92, 246, 0.2);
    border: 2px solid rgba(139, 92, 246, 0.4);
    color: rgba(139, 92, 246, 1);
}

.flux-describe-btn:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.6);
    transform: translateY(-2px);
}

.flux-describe-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.flux-describe-btn.loading {
    animation: describeGlow 1.5s ease-in-out infinite;
}

@keyframes describeGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
    }
}

.flux-add-world-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(16, 185, 129, 0.3));
    border: 2px solid rgba(59, 130, 246, 0.5);
    color: rgba(59, 130, 246, 1);
}

.flux-add-world-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.5), rgba(16, 185, 129, 0.5));
    border-color: rgba(59, 130, 246, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.flux-add-world-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.flux-add-world-btn.loading {
    animation: worldGlow 1.5s ease-in-out infinite;
}

@keyframes worldGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    }
}

/* Right Side - Preview */
.flux-right-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.flux-preview-container {
    position: relative;
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flux-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.4);
}

.flux-placeholder-icon {
    font-size: 4rem;
    opacity: 0.5;
}

.flux-placeholder-text {
    font-size: 1rem;
    text-align: center;
}

.flux-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

/* Loading Overlay */
.flux-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    border-radius: 14px;
}

.flux-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(236, 72, 153, 0.2);
    border-top-color: rgba(236, 72, 153, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.flux-loading-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    text-align: center;
}

/* Error Overlay */
.flux-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-radius: 14px;
}

.flux-error-icon {
    font-size: 3rem;
}

.flux-error-text {
    color: rgba(239, 68, 68, 0.9);
    font-size: 1rem;
    text-align: center;
    max-width: 80%;
}

.flux-retry-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid rgba(239, 68, 68, 0.5);
    border-radius: 8px;
    color: rgba(239, 68, 68, 1);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.flux-retry-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.7);
}

/* Responsive Design for Flux Modal */
@media (max-width: 900px) {
    .flux-modal-body {
        flex-direction: column;
    }
    
    .flux-left-side {
        flex: none;
    }
    
    .flux-right-side {
        min-height: 300px;
    }
}
