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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #FFF8E7 0%, #FFE8D6 100%);
    color: #4A3728;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, #FFE135 0%, #FFC300 100%);
    padding: 2rem;
    text-align: center;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 8px 24px rgba(255, 193, 0, 0.3);
    position: relative;
}

h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    margin: 0;
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

.sound-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.container {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

aside {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #FF9800;
}

.style-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.style-btn, .expr-btn {
    background: #F5F5F5;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.style-btn:hover, .expr-btn:hover {
    background: #FFE135;
    transform: translateY(-2px);
}

.style-btn.active, .expr-btn.active {
    background: #FFE135;
    border-color: #FFC300;
    transform: scale(1.05);
}

label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #FFE135;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    margin-top: 0.5rem;
}

#size-value {
    display: inline-block;
    margin-left: 0.5rem;
    color: #FF9800;
    font-weight: bold;
}

.expression-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.expr-btn {
    font-size: 1.5rem;
    padding: 0.5rem;
}

.accessory-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.toggle:hover {
    background: #FFF8E7;
}

.toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.generation-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-primary, .btn-secondary, .btn-export, .btn-share {
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Poppins', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #FFE135 0%, #FFC300 100%);
    color: #4A3728;
    box-shadow: 0 4px 12px rgba(255, 193, 0, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 193, 0, 0.6);
}

.btn-secondary {
    background: #98FF98;
    color: #2D5016;
}

.btn-secondary:hover {
    background: #7FE67F;
    transform: translateY(-2px);
}

.counter {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #FFF8E7 0%, #FFE8D6 100%);
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.1rem;
}

.canvas-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#canvas {
    border: 4px solid #FFE135;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    max-width: 100%;
    height: auto;
}

.achievement-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #FF6EC7 0%, #7FDBFF 100%);
    color: white;
    padding: 2rem 3rem;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s;
    z-index: 1000;
    text-align: center;
}

.achievement-popup.show {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.gallery-thumb {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid #FFE135;
}

.gallery-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.export-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-export {
    background: white;
    border: 2px solid #FFE135;
    color: #4A3728;
    padding: 0.75rem;
    font-size: 0.95rem;
}

.btn-export:hover:not(:disabled) {
    background: #FFE135;
    transform: translateY(-2px);
}

.btn-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fun-facts {
    background: linear-gradient(135deg, #FFF8E7 0%, #FFE8D6 100%);
    border-radius: 12px;
    padding: 1rem;
}

.fun-facts p {
    font-style: italic;
    line-height: 1.6;
}

.btn-share {
    background: linear-gradient(135deg, #FF6EC7 0%, #B10DC9 100%);
    color: white;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(177, 13, 201, 0.4);
}

footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    color: #4A3728;
}

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

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

.easter-egg-hint {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 0.5rem;
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall 1s linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

#cursor-sparkles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.cursor-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #FFE135;
    border-radius: 50%;
    animation: sparkle-fade 0.6s ease-out forwards;
    box-shadow: 0 0 8px #FFE135;
}

@keyframes sparkle-fade {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0) translateY(-20px);
        opacity: 0;
    }
}

body.disco-mode {
    animation: disco-bg 0.5s infinite;
}

@keyframes disco-bg {
    0% { background: #FF6EC7; }
    25% { background: #7FDBFF; }
    50% { background: #FFE135; }
    75% { background: #98FF98; }
    100% { background: #FF6EC7; }
}

@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .style-selector {
        grid-template-columns: 1fr;
    }
    
    .expression-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    #canvas {
        max-width: 100%;
    }
}