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

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #9CAF56, #B8C768);
    min-height: 100vh;
    color: #3C2415;
}

.header {
    text-align: center;
    padding: 20px;
    background: rgba(156, 175, 86, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5em;
    color: #F5F5DC;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.1em;
    color: #F5F5DC;
    font-weight: 300;
}

.app-container {
    display: flex;
    max-width: 1200px;
    margin: 20px auto;
    gap: 20px;
    padding: 0 20px;
    flex-wrap: wrap;
}

.sidebar {
    flex: 0 0 250px;
    background: rgba(245, 245, 220, 0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.sidebar h3 {
    font-family: 'Fredoka One', cursive;
    color: #9CAF56;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(156, 175, 86, 0.3);
}

.section:last-child {
    border-bottom: none;
}

.section h4 {
    font-weight: 600;
    margin-bottom: 10px;
    color: #3C2415;
}

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

.color-btn {
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.color-btn.active {
    border-color: #FFB347;
    transform: scale(1.1);
}

.select-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #9CAF56;
    border-radius: 8px;
    background: white;
    font-family: inherit;
    color: #3C2415;
    cursor: pointer;
}

.select-dropdown:focus {
    outline: none;
    border-color: #FFB347;
}

.slider {
    width: 100%;
    margin: 8px 0;
    -webkit-appearance: none;
    height: 6px;
    background: #9CAF56;
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #FFB347;
    border-radius: 50%;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #FFB347;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-label {
    font-size: 0.9em;
    color: #3C2415;
}

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(245, 245, 220, 0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 360px;
}

.canvas-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn, .action-btn, .save-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-btn {
    background: #9CAF56;
    color: white;
}

.action-btn {
    background: #FFB347;
    color: #3C2415;
    padding: 10px 20px;
    font-size: 1em;
}

.save-btn {
    background: #228B22;
    color: white;
    padding: 12px 24px;
    font-size: 1.1em;
    margin-top: 20px;
}

.control-btn:hover, .action-btn:hover, .save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.canvas-controls .control-btn:hover {
    background: #B8C768;
}

.action-btn:hover {
    background: #FFD700;
}

.save-btn:hover {
    background: #32CD32;
}

#canvas {
    border: 4px solid #9CAF56;
    border-radius: 12px;
    background: white;
    transition: transform 0.2s;
}

.export-controls {
    display: flex;
    justify-content: center;
}

.info-panel {
    background: rgba(245, 245, 220, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin: 20px auto;
    max-width: 1200px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.pattern-info {
    flex: 1;
    min-width: 300px;
}

.pattern-info h4 {
    font-family: 'Fredoka One', cursive;
    color: #9CAF56;
    margin-bottom: 10px;
}

.pattern-info p {
    line-height: 1.6;
    color: #3C2415;
}

.gallery {
    flex: 1;
    min-width: 300px;
}

.gallery h4 {
    font-family: 'Fredoka One', cursive;
    color: #9CAF56;
    margin-bottom: 15px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.gallery-thumbnail {
    width: 60px;
    height: 60px;
    border: 2px solid #9CAF56;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
    border-color: #FFB347;
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        flex: none;
    }
    
    .title {
        font-size: 2em;
    }
    
    .canvas-container {
        min-width: auto;
    }
    
    .info-panel {
        flex-direction: column;
        margin: 20px;
    }
    
    #canvas {
        max-width: 100%;
        height: auto;
    }
}

.tabby-options {
    background: rgba(156, 175, 86, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

/* Pixel art specific styles */
#canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Active state for select dropdowns */
.select-dropdown:focus {
    background: rgba(255, 179, 71, 0.1);
}

/* Smooth transitions */
* {
    transition: all 0.2s ease;
}

.color-btn, .control-btn, .action-btn, .save-btn, .gallery-thumbnail {
    transition: all 0.2s ease;
}