/**
 * Factor Factory - Factory/Machine Theme
 *
 * Industrial-themed math game for GCF and LCM practice
 * Target: Grade 5 students
 *
 * Color Palette:
 * - Steel Gray: #4A5568 (background, card base)
 * - Dark Slate: #2D3748 (darker accents, text)
 * - Gear Gold: #D4AF37 (highlights, correct answers)
 * - Blueprint Blue: #3B82F6 (primary buttons, progress)
 * - Oil Black: #1A202C (deep backgrounds)
 * - Warning Orange: #F97316 (incorrect answers, alerts)
 * - Light Gray: #E2E8F0 (text on dark backgrounds)
 */

/* Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    background: linear-gradient(135deg, #2D3748 0%, #1A202C 100%);
    color: #E2E8F0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.game-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Card Styling */
.game-card {
    background: linear-gradient(135deg, #4A5568 0%, #2D3748 100%);
    border: 3px solid #D4AF37;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(212, 175, 55, 0.3);
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mascot */
.mascot {
    font-size: 80px;
    text-align: center;
    margin-bottom: 20px;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.mascot.excited {
    animation: pulse 1s ease-in-out infinite;
}

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

/* Typography */
.game-title {
    font-size: 48px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 15px 0;
    color: #D4AF37;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.game-subtitle {
    font-size: 20px;
    text-align: center;
    margin: 0 0 30px 0;
    color: #E2E8F0;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin: 30px 0 20px 0;
    color: #3B82F6;
}

/* Difficulty Selection */
.difficulty-selection {
    margin: 30px 0;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.difficulty-card {
    background: linear-gradient(135deg, #2D3748 0%, #1A202C 100%);
    border: 2px solid #4A5568;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.difficulty-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.2), transparent);
    transition: left 0.5s ease;
}

.difficulty-card:hover::before {
    left: 100%;
}

.difficulty-card:hover {
    transform: translateY(-5px);
    border-color: #3B82F6;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.4);
}

.difficulty-card.easy:hover {
    border-color: #10B981;
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

.difficulty-card.hard:hover {
    border-color: #F97316;
    box-shadow: 0 5px 20px rgba(249, 115, 22, 0.4);
}

.difficulty-label {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #D4AF37;
}

.difficulty-card p {
    margin: 5px 0;
    color: #E2E8F0;
    font-size: 16px;
}

/* Practice Mode */
.practice-mode-option {
    text-align: center;
    margin: 30px 0;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4B5563 0%, #374151 100%);
}

.btn-accent {
    background: linear-gradient(135deg, #D4AF37 0%, #B8860B 100%);
    color: #1A202C;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #B8860B 0%, #9A7209 100%);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-hint {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    margin: 10px 0;
}

.btn-hint:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
}

.btn-solution {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    margin: 10px 0;
}

.btn-solution:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
}

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

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.question-counter,
.score-display {
    font-size: 18px;
    font-weight: 600;
    color: #D4AF37;
    background: rgba(212, 175, 55, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #D4AF37;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
    border: 2px solid #4A5568;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6 0%, #10B981 100%);
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

/* Problem Display */
.problem-display {
    text-align: center;
    margin: 30px 0;
    padding: 30px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 2px solid #4A5568;
}

.problem-type {
    font-size: 18px;
    font-weight: 600;
    color: #3B82F6;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.problem-numbers {
    font-size: 48px;
    font-weight: 800;
    color: #D4AF37;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.problem-question {
    font-size: 24px;
    color: #E2E8F0;
    margin-top: 15px;
}

/* Hint Section */
.hint-section {
    text-align: center;
    margin: 20px 0;
}

.hint-display {
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid #8B5CF6;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

.hint-content p {
    margin: 10px 0;
    font-size: 16px;
    color: #E2E8F0;
}

.hint-content strong {
    color: #D4AF37;
}

/* Solution Section */
.solution-section {
    text-align: center;
    margin: 20px 0;
}

.solution-display {
    background: rgba(245, 158, 11, 0.1);
    border: 2px solid #F59E0B;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    text-align: left;
}

.solution-content h4 {
    color: #F59E0B;
    margin-top: 0;
    text-align: center;
}

.solution-content ol {
    color: #E2E8F0;
    font-size: 16px;
    line-height: 1.8;
}

.solution-content strong {
    color: #D4AF37;
    font-size: 18px;
}

/* Answer Choices */
.answer-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 30px 0;
}

.answer-btn {
    padding: 20px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #4A5568 0%, #2D3748 100%);
    color: #E2E8F0;
    border: 3px solid #6B7280;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.answer-btn:hover:not(:disabled) {
    transform: scale(1.05);
    border-color: #3B82F6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.answer-btn.correct {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-color: #10B981;
    animation: correctPulse 0.5s ease;
}

.answer-btn.incorrect {
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    border-color: #F97316;
    animation: shake 0.5s ease;
}

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

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

/* Feedback */
.feedback-area {
    margin: 20px 0;
    text-align: center;
}

.feedback {
    padding: 20px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 600;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback.correct {
    background: rgba(16, 185, 129, 0.2);
    border: 2px solid #10B981;
    color: #10B981;
}

.feedback.incorrect {
    background: rgba(249, 115, 22, 0.2);
    border: 2px solid #F97316;
    color: #F97316;
}

/* Results Screen */
.stars {
    text-align: center;
    font-size: 60px;
    margin: 20px 0;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.result-stat {
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 2px solid #4A5568;
}

.stat-value {
    font-size: 48px;
    font-weight: 800;
    color: #D4AF37;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 16px;
    color: #E2E8F0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Missed Problems */
.missed-problems {
    margin: 30px 0;
    padding: 25px;
    background: rgba(249, 115, 22, 0.1);
    border: 2px solid #F97316;
    border-radius: 12px;
}

.missed-problems .section-title {
    color: #F97316;
    margin-top: 0;
}

.missed-list {
    display: grid;
    gap: 10px;
}

.missed-item {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 18px;
    color: #E2E8F0;
    border-left: 4px solid #F97316;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-card {
        padding: 25px;
    }

    .game-title {
        font-size: 36px;
    }

    .mascot {
        font-size: 60px;
    }

    .problem-numbers {
        font-size: 36px;
    }

    .problem-question {
        font-size: 20px;
    }

    .answer-btn {
        font-size: 20px;
        padding: 15px;
    }

    .difficulty-options {
        grid-template-columns: 1fr;
    }

    .game-header {
        flex-direction: column;
        align-items: stretch;
    }

    .question-counter,
    .score-display {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 28px;
    }

    .game-subtitle {
        font-size: 16px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 16px;
    }

    .answer-choices {
        grid-template-columns: 1fr;
    }

    .results-summary {
        grid-template-columns: 1fr;
    }
}
