/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Mini-game container styles */
.mini-game-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.game-header h2 {
    margin: 0;
    color: #333;
}

#close-game, #close-puzzle-game, #close-speed-game {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #777;
}

#close-game:hover, #close-puzzle-game:hover, #close-speed-game:hover {
    color: #333;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#game-status, #puzzle-status, #speed-status {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
}

#number-display, #puzzle-display, #speed-problem {
    font-size: 32px;
    font-weight: bold;
    letter-spacing: 3px;
    min-height: 40px;
    color: #2c3e50;
    background-color: #f8f9fa;
    padding: 15px 30px;
    border-radius: 8px;
    width: 80%;
    text-align: center;
}

#input-container, #puzzle-input-container, #speed-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80%;
}

#number-input, #puzzle-input, #speed-input {
    padding: 12px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    letter-spacing: 2px;
}

#submit-answer, #submit-puzzle, #submit-speed, #start-speed-game {
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

#submit-answer:hover {
    background-color: #2980b9;
}

#game-message, #puzzle-message, #speed-message {
    font-size: 16px;
    text-align: center;
    min-height: 50px;
    padding: 10px;
    width: 80%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #3498db;
    margin-bottom: 30px;
}

header h1 {
    color: #3498db;
    font-size: 2.5rem;
}

#user-info {
    background-color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#user-info p {
    margin: 5px 0;
    font-weight: 500;
}

#user-level, #user-points {
    font-weight: 700;
    color: #3498db;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

/* Authentication Section */
#auth-section {
    max-width: 500px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#auth-section h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #3498db;
}

#auth-section p {
    text-align: center;
    margin-top: 20px;
}

#auth-section a {
    color: #3498db;
    text-decoration: none;
}

#auth-section a:hover {
    text-decoration: underline;
}

/* Game Section */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    padding: 10px 20px;
    background-color: transparent;
    color: #333;
    border: none;
    border-bottom: 3px solid transparent;
    margin-right: 10px;
}

.tab-btn.active {
    border-bottom: 3px solid #3498db;
    color: #3498db;
}

.tab-content {
    display: none;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.tab-content.active {
    display: block;
}

/* Question Container */
.question-container {
    margin-bottom: 30px;
}

#question-text {
    font-size: 1.2rem;
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.actions {
    margin-top: 20px;
}

.action-btn {
    background-color: #2ecc71;
    margin-right: 10px;
}

.action-btn:hover {
    background-color: #27ae60;
}

#hint-container {
    margin-top: 15px;
    padding: 10px;
    background-color: #fffde7;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
}

/* Progression */
.progression {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Mini Games */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.game-card {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-card h3 {
    color: #3498db;
    margin-bottom: 10px;
}

.game-card p {
    margin-bottom: 15px;
    color: #666;
}

.game-card.locked {
    position: relative;
}

.game-card.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    z-index: 1;
    pointer-events: none; /* Ensure overlay doesn't capture clicks */
}

.play-btn {
    position: relative;
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
}

.unlock-btn {
    background-color: #e74c3c;
    position: relative;
    z-index: 5;
}

.unlock-btn:hover {
    background-color: #c0392b;
}

.play-btn {
    background-color: #3498db;
    display: inline-block !important;
    position: relative !important;
    z-index: 100 !important; /* Extremely high z-index */
    pointer-events: auto !important; /* Force pointer events */
}

.play-btn:hover {
    background-color: #2980b9;
}

/* Ensure game card doesn't block play button */
.game-card {
    position: relative;
    overflow: visible !important;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    color: #777;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
    }
    
    #user-info {
        margin-top: 15px;
        width: 100%;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fadeIn {
    animation: fadeIn 0.5s ease-in;
}

/* Feedback Messages */
.feedback {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}