/* =========================================================
   Chemistry Equation Quiz
   ========================================================= */

.chemistry-equation-quiz-page {
    background: #ffffff;
    color: #1f2937;
    font-family: "Inter", sans-serif;
}

.chemistry-equation-quiz-page *,
.chemistry-equation-quiz-page *::before,
.chemistry-equation-quiz-page *::after {
    box-sizing: border-box;
}


/* =========================================================
   Main Practice Section
   ========================================================= */

.ceq-section {
    padding: 5rem 1.5rem;
    background:
        radial-gradient(
            circle at top left,
            rgba(13, 148, 136, 0.08),
            transparent 34rem
        ),
        linear-gradient(
            180deg,
            #ffffff 0%,
            #f7fafc 100%
        );
}

.ceq-app {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
}


/* =========================================================
   Topic Selector
   ========================================================= */

.ceq-topic-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.25rem;
    background: #ffffff;
    border: 1px solid #dbe4ea;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.ceq-topic-label {
    margin: 0;
    color: #334155;
    font-size: 0.95rem;
    font-weight: 700;
}

.ceq-topic-select {
    width: min(100%, 360px);
    min-height: 46px;
    padding: 0.65rem 2.5rem 0.65rem 0.9rem;
    color: #1e293b;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ceq-topic-select:hover {
    border-color: #0f766e;
}

.ceq-topic-select:focus {
    border-color: #0f766e;
    outline: none;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
}


/* =========================================================
   Progress Bar
   ========================================================= */

.ceq-progress-area {
    margin-bottom: 1.5rem;
}

.ceq-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 700;
}

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

.ceq-progress-bar {
    width: 5%;
    height: 100%;
    background: linear-gradient(
        90deg,
        #0f766e,
        #14b8a6
    );
    border-radius: inherit;
    transition: width 0.35s ease;
}


/* =========================================================
   Main Question Card
   ========================================================= */

.ceq-card {
    position: relative;
    overflow: hidden;
    padding: 2.25rem;
    background: #ffffff;
    border: 1px solid #dbe4ea;
    border-radius: 1.25rem;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.08),
        0 3px 10px rgba(15, 23, 42, 0.04);
}

.ceq-card::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    content: "";
    background: linear-gradient(
        90deg,
        #0f766e,
        #2dd4bf
    );
}

.ceq-card-heading {
    margin-bottom: 1.8rem;
}

.ceq-card-label {
    margin: 0 0 0.65rem;
    color: #0f766e;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.ceq-card-heading h2 {
    margin: 0 0 0.75rem;
    color: #0f172a;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    line-height: 1.25;
}

.ceq-card-instructions {
    max-width: 760px;
    margin: 0;
    color: #64748b;
    font-size: 0.98rem;
    line-height: 1.7;
}


/* =========================================================
   Problem Text
   ========================================================= */

.ceq-problem {
    margin-bottom: 2rem;
    padding: 1.4rem 1.5rem;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #dbe4ea;
    border-left: 5px solid #0f766e;
    border-radius: 0.9rem;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.8;
}


/* =========================================================
   Answer Choices
   ========================================================= */

.ceq-answer-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.ceq-answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ceq-answer-choice {
    position: relative;
    display: flex;
    min-height: 112px;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 1.15rem 1.25rem;
    overflow: hidden;
    color: #1e293b;
    background: #ffffff;
    border: 2px solid #dbe4ea;
    border-radius: 1rem;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ceq-answer-choice:hover {
    transform: translateY(-2px);
    background: #f8fffe;
    border-color: #5eead4;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.1);
}

.ceq-answer-choice:focus-within {
    border-color: #0f766e;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
}

.ceq-answer-choice input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.ceq-answer-letter {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    color: #0f766e;
    background: #ecfdf5;
    border: 1px solid #99f6e4;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 800;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.ceq-answer-equation {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.35rem 0;
    color: #0f172a;
    font-size: 1.08rem;
    text-align: center;
}

.ceq-answer-equation mjx-container {
    margin: 0 !important;
}

.ceq-answer-choice.is-selected {
    background: #f0fdfa;
    border-color: #0f766e;
    box-shadow: 0 10px 25px rgba(15, 118, 110, 0.12);
}

.ceq-answer-choice.is-selected .ceq-answer-letter {
    color: #ffffff;
    background: #0f766e;
    border-color: #0f766e;
}


/* =========================================================
   Correct and Incorrect States
   ========================================================= */

.ceq-answer-choice.is-correct {
    background: #ecfdf5;
    border-color: #16a34a;
    box-shadow: 0 10px 25px rgba(22, 163, 74, 0.11);
}

.ceq-answer-choice.is-correct .ceq-answer-letter {
    color: #ffffff;
    background: #16a34a;
    border-color: #16a34a;
}

.ceq-answer-choice.is-incorrect {
    background: #fff1f2;
    border-color: #e11d48;
    box-shadow: 0 10px 25px rgba(225, 29, 72, 0.1);
}

.ceq-answer-choice.is-incorrect .ceq-answer-letter {
    color: #ffffff;
    background: #e11d48;
    border-color: #e11d48;
}

.ceq-answer-choice.is-disabled {
    cursor: default;
}

.ceq-answer-choice.is-disabled:hover {
    transform: none;
}

.ceq-answer-choice.is-muted {
    opacity: 0.58;
}


/* =========================================================
   Controls
   ========================================================= */

.ceq-controls {
    display: flex;
    justify-content: center;
    margin-top: 1.8rem;
}

.ceq-submit-button {
    display: inline-flex;
    min-width: 190px;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    color: #ffffff;
    background: #0f766e;
    border: 0;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ceq-submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    background: #115e59;
    box-shadow: 0 13px 26px rgba(15, 118, 110, 0.24);
}

.ceq-submit-button:focus-visible {
    outline: 3px solid rgba(45, 212, 191, 0.55);
    outline-offset: 3px;
}

.ceq-submit-button:disabled {
    color: #94a3b8;
    background: #e2e8f0;
    cursor: not-allowed;
    box-shadow: none;
}

.ceq-submit-button[hidden] {
    display: none;
}


/* =========================================================
   Feedback
   ========================================================= */

.ceq-feedback {
    min-height: 56px;
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.ceq-feedback.is-correct {
    color: #166534;
    background: #f0fdf4;
    border-color: #86efac;
}

.ceq-feedback.is-incorrect {
    color: #9f1239;
    background: #fff1f2;
    border-color: #fda4af;
}


/* =========================================================
   Explanation Box
   ========================================================= */

.ceq-explanation {
    margin-top: 1.25rem;
    padding: 1.35rem 1.4rem;
    background: linear-gradient(
        135deg,
        #f0fdfa,
        #f8fafc
    );
    border: 1px solid #99f6e4;
    border-radius: 0.9rem;
}

.ceq-explanation[hidden] {
    display: none;
}

.ceq-explanation-label {
    margin: 0 0 0.45rem;
    color: #0f766e;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ceq-explanation h3 {
    margin: 0 0 0.85rem;
    color: #0f172a;
    font-size: 1.2rem;
    font-weight: 800;
}

.ceq-correct-equation {
    margin-bottom: 0.9rem;
    padding: 0.9rem 1rem;
    overflow-x: auto;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #ccfbf1;
    border-radius: 0.75rem;
    font-size: 1.2rem;
    text-align: center;
}

.ceq-correct-equation mjx-container {
    margin: 0 !important;
}

.ceq-explanation p:last-child {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.7;
}


/* =========================================================
   Statistics
   ========================================================= */

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

.ceq-stat {
    padding: 1.15rem 1rem;
    background: #ffffff;
    border: 1px solid #dbe4ea;
    border-radius: 0.9rem;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
    text-align: center;
}

.ceq-stat span {
    display: block;
    margin-bottom: 0.4rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ceq-stat strong {
    display: block;
    color: #0f172a;
    font-size: 1.45rem;
    font-weight: 800;
}


/* =========================================================
   Results Screen
   ========================================================= */

.ceq-results {
    margin-top: 1.5rem;
    padding: 2.25rem;
    background: #ffffff;
    border: 1px solid #dbe4ea;
    border-radius: 1.25rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    text-align: center;
}

.ceq-results[hidden] {
    display: none;
}

.ceq-results-label {
    margin: 0 0 0.45rem;
    color: #0f766e;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ceq-results h2 {
    margin: 0 0 0.65rem;
    color: #0f172a;
    font-size: clamp(1.7rem, 3vw, 2.25rem);
    font-weight: 800;
}

.ceq-results > p:not(.ceq-results-label) {
    margin: 0 auto 1.6rem;
    color: #64748b;
    line-height: 1.7;
}

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

.ceq-result-item {
    padding: 1.15rem 0.9rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
}

.ceq-result-item span {
    display: block;
    margin-bottom: 0.35rem;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ceq-result-item strong {
    display: block;
    color: #0f172a;
    font-size: 1.55rem;
    font-weight: 800;
}

.ceq-result-accuracy {
    background: #f0fdfa;
    border-color: #99f6e4;
}


/* =========================================================
   Basic Information Section
   ========================================================= */

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

.ceq-info article {
    padding: 1.7rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.ceq-info h2 {
    margin: 0 0 0.8rem;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.35;
}

.ceq-info p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.75;
}


/* =========================================================
   SEO Section
   ========================================================= */

.ceq-seo-section {
    padding: 5rem 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.ceq-seo-content {
    max-width: 900px;
    margin: 0 auto;
}

.ceq-seo-content h2 {
    margin: 0 0 1rem;
    color: #0f172a;
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 800;
}

.ceq-seo-content h3 {
    margin: 2rem 0 0.7rem;
    color: #0f172a;
    font-size: 1.3rem;
    font-weight: 800;
}

.ceq-seo-content p {
    margin: 0 0 1rem;
    color: #475569;
    line-height: 1.8;
}

.ceq-seo-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
}

.ceq-resource-link {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ceq-resource-link:hover {
    color: #115e59;
    text-decoration: underline;
}


/* =========================================================
   MathJax Adjustments
   ========================================================= */

.ceq-card mjx-container,
.ceq-results mjx-container {
    max-width: 100%;
}

.ceq-answer-equation mjx-container[jax="CHTML"],
.ceq-correct-equation mjx-container[jax="CHTML"] {
    line-height: 1.35;
}

.ceq-answer-equation mjx-math,
.ceq-correct-equation mjx-math {
    white-space: nowrap;
}


/* =========================================================
   Loading State
   ========================================================= */

.ceq-app.is-loading .ceq-card {
    pointer-events: none;
    opacity: 0.72;
}

.ceq-app.is-loading .ceq-answer-choice {
    cursor: wait;
}


/* =========================================================
   Responsive — Tablet
   ========================================================= */

@media (max-width: 991.98px) {

    .ceq-section {
        padding: 4rem 1.25rem;
    }

    .ceq-card {
        padding: 1.8rem;
    }

    .ceq-answer-grid {
        grid-template-columns: 1fr;
    }

    .ceq-answer-choice {
        min-height: 96px;
    }

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

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

    .ceq-info {
        grid-template-columns: 1fr;
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

}


/* =========================================================
   Responsive — Mobile
   ========================================================= */

@media (max-width: 767.98px) {

    .ceq-section {
        padding: 3rem 1rem;
    }

    .ceq-topic-area {
        align-items: stretch;
        flex-direction: column;
        padding: 1rem;
    }

    .ceq-topic-select {
        width: 100%;
    }

    .ceq-progress-text {
        font-size: 0.82rem;
    }

    .ceq-card {
        padding: 1.35rem;
        border-radius: 1rem;
    }

    .ceq-card-heading {
        margin-bottom: 1.3rem;
    }

    .ceq-card-heading h2 {
        font-size: 1.45rem;
    }

    .ceq-card-instructions {
        font-size: 0.92rem;
    }

    .ceq-problem {
        margin-bottom: 1.4rem;
        padding: 1.1rem;
        font-size: 0.98rem;
        line-height: 1.7;
    }

    .ceq-answer-grid {
        gap: 0.8rem;
    }

    .ceq-answer-choice {
        min-height: 88px;
        gap: 0.75rem;
        padding: 0.95rem;
        border-radius: 0.85rem;
    }

    .ceq-answer-letter {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
        font-size: 0.85rem;
    }

    .ceq-answer-equation {
        justify-content: flex-start;
        font-size: 0.98rem;
        text-align: left;
    }

    .ceq-controls {
        margin-top: 1.35rem;
    }

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

    .ceq-feedback {
        font-size: 0.9rem;
    }

    .ceq-explanation {
        padding: 1.1rem;
    }

    .ceq-correct-equation {
        font-size: 1.05rem;
    }

    .ceq-stats {
        gap: 0.75rem;
    }

    .ceq-stat {
        padding: 1rem 0.75rem;
    }

    .ceq-stat strong {
        font-size: 1.3rem;
    }

    .ceq-results {
        padding: 1.5rem 1.15rem;
    }

    .ceq-results-grid {
        gap: 0.75rem;
    }

    .ceq-result-item {
        padding: 1rem 0.65rem;
    }

    .ceq-result-item strong {
        font-size: 1.35rem;
    }

    .ceq-info {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .ceq-info article {
        padding: 1.4rem;
    }

    .ceq-seo-section {
        padding: 3.5rem 0;
    }

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

    .ceq-seo-links .btn,
    .ceq-resource-link {
        width: 100%;
        text-align: center;
    }

}


/* =========================================================
   Responsive — Small Phones
   ========================================================= */

@media (max-width: 420px) {

    .ceq-section {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .ceq-card {
        padding: 1.1rem;
    }

    .ceq-answer-choice {
        align-items: flex-start;
    }

    .ceq-answer-equation {
        font-size: 0.9rem;
    }

    .ceq-stats,
    .ceq-results-grid {
        grid-template-columns: 1fr 1fr;
    }

}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .ceq-progress-bar,
    .ceq-topic-select,
    .ceq-answer-choice,
    .ceq-answer-letter,
    .ceq-submit-button,
    .ceq-resource-link {
        transition: none;
    }

}


/* =========================================================
   Print
   ========================================================= */

@media print {

    .ceq-topic-area,
    .ceq-progress-area,
    .ceq-controls,
    .ceq-stats,
    .ceq-results,
    .ceq-seo-links {
        display: none !important;
    }

    .ceq-section,
    .ceq-seo-section {
        padding: 1rem 0;
        background: #ffffff;
    }

    .ceq-card,
    .ceq-info article {
        box-shadow: none;
    }

}