/* Uses existing calculator design tokens, with no styles outside this page. */
.game-math .calculators-hero__inner{grid-template-columns:1fr;gap:1rem;padding-block:2rem}
.game-math .calculators-hero h1{max-width:30ch;font-size:clamp(1.85rem,3.4vw,3rem);line-height:1.12}
.game-math .calculators-hero__lead{max-width:78ch}
.game-math .math-takeaways{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.8rem;padding-block:.6rem 1.2rem}
.game-math .math-keypoints h2{font-size:1.2rem;margin:.8rem 0 0}
.game-math .math-takeaways p{margin:0;border-left:3px solid var(--calc-accent);padding:.4rem .8rem;font-size:.91rem;line-height:1.6}
.game-math .math-takeaways strong{display:block;color:var(--calc-text)}
.game-math .calc-guide{max-width:none}
.game-math .calculator-section+.calculator-section{border-top:4px solid var(--calc-accent);margin-top:clamp(3rem,6vw,5rem);padding-top:clamp(2rem,4vw,3.5rem)}
.game-math .calculator-section+.calculator-section>.calculator-section__heading{padding:1rem;border:1px solid var(--calc-line);border-radius:.8rem;background:var(--calc-field);margin-bottom:1.5rem}
.game-math .calculator-section__number{display:grid!important}
.game-math [data-math-step]{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.game-math [data-math-step]:active{background:var(--calc-accent);color:var(--calc-bg)}
.game-math .math-guide-copy{max-width:86ch}
.game-math input[type=range]{width:100%;height:28px;padding:0;border:0;accent-color:var(--calc-accent);cursor:pointer}
.game-math .math-slider-label{font-size:.75rem!important;font-weight:400!important;color:var(--calc-muted)!important}
.game-math .math-error{padding:.7rem;border:1px solid #d17b7b;border-radius:.5rem;background:#451e29;color:#ffe0e4}
.game-math [hidden]{display:none!important}
.game-math .math-review{font-size:.82rem;color:var(--calc-muted);margin:.8rem 0 0}
.game-math .math-modes{border:0;padding:0;margin:0 0 1.2rem;display:flex;flex-wrap:wrap;gap:.6rem}
.game-math .math-modes legend{font-weight:700;margin-bottom:.5rem;color:var(--calc-text)}
.game-math .math-modes label{display:flex;align-items:center;gap:.5rem;border:1px solid var(--calc-line);border-radius:.6rem;padding:.6rem .7rem;min-height:44px;cursor:pointer;font-size:.9rem}
.game-math .math-modes input{width:18px;height:18px;padding:0;accent-color:var(--calc-accent);flex:none}
.game-math .math-modes label:has(:checked){border-color:var(--calc-accent);background:var(--calc-field)}
.game-math .math-presets{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin:1rem 0}
.game-math .math-presets>span{flex-basis:100%;font-size:.85rem;color:var(--calc-muted)}
.game-math .math-presets button{background:var(--calc-field);color:var(--calc-text);border:1px solid var(--calc-line);border-radius:.6rem;min-height:44px;padding:.5rem .8rem;font:inherit;font-size:.85rem;cursor:pointer}
.game-math .math-presets button:hover{border-color:var(--calc-accent)}
.game-math .math-comparison{width:100%;table-layout:fixed;border-collapse:collapse;margin:1rem 0;font-variant-numeric:tabular-nums;font-size:.95rem;line-height:1.5}
.game-math .math-comparison caption{text-align:left;font-weight:600;color:var(--calc-text);padding:.5rem 0}
.game-math .math-comparison :is(th,td){padding:.8rem;border-bottom:1px solid var(--calc-line);text-align:left;vertical-align:top;overflow-wrap:anywhere}
.game-math .math-comparison thead th{color:var(--calc-accent);background:var(--calc-field)}
.game-math .math-comparison th{font-weight:600;width:34%}
.game-math .math-comparison td{color:var(--calc-text)}
.game-math .math-prob-value{display:block;font-weight:700}
.game-math .math-prob-track{display:block;background:var(--calc-line);height:9px;border-radius:5px;overflow:hidden;margin-top:.5rem}
.game-math .math-prob-fill{display:block;height:100%}
.game-math .math-prob-fill--loss{background:#df8799}.game-math .math-prob-fill--equal{background:#9db0c6}.game-math .math-prob-fill--profit{background:#24bba4}
.game-math .math-detail{border:1px solid var(--calc-line);padding:.9rem;border-radius:.6rem;margin:1rem 0}
.game-math .math-detail summary{cursor:pointer;font-weight:600;color:var(--calc-accent);min-height:32px}
.game-math .math-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.game-math .math-field-error{color:#ffb4c2!important;font-weight:600}
.game-math .math-pending{border-color:var(--calc-line);background:var(--calc-field);color:var(--calc-copy)}
.game-math .math-back{display:inline-block;margin-top:1rem;font-size:.9rem;padding:.4rem 0}
.game-math :is(button,input,summary,a):focus-visible{outline:2px solid var(--calc-accent);outline-offset:3px}
.game-math .math-wide{grid-column:1/-1;min-width:0}
.game-math .math-notice{border-left:3px solid var(--calc-accent);padding:.8rem 1rem;background:var(--calc-field);line-height:1.6}
.game-math .math-example{font-size:.85rem;line-height:1.6;color:var(--calc-muted)}
.game-math .math-sources{padding-block:1.3rem;border-top:1px solid var(--calc-line);font-size:.9rem;line-height:1.6}
.game-math .math-sources h2{font-size:1.4rem}
.game-math a{color:var(--calc-accent);text-underline-offset:3px}
.game-math .math-sources ul{padding-left:1.3rem}
.game-math :is(.calc-guide,.math-sources,#tooriistad){scroll-margin-top:7rem}
.game-math .calculator-result-wrap{position:static}
.game-math [data-output]{scroll-margin-block:7rem 2rem}
.game-math .math-stale{opacity:.65;border-left:3px dashed var(--calc-muted);padding-left:.6rem}
.game-math .calc-form{gap:.7rem}
.game-math .math-modes{margin-bottom:.3rem}
.game-math .math-presets{margin:.25rem 0}
.game-math .math-quick{font-size:.85rem;line-height:1.5;border-left:3px solid var(--calc-accent);padding:.5rem .7rem;margin:.25rem 0;background:var(--calc-field)}
.game-math :is(.math-quick,.math-mode-note):empty{display:none}
.game-math .math-mode-note{font-size:.85rem;padding:.5rem;border:1px solid var(--calc-line)}
.game-math .math-models{margin:1rem 0;max-width:95ch}
.game-math .math-guide{border:1px solid var(--calc-line);border-radius:.6rem;padding:.85rem 1rem;margin:1rem 0}
.game-math .math-guide summary{color:var(--calc-accent);font-weight:650;cursor:pointer;min-height:32px}
.game-math .math-guide .calc-guide__steps{margin-top:.8rem}
.game-math .math-guide-copy{margin-top:1rem}
.game-math .math-guide-copy h3{font-size:1.15rem;margin:1rem 0 .4rem}
.game-math .math-guide-copy p{line-height:1.65;margin:.5rem 0}
.game-math .math-formula{font-variant-numeric:tabular-nums}
.game-math .calculator-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.25rem}
.game-math .math-error:empty{display:none}
html[data-taring-theme=light] .game-math .math-error{background:#fff0f0;color:#821e2a}
html[data-taring-theme=light] .game-math .math-field-error{color:#9b1932!important}
html[data-taring-theme=light] .game-math .math-pending{background:var(--calc-field);color:var(--calc-copy)}
@media(max-width:720px){.game-math .math-takeaways{grid-template-columns:1fr}.game-math .calculators-tool-grid{grid-template-columns:1fr}.game-math .calculators-hero__inner{padding-block:1.4rem}.game-math .math-comparison{font-size:.875rem}.game-math .math-comparison :is(th,td){padding:.6rem .35rem}.game-math .math-detail{padding:.6rem}}

/* Educational visuals share the site's theme tokens; no external chart library. */
.game-math{--math-a:#59d8c0;--math-b:#f5bb69;--math-loss:#df8799}
html[data-taring-theme=light] .game-math{--math-a:#087763;--math-b:#915012;--math-loss:#a54158}
.game-math .math-model-cards{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin:1rem 0 .6rem}
.game-math .math-model-card{border:1px solid var(--calc-line);border-top:3px solid var(--math-a);border-radius:.8rem;padding:1rem;background:var(--calc-field)}
.game-math .math-model-card.math-model-b{border-top-color:var(--math-b)}
.game-math .math-model-card h3{font-size:1.03rem;line-height:1.45;margin:0 0 .5rem;display:flex;gap:.6rem;align-items:start}
.game-math .math-model-card h3 span{font-size:1.25rem;line-height:1.2;color:var(--math-a)}
.game-math .math-model-b h3 span{color:var(--math-b)}
.game-math .math-model-card p{font-size:.94rem;line-height:1.6;margin:.4rem 0}
.game-math .math-model-card small{color:var(--calc-muted);line-height:1.5;display:block}
.game-math .math-volatility{display:flex;flex-direction:column;gap:1.4rem}
.game-math .math-volatility .calc-form{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);column-gap:1.6rem;align-items:start}
.game-math .math-volatility .calc-form>.calc-field{grid-column:1;grid-row:1}
.game-math .math-volatility .math-quick-comparison{grid-column:2;grid-row:1/4;border:0;background:none;padding:0;margin:0}
.game-math .math-volatility :is(.math-presets,.calculator-actions){grid-column:1;align-self:start}
.game-math .math-volatility .calc-form>.calculator-actions{margin-bottom:auto}
.game-math .math-quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:.7rem}
.game-math .math-quick-grid>div{border:1px solid var(--calc-line);border-top:3px solid var(--math-a);border-radius:.6rem;padding:.7rem;background:var(--calc-field);min-width:0}
.game-math .math-quick-grid>.math-model-b{border-top-color:var(--math-b)}
.game-math .math-quick-grid>div>strong{color:var(--math-a);font-size:.96rem}
.game-math .math-quick-grid>.math-model-b>strong{color:var(--math-b)}
.game-math .math-quick-grid span{display:block;font-size:.8rem;line-height:1.4;margin-top:.6rem}
.game-math .math-quick-grid b{display:block;color:var(--calc-text);font-size:1.23rem;margin-top:.2rem;font-variant-numeric:tabular-nums;white-space:nowrap}
.game-math .math-shared-mean{margin:0 0 .7rem;font-size:.88rem;line-height:1.5;color:var(--calc-copy)}
.game-math .math-why{font-size:.87rem;line-height:1.55;margin:.7rem 0 0;color:var(--calc-copy)}
.game-math .math-volatility .calculator-result-wrap{border-top:1px solid var(--calc-line);padding-top:1rem;min-width:0}
.game-math .math-volatility [data-output]>h3{font-size:1.2rem;margin:0}
.game-math .math-simulation{border:1px solid var(--calc-line);border-radius:.8rem;padding:1.1rem;background:var(--calc-field);min-width:0}
.game-math .math-sim-heading{display:flex;gap:1rem;justify-content:space-between;align-items:start}
.game-math .math-sim-heading h3{font-size:1.2rem;margin:0 0 .4rem}
.game-math .math-sim-heading p{font-size:.9rem;line-height:1.5;margin:0;max-width:70ch}
.game-math .math-motion{display:flex;gap:.5rem;align-items:center;flex-shrink:0;font-size:.85rem;min-height:44px;cursor:pointer}
.game-math .math-motion input{width:18px;height:18px;accent-color:var(--calc-accent);margin:0}
.game-math .math-sim-actions{display:flex;gap:.6rem;flex-wrap:wrap;margin:1rem 0}
.game-math .math-sim-actions button{min-height:44px;padding:.6rem .85rem;border:1px solid var(--calc-line);border-radius:.5rem;background:var(--calc-field);color:var(--calc-text);font:inherit;font-size:.88rem;cursor:pointer}
.game-math .math-sim-actions [data-sim-start]{border-color:var(--calc-accent);color:var(--calc-accent);font-weight:650}
.game-math .math-sim-actions button:disabled{opacity:.45;cursor:default}
.game-math .math-sim-actions button:not(:disabled):hover{background:var(--calc-panel);border-color:var(--calc-accent)}
.game-math .math-sim-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.8rem}
.game-math .math-sim-metrics>div{border-left:3px solid var(--calc-line);padding:.35rem .7rem;min-width:0}
.game-math .math-sim-metrics>.math-model-a{border-color:var(--math-a)}
.game-math .math-sim-metrics>.math-model-b{border-color:var(--math-b)}
.game-math .math-sim-metrics :is(span,small){display:block;font-size:.8rem;line-height:1.5;color:var(--calc-muted)}
.game-math .math-sim-metrics strong{display:block;font-size:1.35rem;white-space:nowrap;color:var(--calc-text);font-variant-numeric:tabular-nums}
.game-math .math-chart{margin:1rem 0 0;min-width:0}
.game-math .math-chart svg{display:block;width:100%;height:350px;overflow:visible}
.game-math .math-chart text{fill:var(--calc-muted);font-family:inherit;font-size:12px}
.game-math .math-chart .math-chart-empty{font-size:22px}
.game-math .math-chart-grid{stroke:var(--calc-line);stroke-width:1}
.game-math .math-chart-zero{stroke:var(--calc-text);stroke-opacity:.65;stroke-width:1.5}
.game-math .math-chart-a{stroke:var(--math-a);stroke-width:2.5;fill:none;vector-effect:non-scaling-stroke}
.game-math .math-chart-b{stroke:var(--math-b);stroke-width:2.5;stroke-dasharray:7 3;fill:none;vector-effect:non-scaling-stroke}
.game-math .math-chart-mean{stroke:var(--calc-muted);stroke-width:1.5;stroke-dasharray:3 5}
.game-math .math-chart-cursor{stroke:var(--calc-muted);stroke-width:1;stroke-opacity:.5}
.game-math .math-chart figcaption{font-size:.88rem;line-height:1.6;min-height:4.8em;margin:.3rem 0}
.game-math .math-chart-key{display:flex;flex-wrap:wrap;gap:.5rem 1rem;font-size:.8rem;margin:.6rem 0}
.game-math .math-chart-key span:before{content:"";display:inline-block;width:22px;border-top:3px solid var(--math-a);margin-right:6px;vertical-align:middle}
.game-math .math-chart-key .math-key-b:before{border-color:var(--math-b);border-top-style:dashed}
.game-math .math-chart-key .math-key-mean:before{border-color:var(--calc-muted);border-top:2px dotted}
.game-math .math-return-visual{margin-bottom:1.2rem;padding-bottom:1rem;border-bottom:1px solid var(--calc-line)}
.game-math .math-return-visual p{font-size:.95rem;margin:0 0 .7rem;line-height:1.5}
.game-math .math-return-track{display:flex;height:22px;overflow:hidden;border-radius:6px;background:var(--calc-line);margin:.6rem 0}
.game-math .math-return-paid{background:var(--math-a)}
.game-math .math-return-cost{background:var(--math-loss)}
.game-math .math-return-labels{display:grid;grid-template-columns:1fr 1fr;gap:.75rem;margin:.7rem 0}
.game-math .math-return-labels span{font-size:.83rem;line-height:1.5}
.game-math .math-return-labels strong{display:block;font-size:1.1rem;color:var(--calc-text)}
.game-math .math-return-labels i{display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:5px;background:var(--math-a)}
.game-math .math-return-labels .math-swatch-cost{background:var(--math-loss)}
.game-math :is(.math-return-visual,.math-history)>small{display:block;font-size:.8rem;line-height:1.5;color:var(--calc-muted)}
.game-math .math-future-comparison{display:grid;grid-template-columns:1fr 1fr;gap:.7rem}
.game-math .math-future-comparison>div{border:1px solid var(--calc-line);border-radius:.6rem;padding:.8rem;background:var(--calc-field)}
.game-math .math-future-comparison :is(span,small){display:block;font-size:.83rem;line-height:1.45}
.game-math .math-future-comparison strong{display:block;font-size:clamp(1.25rem,2.5vw,1.8rem);color:var(--calc-accent);margin:.4rem 0;overflow-wrap:anywhere}
.game-math .math-chance-track{height:12px;background:var(--calc-line);border-radius:6px;overflow:hidden;margin:1rem 0}
.game-math .math-chance-track>span{display:block;height:100%;background:var(--math-a)}
.game-math .math-history{border-top:1px solid var(--calc-line);padding-top:.7rem;margin-top:1rem}
.game-math .math-history p{font-size:.9rem;margin:.5rem 0}
.game-math .math-history>div{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.6rem;margin:.8rem 0}
.game-math .math-history span{font-size:.8rem;border-left:2px solid var(--calc-accent);padding-left:.5rem;line-height:1.45}
.game-math .math-history strong{display:block;overflow-wrap:anywhere}
@media(max-width:720px){
 .game-math .math-model-cards{gap:.6rem}
 .game-math .math-model-card{padding:.75rem}
 .game-math .math-model-card h3{display:block;font-size:.93rem}
 .game-math .math-model-card h3 span{display:block;margin-bottom:.3rem}
 .game-math .math-model-card p{font-size:.85rem}
 .game-math .math-model-card small{font-size:.76rem}
 .game-math .math-volatility .calc-form{display:flex;flex-direction:column;gap:.75rem}
 .game-math .math-volatility .calc-form>*{width:100%}
 .game-math .math-volatility .math-presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.35rem}
 .game-math .math-volatility .math-presets button{padding:.5rem .2rem;font-size:.77rem}
 .game-math .math-quick-grid b{font-size:1.12rem}
 .game-math .math-simulation{padding:.7rem}
 .game-math .math-sim-heading{display:block}
 .game-math .math-motion{margin-top:.4rem}
 .game-math .math-sim-actions{gap:.4rem}
 .game-math .math-sim-actions button{font-size:.8rem;flex:1 1 auto}
 .game-math .math-sim-actions [data-sim-start]{flex-basis:100%}
 .game-math .math-sim-metrics{gap:.4rem;grid-template-columns:1fr 1fr}
 .game-math .math-sim-metrics>div:first-child{grid-column:1/-1;display:flex;align-items:baseline;gap:.6rem;flex-wrap:wrap}
 .game-math .math-sim-metrics strong{font-size:1.15rem}
 .game-math .math-chart svg{height:300px}
 .game-math .math-sim-metrics small{font-size:.74rem}
}
@media(prefers-reduced-motion:reduce){.game-math *, .game-math *:before, .game-math *:after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
/* The result card and hero keep a dark surface in both colour modes, so their
   text tokens stay on the dark palette even when the page is in light mode. */
html[data-taring-theme=light] .game-math :is(.calculator-result,.calculators-hero){--calc-surface:#102438;--calc-field:#091b2a;--calc-text:#f4f8fc;--calc-copy:#c5d4e0;--calc-muted:#a6bccb;--calc-line:#365165;--calc-accent:#59e0bc;--calc-active:#09352f;--math-a:#59d8c0;--math-b:#f5bb69;--math-loss:#df8799}
