/* Mathematics keeps its curriculum; motion and controls match the EGE course map. */
.math-road{min-width:0;padding:20px 0 10px;color:var(--text)}
.math-road__header{display:flex;flex-direction:column;gap:14px;padding-bottom:22px}
.math-road__header h1{margin:0;font-size:clamp(22px,3.6vw,36px);font-weight:900;letter-spacing:-.4px;line-height:1.15;background:linear-gradient(90deg,var(--c-acc-1),var(--c-acc-2),var(--c-acc-3));background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}
.math-road__header p{margin:0;font-size:15px;line-height:1.55;color:var(--muted,var(--text))}
.math-road__scroll{overflow-x:auto;overscroll-behavior-x:contain;max-width:100%;padding:20px 0 10px;scrollbar-width:thin}
.math-road__canvas-wrap{position:relative;width:100%;min-width:850px;margin:0 auto}
.math-road__tree{display:block;width:100%;overflow:visible}
.math-road__particles{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2}
.math-road__edge{stroke-width:2.5;stroke-linecap:round;filter:drop-shadow(0 0 6px var(--edge-color));stroke-dasharray:2000;animation:mathBranchGrow 1.2s ease-out both}
.math-road__edge--related{stroke-dasharray:7 7;opacity:.4;animation:mathRelatedGrow 1.2s ease-out both}
.math-road__node{cursor:pointer;outline:none}
.math-road__visual{transform-box:fill-box;transform-origin:center;animation:mathNodePop .44s cubic-bezier(.34,1.56,.64,1) backwards;transition:transform .28s cubic-bezier(.34,1.56,.64,1)}
.math-road__halo{fill:var(--node-color);opacity:0;transition:opacity .25s}
.math-road__disk{fill:var(--node-fill);stroke:var(--node-color);stroke-opacity:.54;stroke-width:2;transition:fill .24s ease,stroke .24s ease,filter .28s ease}
.math-road__number{font-size:20px;font-weight:800;letter-spacing:-.3px;fill:var(--text,#eaf0ff);pointer-events:none;transition:fill .22s ease}
.math-road__node:is(:hover,:focus-visible) .math-road__visual{transform:scale(1.25)}
.math-road__node:is(:hover,:focus-visible) .math-road__disk{fill:var(--node-color);fill-opacity:.22;stroke-opacity:.92;filter:drop-shadow(0 0 16px var(--node-color))}
.math-road__node:focus-visible .math-road__disk{stroke-width:4}
.math-road__ring{fill:none;stroke:var(--node-color);stroke-width:4;stroke-linecap:round;stroke-dasharray:0 100;opacity:0;transition:stroke-dasharray .45s ease,opacity .3s;pointer-events:none}
.math-road__node.is-partial .math-road__ring{opacity:1;animation:mathTopicGlow 2.4s ease-in-out infinite}
.math-road__node.is-done .math-road__disk{fill:var(--node-done);fill-opacity:1;stroke-opacity:.98;animation:mathDoneGlow 2.8s ease-in-out infinite}
.math-road__node.is-done .math-road__number{fill:#fff}
.math-road__check{opacity:0;transition:opacity .24s ease}
.math-road__node.is-done .math-road__check{opacity:1}
.math-road__check circle{fill:rgba(255,255,255,.94)}
.math-road__check path{fill:none;stroke:#1a1a2e;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.math-road__percent-label rect{fill:var(--p-surface,var(--bg,#10152a))}
.math-road__percent{fill:var(--text,#eaf0ff);font-size:12px;font-weight:750;pointer-events:none}
.math-road__labels{fill:var(--text,#eaf0ff);font-size:16px;font-weight:750}
.math-road__summary{position:relative;display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-top:20px;padding:14px 22px;border-radius:18px;background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.025));border:1px solid rgba(var(--c-acc-1-rgb),.3);box-shadow:0 14px 36px #0005,inset 0 1px 0 #ffffff1a}
.math-road__summary strong{font-size:14px;font-weight:800;letter-spacing:-.2px}
.math-road__bar{height:10px;background:rgba(0,0,0,.3);box-shadow:inset 0 2px 5px #0005;border-radius:999px;flex:1;min-width:100px;overflow:hidden}
.math-road__bar span{display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--c-acc-1),var(--c-acc-2),var(--c-acc-3),var(--c-acc-2),var(--c-acc-1));background-size:300% 100%;box-shadow:0 0 14px rgba(var(--c-acc-1-rgb),.45);transition:width .65s cubic-bezier(.34,1.56,.64,1);animation:mathBarWave 14s linear infinite}
#mathPercent{font-size:12.5px;font-weight:700}
#mathCompleted{font-size:13px}
.math-road__status{min-height:1.5em;margin:8px 0 0;font-size:14px}
.math-road__dialog{box-sizing:border-box;position:fixed;border:1px solid rgba(var(--c-acc-1-rgb),.28);border-radius:28px;padding:34px 28px 28px;background:var(--p-surface,var(--surface,var(--bg,#10152a)));color:var(--text,#eaf0ff);width:min(380px,calc(100vw - 32px));max-height:85dvh;overflow:auto;box-shadow:0 36px 90px #0009}
.math-road__dialog[open]{animation:mathDialogIn .3s cubic-bezier(.34,1.56,.64,1) both}
.math-road__dialog::backdrop{background:#0009;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
.math-road__dialog h2{margin:0 18px 10px;text-align:center;font-size:26px;font-weight:900;letter-spacing:-.4px}
#mathTopicCount{text-align:center;font-size:14px;color:var(--muted,var(--text))}
.math-road__close{position:absolute;top:16px;right:18px;width:30px;height:30px;border-radius:50%;border:0;background:#ffffff14;color:inherit;cursor:pointer;font-size:20px;display:flex;align-items:center;justify-content:center;transition:background .18s ease}
.math-road__close:hover{background:#ffffff24}
.math-road__topics-heading{margin-top:12px;padding-top:10px;border-top:1px solid rgba(var(--c-acc-1-rgb),.2);font-size:10px;font-weight:700;letter-spacing:.9px;text-transform:uppercase;color:var(--muted,var(--text))}
.math-road__topics{display:flex;flex-direction:column;gap:4px;max-height:220px;overflow-y:auto;scrollbar-width:thin;margin:6px 0 12px;padding:2px 4px 2px 0}
.math-road__topic{display:flex;align-items:center;gap:10px;padding:8px 11px;border-radius:12px;cursor:pointer;user-select:none;background:#ffffff0a;border:1px solid #ffffff14;transition:background .16s ease,border-color .16s ease,transform .18s cubic-bezier(.34,1.56,.64,1);font-size:13px;line-height:1.35}
.math-road__topic:hover{background:#ffffff17;border-color:#ffffff29;transform:translateX(3px)}
.math-road__topic:has(input:checked){background:rgba(var(--c-acc-3-rgb),.1);border-color:rgba(var(--c-acc-3-rgb),.28)}
 .math-road__topic{position:relative}
.math-road__topic input{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;margin:0!important;opacity:0!important;cursor:pointer;z-index:1}
.math-road__topic-check{display:flex;align-items:center;justify-content:center;flex:0 0 19px;width:19px;height:19px;border:2px solid rgba(var(--c-acc-1-rgb),.5);border-radius:7px;color:transparent;background:transparent;font:900 13px/1 sans-serif;transition:background .2s ease,border-color .2s ease,color .2s ease;pointer-events:none}
.math-road__topic-text{pointer-events:none}
.math-road__topic:has(input:focus-visible){outline:3px solid var(--text);outline-offset:2px}
.math-road__topic input:checked + .math-road__topic-check{background:var(--c-acc-3);border-color:var(--c-acc-3);color:var(--bg,#10152a)}
.math-road__actions{display:flex;gap:10px;margin:16px 0 10px}
.math-road__actions button{flex:1;padding:13px 12px;border-radius:16px;font-family:inherit;font-size:14px;font-weight:700;cursor:pointer;border:1.5px solid rgba(var(--c-acc-3-rgb),.32);background:rgba(var(--c-acc-3-rgb),.14);color:var(--text);transition:transform .22s cubic-bezier(.34,1.56,.64,1),box-shadow .18s ease,background .18s ease}
.math-road__actions button:hover{transform:translateY(-3px);box-shadow:0 10px 28px rgba(var(--c-acc-3-rgb),.2)}
.math-road__actions [data-select="none"]{background:#ffffff0f;border-color:#ffffff24}
.math-road__actions [data-select="all"].is-active{background:linear-gradient(135deg,var(--c-acc-3),var(--c-acc-1));color:var(--bg)}
.math-road__practice{display:block;text-align:center;font-size:13px;margin-top:4px;text-decoration:none}
.math-road__dialog :is(button,input,a):focus-visible{outline:3px solid var(--text);outline-offset:3px}
body.light .math-road__summary{background:linear-gradient(180deg,rgba(255,255,255,.86),rgba(var(--c-acc-2-rgb),.07));box-shadow:0 14px 30px rgba(var(--c-acc-1-rgb),.1),inset 0 1px 0 #ffffffd9}
body.light .math-road__bar{background:rgba(20,40,80,.08);box-shadow:inset 0 2px 4px #5064a029}
body.light .math-road__disk{stroke-opacity:.64}
body.light .math-road__dialog{box-shadow:0 36px 90px rgba(var(--c-acc-1-rgb),.22)}
body.light .math-road__topic{background:#141e3c0a;border-color:#141e3c17}
body.light .math-road__topic:has(input:checked){background:rgba(var(--c-acc-3-rgb),.14);border-color:rgba(var(--c-acc-3-rgb),.32)}
body.light .math-road__topic-check{border-color:rgba(var(--c-acc-1-rgb),.5)}
body.light .math-road__close,body.light .math-road__actions [data-select="none"]{background:#141e3c0f}
@keyframes mathBranchGrow{from{stroke-dashoffset:2000;opacity:0}to{stroke-dashoffset:0;opacity:1}}
@keyframes mathRelatedGrow{from{opacity:0}to{opacity:.4}}
@keyframes mathNodePop{from{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}
@keyframes mathTopicGlow{50%{opacity:.55}}
@keyframes mathDoneGlow{0%,100%{filter:drop-shadow(0 0 10px var(--node-color))}50%{filter:drop-shadow(0 0 22px var(--node-color))}}
@keyframes mathDialogIn{from{opacity:0;transform:scale(.84) translateY(20px)}to{opacity:1;transform:scale(1) translateY(0)}}
@keyframes mathBarWave{from{background-position:0% 50%}to{background-position:300% 50%}}
@media(max-width:600px){.math-road__header h1{font-size:21px}.math-road__summary{gap:12px;padding:14px}.math-road__summary #mathCompleted{width:100%}.math-road__dialog{padding:34px 22px 22px}}
@media(prefers-reduced-motion:reduce){.math-road *,.math-road__dialog,.math-road__dialog *{animation:none!important;transition:none!important}.math-road__particles{display:none}}
