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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #e0e0e0;
    overflow: hidden;
}

#app-container {
    display: grid;
    grid-template-areas: 
        "header header header"
        "left-sidebar scene right-sidebar"
        "bottom-controls bottom-controls bottom-controls"
        "footer footer footer";
    grid-template-rows: 140px 1fr 70px 40px;
    grid-template-columns: 320px 1fr 320px;
    height: 100vh;
    gap: 10px;
    padding: 10px;
}

/* Enhanced Header with Crime HUD */
.header {
    grid-area: header;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 20, 147, 0.6);
    border-radius: 15px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 20, 147, 0.1), rgba(255, 107, 53, 0.1));
    z-index: -1;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.app-title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #ff1493, #ff6b35, #00d4ff);
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: neonGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 0 20px rgba(255, 20, 147, 0.5);
}

@keyframes neonGlow {
    0% { 
        background-position: 0% 50%;
        filter: drop-shadow(0 0 10px rgba(255, 20, 147, 0.8));
    }
    100% { 
        background-position: 100% 50%;
        filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.8));
    }
}

.crime-hud {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.wanted-level {
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid #ff0000;
    border-radius: 10px;
    padding: 6px 12px;
    color: #ff0000;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.cash-counter {
    background: rgba(0, 255, 0, 0.2);
    border: 2px solid #00ff00;
    border-radius: 10px;
    padding: 6px 12px;
    color: #00ff00;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

.mission-status {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 6px 12px;
    color: #ffd700;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.generation-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 400px;
}

.control-input {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 20, 147, 0.5);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.control-input:focus {
    outline: none;
    border-color: #ff1493;
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.4);
}

.seed-container {
    display: flex;
    gap: 5px;
    align-items: center;
}

.seed-input {
    width: 120px !important;
}

.dice-btn {
    background: rgba(255, 20, 147, 0.3);
    border: 1px solid rgba(255, 20, 147, 0.7);
    border-radius: 6px;
    padding: 8px;
    color: #ff1493;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.dice-btn:hover {
    background: rgba(255, 20, 147, 0.5);
    transform: rotate(180deg);
}

.generate-btn {
    background: linear-gradient(135deg, #ff1493, #ff6b35);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 20, 147, 0.5);
}

.crime-btn, .spree-btn {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.spree-btn {
    background: linear-gradient(135deg, #8b0000, #4b0000);
    animation: dangerGlow 2s ease-in-out infinite;
}

@keyframes dangerGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(139, 0, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(139, 0, 0, 0.8); }
}

.crime-btn:hover, .spree-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.6);
}

/* Enhanced Sidebars for Crime Theme */
.left-sidebar, .right-sidebar {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 20, 147, 0.4);
    border-radius: 15px;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

.left-sidebar {
    grid-area: left-sidebar;
}

.right-sidebar {
    grid-area: right-sidebar;
}

.crime-panel {
    border: 2px solid rgba(255, 0, 0, 0.4);
    background: rgba(255, 0, 0, 0.05);
}

.panel {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.panel:hover {
    border-color: rgba(255, 20, 147, 0.4);
    transform: translateY(-1px);
}

.panel h3 {
    color: #ff1493;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 20, 147, 0.3);
    text-transform: uppercase;
}

.crime-panel h3 {
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.panel label {
    display: block;
    margin: 10px 0 5px 0;
    font-size: 12px;
    color: #cccccc;
    font-weight: bold;
    text-transform: uppercase;
}

/* Texture Studio */
.texture-studio {
    border: 2px solid rgba(255, 107, 53, 0.4);
    background: rgba(255, 107, 53, 0.05);
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
}

.collapsible-header:hover {
    color: #ff8855;
    transform: translateX(3px);
}

.collapse-indicator {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.collapsible-content {
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.collapsible-content.collapsed {
    max-height: 0;
}

.template-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 107, 53, 0.4);
    border-radius: 6px;
    padding: 10px;
    color: #e0e0e0;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 50px;
    line-height: 1.3;
}

.crime-variables {
    background: rgba(255, 20, 147, 0.05);
    border: 1px solid rgba(255, 20, 147, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}

.variable-grid {
    display: grid;
    gap: 6px;
}

.variable-item {
    font-size: 11px;
    line-height: 1.2;
    color: #cccccc;
}

.variable-item strong {
    color: #ff1493;
}

/* Mission Controls */
.mission-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.mission-btn {
    background: rgba(255, 20, 147, 0.2);
    border: 1px solid rgba(255, 20, 147, 0.5);
    border-radius: 6px;
    padding: 8px 10px;
    color: #ff1493;
    cursor: pointer;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.mission-btn:hover {
    background: rgba(255, 20, 147, 0.4);
    transform: translateY(-1px);
}

.mission-info h4 {
    color: #ff6b35;
    margin: 10px 0 5px 0;
    font-size: 12px;
    text-transform: uppercase;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 8px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff1493, #ff6b35);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Scene Container with Game HUD */
.scene-container {
    grid-area: scene;
    position: relative;
    border: 2px solid rgba(255, 20, 147, 0.5);
    border-radius: 15px;
    overflow: hidden;
    background: radial-gradient(circle, rgba(26, 26, 46, 0.8) 0%, rgba(10, 10, 10, 0.9) 100%);
}

.scene-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Game HUD Overlays */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.minimap {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 20, 147, 0.6);
    border-radius: 10px;
    padding: 10px;
}

.minimap-label {
    color: #ff1493;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
    font-family: 'Courier New', monospace;
}

#minimapCanvas {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.weapon-hud {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 0, 0, 0.6);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.weapon-icon {
    font-size: 24px;
    color: #ff0000;
}

.ammo-count {
    color: #ffff00;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.police-radio {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(0, 0, 255, 0.6);
    border-radius: 10px;
    padding: 10px;
    max-width: 250px;
}

.radio-header {
    color: #0088ff;
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 5px;
    font-family: 'Courier New', monospace;
}

.radio-text {
    color: #cccccc;
    font-size: 9px;
    line-height: 1.3;
    font-family: 'Courier New', monospace;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 30px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 20, 147, 0.3);
    border-top: 4px solid #ff1493;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Crime Inspector */
.crime-inspector {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid rgba(255, 20, 147, 0.8);
    border-radius: 12px;
    padding: 20px;
    max-width: 350px;
    z-index: 1001;
    backdrop-filter: blur(15px);
}

.inspector-content h4 {
    color: #ff1493;
    margin-bottom: 12px;
    font-size: 1rem;
    text-transform: uppercase;
}

.inspector-info {
    text-align: left;
    font-size: 12px;
    line-height: 1.4;
    font-family: 'Courier New', monospace;
}

.inspector-info p {
    margin: 6px 0;
    color: #cccccc;
}

.inspector-info strong {
    color: #ff1493;
}

.inspector-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 12px;
}

.small-btn {
    background: rgba(255, 20, 147, 0.3);
    border: 1px solid rgba(255, 20, 147, 0.6);
    border-radius: 4px;
    padding: 4px 8px;
    color: #ff1493;
    cursor: pointer;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.small-btn:hover {
    background: rgba(255, 20, 147, 0.5);
    transform: translateY(-1px);
}

/* Bottom Controls */
.bottom-controls {
    grid-area: bottom-controls;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 20, 147, 0.4);
    border-radius: 15px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.view-controls, .export-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 20, 147, 0.5);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-transform: uppercase;
}

.control-btn:hover {
    background: rgba(255, 20, 147, 0.3);
    border-color: #ff1493;
    transform: translateY(-1px);
}

/* Statistics Panels */
.crime-stats, .empire-finances, .law-enforcement {
    display: grid;
    gap: 6px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.stat-label {
    color: #ccc;
    text-transform: uppercase;
    font-weight: bold;
}

.stat-value {
    color: #ff1493;
    font-weight: bold;
}

.stat-value.green {
    color: #00ff00;
}

.stat-value.red {
    color: #ff0000;
}

.stat-value.gold {
    color: #ffd700;
}

.stat-value.orange {
    color: #ff8800;
}

/* Crime Log */
.crime-log {
    max-height: 150px;
    overflow-y: auto;
    font-size: 10px;
    line-height: 1.4;
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.crime-log p {
    margin-bottom: 4px;
    padding: 1px 0;
}

.crime-log p.crime-error {
    color: #ff0000;
}

.crime-log p.crime-warning {
    color: #ffaa00;
}

.crime-log p.crime-success {
    color: #00ff00;
}

.crime-log p.crime-action {
    color: #ff1493;
}

.timestamp {
    color: #666;
    font-size: 9px;
    font-weight: bold;
}

/* Footer */
.footer {
    grid-area: footer;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 20, 147, 0.4);
    border-radius: 15px;
    padding: 8px 20px;
    text-align: center;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer a {
    color: #ff1493;
    text-decoration: none;
    font-weight: bold;
}

.footer a:hover {
    text-decoration: underline;
    text-shadow: 0 0 8px rgba(255, 20, 147, 0.5);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Enhanced Scrollbars */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff1493, #ff6b35);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff6b35, #ff1493);
}

/* Mobile Responsiveness */
@media (max-width: 1400px) {
    #app-container {
        grid-template-columns: 280px 1fr 280px;
    }
    
    .app-title {
        font-size: 1.6rem;
    }
}

@media (max-width: 1200px) {
    #app-container {
        grid-template-areas: 
            "header"
            "scene"
            "bottom-controls"
            "footer";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto auto;
    }
    
    .left-sidebar, .right-sidebar {
        display: none;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .generation-controls {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 768px) {
    #app-container {
        padding: 6px;
        gap: 6px;
    }
    
    .header {
        padding: 12px;
    }
    
    .bottom-controls {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }
    
    .app-title {
        font-size: 1.4rem;
    }
    
    .control-btn {
        font-size: 10px;
        padding: 6px 10px;
    }
    
    .police-radio {
        max-width: 200px;
    }
}

/* Focus accessibility */
.control-input:focus,
.template-input:focus,
.small-btn:focus,
.control-btn:focus {
    outline: 2px solid #ff1493;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}