/* ===================================
   JOGO DE COLORIR
   =================================== */

.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 0 auto 30px;
    padding: 25px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 8px 20px var(--shadow);
}

.color-btn {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px var(--shadow);
    position: relative;
}

.color-btn:hover {
    transform: scale(1.15) translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow);
}

.color-btn.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--gold),
                0 8px 20px var(--shadow);
}

.color-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-size: 30px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#coloring-canvas {
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 8px solid var(--gold);
    cursor: crosshair;
    touch-action: none;
}

.brush-size-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 6px 15px var(--shadow);
}

.brush-size-control label {
    font-weight: 700;
    color: var(--brown);
    font-size: 16px;
}

.brush-size-control input[type="range"] {
    width: 200px;
    height: 8px;
    background: linear-gradient(to right, var(--gold), var(--orange));
    border-radius: 10px;
    outline: none;
}

.brush-size-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--white);
    border: 3px solid var(--gold);
    border-radius: 50%;
    cursor: pointer;
}

/* ===================================
   QUEBRA-CABEÇA
   =================================== */

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 8px solid var(--gold);
}

.puzzle-piece {
    aspect-ratio: 1;
    background-size: 400% 300%;
    background-repeat: no-repeat;
    border-radius: 10px;
    cursor: move;
    transition: all 0.3s;
    box-shadow: 0 4px 10px var(--shadow);
    position: relative;
    overflow: hidden;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px var(--shadow);
    z-index: 10;
}

.puzzle-piece.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

.puzzle-piece.correct {
    animation: puzzle-correct 0.6s ease-out;
    cursor: default;
    border: 3px solid var(--green);
}

@keyframes puzzle-correct {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.puzzle-piece.empty {
    background: linear-gradient(135deg, var(--cream) 0%, var(--beige) 100%);
    border: 3px dashed var(--gold);
}

.puzzle-hint {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--gold);
    color: var(--white);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px var(--shadow);
}

.puzzle-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(218, 165, 32, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s;
}

.puzzle-complete-overlay.show {
    display: flex;
}

.puzzle-complete-message {
    text-align: center;
    background: var(--white);
    padding: 50px;
    border-radius: 30px;
    box-shadow: 0 20px 50px var(--shadow);
    animation: zoomIn 0.5s;
}

.puzzle-complete-message h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 48px;
    color: var(--gold);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px var(--shadow);
}

.puzzle-complete-message p {
    font-size: 24px;
    color: var(--brown);
    margin-bottom: 30px;
}

/* ===================================
   QUIZ
   =================================== */

.quiz-question {
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow);
    border: 8px solid var(--gold);
    margin-bottom: 30px;
}

.quiz-question h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    color: var(--brown);
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.4;
}

#options-container {
    display: grid;
    gap: 15px;
}

.quiz-option {
    background: linear-gradient(135deg, var(--cream) 0%, var(--beige) 100%);
    padding: 20px 30px;
    border-radius: 15px;
    border: 3px solid var(--gold);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 18px;
    font-weight: 600;
    color: var(--brown-dark);
    text-align: center;
}

.quiz-option:hover {
    transform: translateX(10px);
    box-shadow: 0 6px 15px var(--shadow);
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--yellow-bright) 100%);
    border-color: var(--orange);
}

.quiz-option.selected {
    background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
    color: var(--white);
    border-color: var(--orange-dark);
    transform: scale(1.05);
}

.quiz-option.correct {
    background: linear-gradient(135deg, var(--green-light) 0%, var(--green) 100%);
    color: var(--white);
    border-color: var(--green-dark);
    animation: correctAnswer 0.6s ease-out;
}

.quiz-option.wrong {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    color: var(--white);
    border-color: #C92A2A;
    animation: wrongAnswer 0.6s ease-out;
}

@keyframes correctAnswer {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1.05) rotate(0deg);
    }
}

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

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-score {
    background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    color: var(--white);
    box-shadow: 0 8px 20px var(--shadow);
}

.quiz-result {
    background: var(--white);
    padding: 60px 40px;
    border-radius: 25px;
    box-shadow: 0 15px 40px var(--shadow);
    border: 8px solid var(--gold);
    text-align: center;
    animation: zoomIn 0.6s ease-out;
}

.quiz-result h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 48px;
    color: var(--gold);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px var(--shadow);
}

.quiz-result p {
    font-size: 22px;
    color: var(--brown);
    margin-bottom: 15px;
}

.final-score {
    font-size: 32px !important;
    font-weight: 700;
    color: var(--orange);
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, var(--cream) 0%, var(--beige) 100%);
    border-radius: 15px;
    border: 3px solid var(--gold);
}

.quiz-certificate {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--yellow-bright) 100%);
    border-radius: 20px;
    border: 5px solid var(--gold);
    box-shadow: 0 10px 30px var(--shadow);
}

.quiz-certificate h4 {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    color: var(--brown);
    margin-bottom: 15px;
}

.quiz-certificate p {
    font-size: 18px;
    color: var(--brown-dark);
}

.certificate-star {
    font-size: 60px;
    color: var(--gold);
    margin: 20px 0;
    animation: rotate 3s linear infinite;
}

/* ===================================
   CONTADOR DE PROGRESSO
   =================================== */

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--cream);
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: inset 0 2px 5px var(--shadow);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, var(--orange) 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shine 2s infinite;
}

/* ===================================
   BOTÕES DE AÇÃO DOS JOGOS
   =================================== */

.game-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.game-actions .action-btn {
    min-width: 180px;
}

.action-btn.secondary {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
}

.action-btn.secondary:hover {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-forest) 100%);
}

.action-btn.danger {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
}

.action-btn.danger:hover {
    background: linear-gradient(135deg, #EE5A6F 0%, #C92A2A 100%);
}

/* ===================================
   FEEDBACK VISUAL
   =================================== */

.feedback-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--white);
    padding: 40px 60px;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 2000;
    animation: popUp 0.4s ease-out forwards;
}

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

.feedback-message.success {
    border: 6px solid var(--green);
}

.feedback-message.error {
    border: 6px solid #FF6B6B;
}

.feedback-message h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 36px;
    margin-bottom: 15px;
}

.feedback-message.success h3 {
    color: var(--green);
}

.feedback-message.error h3 {
    color: #FF6B6B;
}

.feedback-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

/* ===================================
   TIMER/CRONÔMETRO
   =================================== */

.game-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--orange) 100%);
    padding: 15px 30px;
    border-radius: 20px;
    box-shadow: 0 6px 15px var(--shadow);
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    color: var(--white);
    margin-bottom: 20px;
}

.game-timer i {
    font-size: 28px;
}

/* ===================================
   ESTRELAS DE PONTUAÇÃO
   =================================== */

.star-rating {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.star {
    font-size: 48px;
    color: var(--beige);
    transition: all 0.3s;
}

.star.filled {
    color: var(--gold);
    animation: starFill 0.5s ease-out;
}

@keyframes starFill {
    0% {
        transform: scale(0) rotate(-180deg);
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* ===================================
   RESPONSIVIDADE DOS JOGOS
   =================================== */

@media (max-width: 768px) {
    .color-palette {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
        padding: 15px;
    }
    
    .color-btn {
        width: 50px;
        height: 50px;
    }
    
    .puzzle-grid {
        gap: 5px;
        padding: 10px;
    }
    
    .quiz-question {
        padding: 25px;
    }
    
    .quiz-question h3 {
        font-size: 22px;
    }
    
    .quiz-option {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .game-actions .action-btn {
        min-width: 140px;
        padding: 12px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .color-palette {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .color-btn {
        width: 45px;
        height: 45px;
    }
    
    .quiz-result {
        padding: 40px 25px;
    }
    
    .quiz-result h3 {
        font-size: 36px;
    }
    
    .final-score {
        font-size: 24px !important;
    }
}
