/* General Body and Font Styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7fa;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    padding: 20px;
}

/* Main container for the application */
.container {
    background-color: #ffffff;
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    width: 95%;
    max-width: 1200px;
    text-align: center;
}

h1 {
    color: #1c3d5a;
    margin-bottom: 25px;
    font-weight: 600;
}

/* --- UPDATED: Mode Switching Tabs for Accessibility & High Contrast --- */
.mode-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background-color: #e9ecef;
    border-radius: 10px;
    padding: 5px;
    /* Reset list styling */
    list-style: none; 
}
.mode-switcher li {
    flex: 1; /* Make list items take up equal space */
    display: flex;
}

.mode-btn {
    padding: 12px 20px;
    border: none;
    background-color: transparent;
    color: #495057; /* Darker text color for high contrast on inactive state */
    font-size: 1em;
    font-weight: 600; /* Bolder text for better readability */
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
    width: 100%; /* Ensure button fills the list item */
}
.mode-btn.active {
    background-color: #007bff; /* Solid blue background for active state */
    color: #ffffff; /* White text for maximum contrast */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); /* Subtle shadow for depth */
}
/* Add a visible focus ring for keyboard users */
.mode-btn:focus-visible {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}
/* --- END OF UPDATE --- */


/* Area for user inputs and controls */
.input-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    min-height: 80px; /* Reserve space */
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group label {
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #555;
    font-weight: 500;
}

input[type="number"] {
    padding: 12px;
    border: 2px solid #dde1e6;
    border-radius: 8px;
    width: 150px;
    text-align: center;
    font-size: 1.2em;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="number"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

button {
    padding: 14px 30px;
    background-image: linear-gradient(to right, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.3s, background-color 0.3s;
    align-self: flex-end; /* Aligns with the bottom of the input fields */
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

button.secondary {
     background-image: linear-gradient(to right, #6c757d, #495057);
     box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Quiz Mode Specifics */
.quiz-question {
    font-size: 1.8em;
    color: #1c3d5a;
    margin-bottom: 15px;
}
.feedback {
    min-height: 25px;
    margin-top: -10px;
    margin-bottom: 15px;
    font-weight: 500;
}
.feedback.correct { color: #28a745; }
.feedback.incorrect { color: #dc3545; }

/* Displays the final equation */
#equation {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: #1c3d5a;
    min-height: 40px;
    font-weight: 300;
}

#equation strong {
    font-weight: 600;
}

/* Explanation Text Styling */
.explanation {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px 20px;
    margin: 0 auto 30px auto;
    max-width: 80%;
    text-align: left;
    border-radius: 0 8px 8px 0;
    font-size: 1em;
    line-height: 1.6;
    color: #343a40;
}
.explanation p { margin: 5px 0; }
.explanation strong { color: #1c3d5a; }

/* Number Line Styling (Shared) */
.number-line-container {
    width: 100%;
    overflow-x: auto;
    padding: 20px 0;
    position: relative;
    border-top: 1px solid #e9ecef;
    min-height: 160px; /* Reserve space */
}

.number-line {
    position: relative;
    height: 100px;
    margin: 0 auto;
    background-image: linear-gradient(to right, #ccc, #ccc);
    background-position: 0 60px;
    background-size: 100% 2px;
    background-repeat: no-repeat;
    transition: opacity 0.5s;
}

.tick-container { display: flex; flex-direction: column; align-items: center; position: absolute; transform: translateX(-50%); top: 40px; }
.tick { width: 2px; background-color: #888; }
.tick.major { height: 20px; }
.tick.minor { height: 10px; background-color: #bbb; }
.tick-label { margin-top: 8px; font-size: 0.9em; color: #555; }
#arrow-container { position: absolute; top: 20px; height: 25px; width: 100%; left: 0; }
.arrow { position: absolute; height: 100%; display: flex; align-items: center; transition: all 0.6s ease-in-out; }
.arrow-line { height: 4px; border-radius: 2px; position: absolute; top: 50%; transform: translateY(-50%); }
.arrow-head { width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; position: absolute; top: 50%; transform: translateY(-50%); }
.arrow.positive .arrow-line { background-color: #28a745; }
.arrow.positive .arrow-head { border-left: 15px solid #28a745; }
.arrow.negative .arrow-line { background-color: #dc3545; }
.arrow.negative .arrow-head { border-right: 15px solid #dc3545; }
.result-dot { width: 18px; height: 18px; background-color: #007bff; border: 3px solid white; box-shadow: 0 0 10px rgba(0, 123, 255, 0.7); border-radius: 50%; position: absolute; top: 51px; transform: translateX(-50%); transition: left 0.6s ease-in-out; z-index: 10; }

/* Utility to hide elements */
.hidden { display: none !important; }
