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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFE4E1 0%, #E0F2F1 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 600px;
    width: 100%;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#level-info {
    display: flex;
    gap: 15px;
    font-size: 18px;
    font-weight: bold;
}

#restart-btn {
    background: #FFD93D;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    min-width: 44px;
    min-height: 44px;
}

#restart-btn:hover {
    transform: scale(1.05);
}

#restart-btn:active {
    transform: scale(0.95);
}

#canvas-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#game-canvas {
    border: 3px solid #D4A574;
    border-radius: 10px;
    background: #F8F8F8;
    cursor: pointer;
    touch-action: none;
}

#piece-tray {
    background: #FFF9E6;
    border-radius: 10px;
    padding: 15px;
    min-height: 150px;
}

#tray-title {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

#tray-pieces {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    min-height: 100px;
}

.tray-piece {
    cursor: grab;
    touch-action: none;
    user-select: none;
    transition: transform 0.1s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tray-piece:hover {
    transform: scale(1.05);
}

.tray-piece:active {
    cursor: grabbing;
}

.tray-piece.used {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

#win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#win-screen.hidden {
    display: none;
}

#win-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    animation: bounceIn 0.5s;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#win-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #FF6B9D;
}

#stars {
    font-size: 48px;
    margin-bottom: 20px;
}

#win-message {
    font-size: 24px;
    color: #666;
    margin-bottom: 30px;
}

#win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

#retry-btn, #next-btn {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

#retry-btn {
    background: #FFD93D;
}

#next-btn {
    background: #6BCB77;
    color: white;
}

#retry-btn:hover, #next-btn:hover {
    transform: scale(1.05);
}

#retry-btn:active, #next-btn:active {
    transform: scale(0.95);
}

/* Mobile responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    #game-container {
        padding: 10px;
        max-width: 100%;
    }

    #header {
        font-size: 14px;
    }

    #level-info {
        font-size: 16px;
        gap: 10px;
    }

    #restart-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    #piece-tray {
        padding: 10px;
        min-height: 120px;
    }

    #tray-title {
        font-size: 12px;
    }

    #tray-pieces {
        gap: 15px;
    }

    #win-content {
        padding: 20px;
        margin: 10px;
        max-width: 90vw;
    }

    #win-content h1 {
        font-size: 36px;
    }

    #stars {
        font-size: 36px;
    }

    #win-message {
        font-size: 18px;
    }

    #retry-btn, #next-btn {
        padding: 12px 24px;
        font-size: 16px;
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 400px) {
    #win-buttons {
        flex-direction: column;
        width: 100%;
    }

    #retry-btn, #next-btn {
        width: 100%;
    }
}
