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

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

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 900px;
    width: 100%;
}

h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.piece-palette {
    flex: 1;
    min-width: 250px;
}

.piece-palette h3 {
    color: #333;
    margin-bottom: 10px;
}

.piece-btn {
    background: #f0f0f0;
    border: 2px solid #ddd;
    padding: 12px 20px;
    margin: 5px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.piece-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.piece-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.icon {
    font-size: 20px;
}

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

.piece-counter {
    background: #f0f0f0;
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    color: #333;
    border: 2px solid #ddd;
}

#pieceCount {
    color: #667eea;
    font-size: 20px;
}

.play-btn, .reset-btn, .clear-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.play-btn {
    background: #4CAF50;
    color: white;
}

.play-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.play-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.reset-btn {
    background: #ff9800;
    color: white;
}

.reset-btn:hover {
    background: #e68900;
}

.clear-btn {
    background: #f44336;
    color: white;
}

.clear-btn:hover {
    background: #da190b;
}

.game-area {
    position: relative;
    border: 3px solid #667eea;
    border-radius: 10px;
    overflow: hidden;
    background: #f9f9f9;
    width: 100%;
    max-width: 100%;
}

#gameCanvas {
    display: block;
    cursor: crosshair;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.goal-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 30px 50px;
    border-radius: 15px;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: popIn 0.5s ease-out;
}

.goal-message.hidden {
    display: none;
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.info {
    margin-top: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 10px;
    text-align: center;
    color: #666;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    
    h1 {
        font-size: 2em;
    }
}
