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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#app {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 900px;
    width: 100%;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 20px;
    text-align: center;
    position: relative;
}

h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    color: white;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

#mode-indicator {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: #fff;
    background: rgba(0,0,0,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}

.action-bar {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    flex-wrap: wrap;
    align-items: center;
}

#custom-text {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

#color-picker {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #6c757d;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 #495057;
}

.pixel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #495057;
}

.pixel-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #495057;
}

.pixel-btn.primary {
    background: #f5576c;
    box-shadow: 0 4px 0 #c72c3e;
}

.pixel-btn.primary:hover {
    box-shadow: 0 6px 0 #c72c3e;
}

.pixel-btn.primary:active {
    box-shadow: 0 2px 0 #c72c3e;
}

.pixel-btn.success {
    background: #2ECC71;
    box-shadow: 0 4px 0 #27AE60;
}

.pixel-btn.success:hover {
    box-shadow: 0 6px 0 #27AE60;
}

.pixel-btn.success:active {
    box-shadow: 0 2px 0 #27AE60;
}

#canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #e9ecef;
}

#game-canvas {
    border: 4px solid #495057;
    border-radius: 8px;
    cursor: crosshair;
    display: block;
}

#grid-cursor {
    position: fixed;
    width: 32px;
    height: 32px;
    border: 2px solid #f5576c;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(245, 87, 108, 0.5);
}

.tool-palette {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
    flex-wrap: wrap;
    align-items: center;
}

.tool-btn {
    font-size: 24px;
    width: 50px;
    height: 50px;
    border: 3px solid #dee2e6;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    transform: scale(1.1);
    border-color: #f5576c;
}

.tool-btn.active {
    border-color: #f5576c;
    background: #fff5f7;
    box-shadow: 0 0 15px rgba(245, 87, 108, 0.3);
}

#tool-info {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #495057;
    margin-left: auto;
    font-weight: 600;
}

#game-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

#health-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

#health-bar {
    width: 100px;
    height: 20px;
    background: #2ECC71;
    border: 2px solid #495057;
    border-radius: 10px;
    transition: all 0.3s;
}

#score-display {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #495057;
}

#game-controls {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
    font-size: 14px;
    color: #6c757d;
}

footer {
    background: #343a40;
    color: white;
    padding: 20px;
    text-align: center;
}

footer p {
    margin: 5px 0;
    font-size: 14px;
}

footer a {
    color: #f093fb;
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.vibe-check {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #ffd700;
    margin-top: 10px !important;
}

#toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2ECC71;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    margin-bottom: 20px;
    color: #495057;
}

#import-text {
    width: 100%;
    height: 150px;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin-bottom: 15px;
    resize: vertical;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    #game-canvas {
        max-width: 100%;
        height: auto;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .action-bar {
        justify-content: center;
    }
    
    .pixel-btn {
        font-size: 8px;
        padding: 8px 12px;
    }
    
    #tool-info {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 10px;
    }
}