/* Algebra Tiles */
.at-body{position:relative}
.at-stage{display:flex;flex-direction:column}

/* the expression: two lines with a fixed height, so that the mat does not move when the words change */
.at-head{flex:none;height:4.8em;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.05em;padding:.35em .8em 0;overflow:hidden}
.at-l1,.at-l2{max-width:100%;white-space:nowrap;overflow:hidden;text-align:center;font-weight:700;line-height:1.2;color:var(--ink);font-variant-numeric:tabular-nums}
.at-l1{font-size:2.05em}
.at-l2{font-size:1.55em}
.at-head[data-mode=free] .at-l1{font-size:1.3em;font-weight:600;color:#39424e}
.at-head[data-mode=free] .at-l2{font-size:2.15em}
.at-m{white-space:nowrap}
.x{color:var(--blue);font-style:italic;padding-right:.05em}
.at-eq{display:inline-block;margin:0 .32em}
.at-l2 .at-eq:first-child{margin-left:0}
.at-ans{display:inline-block;padding:0 .22em;border-radius:.22em;background:var(--tint-yellow);box-shadow:inset 0 -.12em 0 var(--sun)}
.at-q{display:inline-block;min-width:1.4em;padding:0 .2em;border:.07em dashed #7b8694;border-radius:.18em;color:var(--soft);text-align:center;line-height:1.1}
.at-soft{color:var(--soft);font-weight:600}
.at-try{color:#39424e}
.at-neq{position:relative}
.at-neq::after{content:"";position:absolute;left:50%;top:.08em;bottom:.02em;width:.11em;border-radius:.06em;background:var(--red);transform:translateX(-50%) rotate(28deg)}
.at-tick{display:inline-block;position:relative;width:1em;height:1em;margin-left:.35em;vertical-align:-.12em;border-radius:50%;background:var(--green);border:.08em solid var(--ink)}
.at-tick::after{content:"";position:absolute;left:.3em;top:.12em;width:.24em;height:.48em;border:solid #fff;border-width:0 .12em .12em 0;transform:rotate(42deg)}

.at-pic{flex:1;min-height:0;position:relative}
.at-pic>svg{position:absolute;inset:0;width:100%;height:100%;display:block}
.at-bubble{position:absolute;z-index:5;display:flex;gap:.4em;padding:.35em;background:#fff;border:2px solid var(--ink);border-radius:.8em;box-shadow:3px 3px 0 var(--ink)}
.at-saybox{flex:none}

/* the side panel: the buttons of the mode and the words */
#side{width:15.5em;gap:.6em;padding:.75em .7em 1em}
.at-acts{display:flex;flex-direction:column;gap:.5em}
.at-acts .btn{width:100%}
.btn.ready{background:var(--gold)}
.btn.ready:hover{background:#ffc93d}
.at-sidehead{margin:0 0 -.25em;font:600 .82em var(--font-head);color:var(--soft)}
.at-frows{display:flex;flex-direction:column;gap:.45em}
.at-frow{display:flex;align-items:center;gap:.18em;font:700 1.4em/1 var(--font-head);color:var(--ink)}
.at-frow .stepper{font-size:.715em}
/* the arrow buttons of a stepper are 40 px high or more (the kit box is 42 px with its border) */
.at-frow .stepper,.own-row .stepper{min-height:max(2.5em,44px)}
.at-frow .stepper input{width:3ch}
.at-par{font-weight:600}
.at-fx{display:inline-block;min-width:1.15em;text-align:center}
.at-plus{display:inline-block;width:.8em;text-align:center}
.at-say{margin:0;padding:.55em .7em;border:2px solid var(--ink);border-radius:.7em;background:#fff;font:400 .98em/1.35 var(--font-body);color:#2b3440;min-height:6.2em}
.at-say.hint{font-weight:700;color:var(--ink)}
.at-say.good{background:var(--green-tint);border-color:var(--green);color:#0f5a2c;font-weight:700}
.at-sayeq{font:700 1.05em var(--font-head);color:var(--ink);white-space:nowrap}
.at-key{display:flex;align-items:center;gap:.55em;margin-top:auto;font:400 .86em/1.3 var(--font-body);color:var(--soft)}
.at-keytile{flex:none;width:1.35em;height:1.35em;border-radius:.25em;background:var(--red);border:2px solid var(--ink)}

/* make your own */
.at-own{position:absolute;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;padding:.8em;background:rgba(244,247,251,.86)}
.at-own[hidden]{display:none}
.own-card{max-width:100%;max-height:100%;overflow:auto;background:#fff;border:2px solid var(--ink);border-radius:.8em;padding:.8em 1.1em 1em;
  box-shadow:0 .3em 1.2em rgba(20,26,34,.2);display:flex;flex-direction:column;gap:.55em}
.own-card h2{margin:0;font-size:1.15em}
.own-hint{margin:0;color:var(--soft);font:400 .9em var(--font-body)}
.own-grid{display:grid;grid-template-columns:repeat(2,auto);gap:.45em 1.4em;justify-content:center}
.own-row{display:flex;align-items:center;gap:.5em}
.own-pic{flex:none;width:2.4em;height:2.4em;overflow:visible}
.own-pic .at-sh rect{fill:var(--ink);fill-opacity:.17}
.own-pic .at-body{stroke:var(--ink)}
.own-pic .at-rim{fill:none}
.own-pic .at-halo{fill:none;stroke:none}
.own-pic .at-name{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle}
.own-pic .at-var{font-style:italic}
.own-name{min-width:2.3em;font:700 1.15em var(--font-head)}
.own-row .stepper input{width:2.2ch}
.own-prev{display:flex;justify-content:center;min-height:1.6em;font:700 1.35em var(--font-head)}
.own-btns{display:flex;flex-wrap:wrap;gap:.5em;justify-content:flex-end}

/* the picture */
#pic .at-board{fill:#fff;stroke:var(--ink);stroke-width:2}
#pic .at-tray{fill:#fff;stroke:var(--ink);stroke-width:2;transition:fill .15s}
#pic .at-cell{cursor:grab;outline:none}
#pic .at-cellbg{fill:transparent}
#pic .at-cell:hover .at-cellbg{fill:var(--desk)}
#pic .at-cell:focus-visible .at-cellbg{stroke:var(--blue);stroke-width:3}
#pic .at-celllab{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle;fill:#39424e}
#pic .at-sep{stroke:var(--line);stroke-width:1.5}
#pic .at-zline{fill:none;stroke:#7b8694;stroke-width:2;stroke-dasharray:10 7;stroke-linecap:round}
#pic .at-zsign{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle;fill:#7b8694}
#pic .at-bin{fill:none;stroke:var(--soft);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
#pic.at-over-bin .at-tray{fill:var(--red-tint);stroke:var(--red)}
#pic.at-over-bin .at-bin{stroke:var(--red)}
#pic.at-over-bin .bin .at-celllab{fill:var(--red)}
#pic .at-tile{cursor:grab;outline:none}
#pic .at-tile.at-lifted{cursor:grabbing}
#pic .at-tile:focus-visible .at-halo{stroke:var(--blue);stroke-opacity:1}
#pic .at-edge{cursor:default}
#pic .at-sh rect{fill:var(--ink);fill-opacity:.17}
#pic .at-lifted .at-sh rect{fill-opacity:.3}
#pic .at-body{stroke:var(--ink)}
#pic .at-rim{fill:none}
#pic .at-halo{fill:none;stroke:var(--gold);stroke-opacity:0}
#pic .at-addmark{fill:none;stroke:var(--sun);stroke-linecap:round}
#pic .at-name{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle;pointer-events:none}
#pic .at-var{font-style:italic}
#pic .at-area{fill:#f4f7fb;stroke:#9aa6b4;stroke-width:2;stroke-dasharray:8 6}
#pic .at-div{fill:none;stroke:#b6c1cd;stroke-width:1.5;stroke-dasharray:5 5}
#pic .at-frame{fill:none;stroke:var(--ink);stroke-linecap:round;stroke-linejoin:round}
#pic .at-times{stroke:#7b8694;stroke-linecap:round}
#pic .at-ghost rect{fill:#fff;fill-opacity:.75}
#pic .at-ghost.zero rect{fill:none;stroke-opacity:.5}
#pic .at-gname{fill-opacity:.7}
#pic .at-ghost.zero .at-gname{fill-opacity:.4}
#pic .at-box{fill:#fafbfd;stroke:#9aa6b4;stroke-width:2;stroke-dasharray:9 6}
#pic .at-boxlab{font-family:Lexend,Arial,sans-serif;font-weight:700;fill:var(--soft)}
#pic .at-burst{fill:#ffe79a;stroke:var(--gold)}
#pic .at-badge circle{fill:#fff;stroke:var(--ink);stroke-width:2.5}
#pic .at-badge text{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle;fill:var(--ink)}
#pic .at-sel{fill:none;stroke:var(--gold);stroke-width:4;stroke-dasharray:9 6;pointer-events:none}
#pic .at-sweep{stroke:var(--ink);fill-opacity:.82}
#pic .at-flash{fill:none;stroke:var(--gold)}

/* a middle-sized tool (tablet) */
@container (min-width:681px) and (max-width:1100px){
  #side{width:14em}
}
/* a narrow tool (phone): the buttons go above the picture, the words under it */
@container (max-width:680px){
  .tool-bar{gap:.45em .5em;padding:.45em}
  .tool-bar .ctl-label{display:none}
  .at-body{flex-direction:column}
  #side{order:-1;width:auto;flex:none;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:center;border-left:0;border-bottom:2px solid var(--ink);padding:.45em;gap:.45em;overflow:visible}
  .at-acts{flex:1 1 100%;flex-direction:row;gap:.45em}
  .at-acts .btn{width:auto;flex:1 1 0;padding:0 .5em}
  .at-frows{flex-direction:row;flex-wrap:wrap;justify-content:center;gap:.3em .7em}
  .at-frow{font-size:1.15em;gap:.12em}
  .at-frow .stepper{font-size:.87em}
  /* narrow steppers (buttons of 40 px), so that the two factors fit in one row and the picture has more height */
  .at-frow .stepper button{width:40px}
  .at-frow .stepper input{width:2.2ch;min-width:0}
  .at-plus{width:.75em}
  .at-fx{min-width:0}
  .at-sidehead,.at-key{display:none}
  .at-head{height:3.9em;padding:.25em .4em 0}
  .at-l1{font-size:1.6em}
  .at-l2{font-size:1.3em}
  .at-head[data-mode=free] .at-l1{font-size:1.1em}
  .at-head[data-mode=free] .at-l2{font-size:1.7em}
  .at-saybox{height:4.6em;display:flex;align-items:center;justify-content:center;padding:0 .4em .6em}
  .at-say{min-height:0;max-height:100%;overflow:hidden;font-size:.95em;line-height:1.3;padding:.3em .6em;text-align:center}
  /* the expression above the picture shows the result already: the words are short on a phone */
  .at-say .at-sayres{display:none}
  .own-grid{grid-template-columns:auto;gap:.35em}
}
