/* Kyle Kart 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: 300;
}

/* Hide mobile controls by default (shown only in media query) */
#mobile-controls {
    display: none;
}

/* Hide mobile kart button by default - only show on mobile */
#btn-standard-kart-mobile {
    display: none;
}

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

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

.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);
}

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

@media (max-width: 768px) {
    .fps-display {
        padding: 0.3rem 0.5rem;
        font-size: 0.625rem;
        border-radius: 4px;
        height: 28px;
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }
}

#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);
}

@media (max-width: 768px) {
    .menu-btn {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
        min-width: auto;
        width: auto !important;
        max-width: fit-content;
        flex: none;
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
    }

    #top-bar {
        display: grid;
        grid-template-columns: auto auto 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 0.5rem;
        align-items: center;
    }

    #score-display {
        grid-column: 1;
        grid-row: 1;
        padding: 0.375rem 0.5rem;
        font-size: 0.85rem;
        width: fit-content;
        max-width: 50%;
    }

    .connection-status {
        grid-column: 1;
        grid-row: 2;
        padding: 0.375rem 0.75rem;
        font-size: 0.7rem;
        justify-self: start;
    }
}

/* 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;
    max-height: 85vh;
    overflow-y: auto;
    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);
}

/* World Navigation Styles */
.menu-section-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.menu-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
    margin: 1rem 0;
}

.world-btn {
    position: relative;
}

.world-btn#btn-go-home {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.4);
}

.world-btn#btn-go-home:hover {
    background: rgba(0, 255, 136, 0.4);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.world-btn#btn-go-metaverse {
    background: rgba(0, 136, 255, 0.2);
    border-color: rgba(0, 136, 255, 0.4);
}

.world-btn#btn-go-metaverse:hover {
    background: rgba(0, 136, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 136, 255, 0.3);
}

.current-world-info {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    text-align: center;
}

.current-world-info.home-world {
    color: rgba(0, 255, 136, 0.9);
    background: rgba(0, 255, 136, 0.1);
}

.current-world-info.public-world {
    color: rgba(0, 136, 255, 0.9);
    background: rgba(0, 136, 255, 0.1);
}

/* Full Page Modal Styles */
#ai-image-lab-modal {
    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;
}

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

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

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

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

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

.settings-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: 450px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    text-align: center;
}

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

.account-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: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    text-align: center;
    z-index: 1;
}

/* ── My Creations gallery ───────────────────────────── */
.account-creations {
    margin-top: 1.5rem;
    text-align: left;
    border-top: 1px solid rgba(102, 126, 234, 0.25);
    padding-top: 1rem;
}

.account-creations .creations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.account-creations h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 0.75rem 0 0.5rem 0;
}

.creations-refresh {
    background: rgba(102, 126, 234, 0.25);
    border: 1px solid rgba(102, 126, 234, 0.5);
    color: white;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.creations-refresh:hover {
    background: rgba(102, 126, 234, 0.55);
}

.creations-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.creations-empty {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    padding: 0.75rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.creation-thumb {
    margin: 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.creation-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.4);
}

.creation-thumb figcaption {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.25rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.25rem;
    text-align: left;
}

.account-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.account-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(102, 126, 234, 0.45);
    border-radius: 8px;
    color: white;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.account-input:focus {
    border-color: rgba(102, 126, 234, 0.9);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.account-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.account-btn-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.account-btn {
    flex: 1;
    background: rgba(102, 126, 234, 0.25);
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    color: white;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
    font-weight: 600;
}

.account-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.55);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.account-btn:disabled {
    cursor: not-allowed;
}

.account-btn-primary {
    background: rgba(0, 200, 120, 0.25);
    border-color: rgba(0, 200, 120, 0.5);
}

.account-btn-primary:hover:not(:disabled) {
    background: rgba(0, 200, 120, 0.45);
    box-shadow: 0 4px 12px rgba(0, 200, 120, 0.3);
}

.account-btn-secondary {
    background: rgba(102, 126, 234, 0.2);
}

.account-btn-google {
    width: 100%;
    margin-top: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
}

.account-btn-google:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.account-btn-danger {
    width: 100%;
    margin-top: 1.25rem;
    background: rgba(220, 60, 60, 0.25);
    border-color: rgba(220, 60, 60, 0.5);
}

.account-btn-danger:hover:not(:disabled) {
    background: rgba(220, 60, 60, 0.45);
    box-shadow: 0 4px 12px rgba(220, 60, 60, 0.3);
}

.account-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
}

.account-divider::before,
.account-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
}

.account-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(220, 60, 60, 0.2);
    border: 1px solid rgba(220, 60, 60, 0.45);
    border-radius: 8px;
    color: #ffb4b4;
    font-size: 0.9rem;
    text-align: left;
}

.account-profile {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(0, 255, 136, 0.25);
}

.account-profile-name {
    color: rgba(0, 255, 136, 0.95);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.account-profile-email {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    word-break: break-all;
}

.settings-section {
    margin-top: 1.5rem;
    text-align: left;
}

.settings-item {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.settings-icon {
    font-size: 1.25rem;
}

.settings-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-control input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
    cursor: pointer;
}

.settings-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
}

.settings-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
}

.zoom-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    min-width: 35px;
}

.settings-value {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    min-width: 35px;
    text-align: center;
}

/* Room Selector Modal Styles */
#room-selector-modal .full-page-modal-content.room-selector-modal {
    width: 90vw;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    overflow: hidden;
    pointer-events: all;
}

/* Prevent clicks from passing through the modal backdrop */
#room-selector-modal .modal-backdrop {
    pointer-events: all;
}

/* Ensure all room selector elements capture clicks */
.room-selector-body,
.room-list-panel,
.room-preview-panel,
.room-list-container,
.room-preview-content,
.room-3d-preview-container {
    pointer-events: all;
}

.room-selector-body {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    margin-top: 1rem;
}

/* Left Panel - Room List */
.room-list-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
}

.room-list-header {
    margin-bottom: 1rem;
}

.room-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.room-search-input:focus {
    border-color: rgba(102, 126, 234, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

.room-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.room-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.room-list-loading {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 2rem;
}

.room-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.room-list-item:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateX(4px);
}

.room-list-item.selected {
    background: rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.8);
}

.room-item-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.room-item-info {
    flex: 1;
    min-width: 0;
}

.room-item-name {
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-item-id {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

/* Right Panel - Preview */
.room-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    min-width: 0;
}

.room-preview-placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
}

.preview-placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.preview-placeholder-text {
    font-size: 1rem;
}

.room-preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.room-preview-color {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.room-preview-name {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.room-preview-id {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.room-preview-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    max-width: 280px;
}

.room-enter-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: 12px;
    color: white;
    font-weight: bold;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.room-enter-btn:hover {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.9), rgba(102, 126, 234, 0.9));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* 3D Preview Container */
.room-3d-preview-container {
    width: 100%;
    height: 280px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

#room-preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.room-preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.7);
    gap: 0.5rem;
}

.preview-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top-color: rgba(102, 126, 234, 0.9);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.room-info-section {
    text-align: center;
}

.room-info-section .room-preview-name {
    margin-bottom: 0.25rem;
}

.room-info-section .room-preview-description {
    max-width: 100%;
    margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #room-selector-modal .full-page-modal-content.room-selector-modal {
        width: 95vw;
        height: auto;
        max-height: 90vh;
        padding: 1rem;
        padding-bottom: 3rem;
        overflow-y: auto !important;
    }

    .room-selector-body {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .room-list-panel,
    .room-preview-panel {
        flex: none;
        height: auto;
        min-height: 200px;
        max-height: none;
        overflow: visible;
    }

    .room-list-panel {
        max-height: 35vh;
        overflow-y: auto;
    }

    .room-preview-panel {
        max-height: none;
        margin-bottom: 2rem;
        overflow: visible;
    }

    .room-preview-color {
        width: 80px;
        height: 80px;
    }

    .room-preview-name {
        font-size: 1.2rem;
    }

    .room-enter-btn {
        margin-bottom: 1rem;
    }
}

.player-avatar-modal-content {
    overflow: auto;
}

.player-avatar-modal-body {
    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 - Now visible on all devices! */
#mobile-controls {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    z-index: 200;
    display: block;
    /* Visible on all devices now */
    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);
    }
}

/* Portal Button - next to tree button */
#btn-portal {
    position: fixed;
    bottom: 225px;
    /* Vertically centered with tree button */
    left: 175px;
    /* Right next to tree button */
    width: 70px;
    height: 70px;
    background: radial-gradient(circle, rgba(0, 102, 170, 0.5) 0%, rgba(0, 0, 51, 0.7) 70%);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(0, 255, 255, 0.6);
    border-radius: 50%;
    color: white;
    font-size: 1.8rem;
    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(0, 255, 255, 0.4), inset 0 0 30px rgba(255, 0, 255, 0.3);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: portalPulse 10s ease-in-out infinite;
    z-index: 300;
}

#btn-portal:active {
    background: radial-gradient(circle, rgba(0, 102, 170, 0.8) 0%, rgba(0, 0, 51, 0.9) 70%);
    border-color: rgba(255, 0, 255, 0.9);
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.8), inset 0 0 40px rgba(255, 0, 255, 0.5);
}

@keyframes portalPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(0, 255, 255, 0.4), inset 0 0 30px rgba(255, 0, 255, 0.3);
        border-color: rgba(0, 255, 255, 0.6);
    }

    50% {
        box-shadow: 0 4px 30px rgba(255, 0, 255, 0.6), inset 0 0 40px rgba(0, 255, 255, 0.4);
        border-color: rgba(255, 0, 255, 0.8);
    }
}

/* Avatar Button - above brick button */
#btn-avatar {
    position: fixed;
    bottom: 510px;
    /* Above brick button */
    left: 30px;
    width: 140px;
    height: 140px;
    background: rgba(139, 92, 246, 0.3);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(167, 139, 250, 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(139, 92, 246, 0.4);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: avatarPulse 2s ease-in-out infinite;
    z-index: 300;
}

#btn-avatar:active {
    background: rgba(139, 92, 246, 0.7);
    border-color: rgba(167, 139, 250, 0.9);
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.8);
}

@keyframes avatarPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(167, 139, 250, 0.7);
    }
}

/* AI Image Lab Button - above avatar button */
#btn-image-lab {
    position: fixed;
    bottom: 670px;
    /* Above avatar button */
    left: 30px;
    width: 140px;
    height: 140px;
    background: rgba(236, 72, 153, 0.3);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(236, 72, 153, 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(236, 72, 153, 0.4);
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: imageLabPulse 2s ease-in-out infinite;
    z-index: 300;
}

#btn-image-lab:active {
    background: rgba(236, 72, 153, 0.7);
    border-color: rgba(236, 72, 153, 0.9);
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(236, 72, 153, 0.8);
}

@keyframes imageLabPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(236, 72, 153, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(236, 72, 153, 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 center */
#dpad {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 259px;
    height: 259px;
    pointer-events: all;
    z-index: 250;
    display: none;
    /* Hidden on desktop, shown on touch devices */
}

/* Show D-pad only on touch devices */
@media (hover: none) and (pointer: coarse) {
    #dpad {
        display: block;
    }
}

.dpad-btn {
    position: absolute;
    width: 86px;
    height: 86px;
    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: 2.2rem;
    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);
}

/* Toggled-on state for forward button in kart mode (cruise control) */
.dpad-btn.toggled-on {
    background: rgba(50, 205, 50, 0.5);
    border-color: rgba(50, 255, 50, 0.9);
    box-shadow: 0 4px 20px rgba(50, 205, 50, 0.6), inset 0 0 15px rgba(50, 255, 50, 0.3);
    animation: cruiseControlPulse 1s ease-in-out infinite;
}

@keyframes cruiseControlPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(50, 205, 50, 0.6), inset 0 0 15px rgba(50, 255, 50, 0.3);
    }

    50% {
        box-shadow: 0 4px 30px rgba(50, 255, 50, 0.8), inset 0 0 20px rgba(50, 255, 50, 0.5);
    }
}

/* Boost mode (double speed) for forward button in kart mode */
.dpad-btn.toggled-boost {
    background: rgba(255, 100, 50, 0.6);
    border-color: rgba(255, 150, 50, 0.9);
    box-shadow: 0 4px 25px rgba(255, 100, 50, 0.7), inset 0 0 20px rgba(255, 150, 50, 0.4);
    animation: boostPulse 0.5s ease-in-out infinite;
}

@keyframes boostPulse {

    0%,
    100% {
        box-shadow: 0 4px 25px rgba(255, 100, 50, 0.7), inset 0 0 20px rgba(255, 150, 50, 0.4);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 4px 35px rgba(255, 50, 0, 0.9), inset 0 0 25px rgba(255, 200, 50, 0.6);
        transform: scale(1.05);
    }
}

/* Super Boost mode (4x speed) for forward button in kart mode - YELLOW */
.dpad-btn.toggled-superboost {
    background: rgba(255, 230, 50, 0.7);
    border-color: rgba(255, 255, 100, 0.95);
    box-shadow: 0 4px 30px rgba(255, 230, 50, 0.8), inset 0 0 25px rgba(255, 255, 100, 0.5);
    animation: superBoostPulse 0.3s ease-in-out infinite;
}

@keyframes superBoostPulse {

    0%,
    100% {
        box-shadow: 0 4px 30px rgba(255, 230, 50, 0.8), inset 0 0 25px rgba(255, 255, 100, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 6px 40px rgba(255, 255, 0, 1), inset 0 0 35px rgba(255, 255, 150, 0.7);
        transform: scale(1.1);
    }
}

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

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

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

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

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

    /* Move speed indicator to bottom right on mobile */
    #race-speed,
    .race-speed {
        bottom: 10px !important;
        right: 20px !important;
        left: auto !important;
        transform: none !important;
        font-size: 11px !important;
        padding: 6px 14px !important;
    }

    /* Make race timer smaller on mobile */
    #race-timer {
        font-size: 14px !important;
        padding: 8px 14px !important;
        top: 60px !important;
        right: 10px !important;
    }

    /* Make checkpoints smaller on mobile */
    #race-checkpoints {
        font-size: 10px !important;
        padding: 6px 12px !important;
        top: 100px !important;
        right: 10px !important;
    }

    /* Hide boost indicator on mobile (D-pad button shows boost state) */
    #race-boost,
    .race-boost {
        display: none !important;
    }
}

/* 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;
    overscroll-behavior: contain;
    touch-action: none;
}

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

.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;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

@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: 16px;
    /* Prevents iOS zoom on focus */
    transition: all 0.3s ease;
    touch-action: manipulation;
}

#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;
}

/* Mobile: Half-size input area and chat */
@media (hover: none) and (pointer: coarse) {

    /* Move portal button between avatar and image lab on mobile */
    #btn-portal {
        left: 100px;
        bottom: 590px;
        /* Nestled between avatar (510px) and image lab (670px) buttons */
    }

    .input-area {
        max-width: 50%;
    }

    #user-input {
        padding: 0.5rem 0.75rem;
        font-size: 14px;
    }

    .send-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    /* Smaller conversation/chat area on mobile */
    .conversation-container {
        max-height: 80px;
    }

    .conversation-history {
        min-height: 40px;
        max-height: 60px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .pipeline-status-section {
        padding: 0.5rem;
    }

    .pipeline-stage {
        padding: 0.5rem;
    }

    .stage-header {
        font-size: 0.8rem;
    }

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

.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: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

    /* Move connection status to the left on mobile to avoid overlap with players online */
    #connection-status {
        margin-left: 0;
    }

    /* Keep FPS small and inline with score */
    #score-display {
        order: 1;
    }

    #fps-display {
        order: 2;
    }

    #connection-status {
        order: 3;
    }

    #menu-button {
        order: 4;
        width: 100%;
        margin-left: 0;
    }

    .back-button,
    #score-display {
        font-size: 0.625rem;
        padding: 0.3rem 0.5rem;
        height: 28px;
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }

    #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: 170px;
        /* Above chat panel */
        left: 20px;
        width: 60px;
        /* Half size for mobile */
        height: 60px;
        font-size: 1.6rem;
        /* Half size font */
    }

    #btn-standard-kart-mobile {
        position: absolute;
        bottom: 170px;
        left: 90px;
        /* Next to rocket */
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
        border-radius: 50%;
        background: rgba(50, 100, 255, 0.6);
        /* Blueish for Kart */
        border: 2px solid rgba(255, 255, 255, 0.6);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(4px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        pointer-events: auto;
    }

    #btn-tree {
        bottom: 235px;
        /* Above rocket on mobile */
        left: 20px;
        width: 60px;
        /* Half size for mobile */
        height: 60px;
        font-size: 1.6rem;
        /* Half size font */
    }

    #btn-brick {
        bottom: 300px;
        /* Above tree on mobile */
        left: 20px;
        width: 60px;
        /* Half size for mobile */
        height: 60px;
        font-size: 1.6rem;
        /* Half size font */
    }

    #btn-avatar {
        bottom: 365px;
        /* Above brick on mobile */
        left: 20px;
        width: 60px;
        /* Half size for mobile */
        height: 60px;
        font-size: 1.6rem;
        /* Half size font */
    }

    #btn-image-lab {
        bottom: 430px;
        /* Above avatar on mobile */
        left: 20px;
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }

    #btn-portal {
        bottom: 495px;
        /* Above image lab button in first column */
        left: 20px;
        /* First column */
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }

    #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: 188px;
        height: 188px;
        bottom: 20px;
        right: 20px;
    }

    .dpad-btn {
        width: 63px;
        height: 63px;
        font-size: 1.5rem;
    }

    #btn-up {
        left: 63px;
    }

    #btn-down {
        left: 63px;
    }

    #btn-left {
        top: 63px;
    }

    #btn-right {
        top: 63px;
    }

    .connection-status {
        padding: 0.3rem 0.5rem;
        font-size: 0.625rem;
        border-radius: 5px;
        height: 28px;
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }

    .menu-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.625rem;
        border-radius: 5px;
        height: 28px;
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }
}

/* 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;
        overflow-y: auto;
    }

    .flux-left-side {
        flex: none;
        max-height: none;
        overflow-y: visible;
    }

    .flux-right-side {
        min-height: 300px;
        flex-shrink: 0;
    }

    /* Ensure action buttons are always visible on mobile */
    .flux-action-buttons {
        position: sticky;
        bottom: 0;
        background: linear-gradient(to top, rgba(15, 15, 35, 0.98) 80%, transparent);
        padding: 1rem 0;
        margin: 0 -0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        z-index: 10;
    }
}

/* Players Online box - mobile positioning */
@media (max-width: 768px) {
    #player-list {
        top: 10px !important;
        right: 10px !important;
        max-width: 150px !important;
        max-height: 150px !important;
        overflow-y: auto !important;
        padding: 8px !important;
        font-size: 12px !important;
        z-index: 500 !important;
    }

    .player-list-header {
        font-size: 11px !important;
    }

    #player-list-content {
        max-height: 100px !important;
        overflow-y: auto !important;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    #player-list {
        top: 8px !important;
        right: 8px !important;
        max-width: 120px !important;
        max-height: 120px !important;
        padding: 6px !important;
        font-size: 10px !important;
    }

    #player-list-content {
        max-height: 80px !important;
    }
}

/* ========================================
   CUSTOM RANGE SLIDER STYLES - THICKER FOR EASIER USE
   ======================================== */

/* Webkit browsers (Chrome, Safari, Edge) */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: -6px;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

/* Firefox */
input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

input[type="range"]::-moz-range-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

/* Mobile-specific - even larger for touch */
@media (max-width: 768px) {
    input[type="range"] {
        height: 16px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
        margin-top: -8px;
    }

    input[type="range"]::-webkit-slider-runnable-track {
        height: 16px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 32px;
        height: 32px;
    }

    input[type="range"]::-moz-range-track {
        height: 16px;
    }
}