/* Multiply Charges */
/* the number sentence controls: number × number, each with its label above */
.mc-build{display:inline-flex;align-items:flex-end;gap:.4em .45em}
.mc-build>.ctl{flex-direction:column;flex-wrap:nowrap;align-items:center;gap:.15em}
.mc-build .ctl-label{line-height:1.1}
.mc-build .stepper{min-height:max(2.5em,44px)}
.mc-build .stepper input{width:2.7ch;min-width:0}
.mc-times{font:700 1.75em/1 var(--font-head);padding-bottom:.28em}
.mc-run,.mc-extras{display:inline-flex;align-items:center;gap:.5em}
.mc-extras{gap:.5em .6em}
.mc-play{min-width:5.4em;font-size:1.1em}
.mc-optbtn,.mc-done{display:none}
.mc-body{position:relative}

/* the stage: the sign rule, the number sentence and the counters on top; the charges; the line of words under them */
.mc-stage{display:flex;flex-direction:column}
.mc-head{flex:none;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:.3em 1em;height:4.3em;padding:.35em .9em 0}
.mc-sum{grid-column:2;font-size:2.45em;font-weight:700;line-height:1;white-space:nowrap;font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.mc-sum .ans{display:inline-block;min-width:1.5em;padding:.07em .2em .1em;border:.07em solid var(--ink);border-radius:.18em;background:#fff;text-align:center}
.mc-sum .ans.q{border-style:dashed;color:var(--soft)}
.mc-sum .ans.pop{animation:mc-pop .6s ease-out}
.mc-tally{grid-column:3;justify-self:end;display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:center;gap:.3em .4em;max-height:100%;overflow:hidden}
.mc-pill{display:inline-flex;align-items:baseline;gap:.3em;padding:.15em .75em .2em;border:2px solid var(--ink);border-radius:999px;background:#fff;font-weight:600;white-space:nowrap}
.mc-pill b{font-size:1.4em;font-variant-numeric:tabular-nums}
.mc-pill.mc-count{background:var(--gold-tint)}
.mc-pill.mc-you{border-style:dashed;align-items:center}
.mc-pill.mc-you b{font-size:1em}

/* the sign rule: four boxes that light up */
.mc-strip{grid-column:1;justify-self:start;display:flex;align-items:center;gap:.45em}
.mc-strip-t{font:700 .8em/1.1 var(--font-head);color:var(--soft);text-align:right}
.mc-cells{display:grid;grid-template-columns:repeat(2,auto);gap:.22em .3em}
.mc-cell{display:inline-flex;align-items:center;gap:.16em;padding:.08em .4em;border:2px dashed #b7c1cc;border-radius:.55em;background:#fff;font-weight:700;font-size:1.02em;color:var(--soft)}
.mc-cell i{font-style:normal;padding:0 .05em}
.mc-cell[data-lit="1"]{border-style:solid;border-color:var(--ink);color:var(--ink);background:var(--gold-tint)}
.mc-cell.now{box-shadow:0 0 0 2px var(--blue)}

.mc-mini{width:1.3em;height:1.3em;flex:none;display:block}
@keyframes mc-pop{0%{transform:scale(.7)}55%{transform:scale(1.16)}100%{transform:scale(1)}}
@keyframes mc-light{0%{transform:scale(.9);background:var(--sun)}50%{transform:scale(1.06);background:var(--sun)}100%{transform:scale(1)}}
.mc-cell.pop{animation:mc-light .8s ease-out}

.mc-pic{flex:1;min-height:0;position:relative}
.mc-pic>svg{position:absolute;inset:0;width:100%;height:100%;display:block;overflow:hidden}
.mc-saybox{flex:none;height:5em;display:flex;align-items:center;justify-content:center;padding:0 .8em .45em}
.mc-say{margin:0;max-width:60em;padding:.35em 1em .4em;background:#fff;border:2px solid var(--ink);border-radius:.7em;font:600 1.08em/1.3 var(--font-head);text-align:center;color:#2b3440;text-wrap:balance}
.mc-say:empty{visibility:hidden}
.mc-verdict{font-weight:700}
.mc-verdict.right{color:var(--green)}
.mc-verdict.wrong{color:#b3480a}

/* Predict: three large buttons in the place of the line of words, with plain space under them */
.mc-predict{align-self:flex-start;margin-top:.3em;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.3em .8em}
.mc-pq{font-weight:700;font-size:1.05em}
.mc-predict .seg{gap:.5em}
.mc-predict .seg .btn,.mc-predict .seg .btn:first-child,.mc-predict .seg .btn:last-child{border-radius:.7em;margin-left:0;min-height:2.6em;padding:0 1em;font-size:1.08em}
.mc-pb{display:inline-flex;align-items:center;gap:.45em}
.mc-pb .mc-mini{width:1.35em;height:1.35em}

/* the pattern table beside the field */
.mc-pat{width:15.5em;gap:.5em;padding:.7em .6em .9em}
.mc-pat-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:.1em .5em;padding:0 .3em}
.mc-pat-head b{font-size:1.05em}
.mc-each{font-weight:700;color:var(--green)}
/* each line takes two rows; the step mark sits on the right, between two lines, as on a whiteboard */
.mc-lines{list-style:none;margin:0;padding:0 0 .2em;display:grid;grid-template-columns:auto auto;align-content:start;justify-content:center;column-gap:.2em;min-height:0;overflow-y:auto}
.mc-line{grid-column:1;display:flex;align-items:baseline;padding:.2em .35em;border:2px solid transparent;border-radius:.5em;font:700 1.05em/1.05 var(--font-head);font-variant-numeric:tabular-nums;white-space:nowrap}
.mc-line .pa{width:2.35em;text-align:right}
.mc-line .px{width:1.1em;text-align:center}
.mc-line .pv{width:2.1em;text-align:right}
.mc-line.now{background:var(--gold-tint);border-color:var(--ink)}
.mc-stepmark{grid-column:2;align-self:center;display:flex;align-items:center;gap:.05em;font:700 .88em/1 var(--font-head);color:var(--green);white-space:nowrap}
.mc-stepmark svg{width:1.3em;height:1.3em;flex:none}

/* the options panel of a phone */
.mc-opts{display:none}

/* the charges and the parts of the picture */
#pic .mc-body{stroke:var(--ink)}
#pic .mc-ring{fill:none}
#pic .mc-sign{fill:none;stroke-linecap:round}
#pic .mc-shadow{fill:var(--ink);fill-opacity:.17}
#pic .mc-halo{fill:none;stroke:var(--gold)}
#pic .mc-cap rect{fill:var(--gold-tint);stroke:var(--ink)}
#pic .mc-loopline{stroke:var(--ink)}
#pic .mc-badge circle{fill:#fff;stroke:var(--ink)}
#pic .mc-badge text{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle;fill:var(--ink)}
#pic .mc-field{fill:#fff;fill-opacity:.8;stroke:#9aa6b4;stroke-width:2}
#pic .mc-box{fill:#fff;fill-opacity:.8;stroke:#7b8694;stroke-width:2;stroke-dasharray:9 6}
#pic .mc-wm{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle;fill:var(--ink)}
#pic .mc-ghostloop{fill:#f4f7fb;fill-opacity:.7;stroke:#9aa6b4}
#pic .mc-ghostch circle{fill:#f4f7fb;stroke:#9aa6b4;stroke-width:2}
#pic .mc-ghostch path{fill:none;stroke:#aeb8c4;stroke-linecap:round}
#pic .mc-label text{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle}
#pic .mc-label .lead{fill:var(--ink)}
#pic .mc-label .rest{fill:#465060;font-weight:600}
#pic .mc-burst{fill:#ffe79a;fill-opacity:0;stroke:var(--gold)}

@media (prefers-reduced-motion:reduce){.mc-sum .ans.pop,.mc-cell.pop{animation:none}}

/* a narrow stage (a tablet, or a small laptop with the pattern beside the field): the counters go under the sign rule
   and the sentence. The stage is the frame less the pattern panel (15.5em). */
@container (min-width:681px) and (max-width:900px){
  .mc-head{grid-template-columns:auto 1fr;grid-template-rows:auto auto;height:7em;gap:.35em .6em;padding:.35em .6em 0}
  .mc-strip{grid-row:1;grid-column:1;min-width:max-content}
  .mc-sum{grid-row:1;grid-column:2;justify-self:center;font-size:2.05em}
  .mc-tally{grid-row:2;grid-column:1/-1;justify-self:center;justify-content:center}
}
@container (min-width:901px) and (max-width:1140px){
  .mc-pat-on .mc-head{grid-template-columns:auto 1fr;grid-template-rows:auto auto;height:7em;gap:.35em .6em;padding:.35em .6em 0}
  .mc-pat-on .mc-strip{grid-row:1;grid-column:1;min-width:max-content}
  .mc-pat-on .mc-sum{grid-row:1;grid-column:2;justify-self:center;font-size:2.05em}
  .mc-pat-on .mc-tally{grid-row:2;grid-column:1/-1;justify-self:center;justify-content:center}
}
/* a middle-sized tool (tablet): the stage is narrower, so the longest lines take three lines */
@container (min-width:681px) and (max-width:1100px){.mc-saybox{height:6em}}
/* a narrow tool (phone): the toggles go into an options panel; the pattern goes under the field */
@container (max-width:680px){
  .tool-bar{gap:.45em .4em;padding:.45em;justify-content:center}
  .tool-bar>.spacer{display:none}
  .mc-build{gap:.3em .3em}
  .mc-build .stepper button{width:40px}
  .mc-build .stepper input{width:2.3ch;padding:0}
  .mc-times{font-size:1.45em}
  .mc-optbtn{display:inline-flex;order:1;padding:0 .7em}
  .mc-run{order:2;gap:.4em}
  .mc-play{min-width:4.6em}
  .mc-opts{position:absolute;inset:0;z-index:5;background:#fff;flex-direction:column;align-items:flex-start;gap:.7em;padding:.8em 1em 1.6em;overflow:auto}
  .mc-opts.open{display:flex}
  .mc-done{display:inline-flex;align-self:flex-end}
  .mc-body{flex-direction:column}
  .mc-head{grid-template-columns:1fr;grid-template-rows:auto auto;justify-items:center;height:5.1em;padding:.3em .4em 0;gap:.3em}
  .mc-sum{grid-column:1;grid-row:1;font-size:1.9em}
  .mc-strip{grid-column:1;grid-row:2;justify-self:center}
  .mc-strip-t{display:none}
  .mc-cells{grid-template-columns:repeat(4,auto);gap:.25em}
  .mc-cell{font-size:.8em;padding:.08em .28em;gap:.1em}
  .mc-mini{width:1.25em;height:1.25em}
  .mc-tally{display:none}
  .mc-saybox{height:6.6em;padding:0 .4em .45em}
  .mc-say{font-size:.95em;padding:.3em .6em}
  .mc-predict{flex-direction:column;gap:.3em}
  .mc-predict .seg{gap:.35em}
  .mc-predict .seg .btn,.mc-predict .seg .btn:first-child,.mc-predict .seg .btn:last-child{padding:0 .6em;font-size:1em}
  .mc-pat{flex:none;width:auto;height:4.3em;flex-direction:row;align-items:center;gap:.4em;padding:.3em .4em;border-left:0;border-top:2px solid var(--ink);overflow:hidden}
  .mc-pat-head{flex:none;font-size:.82em;line-height:1.15;padding:0 .2em}
  .mc-lines{flex:1;min-width:0;display:flex;flex-direction:row;align-items:center;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;padding:.15em 0}
  .mc-line{flex:none;padding:.3em .45em;border-color:var(--line);background:#fff;font-size:.98em}
  .mc-line .pa,.mc-line .px,.mc-line .pb,.mc-line .pv{width:auto;padding:0 .08em}
  .mc-stepmark{flex:none;padding:0 .15em;flex-direction:column;gap:0;font-size:.85em}
  .mc-stepmark svg{transform:rotate(-90deg);width:1.15em;height:1.15em}
}
