:root { color-scheme:light; font: 100%/1.55 system-ui,sans-serif; color:#172d3c; background:#eff5f7; }
* { box-sizing:border-box; }
body { margin:0; }
header, main, footer { margin-inline:auto; width:min(100% - 2rem, 72rem); }
header { display:flex; align-items:center; flex-wrap:wrap; gap:.75rem 1.25rem; padding-block:1rem; }
header a:first-child { font-weight:800; }
header label { margin-inline-start:auto; }
a { color:#065850; }
h1 { font-size:clamp(1.9rem,5vw,3rem); line-height:1.12; margin-block:1rem .7rem; }
h2 { margin-block:0 .8rem; }
main > p { max-width:65ch; }
.lab { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; align-items:start; }
section { background:#fff; border:1px solid #bed0d8; border-radius:1rem; padding:clamp(.85rem,3vw,1.65rem); }
.controls, .actions { display:flex; flex-wrap:wrap; gap:.65rem 1rem; }
.controls label { flex:1 1 9rem; }
input[type=range] { display:block; width:100%; min-height:2.75rem; accent-color:#08665d; }
input:not([type=range]), select, button { color:inherit; font:inherit; min-height:2.75rem; border:1px solid #77909e; border-radius:.5rem; padding:.35rem .65rem; max-width:100%; background:#fff; }
#ml-answer { display:block; width:min(100%,15rem); margin-block:.25rem .75rem; }
button { font-weight:650; background:#096359; color:white; border-color:#096359; cursor:pointer; }
button.secondary { background:white; color:#07574f; }
:focus-visible { outline:3px solid #ae4a20; outline-offset:3px; }
svg { display:block; width:100%; background:#f8fbfc; border-radius:.5rem; }
.equation { font-weight:750; font-variant-numeric:tabular-nums; unicode-bidi:isolate; }
.equation:empty { display:none; }
table { width:100%; text-align:center; border-collapse:collapse; }
caption { font-weight:700; padding:.5rem; }
th,td { border-bottom:1px solid #d2dfe4; padding:.15rem; }
#ml-position, #ml-progress { color:#3e5969; }
#ml-question { font-weight:700; }
#ml-status:not(:empty) { padding:.6rem .75rem; background:#e8f3f1; border-inline-start:3px solid #096359; }
footer { padding-block:1.5rem; }
@media (max-width:46rem) { .lab { grid-template-columns:1fr; } }

#worksheet { display:none; }
@media print {
  body:has(#worksheet) { background:white; color:black; }
  body:has(#worksheet) header,
  body:has(#worksheet) footer,
  body:has(#worksheet) main > :not(#worksheet) { display:none !important; }
  body:has(#worksheet) main { width:100%; }
  #worksheet { display:block; border:0; padding:0; }
  #sheet-tasks li { min-height:1.6cm; break-inside:avoid; }
  #sheet-key { break-before:page; }
}

.ml-metrics {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,9rem),1fr));gap:.5rem;margin-block:1rem;}
.ml-metrics div {background:#edf5f5;border:1px solid #c5d6db;border-radius:.5rem;padding:.65rem;min-width:0;overflow-wrap:anywhere;}
.ml-metrics dt {font-size:.85rem;color:#3e5969;}
.ml-metrics dd {margin:0;font-weight:700;font-variant-numeric:tabular-nums;}

.ml-print {border-top:1px solid #d2dfe4;margin-top:1.2rem;padding-top:1rem;}
.ml-print h3 {font-size:1.05rem;margin:0;}
@media print { @page { margin:16mm; } #worksheet {font-size:11pt;} #sheet-title {font-size:20pt;} #sheet-solutions li {margin-bottom:.55em;break-inside:avoid;} #sheet-tasks li {padding-inline-start:.35em;} }

/* Keep long translated option labels and feedback within the viewport. */
header label {min-width:0;max-width:100%;}
.lab > section {min-width:0;overflow-wrap:anywhere;}
#ml-skill {width:100%;}

/* Mathematical axes and signs retain LTR order on RTL pages. */
#ml-graph, #ml-graph text {direction:ltr;unicode-bidi:isolate;}

#eq-graph, #eq-graph text {direction:ltr;unicode-bidi:isolate;}
#graph-steps {font-weight:500; margin-block:.6rem; padding-inline-start:1.6rem;}
#exercise select {width:100%;}
#coordinates input {width:min(100%,12rem);}
#status:not(:empty) {padding:.6rem .75rem;background:#e8f3f1;border-inline-start:3px solid #096359;}

#coordinates:not([hidden]) {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;margin-block:.6rem;}
#coordinates label {display:grid;gap:.2rem;min-width:0;direction:ltr;}
#coordinates input {width:100%;}
