/* General Styling (consistent with main site) */
body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.game-container {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
    width: 100%;
    position: relative;
}

.game-title {
    font-family: 'Nunito', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: #4c51bf;
    margin-bottom: 1rem;
}

.game-description {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

/* Game Screens */
.game-screen {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.game-screen.active {
    display: block;
}

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

.screen-title {
    font-family: 'Nunito', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

/* Difficulty Selection */
.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.difficulty-button, .game-button {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.difficulty-button:hover, .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.high-score {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.back-to-hub {
    display: inline-block;
    margin-top: 1.5rem;
    color: #4c51bf;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.back-to-hub:hover {
    color: #7c3aed;
}

/* Game Play Screen */
.game-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 2rem;
    background: #eef2ff;
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid #c7d2fe;
}

.game-stat {
    font-family: 'Nunito', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #374151;
}

.game-stat span:first-child {
    font-weight: 500;
    color: #6b7280;
    margin-right: 0.5rem;
}

.problem-area {
    margin-bottom: 2rem;
}

.problem-text {
    font-family: 'Nunito', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.answer-input {
    width: 80%;
    max-width: 250px;
    padding: 0.8rem 1.2rem;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    font-size: 1.5rem;
    text-align: center;
    -moz-appearance: textfield; /* Hide number input arrows for Firefox */
}

/* Hide number input arrows for Chrome, Safari, Edge */
.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.answer-input:focus {
    outline: none;
    border-color: #4c51bf;
    box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.2);
}

.feedback {
    min-height: 24px; /* Ensure space for feedback */
    margin-top: 1rem;
    font-weight: 600;
}

.feedback.correct {
    color: #10b981;
}

.feedback.incorrect {
    color: #ef4444;
}

.game-button.hidden {
    display: none;
}

/* End Screen */
.final-score {
    font-family: 'Nunito', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}

.new-high-score {
    font-size: 1.3rem;
    font-weight: 600;
    color: #22c55e;
    margin-bottom: 2rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .game-container {
        padding: 1.5rem;
    }
    .game-title {
        font-size: 2rem;
    }
    .game-description {
        font-size: 1rem;
    }
    .screen-title {
        font-size: 1.8rem;
    }
    .difficulty-button, .game-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    .game-header {
        flex-direction: column;
        gap: 0.8rem;
    }
    .problem-text {
        font-size: 2.5rem;
    }
    .answer-input {
        font-size: 1.2rem;
    }
}