/* Number Line */
#nl .nl-num,#nl .nl-meas,#nl text{font-family:Lexend,Arial,sans-serif;font-weight:700;font-variant-numeric:tabular-nums}
#nl .nl-meas{visibility:hidden}
#nl .nl-num{fill:var(--ink);pointer-events:none}
#nl .nl-num.nl-hl{fill:var(--teal)}
#nl .nl-axis{stroke:var(--ink);stroke-linecap:round;fill:none}
#nl .nl-lshadow{stroke:var(--ink);opacity:.08;stroke-linecap:round;fill:none}
#nl .nl-head{fill:var(--ink);stroke:var(--ink);stroke-width:1.5;stroke-linejoin:round}
#nl .nl-tick{stroke:var(--ink);stroke-linecap:round}
#nl .nl-pill{fill:var(--gold);stroke:var(--ink);stroke-width:2}
#nl .nl-cover{fill:#5b6573;stroke:var(--ink);stroke-width:2;pointer-events:none}
#nl .nl-taphit{fill:transparent;cursor:pointer;outline:none}
#nl .nl-taphit:hover{fill:rgba(31,111,209,.08)}
#nl .nl-taphit:focus-visible{stroke:var(--blue);stroke-width:3;fill:rgba(31,111,209,.08)}
#nl .nl-start{fill:var(--gold);stroke:var(--ink);stroke-width:2}
#nl .nl-hlbead{fill:var(--teal);stroke:var(--ink);stroke-width:2}
#nl .nl-arc-case{fill:none;stroke:var(--ink);stroke-linecap:round;opacity:.85}
#nl .nl-arc-line{fill:none;stroke-linecap:round}
#nl .nl-arc-head{stroke:var(--ink);stroke-width:1.5;stroke-linejoin:round}
#nl .nl-arc-label rect{fill:#fff;stroke-width:2}
#nl .nl-arc-label{pointer-events:none}

/* the counter */
#nl .nl-token{cursor:grab;outline:none}
#nl .nl-token:active{cursor:grabbing}
#nl .nl-tok-body{fill:var(--gold);stroke:var(--ink);stroke-width:2.5;stroke-linejoin:round}
#nl .nl-tok-hole{fill:#fff;stroke:var(--ink);stroke-width:2}
#nl .nl-tok-shadow{fill:var(--ink);opacity:.18}
#nl .nl-hit{fill:transparent}
#nl .nl-token:focus-visible .nl-tok-body{stroke:var(--blue);stroke-width:4}
#nl .nl-tok-in{transform-box:fill-box;transform-origin:50% 100%}
#nl .nl-tok-in.land{animation:nl-land .26s ease-out}
#nl .nl-tok-in.shake{animation:nl-shake .4s ease-in-out}
@keyframes nl-land{0%{transform:scale(1.14,.8)}55%{transform:scale(.95,1.06)}100%{transform:none}}
@keyframes nl-shake{0%,100%{transform:none}20%{transform:translateX(-5px)}40%{transform:translateX(5px)}60%{transform:translateX(-4px)}80%{transform:translateX(3px)}}
@media (prefers-reduced-motion:reduce){#nl .nl-tok-in.land,#nl .nl-tok-in.shake{animation:none}}

/* the walker */
#nl .nl-walker{cursor:grab;outline:none}
#nl .nl-walker *{vector-effect:non-scaling-stroke;stroke-linejoin:round}
#nl .nl-walker:focus-visible .nl-whead{stroke:var(--blue);stroke-width:4}
#nl .nl-wshadow{fill:var(--ink);opacity:.16}
#nl .nl-wlimb{fill:#5b37b0;stroke:var(--ink);stroke-width:2.2}
#nl .nl-leg-back .nl-wlimb{fill:#43278a}
#nl .nl-wboot{fill:#2b3440;stroke:var(--ink);stroke-width:2.2}
#nl .nl-wbody{fill:var(--purple);stroke:var(--ink);stroke-width:2.6}
#nl .nl-warrow{fill:var(--gold);stroke:var(--ink);stroke-width:2}
#nl .nl-whand{fill:#fff;stroke:var(--ink);stroke-width:2.2}
#nl .nl-wneck{fill:#5b6573;stroke:var(--ink);stroke-width:2}
#nl .nl-whead{fill:#fff;stroke:var(--ink);stroke-width:2.6}
#nl .nl-wnose{fill:var(--gold);stroke:var(--ink);stroke-width:2.2}
#nl .nl-wbolt{fill:var(--line);stroke:var(--ink);stroke-width:2}
#nl .nl-weye{fill:#fff;stroke:var(--ink);stroke-width:2.2}
#nl .nl-wpupil{fill:var(--ink)}
#nl .nl-wmouth{fill:none;stroke:var(--ink);stroke-width:2.2;stroke-linecap:round}
#nl .nl-wantenna{fill:none;stroke:var(--ink);stroke-width:2.6;stroke-linecap:round}
#nl .nl-wball{fill:var(--gold);stroke:var(--ink);stroke-width:2.2}
#nl .nl-bubble circle{fill:#fff;stroke:var(--ink);stroke-width:2.5}
#nl .nl-bubble text{fill:var(--ink)}

/* words on the stage */
.nl-say{position:absolute;left:.6em;right:.6em;text-align:center;pointer-events:none;font-family:var(--font-head);font-weight:700;color:var(--ink);font-variant-numeric:tabular-nums}
.nl-main{line-height:1.25;overflow:hidden}
.nl-sub{display:flex;flex-wrap:wrap;justify-content:center;gap:0 1.6em;margin-top:.2em;line-height:1.3;color:#39424e}
.nl-sub:empty{display:none}
.t-f{color:var(--blue)}
.t-b{color:var(--red)}
.nl-res{display:inline-block;min-width:1.2em;padding:0 .22em;border:.09em solid var(--ink);border-radius:.22em;background:var(--gold-tint);line-height:1.1}
.nl-res.q{background:#fff;color:var(--soft)}
.nl-soft{color:var(--soft);font-weight:600}
.nl-say.walk .nl-main{line-height:1.3}
.nl-stage{display:inline-grid;place-items:center;width:1.45em;height:1.45em;margin-right:.25em;border-radius:50%;border:2px solid var(--ink);background:var(--gold);font-size:.85em;vertical-align:.08em}
.nl-toast{position:absolute;top:.5em;left:50%;transform:translateX(-50%);max-width:calc(100% - 1.2em);padding:.45em .9em;border:2px solid var(--red);border-radius:.7em;background:#fff;color:#a62610;font:700 .95em/1.3 var(--font-head);text-align:center;box-shadow:3px 3px 0 rgba(20,26,34,.15);pointer-events:none;z-index:2}
.nl-toast.show{animation:nl-pop .22s ease-out}
@keyframes nl-pop{from{transform:translateX(-50%) scale(.92);opacity:0}}
@media (prefers-reduced-motion:reduce){.nl-toast.show{animation:none}}

/* the walker's rule and its question */
.nl-key{position:absolute;left:.6em;top:.6em;display:grid;grid-template-columns:auto auto;gap:.12em .7em;align-items:center;padding:.45em .7em .55em;border:2px solid var(--ink);border-radius:.7em;background:#fff;font:600 1em/1.25 var(--font-head);color:var(--ink);box-shadow:3px 3px 0 rgba(20,26,34,.1);pointer-events:none}
.nl-key .k-h{grid-column:1/-1;font-size:.82em;color:var(--soft);text-transform:uppercase;letter-spacing:.06em}
.nl-key .k-r{display:contents}
.nl-key .k-w{font-weight:700}
.nl-key .k-d{display:inline-flex;align-items:center;gap:.3em}
.k-pos{color:var(--blue)} .k-neg{color:var(--red)} .k-add{color:var(--green)} .k-sub{color:var(--orange)}
.nl-key .nl-ico{width:1.1em;height:1.1em}
.nl-eq{position:absolute;top:.35em;left:0;right:0;text-align:center;font:700 2.3em/1.25 var(--font-head);color:var(--ink);pointer-events:none;white-space:nowrap;font-variant-numeric:tabular-nums}
.nl-eq .e-pos{color:var(--blue)} .nl-eq .e-neg{color:var(--red)} .nl-eq .e-add{color:var(--green)} .nl-eq .e-sub{color:var(--orange)}

.nl-short{display:none}
.nl-ico{width:1.15em;height:1.15em;flex:none}
.nl-ico path{fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}

/* tool bar */
.nl-lines .seg .btn{padding:0 .7em}
/* in Walker only two lines and two tabs show: round the ends that show */
.nl-walk .nl-lines .seg .btn[data-value=n10],.nl-walk .nl-tabs .btn[data-value=walk]{border-radius:.6em 0 0 .6em;margin-left:0}
.nl-walk .nl-lines .seg .btn[data-value=n20]{border-radius:0 .6em .6em 0}

/* side panel */
#side{width:19em;gap:.55em}
.nl-tabs{display:flex}
.nl-tabs .btn{flex:1 1 auto;padding:0 .4em}
.nl-panel{display:flex;flex-direction:column;gap:.5em}
.nl-p-walk{gap:.42em}
.nl-panel>.ctl{justify-content:space-between}
.nl-panel .seg{display:flex}
.nl-panel .seg .btn{flex:1 1 auto;padding:0 .5em}
.nl-panel>.ctl>.seg{flex:1}
.nl-row{display:flex;gap:.5em;align-items:center}
.nl-row>.btn{flex:1}
.nl-jb{min-height:max(2.8em,46px);font-size:1.15em}
.nl-card{display:flex;flex-direction:column;gap:.45em;padding:.45em .6em .55em;border:2px solid var(--ink);border-radius:.8em;background:#fff}
.nl-card>.ctl{justify-content:space-between}
.nl-card-h{margin:0;font:600 .82em var(--font-head);color:var(--soft)}
.nl-zoom{flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:space-between}
.nl-nav{display:inline-flex;align-items:center;gap:.3em}
.nl-zr{min-width:5.2em;text-align:center;font-size:1em}
.nl-zr.off{color:var(--soft)}
.nl-nums{flex-direction:column;align-items:stretch}
.nl-nums .seg{display:grid;grid-template-columns:1fr 1fr}
.nl-nums .seg .btn{margin:0 0 0 -2px;border-radius:0}
.nl-nums .seg .btn:nth-child(n+3){margin-top:-2px}
.nl-nums .seg .btn:nth-child(odd){margin-left:0}
.nl-nums .seg .btn:nth-child(1){border-radius:.6em 0 0 0}
.nl-nums .seg .btn:nth-child(2){border-radius:0 .6em 0 0}
.nl-nums .seg .btn:nth-child(3){border-radius:0 0 0 .6em}
.nl-nums .seg .btn:nth-child(4){border-radius:0 0 .6em 0}
.nl-nums .seg .btn[hidden]+.btn{border-radius:0 0 .6em .6em;grid-column:1/-1;margin-left:0}
.nl-hint{margin:0;font:500 .85em/1.35 var(--font-head);color:var(--soft)}
.nl-hint:empty{display:none}
.nl-big{min-height:1.2em;display:grid;place-items:center;font:700 3em/1.15 var(--font-head);color:var(--teal);font-variant-numeric:tabular-nums;border:2px solid var(--ink);border-radius:.2em;background:#fff}
.nl-wide .stepper input{width:4.4ch}

/* a frame that is too narrow for one row: the line choice gets the second row to itself */
@container (max-width:1000px){
  .nl-lines{order:5;flex-basis:100%}
  .nl-lines>.seg{flex:1}
  .nl-lines .seg .btn{flex:1 1 auto;padding:0 .4em}
}
/* narrow or tall tool: the panel goes under the stage, and the controls flow in rows */
@container (max-width:680px) or (max-aspect-ratio:1/1){
  .tool-body{flex-direction:column}
  #side{width:auto;height:12em;flex:none;border-left:0;border-top:2px solid var(--ink);padding:.45em .5em;gap:.45em}
  .nl-panel{flex-direction:row;flex-wrap:wrap;align-items:center;gap:.45em .6em}
  .nl-panel>.ctl{justify-content:flex-start}
  .nl-panel>.btn{flex:1 1 auto}
  .nl-row{flex:1 1 auto}
  .nl-p-walk>.seg,.nl-p-eq>.seg{flex:1 1 auto}
  .nl-nums{flex-direction:row;align-items:center}
  .nl-nums .seg{display:flex}
  .nl-nums .seg .btn{margin:0 0 0 -2px!important;border-radius:0!important;grid-column:auto!important}
  .nl-nums .seg .btn:first-child{margin-left:0!important;border-radius:.6em 0 0 .6em!important}
  .nl-nums .seg .btn:last-child{border-radius:0 .6em .6em 0!important}
  .nl-card{display:contents}
  .nl-card-h{display:none}
  .nl-big{font-size:1.6em;min-width:3em;padding:0 .3em}
  .nl-hint{flex:1 1 12em}
}
@container (max-width:680px){
  .tool-bar{--nl-narrow:1;gap:.45em .5em;padding:.45em .5em}
  .nl-p-line>.nl-lines>.ctl-label,.nl-p-line .nl-hint{display:none}
  .nl-p-line>.nl-lines{order:-1}
  .tool-bar .ctl-label{display:none}
  .nl-lines{flex-basis:100%}
  .nl-lines .seg{display:grid;grid-template-columns:repeat(4,1fr);width:100%}
  .nl-lines .seg .btn{margin:0 0 0 -2px;border-radius:0;padding:0 .3em;font-size:.92em}
  .nl-lines .seg .btn:nth-child(4n+1){margin-left:0}
  .nl-lines .seg .btn:nth-child(n+5){margin-top:-2px}
  .nl-lines .seg .btn:first-child{border-radius:.6em 0 0 0}
  .nl-lines .seg .btn:nth-child(4){border-radius:0 .6em 0 0}
  .nl-lines .seg .btn:nth-child(5){border-radius:0 0 0 .6em}
  .nl-lines .seg .btn:last-child{border-radius:0 0 .6em 0}
  /* a fixed height for each tab (never one that follows the text, which would move the stage during a drag),
     with 1.5em of plain space under the lowest button. The Line tab of Jumps holds the seven lines and the custom line. */
  #side{height:15em}
  .tool-app[data-tab=line]:not(.nl-walk) #side{height:20.8em}
  .nl-long{display:none}
  .nl-short{display:inline}
  .nl-panel .stepper input{min-width:1.8em;width:3ch}
  .nl-panel .stepper button{width:40px}
  .nl-panel .ctl{gap:.3em}
  .nl-wide .stepper input{width:3.6ch}
  .nl-p-walk>.ctl>.ctl-label{display:none}
  .nl-panel{gap:.4em .45em}
  .nl-walk .nl-lines .seg{display:flex}
  .nl-walk .nl-lines .seg .btn{flex:1;margin-top:0}
  .tool-bar>.btn,.tool-bar>.seg .btn{padding:0 .65em}
  .nl-key{left:.4em;right:.4em;top:.4em;grid-template-columns:1fr 1fr;font-size:.8em;padding:.3em .55em;gap:.1em .8em}
  .nl-key .k-h{display:none}
  .nl-key .k-r{display:flex;gap:.35em;white-space:nowrap}
  .nl-eq{font-size:1.7em}
}
