/* UPA Beta 3.5 — accessible, human-first teaching layer. Layout only; mathematical core untouched. */
:root{--learn-violet:#8c91ff;--learn-mint:#60e3c3;--learn-gold:#ffd28c;--learn-ink:#0c1222}
html{scroll-padding-top:25px}
body{overflow-wrap:anywhere}
a,button,summary,input,select{touch-action:manipulation}
:where(a,button,input,select,summary):focus-visible{outline:3px solid #8fc7ff!important;outline-offset:3px}
/* Consistent subtle visual polish across all eight pages */
.content > .hero,.content > .welcome-hero,.math-hero{isolation:isolate}
.content > .hero:after,.math-hero .hero-card:after{content:"";pointer-events:none;position:absolute;inset:auto -120px -180px auto;width:340px;height:340px;background:radial-gradient(circle,rgba(108,138,255,.115),transparent 69%);z-index:0}
.math-hero .hero-card{position:relative}
.nav-item[href="./math.html"]{border:1px solid rgba(141,164,255,.08)}
/* Start-here panels */
.learn-path{position:relative;overflow:hidden;max-width:100%;padding:clamp(1rem,2vw,1.55rem);margin:1.1rem 0 1.5rem;border-radius:26px;background:linear-gradient(110deg,rgba(28,38,70,.91),rgba(15,25,45,.95) 49%,rgba(12,48,55,.77));border:1px solid rgba(128,174,255,.25);box-shadow:0 18px 50px rgba(3,8,21,.28)}
.learn-path::before{content:"";position:absolute;top:-75px;right:-48px;width:265px;height:265px;border-radius:50%;background:radial-gradient(circle,rgba(92,220,224,.15),transparent 65%);pointer-events:none}
.learn-path > *{position:relative}
.learn-lead{display:flex;gap:1.1rem;justify-content:space-between;align-items:center;flex-wrap:wrap;margin-bottom:.8rem}
.learn-kicker{display:inline-flex;align-items:center;gap:.45rem;color:#91e0f0;font-size:.78rem;letter-spacing:.09em;font-weight:800}
.learn-path h2{font-size:clamp(1.15rem,2vw,1.65rem);line-height:1.33;letter-spacing:-.015em;margin:.35rem 0 .45rem;color:#f9fbff}
.learn-path p{color:#d1deef;font-size:.98rem;max-width:75ch;line-height:1.75;margin:.35rem 0 .9rem}
.learn-roadmap{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.72rem;margin:.9rem 0}
.learn-way{display:flex;align-items:flex-start;gap:.72rem;padding:.85rem;border-radius:17px;background:rgba(255,255,255,.045);border:1px solid rgba(255,255,255,.075)}
.learn-count{flex:0 0 34px;height:34px;display:grid;place-items:center;border-radius:11px;color:#0b1a2d;font-weight:900;background:linear-gradient(145deg,#73d6f5,#a2aaff);box-shadow:0 5px 18px rgba(105,187,245,.22)}
.learn-way b{display:block;color:#fff;font-size:.93rem;margin:0 0 .18rem}
.learn-way span{font-size:.87rem;color:#c1d1e8;line-height:1.6}
.learn-path .learn-actions{display:flex;flex-wrap:wrap;gap:.7rem;align-items:center;margin-top:.85rem}
.learn-link,.learn-trigger{display:inline-flex;align-items:center;justify-content:center;gap:.45rem;min-height:44px;padding:.7rem 1.05rem;border-radius:13px;border:1px solid rgba(142,176,255,.25);background:rgba(125,143,254,.15);color:#edf4ff;font-weight:750;text-decoration:none;cursor:pointer;transition:transform .2s ease,background .2s ease,border-color .2s ease}
.learn-link:hover,.learn-trigger:hover{background:rgba(119,161,255,.23);border-color:rgba(173,201,255,.4);transform:translateY(-2px)}
.learn-link.primary{color:#071525;background:linear-gradient(115deg,#92f0de,#98b9ff);border-color:transparent}
.learn-glossary{margin-top:1rem;padding:0;border-top:1px solid rgba(255,255,255,.09)}
.learn-glossary summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;cursor:pointer;padding:.9rem .2rem .1rem;list-style:none;color:#e9f4ff;font-weight:750}
.learn-glossary summary::-webkit-details-marker{display:none}
.learn-glossary summary::after{content:"＋";font-size:1.35rem;color:#8bdfff}
.learn-glossary[open] summary::after{content:"−"}
.learn-glossary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(205px,1fr));gap:.7rem;margin-top:.9rem}
.learn-term{border-radius:14px;padding:.85rem;background:rgba(3,13,27,.34);border:1px solid rgba(160,181,255,.12)}
.learn-term b{display:block;color:#f0f6ff;margin-bottom:.3rem}
.learn-term span{display:block;color:#c7d7ed;font-size:.89rem;line-height:1.64}
/* Friendly microcopy, new visual examples, compare cards */
.human-meaning{padding:.9rem 1rem;margin:.75rem 0 .95rem;border-left:3px solid #79dec9;border-radius:0 13px 13px 0;background:linear-gradient(90deg,rgba(86,224,198,.10),rgba(85,121,202,.045));line-height:1.72!important;color:#ebf9f7!important}
.human-meaning b{color:#b9fff3}
.example-badge{display:inline-flex;gap:.35rem;align-items:center;padding:.25rem .62rem;margin-bottom:.4rem;background:rgba(118,211,234,.12);border:1px solid rgba(137,220,249,.2);border-radius:999px;color:#a4e9ff;font-weight:800;font-size:.74rem}
.math-method-card{position:relative;overflow:hidden;transition:border-color .25s ease,transform .25s ease,box-shadow .25s ease}
.math-method-card:hover{border-color:rgba(130,205,240,.28);box-shadow:0 20px 40px rgba(0,0,0,.28)}
.math-method-card .method-top h3{line-height:1.42}
.math-method-card .method-top .pill-number{font-size:.75rem;white-space:nowrap}
.formula-disclosure{margin:.65rem 0 .85rem;border-radius:15px;border:1px solid rgba(142,170,255,.2);overflow:hidden;background:rgba(11,21,38,.55)}
.formula-disclosure summary{list-style:none;cursor:pointer;padding:.85rem 1rem;color:#c7d4ff;font-weight:750;display:flex;align-items:center;justify-content:space-between;gap:.5rem;user-select:none}
.formula-disclosure summary::-webkit-details-marker{display:none}
.formula-disclosure summary::after{content:"＋";font-size:1.2rem;color:#8fd8f7}
.formula-disclosure[open] summary::after{content:"−"}
.formula-disclosure[open]{background:rgba(13,23,43,.77)}
.formula-disclosure .formula-box{border:0!important;border-top:1px solid rgba(142,170,255,.18)!important;border-radius:0!important;margin:0!important;background:rgba(4,9,19,.5)!important;white-space:normal}
.formula-disclosure .formula-box code{font-size:.89rem;overflow-wrap:anywhere}
.learn-mode-row{display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap;margin:.95rem 0 1.15rem}
.learn-mode-row p{margin:0;color:#bed0e5;max-width:65ch;font-size:.91rem}
.learn-mode-row .learn-trigger[aria-pressed="true"]{background:rgba(99,216,181,.18);border-color:rgba(101,235,186,.55)}
.beginner-bridge .learn-roadmap{margin:.8rem 0 .65rem}
.math-page .hero-card,.math-card,.hero-visual-card{transition:border-color .25s ease,box-shadow .25s ease}
.math-page .hero-card:hover,.math-card:hover{border-color:rgba(162,202,255,.28)}
.math-card .icon-badge{transition:transform .4s cubic-bezier(.2,.8,.2,1);transform-origin:center center}
.math-card:hover .icon-badge{transform:rotate(-8deg) scale(1.07)}
.math-card h3{line-height:1.45}
.math-main .math-hub-intro{margin-bottom:1.2rem}
.math-hub-switch{display:flex;flex-wrap:wrap;gap:.55rem;margin:.6rem 0}
.math-hub-switch button{background:rgba(255,255,255,.05);border:1px solid rgba(150,175,255,.17);border-radius:999px;color:#d7e5ff;padding:.6rem .9rem;min-height:44px;cursor:pointer;font:inherit;font-weight:750}
.math-hub-switch button[aria-pressed="true"]{background:linear-gradient(120deg,#8aabff,#69e0dc);color:#061a28;border-color:transparent}
.math-demo-result{background:rgba(6,17,32,.5);border-radius:18px;border:1px solid rgba(164,197,255,.13);padding:1rem;min-height:90px}
.math-demo-result b{display:block;color:#abf5e5;font-size:1.03rem;margin-bottom:.3rem}
.math-demo-result p{margin:.2rem 0;color:#c7d7ea}
.visual-example{background:linear-gradient(130deg,rgba(35,64,91,.45),rgba(28,35,74,.36));padding:1rem;border-radius:18px;border:1px solid rgba(120,188,255,.19);margin:.8rem 0}
.visual-example strong{display:block;margin-bottom:.4rem;color:#a5eedd}
.visual-example p{margin:.3rem 0;color:#d1e4f1}
.visual-pair-grid{display:grid;grid-template-columns:repeat(var(--grid-size,6),minmax(0,1fr));gap:4px;max-width:440px;margin:.85rem 0}
.visual-pair-grid span{display:grid;place-items:center;min-width:0;aspect-ratio:1;border-radius:7px;background:rgba(113,137,190,.1);border:1px solid rgba(137,164,228,.14);font-size:clamp(.62rem,1vw,.77rem);color:#aebbd7;transition:background .23s,color .23s,transform .23s}
.visual-pair-grid span.match{background:linear-gradient(150deg,rgba(83,209,179,.55),rgba(76,142,245,.42));border-color:rgba(153,237,214,.48);color:white;font-weight:800;box-shadow:0 3px 12px rgba(70,199,178,.13)}
.visual-pair-grid span:hover{transform:scale(1.08);z-index:1}
.visual-ratio{display:flex;overflow:hidden;min-height:26px;border-radius:999px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.08);margin:.65rem 0}
.visual-ratio .win{width:var(--win);background:linear-gradient(90deg,#68ded0,#7ea9ff);transition:width .35s}
.visual-ratio .rest{flex:1;background:rgba(255,255,255,.05)}
.visual-caption{color:#bfd4e9!important;font-size:.89rem!important}
.reel-illustration{display:flex;gap:.6rem;align-items:center;margin:.7rem 0}
.reel-illustration span{display:grid;place-items:center;flex:0 1 73px;aspect-ratio:1;border-radius:16px;background:radial-gradient(circle at 50% 20%,rgba(151,177,255,.18),rgba(29,38,66,.88));border:1px solid rgba(164,188,255,.2);font-size:2.3rem;box-shadow:inset 0 -6px 20px rgba(0,0,0,.25)}
.reel-illustration.spin span{animation:soft-reel .55s cubic-bezier(.2,.8,.1,1)}
.reel-illustration.spin span:nth-child(2){animation-delay:.08s}
.reel-illustration.spin span:nth-child(3){animation-delay:.15s}
@keyframes soft-reel{0%{transform:translateY(-8px);filter:blur(2px)}100%{transform:translateY(0);filter:blur(0)}}
.math-page .theory-nav a{font-size:.93rem}
.math-footer-note,.note-box{line-height:1.73}
/* improved legibility on technical pages */
.math-page .formula-line{overflow-wrap:anywhere}
.math-page .math-hero h1{line-height:1.19}
.math-page .math-method-card p,.math-page .math-card p{line-height:1.8}
.math-page .math-method-card h3{font-size:clamp(1.05rem,1.5vw,1.28rem)}
.math-page .hero-visual-card{border-color:rgba(102,213,208,.22);background:radial-gradient(circle at top right,rgba(51,94,133,.33),transparent 55%),linear-gradient(175deg,#17233e,#0c1428)}
.math-page .hero-card{background:radial-gradient(circle at 10% 0,rgba(56,126,168,.20),transparent 65%),linear-gradient(130deg,#111d37,#101426)}
.math-page .math-card{background:linear-gradient(160deg,rgba(25,42,66,.94),rgba(12,21,38,.94))}
.math-page .math-method-card:nth-child(4n+2){border-top:2px solid rgba(101,221,197,.42)}
.math-page .math-method-card:nth-child(4n+3){border-top:2px solid rgba(162,142,245,.42)}
.math-page .math-method-card:nth-child(4n+4){border-top:2px solid rgba(242,190,119,.42)}
@media(min-width:1040px){.math-main .theory-layout{grid-template-columns:minmax(230px,.66fr) minmax(0,2fr)}}
@media(max-width:900px){.learn-roadmap{grid-template-columns:1fr}.learn-way{align-items:center}.learn-lead{align-items:flex-start}}
@media(max-width:640px){.learn-path{border-radius:20px;padding:1rem}.learn-way{padding:.75rem}.learn-link,.learn-trigger{width:100%}.learn-actions>*{flex:1 1 170px}.math-page .hero-card h1{font-size:1.75rem}.math-page .method-top{flex-wrap:wrap}.math-hub-switch button{flex:1}.visual-pair-grid{gap:2px}.visual-pair-grid span{border-radius:4px;font-size:.56rem}.math-page .learn-mode-row .learn-trigger{width:100%}}
@media(prefers-reduced-motion:reduce){.reel-illustration.spin span,.math-card .icon-badge,.visual-pair-grid span,.math-card,.math-method-card{animation:none!important;transition:none!important}}

@media(max-width:640px){.math-hub-switch{flex-wrap:nowrap;overflow-x:auto;padding-bottom:.4rem}.math-hub-switch button{flex:0 0 auto;white-space:nowrap;font-size:.88rem}}

/* Language audit: keep source links readable on small screens. */
.math-source-list{display:grid;gap:.55rem;padding-inline-start:1.35rem;line-height:1.5}
.math-source-list a{color:#a9ddff;text-underline-offset:.25rem;overflow-wrap:anywhere}
.math-source-list a:focus-visible{outline:2px solid #9bdcfd;outline-offset:3px}

/* Beta 3.7 — verified mathematical bibliography */
.math-reference-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem;margin-top:1rem}
.math-reference-item{min-width:0;padding:1rem 1.1rem;border:1px solid rgba(145,173,255,.15);border-radius:17px;background:linear-gradient(145deg,rgba(25,34,57,.64),rgba(11,17,31,.82));transition:border-color .2s,transform .2s}
.math-reference-item:hover{border-color:rgba(127,186,255,.42);transform:translateY(-2px)}
.math-ref-topic{display:inline-block;color:#9dcaff;font-size:.76rem;font-weight:700;letter-spacing:.04em;margin-bottom:.6rem}
.math-reference-item h3{font-size:1rem;line-height:1.45;margin:0 0 .55rem;color:#f0f5ff;overflow-wrap:anywhere}
.math-reference-item p{font-size:.9rem;line-height:1.65;color:#b5c5e7;margin:.1rem 0 .75rem}
.math-reference-item a{color:#9bdcff;font-weight:700;line-height:1.5;text-underline-offset:.2rem;overflow-wrap:anywhere}
.math-reference-item a:focus-visible{outline:2px solid #9bdcff;outline-offset:4px;border-radius:3px}
@media(max-width:810px){.math-reference-grid{grid-template-columns:1fr}.math-reference-item{padding:1rem}}
@media(prefers-reduced-motion:reduce){.math-reference-item{transition:none}.math-reference-item:hover{transform:none}}

/* Beta 3.8 · only bibliography styles */
.math-source-subtitle{margin:1.5rem 0 .7rem;font-size:1.12rem;line-height:1.4;color:#e9efff}
.math-ref-credit{font-weight:650;color:#d6e0fa!important;font-size:.86rem!important}
.math-ref-use{padding:.68rem .8rem;border-radius:11px;background:rgba(79,116,255,.09);border:1px solid rgba(127,161,255,.12)}
.math-ref-use strong{color:#dce8ff}
.math-reference-item{display:flex;flex-direction:column}
.math-reference-item a{margin-top:auto;padding-top:.25rem}
@media(max-width:420px){.math-reference-item{padding:.88rem!important}.math-reference-item h3{font-size:.97rem}}
