.kz-fill {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  color: #0f172a;
}

.kz-fill__hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  font-weight: 800;
  font-size: 0.95rem;
}

.kz-fill__target strong {
  color: #ea580c;
}

.kz-fill__score.is-flash-score {
  color: #15803d;
  transition: color 0.2s ease;
}

.kz-fill__lives.is-flash-life {
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.kz-fill__stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 55%, #fef3c7 100%);
  min-height: 18rem;
}

.kz-fill__pic-wrap {
  width: min(100%, 14rem);
  aspect-ratio: 1;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.kz-fill__pic {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.kz-fill__cloze {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.25rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #0f172a;
}

.kz-fill__blank {
  display: inline-block;
  min-width: 1.1em;
  padding: 0 0.15em;
  margin: 0 0.05em;
  border-bottom: 4px solid #ea580c;
  color: transparent;
  text-align: center;
}

.kz-fill__blank--letter {
  min-width: 0.85em;
}

.kz-fill__blank--rime {
  min-width: 1.6em;
}

.kz-fill__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  width: 100%;
  max-width: 28rem;
}

.kz-fill__choice {
  min-width: 3.25rem;
  min-height: 3.25rem;
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 0.9rem;
  background: #fff;
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(15, 23, 42, 0.12);
  transition: transform 0.12s ease, background 0.12s ease;
}

.kz-fill__choice:hover,
.kz-fill__choice:focus-visible {
  transform: translateY(-2px);
  outline: 3px solid rgba(234, 88, 12, 0.35);
}

.kz-fill__choice.is-correct {
  background: #bbf7d0;
  color: #166534;
}

.kz-fill__choice.is-wrong {
  background: #fecaca;
  color: #991b1b;
  animation: kz-fill-shake 0.35s ease;
}

@keyframes kz-fill-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.kz-fill__float {
  position: absolute;
  left: 50%;
  top: 35%;
  transform: translate(-50%, 0);
  font-weight: 900;
  font-size: 1.25rem;
  pointer-events: none;
  animation: kz-fill-float 0.9s ease forwards;
  z-index: 5;
}

.kz-fill__float--score {
  color: #15803d;
}

.kz-fill__float--life {
  color: #b91c1c;
}

@keyframes kz-fill-float {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -40px);
  }
}

.kz-fill__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 1rem;
  z-index: 6;
}

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

.kz-fill__overlay-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
  max-width: 18rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
}

.kz-fill__overlay-title {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 900;
}

.kz-fill__overlay-score {
  margin: 0 0 0.85rem;
  font-weight: 800;
}

.kz-fill__restart {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  background: #ea580c;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.kz-letter-hub__play .kz-fill-mount,
.kz-letter-hub__play .kz-fill {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.kz-letter-hub__stage-inner:has(.kz-fill-mount),
.kz-letter-hub__stage-inner:has(.kz-fill) {
  align-items: stretch;
  justify-content: stretch;
}

.kz-letter-hub__play:has(.kz-fill) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kz-letter-hub__play .kz-fill__stage {
  min-height: 0;
  gap: 0.45rem;
  padding: 0.45rem;
  container-type: size;
  container-name: kz-fill-stage;
}

.kz-letter-hub__play .kz-fill__pic-wrap {
  /* Picture is the prompt — do not shrink it to a postage stamp. */
  width: min(100%, clamp(9rem, 58cqh, 15rem));
  min-width: min(100%, 9rem);
  min-height: 9rem;
  flex: 0 0 auto;
}

.kz-letter-hub__play .kz-fill__cloze,
.kz-letter-hub__play .kz-fill__choices {
  flex: 0 0 auto;
}

.kz-letter-hub__play .kz-fill__choice {
  min-width: clamp(2.4rem, 12cqh, 3.1rem);
  min-height: clamp(2.4rem, 12cqh, 3.1rem);
  font-size: clamp(1rem, 7cqh, 1.3rem);
  padding: 0.3rem 0.6rem;
}

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