/* Split Strategy */
/* the calculation: large steppers at the top (the same as Jump Strategy) */
.ss-calc{display:inline-flex;align-items:center;gap:.4em}
.ss-calc .stepper{font-size:1.1em}
.ss-calc .stepper input{width:3ch}
/* the operation: two round buttons, so that they do not look like the arrows of the number boxes */
.ss-calc .seg{gap:.28em}
.ss-calc .seg .btn,.ss-calc .seg .btn:first-child,.ss-calc .seg .btn:last-child{border-radius:50%;margin-left:0;width:max(1.95em,42px);height:max(1.95em,42px);
  min-height:0;min-width:0;padding:0;font-size:1.25em}
.ss-new .ss-row .seg .btn{min-width:40px}
.ss-eq{font:700 1.5em/1 var(--font-head);min-width:3.4ch;white-space:nowrap;font-variant-numeric:tabular-nums}

/* the controls at the side */
#side{width:19.8em;gap:.55em}
.ss-group{display:flex;flex-direction:column;gap:.42em}
.ss-row{display:flex;flex-wrap:wrap;align-items:center;gap:.42em}
.ss-row>.btn{flex:1 1 auto;padding:0 .6em}
.ss-next{font-size:1.12em;min-height:max(2.75em,46px)}
.ss-ico{width:1.15em;height:1.15em;flex:none}
.ss-speed .ctl,.ss-opts .ctl{flex-wrap:nowrap;justify-content:space-between}
.ss-speed .seg,.ss-opts .seg{flex:1}
.ss-speed .seg .btn,.ss-opts .seg .btn,.ss-new .seg .btn{flex:1 1 auto;padding:0 .5em}
.ss-opts>.toggle{justify-content:center}
.ss-new{border-top:2px solid var(--grid-strong);padding-top:.5em}
.ss-new .seg{display:flex}
.ss-new .ss-row .seg{flex:0 1 auto}
.ss-new .seg.ss-levels{display:grid;grid-template-columns:1fr 1fr}
.ss-levels .btn{margin:0;border-radius:0}
.ss-levels .btn:nth-child(2n){margin-left:-2px}
.ss-levels .btn:nth-child(n+3){margin-top:-2px}
.ss-levels .btn:nth-child(1){border-radius:.6em 0 0 0}
.ss-levels .btn:nth-child(2){border-radius:0 .6em 0 0}
.ss-levels .btn:nth-child(3){border-radius:0 0 0 .6em}
.ss-levels .btn:nth-child(4){border-radius:0 0 .6em 0}
.ss-tail{flex-direction:row;flex-wrap:wrap;gap:.42em}
.ss-tail:empty{display:none}

/* the stage: a caption over the blocks, and the written working beside them */
#stage{container:ss/size}
.ss-wrap{position:absolute;inset:0;display:flex;flex-direction:column}
.ss-cap{flex:none;display:flex;align-items:center;gap:.55em;min-height:2.7em;padding:.55em .8em 0;font-weight:700;font-size:1.08em;line-height:1.25}
.ss-count{flex:none;font-size:.74em;padding:.28em .65em;border:2px solid var(--ink);border-radius:999px;background:#fff;white-space:nowrap}
.ss-ask{color:#fff;background:var(--blue);border:2px solid var(--ink);border-radius:.7em;padding:.22em .7em;box-shadow:2px 2px 0 var(--ink)}
.ss-main{flex:1;min-height:0;display:flex}
.ss-blocks{flex:1;min-width:0;min-height:0;position:relative}
.ss-blocks>svg{position:absolute;inset:0;width:100%;height:100%;display:block}
.ss-record{flex:none;width:16.5em;margin:.55em .75em .9em 0;overflow:auto;position:relative;background:#fff;border:2px solid var(--ink);border-radius:.8em;
  box-shadow:3px 3px 0 var(--ink);padding:0 .6em .55em 1.25em;font-weight:700;font-variant-numeric:tabular-nums}
/* the red margin line of an exercise book */
.ss-record::before{content:"";position:absolute;left:.62em;top:0;bottom:0;width:2px;background:#f2a493}
.ss-rec-head{position:sticky;top:0;z-index:1;font-size:1.2em;padding:.38em .2em .2em;background:#fff;border-bottom:2px solid var(--ink)}
.ss-show .btn{padding:0 .7em}
.ss-lines{list-style:none;margin:0;padding:0;font-size:1.22em;line-height:1.3}
.ss-line{display:flex;flex-wrap:wrap;column-gap:.3em;padding:.24em .3em .24em 1.35em;border-bottom:1.5px solid var(--grid-strong)}
.ss-seg{display:inline-flex;gap:.3em;white-space:nowrap}
.ss-seg:first-child{margin-left:-1.1em}
.ss-line.now{background:var(--gold-tint)}
.ss-tk.p-h{color:var(--red)}
.ss-tk.p-t{color:var(--blue)}
.ss-tk.p-o{color:var(--green)}
.ss-tk.words{font-size:.92em}
.ss-tk.ans{background:var(--gold);border:2px solid var(--ink);border-radius:.3em;padding:0 .3em;margin:-.1em 0}
.ss-tk.q{color:var(--blue);background:#fff;border:2px dashed var(--blue);border-radius:.3em;padding:0 .5em;margin:-.1em 0}
.ss-hint{color:var(--soft);font-weight:600;font-size:.72em;line-height:1.35;padding:.5em .2em}
.ss-fresh{animation:ss-in .38s ease-out}
@keyframes ss-in{from{transform:translateY(.45em);opacity:0}to{transform:none;opacity:1}}
/* Show: Blocks hides the working; Numbers hides the blocks, and the working fills the stage */
.ss-wrap.only-blocks .ss-record{display:none}
.ss-wrap.only-numbers .ss-blocks{display:none}
.ss-wrap.only-numbers .ss-record{flex:1;width:auto;max-width:min(30em,94%);margin:.6em auto 1em;font-size:1.45em}
/* a tall or narrow stage: the working goes under the blocks */
@container ss (max-aspect-ratio:5/4){
  .ss-main{flex-direction:column}
  .ss-record{width:auto;height:clamp(6.9em,34%,15em);margin:0 .6em .6em}
  .ss-wrap.only-numbers .ss-record{height:auto;margin:.6em auto 1em}
}

/* the blocks, labels and cards */
#pic text{font-family:Lexend,Arial,sans-serif;font-weight:700;text-anchor:middle}
#pic .ss-shadow{fill:var(--ink);opacity:.13}
#pic .ss-lab{fill:var(--ink);paint-order:stroke;stroke:#fff;stroke-width:.18em;stroke-linejoin:round}
#pic .ss-lab.p-h{fill:var(--red)}
#pic .ss-lab.p-t{fill:var(--blue)}
#pic .ss-lab.p-o{fill:var(--green)}
#pic .ss-answer rect{fill:var(--gold);stroke:var(--ink);stroke-width:3}
#pic .ss-answer text{fill:var(--ink)}
#pic .ss-card rect{fill:#fff;stroke:var(--ink);stroke-width:2.5}
#pic .ss-card text{fill:var(--ink)}
#pic .ss-card.p-h text{fill:var(--red)}
#pic .ss-card.p-t text{fill:var(--blue)}
#pic .ss-card.p-o text{fill:var(--green)}
#pic .ss-card.used{opacity:.42}
#pic .ss-card.ss-active rect{fill:var(--gold-tint);stroke-width:3.5}
#pic .ss-strike{stroke:var(--ink);stroke-width:2.6;stroke-linecap:round}
#pic .ss-ring{fill:rgba(240,179,35,.13);stroke:var(--gold);stroke-width:3;stroke-dasharray:8 6}
#pic .ss-flash{fill:none;stroke:var(--gold);stroke-linejoin:round}
#pic .ss-going{filter:drop-shadow(0 0 1.5px #d9381e) drop-shadow(0 0 1.5px #d9381e) drop-shadow(0 0 5px rgba(217,56,30,.75))}
#pic .ss-count-bubble circle{fill:#fff;stroke:var(--ink);stroke-width:2.5}
#pic .ss-count-bubble text{fill:var(--ink)}
#pic .ss-fade{opacity:0;transition:opacity .25s}
#pic .ss-pop{transform-box:fill-box;transform-origin:50% 55%}
@media (prefers-reduced-motion:reduce){.ss-fresh{animation:none}#pic .ss-fade{transition:none}}

/* a message instead of the blocks */
.ss-msg{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max-content;max-width:min(30em,88%);margin:0;padding:.8em 1.1em;background:#fff;
  border:2px solid var(--ink);border-left:.5em solid var(--red);border-radius:.8em;font:600 1.15em/1.4 var(--font-head);text-align:center}

.ss-more{display:none}
/* tall frames (tablet, phone): the controls go under the stage, in a panel of a fixed height */
@container (orientation:portrait){
  .tool-body{flex-direction:column;position:relative}
  /* a panel that scrolls: an arrow under it while there is more below; after a scroll, the row that it cuts goes
     under a soft fade */
  .ss-more{display:block;position:absolute;left:2px;right:2px;bottom:0;height:1.6em;pointer-events:none}
  .ss-more::before{content:"";position:absolute;left:0;right:0;bottom:100%;height:1.7em;background:linear-gradient(rgba(255,255,255,0),#fff 80%)}
  .ss-more.top::before{display:none}
  .ss-more svg{position:absolute;left:50%;top:50%;width:1.2em;height:1.2em;margin:-.6em 0 0 -.6em;color:var(--ink);opacity:.7}
  .ss-more.off{display:none}
  #side{width:auto;height:12.6em;flex:none;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}
  .ss-group,.ss-opts{flex-direction:row;flex-wrap:wrap;align-items:center}
  .ss-play{flex:1 1 100%;flex-wrap:nowrap}
  .ss-next{flex:1.4 1 auto}
  .ss-play .ss-row{flex:3 1 auto;flex-wrap:nowrap}
  .ss-new{border-top:0;padding-top:0}
  .ss-new>.ctl-label{align-self:center}
  .ss-new .seg.ss-levels{display:flex}
  .ss-levels .btn{margin:0 0 0 -2px!important;border-radius:0!important}
  .ss-levels .btn:first-child{margin-left:0!important;border-radius:.6em 0 0 .6em!important}
  .ss-levels .btn:last-child{border-radius:0 .6em .6em 0!important}
}
/* a phone: a smaller calculation; the panel scrolls */
@container (max-width:560px){
  .tool-bar{gap:.45em .5em;padding:.45em .5em}
  .tool-bar>.spacer{display:none}
  .ss-calc{gap:.3em}
  .ss-calc .stepper{font-size:1em}
  .ss-calc .seg{gap:.2em}
  .ss-calc .seg .btn,.ss-calc .seg .btn:first-child,.ss-calc .seg .btn:last-child{width:40px;height:40px;font-size:1.1em}
  .ss-calc .stepper input{width:2.7ch;min-width:0;padding:0}
  .ss-eq{display:none}
  .ss-cap{font-size:.92em;padding:.45em .55em 0;min-height:2.4em}
  .ss-record{height:clamp(6.9em,30%,9em)}
  /* the panel shows two whole rows (the main buttons, then Predict and Show) and an arrow under them */
  #side{height:calc(2px + .5em + max(2.75em,46px) + .45em + max(2.5em,42px) + 3px + 1.6em);gap:.45em .6em;padding:.5em .5em .4em}
  .ss-play{flex-wrap:nowrap;gap:.35em}
  .ss-next{flex:1.3 1 auto;padding:0 .6em;font-size:1.05em}
  .ss-play .ss-row{flex:2 1 auto;flex-wrap:nowrap;gap:.35em}
  .ss-play .ss-row>.btn{padding:0 .45em}
  .ss-speed .ctl-label,.ss-new>.ctl-label,.ss-show>.ctl-label{display:none}
  .ss-group,.ss-opts,.ss-new .ss-row{flex:1 1 100%}
  .ss-opts{flex-wrap:nowrap}
  .ss-opts .ctl{flex:1 1 auto}
  .ss-opts{order:1}.ss-speed{order:2}.ss-new{order:3}.ss-tail{order:4}
  .ss-new .seg.ss-levels{display:grid;grid-template-columns:1fr 1fr}
  .ss-levels .btn:nth-child(1){border-radius:.6em 0 0 0!important}
  .ss-levels .btn:nth-child(2){border-radius:0 .6em 0 0!important;margin-left:-2px!important}
  .ss-levels .btn:nth-child(3){border-radius:0 0 0 .6em!important;margin:-2px 0 0 0!important}
  .ss-levels .btn:nth-child(4){border-radius:0 0 .6em 0!important;margin:-2px 0 0 -2px!important}
}
