/**
 * Math game extras (missing-number sequence + number-match dots).
 * Reuses shoot / fill / match chrome from sibling stylesheets.
 */

.kz-shoot--math .kz-shoot__progress {
  font-weight: 800;
  font-size: 0.85rem;
}

.kz-missing-number .kz-fill__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0.75rem 1.25rem;
}

.kz-missing__prompt {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
  text-align: center;
}

.kz-missing__seq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.15rem;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #0f172a;
}

.kz-missing__num {
  display: inline-flex;
  min-width: 2.1rem;
  justify-content: center;
}

.kz-missing__blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.45rem;
  border: 2px dashed #ea580c;
  background: #fff7ed;
  color: #ea580c;
  font-size: 1.4rem;
}

.kz-missing__sep {
  color: #94a3b8;
  font-weight: 700;
  margin-right: 0.15rem;
}

.kz-missing__choices {
  margin-top: 0.25rem;
}

.kz-missing-number--train .kz-missing__seq {
  gap: 0.2rem;
}

.kz-missing-number--train .kz-missing__car {
  min-width: 2.6rem;
  min-height: 2.8rem;
  border-radius: 0.55rem 0.55rem 0.35rem 0.35rem;
  border: 2px solid #7c2d12;
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 100%);
  color: #0f172a;
  box-shadow: 0 3px 0 #9a3412;
}

.kz-missing-number--train .kz-missing__blank {
  background: #fff7ed;
  border-style: dashed;
}

.kz-missing-number--train .kz-missing__blank.is-current {
  outline: 3px solid #ea580c;
}

.kz-math-fact-choice__prompt {
  font-size: 1.75rem;
  font-weight: 900;
}

.kz-math-fact-choice__choices {
  max-width: 20rem;
  margin: 0 auto;
}

.kz-math-fact-choice .kz-fill__hud {
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.kz-math-fact-choice .kz-fill__reset {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}

/* Isolate from match-word hub prompt|board grid so the dots column is not clipped. */
.kz-letter-hub__play:has(.kz-num-match),
.kz-letter-hub__play .kz-num-match,
.kz-num-match.kz-match {
  overflow: auto;
}

.kz-letter-hub__play-frame:has(.kz-num-match) {
  max-height: none;
  min-height: 22rem;
  overflow: auto;
}

.kz-letter-hub__play .kz-num-match .kz-match__stage,
.kz-num-match .kz-match__stage,
.kz-num-match__stage {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  grid-template-areas: none;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.55rem;
  overflow: auto;
  min-height: 14rem;
}

.kz-num-match__prompt {
  margin: 0;
  flex-shrink: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  color: #0f172a;
  line-height: 1.3;
}

.kz-num-match__reset {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}

.kz-num-match__board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(0.65rem, 2.5vw, 1.25rem);
  width: 100%;
  flex: 0 0 auto;
  min-height: 12rem;
  align-items: stretch;
}

.kz-num-match__col {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.kz-num-match__col-label {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}

.kz-num-match__num,
.kz-num-match__qty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 5.25rem;
  padding: 0.55rem 0.6rem;
  border: 3px solid #0f172a;
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 3px 0 rgba(15, 23, 42, 0.12);
  cursor: grab;
  touch-action: manipulation;
  font: inherit;
  color: inherit;
}

.kz-num-match__num {
  background: #fff7ed;
  border-color: #c2410c;
}

.kz-num-match__qty {
  background: #f0f9ff;
  border-color: #0369a1;
}

.kz-num-match__numeral {
  font-size: clamp(1.85rem, 5vw, 2.4rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  color: #0f172a;
}

.kz-num-match__num.is-selected,
.kz-num-match__qty.is-selected,
.kz-num-match__num.is-over,
.kz-num-match__qty.is-over {
  border-color: #ea580c;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.28);
}

.kz-num-match__num.is-matched,
.kz-num-match__qty.is-matched {
  border-color: #16a34a;
  background: #dcfce7;
  cursor: default;
}

.kz-num-match__qty.is-matched {
  opacity: 0.45;
  pointer-events: none;
}

.kz-num-match__num.is-wrong,
.kz-num-match__qty.is-wrong {
  border-color: #dc2626;
  background: #fee2e2;
  animation: kz-num-match-shake 0.35s ease;
}

@keyframes kz-num-match-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
  60% {
    transform: translateX(4px);
  }
}

.kz-num-match__dots {
  display: grid;
  grid-template-columns: repeat(5, 1.2rem);
  grid-template-rows: repeat(2, 1.2rem);
  gap: 0.42rem;
  justify-content: center;
}

.kz-num-match__dot {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  box-sizing: border-box;
}

.kz-num-match__dot.is-on {
  background: #0c4a6e;
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.25);
}

.kz-num-match__dot.is-off {
  background: #cbd5e1;
  box-shadow: inset 0 0 0 2px #475569;
}

.kz-num-match__num .kz-num-match__dots {
  grid-template-columns: repeat(5, 0.7rem);
  grid-template-rows: repeat(2, 0.7rem);
  gap: 0.22rem;
}

.kz-num-match__num .kz-num-match__dot {
  width: 0.7rem;
  height: 0.7rem;
}

.kz-play-rich.kz-num-match .kz-num-match__num {
  background: #fff7ed;
  border-width: 4px;
  border-radius: 1.1rem;
  min-height: 6rem;
  box-shadow: 0 5px 0 #fdba74;
}

.kz-play-rich.kz-num-match .kz-num-match__qty {
  background: #ecfeff;
  border-width: 4px;
  border-radius: 1.1rem;
  min-height: 6rem;
  box-shadow: 0 5px 0 #67e8f9;
}

.kz-play-rich.kz-num-match .kz-num-match__numeral {
  font-size: clamp(2.1rem, 6vw, 2.85rem);
}

.kz-play-rich.kz-num-match .kz-num-match__dots {
  grid-template-columns: repeat(5, 1.45rem);
  grid-template-rows: repeat(2, 1.45rem);
  gap: 0.48rem;
}

.kz-play-rich.kz-num-match .kz-num-match__dot {
  width: 1.45rem;
  height: 1.45rem;
}

.kz-play-rich.kz-num-match .kz-num-match__dot.is-on {
  background: radial-gradient(circle at 30% 30%, #fda4af, #e11d48 62%);
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.2);
}

.kz-play-rich.kz-num-match .kz-num-match__prompt {
  background: rgba(255, 255, 255, 0.92);
  padding: 0.45rem 0.75rem;
  border-radius: 0.85rem;
}

.kz-num-match--count .kz-num-match__stage {
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.kz-num-match__count-pile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  width: min(100%, 22rem);
  min-height: 7.5rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 1.25rem;
  box-shadow: 0 8px 0 rgba(15, 23, 42, 0.08);
}

.kz-num-match__count-item {
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1;
  animation: kz-count-pop 0.35s ease;
}

.kz-num-match__count-item--dots {
  color: #e11d48;
}

.kz-num-match__count-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.kz-num-match__count-choice {
  min-width: 4.2rem;
  min-height: 4.2rem;
  border: 0;
  border-radius: 1.2rem;
  background: #fff7ed;
  box-shadow: 0 6px 0 #fdba74;
  font-size: 2.1rem;
  font-weight: 900;
  color: #0f172a;
  cursor: pointer;
}

.kz-num-match__count-choice.is-correct {
  background: #dcfce7;
  box-shadow: 0 6px 0 #86efac;
}

.kz-num-match__count-choice.is-wrong {
  background: #fee2e2;
  box-shadow: 0 6px 0 #fca5a5;
}

@keyframes kz-count-pop {
  from {
    transform: scale(0.6);
    opacity: 0.4;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kz-num-match__count-item {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kz-num-match__num.is-wrong,
  .kz-num-match__qty.is-wrong {
    animation: none;
  }
}

@media (max-width: 900px) {
  .kz-letter-hub__play-frame:has(.kz-num-match) {
    min-height: 24rem;
  }

  .kz-num-match .kz-match__hud {
    font-size: 0.72rem;
    padding: 0.28rem 0.4rem;
  }

  .kz-num-match__num,
  .kz-num-match__qty {
    min-height: 4.15rem;
    padding: 0.4rem 0.4rem;
  }

  .kz-play-rich.kz-num-match .kz-num-match__num,
  .kz-play-rich.kz-num-match .kz-num-match__qty {
    min-height: 4.6rem;
    box-shadow: 0 3px 0 #fdba74;
  }

  .kz-play-rich.kz-num-match .kz-num-match__qty {
    box-shadow: 0 3px 0 #67e8f9;
  }

  .kz-play-rich.kz-num-match .kz-num-match__numeral {
    font-size: clamp(1.6rem, 8vw, 2.1rem);
  }

  .kz-play-rich.kz-num-match .kz-num-match__dots {
    grid-template-columns: repeat(5, 1.05rem);
    grid-template-rows: repeat(2, 1.05rem);
    gap: 0.28rem;
  }

  .kz-play-rich.kz-num-match .kz-num-match__dot {
    width: 1.05rem;
    height: 1.05rem;
  }

  .kz-num-match__dots {
    grid-template-columns: repeat(5, 0.95rem);
    grid-template-rows: repeat(2, 0.95rem);
    gap: 0.3rem;
  }

  .kz-num-match__dot {
    width: 0.95rem;
    height: 0.95rem;
  }
}

/* Count mode (tap the number): pictures centered on top, choices underneath.
   The hub match grid otherwise pins a narrow pile to the top-left. */
.kz-letter-hub__play .kz-num-match--count .kz-match__stage,
.kz-num-match--count .kz-num-match__stage {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  grid-template-areas: none;
  align-items: center;
  justify-content: flex-start;
  gap: 1.15rem;
  width: 100%;
  padding: 0.65rem 1rem 1.15rem;
  box-sizing: border-box;
}

.kz-letter-hub__play .kz-num-match--count .kz-num-match__prompt,
.kz-num-match--count .kz-num-match__prompt {
  align-self: center;
  width: min(100%, 36rem);
  text-align: center;
}

.kz-letter-hub__play .kz-num-match--count .kz-num-match__count-pile,
.kz-num-match--count .kz-num-match__count-pile {
  align-self: center;
  width: min(100%, 36rem);
  min-height: 11rem;
  margin-inline: auto;
  justify-content: center;
  align-content: center;
  gap: 0.75rem 1rem;
  padding: 1.35rem 1.5rem;
}

.kz-num-match--count .kz-num-match__count-item {
  font-size: clamp(3.75rem, 12vw, 5.75rem);
}

.kz-letter-hub__play .kz-num-match--count .kz-num-match__count-choices,
.kz-num-match--count .kz-num-match__count-choices {
  align-self: center;
  width: min(100%, 36rem);
  justify-content: center;
  margin-inline: auto;
}

.kz-num-match--count .kz-num-match__count-choice {
  min-width: 4.75rem;
  min-height: 4.75rem;
  font-size: 2.35rem;
}

.kz-num-match__cheer {
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: min(100%, 22rem);
  margin: 0;
  padding: 0.55rem 1rem;
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 6px 0 rgba(15, 23, 42, 0.08);
  pointer-events: none;
  text-align: left;
  animation: kz-count-cheer 0.28s ease;
}

.kz-num-match__cheer[hidden] {
  display: none !important;
}

.kz-num-match__cheer.is-yes {
  background: #f0fdf4;
  box-shadow: 0 8px 0 #86efac;
}

.kz-num-match__cheer.is-no {
  background: #fff1f2;
  box-shadow: 0 8px 0 #fecdd3;
}

.kz-num-match__cheer-face {
  font-size: 2.75rem;
  line-height: 1;
}

.kz-num-match__cheer-words {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.2;
  color: #0f172a;
}

@keyframes kz-count-cheer {
  from {
    transform: scale(0.86);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kz-num-match__cheer {
    animation: none;
  }
}

.kz-math-cheer {
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: min(100%, 22rem);
  margin: 0.35rem auto;
  padding: 0.55rem 1rem;
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 6px 0 rgba(15, 23, 42, 0.08);
  pointer-events: none;
  text-align: left;
  animation: kz-count-cheer 0.28s ease;
  z-index: 2;
}

.kz-math-cheer[hidden] {
  display: none !important;
}

.kz-math-cheer.is-yes {
  background: #f0fdf4;
  box-shadow: 0 8px 0 #86efac;
}

.kz-math-cheer.is-no {
  background: #fff1f2;
  box-shadow: 0 8px 0 #fecdd3;
}

.kz-math-cheer__face {
  font-size: 2.75rem;
  line-height: 1;
}

.kz-math-cheer__words {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.2;
  color: #0f172a;
}

@media (prefers-reduced-motion: reduce) {
  .kz-math-cheer {
    animation: none;
  }
}

.kz-pic-row,
.kz-which-row,
.kz-shape-row,
.kz-line-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: flex-end;
  margin: 0.75rem 0;
}

.kz-pic-group,
.kz-which-card,
.kz-line-pile {
  min-width: 5.5rem;
  min-height: 4.5rem;
  padding: 0.5rem;
  border-radius: 1rem;
  background: #fff;
  border: 3px solid #bae6fd;
}

.kz-pic-dots,
.kz-line-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  max-width: 8rem;
}

.kz-pic-dot {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #38bdf8;
}

.kz-math-pic-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: center;
  max-width: 14rem;
}

.kz-math-pic {
  width: 3.25rem;
  height: 3.25rem;
  flex: 0 0 auto;
}

.kz-which-card .kz-math-pic {
  width: auto;
  height: auto;
  max-width: 8rem;
  max-height: 8rem;
}

.kz-math-pic.is-gone {
  opacity: 0.28;
}

.kz-pic-dot.is-gone {
  background: transparent;
  border: 3px solid #94a3b8;
  position: relative;
}

.kz-pic-dot.is-gone::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 3px solid #64748b;
  transform: rotate(-20deg);
}

.kz-pic-plus {
  align-self: center;
  font-size: 2rem;
  font-weight: 900;
}

.kz-which-card,
.kz-line-pile,
.kz-shape-btn {
  cursor: pointer;
  font: inherit;
}

.kz-which-card.is-wrong,
.kz-line-pile.is-wrong,
.kz-shape-btn.is-wrong,
.kz-fill__choice.is-wrong {
  outline: 3px solid #fb7185;
}

.kz-shape-glyph {
  width: 6.75rem;
  height: 6.75rem;
  display: block;
}

.kz-shape-strip {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 0.75rem 0;
}

.kz-shape-cell {
  width: 7.25rem;
  height: 7.25rem;
  display: grid;
  place-items: center;
  border-radius: 1rem;
  background: #fff;
  border: 3px solid #e2e8f0;
}

.kz-shape-strip .kz-shape-cell {
  width: 5.25rem;
  height: 5.25rem;
}

.kz-shape-strip .kz-shape-glyph {
  width: 4.75rem;
  height: 4.75rem;
}

.kz-shape-park__stage {
  position: relative;
  background: linear-gradient(#7dd3fc 0%, #bae6fd 42%, #bbf7d0 100%);
  border-radius: 1.25rem;
  padding: 0.75rem 0.5rem 1rem;
  overflow: hidden;
}

.kz-shape-sun {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: #fde68a;
  box-shadow: 0 0 0 0.45rem rgba(253, 230, 138, 0.45);
}

.kz-shape-ask {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.25rem 0 0.5rem;
}

.kz-shape-ask .kz-game-prompt {
  margin: 0;
}

.kz-shape-hear {
  min-width: 4.75rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.kz-shape-park .kz-shape-row,
.kz-shape-park .kz-shape-strip {
  position: relative;
  z-index: 1;
}

.kz-shape-btn.is-wrong {
  background: #ffe4e6;
  border-color: #e11d48;
  outline: 3px solid #e11d48;
  cursor: not-allowed;
}

.kz-shape-btn:disabled {
  pointer-events: none;
}

.kz-shape-blank {
  font-size: 1.75rem;
  font-weight: 900;
  color: #0f172a;
}

.kz-compare-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  align-items: flex-end;
  margin: 0.75rem 0;
}

.kz-compare-card {
  flex: 1 1 12rem;
  max-width: 20rem;
  padding: 0.35rem;
  border: 3px solid #bae6fd;
  border-radius: 1.25rem;
  background: #fff;
  cursor: pointer;
  font: inherit;
}

.kz-compare-pic {
  display: block;
  width: 100%;
  height: 13rem;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 1rem;
  background: #e0f2fe;
}

.kz-compare-card.is-small .kz-compare-pic {
  height: 8.25rem;
}

.kz-compare-card.is-big .kz-compare-pic {
  height: 15.5rem;
}

.kz-compare-card.is-length-short {
  flex: 0.55 1 8rem;
  max-width: 11rem;
}

.kz-compare-card.is-length-long {
  flex: 1.4 1 16rem;
  max-width: 22rem;
}

.kz-compare-card.is-length-short .kz-compare-pic,
.kz-compare-card.is-length-long .kz-compare-pic {
  height: 9.5rem;
}

.kz-compare-card.is-height-short .kz-compare-pic {
  height: 8rem;
}

.kz-compare-card.is-height-tall .kz-compare-pic {
  height: 16rem;
}

.kz-compare-card.is-wrong {
  background: #ffe4e6;
  border-color: #e11d48;
  outline: 4px solid #e11d48;
  cursor: not-allowed;
}

.kz-scene-pic {
  display: block;
  width: 100%;
  max-width: 16rem;
  height: 11rem;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 1rem;
  background: #e0f2fe;
}

.kz-pic-group.is-left {
  outline: 4px solid #22c55e;
  border-radius: 1.25rem;
}

.kz-shape-btn .kz-scene-pic,
.kz-shape-cell .kz-scene-pic {
  height: 7.5rem;
  max-width: 9rem;
  margin: 0 auto;
}

.kz-num-match__count-pile .kz-scene-pic {
  height: 13rem;
  max-width: 18rem;
  margin: 0 auto;
}

.kz-line-pile .kz-scene-pic {
  height: 8.5rem;
}

/* Phone only. Desktop keeps the tall hub stage and the sized match container. */
@media (max-width: 900px) {
  .kz-letter-hub__play:has(.kz-num-match--count),
  .kz-letter-hub__stage:has(.kz-num-match--count) {
    height: auto;
    min-height: 38rem;
    overflow: visible;
  }

  .kz-letter-hub__play .kz-num-match--count,
  .kz-letter-hub__play .kz-num-match--count .kz-match__stage {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    flex: 0 0 auto;
    container-type: normal;
  }
}
