/* Visual hints: Zwanzigerfeld, dot arrays, guided steps. Uses the palette tokens from base.css. */
.hint {
  --h-c1: #8ccfe8;
  --h-c1-d: #4fa8cc;
  --h-c1-t: #2a7fa5;
  --h-c2: #f6b98f;
  --h-c2-d: #e48a55;
  --h-c2-t: #c05a24;
  --h-ok: #8fd8c2;
  --h-ok-d: #3fae91;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 14px 18px 16px;
  color: var(--ink);
  font-family: var(--font-nunito, "Nunito", sans-serif);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hint *, .hint *::before, .hint *::after { box-sizing: border-box; }

.hint-title {
  margin: 0;
  text-align: center;
  font: 700 28px/1.2 var(--font-fredoka, "Fredoka", sans-serif);
  color: var(--lavender-dark, #7357bf);
}

.hint-stage {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hv {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.hv-svg {
  flex: 1 1 0;
  min-height: 90px;
  width: 100%;
  max-height: 440px;
  overflow: visible;
}

/* dots */
.hv .dot .body { fill: var(--h-c1); stroke: var(--h-c1-d); stroke-width: 3; }
.hv .dot.c2 .body { fill: var(--h-c2); stroke: var(--h-c2-d); }
.hv .dot.slot .body { fill: #f5f1fb; stroke: var(--line, #ded7eb); stroke-width: 2.5; }
.hv .dot .shine { fill: #fff; opacity: 0.55; }
.hv .dot { transform-box: fill-box; transform-origin: center; }

.hv .panel { fill: #fff; stroke: var(--line, #ded7eb); stroke-width: 3; filter: drop-shadow(0 5px 0 rgb(48 42 67 / 0.06)); }
.hv .tray { fill: rgb(246 185 143 / 0.14); stroke: var(--h-c2-d); stroke-width: 2.5; stroke-dasharray: 3 11; stroke-linecap: round; transition: opacity 0.5s; }
.hv .tray.is-off { opacity: 0; }
.hv .ten-glow { fill: none; stroke: var(--h-ok-d); stroke-width: 4; opacity: 0; transition: opacity 0.6s; }
.hv .ten-glow.is-on { opacity: 0.55; }

.hv .grp { transition: transform 1s cubic-bezier(0.55, 0, 0.2, 1), opacity 0.35s ease; }

/* missing group */
.hv .gap-group { fill: rgb(246 185 143 / 0.22); stroke: var(--h-c2-d); stroke-width: 3.5; stroke-dasharray: 2 10; stroke-linecap: round; animation: hv-breathe 2.2s ease-in-out infinite; transition: opacity 0.5s; }
.hv .gap-group.is-off { opacity: 0; animation: none; }
.hv .caption { font: 700 30px var(--font-fredoka, "Fredoka", sans-serif); fill: var(--h-c2-t); transition: opacity 0.5s; }
.hv .caption.is-off { opacity: 0; }
.hv .dot.fill { opacity: 0; transform: scale(0.4); transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1); }
.hv .dot.fill.is-on { opacity: 1; transform: scale(1); }

/* arrays */
.hv-dots .grp { opacity: 0; }
.hv-dots .grp.is-on { opacity: 1; }
.hv-dots .grp.added { transform: translateX(70px); }
.hv-dots .grp.added.is-on { transform: translateX(0); }
.hv .halo { fill: rgb(140 207 232 / 0.2); stroke: var(--h-c1-d); stroke-width: 2.5; stroke-dasharray: 3 9; stroke-linecap: round; }
.hv .grp.added .halo { fill: rgb(246 185 143 / 0.2); stroke: var(--h-c2-d); }
.hv .lbl { font: 700 32px var(--font-fredoka, "Fredoka", sans-serif); opacity: 0; transition: opacity 0.5s ease; }
.hv .lbl.is-on { opacity: 1; }
.hv .lbl.c1 { fill: var(--h-c1-t); }
.hv .lbl.c2 { fill: var(--h-c2-t); }

/* cue: soft pulse + the correct value on the picture */
.hv .is-cue .body, .hv .is-cue.body { animation: hv-breathe 1.2s ease-in-out infinite; }
.hv .is-cue-all .dot.c1 .body, .hv .is-cue-all .dot.c2 .body { animation: hv-breathe 1.2s ease-in-out infinite; }
.hv .is-cue.gap-group { stroke-width: 6; }
.hv .cue-badge { opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.hv .cue-badge.is-on { opacity: 1; }
.hv .cue-badge rect { fill: #fff6cf; stroke: #f2c14e; stroke-width: 3.5; }
.hv .cue-badge text { font: 700 30px var(--font-fredoka, "Fredoka", sans-serif); fill: #6a5214; }
@keyframes hv-breathe {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 7px rgb(242 193 78 / 0.95)); }
}
.hv .is-done .dot .body { animation: hv-pop 0.7s ease both; }
@keyframes hv-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* equation line */
.hv-eq {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  font: 700 44px/1.1 var(--font-fredoka, "Fredoka", sans-serif);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.hv-eq.is-on { opacity: 1; transform: none; }
.eq-n.c1 { color: var(--h-c1-t, #2a7fa5); }
.eq-n.c2 { color: var(--h-c2-t, #c05a24); }
.eq-n.total { color: var(--ink); }
.eq-t { color: var(--ink-soft, #615977); }

/* rule */
.rule-card { padding: 34px 40px; border-radius: 40px; background: #fff; border: 3px solid var(--line, #ded7eb); box-shadow: var(--shadow-sm); text-align: center; position: relative; }
.rule-eq { display: flex; gap: 16px; justify-content: center; font: 700 72px/1.1 var(--font-fredoka, "Fredoka", sans-serif); opacity: 0.25; transition: opacity 0.6s; }
.rule-card.is-on .rule-eq { opacity: 1; }
.rule-cue { margin-top: 10px; min-height: 0; display: none; padding: 6px 22px; border-radius: 22px; background: #fff6cf; border: 3px solid #f2c14e; font: 700 32px var(--font-fredoka, "Fredoka", sans-serif); }
.rule-cue.is-on { display: inline-block; }

/* text */
.hint-lines { display: flex; flex-direction: column; gap: 6px; min-height: 104px; text-align: center; }
.hint-line { margin: 0; font: 700 26px/1.3 var(--font-nunito, "Nunito", sans-serif); opacity: 0; transform: translateY(8px); transition: opacity 0.6s ease, transform 0.6s ease; }
.hint-line.is-on { opacity: 1; transform: none; }

.hint-actions { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 4px; }
.hint-done {
  min-width: 260px; min-height: 76px; padding: 0 36px; border: 0; border-radius: 38px;
  background: var(--mint, #8fd8c2); color: #14513f; font: 700 32px var(--font-fredoka, "Fredoka", sans-serif);
  box-shadow: 0 6px 0 #5fb79f, 0 14px 26px rgb(48 42 67 / 0.14); cursor: pointer; opacity: 0.55; transition: opacity 0.5s, transform 0.12s;
}
.hint-done.is-ready { opacity: 1; animation: hv-nudge 2.4s ease-in-out 1s infinite; }
.hint-done:active { transform: translateY(4px); box-shadow: 0 2px 0 #5fb79f; }
@keyframes hv-nudge { 0%, 90%, 100% { transform: none; } 95% { transform: scale(1.04); } }
.hint-replay { min-height: 64px; min-width: 64px; padding: 0 22px; border: 3px solid var(--line, #ded7eb); border-radius: 32px; background: #fff; color: var(--ink-soft, #615977); font: 700 22px var(--font-nunito, "Nunito", sans-serif); cursor: pointer; }

/* guided */
.hint-progress { display: flex; gap: 10px; justify-content: center; }
.hint-pip { width: 14px; height: 14px; border-radius: 50%; background: var(--line, #ded7eb); transition: background 0.4s, transform 0.4s; }
.hint-pip.is-now { background: var(--lavender, #b8a1f7); transform: scale(1.3); }
.hint-pip.is-done { background: var(--h-ok-d); }
.hint--guided .hint-stage { flex: 1 1 0; }
.hint-prompt { margin: 0; text-align: center; font: 700 24px/1.25 var(--font-nunito, "Nunito", sans-serif); min-height: 30px; }
.hint-note { margin: 0; min-height: 28px; text-align: center; font: 700 22px var(--font-nunito, "Nunito", sans-serif); color: #8a6a12; opacity: 0; transition: opacity 0.4s; }
.hint-note.is-on { opacity: 1; }
.hint-eqrow { display: flex; align-items: center; justify-content: center; gap: 14px; font: 700 48px/1 var(--font-fredoka, "Fredoka", sans-serif); min-height: 84px; }
.hint-box {
  display: inline-flex; align-items: center; justify-content: center; min-width: 96px; height: 78px; padding: 0 14px;
  border-radius: 24px; background: #fff; border: 4px solid var(--lavender, #b8a1f7); color: var(--ink);
  box-shadow: inset 0 3px 0 rgb(48 42 67 / 0.05); transition: background 0.3s, border-color 0.3s;
}
.hint-box.is-empty::after { content: ""; width: 4px; height: 40px; border-radius: 2px; background: var(--lavender, #b8a1f7); animation: hv-caret 1.1s steps(2) infinite; }
@keyframes hv-caret { 50% { opacity: 0; } }
.hint-box.is-prefilled { min-width: 78px; background: #f3f0fb; border-style: solid; border-color: var(--line, #ded7eb); }
.hint-box.is-prefilled.c2 { color: var(--h-c2-t); }
.hint-box.is-soft { background: #fff3c4; border-color: #f2c14e; animation: hv-soft 0.8s ease; }
@keyframes hv-soft { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.06); } }
.hint-box.is-ok { background: #dff6ee; border-color: var(--h-ok-d); color: #14513f; animation: hv-soft 0.6s ease; }

.hk-pad { display: grid; grid-template-columns: repeat(3, 80px); gap: 10px; justify-content: center; padding-top: 4px; }
.hk {
  width: 80px; height: 80px; padding: 0; border: 3px solid var(--line, #ded7eb); border-radius: 26px; background: #fff; color: var(--ink);
  font: 700 38px var(--font-fredoka, "Fredoka", sans-serif); box-shadow: 0 5px 0 rgb(48 42 67 / 0.12); cursor: pointer; transition: transform 0.08s, box-shadow 0.08s;
}
.hk:active { transform: translateY(4px); box-shadow: 0 1px 0 rgb(48 42 67 / 0.12); }
.hk-back { background: #f3f0fb; color: var(--ink-soft, #615977); }
.hk-ok { background: var(--mint, #8fd8c2); border-color: #5fb79f; color: #14513f; }

/* compact: phones and short containers */
@media (max-width: 520px), (max-height: 760px) {
  .hint { padding: 10px 12px 12px; gap: 6px; }
  .hint-title { font-size: 22px; }
  .hint-line { font-size: 22px; }
  .hint-lines { min-height: 72px; }
  .hv-eq { font-size: 36px; min-height: 44px; }
  .hint-eqrow { font-size: 40px; min-height: 66px; gap: 10px; }
  .hint-box { height: 64px; min-width: 80px; }
  .hint-prompt { font-size: 20px; min-height: 26px; }
  .hint-note { font-size: 18px; min-height: 22px; }
  .hk-pad { gap: 8px; }
  .rule-eq { font-size: 52px; }
}

.hint.is-reduced .grp, .hint.is-reduced .dot.fill, .hint.is-reduced .hv-eq, .hint.is-reduced .hint-line { transition: opacity 0.5s ease; transform: none; }
.hint.is-reduced .hv-dots .grp.added { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .hint .hint-done.is-ready, .hint .hv .gap-group { animation: none; }
}

/* guided: the picture needs the height, the title is kept for screen readers only */
.hint--guided .hint-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hint--guided { position: relative; padding-top: 12px; }
.hint-eqrow { min-height: 78px; }
.hint-note { min-height: 24px; }

.hint-line, .hint-prompt { text-wrap: balance; }
.hint-actions { flex-wrap: wrap; }
@media (max-width: 520px) {
  .hint-done { min-width: 0; flex: 1 1 auto; min-height: 68px; font-size: 28px; padding: 0 22px; }
  .hint-replay { min-height: 64px; padding: 0 16px; }
}
.hint--guided .hv-eq { display: none; }

.hint-wrap { width: 100%; height: 100%; min-height: 0; container-type: size; }

/* guided on a wide, short container: keypad moves to the right so the picture keeps its size */
@container (min-width: 600px) and (max-height: 820px) {
  .hint--guided {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    column-gap: 20px;
    row-gap: 6px;
    align-items: center;
  }
  .hint--guided .hint-progress { grid-column: 1; grid-row: 1; }
  .hint--guided .hint-stage { grid-column: 1; grid-row: 2; height: 100%; }
  .hint--guided .hint-prompt { grid-column: 1; grid-row: 3; }
  .hint--guided .hint-note { grid-column: 1; grid-row: 4; }
  .hint--guided .hint-eqrow { grid-column: 1; grid-row: 5; font-size: 44px; gap: 8px; }
  .hint--guided .hk-pad { grid-column: 2; grid-row: 1 / 6; align-self: center; }
}
