Spaces:
Running
Running
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Quiz: ¿Cuál es la capital de España?</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| :root { | |
| --primary-color: #2563eb; | |
| --secondary-color: #1e40af; | |
| --correct-color: #10b981; | |
| --incorrect-color: #ef4444; | |
| --background-color: #f8fafc; | |
| --card-background: #ffffff; | |
| --text-color: #1e293b; | |
| --text-secondary: #64748b; | |
| --border-color: #e2e8f0; | |
| --shadow: 0 10px 25px rgba(0, 0, 0, 0.05); | |
| --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08); | |
| } | |
| body { | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| padding: 20px; | |
| color: var(--text-color); | |
| } | |
| .header { | |
| width: 100%; | |
| max-width: 800px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| margin-bottom: 30px; | |
| padding: 15px 20px; | |
| background: rgba(255, 255, 255, 0.1); | |
| backdrop-filter: blur(10px); | |
| border-radius: 15px; | |
| border: 1px solid rgba(255, 255, 255, 0.2); | |
| } | |
| .logo { | |
| font-size: 1.2rem; | |
| font-weight: bold; | |
| color: white; | |
| text-decoration: none; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .logo i { | |
| font-size: 1.4rem; | |
| } | |
| .quiz-container { | |
| width: 100%; | |
| max-width: 600px; | |
| background: var(--card-background); | |
| border-radius: 20px; | |
| box-shadow: var(--shadow-lg); | |
| overflow: hidden; | |
| animation: slideIn 0.5s ease-out; | |
| } | |
| @keyframes slideIn { | |
| from { | |
| opacity: 0; | |
| transform: translateY(30px); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0); | |
| } | |
| } | |
| .quiz-header { | |
| background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); | |
| color: white; | |
| padding: 25px; | |
| text-align: center; | |
| } | |
| .quiz-title { | |
| font-size: 1.8rem; | |
| margin-bottom: 10px; | |
| font-weight: 600; | |
| } | |
| .quiz-subtitle { | |
| font-size: 1rem; | |
| opacity: 0.9; | |
| } | |
| .quiz-body { | |
| padding: 30px; | |
| } | |
| .question { | |
| font-size: 1.4rem; | |
| margin-bottom: 30px; | |
| line-height: 1.5; | |
| color: var(--text-color); | |
| text-align: center; | |
| font-weight: 500; | |
| } | |
| .question-icon { | |
| font-size: 3rem; | |
| margin-bottom: 20px; | |
| color: var(--primary-color); | |
| opacity: 0.8; | |
| } | |
| .answers { | |
| display: grid; | |
| gap: 15px; | |
| } | |
| .answer-option { | |
| padding: 18px 25px; | |
| background: var(--background-color); | |
| border: 2px solid var(--border-color); | |
| border-radius: 12px; | |
| cursor: pointer; | |
| transition: all 0.3s ease; | |
| font-size: 1.1rem; | |
| font-weight: 500; | |
| display: flex; | |
| align-items: center; | |
| gap: 15px; | |
| } | |
| .answer-option:hover { | |
| background: #f1f5f9; | |
| border-color: var(--primary-color); | |
| transform: translateY(-2px); | |
| box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); | |
| } | |
| .answer-option.correct { | |
| background: var(--correct-color); | |
| color: white; | |
| border-color: var(--correct-color); | |
| animation: correctPulse 0.5s ease; | |
| } | |
| .answer-option.incorrect { | |
| background: var(--incorrect-color); | |
| color: white; | |
| border-color: var(--incorrect-color); | |
| animation: shake 0.5s ease; | |
| } | |
| @keyframes correctPulse { | |
| 0%, 100% { transform: scale(1); } | |
| 50% { transform: scale(1.05); } | |
| } | |
| @keyframes shake { | |
| 0%, 100% { transform: translateX(0); } | |
| 25% { transform: translateX(-10px); } | |
| 75% { transform: translateX(10px); } | |
| } | |
| .answer-letter { | |
| width: 36px; | |
| height: 36px; | |
| background: var(--primary-color); | |
| color: white; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-weight: bold; | |
| font-size: 1.1rem; | |
| } | |
| .answer-option.correct .answer-letter { | |
| background: var(--correct-color); | |
| } | |
| .answer-option.incorrect .answer-letter { | |
| background: var(--incorrect-color); | |
| } | |
| .feedback { | |
| margin-top: 30px; | |
| padding: 20px; | |
| border-radius: 12px; | |
| text-align: center; | |
| font-size: 1.1rem; | |
| font-weight: 500; | |
| display: none; | |
| } | |
| .feedback.show { | |
| display: block; | |
| animation: fadeIn 0.5s ease; | |
| } | |
| .feedback.correct { | |
| background: rgba(16, 185, 129, 0.1); | |
| color: var(--correct-color); | |
| border: 1px solid var(--correct-color); | |
| } | |
| .feedback.incorrect { | |
| background: rgba(239, 68, 68, 0.1); | |
| color: var(--incorrect-color); | |
| border: 1px solid var(--incorrect-color); | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; } | |
| to { opacity: 1; } | |
| } | |
| .score { | |
| margin-top: 25px; | |
| text-align: center; | |
| font-size: 1.1rem; | |
| color: var(--text-secondary); | |
| } | |
| .score-value { | |
| font-size: 1.5rem; | |
| font-weight: bold; | |
| color: var(--primary-color); | |
| } | |
| .restart-btn { | |
| margin-top: 25px; | |
| padding: 12px 30px; | |
| background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); | |
| color: white; | |
| border: none; | |
| border-radius: 10px; | |
| font-size: 1.1rem; | |
| font-weight: 500; | |
| cursor: pointer; | |
| transition: all 0.3s ease; | |
| display: none; | |
| } | |
| .restart-btn.show { | |
| display: inline-block; | |
| } | |
| .restart-btn:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3); | |
| } | |
| .progress-container { | |
| width: 100%; | |
| height: 6px; | |
| background: var(--border-color); | |
| border-radius: 3px; | |
| margin: 20px 0; | |
| overflow: hidden; | |
| } | |
| .progress-bar { | |
| height: 100%; | |
| background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); | |
| border-radius: 3px; | |
| width: 0%; | |
| transition: width 0.5s ease; | |
| } | |
| @media (max-width: 600px) { | |
| .quiz-container { | |
| margin: 0 auto; | |
| } | |
| .question { | |
| font-size: 1.2rem; | |
| } | |
| .answer-option { | |
| padding: 15px 20px; | |
| font-size: 1rem; | |
| } | |
| .quiz-header { | |
| padding: 20px; | |
| } | |
| .quiz-title { | |
| font-size: 1.4rem; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="header"> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="logo" target="_blank"> | |
| <i class="fas fa-code"></i> | |
| Built with anycoder | |
| </a> | |
| </div> | |
| <div class="quiz-container"> | |
| <div class="quiz-header"> | |
| <div class="quiz-title">Quiz de Geografía</div> | |
| <div class="quiz-subtitle">Prueba tus conocimientos</div> | |
| </div> | |
| <div class="quiz-body"> | |
| <div class="progress-container"> | |
| <div class="progress-bar" id="progressBar"></div> | |
| </div> | |
| <div class="question"> | |
| <i class="fas fa-globe question-icon"></i> | |
| <div>¿Cuál es la capital de España?</div> | |
| </div> | |
| <div class="answers" id="answers"> | |
| <div class="answer-option" data-answer="incorrect"> | |
| <div class="answer-letter">A</div> | |
| <div>Barcelona</div> | |
| </div> | |
| <div class="answer-option" data-answer="correct"> | |
| <div class="answer-letter">B</div> | |
| <div>Madrid</div> | |
| </div> | |
| <div class="answer-option" data-answer="incorrect"> | |
| <div class="answer-letter">C</div> | |
| <div>Sevilla</div> | |
| </div> | |
| <div class="answer-option" data-answer="incorrect"> | |
| <div class="answer-letter">D</div> | |
| <div>Valencia</div> | |
| </div> | |
| </div> | |
| <div class="feedback" id="feedback"></div> | |
| <div class="score"> | |
| Puntuación: <span class="score-value" id="scoreValue">0</span> | |
| </div> | |
| <button class="restart-btn" id="restartBtn">Reiniciar Quiz</button> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const answers = document.querySelectorAll('.answer-option'); | |
| const feedback = document.getElementById('feedback'); | |
| const scoreValue = document.getElementById('scoreValue'); | |
| const restartBtn = document.getElementById('restartBtn'); | |
| const progressBar = document.getElementById('progressBar'); | |
| let score = 0; | |
| let answered = false; | |
| let currentProgress = 0; | |
| answers.forEach(answer => { | |
| answer.addEventListener('click', function() { | |
| if (answered) return; | |
| answered = true; | |
| const isCorrect = this.dataset.answer === 'correct'; | |
| // Add visual feedback | |
| answers.forEach(a => { | |
| if (a.dataset.answer === 'correct') { | |
| a.classList.add('correct'); | |
| } else if (a.dataset.answer === 'incorrect' && !isCorrect) { | |
| a.classList.add('incorrect'); | |
| } | |
| }); | |
| // Show feedback | |
| feedback.classList.add('show'); | |
| if (isCorrect) { | |
| feedback.classList.add('correct'); | |
| feedback.classList.remove('incorrect'); | |
| feedback.innerHTML = '<i class="fas fa-check-circle"></i> ¡Correcto! Madrid es la capital de España.'; | |
| score++; | |
| scoreValue.textContent = score; | |
| currentProgress = 100; | |
| progressBar.style.width = '100%'; | |
| } else { | |
| feedback.classList.add('incorrect'); | |
| feedback.classList.remove('correct'); | |
| feedback.innerHTML = '<i class="fas fa-times-circle"></i> Incorrecto. La capital de España es Madrid.'; | |
| } | |
| // Show restart button | |
| restartBtn.classList.add('show'); | |
| }); | |
| }); | |
| restartBtn.addEventListener('click', function() { | |
| // Reset everything | |
| answered = false; | |
| feedback.classList.remove('show', 'correct', 'incorrect'); | |
| answers.forEach(a => { | |
| a.classList.remove('correct', 'incorrect'); | |
| }); | |
| score = 0; | |
| scoreValue.textContent = score; | |
| currentProgress = 0; | |
| progressBar.style.width = '0%'; | |
| restartBtn.classList.remove('show'); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |