/* Backtracking */
/* the controls at the side */
#side{width:18.6em;gap:.55em}
.bt-group{display:flex;flex-direction:column;gap:.42em}
.bt-row{display:flex;flex-wrap:wrap;align-items:center;gap:.42em}
.bt-row>.btn{flex:1 1 auto;padding:0 .6em}
.bt-go{font-size:1.12em;min-height:max(2.75em,46px)}
.bt-ico{width:1.3em;height:1.3em;flex:none}
.bt-build{border-color:var(--blue);color:var(--blue-ink)}
.bt-build:hover{background:var(--blue-tint)}
.bt-more{border-top:2px solid var(--grid-strong);padding-top:.55em}
.bt-speed .ctl{flex-wrap:nowrap;justify-content:space-between}
.bt-speed .seg{flex:1}
.bt-speed .seg .btn{flex:1 1 auto;padding:0 .5em}
.bt-opts .toggle{flex:1 1 auto}
.bt-tail{flex-direction:row;flex-wrap:wrap;gap:.42em}
.bt-tail:empty{display:none}
.tool-bar .seg .btn{padding:0 .75em}

/* the stage */
#pic text{font-family:Lexend,Arial,sans-serif;font-weight:700}
#pic .m-n,#pic .m-op,#pic .m-eq,#pic .m-bar{fill:currentColor}
#pic .m-x{fill:var(--blue);font-style:italic;font-weight:600}
#pic .m-paren{fill:none;stroke:currentColor;stroke-linecap:round}
#pic .bt-eq,#pic .bt-chart,#pic .bt-work-line{color:var(--ink)}
#pic .bt-shadow{fill:var(--ink);opacity:.1}
#pic .bt-cell-e{fill:#fff}
#pic .bt-cell-v{fill:#fff}
#pic .bt-cell-v.empty{fill:#eef3f9}
#pic .bt-cell-v.given{fill:var(--gold-tint)}
#pic .bt-cell-v.answer{fill:var(--gold)}
#pic .bt-divider{stroke:var(--ink)}
#pic .bt-outline{fill:none;stroke:var(--ink)}
#pic .bt-ghost{fill:rgba(255,255,255,.55);stroke:#b3c3d5;stroke-dasharray:7 6}
#pic .bt-fwd{color:var(--blue)}
#pic .bt-back{color:var(--red)}
#pic .bt-line{stroke:currentColor;stroke-linecap:round}
#pic .bt-case{stroke:var(--ink);stroke-linecap:round}
#pic .bt-head{fill:currentColor;stroke:var(--ink);stroke-linejoin:round}
#pic .bt-label rect{fill:#fff;stroke:currentColor}
#pic .bt-glow{stroke:var(--sun);stroke-linecap:round;opacity:.75}
#pic .bt-ask-mark{color:var(--red)}
#pic .bt-ask-mark rect{fill:#fff;stroke:currentColor;stroke-dasharray:5 4}
#pic .bt-dash{stroke:var(--red);stroke-dasharray:2 9;stroke-linecap:round;opacity:.7}
#pic .bt-pop,#pic [data-role=walk-label]{transform-box:fill-box;transform-origin:50% 50%}

/* the walking number */
#pic .bt-walker{pointer-events:none}
#pic .bt-walker-body{fill:var(--sun);stroke:var(--ink);stroke-linejoin:round}
#pic .bt-walker-num{color:var(--ink)}
#pic .bt-walker-eye{fill:#fff;stroke:var(--ink)}
#pic .bt-walker-pupil{fill:var(--ink)}
#pic .bt-walker-foot{fill:var(--orange);stroke:var(--ink)}
#pic .bt-walker-shadow{fill:var(--ink)}
#pic .bt-fly{color:var(--ink)}

/* the working: a page of an exercise book */
#pic .bt-work-card{fill:#fff;stroke:var(--ink)}
#pic .bt-work-tab{fill:#fff}
#pic .bt-work-title{fill:var(--soft);font-weight:600}
#pic .bt-rule{stroke:var(--grid-strong);stroke-width:1.2}
#pic .bt-work-ans{fill:var(--gold);stroke:var(--ink);stroke-width:2}
#pic .bt-note{color:var(--red)}
#pic .bt-note-bar{stroke:currentColor;stroke-linecap:round}

/* the ticks of the check */
#pic .bt-tick path{fill:none;stroke:var(--green);stroke-linecap:round;stroke-linejoin:round}
#pic .bt-tick-big circle{fill:var(--green);stroke:var(--ink)}
#pic .bt-tick-big path{fill:none;stroke:#fff;stroke-linecap:round;stroke-linejoin:round}

/* Ask me: a card in the band under the chart (a fixed height, which tool.js keeps free): the question or the hint,
   and four buttons */
.bt-ask{position:absolute;z-index:5;left:0;top:0;box-sizing:border-box;height:3.9em;display:flex;align-items:center;gap:.7em;max-width:calc(100% - 12px);padding:0 .55em 0 .75em;background:#fff;border:2px solid var(--ink);border-left:.5em solid var(--red);border-radius:.8em;box-shadow:0 .2em .7em rgba(20,26,34,.16)}
.bt-ask[hidden]{display:none}
.bt-ask-q{margin:0;width:11.5em;max-height:2.6em;overflow:hidden;font:700 .95em/1.3 var(--font-head);color:var(--ink)}
.bt-ask-q.hint{background:var(--gold-tint);border-radius:.4em;padding:.1em .45em;width:12.5em;font-weight:600}
.bt-ask-btns{display:flex;gap:.4em}
.bt-choice{font-size:1.15em;min-width:3.3em;padding:0 .55em;min-height:max(2.45em,42px)}
.bt-choice.wrong{background:var(--red-tint);border-color:#e7a597;color:#9b2b17;text-decoration:line-through;text-decoration-thickness:.1em;opacity:1}

/* Make your own */
.bt-own{position:absolute;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:.8em;background:rgba(244,247,251,.86)}
.bt-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.2em}
.own-help{margin:0;font:400 .95em/1.3 var(--font-body);color:var(--soft)}
.own-steps{display:flex;flex-direction:column;gap:.45em}
.own-step{display:flex;align-items:center;gap:.5em}
.own-n{font:600 .85em var(--font-head);color:var(--soft);min-width:3.6em}
.own-step .seg .btn{font-size:1.4em;min-width:1.75em;min-height:max(1.79em,42px);padding:0 .35em}
.own-rm,.own-rm-space{flex:none;width:max(2.5em,42px)}
.own-add{align-self:flex-start}
.own-right{display:flex;flex-wrap:wrap;align-items:center;gap:.5em;padding-top:.5em;border-top:2px solid var(--grid-strong)}
.own-right .stepper input{width:4.2ch}
.own-show{display:flex;flex-direction:column;align-items:center;gap:.2em;min-height:4.2em;justify-content:center;background:var(--desk);border-radius:.6em;padding:.4em}
.own-prev{display:block;font-size:1.3em;color:var(--ink);overflow:visible}
.own-prev text{font-family:Lexend,Arial,sans-serif;font-weight:700}
.own-prev .m-n,.own-prev .m-op,.own-prev .m-eq,.own-prev .m-bar{fill:currentColor}
.own-prev .m-x{fill:var(--blue);font-style:italic;font-weight:600}
.own-prev .m-paren{fill:none;stroke:currentColor;stroke-linecap:round}
.own-say{margin:0;font:400 .9em/1.3 var(--font-body);color:var(--soft);text-align:center}
.own-btns{display:flex;flex-wrap:wrap;gap:.5em;justify-content:flex-end}

/* tall frames (tablet, phone): the controls go under the stage, in a panel with a fixed height */
@container (orientation:portrait){
  .tool-body{flex-direction:column}
  #side{width:auto;height:11.6em;flex-direction:row;flex-wrap:wrap;align-content:flex-start;border-left:0;border-top:2px solid var(--ink);padding:.55em .7em .5em;gap:.55em 1.2em;overflow:auto;border-bottom:1.6em solid #fff}
  .bt-group,.bt-opts{flex-direction:row;flex-wrap:wrap;align-items:center}
  .bt-play{flex:1 1 100%;flex-wrap:nowrap}
  .bt-go{flex:1.3 1 auto}
  .bt-play .bt-row{flex:3 1 auto;flex-wrap:nowrap}
  .bt-more{border-top:0;padding-top:0}
}
/* a phone: smaller bar; the panel is a grid of six columns, the most used buttons first, and it scrolls */
@container (max-width:560px){
  .tool-bar{gap:.45em .5em;padding:.45em .5em}
  .tool-bar .ctl>.ctl-label{display:none}
  .tool-bar .seg .btn{padding:0 .5em}
  /* four full rows: Go back, Undo / Play all, Again, Build / Check, Ask me, Working / speed, Reset, Sound */
  #side{display:grid;grid-template-columns:repeat(12,1fr);align-content:start;height:auto;overflow:visible;gap:.42em;padding:.5em .5em .4em}
  .bt-group,.bt-row,.bt-tail{display:contents}
  #side .btn{padding:0 .4em;min-width:0}
  .bt-go{grid-column:span 8;order:1}
  .bt-undo{grid-column:span 4;order:2}
  #side .bt-play .bt-row>.btn:not(.bt-undo){grid-column:span 4;order:3}
  .bt-build{grid-column:span 4;order:4}
  .bt-check{grid-column:span 4;order:5}
  .bt-opts .toggle{grid-column:span 4;order:6;gap:.35em}
  .bt-speed>.ctl{grid-column:span 6;order:7;min-width:0}
  .bt-speed .seg{width:100%}
  .bt-speed .seg .btn{flex:1 1 0}
  .bt-speed .ctl-label{display:none}
  .bt-tail>*{grid-column:span 3;order:8;min-width:0}
  .bt-tail>.toggle{gap:.3em;padding:0 .3em;justify-content:center}
  #side{position:relative}
  #side .bt-ask{left:.5em;right:.5em;max-width:none;height:6.6em;flex-direction:column;align-items:stretch;justify-content:center;gap:.55em;padding:0 .6em 0 .75em;box-shadow:0 -.15em .6em rgba(20,26,34,.14)}
  #side .bt-ask-q{max-height:none;font-size:1em}
  .bt-ask-q,.bt-ask-q.hint{width:auto}
  .bt-ask-btns{justify-content:space-between}
  .bt-choice{flex:1 1 0;min-width:0}
  .own-card{padding:.6em .7em .8em}
  .own-n{display:none}
  .own-step{gap:.35em}
  .own-step .seg .btn{min-width:0;padding:0 .3em}
}
