/* KishMat 58.56 — responsive visual system, luminous companion and accessible report drawer.
   Presentation only: no changes to puzzle scoring, board library, achievements or reward APIs. */
.mastery-shell{--km-surface:#ffffff;--km-surface-soft:#f0faf5;--km-text:#173d32;--km-muted:#547166;--km-border:#cce2d7;--km-shine:#24bd90;--km-gold:#e6a943}
.mastery-shell .mastery-hero-art{width:clamp(220px,25vw,295px);height:275px;overflow:visible}
.mastery-shell .mastery-intro{min-height:290px;overflow:hidden;position:relative}
.mastery-shell .mastery-mascot-hero{position:absolute;inset:0;animation:none!important;filter:none;display:grid;place-items:center;pointer-events:none;z-index:2}
.mastery-companion-svg{display:block;width:100%;height:100%;overflow:visible;filter:drop-shadow(0 14px 14px #0c4b3e40)}
.mastery-mascot-hero .mastery-companion-svg{height:275px;width:min(100%,270px);animation:km-companion-float 3.6s ease-in-out infinite;will-change:transform}
.mastery-mascot-hero:before{content:'';position:absolute;width:195px;height:195px;top:30px;right:50%;transform:translateX(50%);border-radius:50%;background:radial-gradient(circle,#b9f9d7a3 0%,#8ee4cf40 58%,transparent 75%);box-shadow:0 0 42px #9ee8c86e}
.mastery-mascot-hero[data-mood="happy"] .mastery-companion-svg,.mastery-mascot-hero[data-mood="victory"] .mastery-companion-svg{animation:km-companion-cheer .55s ease-out 2}
.mastery-mascot-hero[data-mood="oops"] .mastery-companion-svg{animation:km-companion-try .35s ease-in-out 2}
.mastery-mascot-hero .mastery-companion-star{transform-origin:186px 67px;animation:km-companion-glimmer 2.8s ease-in-out infinite}
.mastery-companion-svg .companion-eye,.mastery-companion-svg .companion-mouth,.mastery-companion-svg .mastery-companion-arm{transition:transform .22s ease,opacity .22s ease;transform-box:fill-box;transform-origin:center}
[data-mastery-mascot][data-mood="thinking"] .companion-eye{transform:translateY(-3px) scaleY(.75)}
[data-mastery-mascot][data-mood="thinking"] .companion-mouth{transform:scale(.45)}
[data-mastery-mascot][data-mood="happy"] .companion-eye,[data-mastery-mascot][data-mood="victory"] .companion-eye{transform:scaleY(.55)}
[data-mastery-mascot][data-mood="happy"] .companion-mouth,[data-mastery-mascot][data-mood="victory"] .companion-mouth{transform:scale(1.35,1.3) translateY(-2px)}
[data-mastery-mascot][data-mood="oops"] .companion-mouth{transform:rotate(180deg) translateY(-7px) scale(.75)}
[data-mastery-mascot][data-mood="victory"] .companion-arm-left{transform:rotate(-25deg) translateY(-5px)}
[data-mastery-mascot][data-mood="victory"] .companion-arm-right{transform:rotate(25deg) translateY(-5px)}
@keyframes km-companion-float{0%,100%{transform:translateY(1px) rotate(-1.5deg)}50%{transform:translateY(-8px) rotate(1.5deg)}}
@keyframes km-companion-cheer{0%,100%{transform:translateY(0) rotate(0)}35%{transform:translateY(-23px) rotate(-8deg)}65%{transform:translateY(-8px) rotate(6deg)}}
@keyframes km-companion-try{0%,100%{transform:rotate(0)}25%{transform:rotate(-7deg)}75%{transform:rotate(7deg)}}
@keyframes km-companion-glimmer{0%,100%{transform:scale(.85);opacity:.55}50%{transform:scale(1.2);opacity:1}}
/* Give the mascot an actual portrait within lessons, not the old tiny font glyph. */
.mastery-shell .mastery-mascot-assistant{display:flex;align-items:center;gap:14px;padding:12px 14px;min-height:114px;margin-bottom:14px;background:linear-gradient(120deg,#e6fff2,#e8f5ff);border:1px solid #b6e6d3;border-radius:21px;box-shadow:0 8px 24px #16795616;position:relative;overflow:hidden}
.mastery-shell .mastery-assistant-pawn{width:105px;min-width:105px;height:112px;display:grid;place-items:center;animation:none;flex:0 0 105px;position:relative}
.mastery-shell .mastery-assistant-pawn .mastery-companion-svg{width:100%;height:100%;animation:km-companion-float 3.6s ease-in-out infinite}
.mastery-shell .mastery-mascot-assistant[data-mood="happy"] .mastery-companion-svg,.mastery-shell .mastery-mascot-assistant[data-mood="victory"] .mastery-companion-svg{animation:km-companion-cheer .55s ease-out 2}
.mastery-shell .mastery-mascot-assistant[data-mood="oops"] .mastery-companion-svg{animation:km-companion-try .35s ease 2}
.mastery-shell .mastery-assistant-speech{display:block;flex:1;font-size:clamp(.83rem,1.3vw,.98rem);line-height:1.8;color:#235947;font-weight:850;text-wrap:balance}
/* Restore a clear visual hierarchy to the journey items. */
.mastery-world-emblem{position:relative;isolation:isolate;background:linear-gradient(145deg,#52d8ab,var(--world-dark))!important;border:3px solid #ffffffb3!important;border-radius:25px!important;box-shadow:0 8px 19px #123e3952,inset 0 2px 9px #fff5!important;text-shadow:0 3px 7px #092d2259}
.mastery-world-emblem:after{content:'';position:absolute;inset:6px;border:1px solid #ffffff7c;border-radius:19px;pointer-events:none}
.mastery-node-symbol{border-width:4px!important;box-shadow:0 8px 0 #0b4b3945,0 14px 25px #0b4b392b,inset 0 3px 8px #ffffffa0!important}
.mastery-node.is-current .mastery-node-symbol,.mastery-node.is-ready .mastery-node-symbol{box-shadow:0 8px 0 #bd792b,0 0 0 8px #f9b95843,0 14px 24px #9d681044!important}
.mastery-node.is-done .mastery-node-symbol{box-shadow:0 8px 0 #0b7550,0 10px 22px #173f272b,inset 0 4px 9px #aaffd170!important}
.mastery-world-chip{transition:background .18s,transform .18s,box-shadow .18s}.mastery-world-chip:hover{transform:translateY(-2px)}
.mastery-world-chip:focus-visible,.mastery-report-jump:focus-visible,.mastery-report-fab:focus-visible,.mastery-report-close:focus-visible{outline:3px solid #daa344;outline-offset:3px}
.mastery-world-gate .mastery-gate-castle{display:inline-grid;place-items:center;width:80px;height:80px;margin:0 auto 8px;border-radius:24px;background:linear-gradient(145deg,#ebe5fa,#d1c6e8);color:#7565a4;text-shadow:0 2px 7px #72608a3b}
/* Dimensional, memorable achievement medals with a ribbon and per-badge identity. */
.mastery-badges-grid{gap:14px}
.mastery-badge{position:relative;min-height:205px;padding:19px 10px 14px;border-radius:22px;isolation:isolate;overflow:hidden;gap:8px}
.mastery-badge:before{content:'';position:absolute;top:-28px;left:-45px;width:110px;height:110px;border-radius:50%;background:#f5d8821b;pointer-events:none}
.mastery-badge.is-earned{background:linear-gradient(157deg,#fffef7,#ffebc9);border-color:#e9c783;box-shadow:0 8px 22px #a5782633}
.mastery-badge-illustration{--km-medal:#a9c7b9;position:relative;width:83px;height:83px;display:grid;place-items:center;margin:7px 0 4px;border-radius:50%;font-size:2.45rem;color:#586d63!important;background:radial-gradient(circle at 30% 22%,#f5fff7,var(--km-medal) 65%,#879d90 100%)!important;border:5px solid #ffffff8a;box-shadow:0 4px 0 #718a7c55,0 11px 17px #163d2d20,inset 0 0 0 3px #ffffff63!important;transform:rotate(-6deg)}
.mastery-badge-illustration:before{content:'';position:absolute;inset:7px;border:2px dashed #ffffff8c;border-radius:50%}
.mastery-badge.is-earned .mastery-badge-illustration{--km-medal:#edbb65;background:radial-gradient(circle at 30% 24%,#fffde2,#f3c86f 51%,#c67f32 100%)!important;color:#704116!important;border-color:#ffe8ad;box-shadow:0 4px 0 #b06c2c,0 12px 22px #c68b3970,inset 0 0 0 3px #fff1bf!important;animation:km-badge-rise .6s cubic-bezier(.1,1.1,.4,1) both}
.mastery-badge-icon{position:relative;z-index:2;text-shadow:0 3px #ffffffa1;line-height:1}
.mastery-badge-ribbon{position:absolute;z-index:-1;top:62px;left:15px;width:19px;height:38px;transform:rotate(-19deg);background:#6fa994;clip-path:polygon(0 0,100% 0,100% 100%,50% 76%,0 100%)}
.mastery-badge-ribbon:after{content:'';position:absolute;width:17px;height:38px;left:30px;background:#86c5a5;transform:rotate(30deg)}
.mastery-badge.is-earned .mastery-badge-ribbon{background:#d89b3e}
.mastery-badge-illustration[data-badge-code="first-world"],.mastery-badge-illustration[data-badge-code="five-stages"]{transform:rotate(5deg)}
.mastery-badge-illustration[data-badge-code="streak-three"]{transform:rotate(-4deg)}
.mastery-badge.is-locked .mastery-badge-illustration{filter:saturate(.48);opacity:.8}
.mastery-badge>strong{font-size:.87rem}.mastery-badge>small{font-size:.73rem;line-height:1.7}.mastery-badge-bottom{font-size:.73rem;padding:5px 12px}
@keyframes km-badge-rise{from{opacity:.2;transform:translateY(10px) scale(.76)}to{opacity:1;transform:translateY(0) scale(1) rotate(-6deg)}}
/* Report launcher and accessible drawer; stage content no longer requires scrolling past all worlds. */
.mastery-report-jump{font:inherit;font-size:.87rem;font-weight:900;padding:11px 18px;min-height:45px;border-radius:16px;cursor:pointer;box-shadow:0 5px 13px #105f3d18;background:linear-gradient(135deg,#e7fff0,#d9f6ff)!important;border:1px solid #a9dfc5!important;color:#155c48!important}
.mastery-report-fab{position:fixed;z-index:1200;bottom:max(19px,env(safe-area-inset-bottom));left:clamp(10px,2vw,28px);display:flex;align-items:center;gap:8px;padding:10px 16px;min-height:48px;border-radius:999px;cursor:pointer;background:linear-gradient(140deg,#146e57,#0b554d);border:1px solid #55b89a;color:#fff;font:inherit;font-size:.8rem;font-weight:900;box-shadow:0 10px 30px #12362e5a;transition:transform .2s,opacity .2s}
.mastery-report-fab:hover{transform:translateY(-4px)}.mastery-report-fab>span:first-child{font-size:20px}.mastery-report-fab strong{min-width:22px;text-align:center;background:#e9b553;color:#513312;border-radius:100px;padding:2px 6px;font-weight:900}
.mastery-shell.is-playing .mastery-report-fab,.mastery-report-fab[hidden]{display:none!important}
.mastery-report-scrim[hidden],.mastery-report-drawer[hidden]{display:none!important}
.mastery-report-scrim{position:fixed;z-index:2090;inset:0;background:#081a16b6;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px)}
.mastery-report-drawer{position:fixed;z-index:2091;inset:0 0 0 auto;width:min(960px,100vw);height:100dvh;max-height:100dvh;background:var(--km-surface-soft);color:var(--km-text);box-shadow:-16px 0 65px #0005;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;animation:km-report-enter .29s cubic-bezier(.14,1,.38,1) both}
.mastery-report-topbar{position:sticky;z-index:1;top:0;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:14px clamp(15px,3vw,30px);background:var(--km-surface);border-bottom:1px solid var(--km-border);box-shadow:0 4px 17px #0e4d3514}
.mastery-report-topbar>div{display:grid;gap:1px}.mastery-report-topbar span{font-size:.7rem;font-weight:850;color:var(--km-muted)}.mastery-report-topbar strong{font-size:1.15rem;color:var(--km-text)}
.mastery-report-close{min-width:45px;min-height:45px;border-radius:14px;border:1px solid var(--km-border);background:var(--km-surface-soft);color:var(--km-text);font-size:1.15rem;cursor:pointer}
.mastery-report-drawer .mastery-insights{margin:15px clamp(10px,3vw,26px) 35px}
body.mastery-report-open{overflow:hidden!important}
@keyframes km-report-enter{from{opacity:.6;transform:translateX(-50px)}to{opacity:1;transform:translateX(0)}}
@media(max-width:799px){
 .mastery-shell .mastery-mascot-assistant{min-height:92px;padding:8px 12px;gap:12px;margin-bottom:8px;border-radius:16px;align-items:center}
 .mastery-shell .mastery-assistant-pawn{min-width:86px;width:86px;flex-basis:86px;height:90px}
 .mastery-shell .mastery-assistant-speech{font-size:.79rem;line-height:1.55}
 .mastery-report-fab{padding:9px 11px;min-height:42px;font-size:.74rem;bottom:max(14px,env(safe-area-inset-bottom))}
 .mastery-report-drawer{width:100vw}
}
@media(max-width:680px){
 .mastery-shell .mastery-intro{min-height:224px;padding:20px 14px;gap:6px}
 .mastery-shell .mastery-hero-art{width:clamp(124px,35vw,180px);height:186px}
 .mastery-mascot-hero .mastery-companion-svg{width:100%;height:184px}
 .mastery-shell .mastery-mascot-hero:before{width:125px;height:125px;top:32px}
 .mastery-shell .mastery-headline h1{font-size:clamp(1.9rem,7vw,2.4rem)}
 .mastery-shell .mastery-headline p{font-size:.76rem;line-height:1.75}
 .mastery-shell .mastery-badges-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-height:680px) and (max-width:799px){
 .mastery-shell .mastery-mascot-assistant{display:flex!important;min-height:50px;padding:2px 8px;margin-bottom:3px}
 .mastery-shell .mastery-assistant-pawn{width:46px;min-width:46px;flex-basis:46px;height:48px}
 .mastery-shell .mastery-assistant-speech{font-size:.7rem;line-height:1.25}
}
@media(max-height:450px){.mastery-shell .mastery-mascot-assistant{min-height:40px}.mastery-shell .mastery-assistant-pawn{width:36px;min-width:36px;flex-basis:36px;height:38px}}
/* REAL DARK THEME — site stores data-theme on html, not the body. */
html[data-theme="dark"] .mastery-page{background:#0a151a!important}
html[data-theme="dark"] .mastery-shell{--km-surface:#1a3035;--km-surface-soft:#10242a;--km-text:#e9f7f3;--km-muted:#a0c0b8;--km-border:#35575b;--km-shine:#61ddb1;--mastery-ink:#e9f7f3;--mastery-muted:#a0c0b8;color:var(--km-text)!important;background:radial-gradient(ellipse at top,#16312d55,transparent 45%)}
html[data-theme="dark"] .mastery-intro{background:radial-gradient(circle at 10% 15%,#1c6a504d,transparent 35%),linear-gradient(120deg,#193e3c,#193239 60%,#24464c)!important;border-color:#426c60;box-shadow:0 17px 40px #0005}
html[data-theme="dark"] .mastery-kicker,html[data-theme="dark"] .mastery-text-link,html[data-theme="dark"] .mastery-headline h1 span{color:#81edc3!important}
html[data-theme="dark"] .mastery-headline h1,html[data-theme="dark"] .mastery-hero-crown{color:#f6fff5!important}
html[data-theme="dark"] .mastery-headline p{color:#c2dfd5!important}
html[data-theme="dark"] .mastery-hero-orbit{border-color:#5bac97}
html[data-theme="dark"] .mastery-overview,html[data-theme="dark"] .mastery-node-card,html[data-theme="dark"] .mastery-signin,html[data-theme="dark"] .mastery-empty{background:#1a3035!important;border-color:#35575b!important;color:var(--km-text)!important;box-shadow:0 8px 28px #0004}
html[data-theme="dark"] .mastery-stat span,html[data-theme="dark"] .mastery-stat small,html[data-theme="dark"] .mastery-status,html[data-theme="dark"] .mastery-lesson-progress,html[data-theme="dark"] .mastery-empty p,html[data-theme="dark"] .mastery-signin p{color:#a4c5b9!important}
html[data-theme="dark"] .mastery-stat strong,html[data-theme="dark"] .mastery-node-heading h3,html[data-theme="dark"] .mastery-empty h2{color:#eafaf4!important}
html[data-theme="dark"] .mastery-stat+ .mastery-stat{border-color:#335a55}
html[data-theme="dark"] .mastery-progress-track,html[data-theme="dark"] .mastery-lesson-track{background:#304b49}
html[data-theme="dark"] .mastery-progress-track::-webkit-progress-bar,html[data-theme="dark"] .mastery-lesson-track::-webkit-progress-bar{background:#304b49}
html[data-theme="dark"] .mastery-world{--world-bg:#18372f;--world-dark:#b5f3d6;--world-light:#41665c;--world-accent:#2a987b;background:linear-gradient(180deg,#234b3f,#162a32 295px)!important;border-color:#315b57!important;box-shadow:0 12px 40px #0005}
html[data-theme="dark"] .mastery-world[data-world-theme="castle"]{--world-dark:#c4d8ff;--world-light:#4e638b;--world-accent:#4f7db8;background:linear-gradient(180deg,#273c5b,#19283d 295px)!important}
html[data-theme="dark"] .mastery-world[data-world-theme="tower"]{--world-dark:#e1caff;--world-light:#735c93;--world-accent:#8a64b8;background:linear-gradient(180deg,#413259,#231f39 295px)!important}
html[data-theme="dark"] .mastery-world-head h2,html[data-theme="dark"] .mastery-world-eyebrow{color:var(--world-dark)!important}
html[data-theme="dark"] .mastery-world-head p,html[data-theme="dark"] .mastery-node-card p,html[data-theme="dark"] .mastery-world-gate p,html[data-theme="dark"] .mastery-footer-note{color:#bdd4ca!important}
html[data-theme="dark"] .mastery-world-head{border-color:#5e807a6b}
html[data-theme="dark"] .mastery-world-count,html[data-theme="dark"] .mastery-node-heading>span{background:#284c4c!important;color:#c9f5e4!important}
html[data-theme="dark"] .mastery-world-chip{background:#1c313a;color:#c0d6cd;border-color:#39595a;box-shadow:0 5px 14px #0003}
html[data-theme="dark"] .mastery-world-chip span{background:#2d4c4d}
html[data-theme="dark"] .mastery-world-chip.is-active{background:#178569;color:#fff;border-color:#1ba37b}
html[data-theme="dark"] .mastery-world-chip.is-won{color:#9ee9c8}
html[data-theme="dark"] .mastery-world-gate{background:linear-gradient(#25463f99,#22313eaa);border-color:#57716c}
html[data-theme="dark"] .mastery-world-gate strong{color:#e1f7ee}
html[data-theme="dark"] .mastery-conquered-review,html[data-theme="dark"] .mastery-world-win{color:#e4f5ed;background:#224440;border-color:#3b6a5b}
html[data-theme="dark"] .mastery-extra-links a{color:#a0efcb}
html[data-theme="dark"] .mastery-daily-island{background:linear-gradient(120deg,#173e37,#162f36 62%,#3d341e)!important;border-color:#477568!important;box-shadow:0 11px 30px #0004}
html[data-theme="dark"] .mastery-daily-information h2{color:#f4fff7!important}
html[data-theme="dark"] .mastery-daily-information p,html[data-theme="dark"] .mastery-daily-progress-text{color:#c4dfd7!important}
html[data-theme="dark"] .mastery-daily-eyebrow,html[data-theme="dark"] .mastery-daily-earned{color:#83ebbd!important}
html[data-theme="dark"] .mastery-streak-panel{background:#463719!important;border-color:#776039!important;color:#ffe0a0}
html[data-theme="dark"] .mastery-streak-copy small{color:#ffcc81}
html[data-theme="dark"] .mastery-chest-panel{background:#3b3024!important;border-color:#755c31!important;color:#ffe4b1}
html[data-theme="dark"] .mastery-chest-panel small,html[data-theme="dark"] .mastery-chest-hint{color:#e2c99b!important}
html[data-theme="dark"] .mastery-report-jump{background:linear-gradient(135deg,#1d5b4d,#224e61)!important;color:#d8fff0!important;border-color:#3e9c7e!important}
html[data-theme="dark"] .mastery-mascot-assistant{background:linear-gradient(115deg,#193b38,#243f52)!important;border-color:#477b73!important;box-shadow:0 8px 24px #0003}
html[data-theme="dark"] .mastery-assistant-speech{color:#d8faf0!important}
html[data-theme="dark"] .mastery-lesson-screen{--lesson-text:#e7f4ef;--lesson-muted:#accbc1;color:#e7f4ef!important;background:radial-gradient(ellipse at 90% 8%,#205242 0%,transparent 35%),linear-gradient(155deg,#0d212c,#162e36)!important}
html[data-theme="dark"] .mastery-lesson-panel{background:#1a323a!important;border-color:#355b5d!important;box-shadow:0 8px 32px #0004}
html[data-theme="dark"] .mastery-lesson-back,html[data-theme="dark"] .mastery-lesson-rating{background:#24414b!important;color:#e4f7ed!important;border-color:#476b68!important}
html[data-theme="dark"] .mastery-lesson-heading h2,html[data-theme="dark"] .mastery-lesson-task h3,html[data-theme="dark"] .mastery-lesson-counter strong,html[data-theme="dark"] .mastery-lesson-final-count{color:#e9fff6!important}
html[data-theme="dark"] .mastery-lesson-heading small,html[data-theme="dark"] .mastery-lesson-kicker{color:#7cdfb4!important}
html[data-theme="dark"] .mastery-lesson-task p{color:#b7d5cb}
html[data-theme="dark"] .mastery-lesson-action{background:#285049;color:#e6fff2;border-color:#458371;box-shadow:0 3px 0 #113c31}
html[data-theme="dark"] .mastery-lesson-action-primary{background:#157c65;border-color:#188e6c}
html[data-theme="dark"] .mastery-lesson-loading{background:#193739f0;color:#d3f8ea}
html[data-theme="dark"] .mastery-lesson-finish{background:radial-gradient(circle at 50% 25%,#62501e8c,transparent 52%)}
html[data-theme="dark"] .mastery-lesson-finish h2{color:#f6e8bc}html[data-theme="dark"] .mastery-lesson-finish p{color:#c1dccf}
html[data-theme="dark"] .mastery-insights{background:linear-gradient(135deg,#163337,#15262e 65%,#3c3424)!important;border-color:#35575b!important;color:var(--km-text)}
html[data-theme="dark"] .mastery-insights-head h2,html[data-theme="dark"] .mastery-badges-head h3,html[data-theme="dark"] .mastery-panel-title h3,html[data-theme="dark"] .mastery-topics-panel strong{color:#e8f9ef!important}
html[data-theme="dark"] .mastery-insights-head p,html[data-theme="dark"] .mastery-badges-head p,html[data-theme="dark"] .mastery-panel-note,html[data-theme="dark"] .mastery-topics-empty{color:#a5c3b7!important}
html[data-theme="dark"] .mastery-insights-rating,html[data-theme="dark"] .mastery-insights-stat,html[data-theme="dark"] .mastery-insights-panel{background:#223c40!important;border-color:#3a6060!important;box-shadow:none}
html[data-theme="dark"] .mastery-insights-rating span,html[data-theme="dark"] .mastery-insights-stat span,html[data-theme="dark"] .mastery-panel-title>span,html[data-theme="dark"] .mastery-week-day small,html[data-theme="dark"] .mastery-week-value,html[data-theme="dark"] .mastery-topic-row small{color:#a5c8be!important}
html[data-theme="dark"] .mastery-insights-rating strong,html[data-theme="dark"] .mastery-insights-stat strong{color:#e9fff6!important}
html[data-theme="dark"] .mastery-week-column,html[data-theme="dark"] .mastery-topic-track{background:#304a4c}
html[data-theme="dark"] .mastery-next-badge{background:#4b3f29!important;border-color:#9c7b43!important}html[data-theme="dark"] .mastery-next-badge strong{color:#ffe3a1!important}html[data-theme="dark"] .mastery-next-badge small{color:#ebcc95!important}
html[data-theme="dark"] .mastery-badge{background:#253e43!important;border-color:#466665!important;box-shadow:0 7px 14px #0003}
html[data-theme="dark"] .mastery-badge.is-earned{background:linear-gradient(145deg,#52442f,#383b35)!important;border-color:#9e804c!important}
html[data-theme="dark"] .mastery-badge strong{color:#eaf9f2!important}html[data-theme="dark"] .mastery-badge>small{color:#accbc1!important}
html[data-theme="dark"] .mastery-badge-bottom{background:#335b56;color:#bbebd4}html[data-theme="dark"] .mastery-badge.is-earned .mastery-badge-bottom{background:#81602a;color:#fff2c1}
html[data-theme="dark"] .mastery-badges-head>strong{background:#244d42;color:#b0efd0;border-color:#4f8f79}
html[data-theme="dark"] .mastery-flash{background:#1c5245;border-color:#3f9875;color:#b0f5d4}
html[data-theme="dark"] .mastery-reward-panel{background:radial-gradient(circle at 50% -20%,#356257 0%,transparent 60%),linear-gradient(145deg,#18353c,#16252e)!important;border-color:#507a6e}
html[data-theme="dark"] .mastery-reward-heading{color:#f0fff7}html[data-theme="dark"] .mastery-reward-description{color:#bddad0}
html[data-theme="dark"] .mastery-reward-markers i{background:#365551}
html[data-theme="dark"] .mastery-reward-markers i.is-current{background:var(--km-reward)}
@media(prefers-reduced-motion:reduce){.mastery-companion-svg,.mastery-companion-svg *, .mastery-badge-illustration,.mastery-report-drawer{animation:none!important;transition:none!important;will-change:auto!important}}
/* The lesson has a strict viewport budget; padding must be inside its 100dvh box. */
.mastery-lesson-layout{box-sizing:border-box}
@media(max-height:680px) and (max-width:799px) and (min-height:500px){
 .mastery-shell .mastery-mascot-assistant{min-height:62px}
 .mastery-shell .mastery-assistant-pawn{width:58px;min-width:58px;flex-basis:58px;height:62px}
}

/* Data-dependent bars without inline styles, so CSP and UI contracts remain intact. */
.mastery-week-column .mastery-bar-level-0{height:0%}
.mastery-week-column .mastery-bar-level-1{height:5%}
.mastery-week-column .mastery-bar-level-2{height:10%}
.mastery-week-column .mastery-bar-level-3{height:15%}
.mastery-week-column .mastery-bar-level-4{height:20%}
.mastery-week-column .mastery-bar-level-5{height:25%}
.mastery-week-column .mastery-bar-level-6{height:30%}
.mastery-week-column .mastery-bar-level-7{height:35%}
.mastery-week-column .mastery-bar-level-8{height:40%}
.mastery-week-column .mastery-bar-level-9{height:45%}
.mastery-week-column .mastery-bar-level-10{height:50%}
.mastery-week-column .mastery-bar-level-11{height:55%}
.mastery-week-column .mastery-bar-level-12{height:60%}
.mastery-week-column .mastery-bar-level-13{height:65%}
.mastery-week-column .mastery-bar-level-14{height:70%}
.mastery-week-column .mastery-bar-level-15{height:75%}
.mastery-week-column .mastery-bar-level-16{height:80%}
.mastery-week-column .mastery-bar-level-17{height:85%}
.mastery-week-column .mastery-bar-level-18{height:90%}
.mastery-week-column .mastery-bar-level-19{height:95%}
.mastery-week-column .mastery-bar-level-20{height:100%}

.mastery-topic-track progress{display:block;width:100%;height:8px;appearance:none;border:0;border-radius:20px;overflow:hidden;background:transparent;color:#29a77d;accent-color:#29a77d}
.mastery-topic-track progress::-webkit-progress-bar{background:#e6efe8;border-radius:20px}
.mastery-topic-track progress::-webkit-progress-value{background:linear-gradient(90deg,#77dba6,#219c73);border-radius:20px}
.mastery-topic-track progress::-moz-progress-bar{background:#2eac85;border-radius:20px}
html[data-theme="dark"] .mastery-topic-track progress::-webkit-progress-bar{background:#304a4c}

/* v58.61: Completed-world review must remain legible on dark theme.
   The original .mastery-review-list span uses a fixed light background, and
   inherited text color is insufficient once the world panel switches theme. */
html[data-theme="dark"] .mastery-shell .mastery-conquered-review,
[data-theme="dark"] .mastery-shell .mastery-conquered-review {
    background: #203c39 !important;
    color: #eafbf1 !important;
    border: 1px solid #47796b !important;
}
html[data-theme="dark"] .mastery-shell .mastery-conquered-review > summary,
[data-theme="dark"] .mastery-shell .mastery-conquered-review > summary {
    color: #eafbf1 !important;
    font-weight: 850;
    line-height: 1.8;
}
html[data-theme="dark"] .mastery-shell .mastery-conquered-review > summary::marker,
[data-theme="dark"] .mastery-shell .mastery-conquered-review > summary::marker {
    color: #83e4bb;
}
html[data-theme="dark"] .mastery-shell .mastery-review-list,
[data-theme="dark"] .mastery-shell .mastery-review-list {
    color: #eafbf1 !important;
}
html[data-theme="dark"] .mastery-shell .mastery-review-list > span,
[data-theme="dark"] .mastery-shell .mastery-review-list > span {
    background: #2a5249 !important;
    border: 1px solid #548576;
    color: #f2fff7 !important;
    box-shadow: 0 2px 10px #041e1b24;
}
html[data-theme="dark"] .mastery-shell .mastery-conquered-review > summary:focus-visible,
[data-theme="dark"] .mastery-shell .mastery-conquered-review > summary:focus-visible {
    outline: 2px solid #90f5cb;
    outline-offset: 4px;
    border-radius: 6px;
}
