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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #faf7f0 0%, #f0ede6 100%);
    min-height: 100vh;
    color: #4a4a4a;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.title {
    font-size: 2.5rem;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    font-weight: bold;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    font-style: italic;
}

.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.crayon-box {
    width: 280px;
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    border: 3px solid #ff6b6b;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.crayon-box-header {
    text-align: center;
    margin-bottom: 20px;
}

.crayon-box-header h3 {
    color: #ff6b6b;
    font-size: 1.4rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.crayon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.crayon {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 5px;
}

.crayon:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.crayon.selected {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.3);
}

.crayon-body {
    height: 80px;
    width: 20px;
    margin: 0 auto;
    border-radius: 10px 10px 2px 2px;
    position: relative;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.crayon-tip {
    width: 8px;
    height: 20px;
    margin: 0 auto;
    border-radius: 0 0 4px 4px;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.crayon-wrapper {
    position: absolute;
    top: 15px;
    left: -5px;
    right: -5px;
    height: 30px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crayon-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.crayon-peel {
    position: absolute;
    top: 0;
    right: -2px;
    width: 4px;
    height: 15px;
    background: #fff;
    border-radius: 2px;
    transform: rotate(15deg);
}

.controls {
    margin-bottom: 20px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #ff6b6b;
    border-radius: 50%;
    cursor: pointer;
}

.control-group span {
    font-weight: bold;
    color: #666;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-clear {
    background: linear-gradient(145deg, #ff6b6b, #ff5252);
    color: white;
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

.btn-save {
    background: linear-gradient(145deg, #4ecdc4, #26a69a);
    color: white;
    box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
}

.btn-sound {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 4px 8px rgba(149, 165, 166, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

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

.canvas-area {
    flex: 1;
}

.canvas-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
}

#drawingCanvas {
    width: 100%;
    height: 600px;
    border: 3px solid #ddd;
    border-radius: 10px;
    cursor: crosshair;
    background: #faf7f0;
}

.selected-crayon-info {
    position: absolute;
    top: 10px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery {
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 15px;
    margin-top: 30px;
}

.gallery h3 {
    text-align: center;
    color: #ff6b6b;
    margin-bottom: 20px;
}

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

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

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

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

/* Mobile responsiveness */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .crayon-box {
        width: 100%;
        position: static;
    }
    
    .crayon-grid {
        grid-template-columns: repeat(4, 1fr);
        max-height: 200px;
    }
    
    #drawingCanvas {
        height: 400px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .crayon-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

/* Custom scrollbar for crayon grid */
.crayon-grid::-webkit-scrollbar {
    width: 6px;
}

.crayon-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.crayon-grid::-webkit-scrollbar-thumb {
    background: #ff6b6b;
    border-radius: 3px;
}

.crayon-grid::-webkit-scrollbar-thumb:hover {
    background: #ff5252;
}