:root{color-scheme:light;font-family:system-ui,-apple-system,Segoe UI,sans-serif;background:#f3f6fb;color:#17243b}*{box-sizing:border-box}body{margin:0}.container{max-width:950px;margin:auto;padding:28px 18px 60px}header{margin-bottom:28px}h1{font-size:clamp(2rem,5vw,3rem);margin:.2em 0}h2{font-size:1.35rem;margin:0 0 16px}.eyebrow{font-size:.75rem;font-weight:800;letter-spacing:.13em;color:#2563eb}header>p:last-child{color:#50617b}.panel{background:#fff;border:1px solid #dbe3ee;border-radius:18px;padding:25px;margin:20px 0;box-shadow:0 7px 22px #192e5010}label{display:block;font-weight:700;margin-bottom:9px}input,select{width:100%;padding:13px 15px;border:1px solid #aebcd0;border-radius:9px;font:inherit;background:#fff;color:inherit}input:focus,select:focus{outline:3px solid #bed4ff;border-color:#2563eb}.controls{display:flex;align-items:end;gap:16px;margin-top:24px}.controls>div{flex:1}button{cursor:pointer;font:inherit;border:0;border-radius:9px;padding:13px 19px;font-weight:700;background:#2563eb;color:white}button:disabled{opacity:.55;cursor:wait}.hint{color:#586981;font-size:.91rem;line-height:1.55}.examples{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:24px}.examples span{font-size:.85rem;color:#64748b}.examples button{background:#e8effd;color:#184bb0;padding:8px 12px;font-size:.86rem}.formula{font-size:1.4rem;overflow-x:auto;padding:12px 0}.derivative{border-top:1px solid #e7edf5;padding:12px 0;overflow-x:auto}.step{padding:13px 0;border-bottom:1px solid #e7edf5}.step small{display:block;color:#526783;margin-top:6px}.step .math{overflow-x:auto}#message.error{padding:14px;background:#fff0f0;color:#9b1c1c;border-radius:9px}footer{color:#6b7890;font-size:.85rem;margin-top:30px}@media(max-width:550px){.controls{flex-direction:column;align-items:stretch}.controls>div{width:100%}.panel{padding:18px}}

.step-detail{font-size:.9rem;color:#526783;margin:7px 0 0;line-height:1.5}.math{overflow-x:auto;overflow-y:hidden;min-height:1.7em}mjx-container{max-width:100%}
.test-result{padding:12px 0;border-bottom:1px solid #e7edf5}.test-result b{font-size:.75rem;margin-right:10px}.pass{color:#167047}.fail{color:#b42318}.test-result p{color:#9b1c1c;margin:6px 0 0}.step .math{font-size:1.05rem}.step-detail{max-width:75ch}

/* v0.4: eliminate scrollbar spinners beside short MathJax expressions */
.step .math{overflow:visible;min-height:0;max-width:100%;overflow-wrap:anywhere}
.step{min-width:0}
.tests-page .tests-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.tests-page .tests-heading h2{margin:0}
.status-pill{border-radius:999px;padding:7px 12px;font-size:.82rem;font-weight:750}
.status-pass{background:#e7f6ed;color:#17623b}.status-fail{background:#ffeded;color:#a32424}
.test-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.test-stats>div{background:#f4f7fc;border:1px solid #e4ebf5;border-radius:12px;padding:17px;display:flex;flex-direction:column;gap:5px}
.test-stats strong{font-size:2rem;font-variant-numeric:tabular-nums}.test-stats span{color:#526783;font-size:.88rem}
.test-progress{height:10px;border-radius:999px;background:#f2d4d4;overflow:hidden;margin:18px 0 12px}
.test-progress>div{height:100%;background:#21865a;border-radius:999px}
.back-link{display:inline-block;margin-top:6px;color:#1958c4;font-weight:650}
.test-filters{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0 20px}
.test-filters button{background:#edf2fa;color:#28456f;font-size:.88rem;padding:10px 13px}
.test-filters button.active{background:#2563eb;color:#fff}
.test-table-wrap{overflow-x:auto}
.test-table{width:100%;border-collapse:collapse;text-align:left;font-size:.91rem}
.test-table th{font-size:.78rem;text-transform:uppercase;letter-spacing:.045em;color:#61738d;background:#f6f8fc}
.test-table th,.test-table td{padding:14px 12px;border-bottom:1px solid #e7edf5;vertical-align:top}
.test-table th:last-child,.test-table td:last-child{white-space:nowrap}
.test-name{font-weight:600;overflow-wrap:anywhere}.test-muted{color:#63738a}.test-error{color:#a32424;overflow-wrap:anywhere}
.test-state{font-size:.82rem;font-weight:750}.test-state.pass{color:#167047}.test-state.fail{color:#b42318}
.test-table tr[hidden]{display:none}
@media(max-width:600px){.test-stats>div{padding:12px}.test-stats strong{font-size:1.6rem}.test-table{font-size:.83rem}.test-table th,.test-table td{padding:10px 7px}}

/* v0.6: formula leggibile, nessuna scrollbar nelle righe brevi */
.derivative .math{font-size:1.35rem;line-height:1.8;overflow:visible}
.step .math{font-size:1.16rem;line-height:1.85;overflow:visible}
.step{overflow:visible}.step-detail{font-size:.96rem}
#steps .step:first-of-type{margin-top:8px}
@media(max-width:600px){.derivative .math{font-size:1.13rem}.step .math{font-size:1.04rem}}

/* v0.7: MathJax has no nested native scroll controls; allow natural line layout. */
#steps .step .math,#steps .step .math mjx-container{overflow:visible!important;max-height:none!important;min-height:0!important}
#steps .step .math{height:auto!important;max-width:none!important;scrollbar-width:none}
#steps .step .math::-webkit-scrollbar{display:none}
#steps .step .intermediate{font-size:1.08rem;color:#23436b;margin:8px 0}
#steps .step{padding:16px 0}
.derivative .math{font-size:1.48rem}

/* v0.8: avviso beta e attribuzione */
.beta-alert{margin:22px 0 10px;padding:17px 20px;border:1px solid #e9c78a;border-left:5px solid #b87917;background:#fff9eb;border-radius:12px;color:#624817;line-height:1.55}
.beta-alert strong{font-size:1rem}.beta-alert p{margin:6px 0 0;font-size:.93rem}
footer a{color:#1958c4;font-weight:700;text-decoration:underline;text-underline-offset:3px}
#steps .step small{font-weight:700;font-size:.93rem;color:#25436d}
#steps .step .math{font-size:1.17rem}

/* v0.9: gerarchia dei passaggi e footer beta sempre leggibile */
#steps .step>small{display:block;font-size:1rem;font-weight:750;color:#183a6d;margin:0 0 9px}
#steps .step .math{font-size:1.22rem;margin:7px 0}
#steps .step .intermediate{margin:10px 0;padding:9px 12px;background:#f5f8ff;border-radius:8px}
.beta-alert{display:block!important;visibility:visible!important}
footer a{display:inline-block;margin-left:8px}

/* v1.0 */
.auth-panel{max-width:530px}.auth-submit{margin-top:18px}.auth-error{color:#a32424;background:#fff0f0;padding:12px;border-radius:8px}.logout-form{display:inline-block;margin-left:16px}.logout-form button{padding:8px 12px;background:#e8effd;color:#184bb0}.beta-alert{display:block!important}#steps .step .intermediate{font-size:1.22rem}
/* v1.2: versione visibile in alto a destra */
.topline{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.topline .eyebrow{margin:0}
.version-label{font-size:.88rem;font-weight:750;color:#2155b4;background:#e8effd;border-radius:999px;padding:7px 12px;white-space:nowrap}
#steps .step .intermediate .math{font-size:1.35rem}

/* v1.3: formule didattiche uniformi e frazioni più leggibili */
#steps .step .math{font-size:1.35rem;line-height:1.85}
#steps .step .intermediate .math{font-size:1.48rem;line-height:1.9}
#steps .step:last-child .math{font-size:1.5rem}
#steps .step .math mjx-container{font-size:100%!important}
@media(max-width:600px){#steps .step .math{font-size:1.16rem}#steps .step .intermediate .math{font-size:1.25rem}}

/* v1.4: maggiore leggibilità dei risultati, senza ridurre le formule MathJax. */
#steps .step:last-child .math{font-size:1.65rem;line-height:2.1}
#steps .step .intermediate .math{font-size:1.55rem;line-height:2.05}
#steps .step .math{overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none}
#steps .step .math::-webkit-scrollbar{display:none}
@media(max-width:600px){#steps .step:last-child .math{font-size:1.28rem}#steps .step .intermediate .math{font-size:1.24rem}}

/* v1.5 */
.domain-box{margin:22px 0;padding:18px;border:1px solid #d8e4f5;border-radius:12px;background:#f7faff}
.domain-box h3{margin:0 0 12px}.domain-label{font-weight:700;color:#274a7a;margin:14px 0 6px}
.domain-box .math{font-size:1.18rem;overflow-x:auto;scrollbar-width:none}.domain-box .math::-webkit-scrollbar{display:none}

/* v1.6 */
.domain-conditions{margin:8px 0 12px}.domain-conditions .math{font-size:1.1rem;margin:5px 0}.domain-box .math{font-size:1.35rem}#steps .step:last-child .math{font-size:1.8rem}

/* v1.7 */
.interval-graph{margin:10px 0 18px}.interval-graph svg{display:block;width:100%;height:auto;max-height:120px}.graph-caption{font-size:.83rem;color:#526782;margin:0 0 6px}.domain-box .math{font-size:1.4rem}#steps .step:last-child .math{font-size:1.85rem}

/* v1.9: niente scrollbar verticali nelle formule MathJax; scroll solo orizzontale. */
#derivatives,.derivative,.derivative .math,#steps .step,#steps .step .math,#steps .step .intermediate,#steps .step .intermediate .math{height:auto!important;max-height:none!important;overflow-y:visible!important;}
.derivative .math,#steps .step .math{overflow-x:auto!important;scrollbar-width:thin;min-height:2.8em;padding:8px 2px;}
.derivative mjx-container,#steps mjx-container{max-height:none!important;overflow:visible!important;}
#steps .step:last-child .math{font-size:1.65rem;}

/* v2.0: nessuna barra verticale nelle formule, scorrimento solo orizzontale. */
.derivative .math,#steps .step .math,#steps .step .intermediate .math{
  display:block;box-sizing:border-box;max-height:none!important;height:auto!important;
  overflow-x:auto!important;overflow-y:hidden!important;
  padding:12px 3px 16px!important;line-height:normal!important;
}
.derivative mjx-container,#steps mjx-container{max-height:none!important;height:auto!important;vertical-align:middle!important;}

/* Versione 2.1: formule leggibili e grafico non duplicato */
#derivatives .derivative .math{font-size:1.75rem;line-height:2.1}
#steps .step:last-child .math{font-size:1.9rem;line-height:2.1}
#steps .step .intermediate .math{font-size:1.65rem}
.same-domain-note{font-size:.95rem;color:#25436d;background:#e8effd;padding:11px 14px;border-radius:9px;margin:10px 0 14px}
[hidden]{display:none!important}
@media(max-width:600px){#derivatives .derivative .math{font-size:1.35rem}#steps .step:last-child .math{font-size:1.4rem}#steps .step .intermediate .math{font-size:1.25rem}}

/* v2.2: risultati e stato della risoluzione più leggibili */
#steps .step:last-child>.math{font-size:1.85rem;line-height:2.2}
#steps .step .intermediate .math{font-size:1.65rem;line-height:2.1}
.domain-status{font-size:.9rem;line-height:1.55;color:#26466f;background:#eaf1ff;border-radius:8px;padding:10px 12px;margin:14px 0 6px}
@media(max-width:600px){#steps .step:last-child>.math{font-size:1.38rem}#steps .step .intermediate .math{font-size:1.3rem}}

/* v2.6: approfondimento per sqrt(x^2) */
.special-explanation{background:#fff;border:1px solid #d7e2f5;border-radius:10px;padding:15px 17px;margin:16px 0}.special-explanation h4{margin:0 0 10px;color:#183e7a}.special-explanation p{line-height:1.55}.special-explanation .math{overflow-x:auto;padding:8px 0;font-size:1.15rem}

/* v2.94: i risultati lunghi vanno a capo dove possibile; scorrimento solo come fallback. */
#derivatives .derivative{max-width:100%;min-width:0}
#derivatives .derivative .math{max-width:100%;overflow-x:auto!important;scrollbar-width:thin;overscroll-behavior-x:contain}
#steps .step{min-width:0;max-width:100%}
#steps .step .math{max-width:100%;scrollbar-width:thin}

/* 2.95: formule raccolte su più righe, con scorrimento di sicurezza per gli altri casi */
#derivatives .derivative, #steps .step {min-width:0;max-width:100%}
#derivatives .math, #steps .math {max-width:100%;overflow-x:auto;overflow-y:hidden}
#derivatives mjx-container[display="true"],#steps mjx-container[display="true"] {max-width:100%}

/* 3.00: formule multilinea ancorate a sinistra, senza altezze imposte. */
#derivatives .derivative .math, #steps .step .math {text-align:left!important;line-height:normal!important;height:auto!important;min-height:0!important;}
#derivatives .derivative .math mjx-container, #steps .step .math mjx-container {text-align:left!important;margin:0!important;max-height:none!important;}

/* 3.01: riepilogo copiabile dei soli test falliti */
.failed-tests-copy{display:block;box-sizing:border-box;width:100%;min-height:190px;max-height:360px;resize:vertical;overflow:auto;white-space:pre;font:14px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace;padding:14px;margin:12px 0;border:1px solid #c9d5e9;border-radius:8px;background:#f7faff;color:#15223d;}
.copy-failed-tests{margin:4px 12px 4px 0;padding:10px 16px;background:#2463eb;color:white;border:0;border-radius:7px;cursor:pointer;}
#copy-failed-feedback{font-size:14px;}
