/* Estilos específicos para o quebra-cabeça */

.game-header {
    margin-bottom: 30px;
}

.letra-objetivo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.letra-grande {
    font-size: 150px;
    font-weight: bold;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    display: inline-block;
    animation: pulse 2s infinite;
}

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

.puzzle-area {
    margin: 40px 0;
    padding: 20px;
}

.puzzle-board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 300px;
}

.puzzle-slot {
    width: 100%;
    min-height: 120px;
    border: 4px dashed #dee2e6;
    background: white;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin: 5px;
    padding: 0;
    box-sizing: border-box;
}

/* Canvas para mostrar o formato da letra no slot */
.puzzle-slot canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}

/* Remover indicador quando slot estiver preenchido */
.puzzle-slot.filled::before {
    display: none;
}

.puzzle-slot.drag-over {
    border-color: #0d6efd;
    background: #e7f1ff;
    transform: scale(1.05);
}

.puzzle-slot.filled {
    border-color: #28a745;
    background: transparent !important;
    border-style: solid;
    border-width: 4px;
    padding: 0 !important;
    overflow: hidden !important;
}

.puzzle-slot.filled::before {
    display: none;
}

.puzzle-slot.filled canvas {
    opacity: 1 !important;
    z-index: 2 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    object-fit: fill !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border: none !important;
    outline: none !important;
}

.puzzle-slot canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.piece-expanding {
    animation: expandPiece 0.4s ease-out forwards;
}

@keyframes expandPiece {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.puzzle-slot.filled {
    display: flex !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    padding: 0 !important;
}

.puzzle-slot.filled canvas {
    flex: 1 1 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.puzzle-slot.correct {
    border-color: #28a745;
    background: #d4edda;
    animation: correctPulse 0.5s ease;
}

.puzzle-slot.wrong-place {
    border-color: #dc3545;
    background: #f8d7da;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.puzzle-slot canvas {
    border-radius: 15px;
    display: block;
}

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

/* Animações de montagem */
.puzzle-board.assembling {
    animation: boardPulse 2s ease;
}

@keyframes boardPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.puzzle-slot.assembling-piece {
    animation: pieceAssemble 2s ease;
}

@keyframes pieceAssemble {
    0% { 
        transform: scale(0.9);
        opacity: 0.8;
    }
    25% {
        transform: scale(1.02);
    }
    50% {
        transform: scale(1.05);
    }
    75% {
        transform: scale(1.02);
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes letterPulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
    }
    50% { 
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.8));
    }
}

.complete-letter {
    pointer-events: none;
}

.pieces-area {
    margin: 40px 0;
    padding: 20px;
}

.pieces-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.puzzle-piece {
    width: 120px;
    height: 120px;
    border: 4px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
    background: transparent;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

.puzzle-piece.dragging {
    transition: none !important;
    z-index: 1000 !important;
    will-change: transform;
    transform: translateZ(0);
}

.puzzle-piece canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 1;
}

/* Formas geométricas nas peças */
.piece-square {
    border-radius: 0;
    clip-path: polygon(10% 10%, 90% 10%, 90% 90%, 10% 90%);
}

.piece-triangle {
    border-radius: 0;
    clip-path: polygon(50% 10%, 10% 90%, 90% 90%);
}

.piece-circle {
    border-radius: 50%;
}

.piece-diamond {
    border-radius: 0;
    clip-path: polygon(50% 10%, 90% 50%, 50% 90%, 10% 50%);
}

.puzzle-piece:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.puzzle-piece:active {
    cursor: grabbing;
    transform: scale(1.15) rotate(5deg);
    z-index: 100;
}

.puzzle-piece.dragging {
    opacity: 0.5;
    transform: scale(1.2) rotate(10deg);
    z-index: 1000;
}

.puzzle-piece.used {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(0.8);
}

.puzzle-piece.used:hover {
    transform: scale(0.8);
}

.help-section {
    margin: 30px 0;
}

.help-section .btn {
    margin: 0 10px;
}

/* Estrela animada */
.estrela-animacao {
    font-size: 100px;
    animation: estrelaPulse 1s ease infinite;
    display: inline-block;
}

@keyframes estrelaPulse {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.3) rotate(-15deg); 
    }
    50% { 
        transform: scale(1.2) rotate(15deg); 
    }
    75% { 
        transform: scale(1.3) rotate(-10deg); 
    }
}

/* Modal de parabéns */
.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
}

.modal-body h1,
.modal-body p {
    color: white !important;
}

/* Responsividade */
@media (max-width: 768px) {
    .letra-grande {
        font-size: 100px;
    }
    
    .puzzle-board {
        max-width: 100%;
        gap: 10px;
        padding: 15px;
    }
    
    .puzzle-slot {
        min-height: 100px;
    }
    
    .puzzle-piece {
        width: 80px;
        height: 80px;
        font-size: 30px;
    }
    
    .estrela-animacao {
        font-size: 70px;
    }
}

@media (min-width: 992px) {
    .puzzle-board {
        max-width: 600px;
        min-height: 350px;
    }
    
    .puzzle-slot {
        min-height: 150px;
    }
    
    .puzzle-piece {
        width: 120px;
        height: 120px;
        font-size: 50px;
    }
}

