/* =========================================================
   MULTI-STEP EQUATIONS PRACTICE PAGE
   ========================================================= */

:root
{
    --mse-navy: #102a43;
    --mse-navy-dark: #081c2f;
    --mse-blue: #1f6f8b;
    --mse-teal: #159a9c;
    --mse-teal-dark: #117b7d;
    --mse-green: #198754;
    --mse-red: #c0392b;
    --mse-orange: #d97706;
    --mse-purple: #6f42c1;
    --mse-light: #f5f8fb;
    --mse-lighter: #fbfcfe;
    --mse-border: #dbe5ee;
    --mse-text: #243b53;
    --mse-muted: #627d98;
    --mse-white: #ffffff;
    --mse-shadow: 0 18px 45px rgba(16, 42, 67, 0.12);
    --mse-shadow-small: 0 8px 24px rgba(16, 42, 67, 0.09);
}


/* =========================================================
   GENERAL PAGE STYLING
   ========================================================= */

.multi-step-equations-page
{
    background: var(--mse-white);
    color: var(--mse-text);
    font-family: "Inter", sans-serif;
}

.multi-step-equations-page *,
.multi-step-equations-page *::before,
.multi-step-equations-page *::after
{
    box-sizing: border-box;
}

.multi-step-equations-page button,
.multi-step-equations-page input,
.multi-step-equations-page select
{
    font-family: inherit;
}

.multi-step-equations-page button
{
    cursor: pointer;
}


/* =========================================================
   PRACTICE SECTION
   ========================================================= */

.mse-section
{
    position: relative;
    padding: 5rem 1.5rem;
    background:
        radial-gradient(
            circle at top left,
            rgba(21, 154, 156, 0.08),
            transparent 32rem
        ),
        linear-gradient(
            180deg,
            #ffffff 0%,
            #f5f8fb 100%
        );
}

.mse-app
{
    width: min(100%, 980px);
    margin: 0 auto;
}


/* =========================================================
   TOOLBAR
   ========================================================= */

.mse-toolbar
{
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.mse-toolbar-heading
{
    max-width: 650px;
}

.mse-toolbar-heading h2
{
    margin: 0 0 0.75rem;
    color: var(--mse-navy);
    font-size: clamp(1.8rem, 4vw, 2.55rem);
    font-weight: 800;
    line-height: 1.15;
}

.mse-toolbar-heading p:last-child
{
    max-width: 620px;
    margin: 0;
    color: var(--mse-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.mse-eyebrow
{
    margin: 0 0 0.5rem;
    color: var(--mse-teal-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.mse-difficulty-control
{
    flex: 0 0 auto;
    min-width: 190px;
}

.mse-difficulty-control label
{
    display: block;
    margin-bottom: 0.45rem;
    color: var(--mse-navy);
    font-size: 0.85rem;
    font-weight: 700;
}

.mse-difficulty-select
{
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 2.5rem 0.7rem 0.95rem;
    border: 1px solid var(--mse-border);
    border-radius: 0.75rem;
    background-color: var(--mse-white);
    color: var(--mse-navy);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    box-shadow: var(--mse-shadow-small);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.mse-difficulty-select:hover
{
    border-color: rgba(21, 154, 156, 0.6);
}

.mse-difficulty-select:focus
{
    border-color: var(--mse-teal);
    box-shadow:
        0 0 0 4px rgba(21, 154, 156, 0.14),
        var(--mse-shadow-small);
}


/* =========================================================
   PROGRESS BAR
   ========================================================= */

.mse-progress-area
{
    margin-bottom: 1.25rem;
}

.mse-progress-text
{
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
    color: var(--mse-navy);
    font-size: 0.88rem;
    font-weight: 700;
}

.mse-progress-track
{
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe9f1;
}

.mse-progress-bar
{
    width: 10%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        var(--mse-teal),
        var(--mse-blue)
    );
    transition: width 0.35s ease;
}


/* =========================================================
   MAIN CARD
   ========================================================= */

.mse-card
{
    padding: clamp(1.4rem, 4vw, 2.5rem);
    border: 1px solid rgba(219, 229, 238, 0.9);
    border-radius: 1.35rem;
    background: var(--mse-white);
    box-shadow: var(--mse-shadow);
}

.mse-card-top
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.mse-card-label
{
    margin: 0 0 0.3rem;
    color: var(--mse-navy);
    font-size: 0.95rem;
    font-weight: 800;
}

.mse-step-instruction
{
    margin: 0;
    color: var(--mse-muted);
    font-size: 0.92rem;
}

.mse-difficulty-badge
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(21, 154, 156, 0.11);
    color: var(--mse-teal-dark);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}


/* =========================================================
   EXPRESSION AREAS
   ========================================================= */

.mse-original-problem-area,
.mse-current-equation-area
{
    padding: 1.3rem;
    border-radius: 1rem;
}

.mse-original-problem-area
{
    margin-bottom: 1.25rem;
    border: 1px solid var(--mse-border);
    background: var(--mse-lighter);
}

.mse-current-equation-area
{
    margin: 1.25rem 0;
    border: 2px solid rgba(21, 154, 156, 0.25);
    background:
        linear-gradient(
            135deg,
            rgba(21, 154, 156, 0.08),
            rgba(31, 111, 139, 0.05)
        );
}

.mse-equation-label
{
    display: block;
    margin-bottom: 0.55rem;
    color: var(--mse-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mse-original-equation
{
    color: var(--mse-navy);
    font-size: clamp(1.25rem, 4vw, 1.8rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    overflow-wrap: anywhere;
}

.mse-current-equation
{
    color: var(--mse-navy-dark);
    font-size: clamp(1.65rem, 5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.025em;
    overflow-wrap: anywhere;
}


/* =========================================================
   STEP HISTORY
   ========================================================= */

.mse-step-history-area
{
    padding: 1.25rem;
    border: 1px solid var(--mse-border);
    border-radius: 1rem;
    background: #ffffff;
}

.mse-step-history-heading
{
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--mse-border);
    color: var(--mse-navy);
    font-size: 0.82rem;
    font-weight: 800;
}

.mse-step-history-heading span:last-child
{
    color: var(--mse-muted);
    font-weight: 600;
}

.mse-step-history
{
    display: grid;
    gap: 0.7rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.mse-history-item
{
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: center;
    gap: 0.9rem;
    padding: 0.8rem 0.9rem;
    border-radius: 0.75rem;
    background: var(--mse-light);
}

.mse-history-number
{
    color: var(--mse-teal-dark);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.mse-history-equation
{
    color: var(--mse-navy);
    font-size: 1rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.mse-history-correct
{
    border-left: 4px solid var(--mse-green);
    background: rgba(25, 135, 84, 0.07);
}


/* =========================================================
   INPUT FORM
   ========================================================= */

.mse-step-form
{
    margin-top: 1.5rem;
}

.mse-input-label
{
    display: block;
    margin-bottom: 0.6rem;
    color: var(--mse-navy);
    font-size: 0.9rem;
    font-weight: 800;
}

.mse-input-row
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.8rem;
}

.mse-step-input
{
    width: 100%;
    min-height: 56px;
    padding: 0.85rem 1rem;
    border: 2px solid var(--mse-border);
    border-radius: 0.85rem;
    background: var(--mse-white);
    color: var(--mse-navy-dark);
    font-size: 1.05rem;
    font-weight: 650;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.mse-step-input::placeholder
{
    color: #9aabba;
    font-weight: 500;
}

.mse-step-input:hover
{
    border-color: #b9cad8;
}

.mse-step-input:focus
{
    border-color: var(--mse-teal);
    box-shadow: 0 0 0 4px rgba(21, 154, 156, 0.13);
}

.mse-step-input.is-correct
{
    border-color: var(--mse-green);
    background: rgba(25, 135, 84, 0.045);
}

.mse-step-input.is-incorrect
{
    border-color: var(--mse-red);
    background: rgba(192, 57, 43, 0.045);
}

.mse-input-help
{
    margin: 0.6rem 0 0;
    color: var(--mse-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.mse-submit-button
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 0.85rem 1.4rem;
    border: 0;
    border-radius: 0.85rem;
    background: linear-gradient(
        135deg,
        var(--mse-teal),
        var(--mse-blue)
    );
    color: var(--mse-white);
    font-size: 0.92rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(21, 154, 156, 0.22);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.mse-submit-button:hover
{
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 12px 24px rgba(21, 154, 156, 0.28);
}

.mse-submit-button:active
{
    transform: translateY(0);
}

.mse-submit-button:focus-visible,
.mse-secondary-button:focus-visible,
.mse-close-button:focus-visible
{
    outline: 3px solid rgba(21, 154, 156, 0.25);
    outline-offset: 3px;
}

.mse-submit-button:disabled
{
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

.mse-action-row
{
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.25rem;
}

.mse-secondary-button
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 42px;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--mse-border);
    border-radius: 0.7rem;
    background: var(--mse-white);
    color: var(--mse-navy);
    font-size: 0.82rem;
    font-weight: 750;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.mse-secondary-button svg
{
    width: 17px;
    height: 17px;
}

.mse-secondary-button:hover
{
    border-color: rgba(21, 154, 156, 0.55);
    background: rgba(21, 154, 156, 0.06);
    color: var(--mse-teal-dark);
    transform: translateY(-1px);
}

.mse-close-button
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(16, 42, 67, 0.07);
    color: var(--mse-navy);
}

.mse-close-button:hover
{
    background: rgba(16, 42, 67, 0.13);
}

.mse-close-button svg
{
    width: 18px;
    height: 18px;
}


/* =========================================================
   FEEDBACK
   ========================================================= */

.mse-feedback
{
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.8rem;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.55;
}

.mse-feedback-neutral
{
    border-color: var(--mse-border);
    background: var(--mse-light);
    color: var(--mse-muted);
}

.mse-feedback-correct
{
    border-color: rgba(25, 135, 84, 0.26);
    background: rgba(25, 135, 84, 0.08);
    color: #12633e;
}

.mse-feedback-incorrect
{
    border-color: rgba(192, 57, 43, 0.25);
    background: rgba(192, 57, 43, 0.07);
    color: #922b21;
}

.mse-feedback-warning
{
    border-color: rgba(217, 119, 6, 0.28);
    background: rgba(217, 119, 6, 0.08);
    color: #9a5204;
}


/* =========================================================
   HELP AND RULE PANELS
   ========================================================= */

.mse-help-panel,
.mse-reference-panel
{
    margin-top: 1rem;
    border-radius: 0.9rem;
}

.mse-help-panel
{
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px solid rgba(217, 119, 6, 0.22);
    background: rgba(217, 119, 6, 0.07);
}

.mse-help-panel[hidden],
.mse-reference-panel[hidden],
.mse-results[hidden]
{
    display: none !important;
}

.mse-help-panel-icon
{
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(217, 119, 6, 0.14);
    color: var(--mse-orange);
}

.mse-help-panel-icon svg
{
    width: 19px;
    height: 19px;
}

.mse-help-panel strong
{
    display: block;
    margin-bottom: 0.2rem;
    color: #804000;
    font-size: 0.86rem;
}

.mse-help-panel p
{
    margin: 0;
    color: #855008;
    font-size: 0.85rem;
    line-height: 1.55;
}

.mse-reference-panel
{
    padding: 1.15rem;
    border: 1px solid rgba(111, 66, 193, 0.2);
    background: rgba(111, 66, 193, 0.055);
}

.mse-reference-panel-heading
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mse-reference-panel-heading h3
{
    margin: 0;
    color: var(--mse-navy);
    font-size: 1rem;
    font-weight: 800;
}

.mse-rule-list
{
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0 0;
    padding-left: 1.25rem;
    color: var(--mse-text);
    font-size: 0.86rem;
    line-height: 1.55;
}

.mse-rule-list strong
{
    color: var(--mse-purple);
}


/* =========================================================
   STATISTICS
   ========================================================= */

.mse-stats
{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.mse-stat
{
    padding: 1.1rem;
    border: 1px solid var(--mse-border);
    border-radius: 0.95rem;
    background: var(--mse-white);
    text-align: center;
    box-shadow: var(--mse-shadow-small);
}

.mse-stat span
{
    display: block;
    min-height: 2.5em;
    margin-bottom: 0.45rem;
    color: var(--mse-muted);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.35;
}

.mse-stat strong
{
    display: block;
    color: var(--mse-navy);
    font-size: 1.65rem;
    font-weight: 800;
}


/* =========================================================
   RESULTS SCREEN
   ========================================================= */

.mse-results
{
    margin-top: 1.5rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid rgba(21, 154, 156, 0.22);
    border-radius: 1.2rem;
    background:
        radial-gradient(
            circle at top right,
            rgba(21, 154, 156, 0.12),
            transparent 22rem
        ),
        var(--mse-white);
    text-align: center;
    box-shadow: var(--mse-shadow);
}

.mse-results-label
{
    margin: 0 0 0.5rem;
    color: var(--mse-teal-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.mse-results h2
{
    margin: 0 0 0.65rem;
    color: var(--mse-navy);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
}

.mse-results > p:not(.mse-results-label)
{
    margin: 0 auto;
    max-width: 600px;
    color: var(--mse-muted);
    line-height: 1.65;
}

.mse-results-grid
{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.75rem 0;
}

.mse-result-item
{
    padding: 1.1rem;
    border: 1px solid var(--mse-border);
    border-radius: 0.85rem;
    background: var(--mse-light);
}

.mse-result-item span
{
    display: block;
    min-height: 2.5em;
    margin-bottom: 0.4rem;
    color: var(--mse-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.mse-result-item strong
{
    color: var(--mse-navy);
    font-size: 1.55rem;
    font-weight: 800;
}

.mse-result-accuracy
{
    border-color: rgba(21, 154, 156, 0.3);
    background: rgba(21, 154, 156, 0.08);
}


/* =========================================================
   INFORMATION CARDS
   ========================================================= */

.mse-info
{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    padding-top: 4.5rem;
    padding-bottom: 4.5rem;
}

.mse-info article
{
    padding: 1.7rem;
    border: 1px solid var(--mse-border);
    border-radius: 1rem;
    background: var(--mse-white);
    box-shadow: var(--mse-shadow-small);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.mse-info article:hover
{
    transform: translateY(-4px);
    border-color: rgba(21, 154, 156, 0.35);
    box-shadow: var(--mse-shadow);
}

.mse-info-icon
{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 1rem;
    border-radius: 0.8rem;
    background: rgba(21, 154, 156, 0.1);
    color: var(--mse-teal-dark);
}

.mse-info-icon svg
{
    width: 21px;
    height: 21px;
}

.mse-info h2
{
    margin: 0 0 0.75rem;
    color: var(--mse-navy);
    font-size: 1.12rem;
    font-weight: 800;
}

.mse-info p
{
    margin: 0;
    color: var(--mse-muted);
    font-size: 0.91rem;
    line-height: 1.7;
}


/* =========================================================
   EXAMPLE SECTION
   ========================================================= */

.mse-example-section
{
    padding: 5rem 0;
    background: var(--mse-navy);
    color: var(--mse-white);
}

.mse-example-content
{
    width: min(100%, 840px);
    margin: 0 auto;
}

.mse-example-heading
{
    text-align: center;
}

.mse-example-heading .mse-eyebrow
{
    color: #6dd8d9;
}

.mse-example-heading h2
{
    margin: 0 0 0.85rem;
    color: var(--mse-white);
    font-size: clamp(1.8rem, 4vw, 2.45rem);
    font-weight: 800;
}

.mse-example-heading p
{
    margin: 0;
    color: #c8d8e5;
}

.mse-example-equation
{
    margin: 2rem auto;
    padding: 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.07);
    color: var(--mse-white);
    font-size: clamp(1.65rem, 5vw, 2.35rem);
    font-weight: 800;
    text-align: center;
}

.mse-example-steps
{
    display: grid;
    gap: 0.9rem;
}

.mse-example-step
{
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.055);
}

.mse-example-step-number
{
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--mse-teal);
    color: var(--mse-white);
    font-weight: 800;
}

.mse-example-step > div
{
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.mse-example-step-label
{
    color: #a9bfd0;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
}

.mse-example-step strong
{
    color: var(--mse-white);
    font-size: 1.15rem;
}

.mse-example-note
{
    margin: 1.5rem 0 0;
    color: #c8d8e5;
    font-size: 0.9rem;
    line-height: 1.7;
    text-align: center;
}


/* =========================================================
   SEO SECTION
   ========================================================= */

.mse-seo-section
{
    padding: 5rem 0;
    background: var(--mse-white);
}

.mse-seo-content
{
    width: min(100%, 860px);
    margin: 0 auto;
}

.mse-seo-content h2
{
    margin: 0 0 1rem;
    color: var(--mse-navy);
    font-size: clamp(1.8rem, 4vw, 2.45rem);
    font-weight: 800;
    line-height: 1.2;
}

.mse-seo-content h3
{
    margin: 2.2rem 0 0.75rem;
    color: var(--mse-navy);
    font-size: 1.3rem;
    font-weight: 800;
}

.mse-seo-content p
{
    margin: 0 0 1rem;
    color: var(--mse-muted);
    font-size: 0.96rem;
    line-height: 1.8;
}

.mse-seo-links
{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 2rem;
}

.mse-resource-link
{
    color: var(--mse-teal-dark);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.mse-resource-link:hover
{
    color: var(--mse-navy);
    text-decoration: underline;
}


/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes mseShake
{
    0%,
    100%
    {
        transform: translateX(0);
    }

    25%
    {
        transform: translateX(-5px);
    }

    50%
    {
        transform: translateX(5px);
    }

    75%
    {
        transform: translateX(-3px);
    }
}

@keyframes msePop
{
    0%
    {
        transform: scale(0.97);
        opacity: 0.5;
    }

    100%
    {
        transform: scale(1);
        opacity: 1;
    }
}

.mse-shake
{
    animation: mseShake 0.3s ease;
}

.mse-pop
{
    animation: msePop 0.25s ease;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px)
{
    .mse-toolbar
    {
        align-items: stretch;
        flex-direction: column;
        gap: 1.25rem;
    }

    .mse-difficulty-control
    {
        width: 100%;
        max-width: 320px;
    }

    .mse-stats,
    .mse-results-grid
    {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mse-info
    {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px)
{
    .mse-section
    {
        padding: 3.5rem 1rem;
    }

    .mse-card
    {
        padding: 1.15rem;
        border-radius: 1rem;
    }

    .mse-card-top
    {
        flex-direction: column;
    }

    .mse-input-row
    {
        grid-template-columns: 1fr;
    }

    .mse-submit-button
    {
        width: 100%;
    }

    .mse-action-row
    {
        display: grid;
        grid-template-columns: 1fr;
    }

    .mse-secondary-button
    {
        width: 100%;
    }

    .mse-history-item
    {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .mse-step-history-heading
    {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }

    .mse-stats,
    .mse-results-grid
    {
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem;
    }

    .mse-stat,
    .mse-result-item
    {
        padding: 0.9rem 0.65rem;
    }

    .mse-stat strong,
    .mse-result-item strong
    {
        font-size: 1.35rem;
    }

    .mse-info
    {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    .mse-example-section,
    .mse-seo-section
    {
        padding: 4rem 0;
    }

    .mse-example-step
    {
        align-items: flex-start;
    }

    .mse-seo-links
    {
        align-items: stretch;
        flex-direction: column;
    }

    .mse-seo-links .btn
    {
        width: 100%;
    }

    .mse-resource-link
    {
        text-align: center;
    }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 390px)
{
    .mse-stats,
    .mse-results-grid
    {
        grid-template-columns: 1fr;
    }

    .mse-original-problem-area,
    .mse-current-equation-area,
    .mse-step-history-area
    {
        padding: 1rem;
    }

    .mse-current-equation
    {
        font-size: 1.5rem;
    }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce)
{
    .multi-step-equations-page *,
    .multi-step-equations-page *::before,
    .multi-step-equations-page *::after
    {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   MULTI-STEP EQUATIONS — CONTROL GROUPS
   ========================================================= */

.mse-controls
{
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 1rem;
    flex: 0 0 auto;
    min-width: min(100%, 410px);
}

.mse-control-group
{
    min-width: 0;
}

.mse-control-group label
{
    display: block;
    margin-bottom: 0.45rem;
    color: var(--mse-navy);
    font-size: 0.85rem;
    font-weight: 700;
}

.mse-select
{
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 2.5rem 0.7rem 0.95rem;
    border: 1px solid var(--mse-border);
    border-radius: 0.75rem;
    background-color: var(--mse-white);
    color: var(--mse-navy);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    box-shadow: var(--mse-shadow-small);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.mse-select:hover
{
    border-color: rgba(21, 154, 156, 0.6);
}

.mse-select:focus
{
    border-color: var(--mse-teal);
    box-shadow:
        0 0 0 4px rgba(21, 154, 156, 0.14),
        var(--mse-shadow-small);
}


/* =========================================================
   MULTI-STEP EQUATIONS — RULE GRID
   ========================================================= */

.mse-reference-grid
{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}

.mse-reference-item
{
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid rgba(111, 66, 193, 0.14);
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.72);
}

.mse-reference-item strong
{
    color: var(--mse-purple);
    font-size: 0.86rem;
}

.mse-reference-equation
{
    color: var(--mse-navy-dark);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.4;
}

.mse-reference-item p
{
    margin: 0;
    color: var(--mse-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}


/* =========================================================
   MULTI-STEP EQUATIONS — EXPRESSION READABILITY
   ========================================================= */

.mse-original-equation,
.mse-current-equation,
.mse-history-equation,
.mse-example-equation,
.mse-example-step strong,
.mse-reference-equation
{
    font-variant-numeric: tabular-nums;
}

.mse-original-equation,
.mse-current-equation,
.mse-history-equation
{
    word-break: normal;
    overflow-wrap: normal;
}

.mse-current-equation
{
    min-height: 1.4em;
}


/* =========================================================
   MULTI-STEP EQUATIONS — INPUT EMPHASIS
   ========================================================= */

.mse-step-input
{
    letter-spacing: 0.01em;
}

.mse-step-input.is-correct
{
    border-color: var(--mse-green);
}

.mse-step-input.is-incorrect
{
    border-color: var(--mse-red);
}


/* =========================================================
   MULTI-STEP EQUATIONS — TOOLBAR RESPONSIVE OVERRIDES
   ========================================================= */

@media (max-width: 900px)
{
    .mse-controls
    {
        width: 100%;
        max-width: 620px;
        min-width: 0;
    }
}

@media (max-width: 600px)
{
    .mse-controls
    {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .mse-reference-grid
    {
        grid-template-columns: 1fr;
    }

    .mse-original-equation,
    .mse-current-equation
    {
        overflow-wrap: anywhere;
    }
}


/* =========================================================
   ACCESSIBILITY / REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce)
{
    .mse-select,
    .mse-reference-item
    {
        transition: none;
    }
}


/* =========================================================
   MULTI-STEP EQUATIONS — TOOLBAR OVERRIDES
   ========================================================= */

.mse-controls
{
    display: block;
    flex: 0 0 auto;
    width: min(100%, 260px);
    min-width: 220px;
}

.mse-control-group
{
    width: 100%;
}

.mse-control-group label
{
    display: block;
    margin-bottom: 0.45rem;
    color: var(--mse-navy);
    font-size: 0.85rem;
    font-weight: 700;
}

.mse-select
{
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 2.5rem 0.7rem 0.95rem;
    border: 1px solid var(--mse-border);
    border-radius: 0.75rem;
    background-color: var(--mse-white);
    color: var(--mse-navy);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    box-shadow: var(--mse-shadow-small);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.mse-select:hover
{
    border-color: rgba(21, 154, 156, 0.6);
}

.mse-select:focus
{
    border-color: var(--mse-teal);
    box-shadow:
        0 0 0 4px rgba(21, 154, 156, 0.14),
        var(--mse-shadow-small);
}


/* =========================================================
   MULTI-STEP EQUATIONS — EQUATION READABILITY
   ========================================================= */

.mse-original-equation,
.mse-current-equation,
.mse-history-equation,
.mse-example-equation,
.mse-example-step strong,
.mse-reference-equation
{
    font-variant-numeric: tabular-nums;
}

.mse-original-equation,
.mse-current-equation,
.mse-history-equation
{
    word-break: normal;
    overflow-wrap: normal;
}

.mse-original-equation,
.mse-current-equation
{
    letter-spacing: 0.01em;
}


/* =========================================================
   MULTI-STEP EQUATIONS — STACKED FRACTIONS
   Ready for equation rendering such as x over 5.
   ========================================================= */

.mse-fraction
{
    display: inline-grid;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: stretch;
    min-width: 1.35em;
    margin: 0 0.12em;
    vertical-align: middle;
    line-height: 1;
}

.mse-fraction-top,
.mse-fraction-bottom
{
    display: block;
    min-width: 100%;
    padding-right: 0.14em;
    padding-left: 0.14em;
    text-align: center;
    line-height: 0.95;
}

.mse-fraction-top
{
    border-bottom: 0.075em solid currentColor;
    padding-bottom: 0.08em;
}

.mse-fraction-bottom
{
    padding-top: 0.08em;
}

.mse-equation-inline
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.16em;
    white-space: nowrap;
}


/* =========================================================
   MULTI-STEP EQUATIONS — REFERENCE PANEL
   ========================================================= */

.mse-reference-grid
{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}

.mse-reference-item
{
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.76);
}

.mse-reference-item strong
{
    color: var(--mse-teal-dark);
    font-size: 0.86rem;
}

.mse-reference-equation
{
    color: var(--mse-navy-dark);
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.45;
}

.mse-reference-item p
{
    margin: 0;
    color: var(--mse-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}


/* =========================================================
   MULTI-STEP EQUATIONS — FONT AWESOME INFO ICONS
   ========================================================= */

.mse-info-icon .svg-inline--fa
{
    width: 21px;
    height: 21px;
}


/* =========================================================
   MULTI-STEP EQUATIONS — RESPONSIVE OVERRIDES
   ========================================================= */

@media (max-width: 900px)
{
    .mse-controls
    {
        width: 100%;
        max-width: 360px;
        min-width: 0;
    }
}

@media (max-width: 600px)
{
    .mse-controls
    {
        max-width: none;
    }

    .mse-reference-grid
    {
        grid-template-columns: 1fr;
    }

    .mse-original-equation,
    .mse-current-equation
    {
        overflow-wrap: anywhere;
    }

    .mse-equation-inline
    {
        white-space: normal;
        flex-wrap: wrap;
    }
}


/* =========================================================
   MULTI-STEP EQUATIONS — REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce)
{
    .mse-select,
    .mse-reference-item
    {
        transition: none;
    }
}


/* =========================================================
   MULTI-STEP EQUATIONS — STEP HISTORY EMPHASIS
   ========================================================= */

.mse-step-history-area
{
    border-top: 1px solid var(--mse-border);
    border-bottom: 1px solid var(--mse-border);
}

.mse-history-item + .mse-history-item
{
    margin-top: 0.75rem;
}

.mse-history-correct
{
    border-color: rgba(21, 128, 61, 0.2);
    background: rgba(240, 253, 244, 0.75);
}

.mse-history-correct .mse-history-number
{
    background: rgba(21, 128, 61, 0.12);
    color: var(--mse-green);
}


/* =========================================================
   MULTI-STEP EQUATIONS — CURRENT EQUATION EMPHASIS
   ========================================================= */

.mse-current-equation
{
    min-height: 1.5em;
}

.mse-card[data-step-stage="constant"] .mse-current-equation-area
{
    box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.mse-card[data-step-stage="coefficient"] .mse-current-equation-area
{
    box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.08);
}


/* =========================================================
   MULTI-STEP EQUATIONS — REFERENCE PANEL
   ========================================================= */

.mse-reference-grid
{
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mse-reference-item strong
{
    color: var(--mse-teal-dark);
}

.mse-reference-equation
{
    font-size: 1.04rem;
}


/* =========================================================
   MULTI-STEP EQUATIONS — FRACTION / DIVISION FORMS
   ========================================================= */

.mse-fraction
{
    margin-inline: 0.14em;
}

.mse-equation-inline
{
    gap: 0.18em;
}

.mse-original-equation .mse-fraction,
.mse-current-equation .mse-fraction,
.mse-example-equation .mse-fraction
{
    transform: translateY(0.02em);
}


/* =========================================================
   MULTI-STEP EQUATIONS — INFO ICONS
   ========================================================= */

.mse-info-icon .svg-inline--fa
{
    width: 21px;
    height: 21px;
}


/* =========================================================
   MULTI-STEP EQUATIONS — RESPONSIVE
   ========================================================= */

@media (max-width: 700px)
{
    .mse-reference-grid
    {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px)
{
    .mse-history-item
    {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .mse-history-number
    {
        justify-self: start;
    }

    .mse-history-equation
    {
        width: 100%;
    }
}


/* =========================================================
   MULTI-STEP EQUATIONS — ACTIVE ALGEBRA STAGES
   ========================================================= */

.mse-card[data-step-stage="distribute"] .mse-current-equation-area
{
    box-shadow:
        inset 0 0 0 1px rgba(79, 70, 229, 0.13);
}

.mse-card[data-step-stage="combine"] .mse-current-equation-area
{
    box-shadow:
        inset 0 0 0 1px rgba(8, 145, 178, 0.13);
}

.mse-card[data-step-stage="constant"] .mse-current-equation-area
{
    box-shadow:
        inset 0 0 0 1px rgba(22, 163, 74, 0.13);
}

.mse-card[data-step-stage="coefficient"] .mse-current-equation-area
{
    box-shadow:
        inset 0 0 0 1px rgba(217, 119, 6, 0.13);
}


/* =========================================================
   MULTI-STEP EQUATIONS — LONGER WORK HISTORIES
   ========================================================= */

.mse-step-history
{
    display: grid;
    gap: 0.7rem;
}

.mse-history-item
{
    min-height: 58px;
}

.mse-history-item + .mse-history-item
{
    margin-top: 0;
}

.mse-history-correct
{
    border-color: rgba(21, 128, 61, 0.2);
    background: rgba(240, 253, 244, 0.78);
}

.mse-history-correct .mse-history-number
{
    background: rgba(21, 128, 61, 0.12);
    color: var(--mse-green);
}


/* =========================================================
   MULTI-STEP EQUATIONS — LONG EQUATION READABILITY
   ========================================================= */

.mse-original-equation,
.mse-current-equation
{
    width: 100%;
    min-height: 1.5em;
    text-align: center;
}

.mse-current-equation
{
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.mse-original-equation
{
    font-size: clamp(1.8rem, 4.5vw, 3rem);
}

.mse-equation-inline
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.18em;
    flex-wrap: wrap;
    max-width: 100%;
}

.mse-equation-side
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.18em;
    flex-wrap: wrap;
    max-width: 100%;
}

.mse-equation-operator
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mse-equation-equals
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline: 0.12em;
    line-height: 1;
}

.mse-original-equation,
.mse-current-equation,
.mse-history-equation,
.mse-example-equation,
.mse-example-step strong,
.mse-reference-equation
{
    overflow-wrap: anywhere;
}


/* =========================================================
   MULTI-STEP EQUATIONS — FRACTIONS
   ========================================================= */

.mse-fraction
{
    display: inline-grid;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: stretch;
    min-width: 1.35em;
    margin: 0 0.12em;
    vertical-align: middle;
    line-height: 1;
}

.mse-fraction-top,
.mse-fraction-bottom
{
    display: block;
    min-width: 100%;
    padding-right: 0.14em;
    padding-left: 0.14em;
    text-align: center;
    line-height: 0.95;
}

.mse-fraction-top
{
    border-bottom: 0.075em solid currentColor;
    padding-bottom: 0.08em;
}

.mse-fraction-bottom
{
    padding-top: 0.08em;
}

.mse-fraction-variable
{
    display: inline-flex;
    align-items: center;
    line-height: 1;
}


/* =========================================================
   MULTI-STEP EQUATIONS — REFERENCE PANEL
   ========================================================= */

.mse-reference-grid
{
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mse-reference-item strong
{
    color: var(--mse-teal-dark);
}

.mse-reference-equation
{
    font-size: 1.02rem;
}


/* =========================================================
   MULTI-STEP EQUATIONS — EXAMPLE SECTION
   ========================================================= */

.mse-example-steps
{
    display: grid;
    gap: 1rem;
}

.mse-example-step
{
    align-items: flex-start;
}

.mse-example-step strong
{
    display: block;
    margin-top: 0.25rem;
}


/* =========================================================
   MULTI-STEP EQUATIONS — FONT AWESOME INFO ICONS
   ========================================================= */

.mse-info-icon .svg-inline--fa
{
    width: 21px;
    height: 21px;
}


/* =========================================================
   MULTI-STEP EQUATIONS — RESPONSIVE
   ========================================================= */

@media (max-width: 700px)
{
    .mse-reference-grid
    {
        grid-template-columns: 1fr;
    }

    .mse-current-equation
    {
        font-size: clamp(1.7rem, 8vw, 2.6rem);
    }

    .mse-original-equation
    {
        font-size: clamp(1.55rem, 7vw, 2.3rem);
    }
}

@media (max-width: 520px)
{
    .mse-history-item
    {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .mse-history-number
    {
        justify-self: start;
    }

    .mse-history-equation
    {
        width: 100%;
    }

    .mse-equation-inline,
    .mse-equation-side
    {
        justify-content: center;
    }
}