/* =========================================================
   Chemical Equation Balancer
   ========================================================= */

.chemical-equation-balancer-page {
    --ceb-navy: #16324f;
    --ceb-navy-dark: #10263c;
    --ceb-teal: #1b8f8a;
    --ceb-teal-dark: #14726e;
    --ceb-teal-light: #e8f7f6;
    --ceb-blue-light: #edf5fb;
    --ceb-green: #23845f;
    --ceb-green-light: #eaf7f0;
    --ceb-red: #b74747;
    --ceb-red-light: #fdf0f0;
    --ceb-yellow: #9a6b12;
    --ceb-yellow-light: #fff7dd;
    --ceb-text: #243746;
    --ceb-muted: #637381;
    --ceb-border: #d7e1e8;
    --ceb-background: #f4f8fb;
    --ceb-white: #ffffff;
    --ceb-shadow: 0 18px 45px rgba(22, 50, 79, 0.11);

    color: var(--ceb-text);
    font-family: "Inter", sans-serif;
}


/* =========================================================
   Main tool section
   ========================================================= */

.ceb-section {
    background:
        radial-gradient(
            circle at top left,
            rgba(27, 143, 138, 0.08),
            transparent 34rem
        ),
        var(--ceb-background);
    padding: 5rem 1.5rem;
}

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

.ceb-card {
    background: var(--ceb-white);
    border: 1px solid rgba(215, 225, 232, 0.9);
    border-radius: 24px;
    box-shadow: var(--ceb-shadow);
    overflow: hidden;
    padding: 2.5rem;
}

.ceb-card-heading {
    max-width: 760px;
    margin-bottom: 2rem;
}

.ceb-card-heading h2,
.ceb-practice-heading h2,
.ceb-custom-equation-heading h3,
.ceb-quiz-prompt h3,
.ceb-section-heading h3,
.ceb-answer-heading h3 {
    color: var(--ceb-navy);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.65rem;
}

.ceb-card-heading h2 {
    font-size: clamp(1.75rem, 3vw, 2.35rem);
}

.ceb-card-label,
.ceb-explanation-label,
.ceb-category-label {
    color: var(--ceb-teal-dark);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    margin-bottom: 0.55rem;
    text-transform: uppercase;
}

.ceb-card-instructions,
.ceb-card-heading p,
.ceb-custom-equation-heading p,
.ceb-practice-heading p,
.ceb-section-heading p {
    color: var(--ceb-muted);
    line-height: 1.7;
}


/* =========================================================
   Mode selection
   ========================================================= */

.ceb-mode-selection {
    display: inline-flex;
    gap: 0.5rem;
    background: #edf3f7;
    border: 1px solid var(--ceb-border);
    border-radius: 14px;
    margin-bottom: 2rem;
    padding: 0.4rem;
}

.ceb-mode-button {
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--ceb-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.93rem;
    font-weight: 700;
    padding: 0.8rem 1.15rem;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.ceb-mode-button:hover {
    color: var(--ceb-navy);
}

.ceb-mode-button.is-active,
.ceb-mode-button[aria-pressed="true"] {
    background: var(--ceb-white);
    box-shadow: 0 4px 12px rgba(22, 50, 79, 0.1);
    color: var(--ceb-teal-dark);
}

.ceb-mode-button:focus-visible,
.ceb-difficulty-button:focus-visible,
.ceb-primary-button:focus-visible,
.ceb-secondary-button:focus-visible,
.ceb-text-button:focus-visible,
.ceb-equation-input:focus-visible,
.ceb-coefficient-input:focus-visible {
    outline: 3px solid rgba(27, 143, 138, 0.28);
    outline-offset: 3px;
}


/* =========================================================
   Random quiz toolbar
   ========================================================= */

.ceb-quiz-mode {
    margin-bottom: 2rem;
}

.ceb-quiz-toolbar {
    align-items: flex-end;
    background: linear-gradient(
        135deg,
        rgba(232, 247, 246, 0.94),
        rgba(237, 245, 251, 0.94)
    );
    border: 1px solid #cfe3e5;
    border-radius: 18px;
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    padding: 1.25rem;
}

.ceb-difficulty-section {
    flex: 1;
}

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

.ceb-difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.ceb-difficulty-button {
    appearance: none;
    background: var(--ceb-white);
    border: 1px solid #bfd5db;
    border-radius: 999px;
    color: var(--ceb-navy);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 750;
    min-width: 88px;
    padding: 0.62rem 1rem;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.ceb-difficulty-button:hover {
    border-color: var(--ceb-teal);
    transform: translateY(-1px);
}

.ceb-difficulty-button.is-active,
.ceb-difficulty-button[aria-pressed="true"] {
    background: var(--ceb-teal);
    border-color: var(--ceb-teal);
    box-shadow: 0 6px 14px rgba(27, 143, 138, 0.2);
    color: var(--ceb-white);
}

.ceb-quiz-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(78px, 1fr));
    gap: 0.65rem;
}

.ceb-quiz-stat {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(199, 218, 224, 0.9);
    border-radius: 12px;
    min-width: 82px;
    padding: 0.7rem 0.8rem;
    text-align: center;
}

.ceb-quiz-stat-label {
    color: var(--ceb-muted);
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 0.15rem;
    text-transform: uppercase;
}

.ceb-quiz-stat strong {
    color: var(--ceb-navy);
    font-size: 1.2rem;
    font-weight: 800;
}

.ceb-quiz-prompt {
    align-items: center;
    background: var(--ceb-white);
    border: 1px solid var(--ceb-border);
    border-radius: 16px;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 1.15rem 1.25rem;
}

.ceb-quiz-prompt h3 {
    font-size: 1.15rem;
    margin: 0;
}

.ceb-quiz-prompt .ceb-card-label {
    margin-bottom: 0.35rem;
}

.ceb-difficulty-badge {
    background: var(--ceb-teal-light);
    border: 1px solid #bfe2df;
    border-radius: 999px;
    color: var(--ceb-teal-dark);
    flex-shrink: 0;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 0.45rem 0.8rem;
    text-transform: uppercase;
}


/* =========================================================
   Custom equation form
   ========================================================= */

.ceb-custom-equation-section {
    background: #f8fbfd;
    border: 1px solid var(--ceb-border);
    border-radius: 18px;
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.ceb-custom-equation-heading {
    margin-bottom: 1.25rem;
}

.ceb-custom-equation-heading h3 {
    font-size: 1.35rem;
}

.ceb-form {
    margin-top: 1rem;
}

.ceb-input-row {
    align-items: stretch;
    display: flex;
    gap: 0.75rem;
}

.ceb-equation-input {
    background: var(--ceb-white);
    border: 1px solid #bfcdd6;
    border-radius: 11px;
    color: var(--ceb-navy);
    flex: 1;
    font-family: inherit;
    font-size: 1rem;
    min-height: 50px;
    min-width: 0;
    padding: 0.8rem 1rem;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ceb-equation-input::placeholder {
    color: #93a3af;
}

.ceb-equation-input:focus {
    border-color: var(--ceb-teal);
    box-shadow: 0 0 0 4px rgba(27, 143, 138, 0.12);
    outline: none;
}

.ceb-input-help {
    color: var(--ceb-muted);
    font-size: 0.84rem;
    line-height: 1.55;
    margin: 0.7rem 0 0;
}


/* =========================================================
   Buttons
   ========================================================= */

.ceb-primary-button,
.ceb-secondary-button {
    align-items: center;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 750;
    justify-content: center;
    min-height: 48px;
    padding: 0.72rem 1.15rem;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.ceb-primary-button {
    background: var(--ceb-teal);
    border: 1px solid var(--ceb-teal);
    color: var(--ceb-white);
}

.ceb-primary-button:hover {
    background: var(--ceb-teal-dark);
    border-color: var(--ceb-teal-dark);
    box-shadow: 0 7px 18px rgba(27, 143, 138, 0.2);
    color: var(--ceb-white);
    transform: translateY(-1px);
}

.ceb-secondary-button {
    background: var(--ceb-white);
    border: 1px solid #bfcdd6;
    color: var(--ceb-navy);
}

.ceb-secondary-button:hover {
    background: var(--ceb-blue-light);
    border-color: #99b3c3;
    color: var(--ceb-navy);
    transform: translateY(-1px);
}

.ceb-primary-button:disabled,
.ceb-secondary-button:disabled,
.ceb-text-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.ceb-text-button {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--ceb-teal-dark);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 750;
    padding: 0.45rem 0;
    text-decoration: underline;
    text-decoration-color: rgba(20, 114, 110, 0.35);
    text-underline-offset: 4px;
}

.ceb-text-button:hover {
    color: var(--ceb-navy);
    text-decoration-color: currentColor;
}


/* =========================================================
   Error and general messages
   ========================================================= */

.ceb-message {
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.55;
    margin-top: 0.8rem;
    padding: 0.85rem 1rem;
}

.ceb-error-message {
    background: var(--ceb-red-light);
    border: 1px solid #efc5c5;
    color: #8d3030;
}

.ceb-success-message {
    background: var(--ceb-green-light);
    border: 1px solid #bfe3d0;
    color: #176a4b;
}

.ceb-warning-message {
    background: var(--ceb-yellow-light);
    border: 1px solid #ecd894;
    color: #79500b;
}


/* =========================================================
   Practice workspace
   ========================================================= */

.ceb-practice {
    border-top: 1px solid var(--ceb-border);
    margin-top: 2rem;
    padding-top: 2rem;
}

.ceb-practice-heading,
.ceb-answer-heading,
.ceb-section-heading {
    align-items: flex-start;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
}

.ceb-practice-heading {
    margin-bottom: 1.5rem;
}

.ceb-practice-heading > div,
.ceb-section-heading > div,
.ceb-answer-heading > div {
    min-width: 0;
}

.ceb-practice-heading h2 {
    font-size: 1.65rem;
}

.ceb-status {
    align-items: center;
    background: var(--ceb-green-light);
    border: 1px solid #b8dfca;
    border-radius: 999px;
    color: var(--ceb-green);
    display: inline-flex;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 800;
    justify-content: center;
    letter-spacing: 0.04em;
    min-height: 34px;
    padding: 0.42rem 0.8rem;
    text-transform: uppercase;
}

.ceb-status-working {
    background: var(--ceb-yellow-light);
    border-color: #ecd894;
    color: var(--ceb-yellow);
}

.ceb-status-error,
.ceb-status-unbalanced {
    background: var(--ceb-red-light);
    border-color: #edc1c1;
    color: var(--ceb-red);
}

.ceb-status-balanced,
.ceb-status-success {
    background: var(--ceb-green-light);
    border-color: #b8dfca;
    color: var(--ceb-green);
}


/* =========================================================
   Interactive equation
   ========================================================= */

.ceb-interactive-equation {
    align-items: center;
    background:
        linear-gradient(
            135deg,
            rgba(237, 245, 251, 0.95),
            rgba(232, 247, 246, 0.95)
        );
    border: 1px solid #c8dce2;
    border-radius: 18px;
    color: var(--ceb-navy);
    display: flex;
    flex-wrap: nowrap;
    font-size: clamp(1rem, 2.3vw, 1.38rem);
    font-weight: 700;
    gap: 0.45rem;
    justify-content: center;
    line-height: 1.4;
    min-height: 120px;
    overflow-x: auto;
    padding: 1.4rem;
    scrollbar-width: thin;
}

.ceb-interactive-equation::-webkit-scrollbar {
    height: 7px;
}

.ceb-interactive-equation::-webkit-scrollbar-thumb {
    background: #aac2cc;
    border-radius: 999px;
}

.ceb-compound,
.ceb-equation-compound,
.ceb-term {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.35rem;
    white-space: nowrap;
}

.ceb-formula,
.ceb-compound-formula {
    white-space: nowrap;
}

.ceb-plus,
.ceb-equation-plus,
.ceb-arrow,
.ceb-equation-arrow {
    color: var(--ceb-muted);
    flex: 0 0 auto;
    font-weight: 800;
    margin: 0 0.15rem;
}

.ceb-arrow,
.ceb-equation-arrow {
    color: var(--ceb-teal-dark);
    font-size: 1.3em;
    margin-inline: 0.35rem;
}

.ceb-coefficient-input {
    appearance: textfield;
    background: var(--ceb-white);
    border: 2px solid #9eb5c2;
    border-radius: 9px;
    color: var(--ceb-navy);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    height: 44px;
    padding: 0.35rem;
    text-align: center;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
    width: 52px;
}

.ceb-coefficient-input::-webkit-outer-spin-button,
.ceb-coefficient-input::-webkit-inner-spin-button {
    margin: 0;
}

.ceb-coefficient-input:focus {
    border-color: var(--ceb-teal);
    box-shadow: 0 0 0 4px rgba(27, 143, 138, 0.13);
    outline: none;
}

.ceb-coefficient-input.is-correct,
.ceb-coefficient-input.correct {
    background: var(--ceb-green-light);
    border-color: var(--ceb-green);
}

.ceb-coefficient-input.is-incorrect,
.ceb-coefficient-input.incorrect {
    background: var(--ceb-red-light);
    border-color: var(--ceb-red);
}

.ceb-coefficient-help {
    color: var(--ceb-muted);
    font-size: 0.84rem;
    line-height: 1.55;
    margin: 0.75rem 0 0;
    text-align: center;
}


/* =========================================================
   Atom count table
   ========================================================= */

.ceb-atom-section {
    margin-top: 2rem;
}

.ceb-section-heading {
    margin-bottom: 1rem;
}

.ceb-section-heading h3 {
    font-size: 1.25rem;
    margin-bottom: 0;
}

.ceb-section-heading > p {
    font-size: 0.86rem;
    margin: 0;
    max-width: 360px;
    text-align: right;
}

.ceb-table-wrapper {
    border: 1px solid var(--ceb-border);
    border-radius: 14px;
    overflow: hidden;
    width: 100%;
}

.ceb-atom-table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.ceb-atom-table th,
.ceb-atom-table td {
    border-bottom: 1px solid var(--ceb-border);
    overflow-wrap: anywhere;
    padding: 0.9rem 0.75rem;
    text-align: center;
    vertical-align: middle;
}

.ceb-atom-table th {
    background: var(--ceb-navy);
    color: var(--ceb-white);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.ceb-atom-table th:first-child,
.ceb-atom-table td:first-child {
    text-align: left;
    width: 24%;
}

.ceb-atom-table th:nth-child(2),
.ceb-atom-table td:nth-child(2),
.ceb-atom-table th:nth-child(3),
.ceb-atom-table td:nth-child(3) {
    width: 23%;
}

.ceb-atom-table th:last-child,
.ceb-atom-table td:last-child {
    width: 30%;
}

.ceb-atom-table tbody tr:last-child td {
    border-bottom: 0;
}

.ceb-atom-table tbody tr:nth-child(even) {
    background: #f8fbfd;
}

.ceb-atom-table td {
    color: var(--ceb-text);
    font-size: 0.92rem;
    font-weight: 650;
}

.ceb-atom-table td:first-child {
    color: var(--ceb-navy);
    font-weight: 800;
}

.ceb-table-status,
.ceb-atom-status {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.69rem;
    font-weight: 800;
    justify-content: center;
    letter-spacing: 0.03em;
    max-width: 100%;
    padding: 0.32rem 0.55rem;
    text-transform: uppercase;
}

.ceb-table-status-balanced,
.ceb-atom-status-balanced,
.ceb-balanced {
    background: var(--ceb-green-light);
    color: var(--ceb-green);
}

.ceb-table-status-unbalanced,
.ceb-atom-status-unbalanced,
.ceb-unbalanced {
    background: var(--ceb-red-light);
    color: var(--ceb-red);
}


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

.ceb-feedback-section {
    background: #f8fbfd;
    border: 1px solid var(--ceb-border);
    border-left: 5px solid var(--ceb-teal);
    border-radius: 13px;
    margin-top: 1.5rem;
    padding: 1.1rem 1.2rem;
}

.ceb-student-feedback {
    color: var(--ceb-text);
    font-size: 0.94rem;
    line-height: 1.65;
}

.ceb-feedback-section.is-success,
.ceb-feedback-success {
    background: var(--ceb-green-light);
    border-color: #b8dfca;
    border-left-color: var(--ceb-green);
}

.ceb-feedback-section.is-error,
.ceb-feedback-error {
    background: var(--ceb-red-light);
    border-color: #edc1c1;
    border-left-color: var(--ceb-red);
}

.ceb-feedback-section.is-hint,
.ceb-feedback-hint {
    background: var(--ceb-yellow-light);
    border-color: #ecd894;
    border-left-color: #d8a12c;
}


/* =========================================================
   Practice controls
   ========================================================= */

.ceb-practice-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.ceb-reveal-controls {
    align-items: center;
    border-top: 1px solid var(--ceb-border);
    display: flex;
    flex-wrap: wrap;
    gap: 1.3rem;
    margin-top: 1.35rem;
    padding-top: 1rem;
}

#nextEquationButton {
    color: var(--ceb-green);
    font-weight: 800;
}


/* =========================================================
   Answer section
   ========================================================= */

.ceb-answer-section {
    background: linear-gradient(
        135deg,
        rgba(234, 247, 240, 0.96),
        rgba(248, 252, 250, 0.98)
    );
    border: 1px solid #badfcb;
    border-radius: 18px;
    margin-top: 1.75rem;
    padding: 1.5rem;
}

.ceb-answer-heading {
    margin-bottom: 1.2rem;
}

.ceb-answer-heading h3 {
    font-size: 1.35rem;
}

.ceb-balanced-equation {
    background: var(--ceb-white);
    border: 1px solid #c7e1d3;
    border-radius: 12px;
    color: var(--ceb-navy);
    font-size: clamp(1.05rem, 2.2vw, 1.4rem);
    font-weight: 800;
    line-height: 1.6;
    overflow-wrap: anywhere;
    padding: 1rem 1.2rem;
    text-align: center;
}

.ceb-explanation {
    color: var(--ceb-text);
    line-height: 1.7;
    margin-top: 1.25rem;
}

.ceb-explanation p:last-child,
.ceb-explanation ul:last-child {
    margin-bottom: 0;
}


/* =========================================================
   Informational cards
   ========================================================= */

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

.ceb-info article {
    background: var(--ceb-white);
    border: 1px solid var(--ceb-border);
    border-radius: 17px;
    box-shadow: 0 10px 28px rgba(22, 50, 79, 0.07);
    padding: 1.6rem;
}

.ceb-info h2 {
    color: var(--ceb-navy);
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 0.7rem;
}

.ceb-info p {
    color: var(--ceb-muted);
    line-height: 1.7;
    margin-bottom: 0;
}


/* =========================================================
   SEO section
   ========================================================= */

.ceb-seo-section {
    background: #eef4f7;
    padding: 5rem 0;
}

.ceb-seo-content {
    background: var(--ceb-white);
    border: 1px solid var(--ceb-border);
    border-radius: 20px;
    box-shadow: 0 12px 34px rgba(22, 50, 79, 0.07);
    margin: 0 auto;
    max-width: 940px;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.ceb-seo-content h2,
.ceb-seo-content h3 {
    color: var(--ceb-navy);
    font-weight: 800;
}

.ceb-seo-content h2 {
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    margin-bottom: 1rem;
}

.ceb-seo-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.7rem;
    margin-top: 2rem;
}

.ceb-seo-content p {
    color: var(--ceb-muted);
    line-height: 1.8;
}

.ceb-seo-links {
    align-items: center;
    border-top: 1px solid var(--ceb-border);
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
}

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

.ceb-resource-link:hover {
    color: var(--ceb-navy);
    text-decoration: underline;
    text-underline-offset: 4px;
}


/* =========================================================
   Hidden elements
   ========================================================= */

[hidden] {
    display: none !important;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {

    .ceb-card {
        padding: 2rem;
    }

    .ceb-quiz-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 1.2rem;
    }

    .ceb-quiz-stats {
        width: 100%;
    }

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

}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 640px) {

    .ceb-section {
        padding: 3.5rem 0.85rem;
    }

    .ceb-card {
        border-radius: 18px;
        padding: 1.2rem;
    }

    .ceb-card-heading {
        margin-bottom: 1.4rem;
    }

    .ceb-card-heading h2 {
        font-size: 1.65rem;
    }

    .ceb-mode-selection {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .ceb-mode-button {
        width: 100%;
    }

    .ceb-quiz-toolbar {
        border-radius: 14px;
        padding: 1rem;
    }

    .ceb-difficulty-buttons {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ceb-difficulty-button {
        min-width: 0;
        padding-left: 0.45rem;
        padding-right: 0.45rem;
        width: 100%;
    }

    .ceb-quiz-stats {
        gap: 0.4rem;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ceb-quiz-stat {
        min-width: 0;
        padding: 0.65rem 0.3rem;
    }

    .ceb-quiz-stat-label {
        font-size: 0.57rem;
        letter-spacing: 0.02em;
    }

    .ceb-quiz-prompt {
        align-items: flex-start;
        flex-direction: column;
    }

    .ceb-custom-equation-section {
        padding: 1.1rem;
    }

    .ceb-input-row {
        flex-direction: column;
    }

    .ceb-input-row .ceb-primary-button {
        width: 100%;
    }

    .ceb-practice {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }

    .ceb-practice-heading,
    .ceb-answer-heading,
    .ceb-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .ceb-section-heading > p {
        max-width: none;
        text-align: left;
    }

    .ceb-status {
        align-self: flex-start;
    }

    .ceb-interactive-equation {
        font-size: 0.98rem;
        gap: 0.3rem;
        justify-content: flex-start;
        min-height: 105px;
        padding: 1rem 0.8rem;
    }

    .ceb-coefficient-input {
        font-size: 0.92rem;
        height: 40px;
        width: 44px;
    }

    /*
     * Keep the entire atom table visible on small screens.
     * There is intentionally no min-width and no horizontal scrolling.
     */
    .ceb-table-wrapper {
        overflow: hidden;
    }

    .ceb-atom-table {
        min-width: 0;
        table-layout: fixed;
        width: 100%;
    }

    .ceb-atom-table th,
    .ceb-atom-table td {
        font-size: 0.72rem;
        line-height: 1.25;
        padding: 0.65rem 0.22rem;
        word-break: normal;
    }

    .ceb-atom-table th {
        font-size: 0.61rem;
        letter-spacing: 0;
    }

    .ceb-atom-table th:first-child,
    .ceb-atom-table td:first-child {
        width: 20%;
    }

    .ceb-atom-table th:nth-child(2),
    .ceb-atom-table td:nth-child(2),
    .ceb-atom-table th:nth-child(3),
    .ceb-atom-table td:nth-child(3) {
        width: 22%;
    }

    .ceb-atom-table th:last-child,
    .ceb-atom-table td:last-child {
        width: 36%;
    }

    .ceb-table-status,
    .ceb-atom-status {
        border-radius: 7px;
        font-size: 0.54rem;
        line-height: 1.15;
        padding: 0.3rem 0.2rem;
        white-space: normal;
    }

    .ceb-feedback-section {
        padding: 1rem;
    }

    .ceb-practice-controls {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ceb-practice-controls .ceb-primary-button,
    .ceb-practice-controls .ceb-secondary-button {
        width: 100%;
    }

    .ceb-reveal-controls {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .ceb-answer-section {
        padding: 1.1rem;
    }

    .ceb-info {
        gap: 1rem;
        padding: 3.5rem 1rem;
    }

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

    .ceb-seo-section .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .ceb-seo-content {
        border-radius: 16px;
        padding: 1.3rem;
    }

    .ceb-seo-links {
        align-items: flex-start;
        flex-direction: column;
    }

}


/* =========================================================
   Very small screens
   ========================================================= */

@media (max-width: 390px) {

    .ceb-card {
        padding: 1rem;
    }

    .ceb-difficulty-button {
        font-size: 0.76rem;
    }

    .ceb-quiz-stat strong {
        font-size: 1rem;
    }

    .ceb-interactive-equation {
        font-size: 0.9rem;
    }

    .ceb-coefficient-input {
        height: 38px;
        width: 40px;
    }

    .ceb-atom-table th,
    .ceb-atom-table td {
        font-size: 0.65rem;
        padding-left: 0.12rem;
        padding-right: 0.12rem;
    }

    .ceb-atom-table th {
        font-size: 0.55rem;
    }

}