/* Times Tables Drill */
.tt-scroll{overflow:auto;display:flex;flex-direction:column}
.tt-big{font-size:1.15em;padding:0 1.2em}
.tt-best{color:var(--soft)}
.tool-bar .readout{white-space:nowrap}

/* ---------- set-up ---------- */
.tt-setup-in{font-size:max(1em,min(3.4cqh,2.5cqw));width:100%;max-width:56em;margin:auto;padding:.9em 1.2em 1.4em;display:flex;flex-direction:column;gap:.55em}
.tt-head{display:flex;align-items:center;gap:.5em;margin-top:.3em}
.tt-head h2{font-size:1.2em;margin-right:auto}
.tt-chips{display:grid;grid-template-columns:repeat(6,1fr);gap:.5em}
.tt-chip{font-size:1.5em;min-height:max(2.1em,48px);border-radius:.45em;font-variant-numeric:tabular-nums}
.tt-chip[aria-pressed=true],.tt-type[aria-pressed=true]{background:var(--blue);color:#fff;box-shadow:.18rem .18rem 0 var(--ink)}
.tt-chip[aria-pressed=true]:hover,.tt-type[aria-pressed=true]:hover{background:var(--blue-ink)}
.tt-hint{margin:0;min-height:1.25em;color:var(--red);font-weight:600}
.tt-hint:empty{display:none}
.tt-types{display:grid;grid-template-columns:repeat(4,1fr);gap:.5em}
.tt-type{flex-direction:column;gap:.3em;min-height:4.4em;padding:.5em;white-space:normal;text-align:center}
.tt-type b{font-size:1.35em;white-space:nowrap}
.tt-type small{font:600 .8em var(--font-head)}

/* ---------- question ---------- */
.tt-qstage{display:flex;flex-direction:column;padding:1em 1em .8em}
.tt-timebar{position:absolute;left:0;right:0;top:0;height:1.1em;background:#fff;border-bottom:2px solid var(--ink)}
.tt-timebar i{display:block;height:100%;width:100%;background:var(--gold)}
.tt-timebar i.low{background:var(--red)}
.tt-timebar:not([hidden])~.tt-area{margin-top:.8em}
.tt-area{flex:1;min-height:0;width:100%;position:relative;container-type:size;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5em}
.tt-area.fb{justify-content:flex-start}
.tt-tag{position:absolute;top:0;left:50%;transform:translateX(-50%);margin:0;padding:.2em .8em;border-radius:999px;background:var(--gold-tint);border:2px solid var(--ink);font-weight:700;white-space:nowrap}
.tt-q{display:flex;align-items:center;gap:.22em;font-weight:700;line-height:1;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:min(12cqw,32cqh)}
.tt-area.fb .tt-q{font-size:min(9cqw,15cqh)}
.tt-op{color:var(--soft)}
.tt-box{display:inline-flex;align-items:center;justify-content:center;min-width:1.9ch;height:1.3em;padding:0 .16em;border:max(.05em,3px) solid var(--ink);border-radius:.16em;background:#fff;box-shadow:.05em .05em 0 var(--ink)}
.tt-box.empty::before{content:"?";color:#b4bfcc}
.tt-box.typing{border-color:var(--blue);box-shadow:0 0 0 .05em var(--blue-tint),.05em .05em 0 var(--ink)}
.tt-box.typing:not(.empty)::after{content:"";width:.06em;height:.85em;margin-left:.04em;background:var(--blue);animation:tt-blink 1s steps(1) infinite}
.tt-box.right{background:var(--green-tint);border-color:var(--green);color:var(--green)}
.tt-box.wrong{background:var(--red-tint);border-color:var(--red);color:var(--red)}
.tt-box.wrong s{text-decoration-thickness:.08em}
.tt-box.shown{background:var(--blue-tint);border-color:var(--blue);color:var(--blue-ink)}
.tt-fix{color:var(--green)}
@keyframes tt-blink{50%{opacity:0}}
@media (prefers-reduced-motion:reduce){.tt-box.typing::after{animation:none}}

/* feedback: the fact and the array */
.tt-fb{flex:1;min-height:0;width:100%;display:flex;flex-direction:column;gap:.3em}
.tt-msg{margin:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.3em .45em;font-weight:700;font-size:clamp(1em,7cqh,2.2em);line-height:1.1}
.tt-fact{font-variant-numeric:tabular-nums;white-space:nowrap}
.tt-fact b{color:var(--green)}
.tt-pill{display:inline-block;padding:.15em .6em;border-radius:999px;border:2px solid var(--ink);font-size:.8em;font-weight:700;white-space:nowrap}
.tt-pill.good{background:var(--green);color:#fff}
.tt-pill.bad{background:var(--red);color:#fff}
.tt-pill.gold{background:var(--gold);color:var(--ink);margin-left:.6em;vertical-align:middle;font-size:.7em}
.tt-turn{font-size:.5em}
.tt-array{flex:1;min-height:0;position:relative}
.tt-array>svg{position:absolute;inset:0;width:100%;height:100%;display:block}

/* ---------- number pad ---------- */
.tt-pad{width:min(32%,max(14em,42cqh + 3em));justify-content:center;padding:1em}
.tt-keys{display:grid;grid-template-columns:repeat(3,1fr);gap:.45em}
.tt-key{font-size:1.6em;min-height:max(2.1em,48px,min(11cqh,9cqw));padding:0;border-radius:.4em;font-variant-numeric:tabular-nums;box-shadow:.1rem .12rem 0 var(--ink);touch-action:manipulation}
.tt-key:active{transform:translate(.1rem,.12rem);box-shadow:none}
.tt-enter span{font-size:.62em}
.tt-del{width:1.05em;height:.8em}
.tt-pad.wait .tt-key,.tt-pad.next .tt-key:not(.tt-enter){opacity:.35}
.tt-pad.next .tt-enter{outline:3px solid var(--gold);outline-offset:2px}

/* ---------- class mode ---------- */
.tt-ringside{width:clamp(12em,24%,17em);align-items:center;justify-content:center;gap:1em}
.tt-ring{width:100%;max-width:11em;height:auto;flex:none}
.tt-ringside .btn{width:100%;max-width:11em}

/* ---------- end ---------- */
.tt-end-in{display:flex;gap:1.2em;height:100%;padding:.9em 1.2em;max-width:80em;margin:0 auto}
.tt-sum{flex:1;min-width:0;display:flex;flex-direction:column;gap:.55em}
.tt-sum h2{font-size:1.5em}
.tt-sum h3{font-size:1.05em;margin-top:.2em}
.tt-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(7.5em,1fr));gap:.5em}
.tt-tile{display:flex;flex-direction:column;gap:.1em;padding:.45em .7em;border:2px solid var(--ink);border-radius:.7em;background:#fff}
.tt-tile:first-child{background:var(--gold-tint)}
.tt-tile span{font-size:.8em;font-weight:600;color:var(--soft)}
.tt-tile b{font-size:1.9em;line-height:1.05;font-variant-numeric:tabular-nums}
.tt-tile small{font:500 .72em var(--font-head);color:var(--soft)}
.tt-miss{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:.4em}
.tt-miss li{display:flex;align-items:baseline;gap:.5em;padding:.3em .65em;border:2px solid var(--red);border-radius:.6em;background:var(--red-tint);font-weight:700;font-variant-numeric:tabular-nums}
.tt-miss b{color:var(--green)}
.tt-miss small{font-size:.72em;font-weight:500;color:var(--soft)}
.tt-none{margin:0;font-weight:600;color:var(--soft)}
.tt-legend{margin:0;display:flex;flex-wrap:wrap;align-items:center;gap:.3em .5em;font-size:.85em;font-weight:600;color:var(--soft)}
.tt-legend i{width:1.1em;height:1.1em;border-radius:.25em;border:1.5px solid var(--line);background:#fff;margin-left:.4em}
.tt-legend i:first-child{margin-left:0}
.tt-legend i.right{background:var(--green);border-color:var(--ink)}
.tt-legend i.wrong{background:var(--red);border-color:var(--ink)}
.tt-legend i.shown{background:var(--blue);border-color:var(--ink)}
.tt-gridwrap{flex:none;height:100%;aspect-ratio:1;max-width:52%}
.tt-gridwrap svg{display:block;width:100%;height:100%}

/* ---------- narrow frame (phone): the pad goes under the question, the ring above it ---------- */
@container (max-width:680px){
  .tt-chips{grid-template-columns:repeat(4,1fr)}
  .tt-types{grid-template-columns:repeat(2,1fr)}
  .tt-setup-in{padding:.6em .8em 1em}
  .tt-play{flex-direction:column}
  .tt-qstage{padding:.8em .6em .5em}
  .tt-pad{width:auto;border-left:0;border-top:2px solid var(--ink);padding:.6em .8em 1.6em}
  .tt-keys{width:100%;max-width:24em;margin:0 auto;gap:.4em}
  .tt-key{min-height:max(1.9em,46px)}
  .tt-ringside{order:-1;width:auto;flex-direction:row;border-left:0;border-bottom:2px solid var(--ink);padding:.5em .8em}
  .tt-ring{width:4.5em}
  .tt-ringside .btn{width:auto;flex:1}
  .tt-end-in{flex-direction:column;height:auto;padding:.7em .8em 1.2em}
  .tt-gridwrap{height:auto;width:100%;max-width:30em;margin:0 auto}
}
