* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Global Home Button */
.global-home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(108, 117, 125, 0.9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.global-home-btn:hover {
    background: rgba(84, 91, 98, 0.9);
    transform: scale(1.05);
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 25px;
    font-size: 2em;
}

h3 {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.menu-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 1.2em;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.section {
    animation: fadeIn 0.5s ease-in;
}

.hidden {
    display: none;
}

/* Section Header Styles */
.section-header {
    position: relative;
    margin-bottom: 20px;
}

.home-btn {
    position: absolute;
    left: 0;
    top: 0;
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
}

.home-btn:hover {
    background: #545b62;
    transform: scale(1.05);
}

/* Math Trainer Styles */
#mathQuestion {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#questionText {
    font-size: 2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    transition: color 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.input-group label {
    font-weight: bold;
    color: #555;
}

.input-group input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
    max-width: 200px;
    margin: 0 auto;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.input-group input:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.7;
}

#submitAnswer {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background 0.2s;
}

#submitAnswer:hover {
    background: #218838;
}

#submitAnswer:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

#mathProgress {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    color: #495057;
}

/* Reaction Test Styles */
#reactionArea {
    background: #f8f9fa;
    height: 300px;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    cursor: pointer;
}

#reactionDot {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #dc3545;
    transition: background-color 0.1s;
    position: absolute;
}

#reactionDot.green {
    background: #28a745;
}

#reactionInstructions {
    position: absolute;
    bottom: 20px;
    font-size: 1.2em;
    color: #666;
    font-weight: bold;
}

#reactionProgress {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #495057;
}

#startReaction {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background 0.2s;
}

#startReaction:hover {
    background: #138496;
}

/* Results Styles */
#mathResults, #reactionResults {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
}

#allTimes {
    margin: 15px 0;
    font-size: 1.1em;
    color: #666;
}

button {
    margin: 10px;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
}

#restartMath, #restartReaction {
    background: #007bff;
    color: white;
}

#restartMath:hover, #restartReaction:hover {
    background: #0056b3;
}

#backFromMath, #backFromReaction {
    background: #6c757d;
    color: white;
}

#backFromMath:hover, #backFromReaction:hover {
    background: #545b62;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }

    h1 {
        font-size: 2em;
    }

    .input-group {
        gap: 10px;
    }

    .input-group input {
        max-width: 150px;
    }

    #questionText {
        font-size: 1.5em;
    }
}
