/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 900px;
    width: 100%;
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

/* Setup Screen Styles */
.setup-screen {
    text-align: center;
    animation: fadeIn 0.6s ease;
}

.subtitle {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 30px;
}

.setup-content {
    max-width: 700px;
    margin: 0 auto;
}

.setup-section {
    margin-bottom: 40px;
}

.setup-section h3 {
    color: #4A90E2;
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: 700;
}

/* Operation Buttons */
.operation-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.operation-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    border: none;
    padding: 20px 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.operation-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.operation-btn.active {
    background: linear-gradient(135deg, #FFE066, #FF6B6B);
    transform: scale(1.05);
}

.op-symbol {
    font-size: 2em;
    font-weight: 700;
}

/* Count Buttons */
.count-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.count-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    font-size: 1.1em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.count-btn.active {
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    transform: scale(1.1);
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.difficulty-btn {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    color: white;
    border: none;
    padding: 20px 15px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Neue', cursive;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #ff416c, #ff4757);
    transform: scale(1.05);
}

.diff-title {
    font-size: 1.3em;
    font-weight: 700;
}

.diff-desc {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Start Button */
.start-btn {
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    color: white;
    border: none;
    padding: 20px 40px;
    font-size: 1.5em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    font-family: 'Comic Neue', cursive;
    animation: pulse 2s infinite;
}

.start-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3);
    animation: none;
}

/* Game Screen */
.game-screen {
    animation: slideInRight 0.6s ease;
}

/* Header Styles */
.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h1 {
    color: #4A90E2;
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 40px;
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    padding: 15px 30px;
    border-radius: 50px;
    color: white;
    font-weight: 700;
    font-size: 1.2em;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.score-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Question Display */
.question-container {
    text-align: center;
    margin-bottom: 40px;
}

.question-display {
    background: linear-gradient(135deg, #FFE066, #FF6B6B);
    padding: 30px;
    border-radius: 20px;
    font-size: 3em;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    display: inline-block;
    min-width: 300px;
}

.number, .operator, .equals, .question-mark {
    margin: 0 10px;
    display: inline-block;
}

.question-mark {
    background: white;
    color: #FF6B6B;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Answer Buttons */
.answers-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.answer-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
    border: none;
    padding: 25px;
    font-size: 2em;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    font-family: 'Comic Neue', cursive;
}

.answer-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #45B7AA, #3A8B7A);
}

.answer-btn:active {
    transform: translateY(-2px);
}

.answer-btn.correct {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    animation: correctAnswer 0.6s ease;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #ff416c, #ff4757);
    animation: wrongAnswer 0.6s ease;
}

.answer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Feedback Message */
.feedback-container {
    text-align: center;
    margin-bottom: 30px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-message {
    font-size: 1.5em;
    font-weight: 700;
    padding: 15px 30px;
    border-radius: 50px;
    opacity: 0;
    transition: all 0.5s ease;
}

.feedback-message.show {
    opacity: 1;
    transform: scale(1.1);
}

.feedback-message.correct {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    color: white;
    animation: bounceIn 0.6s ease;
}

.feedback-message.wrong {
    background: linear-gradient(135deg, #ff416c, #ff4757);
    color: white;
    animation: shakeX 0.6s ease;
}

/* Control Buttons */
.controls-container {
    text-align: center;
    margin-bottom: 20px;
}

.control-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    font-family: 'Comic Neue', cursive;
    margin: 0 10px;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.next-btn {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
}

.back-btn {
    background: linear-gradient(135deg, #FFE066, #FF6B6B);
}

/* Timer Styles */
.score-item:last-child {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
    0% { background: rgba(255, 255, 255, 0.2); }
    100% { background: rgba(255, 255, 255, 0.4); }
}

.timer-warning {
    color: #ff4757 !important;
    animation: timerWarning 0.5s infinite alternate !important;
}

@keyframes timerWarning {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

/* Score Breakdown Styles */
.score-breakdown {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
}

.score-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.score-detail-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-weight: 600;
    color: #666;
}

.end-game-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Game Over Screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.game-over-content h2 {
    color: #4A90E2;
    font-size: 2.5em;
    margin-bottom: 20px;
}

.game-over-content p {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 20px;
}

.final-score {
    font-size: 2em;
    font-weight: 700;
    color: #FF6B6B;
    margin-bottom: 20px;
}

.performance-message {
    font-size: 1.2em;
    margin-bottom: 30px;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 700;
}

.performance-message.excellent {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    color: white;
}

.performance-message.good {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
}

.performance-message.needs-practice {
    background: linear-gradient(135deg, #FFE066, #FF6B6B);
    color: white;
}

/* Animations */
@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: linear-gradient(135deg, #56ab2f, #a8e6cf); }
    100% { transform: scale(1); }
}

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

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 0.8; }
    70% { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

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

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .score-board {
        flex-direction: column;
        gap: 10px;
        font-size: 1em;
    }
    
    .question-display {
        font-size: 2.5em;
        padding: 20px;
        min-width: 250px;
    }
    
    .answers-container {
        grid-template-columns: 1fr;
        max-width: 300px;
    }
    
    .answer-btn {
        font-size: 1.8em;
        padding: 20px;
    }
    
    .control-btn {
        font-size: 1em;
        padding: 12px 25px;
        margin: 5px;
    }
}

@media (max-width: 480px) {
    .question-display {
        font-size: 2em;
        padding: 15px;
        min-width: 200px;
    }
    
    .answer-btn {
        font-size: 1.5em;
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 1.8em;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .answer-btn:hover {
        transform: none;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    }
    
    .control-btn:hover {
        transform: none;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    }
}
