
.math-page .content{display:block}
.math-main{padding-bottom:2.2rem}
.math-hero{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(280px,.85fr);gap:1.4rem;align-items:stretch;margin-bottom:1.35rem}
.math-hero .hero-card,.hero-visual-card,.math-hub-callout,.math-card,.math-method-card,.math-control-panel,.math-output-panel,.math-explainer,.math-footer-note{background:linear-gradient(180deg,rgba(16,24,42,.95),rgba(9,14,27,.92));border:1px solid rgba(133,164,255,.15);border-radius:24px;box-shadow:0 20px 40px rgba(0,0,0,.28)}
.hero-card{padding:1.6rem 1.5rem;position:relative;overflow:hidden}
.hero-card h1{font-size:clamp(2rem,3.5vw,3rem);margin:.3rem 0 .7rem;line-height:1.08}
.hero-card h1 span{color:var(--teal-300,#8ef0ff)}
.hero-card p{max-width:62ch;color:rgba(230,236,255,.83)}
.hero-kicker,.section-kicker{letter-spacing:.16em;text-transform:uppercase;font-size:.74rem;color:#8ca2d9;font-weight:700}
.hero-actions{display:flex;gap:.85rem;flex-wrap:wrap;margin-top:1rem}
.primary-button,.secondary-button,.mini-button,.link-chip{display:inline-flex;align-items:center;gap:.55rem;border-radius:999px;padding:.85rem 1.15rem;font-weight:700;text-decoration:none;border:1px solid rgba(126,156,255,.18);transition:transform .18s ease, box-shadow .18s ease, background .18s ease}
.primary-button{background:linear-gradient(135deg,#6d7cff,#43c6ff);color:#fff;box-shadow:0 10px 25px rgba(79,117,255,.28)}
.secondary-button,.mini-button,.link-chip{background:rgba(255,255,255,.03);color:#eef3ff}
.primary-button:hover,.secondary-button:hover,.mini-button:hover,.link-chip:hover{transform:translateY(-2px)}
.math-stats{display:flex;gap:.7rem;flex-wrap:wrap;margin-top:1rem}
.math-stats span{padding:.6rem .8rem;border-radius:999px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08);font-size:.93rem}
.hero-visual-card{padding:1.3rem;display:flex;flex-direction:column;justify-content:center;position:relative;overflow:hidden;min-height:280px}
.floating-formulas{position:absolute;inset:0;pointer-events:none;opacity:.75}
.floating-formulas i{position:absolute;display:grid;place-items:center;width:58px;height:58px;border-radius:18px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08);font-style:normal;color:#dfe8ff;box-shadow:0 12px 28px rgba(0,0,0,.2);animation:floaty 9s ease-in-out infinite}
.floating-formulas i:nth-child(1){top:10%;left:8%}
.floating-formulas i:nth-child(2){top:18%;right:15%;animation-delay:1.4s}
.floating-formulas i:nth-child(3){bottom:20%;left:12%;animation-delay:2.3s}
.floating-formulas i:nth-child(4){bottom:12%;right:16%;animation-delay:3s}
@keyframes floaty{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}
.math-preview{position:relative;z-index:1;display:grid;gap:.8rem}
.preview-box{padding:1rem 1.1rem;border-radius:20px;background:rgba(255,255,255,.045);border:1px solid rgba(255,255,255,.09)}
.preview-box strong{display:block;font-size:.88rem;color:#a4bbf6;margin-bottom:.35rem}
.preview-box .formula-line{font-size:1.15rem;font-weight:800;letter-spacing:.02em}
.math-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:1rem}
.math-card{padding:1.1rem}
.math-card h3{margin:.25rem 0 .6rem;font-size:1.1rem}
.math-card p,.math-card li,.math-method-card p,.math-explainer p{color:rgba(228,236,255,.84)}
.math-card ul{padding-left:1.1rem;margin:.2rem 0 0}
.method-links{display:flex;gap:.7rem;flex-wrap:wrap;margin-top:.8rem}
.link-chip{padding:.7rem .95rem;font-size:.93rem}
.link-chip.active{background:rgba(86,121,255,.18)}
.hub-grid .math-card{grid-column:span 4;display:flex;flex-direction:column;gap:.65rem}
.hub-grid .math-card .icon-badge{width:56px;height:56px;border-radius:16px;display:grid;place-items:center;background:linear-gradient(135deg,rgba(100,118,255,.25),rgba(69,204,255,.14));border:1px solid rgba(159,178,255,.2)}
.hub-grid .math-card .icon-badge svg{width:28px;height:28px}
.method-bank{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:.9rem}
.method-pill{padding:1rem;border-radius:18px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08)}
.method-pill strong{display:block;margin-bottom:.35rem}
.theory-layout{display:grid;grid-template-columns:minmax(250px,.8fr) minmax(0,1.2fr);gap:1rem;margin-top:1rem}
.theory-nav{padding:1rem;position:sticky;top:1rem;height:max-content}
.theory-nav h2{margin:.2rem 0 .8rem;font-size:1.1rem}
.theory-nav a{display:flex;align-items:center;justify-content:space-between;color:#eef3ff;text-decoration:none;padding:.85rem .95rem;border-radius:16px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06);margin-bottom:.55rem;transition:transform .18s ease, background .18s ease}
.theory-nav a:hover{transform:translateX(2px);background:rgba(255,255,255,.055)}
.theory-stack{display:grid;gap:1rem}
.math-method-card{padding:1.1rem 1.1rem 1rem}
.math-method-card h3{margin:.15rem 0 .35rem;font-size:1.14rem}
.math-method-card .method-top{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start;margin-bottom:.65rem}
.math-method-card .formula-box{padding:1rem 1rem;border-radius:18px;background:rgba(8,12,24,.72);border:1px solid rgba(132,159,255,.16);overflow:auto;color:#f3f6ff;font-weight:700;font-size:1rem}
.math-method-card .formula-box code,.formula-box code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;line-height:1.7}
.math-two-col{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-top:.95rem}
.math-control-panel,.math-output-panel,.math-explainer,.math-footer-note{padding:1rem}
.math-control-panel h4,.math-output-panel h4,.math-explainer h4{margin:.1rem 0 .7rem;font-size:1rem}
.control-row{display:grid;gap:.35rem;margin-bottom:1rem}
.control-row label{font-weight:700;color:#dfe8ff}
.control-row small{color:#9db0df}
.range-row{display:grid;grid-template-columns:1fr auto;align-items:center;gap:.7rem}
.range-value,.pill-number{padding:.35rem .65rem;border-radius:999px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);font-weight:700;min-width:4rem;text-align:center}
input[type="range"]{width:100%}
select,input[type="number"]{background:rgba(6,10,19,.9);border:1px solid rgba(157,178,255,.16);color:#edf2ff;border-radius:14px;padding:.78rem .85rem;width:100%}
.metric-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:.7rem;margin-top:.75rem}
.metric-tile{padding:.9rem;border-radius:18px;background:rgba(255,255,255,.045);border:1px solid rgba(255,255,255,.07)}
.metric-tile span{display:block;color:#9eb0db;font-size:.84rem;margin-bottom:.25rem}
.metric-tile strong{font-size:1.15rem}
.bar-chart{display:grid;grid-template-columns:repeat(auto-fit,minmax(26px,1fr));gap:.35rem;align-items:end;height:190px;padding:.8rem;border-radius:18px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06);margin-top:.8rem}
.bar-chart .bar-col{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:.35rem}
.bar-chart .bar-col i{display:block;width:100%;max-width:26px;border-radius:10px 10px 3px 3px;background:linear-gradient(180deg,#8dd2ff,#6f7cff);box-shadow:0 8px 18px rgba(78,124,255,.26);height:calc(var(--h) * 1%);min-height:4px;transition:height .28s ease}
.bar-chart .bar-col.active i{background:linear-gradient(180deg,#ffd46d,#ff7e63)}
.bar-chart .bar-col span{font-size:.72rem;color:#a8b6dc}
.prob-bar-list{display:grid;gap:.55rem;margin-top:.7rem}
.prob-row{display:grid;grid-template-columns:minmax(90px,1.2fr) 1fr auto;gap:.7rem;align-items:center}
.prob-row .track{position:relative;height:12px;border-radius:999px;background:rgba(255,255,255,.06);overflow:hidden}
.prob-row .fill{position:absolute;inset:0 auto 0 0;width:var(--w);border-radius:999px;background:linear-gradient(90deg,#8db4ff,#61e2ff)}
.katex-lite{font-size:1.05rem;font-weight:800;letter-spacing:.02em}
.note-box{margin-top:.8rem;padding:.9rem 1rem;border-radius:18px;background:rgba(124,103,255,.09);border:1px solid rgba(157,178,255,.18)}
.math-table{width:100%;border-collapse:collapse;margin-top:.8rem}
.math-table th,.math-table td{padding:.7rem .65rem;border-bottom:1px solid rgba(255,255,255,.08);text-align:left;vertical-align:top}
.math-table th{color:#a9baf1;font-size:.86rem;text-transform:uppercase;letter-spacing:.08em}
.pocket-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(32px,1fr));gap:.35rem;margin-top:.8rem}
.pocket-grid span{display:grid;place-items:center;height:34px;border-radius:12px;font-weight:800;border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.05)}
.pocket-grid span.red{background:rgba(215,64,79,.25)}
.pocket-grid span.black{background:rgba(26,30,42,.88)}
.pocket-grid span.green{background:rgba(31,160,109,.26)}
.reel-display{display:grid;grid-template-columns:repeat(3,1fr);gap:.75rem;margin-top:.8rem}
.reel-display .reel{padding:1rem;border-radius:18px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);display:grid;place-items:center;font-size:2rem;min-height:82px}
.class-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.7rem;margin-top:.8rem}
.class-tile{padding:.95rem;border-radius:18px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.07)}
.class-tile strong{display:block;font-size:1.08rem;margin-bottom:.25rem}
.math-footer-note{margin-top:1rem}
.math-footer-note strong{display:block;margin-bottom:.4rem}
@media (max-width: 980px){.math-hero,.theory-layout,.math-two-col{grid-template-columns:1fr}.hub-grid .math-card{grid-column:span 12}.theory-nav{position:static}.hero-visual-card{min-height:220px}}
@media (max-width: 700px){.hero-card,.hero-visual-card,.math-card,.math-method-card,.math-control-panel,.math-output-panel,.math-explainer{border-radius:20px;padding:1rem}.class-grid{grid-template-columns:1fr}.bar-chart{height:150px}.prob-row{grid-template-columns:minmax(74px,1fr) 1fr auto}}

/* Beta 3.4: teaching interactions — visible, restrained and accessible */
.math-page .math-hero .primary-button,.math-page .math-hero .secondary-button{width:auto;min-height:42px;font-size:.86rem}
.math-page .hero-visual-card{background:radial-gradient(circle at 65% 40%,rgba(77,88,184,.28),transparent 65%),linear-gradient(140deg,#131d36,#101527)}
.math-page .hero-card{background:radial-gradient(circle at 100% 15%,rgba(74,82,172,.18),transparent 70%),linear-gradient(180deg,#101a2d,#0d1526)}
.math-page .math-card,.math-page .math-method-card{min-width:0}
.math-page .formula-box{max-width:100%;white-space:normal;overflow-wrap:anywhere}
.math-page .formula-box code{overflow-wrap:anywhere;font-size:clamp(.8rem,1.35vw,.98rem)}
.math-page .theory-stack > section{scroll-margin-top:20px}
.math-page .math-card p{line-height:1.7}
.math-page .method-top{flex-wrap:wrap}
.math-page .bar-chart{overflow-x:auto;grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(22px,1fr)}
.math-page .bar-chart .bar-col{min-width:20px}
.math-page .math-table{min-width:270px;white-space:normal}
.math-page .math-table th,.math-page .math-table td{word-break:normal}
.math-page .math-table tr:nth-child(even){background:rgba(255,255,255,.018)}
.math-page .theory-nav{max-height:calc(100vh - 40px);overflow-y:auto}
.math-page .theory-nav a{gap:.5rem}
.math-page .theory-nav a svg{flex-shrink:0;width:16px;height:16px}
.math-page .math-section-footer{display:flex;justify-content:flex-end;margin-top:.75rem}
.math-page .math-section-footer a{color:#b7c9ff;text-decoration:underline;text-underline-offset:4px}
.math-page .motion-highlight{animation:math-pop .48s ease-out}
@keyframes math-pop{0%{filter:brightness(1.5);transform:translateY(2px)}100%{filter:brightness(1);transform:translateY(0)}}
.math-page .bar-chart .bar-col i{animation:math-bar-rise .65s ease-out backwards;transform-origin:bottom}
@keyframes math-bar-rise{0%{transform:scaleY(.06);opacity:.38}100%{transform:scaleY(1);opacity:1}}
.math-page .reel-display{max-width:400px;margin-inline:auto}
.math-page .reel-display .reel{transition:transform .2s ease,background .2s ease;animation:reel-enter .5s ease both}
.math-page .reel-display .reel:nth-child(2){animation-delay:.06s}
.math-page .reel-display .reel:nth-child(3){animation-delay:.12s}
@keyframes reel-enter{from{transform:translateY(-11px);filter:blur(2px)}to{transform:translateY(0);filter:blur(0)}}
.math-page .reel-display .reel.win{background:rgba(35,185,140,.17);border-color:rgba(100,240,195,.48)}
.math-page .pocket-grid span.selected{outline:2px solid #a2f2ff;outline-offset:1px;box-shadow:0 0 16px rgba(61,222,255,.2)}
.math-page .viz-track{height:15px;border-radius:999px;background:#283954;overflow:hidden;position:relative;margin-top:.55rem}
.math-page .viz-track > span{display:block;height:100%;width:0;background:linear-gradient(90deg,#8272ff,#50d9c3);border-radius:inherit;transition:width .5s cubic-bezier(.2,.7,.2,1)}
.math-page .viz-track > span.observed{background:linear-gradient(90deg,#ecb866,#f2838b)}
.math-page .viz-legend{display:flex;align-items:center;justify-content:space-between;gap:.75rem;color:#bdc8e7;margin:.4rem 0 .15rem;font-size:.83rem}
.math-page .monte-viz{padding:1rem;border:1px solid #2c4061;border-radius:17px;background:rgba(13,24,44,.8);margin-top:.85rem}
.math-page .monte-viz[hidden]{display:none}
.math-page .control-row input[type=number]{max-width:125px;min-width:80px}
.math-page .weight-editor{display:grid;grid-template-columns:repeat(auto-fit,minmax(126px,1fr));gap:.6rem;margin-top:.75rem}
.math-page .weight-item{display:grid;gap:.4rem;background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.075);border-radius:14px;padding:.7rem}
.math-page .weight-item strong{font-size:.86rem}
.math-page .weight-item label{font-size:.78rem;color:#9ab5da}
.math-page .weight-item input{padding:.55rem .6rem;max-width:100%;min-width:0}
.math-page :is(button,input,select,a):focus-visible{outline:2px solid #add6ff;outline-offset:3px}
.math-page .math-stats span{font-size:.83rem}
.math-page .math-two-col > *{min-width:0}
.math-page .math-preview .formula-line{font-size:clamp(.9rem,1.6vw,1.12rem);overflow-wrap:anywhere}
.math-page .floating-formulas i{font-size:.94rem}
.math-page .math-inline-equation{color:#b8d8fa;font-weight:700}
.math-page .math-method-card details{margin-top:.75rem;padding:.75rem .95rem;background:rgba(255,255,255,.035);border:1px solid rgba(255,255,255,.08);border-radius:16px}
.math-page .math-method-card summary{cursor:pointer;font-weight:720}
.math-page .math-method-card details p{margin:.6rem 0 .2rem;line-height:1.8}
@media(max-width:1100px){.math-page .hero-card h1{font-size:clamp(1.8rem,2.8vw,2.55rem)} }
@media(max-width:650px){.math-page .hero-actions{flex-direction:column;align-items:stretch}.math-page .hero-actions a{text-align:center;justify-content:center}.math-page .math-hero{gap:.85rem}.math-page .hero-visual-card{min-height:215px}.math-page .theory-nav{max-height:none}.math-page .math-method-card .formula-box code{font-size:.79rem}.math-page .math-stats span{font-size:.78rem}.math-page .math-method-card .metric-strip{grid-template-columns:repeat(2,minmax(0,1fr))}.math-page .metric-tile strong{font-size:1rem}}
@media(prefers-reduced-motion:reduce){.math-page .bar-chart .bar-col i,.math-page .reel-display .reel,.math-page .floating-formulas i,.math-page .motion-highlight{animation:none!important;transition:none!important}}
.math-page .metric-tile{min-width:0;overflow:hidden}
.math-page .metric-tile strong{overflow-wrap:anywhere;word-break:normal}
.math-page .math-output-panel{overflow-x:auto}
.math-page .bar-chart{max-width:100%;width:100%}
