* {
    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: 2px solid #e94560;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

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

.title {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: #e94560;
    text-shadow: 2px 2px 0 #0f3460, 4px 4px 8px rgba(233, 69, 96, 0.5);
}

.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: #e94560;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.6);
}

.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: #e94560;
}

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

.tool-btn.primary:hover {
    background: #ff5577;
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.6);
}

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

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

.sidebar.left {
    width: 280px;
    border-right: 2px solid #e94560;
}

.sidebar.right {
    width: 320px;
    border-left: 2px solid #e94560;
}

.sidebar-header {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    padding: 16px;
    background: #0f3460;
    color: #e94560;
    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(80px, 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: #e94560;
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.4);
}

.palette-item.selected {
    border-color: #e94560;
    box-shadow: 0 0 16px rgba(233, 69, 96, 0.8);
    background: #1a4d7a;
}

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

.palette-item .delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e94560;
    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;
}

/* 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: #e94560;
}

#zoomLevel {
    min-width: 60px;
    text-align: center;
    color: #e94560;
    font-weight: bold;
}

.layer-indicator, .coord-display {
    color: #e0e0e0;
}

.layer-indicator span, .coord-display span {
    color: #e94560;
    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 20px rgba(233, 69, 96, 0.3);
}

.minimap-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(22, 33, 62, 0.9);
    border: 2px solid #e94560;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#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: #e94560;
    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: #e94560;
    box-shadow: 0 0 8px rgba(233, 69, 96, 0.4);
}

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

.btn-primary:hover {
    background: #ff5577;
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.6);
    transform: translateY(-2px);
}

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

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

.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: #e94560;
}

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

/* 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: #e94560;
    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: #e94560;
    transform: scale(1.1);
}

.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 #e94560;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    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: #e94560;
    font-weight: bold;
}

.close-btn {
    background: transparent;
    color: #e94560;
    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.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

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

.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: #e94560;
}

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

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

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

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

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

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

.konami-hint {
    color: #666;
    font-size: 12px;
}

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

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

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

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

/* Responsive */
@media (max-width: 1200px) {
    .sidebar.right {
        width: 280px;
    }
    
    .sidebar.left {
        width: 240px;
    }
}

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