@scope (#original-content) {

/* ── Outer content wrapper (educational sections — white background) ── */
#mtg-page {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: #fff;
    color: #1a1a2e;
    max-width: 90%;
    margin: 0 auto;
    padding: 0 16px 40px;
    box-sizing: border-box;
    line-height: 1.75
}
#mtg-page * { box-sizing: border-box }
#mtg-page h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 900;
    color: #1a1a2e;
    margin: 0 0 .5em;
    line-height: 1.2
}
#mtg-page h2 {
    font-size: clamp(1.1rem, 2.8vw, 1.45rem);
    font-weight: 900;
    color: #1a1a2e;
    margin: 2.2rem 0 .75rem;
    padding-left: .9rem;
    border-left: 5px solid #ef4444
}
#mtg-page h3 {
    font-size: clamp(.95rem, 2.3vw, 1.15rem);
    font-weight: 800;
    color: #1a1a2e;
    margin: 1.5rem 0 .5rem
}
#mtg-page p { font-size: 1rem; font-weight: 500; margin-bottom: .95rem; color: #1f2937 }
#mtg-page ul, #mtg-page ol { padding-left: 1.4rem; margin-bottom: 1rem }
#mtg-page li { font-size: 1rem; font-weight: 500; margin-bottom: .45rem; color: #1f2937 }
#mtg-page strong { font-weight: 800 }
#mtg-page a { color: #2563eb; text-decoration: none }
#mtg-page a:hover { text-decoration: underline }
#mtg-page sup, #mtg-page sub { font-size: .72em }

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

/* Topic badges */
.mtg-badge { display: inline-block; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 6px; padding: 3px 10px; font-size: .78rem; font-weight: 800; color: #ef4444; margin: 0 4px 6px 0 }

/* Game wrapper */
.mtg-game-wrap {
    border-radius: 16px;
    overflow: hidden;
    margin: 1.5rem 0 2rem;
    box-shadow: 0 8px 32px rgba(75,108,183,.3)
}

/* Callouts */
.mtg-note { background: #eff6ff; border-left: 5px solid #3b82f6; border-radius: 8px; padding: 14px 18px; margin: 1rem 0; font-size: .97rem; font-weight: 600; color: #1f2937 }
.mtg-tip  { background: #fffbeb; border-left: 5px solid #f59e0b; border-radius: 8px; padding: 14px 18px; margin: 1rem 0; font-size: .97rem; font-weight: 600; color: #1f2937 }
.mtg-key  { background: #f0fdf4; border-left: 5px solid #22c55e; border-radius: 8px; padding: 14px 18px; margin: 1rem 0; font-size: .97rem; font-weight: 600; color: #1f2937 }

/* Math formula box */
.mtg-formula {
    background: #f0f9ff;
    border-left: 5px solid #3b82f6;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 1rem 0
}
.mtg-formula .mtg-f-tag { font-size: .78rem; font-weight: 900; color: #1d4ed8; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px }
.mtg-formula .mtg-f-body { font-size: 1.1rem; font-weight: 800; color: #1a1a2e; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; line-height: 2.4 }
.mtg-formula .mtg-f-note { font-size: .84rem; color: #4b5563; font-weight: 600; margin-top: 8px; border-top: 1px solid #bfdbfe; padding-top: 8px }

/* CSS stacked fractions */
.mtg-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 4px; font-weight: 900; line-height: 1 }
.mtg-frac .mtg-num { padding: 0 6px; border-bottom: 2.5px solid currentColor; font-size: 1em; line-height: 1.5 }
.mtg-frac .mtg-den { padding: 0 6px; font-size: 1em; line-height: 1.5 }

/* Property cards grid */
.mtg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); gap: 14px; margin: 1rem 0 }
.mtg-card { background: #f8faff; border: 1.5px solid #dde5ff; border-radius: 12px; padding: 16px 18px }
.mtg-card-head { font-size: .95rem; font-weight: 900; color: #ef4444; border-bottom: 2px solid #ef4444; padding-bottom: 7px; margin-bottom: 10px }

/* Times table display */
.mtg-tbl-wrap { overflow-x: auto; margin: 1rem 0 }
.mtg-tbl { border-collapse: collapse; font-size: .85rem; min-width: 520px }
.mtg-tbl th { background: #1a1a2e; color: #fff; font-weight: 800; padding: 8px 10px; text-align: center; min-width: 36px }
.mtg-tbl td { padding: 7px 10px; border: 1px solid #e5e7eb; font-weight: 700; text-align: center; color: #1a1a2e; min-width: 36px }
.mtg-tbl tr:nth-child(even) td { background: #f8faff }
.mtg-tbl td.mtg-diag { background: #fef2f2; color: #ef4444; font-weight: 900 }
.mtg-tbl td.mtg-sq { background: #fff7ed; color: #b45309; font-weight: 900 }

/* Worked examples */
.mtg-example { background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 12px; padding: 18px 20px; margin: 1.2rem 0 }
.mtg-example h3 { color: #15803d; margin-top: 0 }
.mtg-step { display: flex; gap: 10px; margin: 8px 0; align-items: flex-start }
.mtg-step-n { min-width: 28px; height: 28px; background: #ef4444; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: .82rem; flex-shrink: 0; margin-top: 1px }
.mtg-step-body { font-size: .96rem; font-weight: 600; color: #1f2937; padding: 6px 12px; background: #fff; border-radius: 6px; border: 1px solid #dde5ff; flex: 1 }

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

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

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

@media (max-width: 600px) {
    .mtg-cards { grid-template-columns: 1fr }
    #mtg-page { padding: 0 12px 30px }
}


        .mult-game-container * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }
        .mult-game-container {
            background: linear-gradient(135deg, #4b6cb7, #182848);
            color: white;
            border-radius: 12px;
            padding: 20px;
            max-width: 100%;
            margin: 0 auto;
            box-shadow: 0 8px 25px rgba(0,0,0,0.3);
            position: relative;
            overflow: hidden;
        }
        .mult-game-header { text-align: center; margin-bottom: 15px }
        .mult-game-title {
            font-size: 2rem;
            margin-bottom: 5px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
            background: linear-gradient(to right,#fff,#ddd);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .mult-game-subtitle { font-size: 1rem; margin-bottom: 10px; opacity: .9 }
        .mult-game-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 15px; gap: 10px }
        .mult-game-dropdown { position: relative; display: inline-block }
        .mult-game-dropdown-content { display: none; position: absolute; background-color: #344e86; min-width: 150px; box-shadow: 0 8px 16px rgba(0,0,0,.5); z-index: 1; border-radius: 5px; top: 40px; left: 0 }
        .mult-game-dropdown-content a { color: white; padding: 8px 12px; text-decoration: none; display: block; font-size: .9rem; transition: background-color .2s; cursor: pointer }
        .mult-game-dropdown-content a:hover { background-color: rgba(255,255,255,.1) }
        .mult-game-dropdown:hover .mult-game-dropdown-content { display: block }
        .mult-game-button { background-color: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); color: white; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-size: .9rem; font-weight: bold; transition: all .3s ease; min-width: 90px; text-align: center }
        .mult-game-button:hover { background-color: rgba(255,255,255,.25); transform: translateY(-2px) }
        .mult-game-button:active { transform: translateY(1px) }
        .mult-game-button:disabled { opacity: .5; cursor: not-allowed; transform: none }
        .mult-game-stats { display: flex; flex-wrap: wrap; justify-content: space-around; margin-bottom: 15px; gap: 5px }
        .mult-game-stat-box { background-color: rgba(255,255,255,.1); padding: 8px 15px; border-radius: 8px; min-width: 100px; text-align: center; flex-grow: 1; border: 1px solid rgba(255,255,255,.1); transition: all .3s ease }
        .mult-game-stat-box:hover { background-color: rgba(255,255,255,.2) }
        .mult-game-stat-label { font-size: .8rem; opacity: .8; margin-bottom: 3px }
        .mult-game-stat-value { font-size: 1.3rem; font-weight: bold }
        .mult-game-area { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-bottom: 20px }
        .mult-game-equation { font-size: 2.5rem; font-weight: bold; text-align: center; background-color: rgba(0,0,0,.3); padding: 20px; border-radius: 10px; min-width: 200px; box-shadow: inset 0 0 10px rgba(0,0,0,.2) }
        .mult-game-answer-input { font-size: 1.8rem !important; width: 150px !important; text-align: center; padding: 10px; border: 2px solid rgba(255,255,255,.2) !important; border-radius: 8px !important; background-color: rgba(255,255,255,.1) !important; color: white !important; outline: none !important; transition: all .3s ease; box-shadow: none !important }
        .mult-game-answer-input:focus { border-color: rgba(255,255,255,.5) !important; background-color: rgba(255,255,255,.2) !important; box-shadow: 0 0 8px rgba(255,255,255,.3) !important }
        .mult-game-submit { font-size: 1.2rem; padding: 10px 25px; background-color: rgba(52,152,219,.8); border: none; border-radius: 8px; color: white; font-weight: bold; cursor: pointer; transition: all .3s ease }
        .mult-game-submit:hover { background-color: rgba(52,152,219,1); transform: translateY(-2px) }
        .mult-game-submit:active { transform: translateY(1px) }
        .mult-game-feedback { height: 50px; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; font-weight: bold; margin-top: 10px }
        .mult-game-correct { color: #2ecc71; animation: mgPulse .5s }
        .mult-game-incorrect { color: #e74c3c; animation: mgShake .5s }
        @keyframes mgPulse { 0%{transform:scale(1)} 50%{transform:scale(1.2)} 100%{transform:scale(1)} }
        @keyframes mgShake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-10px)} 40%,80%{transform:translateX(10px)} }
        .mult-game-table-view { display: grid; grid-template-columns: repeat(11,1fr); gap: 2px; width: 100%; margin: 20px 0; opacity: 0; height: 0; overflow: hidden; transition: opacity .5s, height .5s }
        .mult-game-table-view.active { opacity: 1; height: auto; max-height: 500px; overflow-y: auto }
        .mult-table-cell { display: flex; justify-content: center; align-items: center; height: 40px; background-color: rgba(255,255,255,.1); border-radius: 4px; font-weight: bold; font-size: .9rem; transition: all .2s ease }
        .mult-table-cell:hover { background-color: rgba(255,255,255,.3); transform: scale(1.05); z-index: 1 }
        .mult-table-header { background-color: rgba(52,152,219,.7) }
        .mult-table-result { background-color: rgba(255,255,255,.15) }
        .mult-table-highlighted { background-color: rgba(243,156,18,.7); animation: mgHighlight 2s infinite }
        @keyframes mgHighlight { 0%,100%{background-color:rgba(243,156,18,.7)} 50%{background-color:rgba(243,156,18,.4)} }
        .mult-game-timer-bar-container { width: 100%; height: 8px; background-color: rgba(255,255,255,.1); border-radius: 4px; margin-bottom: 15px; overflow: hidden }
        .mult-game-timer-bar { height: 100%; background: linear-gradient(to right,#4caf50,#8bc34a); width: 100%; border-radius: 4px; transition: width .1s linear }
        .mult-game-modal { display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,.8); z-index: 100; flex-direction: column; justify-content: center; align-items: center; padding: 20px; text-align: center; border-radius: 12px; opacity: 0; transition: opacity .3s ease }
        .mult-game-modal.active { display: flex; opacity: 1 }
        .mult-game-modal h2 { font-size: 2rem; margin-bottom: 15px; color: #fff }
        .mult-game-modal p { font-size: 1.1rem; margin-bottom: 20px; max-width: 80%; line-height: 1.5 }
        .mult-game-high-scores { background-color: rgba(255,255,255,.1); padding: 15px; border-radius: 10px; width: 80%; max-width: 400px; margin-bottom: 20px; max-height: 200px; overflow-y: auto }
        .mult-game-score-item { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.1) }
        .mult-game-score-item:last-child { border-bottom: none }
        .mult-game-score-rank { color: gold; font-weight: bold }
        .mult-game-notification { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); background-color: rgba(0,0,0,.7); color: white; padding: 10px 20px; border-radius: 5px; z-index: 50; opacity: 0; transition: opacity .3s ease; pointer-events: none }
        .mult-game-notification.active { opacity: 1 }
        .mult-game-volume-control { position: absolute; top: 10px; left: 10px; background-color: rgba(0,0,0,.3); width: 30px; height: 30px; display: flex; justify-content: center; align-items: center; border-radius: 50%; cursor: pointer; font-size: 1.2rem }
        .mult-game-table-toggle { display: flex; justify-content: center; margin-top: 15px }
        .mult-game-grid-settings { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; padding: 15px; background-color: rgba(0,0,0,.2); border-radius: 8px; width: 100% }
        .mult-game-range-container { display: flex; flex-direction: column; width: 45%; min-width: 150px }
        .mult-game-range-label { font-size: .9rem; margin-bottom: 5px }
        .mult-game-range-input { display: flex; gap: 10px; align-items: center }
        .mult-game-range-input input { width: 50px !important; text-align: center; padding: 5px; border-radius: 4px; border: 1px solid rgba(255,255,255,.2) !important; background-color: rgba(255,255,255,.1) !important; color: white !important; font-size: .9rem; box-shadow: none !important }
        .mult-game-achievement { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: rgba(0,0,0,.7); color: white; padding: 10px 15px; border-radius: 5px; z-index: 50; display: flex; align-items: center; gap: 10px; opacity: 0; transition: opacity .3s ease }
        .mult-game-achievement.active { opacity: 1; animation: mgSlideUp .5s ease, mgFadeOut .5s ease 4s forwards }
        @keyframes mgSlideUp { 0%{transform:translate(-50%,20px)} 100%{transform:translate(-50%,0)} }
        @keyframes mgFadeOut { 0%{opacity:1} 100%{opacity:0} }
        .mult-game-achievement-icon { font-size: 1.5rem; color: gold }
        .mult-game-buttons { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px }
        @media (max-width:600px) {
            .mult-game-title { font-size: 1.7rem }
            .mult-game-equation { font-size: 2rem }
            .mult-game-answer-input { font-size: 1.5rem !important; width: 120px !important }
            .mult-game-stat-box { min-width: 70px }
            .mult-game-range-container { width: 100% }
            .mult-table-cell { height: 35px; font-size: .8rem }
        }
        .mult-game-container.dark-theme { background: linear-gradient(135deg,#232526,#414345) }
        .mult-game-container.ocean-theme { background: linear-gradient(135deg,#1A2980,#26D0CE) }
        .mult-game-container.forest-theme { background: linear-gradient(135deg,#134E5E,#71B280) }
    
}

#multGameVolumeControl {width:auto;padding-inline:.5rem;font-size:1rem;}
#multGameVolumeControl::after {content:attr(aria-label);}
