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

body {
    font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f0f4ef;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(13, 24, 33, 0.08);
}

h1 {
    text-align: center;
    color: #0d1821;
    margin-bottom: 28px;
    font-size: 2.2em;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 20px;
    background: #f0f4ef;
    border-radius: 20px;
}

.control-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

label {
    font-weight: 500;
    color: #344966;
    font-size: 0.85rem;
}

input[type="number"] {
    width: 70px;
    padding: 8px 12px;
    border: 1.5px solid #e6aace;
    border-radius: 12px;
    text-align: center;
    font-family: inherit;
    background: white;
    color: #0d1821;
    font-size: 0.9rem;
}

input[type="number"]:focus {
    outline: none;
    border-color: #bfcc94;
}

input[type="color"] {
    width: 48px;
    height: 38px;
    border: 1.5px solid #e6aace;
    border-radius: 12px;
    cursor: pointer;
    background: white;
    padding: 2px;
}

button {
    padding: 8px 18px;
    background: white;
    color: #344966;
    border: 1.5px solid #e6aace;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

button:hover {
    background: #e6aace;
    color: #0d1821;
    border-color: #e6aace;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

#clear-btn:hover, #eraser-btn:hover, #fill-btn:hover {
    background: #bfcc94;
    border-color: #bfcc94;
}

#save-btn, #load-btn {
    background: #344966;
    color: white;
    border-color: #344966;
}

#save-btn:hover, #load-btn:hover {
    background: #0d1821;
    border-color: #0d1821;
}

.drawing-mode {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #344966;
    padding: 8px;
    background: #f0f4ef;
    border-radius: 30px;
    display: inline-block;
    width: auto;
    margin-left: auto;
    margin-right: auto;
    padding: 6px 20px;
}

#mode-display {
    color: #e6aace;
    font-weight: 600;
    background: #0d1821;
    padding: 2px 12px;
    border-radius: 30px;
    display: inline-block;
    margin-left: 6px;
}

#grid-container {
    display: grid;
    gap: 1px;
    background: #e6aace;
    border: 2px solid #344966;
    border-radius: 12px;
    margin-top: 24px;
    user-select: none;
    overflow: hidden;
}

.pixel {
    aspect-ratio: 1;
    background: #f0f4ef;
    cursor: pointer;
    transition: all 0.05s ease;
}

.pixel:hover {
    filter: brightness(0.95);
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    
    .control-group {
        justify-content: space-between;
    }
    
    button {
        padding: 6px 14px;
        font-size: 0.8rem;
    }
    
    .drawing-mode {
        font-size: 0.8rem;
    }
}