@scope (#original-content) {

#egc-wrap {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: #fff;
    color: #1a1a2e;
    line-height: 1.72;
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 20px
}
#egc-wrap * { box-sizing: border-box }

#egc-wrap h1 {
    font-size: clamp(1.5rem, 4vw, 2.3rem);
    font-weight: 900;
    color: #1a1a2e;
    margin-bottom: .35em;
    line-height: 1.22
}
#egc-wrap h2 {
    font-size: clamp(1.1rem, 3vw, 1.45rem);
    font-weight: 900;
    color: #1a1a2e;
    margin-top: 2.6rem;
    margin-bottom: .8rem;
    padding-left: .85rem;
    border-left: 5px solid #ef4444
}
#egc-wrap h3 {
    font-size: clamp(.98rem, 2.5vw, 1.18rem);
    font-weight: 800;
    color: #1a1a2e;
    margin-top: 1.6rem;
    margin-bottom: .5rem
}
#egc-wrap p { font-size: 1rem; font-weight: 500; margin-bottom: 1rem; color: #2a2a2a }
#egc-wrap ul, #egc-wrap ol { padding-left: 1.4rem; margin-bottom: 1rem }
#egc-wrap li { font-size: 1rem; font-weight: 500; margin-bottom: .52rem; color: #2a2a2a }
#egc-wrap strong { font-weight: 800 }
#egc-wrap a { color: #2563eb; text-decoration: none }
#egc-wrap a:hover { text-decoration: underline }

/* TOC */
.egc-toc {
    background: #f8faff;
    border: 1.5px solid #dde5ff;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 1.5rem 0
}
.egc-toc strong {
    font-size: .9rem; font-weight: 900; text-transform: uppercase;
    letter-spacing: .04em; color: #374151; display: block; margin-bottom: 10px
}
.egc-toc ol { margin: 0; padding-left: 1.3rem }
.egc-toc li { font-size: .9rem; font-weight: 700; margin-bottom: 5px }

/* CARD */
.egc-card {
    background: #f8faff;
    border: 1.5px solid #dde5ff;
    border-radius: 14px;
    padding: 24px 20px;
    margin: 1.5rem 0
}
.egc-card-title { text-align: center; font-size: 1.2rem; font-weight: 900; color: #ef4444; margin: 0 0 4px }
.egc-card-sub { text-align: center; font-size: .88rem; color: #6b7280; font-weight: 600; margin-bottom: 20px }

/* QUICK TOTAL BUTTONS */
.egc-quick-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px }
.egc-quick-lbl { font-size: .82rem; font-weight: 800; color: #6b7280; white-space: nowrap }
.egc-total-btn {
    background: #f1f5f9; border: 1.5px solid #dce0e8; border-radius: 7px;
    padding: 7px 14px; font-size: .87rem; font-weight: 800; color: #374151;
    cursor: pointer; transition: all .2s
}
.egc-total-btn.active, .egc-total-btn:hover { background: #ef4444; color: #fff; border-color: #ef4444 }

/* INPUT GRID */
.egc-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px
}
.egc-field label {
    display: block;
    font-size: .85rem;
    font-weight: 800;
    color: #374151;
    margin-bottom: 6px
}
.egc-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 1.1rem;
    font-weight: 800;
    border: 2px solid #dce0e8;
    border-radius: 8px;
    background: #fff;
    color: #1a1a2e;
    outline: none;
    transition: border-color .2s;
    -webkit-appearance: none;
    appearance: none
}
.egc-input:focus { border-color: #ef4444 }

/* WRONG COUNTER ROW */
.egc-counter-row {
    display: flex;
    gap: 10px;
    align-items: center
}
.egc-counter-row .egc-input { flex: 1; text-align: center }
.egc-pm-btn {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    font-weight: 900;
    border: 2px solid #dce0e8;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
    user-select: none
}
.egc-pm-btn:hover { background: #ef4444; color: #fff; border-color: #ef4444 }
.egc-pm-btn:active { transform: scale(.95) }

/* ROUNDING CONTROLS */
.egc-round-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center }
.egc-round-lbl { font-size: .82rem; font-weight: 800; color: #6b7280; white-space: nowrap }
.egc-round-btn {
    background: #f1f5f9; border: 1.5px solid #dce0e8; border-radius: 7px;
    padding: 6px 14px; font-size: .84rem; font-weight: 800; color: #374151;
    cursor: pointer; transition: all .2s
}
.egc-round-btn.active, .egc-round-btn:hover { background: #1a1a2e; color: #fff; border-color: #1a1a2e }

/* RESULT BOX */
.egc-result-box {
    display: none;
    background: #fff;
    border: 2.5px solid #ef4444;
    border-radius: 14px;
    padding: 22px 16px;
    margin-top: 18px;
    text-align: center
}
.egc-pct-big {
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 900;
    color: #ef4444;
    line-height: 1;
    margin: 4px 0
}
.egc-fraction {
    font-size: 1.1rem;
    font-weight: 800;
    color: #6b7280;
    margin-bottom: 10px
}
.egc-result-middle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 10px 0
}
.egc-grade-display {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    min-width: 64px
}
.egc-grade-a  { color: #16a34a }
.egc-grade-b  { color: #2563eb }
.egc-grade-c  { color: #d97706 }
.egc-grade-d  { color: #ea580c }
.egc-grade-f  { color: #dc2626 }
.egc-grade-divider { width: 2px; height: 48px; background: #e5e7eb; flex-shrink: 0 }
.egc-grade-label { font-size: 1.05rem; font-weight: 800; color: #374151; text-align: left }
.egc-pass-pill {
    display: inline-block;
    border-radius: 20px;
    padding: 5px 18px;
    font-size: .95rem;
    font-weight: 900;
    margin-top: 10px
}
.egc-pass { background: #f0fdf4; border: 1.5px solid #86efac; color: #16a34a }
.egc-fail  { background: #fef2f2; border: 1.5px solid #fca5a5; color: #dc2626 }

/* ACTION ROW */
.egc-action-row {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; justify-content: center
}
.egc-act-btn {
    padding: 9px 20px; border-radius: 8px; font-size: .88rem; font-weight: 900;
    cursor: pointer; border: 2px solid #e5e7eb; background: #f9fafb; color: #374151; transition: all .2s
}
.egc-act-btn:hover { background: #f3f4f6; border-color: #d1d5db }
.egc-act-btn--red { background: #ef4444; color: #fff; border-color: #ef4444 }
.egc-act-btn--red:hover { background: #dc2626; border-color: #dc2626 }
.egc-act-btn--blue { background: #2563eb; color: #fff; border-color: #2563eb }
.egc-act-btn--blue:hover { background: #1d4ed8; border-color: #1d4ed8 }

/* CHART TOGGLE BUTTON */
.egc-chart-toggle-row { text-align: center; margin: 18px 0 8px }
.egc-chart-toggle-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 24px; background: #1a1a2e; color: #fff;
    border: none; border-radius: 9px; font-size: .95rem; font-weight: 900;
    cursor: pointer; transition: background .2s
}
.egc-chart-toggle-btn:hover { background: #2d2d4e }

/* CHART SECTION */
#egc-chart-section { display: none; margin-top: 14px }
.egc-chart-title {
    font-size: .95rem; font-weight: 900; color: #1a1a2e;
    text-align: center; margin-bottom: 10px
}
.egc-tbl-wrap { overflow-x: auto; margin: 0 0 10px }
.egc-tbl {
    width: 100%; border-collapse: collapse; font-size: .9rem
}
.egc-tbl th {
    background: #1a1a2e; color: #fff; font-weight: 800;
    padding: 10px 14px; text-align: center; white-space: nowrap
}
.egc-tbl td {
    padding: 7px 14px; border-bottom: 1px solid #e5e7eb;
    font-weight: 600; color: #1a1a2e; text-align: center
}
.egc-tbl tr.egc-current-row td {
    outline: 2.5px solid #ef4444;
    outline-offset: -2.5px;
    font-weight: 900
}
.egc-row-a td { background: #f0fdf4 }
.egc-row-b td { background: #eff6ff }
.egc-row-c td { background: #fffbeb }
.egc-row-d td { background: #fff7ed }
.egc-row-f td { background: #fef2f2 }

/* TEACHER QUICK GRADER */
.egc-teacher-card {
    background: #1a1a2e;
    border-radius: 14px;
    padding: 24px 20px;
    margin: 1.5rem 0;
    color: #fff
}
.egc-teacher-title {
    text-align: center; font-size: 1rem; font-weight: 900;
    text-transform: uppercase; letter-spacing: .06em;
    color: #fca5a5; margin-bottom: 16px
}
.egc-teacher-total-row {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px; justify-content: center; flex-wrap: wrap
}
.egc-teacher-total-row label { font-size: .85rem; font-weight: 800; color: #9ca3af }
.egc-teacher-input {
    width: 90px; padding: 10px 12px; font-size: 1.2rem; font-weight: 900;
    border: 2px solid #374151; border-radius: 8px; background: #2d2d4e; color: #fff;
    text-align: center; outline: none; transition: border-color .2s;
    -webkit-appearance: none; appearance: none
}
.egc-teacher-input:focus { border-color: #ef4444 }
.egc-teacher-wrong-row {
    display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 18px
}
.egc-teacher-pm {
    width: 56px; height: 56px; font-size: 1.8rem; font-weight: 900;
    border: 2px solid #374151; border-radius: 10px; background: #2d2d4e;
    color: #fff; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all .2s; user-select: none; flex-shrink: 0
}
.egc-teacher-pm:hover { background: #ef4444; border-color: #ef4444 }
.egc-teacher-pm:active { transform: scale(.93) }
.egc-teacher-wrong-display {
    text-align: center; min-width: 80px
}
.egc-teacher-wrong-num {
    font-size: 3rem; font-weight: 900; color: #fff; line-height: 1
}
.egc-teacher-wrong-lbl { font-size: .78rem; font-weight: 700; color: #9ca3af; text-transform: uppercase }
.egc-teacher-score {
    text-align: center; padding: 16px; background: #2d2d4e;
    border-radius: 10px; margin-bottom: 12px
}
.egc-teacher-pct { font-size: 3.5rem; font-weight: 900; color: #ef4444; line-height: 1 }
.egc-teacher-grade { font-size: 1.8rem; font-weight: 900; margin-top: 4px }
.egc-teacher-fraction { font-size: .9rem; font-weight: 700; color: #9ca3af; margin-top: 4px }
.egc-teacher-reset-btn {
    display: block; width: 100%; padding: 10px; background: #374151;
    color: #fff; border: none; border-radius: 8px; font-size: .9rem; font-weight: 900;
    cursor: pointer; transition: background .2s
}
.egc-teacher-reset-btn:hover { background: #4b5563 }

/* THRESHOLD CARD */
.egc-thresh-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 14px 0
}
.egc-thresh-field label { display: block; font-size: .82rem; font-weight: 800; color: #374151; margin-bottom: 5px }
.egc-thresh-field .egc-input { font-size: .95rem }

/* FORMULA BOX */
.f-box {
    background: #f0f9ff; border-left: 5px solid #3b82f6; border-radius: 8px;
    padding: 16px 20px; margin: 1rem 0
}
.f-box .f-tag { font-weight: 900; font-size: .8rem; color: #1d4ed8; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px }
.f-box .f-body { font-size: 1rem; font-weight: 700; color: #1a1a2e }
.f-box .f-note { font-size: .82rem; color: #4b5563; font-weight: 600; margin-top: 6px }

/* CALLOUTS */
.c-yellow { background: #fffbeb; border-left: 5px solid #f59e0b; border-radius: 8px; padding: 14px 18px; margin: 1rem 0; font-size: .96rem; font-weight: 600 }
.c-green  { background: #f0fdf4; border-left: 5px solid #22c55e; border-radius: 8px; padding: 14px 18px; margin: 1rem 0; font-size: .96rem; font-weight: 600 }
.c-blue   { background: #eff6ff; border-left: 5px solid #3b82f6; border-radius: 8px; padding: 14px 18px; margin: 1rem 0; font-size: .96rem; font-weight: 600 }

/* EXAMPLES GRID */
.egc-ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 1rem 0 }
.egc-ex-card { background: #f8faff; border: 1.5px solid #dde5ff; border-radius: 10px; padding: 16px }
.egc-ex-badge { font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: #ef4444; margin-bottom: 8px }
.egc-ex-row { display: flex; justify-content: space-between; font-size: .85rem; padding: 3px 0; border-bottom: 1px solid #e5e7eb }
.egc-ex-row:last-of-type { border-bottom: none }
.egc-ex-key { font-weight: 600; color: #6b7280 }
.egc-ex-val { font-weight: 800; color: #1a1a2e }
.egc-ex-result { text-align: center; margin-top: 10px; font-size: 1.6rem; font-weight: 900; color: #ef4444 }
.egc-ex-grade { text-align: center; font-size: .82rem; font-weight: 700; color: #6b7280 }

/* COMPARISON TABLE */
.egc-comp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1rem 0 }
.egc-comp-card { background: #f8faff; border: 1.5px solid #dde5ff; border-radius: 10px; padding: 16px }
.egc-comp-card h3 { margin-top: 0; font-size: .95rem; color: #ef4444 }
.egc-comp-card p { font-size: .88rem; font-weight: 500; color: #374151; margin: 0 }

/* STEP LIST */
.step-list { counter-reset: sc; list-style: none; padding: 0 }
.step-list li {
    counter-increment: sc; display: flex; gap: 14px; align-items: flex-start;
    padding: 13px 0; border-bottom: 1px solid #f1f5f9
}
.step-list li::before {
    content: counter(sc); min-width: 32px; height: 32px; background: #ef4444;
    color: #fff; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-weight: 900; font-size: .9rem; flex-shrink: 0; margin-top: 2px
}
.step-list li .sb { flex: 1 }
.step-list li .st { font-weight: 900; font-size: 1rem; color: #1a1a2e; margin-bottom: 3px }
.step-list li .sd { font-size: .92rem; font-weight: 500; color: #4b5563; margin: 0 }

/* WHAT-IF CARDS */
.egc-wi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 1rem 0 }
.egc-wi-card { background: #f8faff; border: 1.5px solid #dde5ff; border-radius: 10px; padding: 14px }
.egc-wi-q { font-size: .78rem; font-weight: 800; color: #6b7280; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px }
.egc-wi-a { font-size: 1.1rem; font-weight: 900; color: #ef4444 }

/* FAQ */
.egc-faq-item { border-bottom: 1px solid #e5e7eb; padding: 0 }
.egc-faq-q {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 4px; cursor: pointer; font-size: 1rem; font-weight: 800;
    color: #1a1a2e; gap: 12px; user-select: none
}
.egc-faq-q:hover { color: #ef4444 }
.egc-faq-icon { font-size: 1.3rem; font-weight: 700; color: #ef4444; flex-shrink: 0; line-height: 1 }
.egc-faq-a { display: none; padding: 0 4px 14px; font-size: .96rem; font-weight: 500; color: #374151; line-height: 1.7 }

/* RELATED LINKS */
.egc-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 1rem 0 }
.egc-related-link {
    background: #f8faff; border: 1.5px solid #dde5ff; border-radius: 8px;
    padding: 12px 16px; font-size: .9rem; font-weight: 800; color: #2563eb;
    text-decoration: none; display: block; transition: all .2s
}
.egc-related-link:hover { background: #eff6ff; border-color: #2563eb; text-decoration: none }

/* DISCLAIMER */
.egc-disclaimer {
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 14px 18px; margin-top: 2.5rem; font-size: .84rem; font-weight: 600; color: #6b7280
}
.egc-disclaimer strong { color: #374151 }

/* MOBILE */
@media (max-width: 560px) {
    .egc-input-grid { grid-template-columns: 1fr }
    .egc-comp-grid  { grid-template-columns: 1fr }
    .egc-teacher-pm { width: 50px; height: 50px; font-size: 1.5rem }
    .egc-teacher-pct { font-size: 2.8rem }
    .egc-teacher-wrong-num { font-size: 2.4rem }
}
@media (max-width: 400px) {
    #egc-wrap { padding: 18px 12px }
    .egc-pct-big { font-size: 3rem }
}

/* PRINT HELPERS */
@media print {
    .egc-card, .egc-teacher-card, .egc-action-row { display: none !important }
    #egc-chart-section { display: block !important }
}

}
