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

body {
    font-family: 'VT323', monospace;
    background: #0a0a0f;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.title {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: #ff6b6b;
    text-shadow: 2px 2px 0 #0f3460, 4px 4px 8px rgba(255, 107, 107, 0.6),
                 0 0 20px rgba(255, 107, 107, 0.4);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 2px 2px 0 #0f3460, 4px 4px 8px rgba(255, 107, 107, 0.6), 0 0 20px rgba(255, 107, 107, 0.4); }
    to { text-shadow: 2px 2px 0 #0f3460, 4px 4px 8px rgba(255, 107, 107, 0.8), 0 0 30px rgba(255, 107, 107, 0.6); }
}

.mode-tabs {
    display: flex;
    gap: 8px;
}

.mode-btn {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 16px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #16213e;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: #1a4d7a;
    border-color: #ff6b6b;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.8);
}

.mode-btn.vibe {
    background: linear-gradient(135deg, #4ecdc4 0%, #ffe66d 100%);
    color: #0a0a0f;
    font-weight: bold;
}

.mode-btn.vibe:hover {
    box-shadow: 0 0 16px rgba(78, 205, 196, 0.6);
}

.mode-btn.vibe.active {
    box-shadow: 0 0 20px rgba(78, 205, 196, 1);
}

.header-right {
    display: flex;
    gap: 8px;
}

.tool-btn {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 8px 12px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #16213e;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #1a4d7a;
    border-color: #ff6b6b;
}

.tool-btn.active {
    background: #4ecdc4;
    border-color: #4ecdc4;
    color: #0a0a0f;
    font-weight: bold;
}

.tool-btn.primary {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
    font-weight: bold;
}

.tool-btn.primary:hover {
    background: #ff5577;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.8);
}

.tool-btn.secondary {
    background: #4ecdc4;
    border-color: #4ecdc4;
    color: #0a0a0f;
    font-weight: bold;
}

.tool-btn.secondary:hover {
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.8);
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    background: #16213e;
    border: 2px solid #1a1a2e;
    display: flex;
    flex-direction: column;
}

.sidebar.left {
    width: 300px;
    border-right: 2px solid #ff6b6b;
}

.sidebar.right {
    width: 340px;
    border-left: 2px solid #ff6b6b;
}

.sidebar-tabs {
    display: flex;
    background: #0f3460;
    border-bottom: 2px solid #1a1a2e;
}

.tab-btn {
    flex: 1;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 10px;
    background: transparent;
    color: #888;
    border: none;
    border-right: 1px solid #1a1a2e;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background: #1a4d7a;
    color: #e0e0e0;
}

.tab-btn.active {
    background: #16213e;
    color: #ff6b6b;
    font-weight: bold;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
}

.tab-content.hidden {
    display: none;
}

.sidebar-header {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    padding: 16px;
    background: #0f3460;
    color: #ff6b6b;
    text-align: center;
    border-bottom: 2px solid #1a1a2e;
}

.sidebar-header.small {
    font-size: 10px;
    padding: 12px;
}

.palette-container {
    flex: 1;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 12px;
    align-content: start;
}

.palette-item {
    background: #0f3460;
    border: 3px solid #1a1a2e;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palette-item:hover {
    border-color: #ff6b6b;
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.5);
}

.palette-item.selected {
    border-color: #ff6b6b;
    box-shadow: 0 0 16px rgba(255, 107, 107, 0.9);
    background: #1a4d7a;
}

.palette-item img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.palette-item .favorite-btn {
    position: absolute;
    top: 2px;
    left: 2px;
    background: transparent;
    color: #ffe66d;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: none;
}

.palette-item:hover .favorite-btn {
    display: block;
}

.palette-item .delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff6b6b;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: none;
}

.palette-item:hover .delete-btn {
    display: block;
}

.palette-footer {
    padding: 12px;
    border-top: 2px solid #1a1a2e;
}

/* Community */
.community-info {
    padding: 20px;
    text-align: center;
    color: #888;
}

.community-info .small {
    font-size: 14px;
    margin-top: 8px;
}

.community-grid {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0a0f;
    position: relative;
}

.canvas-controls {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background: #16213e;
    border-bottom: 2px solid #1a1a2e;
    font-size: 18px;
}

.zoom-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.zoom-btn {
    font-size: 24px;
    width: 32px;
    height: 32px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #16213e;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #1a4d7a;
    border-color: #ff6b6b;
}

#zoomLevel {
    min-width: 60px;
    text-align: center;
    color: #ff6b6b;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

.layer-indicator, .coord-display, .tool-indicator {
    color: #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
}

.layer-indicator span, .coord-display span, .tool-indicator span {
    color: #4ecdc4;
    font-weight: bold;
}

.canvas-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #0a0a0f;
    display: flex;
    align-items: center;
    justify-content: center;
}

#worldCanvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.3);
}

.selection-box {
    position: absolute;
    border: 2px dashed #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    pointer-events: none;
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.6);
}

.selection-box.hidden {
    display: none;
}

.minimap-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(22, 33, 62, 0.95);
    border: 3px solid #ff6b6b;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
}

.minimap-header {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    color: #ff6b6b;
    text-align: center;
    margin-bottom: 6px;
}

#minimap {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 150px;
    height: 150px;
}

/* Generator Panel */
.generator-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.generator-panel label {
    font-size: 16px;
    color: #ff6b6b;
    font-weight: bold;
}

.select-input, .prompt-input {
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 8px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #1a1a2e;
}

.select-input:focus, .prompt-input:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.batch-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-primary {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: 2px solid #ff6b6b;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.btn-primary:hover {
    background: #ff5577;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.8);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #555;
    border-color: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-primary.vibe-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #ffe66d 100%);
    color: #0a0a0f;
    border: 2px solid #4ecdc4;
}

.btn-primary.vibe-btn:hover {
    box-shadow: 0 0 16px rgba(78, 205, 196, 0.8);
}

.btn-small {
    font-family: 'VT323', monospace;
    font-size: 14px;
    padding: 6px 12px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #1a1a2e;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #1a4d7a;
    border-color: #ff6b6b;
}

.status-text {
    font-size: 14px;
    color: #4ecdc4;
    text-align: center;
    min-height: 20px;
}

/* Vibe Panel */
.vibe-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vibe-header {
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    color: #4ecdc4;
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.1) 0%, rgba(255, 230, 109, 0.1) 100%);
    border: 2px solid #4ecdc4;
    border-radius: 4px;
}

.vibe-input {
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 12px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #4ecdc4;
    min-height: 120px;
}

.vibe-input:focus {
    outline: none;
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.6);
}

.vibe-templates {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.vibe-template-btn {
    font-family: 'VT323', monospace;
    font-size: 14px;
    padding: 8px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #1a1a2e;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.vibe-template-btn:hover {
    background: #1a4d7a;
    border-color: #4ecdc4;
    transform: scale(1.02);
}

.vibe-log {
    border-top: 2px solid #1a1a2e;
    margin-top: 12px;
}

.vibe-log.hidden {
    display: none;
}

.vibe-log-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: #0a0a0f;
    font-size: 14px;
    color: #4ecdc4;
    font-family: 'JetBrains Mono', monospace;
}

.vibe-log-content p {
    margin: 4px 0;
}

/* Templates */
.prompt-templates {
    border-top: 2px solid #1a1a2e;
    padding: 12px;
}

.template-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.template-btn {
    font-family: 'VT323', monospace;
    font-size: 14px;
    padding: 6px 10px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #1a1a2e;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.template-btn:hover {
    background: #1a4d7a;
    border-color: #ff6b6b;
    transform: translateX(4px);
}

/* Recent Assets */
.recent-assets {
    border-top: 2px solid #1a1a2e;
    padding: 12px;
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.recent-item {
    background: #0f3460;
    border: 2px solid #1a1a2e;
    padding: 4px;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.recent-item:hover {
    border-color: #ff6b6b;
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

.recent-item img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

/* Animation Preview */
.anim-preview {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #16213e;
    border: 3px solid #ff6b6b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.anim-preview.hidden {
    display: none;
}

.anim-header {
    background: #0f3460;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    color: #ff6b6b;
    font-weight: bold;
}

.close-btn {
    background: transparent;
    color: #ff6b6b;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #ff5577;
}

.anim-content {
    padding: 12px;
}

#animCanvas {
    display: block;
    margin: 0 auto 12px;
    background: #0a0a0f;
    border: 2px solid #1a1a2e;
    image-rendering: pixelated;
}

.anim-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.anim-controls button {
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 6px 12px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #1a1a2e;
    cursor: pointer;
}

.anim-controls input[type="range"] {
    width: 100px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    border: 3px solid #ff6b6b;
    min-width: 400px;
    max-width: 600px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.9);
}

.modal-header {
    background: #0f3460;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1a1a2e;
}

.modal-header h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #ff6b6b;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-link-container {
    display: flex;
    gap: 8px;
}

.share-input {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    padding: 8px;
    background: #0f3460;
    color: #e0e0e0;
    border: 2px solid #1a1a2e;
}

.share-options {
    font-size: 16px;
}

.share-options label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-info {
    font-size: 14px;
    color: #888;
    margin-top: 8px;
}

.export-info p {
    margin: 4px 0;
}

.small {
    font-size: 13px;
    color: #666;
}

/* Footer */
.footer {
    background: #1a1a2e;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    border-top: 3px solid #ff6b6b;
}

.footer a {
    color: #ff6b6b;
    text-decoration: none;
}

.footer a:hover {
    color: #ff5577;
    text-decoration: underline;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #0a0a0f;
}

::-webkit-scrollbar-thumb {
    background: #ff6b6b;
    border: 2px solid #0a0a0f;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff5577;
}

/* Responsive */
@media (max-width: 1400px) {
    .sidebar.right {
        width: 300px;
    }
    
    .sidebar.left {
        width: 260px;
    }
}

@media (max-width: 1100px) {
    .title {
        font-size: 14px;
    }
    
    .mode-btn, .tool-btn {
        font-size: 14px;
        padding: 6px 10px;
    }
    
    .sidebar.left, .sidebar.right {
        width: 240px;
    }
}

@media (max-width: 900px) {
    .header-left {
        flex-direction: column;
        gap: 8px;
    }
    
    .mode-tabs {
        flex-wrap: wrap;
    }
}